diff --git a/.gitattributes b/.gitattributes index a016a1ef98d9f541ced933a7b1f8d27c871e1509..d846cba53b920f2e5d54fbdb282201932d60e85c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1873,3 +1873,63 @@ rupeeroom/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold rupeeroom/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf filter=lfs diff=lfs merge=lfs -text rupeeroom/display-app/brand-hero.png filter=lfs diff=lfs merge=lfs -text rupeeroom/display-app/brand-logo.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/brand-hero.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/owner-app/brand-logo.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/brand-hero.png filter=lfs diff=lfs merge=lfs -text +rupeeroom/staff-app/brand-logo.png filter=lfs diff=lfs merge=lfs -text diff --git a/rupeeroom/owner-app/_expo/static/js/web/index-c7e2d26b899345aed640aa075a97d318.js b/rupeeroom/owner-app/_expo/static/js/web/index-c7e2d26b899345aed640aa075a97d318.js new file mode 100644 index 0000000000000000000000000000000000000000..3884ebc31e047312ac02366193dbc8dd958ef27f --- /dev/null +++ b/rupeeroom/owner-app/_expo/static/js/web/index-c7e2d26b899345aed640aa075a97d318.js @@ -0,0 +1,63 @@ +__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,881,806,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OwnerApp",{enumerable:!0,get:function(){return n.OwnerApp}});var n=r(d[0])},881,[882]); +__d(function(g,_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.OwnerApp=function(){return(0,re.isDesktop)()?(0,ie.jsx)(ne.DesktopShell,{}):(0,ie.jsx)(ce,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),l=_r(d[5]),a=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),j=e(_r(d[14])),y=e(_r(d[15])),w=e(_r(d[16])),S=e(_r(d[17])),R=e(_r(d[18])),C=e(_r(d[19])),k=_r(d[20]),T=_r(d[21]),A=_r(d[22]),L=_r(d[23]),I=_r(d[24]),v=_r(d[25]),E=_r(d[26]),O=_r(d[27]),B=_r(d[28]),P=_r(d[29]),_=_r(d[30]),N=_r(d[31]);_r(d[32]);var M=_r(d[33]),W=_r(d[34]),V=_r(d[35]),D=_r(d[36]),z=_r(d[37]),H=_r(d[38]),$=_r(d[39]),U=_r(d[40]),F=_r(d[41]);_r(d[42]);var G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]),q=_r(d[46]),J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ie=_r(d[57]);const le=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ae=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:I.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],de={home:'Today',orders:'Orders',bookings:'Bookings & waitlist',forecast:'Forecasts',chat:'Staff chat',more:'More'};function ce(){const{rid:e,r:re,role:ne,today:ce,now:ue,meId:he,me:fe}=(0,B.useCtx)(3e4);(0,f.useTipsPosted)(e,ce,'staff'!==ne);const ge=(0,B.useSignedIn)();(0,a.useSoldOutLink)(!0,(ge?.name??fe).replace(' (example)',''));const be=(0,L.useOrders)(e),[pe,me]=(0,x.useState)('home'),[xe,je]=(0,x.useState)(null),[ye,we]=(0,x.useState)(!1),Se=(0,r.useLiveVenue)(),[Re,Ce]=(0,x.useState)(!1),ke=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ce,ue),(0,K.ensureChat)(ue)},[ce]),globalThis.__ccNow=ue.getTime();const Te=(0,K.useChatUnread)().total,Ae=(0,x.useRef)({t:'home',s:null});Ae.current={t:pe,s:xe};const Le=(0,x.useRef)([]),Ie=(0,l.useScrollMemory)(ke),ve=(0,x.useCallback)((e,t=null)=>{const s=Ae.current;s.t===e&&s.s===t||(Le.current=[...Le.current,{...s,y:Ie.leave()}].slice(-30),Ie.restore(0)),me(e),je(t)},[]),Ee=(0,x.useCallback)(()=>{if((0,c.runBackLayer)())return!0;const e=Ae.current;let t=Le.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Le.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ie.leave(),me(s.t),je(s.s),Ie.restore(s.y??0),!0},[]);(0,c.useWebBack)(Ee);const Oe=(0,c.useInnerBackShown)();(0,x.useEffect)(()=>(Z.useVoiceNav.setState({go:ve}),()=>Z.useVoiceNav.setState({go:null})),[ve]),(0,x.useEffect)(()=>{u.PITCH&&(globalThis.__pitchGo=ve)},[ve]),(0,x.useEffect)(()=>{const e=j.default.addEventListener('hardwareBackPress',Ee);return()=>e.remove()},[Ee]),(0,x.useEffect)(()=>{const e=ae.find(e=>e.id===pe);e?.can&&!e.can(ne)&&ve('home');const t=(0,U.pageFor)(xe);t?.can&&!t.can(ne)&&je(null)},[ne]);const Be='more'===pe?(0,U.pageFor)(xe):void 0,Pe=be.filter(e=>(0,O.LIVE)(e)&&'new'===e.status).length,{unread:Ne,list:Me,read:We}=(0,G.useNotifications)();(0,X.useAlertWatcher)(e,{nag:'staff'!==ne}),(0,ee.useScheduledNotices)({rid:e,staffId:ge?.id??'',name:fe,onOpen:()=>ve('more','orderlists')}),(0,te.useOffRotaAlerts)({enabled:'staff'!==ne&&!!ge});const Ve='owner'===ne?'OWNER':'manager'===ne?'MANAGER':'STAFF',De=(0,X.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,X.isUnread)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,X.useAlerts)(t=>t.todoSeen[e]),He=Math.max(0,Ne-Me.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+De;(0,X.useAlertSeenSync)(e);const $e=(0,L.useBookings)(e).filter(e=>'pending'===e.status).length,Ue=t.IS_ISOLATED_VENUE?[{id:e,name:re.name,place:re.location||re.address||''}]:le,Fe=Ue.find(t=>t.id===e)??Ue[0],Ge=(0,R.default)().width<430;return(0,ie.jsxs)(k.SafeAreaView,{style:{flex:1,backgroundColor:v.colours.bg},edges:['top','left','right','bottom'],children:[(0,ie.jsxs)(C.default,{style:{paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:v.colours.border,gap:6},children:[(0,ie.jsx)(C.default,{style:{alignItems:'center'},children:(0,ie.jsx)(w.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${fe}. Account and role`,disabled:'owner'!==W.APP_VARIANT,onPress:()=>Ce(!0),hitSlop:6,style:{borderWidth:1,borderColor:v.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'86%',minHeight:44,justifyContent:'center'},children:(0,ie.jsxs)(T.Row,{gap:6,children:[(0,ie.jsx)(P.StaffAvatar,{id:he,size:24,ring:!1}),(0,ie.jsxs)(T.T,{size:13,weight:"semibold",colour:v.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[ge?`${fe} \xb7 ${ne===ge.role?ge.level??I.ROLE_LABEL[ne]:I.ROLE_LABEL[ne]}`:`${fe} \xb7 ${I.ROLE_LABEL[ne]}`,'owner'===W.APP_VARIANT?' \u25be':'']})]})})}),(0,ie.jsxs)(T.Row,{gap:10,children:[(0,ie.jsx)(A.RestaurantLogo,{rid:e,size:Ge?36:44}),(0,ie.jsxs)(w.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>we(!0),style:{flex:1,minWidth:0},children:[(0,ie.jsxs)(T.Row,{gap:6,children:[(0,ie.jsxs)(T.T,{weight:"semibold",size:Ge?15:16,numberOfLines:1,style:{flexShrink:1},children:[re.name," \u25be"]}),(0,ie.jsx)(oe.AppBadge,{label:Ve})]}),(0,ie.jsxs)(T.Muted,{size:12,numberOfLines:1,children:['staff'===ne?'Staff preview \xb7 ':Ge?'':'Managers \xb7 ',Fe.place]}),(0,ie.jsx)(A.PoweredBy,{})]}),(0,ie.jsx)(w.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>ve('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,ie.jsx)($.Icon,{name:"search",colour:v.colours.text})}),(0,ie.jsx)(w.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:He?`Notifications, ${He} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>ve('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,ie.jsxs)(C.default,{children:[(0,ie.jsx)($.Icon,{name:"bell",colour:v.colours.text}),He?(0,ie.jsx)(C.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:v.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,ie.jsx)(T.T,{size:10,weight:"bold",children:He})}):null]})}),(0,ie.jsx)(q.VoiceSlot,{})]}),ne!==(ge?.role??'owner')&&'owner'===W.APP_VARIANT?(0,ie.jsx)(w.default,{onPress:()=>I.useOwner.getState().setPreviewRole(ge?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,ie.jsx)(T.T,{size:12,colour:v.colours.gold,children:'staff'===ne?`Staff app preview: what staff see in the Staff app. Tap to return to ${I.ROLE_LABEL[ge?.role??'owner']}.`:`Previewing the ${I.ROLE_LABEL[ne].toLowerCase()} view. Tap to return to ${I.ROLE_LABEL[ge?.role??'owner']}.`})}):null]}),(0,ie.jsxs)(S.default,{ref:ke,...Ie.props,contentContainerStyle:{padding:14,paddingBottom:90,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,ie.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:['home'===pe&&!xe||Oe?null:(0,ie.jsx)(c.BackButton,{onPress:Ee}),(0,ie.jsx)(T.T,{size:22,weight:"bold",style:{flex:1,textAlign:'home'===pe&&!xe||Oe?'left':'right'},children:Be?Be.title:'staff'===ne&&'home'===pe?'Staff app preview':de[pe]})]}),'home'===pe&&ge&&'staff'===ge.role&&'owner'===W.APP_VARIANT?(0,ie.jsxs)(C.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:v.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,ie.jsx)(T.T,{weight:"semibold",colour:v.colours.gold,children:"Your manager access is off"}),(0,ie.jsx)(T.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,ie.jsx)(T.Button,{label:"Clock in and my shifts",onPress:()=>ve('more','clock')})]}):null,'home'===pe?(0,ie.jsx)(n.WhoBar,{}):null,'home'===pe&&ge?(0,ie.jsx)(se.MyShiftCard,{go:ve}):null,'home'===pe&&ge?(0,ie.jsx)(h.MyTasksToday,{rid:e,staffId:ge.id,name:ge.name,onShift:(0,b.shiftNow)(ge.id,Date.now()).on}):null,'home'===pe&&'staff'!==ne?(0,ie.jsx)(f.TodaysTipsCard,{rid:e,today:ce}):null,'home'===pe&&'staff'!==ne?(0,ie.jsx)(f.TipsPotCard,{rid:e,today:ce}):null,'home'===pe?'staff'===ne?(0,ie.jsx)(z.StaffHome,{go:ve}):(0,ie.jsx)(M.Dashboard,{go:ve}):null,'orders'===pe?(0,ie.jsx)(F.Orders,{}):null,'bookings'===pe?(0,ie.jsx)(E.Bookings,{}):null,'forecast'===pe?(0,ie.jsx)(H.Forecasts,{go:ve}):null,'chat'===pe?(0,ie.jsx)(K.Chat,{go:ve}):null,'more'===pe?Be?(0,ie.jsx)(Be.C,{go:ve}):(0,ie.jsx)(U.MoreMenu,{go:ve}):null]}),(0,ie.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ne?(0,ie.jsx)(Q.PrintHost,{rid:e}):null,'staff'!==ne?(0,ie.jsx)(J.AlertHost,{variant:"managers",rid:e,me:fe,onOpen:e=>ve('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,ie.jsx)(Y.AssistantSheet,{}),(0,ie.jsx)(C.default,{style:{flexDirection:'row',borderTopWidth:1,borderColor:v.colours.border,backgroundColor:(0,s.soutersSurface)('#0d0d0d')},children:ae.filter(e=>!e.can||e.can(ne)).map(e=>{const t=pe===e.id;return(0,ie.jsxs)(w.default,{accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>ve(e.id),style:{flex:1,alignItems:'center',paddingVertical:8,gap:2},children:[(0,ie.jsxs)(C.default,{children:[(0,ie.jsx)($.Icon,{name:e.icon,colour:t?v.colours.gold:v.colours.muted}),'chat'===e.id&&Te?(0,ie.jsx)(C.default,{style:{position:'absolute',right:-8,top:-4,backgroundColor:v.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,ie.jsx)(T.T,{size:10,weight:"bold",children:Te})}):null,'bookings'===e.id&&$e?(0,ie.jsx)(C.default,{testID:"pending-badge",style:{position:'absolute',right:-8,top:-4,backgroundColor:v.colours.amber,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,ie.jsx)(T.T,{size:10,weight:"bold",colour:"#0B0B0B",children:$e})}):null,'orders'===e.id&&Pe?(0,ie.jsx)(C.default,{style:{position:'absolute',right:-8,top:-4,backgroundColor:v.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,ie.jsx)(T.T,{size:10,weight:"bold",children:Pe})}):null]}),(0,ie.jsx)(T.T,{size:11,colour:t?v.colours.gold:v.colours.muted,children:e.label})]},e.id)})}),(0,ie.jsx)(y.default,{visible:ye,transparent:!0,animationType:"fade",onRequestClose:()=>we(!1),children:(0,ie.jsx)(w.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>we(!1),children:(0,ie.jsxs)(C.default,{style:{backgroundColor:v.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,ie.jsx)(T.T,{weight:"semibold",children:"Your venues"}),Ue.filter(e=>!Se||'saltmarsh'!==e.id).map(t=>(0,ie.jsx)(w.default,{accessibilityRole:"button",onPress:()=>{I.useOwner.getState().setSite(t.id),we(!1),ve('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?v.colours.gold:v.colours.border},children:(0,ie.jsxs)(T.Row,{style:{justifyContent:'space-between'},children:[(0,ie.jsxs)(C.default,{children:[(0,ie.jsx)(T.T,{weight:"medium",children:t.name}),(0,ie.jsx)(T.Muted,{children:t.place})]}),t.id===e?(0,ie.jsx)(T.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,ie.jsx)(T.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${re.name}.`:Se?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,ie.jsx)(y.default,{visible:Re,transparent:!0,animationType:"fade",onRequestClose:()=>Ce(!1),children:(0,ie.jsx)(w.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>Ce(!1),children:(0,ie.jsxs)(C.default,{style:{backgroundColor:v.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[ge?(0,ie.jsxs)(T.Row,{gap:10,children:[(0,ie.jsx)(P.StaffAvatar,{id:ge.id,size:44}),(0,ie.jsxs)(C.default,{style:{flex:1},children:[(0,ie.jsxs)(T.T,{weight:"semibold",children:["Signed in as ",ge.name]}),(0,ie.jsx)(T.Muted,{children:(0,N.levelJob)(ge.level??I.ROLE_LABEL[ge.role],ge.job)})]})]}):(0,ie.jsxs)(C.default,{style:{gap:6},children:[(0,ie.jsx)(T.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,ie.jsx)(T.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,ie.jsx)(_.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!ge?null:(0,ie.jsx)(T.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,ie.jsx)(T.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!ge||(0,B.clampRole)(e,ge.role)===e).map(e=>(0,ie.jsx)(T.Button,{kind:e===ne?'primary':'secondary',label:'staff'===e?'Staff app preview':`${I.ROLE_LABEL[e]} view`,onPress:()=>{I.useOwner.getState().setPreviewRole(e),Ce(!1)}},e))]})})}),(0,ie.jsx)(V.OnboardingHost,{go:ve}),(0,ie.jsx)(D.CoachHost,{})]})}},882,[5,878,820,943,944,945,946,947,2,948,949,950,951,30,233,256,263,151,287,127,289,813,860,819,854,821,952,953,954,955,956,858,122,883,806,905,957,958,909,959,902,910,911,901,960,961,962,963,964,965,966,967,968,969,970,934,935,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.Dashboard=function({go:e}){const{rid:U,r:q,now:W,role:Y,me:_,today:K}=(0,A.useCtx)(5e3),Q=(0,y.useOrders)(U),V=(0,y.useBookings)(U),J=(0,y.useWaitlist)(U),X=(0,y.useEvents)(U),Z=(0,y.useRatings)(U),ee=(0,y.useStore)(e=>e.walkIns[U]??0),se=(0,f.useOwner)(e=>e.staff),ae=(0,f.useOwner)(e=>e.attendance),le=(0,f.useOwner)(e=>e.shifts),oe=(0,D.useRealHistory)(U,W),te=(0,o.useMemo)(()=>(0,a.forecastToday)(q,V,Q,X,W,oe??void 0),[q,V,Q,X,oe,W.getTime()/6e4|0]),ne=(0,P.useExamples)(),re=(0,S.useCashUp)(e=>e.cashUps),ie=V.filter(e=>e.date===K),de=Q.filter(T.LIVE),ue=J.filter(e=>'waiting'===e.status||'notified'===e.status),ce=ie.filter(e=>['seated','finished'].includes((0,v.shownStatus)(e))).reduce((e,s)=>e+s.partySize,0)+ee,ge=ee+ie.filter(e=>e.walkIn&&['seated','finished'].includes((0,v.shownStatus)(e))).reduce((e,s)=>e+s.partySize,0),he=ie.filter(e=>!['cancelled','noshow'].includes(e.status)&&!e.walkIn).reduce((e,s)=>e+s.partySize,0),be=de.filter(e=>(0,H.chainNeedsAction)(e,V)),xe=ie.filter(e=>['confirmed','seated'].includes(e.status)&&(0,H.bookingNeedsAction)(e,de)),ye=de.flatMap(e=>(0,w.readinessFor)(e,q,W).map(s=>({...s,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),fe=te.nextHour,je=(0,T.busyLevel)(fe?.covers??0,q.settings.capacityPerHour),ke=(0,T.restOfDayLevel)(te,q),pe=Q.filter(e=>e.paid>0).reduce((e,s)=>e+s.paid,0)+(ne?186e3:0),me=(0,$.ymd)(new Date(W.getTime()-6048e5)),we=re.find(e=>e.rid===U&&e.date===me),$e=we?(0,N.takings)(we.vals):null,ve=ne?(0,I.revenueHistory)(q,W,7).filter(e=>e.date.getDay()===W.getDay()).pop():null!=$e?{date:(0,$.parseYmd)(me),total:Math.round(100*$e)}:void 0,Be=(0,o.useMemo)(()=>(0,I.insights)(q,V,Q,X,Z,W,ce),[q.id,V.length,Z.length,ce]),Ce=((0,A.weekday)(W),ae.filter(e=>e.date===K&&e.in&&!e.out)),Te=(0,E.useFrontDoor)(K),Ae=(0,j.useOutstanding)(),Ie=(0,n.useTravelDay)('owner',K),De=(0,f.useOwner)(e=>e.socialPosts.reduce((e,s)=>e+('awaiting approval'===s.status?1:0),0)),Pe=f.CAN.manage(Y)?(0,z.jsx)(x.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ie?(0,z.jsxs)(b.default,{style:{gap:12},children:[Pe,(0,z.jsx)(n.DayBar,{app:"owner",today:K}),(0,z.jsx)(n.DayView,{rid:U,day:Ie,today:K,app:"owner"})]}):(0,z.jsxs)(b.default,{style:{gap:12},children:[Pe,(0,z.jsx)(n.DayBar,{app:"owner",today:K}),(0,z.jsx)(t.CoversToday,{rid:U,onPress:()=>e('bookings')}),(0,z.jsx)(G.BlocksBanner,{rid:U,now:W,by:_}),(0,z.jsx)(c.KitchenSignoffs,{rid:U,today:K,by:_,app:"owner",canConfirm:f.CAN.manage(Y)}),f.CAN.manage(Y)?(0,z.jsx)(M.SetupCard,{go:e}):null,f.CAN.manage(Y)?(0,z.jsx)(l.SeasonsTodo,{go:e}):null,(0,z.jsx)(r.LastFoodBanner,{rid:U,now:W}),(0,z.jsx)(i.NextTableFreeCard,{rid:U,now:W}),f.CAN.manage(Y)?(0,z.jsx)(x.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",onPress:()=>e('more','blocks')}):null,(0,z.jsxs)(b.default,{testID:"front-door-bar",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,z.jsx)(d.QuietButton,{label:"New booking",onPress:Te.openBooking,testID:"home-booking"}),f.CAN.manage(Y)?(0,z.jsx)(G.CloseGardenButton,{quiet:!0,short:!0,rid:U,r:q,now:W,by:_}):null]}),Te.elements,f.CAN.manage(Y)?(0,z.jsx)(F.PaydaysCard,{go:e}):null,(0,z.jsx)(O.FadeIn,{children:(0,z.jsxs)(x.Card,{highlight:C.colours.gold,style:{alignItems:'center'},children:[(0,z.jsxs)(x.Row,{style:{alignSelf:'stretch',justifyContent:'space-between'},children:[(0,z.jsxs)(x.T,{weight:"semibold",colour:C.colours.gold,children:["Next hour",fe?` \xb7 ${(0,A.fmtH)(fe.hour)}\u2013${(0,A.fmtH)(fe.hour+1)}`:'']}),te.example?(0,z.jsx)(D.ExampleBadge,{}):te.enough?(0,z.jsx)(x.Badge,{kind:"amber",label:"ESTIMATE"}):(0,z.jsx)(x.Badge,{kind:"neutral",label:"BOOKED ONLY"})]}),(0,z.jsx)(O.Gauge,{pct:fe?fe.covers/q.settings.capacityPerHour:0,label:fe?je.label:te.open?'Kitchen closing':'Closed today',sub:fe&&!te.enough?`${fe.booked} booked${fe.walkIns?` + ${fe.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:fe?`About ${(0,a.coversRange)(fe.coversLow,fe.coversHigh)} of ${q.settings.capacityPerHour} \xb7 ${fe.booked} booked + about ${fe.walkIns} walk-ins${(0,u.showTakeaway)(q)?` \xb7 about ${fe.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,z.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[te.enough?(0,z.jsx)(x.Badge,{kind:"gold",label:`Rest of today: ${ke.level.label}${ke.peak?`, peak ${(0,A.fmtH)(ke.peak.hour)}`:''}`}):null,te.enough?(0,z.jsx)(x.Badge,{kind:"neutral",label:`${(0,a.coversRange)(te.restOfDay.low,te.restOfDay.high)}${(0,u.showTakeaway)(q)?` \xb7 about ${te.restOfDay.takeaway} takeaways`:''}`}):(0,z.jsx)(x.Badge,{kind:"neutral",label:`Booked so far: ${te.restOfDay.booked} covers`})]}),te.flags.length?(0,z.jsxs)(x.Muted,{center:!0,children:["Calendar: ",te.flags.join(', ')]}):null,f.CAN.forecasts(Y)?(0,z.jsx)(x.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,z.jsxs)(x.Row,{wrap:!0,gap:10,children:[(0,z.jsx)(O.FadeIn,{delay:80,style:{flexGrow:1,flexBasis:150},children:(0,z.jsx)(T.Tile,{label:"Covers today",value:"",onPress:()=>e('bookings'),sub:`${ce} seated (${ge} walk-in) \xb7 ${he} booked`,children:(0,z.jsx)(O.CountUp,{value:ce})})}),(0,z.jsx)(O.FadeIn,{delay:140,style:{flexGrow:1,flexBasis:150},children:(0,z.jsx)(T.Tile,{label:"Bookings today",value:"",onPress:()=>e('bookings'),sub:`${ie.filter(e=>['confirmed','pending'].includes((0,v.shownStatus)(e))).length} still to arrive`,children:(0,z.jsx)(O.CountUp,{value:ie.length})})}),(0,u.showTakeaway)(q)||de.length?(0,z.jsx)(O.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,z.jsx)(T.Tile,{label:"Live orders",value:"",accent:de.some(e=>'new'===e.status)?C.colours.red:void 0,onPress:()=>e('orders'),sub:(0,B.orderAtTableOn)(q)?`${de.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${de.filter(e=>'table'===e.type).length} table`:`${de.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,z.jsx)(O.CountUp,{value:de.length})})}):null,(0,z.jsx)(O.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,z.jsx)(T.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings'),sub:`${ue.reduce((e,s)=>e+s.partySize,0)} covers waiting`,children:(0,z.jsx)(O.CountUp,{value:ue.length})})}),f.CAN.takings(Y)?(0,z.jsx)(O.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,z.jsx)(T.Tile,{label:ne?'Takings today (example)':'Paid online today',value:"",onPress:()=>e('more','analytics'),sub:ve?`Last ${(0,$.niceDate)(ve.date).slice(0,3)}: ${(0,p.gbp)(ve.total)}`:void 0,children:(0,z.jsx)(O.CountUp,{value:pe,format:e=>(0,p.gbp)(100*Math.round(e/100)).replace('.00','')})})}):null,(0,z.jsx)(O.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,z.jsx)(T.Tile,{label:"Allergy alerts",value:"",accent:be.length+xe.length?C.colours.red:C.colours.ok,sub:"Need a sign-off",children:(0,z.jsx)(O.CountUp,{value:be.length+xe.length,colour:be.length+xe.length?C.colours.red:C.colours.ok})})})]}),be.length+xe.length+ye.length?(0,z.jsx)(T.SectionHead,{title:"Needs action now"}):null,be.map(e=>(0,z.jsxs)(T.AlertBox,{colour:C.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,s.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,z.jsx)(x.T,{size:14,children:e.allergies.map(e=>`${(0,k.allergenLabel)(e.allergen)} (${(0,k.severityLabel)(e.severity)})`).join('; ')}),(0,z.jsx)(R.AllergyChain,{o:e,me:_,compact:!0})]},e.id)),xe.map(e=>(0,z.jsxs)(T.AlertBox,{colour:C.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,z.jsx)(x.T,{size:14,children:e.allergies.map(e=>`${(0,k.allergenLabel)(e.allergen)} (${(0,k.severityLabel)(e.severity)})`).join('; ')}),(0,z.jsx)(R.BookingAllergyChain,{b:e,me:_})]},e.id)),ye.map(s=>(0,z.jsxs)(T.AlertBox,{colour:'overdue'===s.state?C.colours.red:C.colours.amber,title:`${'cook'===s.stage?'START COOKING':'bag'===s.stage?'BAG IT':'READY'} \xb7 ${s.order.ref} pickup ${(0,$.hm)(new Date(s.order.slotTime))}${'overdue'===s.state?' \xb7 OVERDUE':''}`,children:[(0,z.jsx)(x.T,{size:14,children:s.detail}),(0,z.jsx)(x.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},s.id)),f.CAN.manage(Y)&&(Ae.days.length||Ae.requests)?(0,z.jsxs)(T.AlertBox,{colour:C.colours.amber,title:`HOURS \xb7 ${Ae.days.length?`${Ae.days.length} earlier day${Ae.days.length>1?'s':''} to sign off`:''}${Ae.days.length&&Ae.requests?' \xb7 ':''}${Ae.requests?`${Ae.requests} correction request${Ae.requests>1?'s':''}`:''}`,children:[(0,z.jsx)(x.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,z.jsx)(x.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,De&&f.CAN.publishSocial(Y)?(0,z.jsxs)(T.AlertBox,{colour:C.colours.amber,title:`SOCIAL \xb7 ${De} post${De>1?'s':''} awaiting approval`,children:[(0,z.jsx)(x.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,z.jsx)(x.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,z.jsx)(T.SectionHead,{title:"Quick actions"}),(0,z.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:C.colours.gold,backgroundColor:e?C.colours.goldTint:C.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,z.jsxs)(x.Row,{gap:4,children:[(0,z.jsx)(L.Mark,{p:"facebook"}),(0,z.jsx)(L.Mark,{p:"instagram"}),(0,z.jsx)(L.Mark,{p:"tiktok"}),(0,z.jsx)(L.Mark,{p:"youtube"})]}),(0,z.jsxs)(b.default,{style:{flex:1},children:[(0,z.jsx)(x.T,{weight:"bold",children:"Post to social"}),(0,z.jsx)(x.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,z.jsx)(x.T,{colour:C.colours.gold,size:20,children:"\u203a"})]}),(0,z.jsx)(L.QuickLinksSection,{go:e,heading:e=>(0,z.jsx)(T.SectionHead,{title:e})}),(0,z.jsx)(T.SectionHead,{title:"Who\u2019s on now",right:(0,z.jsx)(x.Badge,{kind:"ok",label:`${Ce.length} clocked in`})}),(0,z.jsxs)(x.Card,{children:[0===Ce.length?(0,z.jsx)(x.Muted,{children:"Nobody clocked in yet."}):null,Ce.map(e=>{const s=se.find(s=>s.id===e.staffId),a=(0,f.shiftOf)(le,e.staffId,K),l=new Date(e.in),o=!!a&&l.getHours()+l.getMinutes()/60-a.start>.08333333333333333;return(0,z.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,z.jsxs)(b.default,{style:{flex:1},children:[(0,z.jsx)(x.T,{weight:"semibold",children:s?.name??e.staffId}),(0,z.jsxs)(x.Muted,{children:[s?.job," \xb7 in ",(0,$.hm)(l),a?` \xb7 shift ${(0,A.fmtH)(a.start)}\u2013${(0,A.fmtH)(a.end)}`:' \xb7 unscheduled']})]}),o?(0,z.jsx)(x.Badge,{kind:"amber",label:"Late"}):(0,z.jsx)(x.Badge,{kind:"ok",label:"On site"})]},e.id)}),f.CAN.manage(Y)?(0,z.jsx)(x.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,z.jsx)(x.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),'staff'!==Y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(T.SectionHead,{title:"Insights",sub:ne?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Be.slice(0,4).map((s,a)=>(0,z.jsx)(O.FadeIn,{delay:100+90*a,children:(0,z.jsxs)(x.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:C.colours.gold,red:C.colours.red,amber:C.colours.amber,ok:C.colours.ok,blue:C.colours.blue}[s.tone]},children:[(0,z.jsxs)(x.T,{weight:"semibold",children:[s.icon," ",s.title]}),(0,z.jsx)(x.Muted,{children:s.body}),s.action?(0,z.jsx)(x.Button,{small:!0,kind:"ghost",label:`${s.action.label} \u2192`,onPress:()=>e(s.action.tab,s.action.sub??null),style:{alignSelf:'flex-start'}}):null]})},s.id)),(0,z.jsx)(x.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights')})]}):null]})};var s=_r(_d[0]),a=_r(_d[1]),l=_r(_d[2]),o=_r(_d[3]),t=_r(_d[4]),n=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=e(_r(_d[11])),b=e(_r(_d[12])),x=_r(_d[13]),y=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),p=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),v=_r(_d[21]),B=_r(_d[22]),C=_r(_d[23]),T=_r(_d[24]),A=_r(_d[25]),I=_r(_d[26]),D=_r(_d[27]),P=_r(_d[28]),S=_r(_d[29]),N=_r(_d[30]),O=_r(_d[31]),L=_r(_d[32]),R=_r(_d[33]),H=_r(_d[34]),M=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),G=_r(_d[38]),z=_r(_d[39])},883,[808,868,884,30,971,972,973,974,975,809,976,263,127,813,819,854,977,814,816,978,818,828,979,821,953,954,980,981,982,983,984,893,985,986,987,894,988,989,990,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.AdvancedSettings=function({go:e}){const{r:b,rid:M,today:P,me:O}=(0,T.useCtx)(6e4),Q=O.replace(" (example)",""),V=b.settings,Z=e=>w.useStore.getState().updateSettings(M,e),[J,ee]=(0,g.useState)(()=>(0,i.takeAdvancedPrefill)()),[se,te]=(0,g.useState)(null),oe=e=>{if(e.onReset)return e.onReset(),void te(`${e.title}: back to the defaults.`);Z(Object.fromEntries(e.reset.map(e=>[e,void 0]))),te(`${e.title}: back to the defaults.`)},ae=(0,R.useBookings)(M),ne=(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,E.jsx)(x.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,E.jsx)(x.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,E.jsx)(x.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,C.dogQuestionOn)(b),onChange:e=>Z({dogQuestion:e})}),(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,E.jsx)(q,{label:"dogs per time",step:1,min:0,max:20,value:V.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>Z({maxDogsPerSlot:e||void 0})})]}),(0,E.jsx)(x.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,C.accessQuestionOn)(b),onChange:e=>Z({accessQuestion:e})}),(0,E.jsx)(x.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,C.dietQuestionOn)(b),onChange:e=>Z({dietQuestion:e})}),(0,E.jsx)(x.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==V.tableRequests,onChange:e=>Z({tableRequests:e})}),(0,E.jsx)(x.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),le=(0,C.dwellBands)(b),re=(e,s)=>Z({dwellBands:le.map((t,o)=>o===e?{...t,mins:s}:t)}),ie=(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsx)(x.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),le.map((e,s)=>{const t=(0,C.dwellFor)(b,9999===e.upTo?20:e.upTo,ae);return(0,E.jsxs)(f.default,{style:{gap:2},children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{style:{flex:1},children:(0,C.bandLabel)(le,s)}),(0,E.jsx)(q,{label:`table time for ${(0,C.bandLabel)(le,s)}`,min:30,max:360,value:e.mins,unit:K,onChange:e=>re(s,e)})]}),t.learned&&t.mins!==e.mins?(0,E.jsxs)(x.Muted,{size:12,children:["From your last ",t.samples," tables: about ",K(t.mins)," (used for estimates)"]}):null]},s)}),(0,E.jsx)(x.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==V.dwellLearn,onChange:e=>Z({dwellLearn:e})}),(0,E.jsx)(x.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),de=V.reservables??(0,v.reservablesOf)(b),he=V.reservables??('anchorage'===M?de:[]),ue=(e,s)=>Z({reservables:he.map(t=>t.id===e?{...t,...s}:t)}),ce=(0,E.jsxs)(f.default,{style:{gap:8},children:[he.length?he.map(e=>(0,E.jsxs)(f.default,{style:{gap:4},children:[(0,E.jsx)(x.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>ue(e.id,{active:s})}),(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.Muted,{children:"Price"}),(0,E.jsx)(q,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>ue(e.id,{price:100*s})})]}),(0,E.jsxs)(x.Muted,{size:12,children:["Uses: ",e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')," from the counted stock. Held from the Display count and shown as \u201cReserved\u201d."]})]},e.id)):(0,E.jsx)(x.Muted,{children:"No reservable dishes yet."}),(0,E.jsx)(x.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==V.reserveStock,onChange:e=>Z({reserveStock:e})}),(0,E.jsx)(x.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),pe=(0,C.regularEventsOf)(b),[ge,be]=(0,g.useState)(null),me=e=>Z({regularEvents:e}),fe=ge?ge.name.trim()?ge.time&&!N.test(ge.time)?'Start time looks wrong (use 20:00).':ge.lastFood&&!N.test(ge.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==ge.rule.kind||H.test(ge.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',xe=(0,E.jsxs)(f.default,{style:{gap:8},children:[pe.map(e=>(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,E.jsx)(x.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,E.jsx)(x.Badge,{kind:"neutral",label:"OFF"})]}),(0,E.jsxs)(x.Muted,{children:[(0,C.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,E.jsxs)(x.Muted,{size:12,children:["Next: ",(0,C.nextOccurrence)(e,P)??'\u2014']}):null,(0,E.jsxs)(x.Row,{gap:6,children:[(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>be({...e})}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>me(pe.filter(s=>s.id!==e.id))})]})]},e.id)),ge?(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,E.jsx)(x.Muted,{children:"Name"}),(0,E.jsx)(G,{label:"Event name",width:220,value:ge.name,onChange:e=>be({...ge,name:e}),placeholder:"Open Mic Night"})]}),(0,E.jsx)(x.Muted,{children:"Repeats"}),(0,E.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(x.Chip,{label:"Last \u2026 of the month",selected:'last'===ge.rule.kind,onPress:()=>be({...ge,rule:{kind:'last',weekday:'weekday'in ge.rule?ge.rule.weekday:0}})}),(0,E.jsx)(x.Chip,{label:"Every week",selected:'weekly'===ge.rule.kind,onPress:()=>be({...ge,rule:{kind:'weekly',weekday:'weekday'in ge.rule?ge.rule.weekday:0}})}),(0,E.jsx)(x.Chip,{label:"One-off date",selected:'once'===ge.rule.kind,onPress:()=>be({...ge,rule:{kind:'once',date:P}})})]}),'weekday'in ge.rule?(0,E.jsx)(x.Row,{wrap:!0,gap:6,children:U.map(e=>(0,E.jsx)(x.Chip,{label:_[e],selected:ge.rule.weekday===e,onPress:()=>be({...ge,rule:{...ge.rule,weekday:e}})},e))}):(0,E.jsxs)(x.Row,{gap:8,children:[(0,E.jsx)(x.Muted,{children:"Date"}),(0,E.jsx)(G,{label:"Event date",width:130,value:ge.rule.date,onChange:e=>be({...ge,rule:{kind:'once',date:e}}),placeholder:"2026-12-31"})]}),(0,E.jsxs)(x.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,E.jsx)(x.Muted,{children:"Starts (optional)"}),(0,E.jsx)(G,{label:"Start time",value:ge.time??'',onChange:e=>be({...ge,time:e||void 0}),placeholder:"20:00",bad:!!ge.time&&!N.test(ge.time)})]}),(0,E.jsxs)(x.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,E.jsx)(x.Muted,{children:"Last food orders (optional)"}),(0,E.jsx)(G,{label:"Last food orders",value:ge.lastFood??'',onChange:e=>be({...ge,lastFood:e||void 0}),placeholder:"19:00",bad:!!ge.lastFood&&!N.test(ge.lastFood)})]}),(0,E.jsxs)(x.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,E.jsx)(x.Muted,{children:"Notes"}),(0,E.jsx)(G,{label:"Notes",width:240,value:ge.notes??'',onChange:e=>be({...ge,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,E.jsx)(x.Toggle,{label:"Expect busier (raises the forecast)",value:ge.busier,onChange:e=>be({...ge,busier:e})}),(0,E.jsx)(x.Toggle,{label:"On",value:ge.active,onChange:e=>be({...ge,active:e})}),fe?(0,E.jsx)(x.T,{size:13,colour:S.colours.red,children:fe}):null,(0,E.jsxs)(x.Row,{gap:6,children:[(0,E.jsx)(x.Button,{small:!0,label:"Save event",disabled:!!fe,testID:"event-save",onPress:()=>{const e={...ge,name:ge.name.trim()};me(pe.some(s=>s.id===e.id)?pe.map(s=>s.id===e.id?e:s):[...pe,e]),be(null),te(`Saved ${e.name}.`)}}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>be(null)})]})]}):(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>be({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,E.jsx)(x.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),ye=(0,k.hourSetsOf)(b),je=(0,k.seasonOn)(b,new Date),[we,ke]=(0,g.useState)(null),[ve,Ce]=(0,g.useState)(null),Se=V.hourOverrides??[],Te=we?we.start&&!W.test(we.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':we.hours&&Object.values(we.hours).some(e=>e&&(!N.test(e[0])||!N.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Re=Object.values(V.lastFoodByDay??{}).some(e=>e&&!N.test(e)),De=[];ye.some(e=>!e.hours)&&De.push(`${ye.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);ye.filter(e=>e.hours).length>=1&&ye.length>1&&ye.some(e=>!e.start)&&De.push('the date each season starts');const Me=(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsx)(x.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),De.length?(0,E.jsxs)(x.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",De.join(' and '),". Until then the app uses ",je?.name??'your weekly'," hours all year."]}):null,je?(0,E.jsxs)(x.T,{colour:S.colours.goldLight,children:["In use today: ",je.name]}):null,ye.map(e=>(0,E.jsxs)(x.Card,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",children:e.name}),je?.id===e.id?(0,E.jsx)(x.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,E.jsx)(x.Badge,{kind:"amber",label:"NOT SET"})]}),(0,E.jsx)(x.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,E.jsx)(x.Muted,{size:13,children:U.map(s=>`${_[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,E.jsx)(x.Muted,{size:13,children:"No hours yet."}),(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>ke({...e,hours:e.hours?{...e.hours}:{...ye.find(e=>e.hours)?.hours??b.kitchenHours}})})]},e.id)),we?(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsxs)(x.T,{weight:"semibold",children:[we.name," hours"]}),(0,E.jsxs)(x.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,E.jsx)(x.Muted,{children:"Starts every year on (MM-DD)"}),(0,E.jsx)(G,{label:"Season start date",value:we.start??'',onChange:e=>ke({...we,start:e||void 0}),placeholder:"04-01",bad:!!we.start&&!W.test(we.start)})]}),U.map(e=>{const s=we.hours?.[e]??null,t=s=>ke({...we,hours:{...we.hours,[e]:s}});return(0,E.jsxs)(x.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,E.jsx)(x.T,{style:{width:44},children:_[e]}),(0,E.jsx)(x.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(G,{label:`${C.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!N.test(s[0])}),(0,E.jsx)(x.Muted,{children:"to"}),(0,E.jsx)(G,{label:`${C.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!N.test(s[1])||s[0]>=s[1]})]}):null]},e)}),Te?(0,E.jsx)(x.T,{size:13,colour:S.colours.red,children:Te}):null,(0,E.jsxs)(x.Row,{gap:6,children:[(0,E.jsx)(x.Button,{small:!0,label:"Save hours",disabled:!!Te,testID:"season-save",onPress:()=>{var e;e=ye.map(e=>e.id===we.id?we:e),Z({hourSets:e}),ke(null),te(`Saved ${we.name} hours.`)}}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ke(null)})]})]}):null,(0,E.jsx)(x.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,E.jsx)(x.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Se.map(e=>(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsxs)(x.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>Z({hourOverrides:Se.filter(s=>s.date!==e.date)})})]},e.date)),ve?(0,E.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,E.jsxs)(x.Row,{gap:8,children:[(0,E.jsx)(x.Muted,{children:"Date"}),(0,E.jsx)(G,{label:"Special day date",width:130,value:ve.date,onChange:e=>Ce({...ve,date:e}),placeholder:"2026-12-31",bad:!H.test(ve.date)})]}),(0,E.jsxs)(x.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,E.jsx)(x.Chip,{label:ve.hours?'Open':'Closed',selected:!!ve.hours,onPress:()=>Ce({...ve,hours:ve.hours?null:['12:00','19:00']})}),ve.hours?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(G,{label:"Opens",width:74,value:ve.hours[0],onChange:e=>Ce({...ve,hours:[e,ve.hours[1]]})}),(0,E.jsx)(x.Muted,{children:"to"}),(0,E.jsx)(G,{label:"Last food orders",width:74,value:ve.hours[1],onChange:e=>Ce({...ve,hours:[ve.hours[0],e]})})]}):null]}),(0,E.jsxs)(x.Row,{gap:8,children:[(0,E.jsx)(x.Muted,{children:"Note"}),(0,E.jsx)(G,{label:"Note",width:220,value:ve.note??'',onChange:e=>Ce({...ve,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=H.test(ve.date)?ve.hours&&(!N.test(ve.hours[0])||!N.test(ve.hours[1])||ve.hours[0]>=ve.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,E.jsxs)(E.Fragment,{children:[e?(0,E.jsx)(x.T,{size:13,colour:S.colours.red,children:e}):null,(0,E.jsxs)(x.Row,{gap:6,children:[(0,E.jsx)(x.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{Z({hourOverrides:[...Se.filter(e=>e.date!==ve.date),ve].sort((e,s)=>e.date.localeCompare(s.date))}),Ce(null)}}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]})})()]}):(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Ce({date:P,hours:null})}),(0,E.jsx)(x.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,E.jsx)(x.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,E.jsx)(x.Row,{wrap:!0,gap:8,children:U.map(e=>(0,E.jsxs)(f.default,{style:{gap:2},children:[(0,E.jsx)(x.Muted,{size:12,children:_[e]}),(0,E.jsx)(G,{label:`${C.DAYS[e]} last food orders`,width:74,value:V.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!V.lastFoodByDay?.[e]&&!N.test(V.lastFoodByDay[e]),onChange:s=>Z({lastFoodByDay:{...V.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Re?(0,E.jsx)(x.T,{size:13,colour:S.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,E.jsx)(x.Muted,{children:"After last food orders, booking times are\u2026"}),(0,E.jsxs)(x.Row,{gap:6,children:[(0,E.jsx)(x.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,C.afterLastFood)(b),onPress:()=>Z({afterLastFood:'drinks'})}),(0,E.jsx)(x.Chip,{label:"Not offered",selected:'block'===(0,C.afterLastFood)(b),onPress:()=>Z({afterLastFood:'block'})})]})]}),Pe=(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsx)(x.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,C.coversCounterOn)(b),onChange:e=>Z({coversCounter:e})}),(0,E.jsx)(x.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,C.nextTableOn)(b),onChange:e=>Z({nextTableFree:e})}),(0,E.jsx)(x.Toggle,{label:"Show takeaway on home screens",value:(0,C.showTakeaway)(b),onChange:e=>Z({showTakeaway:e})}),(0,E.jsx)(x.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,E.jsx)(x.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),Oe=(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsx)(x.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!V.holidayFullNames,onChange:e=>Z({holidayFullNames:e})}),(0,E.jsx)(x.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Le,$e]=(0,g.useState)(null),ze=Le??V.whatsapp??'',Ae=!ze.trim()||!!(0,D.waNumber)(ze),Be=(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsx)(x.T,{children:"The venue\u2019s WhatsApp number"}),(0,E.jsxs)(x.Row,{gap:8,wrap:!0,children:[(0,E.jsx)(G,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:ze,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Ae,onChange:e=>{$e(e),e.trim()?(0,D.waNumber)(e)&&Z({whatsapp:e.trim()}):Z({whatsapp:void 0})}}),ze.trim()&&Ae?(0,E.jsx)(x.Badge,{kind:"gold",label:`wa.me/${(0,D.waNumber)(ze)}`}):null]}),Ae?null:(0,E.jsx)(x.T,{size:13,colour:S.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,E.jsx)(x.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,E.jsx)(x.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ie=(0,F.soldOutSettingsOf)(V.soldOut),Fe=(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsx)(x.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ie.auto,onChange:e=>Z({soldOut:{...Ie,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,E.jsx)(x.Muted,{size:13,children:Ie.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,E.jsx)(x.T,{children:"Clear sold out dishes by themselves"}),(0,E.jsx)(x.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,E.jsx)(x.Chip,{testID:`adv-soldout-${e}`,label:F.SOLD_OUT_CLEAR_LABEL[e],selected:Ie.clear===e,onPress:()=>Z({soldOut:{...Ie,clear:e}})},e))}),'manual'!==Ie.clear?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(x.T,{children:"Next morning means"}),(0,E.jsx)(x.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,E.jsx)(x.Chip,{label:e,selected:Ie.morningAt===e,onPress:()=>Z({soldOut:{...Ie,morningAt:e}})},e))})]}):null,(0,E.jsx)(x.Muted,{size:13,children:'close'===Ie.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ie.clear?`Dishes go back on at ${Ie.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,E.jsx)(x.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),Ee=(0,I.clampWeeks)(V.forecastMinWeeks),Ne=(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsx)(x.T,{children:"History needed before forecasts show"}),(0,E.jsx)(x.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,E.jsx)(x.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:Ee===e,onPress:()=>Z({forecastMinWeeks:e})},e))}),(0,E.jsx)(x.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===Ee?'1 week':`${Ee} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,E.jsx)(x.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,E.jsx)(a.ForecastDaySettings,{r:b,set:Z})]}),We=(0,y.depositOf)(V),He=e=>Z({deposit:{...We,...e}}),Ue=s.IS_GREENSIDE?(0,E.jsx)(t.GreensideCashOnly,{}):(0,E.jsxs)(f.default,{style:{gap:8},children:[(0,E.jsx)(x.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:We.on,onChange:e=>He({on:e})}),(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{children:"Amount per person"}),(0,E.jsx)(x.Stepper,{testID:"adv-deposit-amount",value:We.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>He({perPersonPence:100*e}),label:"deposit per person"})]}),(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{children:"From a party of"}),(0,E.jsx)(x.Stepper,{testID:"adv-deposit-party",value:We.fromParty,min:1,max:30,onChange:e=>He({fromParty:e}),label:"deposit from party size"})]}),(0,E.jsx)(x.T,{children:"Refundable?"}),(0,E.jsxs)(x.Row,{wrap:!0,gap:8,children:[(0,E.jsx)(x.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===We.refundable,onPress:()=>He({refundable:!0})}),(0,E.jsx)(x.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===We.refundable,onPress:()=>He({refundable:!1,cutoffHours:null})}),(0,E.jsx)(x.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===We.refundable,onPress:()=>He({refundable:null,cutoffHours:null})})]}),!0===We.refundable?(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{children:"Refunded if cancelled this many hours before"}),(0,E.jsx)(x.Stepper,{testID:"adv-deposit-cutoff",value:We.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>He({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,E.jsx)(x.T,{children:"Words guests see (optional)"}),(0,E.jsx)(o.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:We.policy,multiline:!0,onChangeText:e=>He({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:S.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:S.colours.hairline,backgroundColor:S.colours.surface2,color:S.colours.text,padding:10,fontSize:15}}),(0,E.jsx)(x.Muted,{size:13,children:We.on&&We.perPersonPence>0?`Guests booking for ${We.fromParty} or more see: \u201c${(0,y.depositWords)(We,We.fromParty,b.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,E.jsx)(x.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!We.wixLinksOn,onChange:e=>He({wixLinksOn:e})}),We.wixLinksOn?(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{children:"Link works for"}),(0,E.jsx)(x.Stepper,{testID:"adv-deposit-linkhours",value:We.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>He({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,E.jsx)(x.Muted,{size:13,children:We.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,E.jsx)(x.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ge=(0,E.jsx)(j.LoyaltySettingsPanel,{}),qe=(0,E.jsx)(X,{rid:M}),Ke=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:ne,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:ie,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ce,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:xe,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Me,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Pe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:Ue,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ge,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:s.IS_GREENSIDE?(0,E.jsx)(t.GreensideCashOnly,{}):(0,E.jsx)(n.TableOrderSettings,{rid:M,me:Q}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Be,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:qe,help:'adv-reminders',onReset:()=>Y(M)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,E.jsx)(A.NotificationsSettings,{rid:M}),help:'adv-notifications',onReset:()=>B.useNotifs.getState().resetSeeds(M)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,E.jsx)(A.OrderListsSettings,{rid:M}),help:'adv-order-lists',onReset:()=>(0,A.resetOrderLists)(M)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,E.jsx)(h.TaskLibrarySettings,{rid:M}),help:'adv-tasks',onReset:()=>p.useDailyTasks.getState().resetLibrary(M)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,E.jsx)(u.CashUpSettings,{rid:M}),help:'adv-cashup',onReset:()=>c.useCashUp.getState().resetFields(M)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,E.jsx)(u.TipsSettings,{rid:M}),help:'adv-tips',onReset:()=>c.useCashUp.getState().setShow(M,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,E.jsx)(A.ClockAreaSettings,{rid:M,me:Q}),help:'adv-clock-area',onReset:()=>(0,A.resetClockArea)(M,Q)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,E.jsx)(d.HrSettingsCard,{rid:M}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ne,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Fe,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,E.jsx)(L.GridSettings,{rid:M,me:Q}),help:'adv-tablegrid',onReset:()=>{const e=z.useFloor.getState().settings[M];z.useFloor.getState().setSettings(M,{...z.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,E.jsx)($.PrintersSettings,{rid:M,go:e}),help:'adv-printers',onReset:()=>{const e=z.useFloor.getState().settings[M];e&&z.useFloor.getState().setSettings(M,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,E.jsx)(r.BlockSettings,{rid:M}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,E.jsx)(l.GiftQrSettings,{rid:M}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:Oe,help:'adv-holidays'}],Qe=J.trim().toLowerCase(),Ye=(0,g.useMemo)(()=>Ke.filter(e=>!Qe||`${e.title} ${e.words}`.toLowerCase().includes(Qe)),[Qe,Ke]);return(0,E.jsxs)(f.default,{style:{gap:12},testID:"advanced-settings",children:[(0,E.jsx)(x.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,E.jsx)(o.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:J,onChangeText:ee,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:S.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:S.colours.accentBorder,backgroundColor:S.colours.surface2,color:S.colours.text,paddingHorizontal:12,fontSize:16}}),se?(0,E.jsx)(x.Banner,{kind:"success",title:se}):null,Ye.length?null:(0,E.jsxs)(x.Muted,{children:["No settings match \u201c",J,"\u201d."]}),Ye.map(s=>(0,E.jsx)(x.Card,{children:(0,E.jsxs)(f.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{size:17,weight:"semibold",colour:S.colours.gold,children:s.title}),e?(0,E.jsx)(m.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,E.jsx)(x.T,{colour:S.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,E.jsx)(x.Row,{style:{justifyContent:'flex-end'},children:(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>oe(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return Q}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,T.useCtx)(6e4),t=(0,k.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,E.jsx)(x.Card,{onPress:()=>e('more','advanced'),highlight:S.colours.gold,children:(0,E.jsxs)(f.default,{testID:"seasons-todo",style:{gap:4},children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:"Setup checklist: kitchen hours"}),(0,E.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]}),(0,E.jsxs)(x.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=e(g),m=e(_r(_d[14])),f=e(_r(_d[15])),x=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),L=_r(_d[30]),$=_r(_d[31]),z=_r(_d[32]),A=_r(_d[33]),B=_r(_d[34]),I=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]);const N=/^([01]\d|2[0-3]):[0-5]\d$/,W=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,H=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,U=[1,2,3,4,5,6,0],_=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function G({value:e,onChange:s,placeholder:t,label:a,width:n=90,bad:l,testID:r}){return(0,E.jsx)(o.TextInput,{accessibilityLabel:a,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:S.colours.muted,style:{width:n,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?S.colours.red:S.colours.hairline,backgroundColor:S.colours.surface2,color:S.colours.text,paddingHorizontal:10,fontSize:15}})}function q({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,E.jsx)(m.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:S.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(x.T,{size:20,colour:S.colours.gold,children:a})});return(0,E.jsxs)(x.Row,{gap:8,children:[r('\u2212',-l),(0,E.jsx)(x.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const K=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const Q={DEFAULT_DWELL:C.DEFAULT_DWELL,ANCHORAGE_SEASONS:k.ANCHORAGE_SEASONS};function Y(e){const s=M.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,M.chairsId)(e))}const V=[1,2,3,4,5,6,0],Z=e=>`${7===e.days.length?'Every day':V.filter(s=>e.days.includes(s)).map(e=>P.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${P.AUDIENCE_LABEL[e.audience]}`;function J({init:e,onSave:s,onCancel:t}){const[a,n]=(0,g.useState)(e.text),[l,r]=(0,g.useState)(e.days),[i,d]=(0,g.useState)(e.time),[h,u]=(0,g.useState)(e.audience),c=a.trim().length>1&&l.length>0&&(0,P.validTime)(i);return(0,E.jsxs)(f.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:S.colours.accentBorder,borderRadius:12,padding:10},children:[(0,E.jsx)(x.T,{weight:"semibold",children:"What it says"}),(0,E.jsx)(o.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:a,onChangeText:n,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:S.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:S.colours.hairline,backgroundColor:S.colours.surface2,color:S.colours.text,paddingHorizontal:10,fontSize:15}}),(0,E.jsx)(x.T,{weight:"semibold",children:"Days"}),(0,E.jsx)(x.Row,{wrap:!0,gap:6,children:V.map(e=>(0,E.jsx)(x.Chip,{label:P.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,E.jsxs)(x.Row,{gap:8,children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Time (UK)"}),(0,E.jsx)(G,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,P.validTime)(i)})]}),(0,E.jsx)(x.T,{weight:"semibold",children:"Who sees it"}),(0,E.jsx)(x.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,E.jsx)(x.Chip,{label:P.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,E.jsx)(x.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,E.jsxs)(x.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,E.jsx)(x.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:a.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function X({rid:e}){b.default.useEffect(()=>{M.useReminders.getState().ensure(e)},[e]);const s=(0,M.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,M.useReminders)(s=>s.rules[e]),a=(0,P.clampRules)(o??P.DEFAULT_BREAK_RULES),n=(0,M.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,O.useOwner)(e=>e.staff),r=M.useReminders.getState(),[i,d]=(0,g.useState)(null),[h,u]=(0,g.useState)(null),c=s=>r.setRules(e,s);return(0,E.jsxs)(f.default,{style:{gap:10},testID:"reminders-settings",children:[(0,E.jsx)(x.Muted,{size:13,children:"Reminders slide up on the phones of 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."}),(0,E.jsx)(x.T,{weight:"semibold",children:"Break reminders"}),(0,E.jsx)(x.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,E.jsx)(x.T,{style:{flex:1},children:"First reminder, if the rota has no break time"}),(0,E.jsx)(q,{label:"first break reminder",step:15,min:30,max:P.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${K(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,E.jsx)(x.T,{style:{flex:1},children:"Remind once more after"}),(0,E.jsx)(q,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,E.jsx)(x.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,E.jsx)(q,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,E.jsxs)(x.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",K(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,E.jsx)(x.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,E.jsx)(f.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:S.colours.hairline,paddingBottom:8},children:i===e.id?(0,E.jsx)(J,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(x.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,E.jsx)(x.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,E.jsx)(x.Muted,{size:13,children:Z(e)}),h===e.id?(0,E.jsxs)(x.Row,{gap:8,wrap:!0,children:[(0,E.jsx)(x.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,E.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,E.jsxs)(x.Row,{gap:8,wrap:!0,children:[(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,E.jsx)(x.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,E.jsx)(x.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,E.jsx)(J,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,E.jsx)(x.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,E.jsxs)(f.default,{style:{gap:2},children:[(0,E.jsx)(x.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,E.jsxs)(x.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,E.jsxs)(x.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (Fri and Sun, 21:00); your own reminders stay."]}),(0,E.jsx)(x.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},884,[5,991,874,885,886,888,889,890,992,948,949,983,993,30,263,127,813,13,891,870,815,828,809,821,954,819,822,994,995,854,892,964,825,996,997,998,999,24]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const h=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=h[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];c(o[0])&&c(o[1])&&s({forecastHours:{...h,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{size:15,style:{width:100},children:r.DAYS[t]}),h[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:h[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??h[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:h[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??h[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{size:15,style:{width:100},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],c=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},885,[874,30,127,813,868,809,821,24]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const y=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),S=!T||(0,b.can)('venue.settings'),[C,N]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[R,P]=(0,t.useState)([]),[M,O]=(0,t.useState)(null),[$,B]=(0,t.useState)(!1),[D,A]=(0,t.useState)(!1),Q=(0,t.useCallback)(async()=>{if(T)try{N(await(0,u.loadTableSettings)()),A(!1),(0,b.can)('venue.settings')&&P(await(0,u.listTableCodes)())}catch(e){O({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(Q(),T?(0,u.watchTableSettings)(()=>{D||Q()}):void 0),[Q]);const _=e=>{N(t=>({...t,...e})),A(!0),O(null)},E=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),F=C.tables??E,L=e=>_({tables:F.includes(e)?F.filter(t=>t!==e):[...F,e].sort((e,t)=>Number(e)-Number(t))}),I=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),G=e=>{const t=I(e);return t.length>0&&t.every(e=>F.includes(e))},W=e=>{const t=I(e),s=G(e);_({tables:s?F.filter(e=>!t.includes(e)):[...new Set([...F,...t])].sort((e,t)=>Number(e)-Number(t))})},H=async()=>{B(!0);try{const e=C.tables&&C.tables.length===E.length&&E.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),A(!1),O({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){O({kind:'danger',t:`Not saved: ${e.message}`})}B(!1)},U=async()=>{B(!0);try{const e=await(0,u.makeTableCodes)(F);P(await(0,u.listTableCodes)()),O({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){O({kind:'danger',t:e.message})}B(!1)},q=async t=>{B(!0);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),O({kind:'warn',t:`${(0,e.tableNumbers)(t)} has a new code. The old QR on that table stops working, so print and swap it.`})}catch(e){O({kind:'danger',t:e.message})}B(!1)};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or till, and the kitchen gets the order like any other ticket."}),S?null:(0,f.jsx)(l.Banner,{kind:"demo",children:"Only managers can change these."}),(0,f.jsx)(l.Toggle,{label:"Guests can order from their table",value:C.on,onChange:e=>_({on:e}),disabled:!S,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>_({staffAccept:e}),disabled:!S}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>I(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:G(e.id),onPress:S?()=>W(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:E.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:F.includes(t),onPress:S?()=>L(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${F.length} of ${E.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:k,onChange:e=>S&&_({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:k,onChange:e=>S&&_({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>_({guestTip:e.slice(0,160)}),editable:S,placeholder:"e.g. Drinks are ordered at the bar."}),S?(0,f.jsx)(l.Button,{label:$?'Saving\u2026':'Save order at the table',disabled:$||!D,onPress:()=>{H()},testID:"tos-save"}):null,M?(0,f.jsx)(l.Banner,{kind:M.kind,children:M.t}):null,S?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${R.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:$,onPress:()=>{U()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print QR sheet (PDF)",disabled:!R.length,onPress:()=>{const e=(0,p.printQrSheet)(y?.name??'Our venue',R.filter(e=>F.includes(e.table)).map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})));O(e?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})},testID:"tos-print"})]}),R.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:[(0,e.tableNumbers)(t.table),F.includes(t.table)?'':' (not taking orders)']}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:`New code for table ${t.table}`,disabled:$,onPress:()=>{q(t.table)}})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{children:"Guests pay at the bar or till. Paying by card from the phone is coming later; no card details are asked for."})]})]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),k=e=>e<0?'Not set':(0,c.hm)(e)},886,[808,30,122,127,813,819,825,873,836,820,875,887,24]); +__d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=o,e.qrSheetHtml=d,e.printQrSheet=function(t,r){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(d(t,r)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},300),!0)};var t=_r(_d[0]);const r=_r(_d[1]),n=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function o(t,n=220){const o=r.create(t,{errorCorrectionLevel:'M'}).modules,d=o.size,l=d+8;let s='';for(let t=0;t`}function d(r,d){const l=d.map(d=>`
${n(r)}
${n((0,t.tableNumbers)(d.table))}
${o(d.link)}
Scan to see the menu and order.
Pay at the bar or till.
${n(d.link)}
`).join('');return`${n(r)} table QR codes
${l}
`}},887,[808,1000]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrSettings=function({rid:e}){const s=(0,n.useFloor)(t=>t.settings[e]),h={...n.DEFAULT_SETTINGS,...s??{}},[p,y]=(0,t.useState)(h.giftQrUrl??''),[Q,b]=(0,t.useState)(''),S=t=>n.useFloor.getState().setSettings(e,{...h,...t}),x=(0,u.giftQrUrlOk)(p);return(0,c.jsxs)(l.default,{style:{gap:8},testID:"adv-giftqr-panel",children:[(0,c.jsx)(o.Toggle,{testID:"giftqr-on",label:"Show \u201cBuy a gift card\u201d on the Display",value:!!h.giftQrOn,disabled:!h.giftQrOn&&!(0,u.giftQrUrlOk)(h.giftQrUrl),onChange:e=>{S({giftQrOn:e}),b(e?'On: the Display shows Buy a gift card.':'Off: the Display hides Buy a gift card.')}}),(0,c.jsx)(o.Field,{testID:"giftqr-url",label:"Your gift card page (https://\u2026)",value:p,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>{y(e.slice(0,u.GIFT_QR_MAX)),b('')},placeholder:"https://www.example.com/gift-card"}),p&&!x?(0,c.jsx)(o.T,{size:13,colour:f.colours.amber,children:"Use the full address starting https://"}):null,(0,c.jsx)(o.Button,{small:!0,label:"Save the page address",testID:"giftqr-save",disabled:!x||p.trim()===(h.giftQrUrl??''),onPress:()=>{S({giftQrUrl:p.trim()}),b('Saved. The Display QR opens this page.')}}),Q?(0,c.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,c.jsx)(o.Muted,{children:Q})}):null,(0,c.jsx)(o.Muted,{size:13,children:"Gift cards are sold through your website. The Display shows only a QR code and \u201cScan to buy a gift card on your phone\u201d: no prices or balances."})]})};var e,t=r(d[0]),s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),n=r(d[3]),u=r(d[4]),f=r(d[5]),c=r(d[6])},888,[30,127,813,825,1001,821,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockSettings=function({rid:e}){const n=(0,o.useFloor)(n=>n.settings[e]),u={...o.DEFAULT_SETTINGS,...n??{}},b=u.serviceWindows??{},m=b.lunch??['12:00','17:00'],w=b.dinner??['17:00','21:00'],f=(n,s)=>o.useFloor.getState().setSettings(e,{...u,serviceWindows:{...b,[n]:s}}),k=(e,n,s,o)=>(0,h.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(t.T,{style:{flex:1},children:e}),(0,h.jsx)(t.Stepper,{testID:o,label:e,value:(0,l.toMins)(n),min:360,max:1425,step:15,format:e=>(0,c.fmt12)((0,l.fromMins)(e)),onChange:s})]});return(0,h.jsxs)(s.default,{style:{gap:8},testID:"adv-blocks-panel",children:[(0,h.jsx)(t.T,{weight:"semibold",children:"Lunch and dinner"}),(0,h.jsx)(t.Muted,{children:"Used by Block now (the Lunch and Dinner buttons) and Spend per head. Always kept inside the kitchen hours for the day."}),b.lunch||b.dinner?null:(0,h.jsx)(t.Muted,{testID:"sw-usual",children:"Usual times now: lunch from opening to 5:00pm, dinner from 5:00pm to close. Change a time below to set your own."}),k('Lunch starts',m[0],e=>f('lunch',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(m[1])-15)),m[1]]),'sw-lunch-from'),k('Lunch ends',m[1],e=>f('lunch',[m[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(m[0])+15))]),'sw-lunch-to'),k('Dinner starts',w[0],e=>f('dinner',[(0,l.fromMins)(Math.min(e,(0,l.toMins)(w[1])-15)),w[1]]),'sw-dinner-from'),k('Dinner ends',w[1],e=>f('dinner',[w[0],(0,l.fromMins)(Math.max(e,(0,l.toMins)(w[0])+15))]),'sw-dinner-to'),b.lunch||b.dinner?(0,h.jsx)(t.Button,{small:!0,kind:"ghost",label:"Use the usual times",onPress:()=>o.useFloor.getState().setSettings(e,{...u,serviceWindows:void 0})}):null,(0,h.jsx)(t.T,{weight:"semibold",style:{marginTop:8},children:"Block on website bookings too"}),(0,h.jsx)(t.Toggle,{testID:"wix-block-push",label:"Copy blocks to website bookings",value:!1,disabled:!0,onChange:()=>{},a11y:"Copy blocks to website bookings. Off until a test block is approved."}),(0,h.jsx)(t.Muted,{size:13,children:"Off until a test block is approved. When it is on, a whole-day or time block made in CoverCharge also closes those times for online booking on your website, and editing or removing it updates website bookings. Website bookings can only close the whole venue, not one area or some tables. Until then, the website can still take bookings in a blocked time, so check those."})]})},r(d[0]);var e,n=r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},t=r(d[2]),o=r(d[3]),l=r(d[4]),c=r(d[5]),h=r(d[6])},889,[30,127,813,825,818,1002,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"advancedPrefill",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"takeAdvancedPrefill",{enumerable:!0,get:function(){return n}});const t={q:''},n=()=>{const n=t.q;return t.q='',n}},890,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,u.staffServer)(),[s,h]=(0,t.useState)(null),[x,y]=(0,t.useState)([]),[p,j]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),v=(0,t.useCallback)(async()=>{try{const[e,t]=await Promise.all([(0,u.readSettings)(),(0,u.readOffers)()]);h(e),y(t)}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,u.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,c.jsx)(l.Banner,{kind:"info",title:"Not connected",children:"Loyalty settings are saved on the server. Not set up yet: sign in to the venue on this device to change them."});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const O=e=>{h({...s,...e}),j(null)},S=(0,o.checkSettings)(s),C=async()=>{if(!S){b(!0);try{await(0,u.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,o.plainError)(e)})}b(!1)}},T=e=>e?`${e} days`:'Never';return(0,c.jsxs)(n.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,c.jsx)(l.T,{weight:"semibold",children:"Stamp card"}),(0,c.jsx)(l.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps for a reward"}),(0,c.jsx)(l.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,c.jsx)(l.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Stamps run out after"}),(0,c.jsx)(l.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Rewards run out after"}),(0,c.jsx)(l.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:T,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Minutes between stamps (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most stamps a day (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,c.jsx)(l.T,{weight:"semibold",children:"Bring a friend"}),(0,c.jsx)(l.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,c.jsx)(l.Field,{label:"Reward for the guest who brings a friend",value:s.referralGiver,onChangeText:e=>O({referralGiver:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsx)(l.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{children:"Most friend rewards a month (one guest)"}),(0,c.jsx)(l.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:S}):null,p?(0,c.jsx)(l.Banner,{kind:p.kind,title:p.text}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{C()}}),(0,c.jsx)(l.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>h({...o.DEFAULT_LOYALTY})})]}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: a friend reward is given when the friend gets their first stamp, and a guest can\u2019t use their own code. Stamps only come from staff, or from a code or QR staff make."}),(0,c.jsx)(l.T,{weight:"semibold",children:"Offers"}),x.length?x.map(e=>(0,c.jsx)(f,{o:e,onSaved:v},e.id)):(0,c.jsx)(l.Muted,{children:"No offers yet."}),(0,c.jsx)(f,{onSaved:v}),(0,c.jsx)(l.Muted,{size:13,children:"Tip: guests see an offer only while it\u2019s on and between its dates. Leave the dates blank to run it until you turn it off."})]})},_e.LoyaltySummaryCard=function({kind:e="card"}){const[s,a]=(0,t.useState)(null),[h,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,u.loyaltySummary)().then(a,e=>f((0,o.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,u.staffServer)())return x(),(0,u.watchLoyalty)(x)},[x]),!(0,u.staffServer)())return null;if(h)return(0,c.jsx)(l.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:h});if(!s)return(0,c.jsx)(l.Muted,{children:"Loading\u2026"});const y='card'===e?[['Guests with a card',s.members],['Joined this month',s.joinedMonth],['Stamps this week',s.stampsWeek],['Stamps this month',s.stampsMonth],['Rewards ready to use',s.rewardsReady],['Rewards used this month',s.rewardsUsedMonth],['Offers live now',s.offersLive]]:[['Friends waiting for their first stamp',s.referralsWaiting],['Friend rewards given',s.referralsRewarded]];return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,c.jsx)(l.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.Muted,{children:e}),(0,c.jsx)(l.T,{weight:"semibold",children:t})]},e)),(0,c.jsx)(l.Muted,{size:13,children:"Tip: these are your real numbers from the server. Change the card in Settings \u203a Advanced \u203a Loyalty."})]})})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=r(d[2]),l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]);const h=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function f({o:e,onSaved:s}){const[f,x]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[y,p]=(0,t.useState)(!!e),[j,w]=(0,t.useState)(null);if(!e&&!y)return(0,c.jsx)(l.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>p(!0)});const b=(!f.startsOn||h.test(f.startsOn))&&(!f.endsOn||h.test(f.endsOn))?(0,o.checkOffer)({title:f.title,details:f.details,startsOn:f.startsOn||null,endsOn:f.endsOn||null}):'Dates look like 2026-12-01.',v=async()=>{if(!b)try{await(0,u.saveOffer)({id:e?.id,title:f.title.trim(),details:f.details.trim(),startsOn:f.startsOn||null,endsOn:f.endsOn||null,isOn:f.isOn}),w('Saved.'),e||(x({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),p(!1)),s()}catch(e){w((0,o.plainError)(e))}};return(0,c.jsx)(l.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[e?(0,c.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(l.T,{weight:"semibold",children:e.title}),(0,c.jsx)(l.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,c.jsx)(l.T,{weight:"semibold",children:"New offer"}),(0,c.jsx)(l.Field,{label:"Title",value:f.title,onChangeText:e=>x({...f,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,c.jsx)(l.Field,{label:"Details",value:f.details,onChangeText:e=>x({...f,details:e.slice(0,500)}),multiline:!0}),(0,c.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(l.Field,{label:"Starts (optional)",value:f.startsOn,onChangeText:e=>x({...f,startsOn:e.trim()}),placeholder:"2026-12-01"}),(0,c.jsx)(l.Field,{label:"Ends (optional)",value:f.endsOn,onChangeText:e=>x({...f,endsOn:e.trim()}),placeholder:"2026-12-24"})]}),(0,c.jsx)(l.Toggle,{label:"Offer on",value:f.isOn,onChange:e=>x({...f,isOn:e})}),b&&(f.title||e)?(0,c.jsx)(l.T,{size:13,colour:a.colours.amber,children:b}):null,j?(0,c.jsx)(l.Muted,{size:13,children:j}):null,(0,c.jsxs)(l.Row,{gap:8,children:[(0,c.jsx)(l.Button,{small:!0,label:"Save offer",disabled:!!b,onPress:()=>{v()}}),e?null:(0,c.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>p(!1)})]})]})})}},891,[30,127,821,813,1003,836,24]); +__d(function(_g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.tidyWholePlan=u,_e.restoreTidy=h,_e.GridSettings=function({rid:e,me:s}){const c=(0,r.useFloor)(t=>t.settings[e]),p={...r.DEFAULT_SETTINGS,...c??{}},y=t=>r.useFloor.getState().setSettings(e,{...p,...t}),[b,S]=(0,t.useState)(''),f=(0,o.gridOf)(p.gridSize),v=p.tidyBackup,T=v?new Date(v.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'';return(0,g.jsxs)(n.default,{style:{gap:8},children:[(0,g.jsx)(a.Toggle,{testID:"adv-grid-snap",label:"Snap tables to the grid when dragging",value:!1!==p.gridSnap,onChange:e=>y({gridSnap:e}),a11y:"Snap tables to the grid when dragging"}),(0,g.jsx)(a.Muted,{size:13,children:!1!==p.gridSnap?'On: tables jump to the nearest grid line and line up with other tables (gold guides show when edges or centres match). Hold Alt (Option on a Mac) while dragging to move freely.':'Off: tables go exactly where you let go. Gold guides still help you line them up.'}),(0,g.jsx)(a.T,{children:"Grid size"}),(0,g.jsx)(a.Row,{wrap:!0,gap:8,children:o.GRID_SIZES.map(e=>(0,g.jsx)(a.Chip,{testID:`adv-grid-${e}`,label:10===e?'Fine (10)':25===e?'Normal (25)':'Coarse (50)',selected:f===e,onPress:()=>y({gridSize:e})},e))}),(0,g.jsx)(a.Button,{testID:"adv-grid-tidy",label:"Tidy up the whole plan",onPress:()=>{const t=u(e,s,(new Date).toISOString());S(t.moved?`Tidied: ${t.moved} tables lined up on the grid. The old positions are kept below.`:'Already tidy. Nothing moved.')}}),(0,g.jsx)(a.Muted,{size:13,children:"Tidy up snaps every table to the grid and evens out the rows, area by area. Only positions change: table numbers, areas, covers, sizes and best tables stay as they are."}),v?(0,g.jsxs)(n.default,{testID:"adv-grid-backup",style:{borderWidth:1,borderColor:l.colours.gold,borderRadius:10,padding:10,gap:6},children:[(0,g.jsxs)(a.T,{size:14,children:["Positions from before the tidy on ",T,v.by?` (${v.by})`:''," are kept."]}),(0,g.jsx)(a.Button,{testID:"adv-grid-restore",kind:"secondary",label:"Put the tables back where they were",onPress:()=>{h(e)&&S('Done: every table is back where it was before the tidy.')}})]}):null,b?(0,g.jsx)(a.Banner,{kind:"success",title:b}):null,(0,g.jsx)(a.Muted,{size:13,children:"Tip: in the table plan editor, Tidy up does one area at a time and you can undo it with \u2318Z (Ctrl+Z)."})]})};var e,t=_r(d[0]),s=_r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},a=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),g=_r(d[6]);function u(e,t,s){const n=r.useFloor.getState(),a=n.plans[e]??(0,r.planOf)(e),l={...r.DEFAULT_SETTINGS,...n.settings[e]??{}};let g=a;for(const e of a.areas)g=(0,o.tidyArea)(g,e.id,(0,o.gridOf)(l.gridSize));const u=(0,o.movedCount)(a,g);return u?(n.setSettings(e,{...l,tidyBackup:(0,o.backupOf)(a,s,t,'Before Tidy up')}),n.setPlan(e,g),{moved:u}):{moved:u}}function h(e){const t=r.useFloor.getState(),s={...r.DEFAULT_SETTINGS,...t.settings[e]??{}},n=s.tidyBackup;return!!n&&(t.setPlan(e,(0,o.restoreFrom)(t.plans[e]??(0,r.planOf)(e),n)),t.setSettings(e,{...s,tidyBackup:void 0}),!0)}},892,[30,127,813,825,1004,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.CountUp=function({value:e,format:t=e=>String(Math.round(e)),size:l=26,colour:n=a.colours.text}){const i=(0,r.useRef)(new o.default.Value(0)).current,[h,x]=(0,r.useState)(0);return(0,r.useEffect)(()=>{const t=i.addListener(({value:e})=>x(e));return o.default.timing(i,{toValue:e,duration:900,easing:s.default.out(s.default.cubic),useNativeDriver:!1}).start(),()=>i.removeListener(t)},[e]),(0,c.jsx)(u.T,{size:l,weight:"bold",colour:n,children:t(h)})},_e.FadeIn=function({children:e,delay:t=0,style:l}){const n=(0,r.useRef)(new o.default.Value(0)).current;return(0,r.useEffect)(()=>{o.default.timing(n,{toValue:1,duration:450,delay:t,easing:s.default.out(s.default.quad),useNativeDriver:!0}).start()},[]),(0,c.jsx)(o.default.View,{style:[{opacity:n,transform:[{translateY:n.interpolate({inputRange:[0,1],outputRange:[12,0]})}]},l],children:e})},_e.Gauge=function({pct:e,label:t,sub:h,size:x=220}){const f=(0,r.useRef)(new o.default.Value(0)).current,[y,j]=(0,r.useState)(0);(0,r.useEffect)(()=>{const t=f.addListener(({value:e})=>j(e));return o.default.timing(f,{toValue:Math.min(1.2,Math.max(0,e)),duration:1200,easing:s.default.out(s.default.back(1.2)),useNativeDriver:!1}).start(),()=>f.removeListener(t)},[e]);const k=x,p=.62*x,M=k/2,b=p-8,S=k/2-16,v=e=>Math.PI*(1-Math.min(1.2,Math.max(0,e))/1.2),w=(e,t=S)=>[M+t*Math.cos(v(e)),b-t*Math.sin(v(e))],z=(e,t)=>{const[r,o]=w(e),[s,l]=w(t);return`M ${r} ${o} A ${S} ${S} 0 0 1 ${s} ${l}`},L=[[0,.35,a.colours.ok],[.35,.6,a.colours.blue],[.6,.85,a.colours.amber],[.85,1.2,a.colours.red]],[$,T]=w(y,S-18);return(0,c.jsxs)(l.default,{style:{alignItems:'center'},children:[(0,c.jsxs)(i.default,{width:k,height:p,children:[(0,c.jsx)(n.Path,{d:z(0,1.2),stroke:a.colours.surface2,strokeWidth:18,fill:"none"}),L.map(([e,t,r])=>(0,c.jsx)(n.Path,{d:z(e+.005,t-.005),stroke:r,strokeOpacity:.85,strokeWidth:14,fill:"none"},r)),(0,c.jsx)(n.Line,{x1:M,y1:b,x2:$,y2:T,stroke:a.colours.text,strokeWidth:4,strokeLinecap:"round"}),(0,c.jsx)(n.Circle,{cx:M,cy:b,r:8,fill:a.colours.gold})]}),(0,c.jsx)(u.T,{size:22,weight:"bold",colour:a.colours.gold,style:{marginTop:-4},children:t}),h?(0,c.jsx)(u.T,{size:13,colour:a.colours.muted,center:!0,children:h}):null]})},_e.LineChart=function({series:e,labels:r,width:o,height:s=140,colours:l=[a.colours.gold,a.colours.blue]}){const u=Math.max(1,...e.flat()),h=Math.max(1,r.length-1),x=e=>8+e/h*(o-16),f=e=>s-18-e/u*(s-30);return(0,c.jsxs)(i.default,{width:o,height:s,children:[[.25,.5,.75,1].map(e=>(0,c.jsx)(n.Line,{x1:8,x2:o-8,y1:f(u*e),y2:f(u*e),stroke:a.colours.border,strokeWidth:1},e)),e.map((e,t)=>(0,c.jsx)(n.Polyline,{points:e.map((e,t)=>`${x(t)},${f(e)}`).join(' '),fill:"none",stroke:l[t],strokeWidth:2.5},t)),r.map((e,o)=>o%Math.ceil(r.length/7)===0?(0,c.jsx)(n.Text,{x:x(o),y:s-3,fill:a.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"middle",children:e},o):null)]})},_e.Donut=function({parts:e,size:r=130,centre:o}){const s=Math.max(1,e.reduce((e,t)=>e+t.value,0)),l=r/2-12,u=2*Math.PI*l;let h=0;return(0,c.jsxs)(i.default,{width:r,height:r,children:[(0,c.jsx)(n.G,{rotation:-90,origin:`${r/2}, ${r/2}`,children:e.map((e,t)=>{const o=e.value/s*u,i=(0,c.jsx)(n.Circle,{cx:r/2,cy:r/2,r:l,stroke:e.colour,strokeWidth:18,fill:"none",strokeDasharray:`${o} ${u-o}`,strokeDashoffset:-h},t);return h+=o,i})}),o?(0,c.jsx)(n.Text,{x:r/2,y:r/2+5,fill:a.colours.text,fontSize:(0,t.soutersFont)(15),fontWeight:"bold",textAnchor:"middle",children:o}):null]})},_e.Scatter=function({points:e,width:r,height:o=240,xMid:s,yMid:l}){const u=1.08*Math.max(1,...e.map(e=>e.x)),h=1.08*Math.max(1,...e.map(e=>e.y)),x=e=>10+e/u*(r-20),f=e=>o-10-e/h*(o-20);return(0,c.jsxs)(i.default,{width:r,height:o,children:[(0,c.jsx)(n.Rect,{x:0,y:0,width:r,height:o,fill:a.colours.surface2,rx:10}),(0,c.jsx)(n.Line,{x1:x(s),x2:x(s),y1:6,y2:o-6,stroke:a.colours.border,strokeDasharray:"4 4"}),(0,c.jsx)(n.Line,{y1:f(l),y2:f(l),x1:6,x2:r-6,stroke:a.colours.border,strokeDasharray:"4 4"}),(0,c.jsx)(n.Text,{x:r-12,y:18,fill:a.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"STARS"}),(0,c.jsx)(n.Text,{x:14,y:18,fill:a.colours.blue,fontSize:(0,t.soutersFont)(11),children:"PUZZLES"}),(0,c.jsx)(n.Text,{x:r-12,y:o-14,fill:a.colours.amber,fontSize:(0,t.soutersFont)(11),textAnchor:"end",children:"PLOUGH HORSES"}),(0,c.jsx)(n.Text,{x:14,y:o-14,fill:a.colours.red,fontSize:(0,t.soutersFont)(11),children:"DOGS"}),e.map((e,t)=>(0,c.jsx)(n.Circle,{cx:x(e.x),cy:f(e.y),r:6,fill:e.colour,fillOpacity:.9},t))]})};var t=_r(d[0]),r=_r(d[1]),o=e(_r(d[2])),s=e(_r(d[3])),l=e(_r(d[4])),n=_r(d[5]),i=e(n),u=_r(d[6]),a=_r(d[7]),c=_r(d[8])},893,[878,30,120,224,127,1005,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.ProgressBar=O,_e.useSetupDone=$,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,k.useCtx)(6e4),n=$(s),o=n.prog,[a,l]=(0,d.useState)(e??null);if(a){const e=f.SETUP_STEPS.findIndex(e=>e.id===a),s=f.SETUP_STEPS[e+1]?.id??null;return(0,P.jsx)(D,{id:a,wizard:!0,onBack:()=>l(e>0?f.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=f.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,P.jsxs)(h.default,{style:{gap:12},testID:"setup-guide",children:[(0,P.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,P.jsxs)(x.Row,{gap:12,children:[(0,P.jsx)(g.RestaurantLogo,{rid:s,size:56}),(0,P.jsxs)(h.default,{style:{flex:1},children:[(0,P.jsxs)(x.T,{size:20,weight:"bold",colour:S.colours.gold,children:["Set up ",t.name]}),(0,P.jsx)(x.Muted,{children:n.loading?'Checking what is already set up\u2026':i?'Everything is set up. Open any step to check or change it.':'Nine short steps. Do them in order or jump to any one; you can come back to each from Settings.'})]})]}),(0,P.jsx)(O,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,P.jsx)(x.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,P.jsx)(h.default,{style:{borderRadius:14,borderWidth:1,borderColor:S.colours.border,backgroundColor:S.colours.surface,overflow:'hidden'},children:f.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,P.jsxs)(c.default,{testID:`setup-step-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Step ${s+1}: ${e.title}${t?', done':o.length?`, still needed: ${o.join(', ')}`:''}`,onPress:()=>l(e.id),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',gap:12,padding:12,minHeight:60,borderTopWidth:s?1:0,borderColor:S.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,P.jsx)(h.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?S.colours.gold:'transparent',borderWidth:1.5,borderColor:t?S.colours.gold:S.colours.border},children:(0,P.jsx)(x.T,{weight:"bold",colour:t?S.colours.onGold:S.colours.muted,children:t?'\u2713':s+1})}),(0,P.jsxs)(h.default,{style:{flex:1},children:[(0,P.jsx)(x.T,{weight:"medium",children:e.title}),(0,P.jsx)(x.Muted,{children:e.sub}),o.length?(0,P.jsxs)(x.T,{size:13,colour:S.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,P.jsx)(x.Badge,{kind:"ok",label:"Done"}):null,(0,P.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=D,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return A}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,k.useCtx)(6e4),t=$(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,P.jsxs)(x.Card,{onPress:()=>e('more','setup'),highlight:S.colours.gold,children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:"Finish setting up"}),(0,P.jsx)(x.T,{colour:S.colours.muted,children:"\u203a"})]}),(0,P.jsx)(O,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,P.jsxs)(x.Muted,{size:13,children:["Next: ",f.SETUP_STEPS.find(e=>!t.isDone(e.id))?.title]})]})};var s=_r(_d[0]),t=_r(_d[1]),n=(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})(_r(_d[2])),o=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),u=e(_r(_d[9])),c=e(_r(_d[10])),h=e(_r(_d[11])),g=_r(_d[12]),p=_r(_d[13]),x=_r(_d[14]),m=_r(_d[15]),b=_r(_d[16]),j=_r(_d[17]),f=_r(_d[18]),y=_r(_d[19]),w=_r(_d[20]),S=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),T=_r(_d[24]),v=_r(_d[25]),P=_r(_d[26]);const R=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],M=[1,2,3,4,5,6,0],E=/^([01]\d|2[0-3]):[0-5]\d$/,z=1271,B=e=>{const s=Number(e.replace(/[\xa3,\s]/g,''));return Number.isFinite(s)&&s>0?Math.round(100*s):null},I=e=>f.SETUP_STEPS.findIndex(s=>s.id===e)+1;function O({done:e,total:t,testID:n}){const o=t?e/t:0;return(0,P.jsxs)(h.default,{testID:n,accessibilityRole:"progressbar",accessibilityValue:{min:0,max:t,now:e},accessibilityLabel:`${e} of ${t} steps done`,style:{gap:4},children:[(0,P.jsx)(h.default,{style:{height:10,borderRadius:5,backgroundColor:(0,s.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:S.colours.border},children:(0,P.jsx)(h.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:S.colours.gold,borderRadius:5}})}),(0,P.jsxs)(x.Muted,{size:12,children:[e," of ",t," steps done"]})]})}function $(e){const s=(0,f.useSiteSetup)(e),t=(0,g.useBrand)(e),{status:n,live:r}=(0,a.useSetupStatus)(),i=(0,d.useMemo)(()=>n?(0,o.evalSetup)(n,{logo:!!t.logo,email:s.email,bookingUrl:s.bookingUrl}):null,[n,t.logo,s.email,s.bookingUrl]),u=(0,l.useSetupMarksLoaded)(),c=e=>i?(0,l.applyMark)(!!i[e]?.done,u[e]):!!s.done[e],h=f.SETUP_STEPS.filter(e=>c(e.id)).length;return{isDone:c,markOf:e=>u[e],missing:e=>i?i[e]?.missing??[]:[],prog:{done:h,total:f.SETUP_STEPS.length},loading:r&&!n,fromVenue:!!i}}function D({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,k.useCtx)(6e4),r=$(a),i=r.prog,u=(0,l.useLiveVenue)(),g=f.SETUP_STEPS.find(s=>s.id===e),[p,m]=(0,d.useState)(null),b=L[e];return(0,P.jsxs)(h.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(x.T,{size:12,weight:"semibold",colour:S.colours.gold,children:["STEP ",I(e)," OF ",f.SETUP_STEPS.length]}),s&&o?(0,P.jsx)(c.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,P.jsx)(x.T,{size:13,colour:S.colours.muted,children:"All steps"})}):null]}),(0,P.jsx)(x.T,{size:22,weight:"bold",children:g.title}),(0,P.jsx)(O,{done:i.done,total:i.total})]}),(0,P.jsx)(b,{rid:a,done:(t="Saved.")=>{f.useSetup.getState().markDone(a,e),u&&!1===r.markOf(e)?.done&&l.useSetupMarks.getState().set(u,e,!0),s&&n?n():m(t)},wizard:!!s}),p?(0,P.jsx)(x.Banner,{kind:"success",title:p}):null,(0,P.jsx)(U,{rid:a,id:e,title:g.title,onDone:m}),s?(0,P.jsxs)(x.Row,{gap:10,children:[(0,P.jsx)(x.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,P.jsx)(x.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const F=({wizard:e,onPress:s,disabled:t,label:n})=>(0,P.jsx)(x.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const L={venue:function({rid:e,done:t,wizard:o}){const{r:a}=(0,k.useCtx)(6e4),l=(0,g.useBrand)(e),[r,i]=(0,d.useState)({name:a.name,address:a.address??a.location,phone:a.phone??'',tagline:a.tagline}),[u,c]=(0,d.useState)('');return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Field,{label:"Venue name",value:r.name,onChangeText:e=>i({...r,name:e})}),(0,P.jsx)(x.Field,{label:"Address",value:r.address,onChangeText:e=>i({...r,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,P.jsx)(x.Field,{label:"Phone",value:r.phone,onChangeText:e=>i({...r,phone:e}),keyboardType:"phone-pad"}),(0,P.jsx)(x.Field,{label:"Tagline",value:r.tagline,onChangeText:e=>i({...r,tagline:e}),placeholder:"e.g. Seafood and real ale by the harbour"})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Logo"}),(0,P.jsxs)(x.Row,{gap:14,children:[(0,P.jsx)(h.default,{style:{backgroundColor:(0,s.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:S.colours.border},children:(0,P.jsx)(g.RestaurantLogo,{rid:e,size:72})}),(0,P.jsxs)(h.default,{style:{flex:1,gap:6},children:[(0,P.jsxs)(x.Muted,{children:[l.custom?'Your uploaded logo.':'anchorage'===e?'The Anchorage logo in black and gold.':'greenside'===e?'The Greenside Restaurant logo.':'abbotsford'===e?'The Abbotsford Hotel logo.':'kirkton'===e?'The Kirkton Inn logo.':'wildings'===e?'The Wildings Hotel & Restaurant logo.':'kirkmichael'===e?'The Kirkmichael Arms logo.':'souters'===e?'The Souter\u2019s Inn logo.':'Placeholder initials.'," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,P.jsxs)(x.Row,{gap:8,wrap:!0,children:[(0,P.jsx)(x.Button,{small:!0,label:"Upload a logo",onPress:async()=>{const s=await n.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(s.canceled||!s.assets?.[0])return;const t=s.assets[0];b.useOwner.getState().setBranding(e,{logoUri:t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri})}}),l.custom?(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>b.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,P.jsx)(v.OrderAtTableCard,{rid:e,compact:!0}),u?(0,P.jsx)(x.Banner,{kind:"warn",title:u}):null,(0,P.jsx)(F,{wizard:o,onPress:()=>{r.name.trim().length<2?c('Add your venue\u2019s name.'):(m.useStore.getState().updateRestaurant(a.id,{name:r.name.trim(),address:r.address.trim(),phone:r.phone.trim(),tagline:r.tagline.trim()}),c(''),t('Venue details saved.'))}})]})},hours:function({done:e,wizard:s}){const{r:n}=(0,k.useCtx)(6e4),[o,a]=(0,d.useState)(n.kitchenHours),l=M.filter(e=>{const s=o[e];return s&&(!E.test(s[0])||!E.test(s[1]))});return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),R.map((e,s)=>{const n=M[s],l=o[n];return(0,P.jsxs)(x.Row,{gap:8,style:{minHeight:52,borderTopWidth:s?1:0,borderTopColor:S.colours.border,paddingTop:s?6:0},children:[(0,P.jsx)(x.T,{weight:"medium",style:{width:92},children:e}),l?(0,P.jsxs)(x.Row,{gap:6,style:{flex:1},children:[(0,P.jsx)(t.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...o,[n]:[e,l[1]]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,P.jsx)(x.T,{colour:S.colours.muted,children:"to"}),(0,P.jsx)(t.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...o,[n]:[l[0],e]}),style:[x.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,P.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,P.jsx)(x.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...o,[n]:e?['12:00','21:00']:null})})]},e)}),o[1]?(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=o[1];e&&a(Object.fromEntries(M.map(s=>[s,o[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,P.jsx)(x.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,P.jsx)(F,{wizard:s,disabled:!!l.length,onPress:()=>{m.useStore.getState().updateRestaurant(n.id,{kitchenHours:o}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,j.usePlan)(e),o=(0,j.planCounts)(n);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(T.TablePlan,{startStep:"areas"}),(0,P.jsx)(F,{wizard:t,disabled:!o.tables,label:t?`Looks right (${o.tables} tables, ${o.seats} seats), continue`:'Mark as done',onPress:()=>s('Table plan step marked as done.')})]})},paygrades:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,d.useState)(()=>n.grades.map(e=>({...e,text:(e.pence/100).toFixed(2)}))),l=(e,s)=>a(t=>t.map(t=>t.id===e?{...t,...s}:t)),r=o.map(e=>({...e,p:B(e.text)})),i=r.some(e=>!e.name.trim()||null==e.p);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"A note on the minimum wage"}),(0,P.jsx)(x.Muted,{children:"In the UK the legal minimum depends on age, and apprentices have their own rate. From 1 April 2026 the National Living Wage for people aged 21 and over is \xa312.71 an hour. Please check the current rate for each age on GOV.UK before you set pay."}),(0,P.jsx)(c.default,{accessibilityRole:"link",onPress:()=>u.default.openURL("https://www.gov.uk/national-minimum-wage-rates"),style:{minHeight:44,justifyContent:'center'},children:(0,P.jsx)(x.T,{colour:S.colours.gold,weight:"semibold",children:"Minimum wage rates on GOV.UK \u2197"})})]}),r.map(e=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{gap:8,style:{alignItems:'flex-end'},children:[(0,P.jsx)(h.default,{style:{flex:2},children:(0,P.jsx)(x.Field,{label:"Grade name",value:e.name,onChangeText:s=>l(e.id,{name:s}),placeholder:"e.g. Front of house"})}),(0,P.jsx)(h.default,{style:{flex:1},children:(0,P.jsx)(x.Field,{label:"\xa3 per hour",value:e.text,onChangeText:s=>l(e.id,{text:s}),keyboardType:"decimal-pad"})})]}),null!=e.p&&e.ps===e.id).length," people on this grade"]}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>a(s=>s.filter(s=>s.id!==e.id))})]})]},e.id)),(0,P.jsx)(x.Button,{kind:"secondary",label:"Add a pay grade",testID:"add-grade",onPress:()=>a(e=>[...e,{id:`pg-${Date.now().toString(36)}`,name:'',pence:z,text:'12.71'}])}),(0,P.jsx)(F,{wizard:t,disabled:i||!o.length,onPress:()=>{const t=r.map(e=>({id:e.id,name:e.name.trim(),pence:e.p}));f.useSetup.getState().patch(e,{grades:t}),Object.entries(n.staffGrade).forEach(([e,s])=>{const n=t.find(e=>e.id===s);n&&b.useOwner.getState().setRate(e,n.pence)}),s('Pay grades saved.')}})]})},staff:function({rid:e,done:s,wizard:t}){const n=(0,b.useOwner)(e=>e.staff).filter(e=>e.active),o=(0,b.useOwner)(e=>e.hourly),a=(0,k.useHourly)(),l=(0,f.useSiteSetup)(e),r=(0,f.useSetup)(e=>e.looks),[i,u]=(0,d.useState)(null),[g,m]=(0,d.useState)(null),j=e=>{const s=l.grades.find(s=>s.id===l.staffGrade[e.id]);return e.salaried&&null==o[e.id]?'Salaried, no hourly wage':s?`${s.name} grade`:null==o[e.id]?'Pay not set':null!=a[e.id]?`${(0,w.gbp)(a[e.id])} an hour`:'Hourly rate set'},C=e=>{const s=l.staffGrade[e.id];u({id:e.id,name:e.name,job:e.job,access:(0,f.accessOf)(e.level,e.role),pay:e.salaried&&null==o[e.id]?'salaried':s?'grade':'own',gradeId:s??l.grades[0]?.id??'',wage:null!=a[e.id]?(a[e.id]/100).toFixed(2):'',noTax:!!e.noTax,look:r[e.id]??null}),m(null)},T=!!i?.id&&(v=i.id,y.ROSTER.some(e=>e.id===v));var v;const R=i?B(i.wage):null,M=!!i&&i.name.trim().length>=2&&('grade'!==i.pay||!!i.gradeId)&&('own'!==i.pay||null!=R||T&&!i.wage);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Muted,{children:[n.length," people. Tap someone to change their pay, tax or avatar. People from your roster keep their name, access and personal link."]}),(0,P.jsx)(h.default,{style:{gap:8},children:n.map(e=>(0,P.jsxs)(c.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>C(e),style:({pressed:s})=>({flexDirection:'row',alignItems:'center',gap:10,padding:10,borderRadius:14,borderWidth:1,borderColor:i?.id===e.id?S.colours.gold:S.colours.border,backgroundColor:s?'#1d1a14':S.colours.surface}),children:[(0,P.jsx)(p.StaffAvatar,{id:e.id,size:42}),(0,P.jsxs)(h.default,{style:{flex:1},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.name}),(0,P.jsxs)(x.Muted,{size:13,children:[e.job," \xb7 ",j(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,P.jsx)(x.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,f.accessOf)(e.level,e.role)})]},e.id))}),g?(0,P.jsx)(x.Banner,{kind:"success",title:g}):null,i?(0,P.jsxs)(x.Card,{highlight:S.colours.gold,children:[(0,P.jsx)(x.T,{weight:"semibold",size:18,children:i.id?`Edit ${i.name}`:'New team member'}),(0,P.jsxs)(x.Row,{gap:14,children:[(0,P.jsx)(h.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:S.colours.gold},children:(0,P.jsx)(p.AvatarArt,{spec:null!=i.look?(0,p.specFor)(`${i.id??i.name}#look${i.look}`):(0,p.specFor)(i.id,i.name||'new'),size:80})}),(0,P.jsxs)(h.default,{style:{flex:1,gap:6},children:[(0,P.jsx)(x.Muted,{children:"Avatar: a space-age crew look. They can make their own from a photo later in My avatar."}),(0,P.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>u({...i,look:((i.look??0)+1)%40})}),null!=i.look?(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>u({...i,look:null})}):null]})]})]}),T?(0,P.jsxs)(x.Muted,{children:[i.name," is on your roster: name and access stay as they are."]}):(0,P.jsx)(x.Field,{label:"Name",value:i.name,onChangeText:e=>u({...i,name:e}),placeholder:"First and last name"}),(0,P.jsx)(x.Field,{label:"Job title",value:i.job,onChangeText:e=>u({...i,job:e}),placeholder:"e.g. Kitchen porter"}),T?null:(0,P.jsxs)(h.default,{style:{gap:6},children:[(0,P.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Access level"}),(0,P.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,P.jsx)(x.Chip,{label:e,selected:i.access===e,onPress:()=>u({...i,access:e})},e))}),(0,P.jsxs)(x.Muted,{size:13,children:["Uses the ",f.ACCESS_APP[i.access]," app. Change what each level can do in Permissions."]})]}),(0,P.jsxs)(h.default,{style:{gap:6},children:[(0,P.jsx)(x.T,{size:14,weight:"medium",colour:S.colours.muted,children:"Pay"}),(0,P.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,P.jsx)(x.Chip,{label:"Pay grade",selected:'grade'===i.pay,onPress:()=>u({...i,pay:'grade'})}),(0,P.jsx)(x.Chip,{label:"Own hourly rate",selected:'own'===i.pay,onPress:()=>u({...i,pay:'own'})}),(0,P.jsx)(x.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===i.pay,onPress:()=>u({...i,pay:'salaried'})})]}),'grade'===i.pay?(0,P.jsx)(x.Row,{gap:6,wrap:!0,children:l.grades.map(e=>(0,P.jsx)(x.Chip,{label:`${e.name} \xb7 ${(0,w.gbp)(e.pence)}`,selected:i.gradeId===e.id,onPress:()=>u({...i,gradeId:e.id})},e.id))}):null,'own'===i.pay?(0,P.jsx)(x.Field,{label:"\xa3 per hour",value:i.wage,onChangeText:e=>u({...i,wage:e}),keyboardType:"decimal-pad",placeholder:T?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===i.pay&&null!=R&&Ru({...i,noTax:e})}),(0,P.jsxs)(x.Row,{gap:8,children:[(0,P.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>u(null),style:{flex:1}}),(0,P.jsx)(x.Button,{label:i.id?'Save':'Add to team',testID:"staff-save",disabled:!M,onPress:()=>{if(!i||!M)return;const s=b.useOwner.getState();let t=i.id;if(!t){const e=new Set(s.staff.map(e=>e.id));if(s.addStaff(i.name.trim(),f.ACCESS_ROLE[i.access],i.job.trim()||'Team member'),t=b.useOwner.getState().staff.find(s=>!e.has(s.id))?.id,!t)return}const n={job:i.job.trim()||'Team member',salaried:'salaried'===i.pay,noTax:i.noTax};T||Object.assign(n,{name:i.name.trim(),level:i.access,role:f.ACCESS_ROLE[i.access],dept:'Head Chef'===i.access?'Kitchen':void 0}),s.updateStaff(t,n);const o={...l.staffGrade};if('grade'===i.pay){const e=l.grades.find(e=>e.id===i.gradeId);e&&(s.setRate(t,e.pence),o[t]=e.id)}else delete o[t],'own'===i.pay&&null!=R&&s.setRate(t,R);'salaried'===i.pay&&b.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),f.useSetup.getState().patch(e,{staffGrade:o}),f.useSetup.getState().setLook(t,i.look),m(`${i.name.trim()} ${i.id?'updated':'added'}.`),u(null)},style:{flex:1}})]}),i.id?null:(0,P.jsx)(x.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):(0,P.jsx)(x.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{u({name:'',job:'',access:'Staff',pay:'grade',gradeId:l.grades[0]?.id??'',wage:'',noTax:!1,look:null}),m(null)}}),(0,P.jsx)(F,{wizard:t,label:t?'Team looks right, continue':'Mark as done',onPress:()=>s('Team step marked as done.')})]})},permissions:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),[o,a]=(0,d.useState)('Manager'),l=e=>f.PERMS.filter(s=>n.perms[e]?.[s.id]).length;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(x.Muted,{children:"Tick what each access level can do. We\u2019ve started you with sensible defaults; change any of them."}),(0,P.jsx)(x.Row,{gap:6,wrap:!0,children:f.ACCESS_LEVELS.map(e=>(0,P.jsx)(x.Chip,{label:e,sub:`${l(e)} of ${f.PERMS.length}`,selected:o===e,onPress:()=>a(e)},e))}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",colour:S.colours.gold,children:o}),'Owner'===o?(0,P.jsx)(x.Muted,{children:"The owner can always do everything."}):null,f.PERMS.map((s,t)=>{const a=!!n.perms[o]?.[s.id],l='Owner'===o;return(0,P.jsxs)(c.default,{testID:`perm-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:a,disabled:l},accessibilityLabel:`${o}: ${s.label}`,disabled:l,onPress:()=>f.useSetup.getState().setPerm(e,o,s.id,!a),style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:50,borderTopWidth:t?1:0,borderTopColor:S.colours.border,opacity:l?.75:1},children:[(0,P.jsx)(h.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:a?S.colours.gold:S.colours.muted,backgroundColor:a?S.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:a?(0,P.jsx)(x.T,{weight:"bold",colour:S.colours.onGold,children:"\u2713"}):null}),(0,P.jsx)(x.T,{style:{flex:1},children:s.label})]},s.id)})]}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Back to the suggested defaults",onPress:()=>f.useSetup.getState().resetPerms(e)}),(0,P.jsx)(x.Banner,{kind:"info",title:"Saved on this device",children:"For now the apps still follow the built-in Owner, Manager and Staff rules. These ticks will control access once staff accounts go live."}),(0,P.jsx)(F,{wizard:t,onPress:()=>s('Permissions saved.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,f.useSiteSetup)(e),o=(0,b.useOwner)(e=>e.workEmail),[a,l]=(0,d.useState)(n.email||o||''),r=!a.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a.trim());return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Field,{label:"Work email address",value:a,onChangeText:l,placeholder:"e.g. hello@yourvenue.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),r?null:(0,P.jsx)(x.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,P.jsx)(x.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Link your inbox"}),(0,P.jsx)(x.Badge,{kind:"amber",label:"Coming soon"})]}),(0,P.jsx)(x.Muted,{children:"Later you\u2019ll be able to link your inbox so booking emails appear in CoverCharge. Nothing is linked yet: CoverCharge doesn\u2019t read or send email from here."}),(0,P.jsx)(x.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,P.jsx)(F,{wizard:t,disabled:!r,onPress:()=>{f.useSetup.getState().patch(e,{email:a.trim()}),a.trim()&&b.useOwner.getState().setOwner({workEmail:a.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:t,wizard:n}){const{r:o}=(0,k.useCtx)(6e4),a=(0,f.useSiteSetup)(e),[l,r]=(0,d.useState)(a.website||o.website||''),i=(0,d.useMemo)(()=>(0,C.appUrl)('/customer-app/index.html'),[]),[u,c]=(0,d.useState)(!1),g=l.trim()&&!/^https?:\/\//i.test(l.trim())?`https://${l.trim()}`:l.trim(),p=!g||/^https?:\/\/[^\s.]+\.[^\s]+$/i.test(g);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,P.jsx)(x.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Your booking link"}),(0,P.jsx)(x.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,P.jsx)(h.default,{style:{backgroundColor:(0,s.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:S.colours.border,padding:10},children:(0,P.jsx)(x.T,{size:14,colour:S.colours.goldLight,children:i})}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:u?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,C.copyText)(i);c(e)}})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Website bookings tables"}),(0,P.jsx)(x.Badge,{kind:"gold",label:"Website bookings tables coming"})]}),(0,P.jsx)(x.Muted,{children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,P.jsx)(F,{wizard:n,disabled:!p,onPress:()=>{m.useStore.getState().updateRestaurant(o.id,{website:g||void 0}),f.useSetup.getState().patch(e,{website:g,bookingUrl:i}),t('Website saved.')}})]})},invites:function({rid:e,done:s,wizard:t}){const n=(0,b.useOwner)(e=>e.staff).filter(e=>e.active),{role:o}=(0,k.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(x.Muted,{children:"Every person has an Android app download and an iPhone app link. Both sign in automatically. Share privately; nothing is sent from here."}),n.map(e=>(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(i.StaffLinkChip,{m:e,actorRole:a}),(0,P.jsx)(r.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,P.jsx)(F,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},A=e=>function(){return(0,P.jsx)(D,{id:e})};function U({rid:e,id:s,title:t,onDone:n}){const o=$(e),a=(0,l.useLiveVenue)(),r=o.markOf(s),[i,u]=(0,d.useState)(!1);return o.isDone(s)?(0,P.jsxs)(h.default,{style:{gap:4},children:[(0,P.jsx)(x.Button,{kind:"secondary",label:i?'Saving\u2026':'Mark as not done',disabled:i,testID:`setup-notdone-${s}`,accessibilityLabel:`${t}, mark as not done`,style:{minHeight:44},onPress:async()=>{u(!0),f.useSetup.getState().markDone(e,s,!1);const o=!a||await l.useSetupMarks.getState().set(a,s,!1);u(!1),n(o?`${t} marked as not done.`:'Could not save. Check the connection and try again.')}}),(0,P.jsx)(x.Muted,{size:13,children:"Tip: use this if a step needs another look. It goes back on your to-do list until you mark it done again."})]}):r&&!1===r.done&&r.by?(0,P.jsxs)(x.Muted,{size:13,testID:`setup-notdone-by-${s}`,children:["Marked as not done by ",r.by,r.at?` on ${new Date(r.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})}`:'',"."]}):null}},894,[878,874,1006,895,896,897,898,900,30,239,263,127,860,955,813,819,854,825,1007,14,816,821,954,901,903,904,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},895,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},896,[30,820]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},897,[30,1008,820]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return x}}),_e.refreshInvites=S,_e.useInviteStatus=function(){const[,e]=(0,n.useState)(0);return(0,n.useEffect)(()=>{const n=()=>e(e=>e+1);return m.add(n),S(),()=>{m.delete(n)}},[]),b},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return $}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Current app links are prepared automatically.':'expired'===e?.state||e?.expiresAt&&Date.parse(e.expiresAt)<=n?'Previous link expired. Current app links are prepared automatically.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.InviteLinkControls=function({m:t,actorRole:s}){const k=(0,u.useSync)(e=>e.venueId),w=(0,u.useSync)(e=>'staff'===e.kind&&!!e.venueId),b=(0,u.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),x=w&&t.active&&!t.name.includes('(example)')&&('owner'===s||b||'manager'===s&&'owner'!==t.role&&!t.ownerAccess),S=`${k}:${t.id}`,[,L]=(0,n.useState)(0),[P,C]=(0,n.useState)(''),[I,M]=(0,n.useState)(null),[D,H]=(0,n.useState)(null);if((0,n.useEffect)(()=>{if(!x)return;const e=()=>L(e=>e+1);m.add(e),j(S,t.id);const n=setInterval(()=>{j(S,t.id)},3e4),s=()=>{j(S,t.id)};return'undefined'!=typeof window&&window.addEventListener('focus',s),()=>{m.delete(e),clearInterval(n),'undefined'!=typeof window&&window.removeEventListener('focus',s)}},[x,S,t.id]),!x)return null;const R=y.get(S),E=async e=>{try{await(0,u.revokeStaffAppLink)(e),y.delete(S),H(null),C('Link revoked. Existing signed-in sessions are unchanged.'),await j(S,t.id),I&&M(await(0,u.staffAppLinkHistory)(t.id))}catch(e){C(String(e.message))}};return(0,f.jsxs)(o.default,{testID:`invite-${t.id}`,style:{gap:10},children:[['android','iphone'].map(n=>{const s='android'===n?'Android app':'iPhone',u=R?.[n],y=(0,c.currentAppLink)(u)&&u?(0,c.personalAppUrl)(n,u):null;return(0,f.jsxs)(o.default,{testID:`invite-${n}-${t.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:p.colours.gold,backgroundColor:p.colours.bg},children:[(0,f.jsx)(l.T,{weight:"semibold",children:s}),y&&u?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(e.Text,{selectable:!0,accessibilityLabel:`${t.name}, ${s} personal link`,testID:`invite-link-${n}-${t.id}`,style:{color:p.colours.goldLight,fontSize:14},children:y}),(0,f.jsxs)(l.Muted,{size:13,children:["Use by ",$(u.expiresAt),". Once set up, stays signed in."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(l.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${t.name}'s ${s} link`,testID:`invite-copy-${n}-${t.id}`,onPress:async()=>C(await(0,h.copyText)(y)?'Link copied':'Select and copy the link.')}),(0,f.jsx)(l.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${t.name}'s ${s} link`,testID:`invite-share-${n}-${t.id}`,onPress:async()=>C(await A(y,t.name))}),(0,f.jsx)(l.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${t.name}'s ${s} link`,onPress:()=>H(u.id)})]})]}):(0,f.jsx)(l.Muted,{children:v.has(S)?'Cannot load the current link. Reconnecting automatically.':'Preparing current link\u2026'})]},n)}),D?(0,f.jsxs)(l.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(l.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${t.name}`,style:{minHeight:44},onPress:()=>{E(D)}}),(0,f.jsx)(l.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>H(null)})]}):null,P?(0,f.jsx)(l.T,{size:14,children:P}):null,(0,f.jsxs)(l.Muted,{size:13,children:["Share privately with ",t.name,". Unused new links last 30 days. New links never switch off older links or signed-in phones."]}),(0,f.jsx)(l.Button,{label:I?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${t.name}`,onPress:async()=>{try{M(I?null:await(0,u.staffAppLinkHistory)(t.id))}catch(e){C(String(e.message))}}}),I?.map(e=>(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsxs)(l.Muted,{size:13,children:['legacy'===e.platform?'Previous app link':'android'===e.platform?'Android app':'iPhone'," \xb7 ",$(e.createdAt)," \xb7 ",e.revokedAt?'Revoked':e.usedAt?'Used for sign-in':e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()?'Expired':'Unused']}),e.revokedAt?null:(0,f.jsx)(l.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${t.name}'s ${e.platform} link from ${$(e.createdAt)}`,onPress:()=>H(e.id)})]},e.id))]})};var e=r(d[0]),n=r(d[1]);r(d[2]),r(d[3]);var t,s=r(d[4]),o=(t=s)&&t.__esModule?t:{default:t},l=r(d[5]),c=r(d[6]),u=r(d[7]),p=r(d[8]),h=r(d[9]),f=r(d[10]);const y=new Map,k=new Map,m=new Set,v=new Map,w=()=>m.forEach(e=>e());let b=null;const x=()=>b;async function S(){return b=await(0,u.readInviteStatus)(),w(),b}const $=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function j(e,n){if(k.has(e))return k.get(e);const t=(async()=>{try{y.set(e,await(0,u.ensureStaffAppLinks)(n)),v.delete(e)}catch(n){y.delete(e),v.set(e,String(n.message||n))}finally{k.delete(e),w()}})();return k.set(e,t),t}async function A(e,n){try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,h.copyText)(e)?'Link copied. Paste it into a private message.':'Select and copy the link.'}},898,[874,30,122,244,127,813,899,820,821,988,24]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,l){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:l});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(l)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',l=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${l}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},899,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},900,[30,263,813,820,821,898,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.Insights=function({go:e}){const{rid:t,r:s,now:l}=(0,w.useCtx)(6e4),n=(0,p.useBookings)(t),i=(0,p.useOrders)(t),a=(0,p.useEvents)(t),o=(0,p.useRatings)(t),d=(0,r.useMemo)(()=>(0,S.insights)(s,n,i,a,o,l,64),[s.id,n.length,i.length,o.length]);return(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsx)(m.Muted,{children:(0,$.useExamples)()?'Smart suggestions from your bookings, orders, forecast, stock and reviews. Example figures: invented for the demo.':'Suggestions from your own bookings, reviews and calendar. Nothing here is invented.'}),d.map((t,s)=>(0,A.jsx)(N.FadeIn,{delay:80*s,children:(0,A.jsxs)(m.Card,{highlight:L[t.tone],children:[(0,A.jsxs)(m.Row,{style:{alignItems:'flex-start'},children:[(0,A.jsx)(m.T,{size:22,children:t.icon}),(0,A.jsxs)(c.default,{style:{flex:1},children:[(0,A.jsx)(m.T,{weight:"semibold",children:t.title}),(0,A.jsx)(m.Muted,{children:t.body})]})]}),t.action?(0,A.jsx)(m.Button,{small:!0,kind:"secondary",label:t.action.label,onPress:()=>e(t.action.tab,t.action.sub??null)}):null]})},t.id))]})},_e.Analytics=function(){return(0,$.useExamples)()?(0,A.jsx)(H,{}):(0,A.jsx)(E,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,w.useCtx)(6e4),s=(0,$.useExamples)(),{width:l}=(0,h.default)(),n=(0,p.useAllMenu)(e),i=(0,S.dishStats)(n),r=i.reduce((e,t)=>e+t.sold,0)/Math.max(1,i.length),a=i.reduce((e,t)=>e+t.margin,0)/Math.max(1,i.length),o={Star:b.colours.ok,'Plough horse':b.colours.amber,Puzzle:b.colours.blue,Dog:b.colours.red},u=i.map(e=>({...e,q:(0,S.quadrant)(e.sold,e.margin,r,a)}));return s?(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsx)(m.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Margin vs popularity"}),(0,A.jsx)(N.Scatter,{width:Math.min(l,900)-60,points:u.map(e=>({x:e.sold,y:e.margin/100,colour:o[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:a/100}),(0,A.jsx)(m.Row,{wrap:!0,gap:8,children:Object.keys(o).map(e=>(0,A.jsxs)(m.Row,{gap:4,children:[(0,A.jsx)(c.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:o[e]}}),(0,A.jsx)(m.Muted,{children:e})]},e))}),(0,A.jsx)(m.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=u.filter(t=>t.q===e);return t.length?(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.Row,{style:{justifyContent:'space-between'},children:(0,A.jsxs)(m.T,{weight:"semibold",colour:o[e],children:[e,"s (",t.length,")"]})}),(0,A.jsx)(m.Muted,{children:S.QUADRANT_TIP[e]}),t.map(e=>(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{size:14,style:{flex:1},children:e.item.name}),(0,A.jsxs)(m.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,j.gbp)(e.margin)]}),(0,A.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>(p.useStore.getState().updateMenuItem(e.item.id,{soldOut:!e.item.soldOut}),(0,v.autoPost)(['kitchen','foh'],e.item.soldOut?`Back on: ${e.item.name}`:`Sold out: ${e.item.name}`)),style:{marginLeft:6,paddingHorizontal:8,paddingVertical:3,borderRadius:10,borderWidth:1,borderColor:e.item.soldOut?b.colours.amber:b.colours.border},children:(0,A.jsx)(m.T,{size:11,colour:e.item.soldOut?b.colours.amber:b.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,A.jsxs)(m.Muted,{children:["Tap Mark sold out to remind staff a dish has run out (signed by ",t,"). It shows on the Display; it doesn't change your till."]})]}):(0,A.jsx)(m.Card,{children:(0,A.jsxs)(c.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,A.jsx)(m.T,{weight:"semibold",colour:b.colours.gold,children:"Not enough data yet"}),(0,A.jsx)(m.Muted,{children:"Menu engineering needs how many of each dish you sell and what each costs. CoverCharge doesn't have a till link yet, so nothing is shown rather than a guess. Dish costs from recipe cards are in the Head Chef app under GP."})]})})},_e.PrepList=function({go:e}){const{rid:t,r:l,now:n,me:i,today:a}=(0,w.useCtx)(6e4),o=(0,x.useOwner)(e=>e.suppliers),d=(0,p.useBookings)(t),u=(0,p.useOrders)(t),h=(0,p.useEvents)(t),g=(0,x.useOwner)(e=>e.checks),j=(0,R.useRealHistory)(t,n),y=(0,r.useMemo)(()=>(0,s.forecastToday)(l,d,u,h,n,j??void 0),[l.id,d.length,u.length,n.getHours(),j]),k=y.restOfDay.high+2*y.restOfDay.takeaway,C=(0,S.stockList)();return(0,A.jsxs)(c.default,{style:{gap:10},children:[y.enough?(0,A.jsxs)(m.Card,{children:[(0,A.jsxs)(m.T,{weight:"semibold",children:["Rest of today: about ",(0,s.coversRange)(y.restOfDay.low,y.restOfDay.high)," + about ",y.restOfDay.takeaway," takeaways"]}),(0,A.jsx)(m.Muted,{children:y.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,A.jsx)(R.NotEnoughHistory,{weeks:y.minWeeks,booked:y.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),C.length?null:(0,A.jsx)(m.Card,{children:(0,A.jsx)(m.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),C.map(t=>{const s=Math.ceil(k*t.perCover*10)/10,l=s>t.onHand,r=(0,T.supplierForCat)(o,t.cat),d=`${a}:prep:${t.id}`,u=g[d];return(0,A.jsxs)(c.default,{style:[m.styles.card,{borderColor:l?b.colours.red:b.colours.border}],children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{weight:"semibold",children:t.name}),(0,A.jsx)(m.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,A.jsxs)(m.Muted,{children:["Need about ",s," ",t.unit," \xb7 on hand ",t.onHand," \xb7 par ",t.par,l?' \xb7 order, or mark dishes sold out when it runs out':'']}),l&&r?(0,A.jsxs)(m.Muted,{children:["Supplier: ",r.name," \xb7 ",r.phones[0],r.cutoff?` \xb7 order by ${r.cutoff}`:'']}):null,l&&r?(0,A.jsx)(m.Button,{small:!0,kind:"secondary",label:`Order from ${r.name}`,onPress:()=>e('more','suppliers')}):null,(0,A.jsx)(m.Chip,{label:u?`Prepped \u2713 ${u.by.split(' ')[0]} ${u.at}`:'Mark prepped',selected:!!u,onPress:()=>u?x.useOwner.getState().untick(d):x.useOwner.getState().tick(d,i,(0,f.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,x.useOwner)(e=>e.customerTags),[s,l]=(0,r.useState)(''),[n,i]=(0,r.useState)('All'),[a,o]=(0,r.useState)(null),d=(0,r.useMemo)(()=>(0,S.crmCustomers)(),[]),u={All:()=>!0,'Opted in':e=>e.optIn,Regulars:e=>e.visits>=6,Lapsed:e=>parseInt(e.lastVisit,10)>20,Allergies:e=>e.allergies.length>0,Birthdays:e=>!!e.birthday},h=d.filter(u[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),g=d.find(e=>e.id===a);return d.length?(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:m.styles.input}),(0,A.jsx)(m.Row,{wrap:!0,gap:6,children:Object.keys(u).map(e=>(0,A.jsx)(m.Chip,{label:`${e} (${d.filter(u[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),h.map(t=>(0,A.jsxs)(m.Card,{onPress:()=>o(t.id),children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{weight:"semibold",children:t.name}),(0,A.jsxs)(m.Muted,{children:[t.visits," visits"]})]}),(0,A.jsxs)(m.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,j.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,A.jsxs)(m.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,A.jsx)(m.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,A.jsx)(m.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,A.jsx)(m.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),g?(0,A.jsxs)(m.Sheet,{visible:!0,onClose:()=>o(null),title:g.name,children:[(0,A.jsxs)(m.Muted,{children:[g.phone," \xb7 ",g.visits," visits \xb7 last ",g.lastVisit," \xb7 prefers ",g.channel]}),(0,A.jsxs)(m.T,{children:["Lifetime spend ",(0,j.gbp)(g.spend)," \xb7 stamps ",g.stamps]}),g.allergies.length?(0,A.jsx)(m.Banner,{kind:"danger",title:"Allergies on file",children:g.allergies.join(', ')}):(0,A.jsx)(m.Muted,{children:"No allergies on file."}),g.birthday?(0,A.jsxs)(m.Muted,{children:["Birthday: ",g.birthday]}):null,(0,A.jsx)(m.Badge,{kind:g.optIn?'ok':'neutral',label:g.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,A.jsx)(m.T,{weight:"semibold",children:"Tags"}),(0,A.jsx)(m.Row,{wrap:!0,gap:6,children:F.map(t=>(0,A.jsx)(m.Chip,{label:t,selected:(e[g.id]??[]).includes(t),onPress:()=>x.useOwner.getState().toggleTag(g.id,t)},t))})]}):null]}):(0,A.jsx)(m.Card,{children:(0,A.jsxs)(c.default,{testID:"crm-live",style:{gap:6},children:[(0,A.jsx)(m.T,{weight:"semibold",colour:b.colours.gold,children:"No customer list yet"}),(0,A.jsx)(m.Muted,{children:"Customer profiles build up from guests who sign in to order or book. None are invented."})]})})},_e.Marketing=function({go:e}){const{rid:t}=(0,w.useCtx)(6e4),s=(0,x.useOwner)(e=>e.campaigns),l=(0,p.useStore)((0,g.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,p.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,x.useOwner)(e=>e.marketingDraft),[a,o]=(0,r.useState)(i?.title??''),[d,u]=(0,r.useState)(i?.body??''),[h,b]=(0,r.useState)('All opted-in'),[k,v]=(0,r.useState)('Now'),T=(0,$.useExamples)(),M=T?{'All opted-in':412,'Takeaway regulars':188,'Lapsed 30+ days':96,'Birthdays this month':23}:{'All opted-in':void 0,'Takeaway regulars':void 0,'Lapsed 30+ days':void 0,'Birthdays this month':void 0};return(0,A.jsxs)(c.default,{style:{gap:10},children:[i?(0,A.jsx)(m.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,A.jsx)(m.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,A.jsxs)(m.Row,{gap:8,children:[T?(0,A.jsxs)(m.Card,{style:{flex:1},children:[(0,A.jsx)(m.Muted,{children:"Referrals"}),(0,A.jsx)(m.T,{size:20,weight:"bold",children:"27"}),(0,A.jsx)(m.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,A.jsxs)(m.Card,{style:{flex:1},children:[(0,A.jsx)(m.Muted,{children:"Gift card sales"}),(0,A.jsx)(m.T,{size:20,weight:"bold",children:(0,j.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,A.jsxs)(m.Muted,{children:[l.length," cards"]})]})]}),(0,A.jsx)(y.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,A.jsx)(C.PostToSocialButtons,{onPick:t=>(0,C.shareToSocial)(e,{group:t})}),(0,A.jsx)(C.QuickLinksSection,{go:e,heading:e=>(0,A.jsx)(y.SectionHead,{title:e})}),(0,A.jsx)(y.SectionHead,{title:"Campaigns"}),s.map(e=>(0,A.jsxs)(m.Card,{children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,A.jsx)(m.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,A.jsx)(m.Muted,{children:e.body}),(0,A.jsxs)(m.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,A.jsx)(m.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>x.useOwner.getState().setCampaign(e.id,{status:'draft'})}):T?(0,A.jsx)(m.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"New campaign"}),(0,A.jsx)(m.Field,{label:"Title",value:a,onChangeText:o}),(0,A.jsx)(m.Field,{label:"Message",value:d,onChangeText:u,multiline:!0}),(0,A.jsx)(m.Muted,{children:"Audience"}),(0,A.jsx)(m.Row,{wrap:!0,gap:6,children:Object.keys(M).map(e=>(0,A.jsx)(m.Chip,{label:e,sub:null==M[e]?void 0:`${M[e]}`,selected:h===e,onPress:()=>b(e)},e))}),(0,A.jsx)(m.Muted,{children:"When"}),(0,A.jsx)(m.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,A.jsx)(m.Chip,{label:e,selected:k===e,onPress:()=>v(e)},e))}),(0,A.jsx)(m.Button,{label:'Now'===k?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||d.trim().length<5,onPress:()=>{x.useOwner.getState().addCampaign({title:a.trim(),body:d.trim(),segment:h,sendAt:k,status:'draft',reach:M[h]??0}),x.useOwner.getState().setOwner({marketingDraft:void 0}),o(''),u('')}})]}),(0,A.jsx)(y.SectionHead,{title:"Event promos"}),n.map(t=>(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:t.title}),(0,A.jsx)(m.Muted,{children:(0,f.niceDate)((0,f.parseYmd)(t.date))}),(0,A.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,A.jsx)(m.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{o(t.title.replace(' (example)','')),u(`Join us on ${(0,f.niceDate)((0,f.parseYmd)(t.date))} at ${(0,P.venueInfo)().name}. Book in the app.`)}}),(0,A.jsx)(m.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e}=(0,w.useCtx)(6e4),s=(0,p.useRatings)(e),[l,n]=(0,r.useState)({}),i=s.length?s.reduce((e,t)=>e+t.stars,0)/s.length:0,a=s.filter(e=>e.stars>=4).length,o=s.filter(e=>e.stars<=2).length,d=e=>e.stars>=4?`Thank you ${e.customerName.split(' ')[0]}! So glad you enjoyed it. See you again soon at ${(0,P.venueInfo)().name}. \u2014 The ${(0,P.venueInfo)().name.replace(/^The /,'')} team`:`Hi ${e.customerName.split(' ')[0]}, I'm sorry about this, it's not the standard we aim for. Please contact our team so we can discuss your visit. \u2014 ${(0,P.venueInfo)().name}`;return(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsxs)(m.Card,{children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(m.T,{size:28,weight:"bold",colour:b.colours.gold,children:[i.toFixed(1),"\u2605"]}),(0,A.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,A.jsx)(m.Badge,{kind:"ok",label:`${a} positive`}),(0,A.jsx)(m.Badge,{kind:"red",label:`${o} negative`})]})]}),(0,A.jsx)(m.T,{size:14,children:"Sentiment: guests love the fish supper, staff and allergy care. Watch-out: food temperature at takeaway collection and table waits around 19:00."}),(0,A.jsx)(m.Muted,{children:"Summary made from recent ratings on this device."})]}),o?(0,A.jsx)(m.Banner,{kind:"danger",title:`Low-rating alert: ${o} rating at 2\u2605 or below`,children:"Reply within 24 hours. Customers who get a reply are more likely to come back."}):null,s.map(e=>(0,A.jsxs)(m.Card,{highlight:e.stars<=2?b.colours.red:void 0,children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{weight:"semibold",children:e.customerName}),(0,A.jsxs)(m.T,{colour:b.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,A.jsx)(m.T,{size:14,children:e.comment}),null!=l[e.id]?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(t.TextInput,{accessibilityLabel:"Reply draft",multiline:!0,value:l[e.id],onChangeText:t=>n({...l,[e.id]:t}),style:[m.styles.input,{minHeight:80}]}),(0,A.jsx)(m.Muted,{children:"Draft only, not sent. Copy it to your review site or reply in the app in production."})]}):(0,A.jsx)(m.Button,{small:!0,kind:"secondary",label:"Draft a reply",onPress:()=>n({...l,[e.id]:d(e)})})]},e.id))]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,w.useCtx)(3e4),i=(0,x.useOwner)(e=>e.checks),a=(0,p.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[o,d]=(0,r.useState)({}),u=W.filter(e=>i[`${n}:${e.id}`]).length;return(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsxs)(m.Card,{children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(m.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,f.niceDate)(s)]}),(0,A.jsx)(m.Badge,{kind:u===W.length?'ok':'amber',label:`${u}/${W.length}`})]}),(0,A.jsx)(c.default,{style:{height:8,backgroundColor:b.colours.border,borderRadius:4},children:(0,A.jsx)(c.default,{style:{height:8,width:u/W.length*100+"%",backgroundColor:b.colours.ok,borderRadius:4}})}),W.map(e=>{const r=`${n}:${e.id}`,a=i[r],u=Number(o[e.id]),h=null!=a?.value&&('freezer'===e.id?Number(a.value)>-18:'hot'===e.id?Number(a.value)<63:Number(a.value)>5);return(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(c.default,{style:{flex:1},children:[(0,A.jsx)(m.T,{size:14,children:e.label}),a?(0,A.jsxs)(m.Muted,{children:[null!=a.value?`${a.value}\xb0C \xb7 `:'',a.by," ",a.at,h?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!a?(0,A.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:o[e.id]??'',onChangeText:t=>d({...o,[e.id]:t}),style:[m.styles.input,{width:64,paddingVertical:4}]}):null,(0,A.jsx)(m.Chip,{label:a?h?'\u26a0':'\u2713':'Tick',selected:!!a,disabled:!a&&e.temp&&!Number.isFinite(u),onPress:()=>a?x.useOwner.getState().untick(r):x.useOwner.getState().tick(r,l,(0,f.hm)(s),e.temp?String(u):void 0)})]},e.id)}),(0,A.jsx)(m.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,A.jsx)(y.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,A.jsxs)(m.Muted,{children:[(0,f.niceDate)(new Date(e.at))," ",(0,f.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,A.jsx)(m.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,w.useCtx)(6e4),l=(0,x.useOwner)(e=>e.lost),n=(0,x.useOwner)(e=>e.lostReports),i=(0,x.useOwner)(e=>e.coats),[a,o]=(0,r.useState)(''),[d,u]=(0,r.useState)(''),[h,g]=(0,r.useState)(''),p=Math.max(0,...i.map(e=>e.ticket))+1;return(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsx)(y.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,A.jsxs)(m.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(m.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,A.jsx)(m.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,A.jsx)(m.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>x.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,A.jsxs)(m.Row,{gap:6,children:[(0,A.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${p}: describe item`,placeholderTextColor:"#7D776C",value:h,onChangeText:g,style:[m.styles.input,{flex:1}]}),(0,A.jsx)(m.Button,{small:!0,label:"Check in",disabled:h.trim().length<2,onPress:()=>{x.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:p,desc:h.trim(),at:(0,f.hm)(e),status:'in'}]}),g('')}})]}),n.length?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(y.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,A.jsxs)(m.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{weight:"semibold",children:e.item}),(0,A.jsx)(m.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,A.jsxs)(m.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,A.jsxs)(m.Row,{gap:6,children:[(0,A.jsx)(m.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>x.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,A.jsx)(m.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>x.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,A.jsx)(y.SectionHead,{title:"Lost property"}),0===l.length?(0,A.jsx)(m.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,A.jsxs)(m.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{weight:"semibold",children:t.item}),(0,A.jsx)(m.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,A.jsxs)(m.Muted,{children:[t.where," \xb7 found ",z(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,A.jsx)(m.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>x.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,f.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Log a found item"}),(0,A.jsx)(m.Field,{label:"Item",value:a,onChangeText:o,placeholder:"e.g. Black phone"}),(0,A.jsx)(m.Field,{label:"Where",value:d,onChangeText:u,placeholder:"e.g. 7"}),(0,A.jsx)(m.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{x.useOwner.getState().addLost({item:a.trim(),where:d.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,f.hm)(e)}`,foundBy:s}),o(''),u('')}})]})]})},_e.useNotifications=_,_e.Notifications=function({go:e}){const{rid:t}=(0,w.useCtx)(3e4),{list:s,read:l}=_(),[h,g]=(0,r.useState)('all'),j=(0,i.useAlerts)(e=>e.history),f=(0,i.useAlerts)(e=>e.read),y=(0,i.useAlerts)(e=>e.readAllAt[t]??0),k=e=>(0,i.isUnread)({read:f,readAllAt:{[t]:y}},e),[C,v]=(0,r.useState)(''),T=j.filter(e=>e.rid===t),M=T.filter(e=>'all'===h||e.kind===h),S=(0,p.useBookings)(t).filter(e=>'pending'===e.status).length;a.default.useEffect(()=>{(0,i.markNotificationsSeen)(t,s.map(e=>e.id))},[t,T.length,s.length]);const $=t=>{i.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Alerts"}),(0,A.jsxs)(m.Row,{gap:6,children:[(0,A.jsx)(m.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",accessibilityLabel:"Mark all alerts as read",onPress:async()=>{x.useOwner.getState().markRead(s.map(e=>e.id));const e=await(0,i.markAllAlertsRead)(t,s.map(e=>e.id))?'All alerts marked as read':'Marked as read on this device. We\u2019ll sync it when you\u2019re back online.';v(`${e} (${(new Date).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})})`),o.default.announceForAccessibility?.(e)}}),(0,A.jsx)(m.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts')})]})]}),C?(0,A.jsx)(c.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,A.jsx)(m.Muted,{children:C})}):null,S?(0,A.jsxs)(m.Banner,{kind:"warn",children:[S," booking ",1===S?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===S?'it\u2019s':'they\u2019re'," handled."]}):null,(0,A.jsx)(u.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:U.map(e=>{const t='all'===e.id?T.filter(k).length:(s=e.id,T.filter(e=>e.kind===s&&k(e)).length);var s;return(0,A.jsxs)(d.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:h===e.id},onPress:()=>g(e.id),style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:12,paddingVertical:7,borderRadius:999,borderWidth:1,borderColor:h===e.id?'all'===e.id?b.colours.gold:i.KIND_META[e.id].colour:b.colours.border,backgroundColor:h===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,A.jsx)(n.KindIcon,{kind:e.id,size:15}):null,(0,A.jsx)(m.T,{size:13,colour:h===e.id?b.colours.text:b.colours.muted,children:e.label}),t?(0,A.jsx)(c.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?b.colours.gold:i.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,A.jsx)(m.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==h||i.CONNECTED_INBOX?null:(0,A.jsx)(m.Card,{children:(0,A.jsxs)(m.Row,{gap:10,children:[(0,A.jsx)(n.KindIcon,{kind:"email"}),(0,A.jsxs)(c.default,{style:{flex:1},children:[(0,A.jsx)(m.T,{weight:"semibold",children:i.INBOX_EMPTY}),(0,A.jsx)(m.Muted,{children:"When your venue inbox is connected, new emails pop up here and on the Display. For now, you can send a test alert from Alerts and sounds."})]})]})}),M.map(e=>{const t=i.KIND_META[e.kind],s=k(e);return(0,A.jsx)(m.Card,{highlight:s?t.colour:void 0,onPress:()=>$(e),children:(0,A.jsxs)(m.Row,{gap:10,children:[(0,A.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,borderWidth:1.2,borderColor:t.colour,alignItems:'center',justifyContent:'center'},children:(0,A.jsx)(n.KindIcon,{kind:e.kind,size:17})}),(0,A.jsxs)(c.default,{style:{flex:1},children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(m.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,A.jsx)(m.Muted,{children:q(e.at)})]}),(0,A.jsx)(m.T,{weight:s?'semibold':'regular',children:(0,i.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,A.jsx)(m.Muted,{numberOfLines:2,children:(0,i.alertText)(e).body})]}),s?(0,A.jsx)(c.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),M.length||'email'===h&&!i.CONNECTED_INBOX?null:(0,A.jsx)(m.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,A.jsx)(m.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),s.map(t=>(0,A.jsxs)(m.Card,{highlight:l[t.id]?void 0:t.tone,onPress:()=>{x.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{weight:l[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),l[t.id]?null:(0,A.jsx)(c.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,A.jsx)(m.Muted,{numberOfLines:2,children:t.body})]},t.id)),s.length?null:(0,A.jsx)(m.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,w.useCtx)(6e4),[n,i]=(0,r.useState)(''),a=(0,p.useAllMenu)(s),o=(0,p.useOrders)(s),d=(0,p.useBookings)(s),u=(0,x.useOwner)(e=>e.staff),h=(0,r.useMemo)(()=>(0,S.crmCustomers)(),[]),g=n.trim().toLowerCase(),f=g.length<2?[]:[...M.PAGES.filter(e=>(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(g)).map(t=>({k:`p${t.id}`,kind:'Screen',t:t.title,sub:t.sub,on:()=>e('more',t.id)})),...a.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,j.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...o.filter(e=>(e.ref+e.customerName).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...d.filter(e=>(e.name+e.ref).toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...x.CAN.manage(l)?h.filter(e=>e.name.toLowerCase().includes(g)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...u.filter(e=>(0,x.staffMatches)(e,g)).map(t=>({k:t.id,kind:'Staff',t:(0,x.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,A.jsxs)(c.default,{style:{gap:8},children:[(0,A.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:m.styles.input}),f.map(e=>(0,A.jsxs)(m.Card,{onPress:e.on,children:[(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsx)(m.T,{style:{flex:1},children:e.t}),(0,A.jsx)(m.Badge,{kind:"neutral",label:e.kind})]}),(0,A.jsx)(m.Muted,{children:e.sub})]},e.k)),g.length>=2&&!f.length?(0,A.jsx)(m.Muted,{children:"No matches."}):null,g.length<2?(0,A.jsx)(m.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,p.useStore)(e=>e.clock.mode);const[e,t]=(0,r.useState)(!1);return(0,l.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Live venue"}),(0,A.jsx)(m.Muted,{children:"This device is connected to your venue, so it uses the real date and time and only real bookings. Example data is for previews only."})]}):(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsxs)(m.Card,{children:[null,(0,A.jsx)(m.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Reset example data"}),e?(0,A.jsxs)(m.Row,{gap:6,children:[(0,A.jsx)(m.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{p.useStore.getState().resetDemo(),x.useOwner.getState().resetOwner(),t(!1)}}),(0,A.jsx)(m.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,A.jsx)(m.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,A.jsx)(m.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=V,_e.copyText=G,_e.YourApps=function(){const[e,s]=(0,r.useState)(null);return(0,A.jsxs)(c.default,{style:{gap:8},testID:"your-apps",children:[(0,A.jsx)(m.Muted,{children:"Each one opens in a new tab. Share the right app with each person; add it to the Home screen from the browser menu."}),K.map(l=>{const n={...l,name:(0,P.venueInfo)().name+l.name},i=V(n.path);return(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:n.name}),(0,A.jsx)(m.Muted,{children:n.who}),(0,A.jsx)(m.Row,{gap:10,children:(0,A.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:b.fonts.medium,fontSize:14,lineHeight:20,color:b.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,A.jsx)(m.Row,{gap:6,children:(0,A.jsx)(m.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await G(V(n.path));s(e?n.path:null),e&&setTimeout(()=>s(e=>e===n.path?null:e),2e3)}})})]},n.path)})]})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),a=e(r),o=e(_r(_d[6]));_r(_d[7]),_r(_d[8]);var d=e(_r(_d[9])),u=e(_r(_d[10])),c=e(_r(_d[11])),h=e(_r(_d[12])),g=_r(_d[13]),m=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),f=_r(_d[18]),b=_r(_d[19]),y=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),C=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),M=_r(_d[26]),S=_r(_d[27]),$=_r(_d[28]),R=_r(_d[29]),O=_r(_d[30]),B=_r(_d[31]),D=_r(_d[32]),N=_r(_d[33]),P=_r(_d[34]),A=_r(_d[35]);const I={'Dine-in':b.colours.gold,Takeaway:b.colours.blue,'Table QR':b.colours.ok},L={gold:b.colours.gold,red:b.colours.red,amber:b.colours.amber,ok:b.colours.ok,blue:b.colours.blue},z=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function E(){const{rid:e,r:t,now:s,today:l}=(0,w.useCtx)(6e4),{width:n}=(0,h.default)(),i=(0,p.useBookings)(e),a=(0,O.useCashUp)(e=>e.cashUps),[o,d]=(0,r.useState)(28),u=Math.min(n,900)-60,g=(0,f.ymd)(new Date(s.getTime()-864e5*o)),x=a.filter(t=>t.rid===e&&t.date>=g&&t.date({date:e.date,t:(0,B.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),j=x.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=g&&e.date'noshow'===e.status).length,k=(0,D.clampWeeks)(t.settings.forecastMinWeeks);return(0,A.jsxs)(c.default,{style:{gap:10},testID:"analytics-live",children:[(0,A.jsxs)(m.Row,{gap:6,children:[(0,A.jsx)(m.Chip,{label:"7 days",selected:7===o,onPress:()=>d(7)}),(0,A.jsx)(m.Chip,{label:"28 days",selected:28===o,onPress:()=>d(28)})]}),x.length?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(m.Card,{children:[(0,A.jsxs)(m.Muted,{children:["Takings from your cash-ups (",x.length," day",1===x.length?'':'s',")"]}),(0,A.jsxs)(m.T,{size:20,weight:"bold",children:["\xa3",Math.round(j).toLocaleString('en-GB')]})]}),x.length>1?(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,A.jsx)(N.LineChart,{width:u,series:[x.map(e=>e.t)],labels:x.map(e=>(0,f.niceDate)((0,f.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,A.jsx)(R.NotEnoughHistory,{weeks:k,what:"Sales figures",testID:"analytics-not-enough"}),(0,A.jsxs)(m.Card,{children:[(0,A.jsxs)(m.Muted,{children:["No-show rate (",o," days)"]}),(0,A.jsx)(m.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,A.jsx)(m.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,A.jsx)(m.Muted,{children:"Takings come from the nightly cash up; no-shows from your bookings. Dish sales and channels need a till link, which CoverCharge doesn't have yet, so they aren't shown."})]})}function H(){const{rid:e,r:t,now:s,today:l}=(0,w.useCtx)(6e4),{width:n}=(0,h.default)(),i=(0,p.useAllMenu)(e),a=(0,p.useBookings)(e),[o,d]=(0,r.useState)(28),u=(0,r.useMemo)(()=>(0,S.revenueHistory)(t,s,o),[t.id,o,s.toDateString()]),g=u.reduce((e,t)=>e+t.total,0),x=u.reduce((e,t)=>e+t.covers,0),f=S.CHANNELS.map(e=>({c:e,v:u.reduce((t,s)=>t+s.byChannel[e],0)})),y=(0,S.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),k=f.find(e=>'Takeaway'===e.c).v+f.find(e=>'Table QR'===e.c).v,C=Math.min(n,900)-60;return(0,A.jsxs)(c.default,{style:{gap:10},children:[(0,A.jsx)(m.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,A.jsxs)(m.Row,{gap:6,children:[(0,A.jsx)(m.Chip,{label:"7 days",selected:7===o,onPress:()=>d(7)}),(0,A.jsx)(m.Chip,{label:"28 days",selected:28===o,onPress:()=>d(28)})]}),(0,A.jsxs)(m.Row,{gap:8,children:[(0,A.jsxs)(m.Card,{style:{flex:1},children:[(0,A.jsx)(m.Muted,{children:"Revenue"}),(0,A.jsx)(N.CountUp,{value:g/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,A.jsxs)(m.Card,{style:{flex:1},children:[(0,A.jsx)(m.Muted,{children:"Avg spend / cover"}),(0,A.jsx)(N.CountUp,{value:x?g/x/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Daily revenue"}),(0,A.jsx)(N.LineChart,{width:C,series:[u.map(e=>e.total/100)],labels:u.map(e=>e.label)})]}),(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Revenue by channel"}),(0,A.jsxs)(m.Row,{gap:14,children:[(0,A.jsx)(N.Donut,{parts:f.map(e=>({value:e.v,colour:I[e.c]})),centre:`\xa3${Math.round(g/1e5)}k`}),(0,A.jsx)(c.default,{style:{gap:4,flex:1},children:f.map(e=>(0,A.jsxs)(m.Row,{gap:6,children:[(0,A.jsx)(c.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:I[e.c]}}),(0,A.jsx)(m.T,{size:14,style:{flex:1},children:e.c}),(0,A.jsxs)(m.T,{size:14,children:[Math.round(e.v/g*100),"%"]})]},e.c))})]})]}),(0,A.jsxs)(m.Card,{children:[(0,A.jsx)(m.T,{weight:"semibold",children:"Top dishes"}),y.map((e,t)=>(0,A.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,A.jsxs)(m.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,A.jsxs)(m.Muted,{children:[e.sold," sold \xb7 ",(0,j.gbp)(e.revenue)]})]},e.item.id))]}),(0,A.jsxs)(m.Row,{gap:8,children:[(0,A.jsxs)(m.Card,{style:{flex:1},children:[(0,A.jsx)(m.Muted,{children:"Repeat customers"}),(0,A.jsx)(m.T,{size:20,weight:"bold",children:"38%"}),(0,A.jsx)(m.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,A.jsxs)(m.Card,{style:{flex:1},children:[(0,A.jsx)(m.Muted,{children:"No-show rate"}),(0,A.jsxs)(m.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,A.jsxs)(m.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,A.jsxs)(m.Card,{highlight:b.colours.ok,children:[(0,A.jsx)(m.T,{weight:"semibold",colour:b.colours.ok,children:"Commission saved vs delivery apps"}),(0,A.jsx)(N.CountUp,{value:.3*k/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:b.colours.ok}),(0,A.jsxs)(m.Muted,{children:[(0,j.gbp)(k)," of direct takeaway & QR orders in ",o," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const F=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const W=[{id:'fridge1',label:'Walk-in fridge temp',temp:!0},{id:'fridge2',label:'Line fridge temp',temp:!0},{id:'freezer',label:'Freezer temp',temp:!0},{id:'hot',label:'Hot-hold check (\u226563\xb0C)',temp:!0},{id:'open-clean',label:'Opening clean & sanitise surfaces'},{id:'allergen-brief',label:'Allergen briefing with front of house'},{id:'specials-allergens',label:'Specials allergens recorded & signed off'},{id:'probe',label:'Probe thermometer calibrated'},{id:'close',label:'Closing checks: fryers off, doors locked'}];function _(){const{rid:e,r:t,now:s,today:l}=(0,w.useCtx)(1e4),n=(0,p.useOrders)(e),i=(0,p.useBookings)(e),r=(0,p.useRatings)(e),a=(0,p.useWaitlist)(e),o=(0,x.useOwner)(e=>e.leave),d=(0,x.useOwner)(e=>e.swaps),u=(0,x.useOwner)(e=>e.readNotes),c=[...n.filter(e=>(0,y.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,j.gbp)(e.total)}`,tone:b.colours.amber})),...n.filter(e=>(0,y.LIVE)(e)&&(0,k.chainNeedsAction)(e,i)).map(e=>({id:`oa-${e.id}`,tab:'orders',title:`Allergy on ${e.ref}`,body:'Allergen sign-off needed before it moves on',tone:b.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,k.bookingNeedsAction)(e,n.filter(y.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:b.colours.red})),...r.filter(e=>e.stars<=2).map(e=>({id:`r-${e.id}`,tab:'more:reviews',title:`${e.stars}\u2605 rating from ${e.customerName}`,body:e.comment,tone:b.colours.red})),...o.filter(e=>'pending'===e.status).map(e=>({id:`l-${e.id}`,tab:'more:rota',title:'Leave request',body:`${e.from} \u2013 ${e.to}: ${e.reason}`,tone:b.colours.blue})),...d.filter(e=>'open'===e.status).map(e=>({id:`s-${e.id}`,tab:'more:rota',title:'swap'===e.kind?'Shift swap request':'Cover needed',body:e.note,tone:b.colours.blue})),...a.filter(e=>'waiting'===e.status).length?[{id:`wl-${a.length}`,tab:'bookings',title:`${a.filter(e=>'waiting'===e.status).length} parties on the waitlist`,body:'Notify when a table frees up',tone:b.colours.gold}]:[]];return{list:c,unread:c.filter(e=>!u[e.id]).length,read:u}}const U=[{id:'all',label:'All'},{id:'booking',label:'New bookings'},{id:'pending',label:'Needs confirming'},{id:'takeaway',label:'Takeaway orders'},{id:'email',label:'Emails'},{id:'test',label:'Tests'}],q=e=>{const t=Math.round((Date.now()-e)/6e4);return t<1?'just now':t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} hr ago`:`${Math.round(t/1440)} days ago`};const K=[{name:'',who:'Customer app: what guests use',path:'/customer-app/index.html'},{name:' \xb7 Staff',who:'Staff phones',path:'/staff-app/index.html'},{name:' \xb7 Display',who:'Restaurant tablet, held sideways',path:'/display-app/index.html'},{name:' \xb7 Head Chef',who:'Kitchen: stock, costing, prep',path:'/chef-app/index.html'},{name:' \xb7 Managers',who:'This app',path:'/owner-app/index.html'}];function V(e){if('undefined'==typeof window||!window.location)return e;const t=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/),s=t?t[1]:'';return new URL(s+e,window.location.origin).toString()}async function G(e){try{const t='undefined'!=typeof navigator?navigator:null;if(t?.clipboard?.writeText)return await t.clipboard.writeText(e),!0;if('undefined'!=typeof document){const t=document.createElement('textarea');t.value=e,t.setAttribute('readonly',''),t.style.position='fixed',t.style.opacity='0',document.body.appendChild(t),t.select();const s=document.execCommand('copy');return document.body.removeChild(t),s}}catch{}return!1}},901,[874,868,820,963,965,30,118,239,122,263,151,127,287,871,813,819,854,816,818,821,953,954,987,985,960,1009,902,980,982,981,983,984,998,893,1010,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,"PAGES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4);return(0,f.jsxs)(o.default,{style:{gap:14},children:[g.map(t=>{const u=b.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:t.title,onPress:()=>e('more',t.id),style:({pressed:e})=>({padding:12,borderTopWidth:l?1:0,borderColor:i.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,f.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),t.badge?(0,f.jsx)(s.Badge,{kind:"gold",label:t.badge}):null,(0,f.jsx)(s.T,{colour:i.colours.muted,children:"\u203a"})]})},t.id))})]},t):null}),(0,f.jsxs)(s.Muted,{center:!0,children:['staff'===l?'Staff app preview':'Managers app'," \xb7 ",t.APP_VERSION," \xb7 ",'live'===c.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),s=r(d[4]),l=r(d[5]),i=r(d[6]),u=r(d[7]),c=r(d[8]),f=r(d[9]);const b=[],p=e=>{e.forEach(e=>{b.some(t=>t.id===e.id)||b.push(e)})},g=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const h=e=>b.find(t=>t.id===e)},902,[1011,30,263,127,813,854,821,954,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.TablePlan=function({startStep:e}){const{rid:s,r:t,now:w,me:f}=(0,b.useCtx)(6e4),k=(0,x.usePlan)(s),[v,T]=(0,n.useState)(null),[S,P]=(0,n.useState)(k.areas[0]?.id??''),[C,D]=(0,n.useState)(null),I=k.areas.find(e=>e.id===S)??k.areas[0],M=(0,x.planCounts)(k),N=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,j.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,m.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,m.jsxs)(h.Muted,{children:["The table plan for ",t.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,m.jsxs)(h.Card,{children:[(0,m.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,m.jsxs)(a.default,{children:[(0,m.jsxs)(h.T,{size:20,weight:"bold",colour:y.colours.gold,children:[M.tables," tables \xb7 ",M.seats," seats"]}),(0,m.jsxs)(h.Muted,{children:[k.areas.length," areas \xb7 ",k.joins.length," joined ",1===k.joins.length?"pair":"pairs"]})]}),(0,m.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>T(e??'arrange')})]}),(0,m.jsx)(a.default,{style:{gap:6},children:k.areas.map(e=>{const s=(0,x.planCounts)(k,e.id);return(0,m.jsxs)(h.Row,{gap:8,style:{borderTopWidth:1,borderTopColor:y.colours.border,paddingTop:6},children:[(0,m.jsxs)(a.default,{style:{flex:1},children:[(0,m.jsx)(h.T,{weight:"semibold",colour:(0,y.brandColour)(e.colour),children:e.name}),e.label?(0,m.jsx)(h.Muted,{size:12,children:e.label}):null]}),e.dogs?(0,m.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,m.jsx)(h.Badge,{kind:N.has(e.id)?'red':'neutral',label:N.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null,(0,m.jsxs)(h.Muted,{children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,m.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,m.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>T('areas')}),(0,m.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>T('tables')}),(0,m.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>T('arrange')})]})]}),k.areas.some(e=>e.outdoor)?(0,m.jsxs)(h.Card,{children:[(0,m.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,m.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,m.jsx)(c.CloseGardenButton,{rid:s,r:t,now:w,by:f})]}):null,I?(0,m.jsxs)(h.Card,{children:[(0,m.jsx)(o.AreaTabs,{plan:k,area:I.id,onPick:P,closed:N,counts:Object.fromEntries(k.areas.map(e=>{const s=(0,x.planCounts)(k,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,m.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,m.jsx)(r.FloorCanvas,{plan:k,areaId:I.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,m.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,C?(0,m.jsx)(h.Banner,{kind:"success",title:C}):null,(0,m.jsx)(l.default,{visible:!!v,animationType:"slide",onRequestClose:()=>T(null),presentationStyle:"fullScreen",children:(0,m.jsx)(a.default,{style:{flex:1,backgroundColor:y.colours.bg},children:v?(0,m.jsx)(u.PlanDesigner,{initial:k,venue:t.name,mode:"managers",startStep:v,onSave:e=>{x.useFloor.getState().setPlan(s,e),T(null),D('Table plan saved. The Display uses it straight away.')},onCancel:()=>T(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),n=(0,x.useDisplaySettings)(e),t=s=>x.useFloor.getState().setSettings(e,s);return(0,m.jsxs)(a.default,{style:{gap:14},children:[(0,m.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,m.jsx)(h.T,{weight:"semibold",colour:y.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,m.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:n.privacy,onChange:e=>t({privacy:e})}):(0,m.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsx)(h.T,{children:"Privacy mode"}),(0,m.jsxs)(h.T,{weight:"semibold",children:[n.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,m.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,m.jsxs)(a.default,{style:{gap:6},children:[(0,m.jsx)(h.T,{weight:"semibold",colour:y.colours.gold,children:"Screensaver"}),(0,m.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,m.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,m.jsx)(a.default,{testID:`idle-${e}`,children:(0,m.jsx)(h.Chip,{label:`${e} min`,selected:n.idleMins===e,onPress:()=>t({idleMins:e})})},e))}),(0,m.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:n.pinOn,onChange:e=>t({pinOn:e})}),n.pinOn?(0,m.jsx)(k,{rid:e}):null,(0,m.jsx)(h.Muted,{children:"Just your logo, with gold sparkles, drifts slowly round the screen (avoids screen burn-in). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,m.jsx)(v,{}),(0,m.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,m.jsx)(h.T,{weight:"semibold",colour:y.colours.gold,children:"Shared tablet or phone"}),(0,m.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,m.jsx)(f.WipeDevice,{})]}),(0,m.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),j=_r(d[12]),y=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]);function k({rid:e}){const t=(0,x.useDisplaySettings)(e),[l,o]=(0,n.useState)(''),[r,u]=(0,n.useState)(''),[c,p]=(0,n.useState)(null),j=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,m.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[t.pinDefault?(0,m.jsx)(a.default,{testID:"wake-pin-default",children:(0,m.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,m.jsxs)(h.Muted,{children:["A wake PIN of ",t.pinLen," digits is set. Type a new one to change it."]}),(0,m.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,m.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:y.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,m.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:y.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,m.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||j?(0,m.jsx)(h.Muted,{children:c??j}):null]})}function v(){const[e,s]=(0,n.useState)((0,t.flapSoundOn)());return(0,m.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,m.jsx)(h.T,{weight:"semibold",colour:y.colours.gold,children:"Covers counter sound"}),(0,m.jsx)(h.Toggle,{label:"Soft flap click when the covers change (Display only)",value:e,onChange:e=>{(0,t.setFlapSound)(e),s(e)}}),(0,m.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},903,[874,30,1012,256,127,1013,1014,1015,990,813,824,825,818,821,954,1016,1017,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderAtTableCard=c,_e.OrderAtTableSettings=function(){const e=(0,h.useOwner)(e=>e.site);return(0,u.jsxs)(n.default,{style:{gap:10},children:[(0,u.jsx)(c,{rid:e}),(0,u.jsx)(o.Banner,{kind:"info",title:"Takeaway is separate",children:"Takeaway ordering, slots and the live takeaway queue work the same whichever way this is set. Each venue sets this for itself."})]})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var r,s=_r(d[3]),n=(r=s)&&r.__esModule?r:{default:r},o=_r(d[4]),l=_r(d[5]),h=_r(d[6]),u=_r(d[7]);function c({rid:r,compact:s}){const h=(0,l.useOrderAtTable)(r),c=(0,l.useStore)(e=>e.restaurants.find(e=>e.id===r)?.name??'this venue');return e.IS_GREENSIDE?(0,u.jsx)(t.GreensideCashOnly,{}):(0,u.jsx)(n.default,{testID:"order-at-table-card",children:(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Order at table"}),(0,u.jsx)(o.Muted,{children:"Guests scan a QR code on the table and order from their phone, then pay at the bar or till. Tables, hours and QR codes: Settings \u203a Advanced \u203a Order at the table."})]}),(0,u.jsx)(o.Toggle,{label:"Order at table",value:h,onChange:e=>l.useStore.getState().updateSettings(r,{orderAtTable:e})})]}),(0,u.jsx)(o.T,{size:13,colour:h?'#E2C489':'#D8CFBF',children:h?`On for ${c}: table QR codes, table orders and table tickets are shown.`:`Off for ${c}: in-house orders go through your till. Takeaway ordering stays on.`}),s?null:(0,u.jsx)(o.Muted,{children:"When it is off: no Order at table or table QR screen in the customer app, no Tables & QR codes page or Table option in Take an order here, no table orders in Live orders, and no table tickets in the Head Chef app."})]})})}},904,[5,991,30,127,813,819,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.useQuestionnaire=C,_e.useProvenance=I,_e.Tick=O,_e.TickLegend=_,_e.useOnboardingDue=M,_e.OnboardingHost=function({go:e}){const{rid:s,role:t}=(0,T.useCtx)(6e4),r=C(s),n=M(s,r);return'owner'===v.APP_VARIANT&&m.CAN.manage(t)&&n&&r?(0,P.jsx)(W,{rid:s,q:r,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),n=C(s),a=(0,f.useOnboard)(e=>e.setup[s]),o=I(s),[l,i]=(0,r.useState)(''),[u,h]=(0,r.useState)(null),[p,m]=(0,r.useState)(!1);if(!n)return null;const y=k.STEP_IDS.filter(e=>'done'===a?.steps[e]).length,x=n.onboardedAt||a?.finished;return(0,P.jsxs)(d.default,{style:{gap:10},testID:"setup-checklist",children:[(0,P.jsxs)(c.Card,{highlight:S.colours.gold,children:[(0,P.jsxs)(c.T,{weight:"semibold",children:[x?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,w.ukDate)(n.onboardedAt)}`:a?.finished?` \xb7 ${(0,w.ukDate)(a.finished)}`:'']}),(0,P.jsx)(d.default,{style:{height:8,borderRadius:4,backgroundColor:S.colours.surface2,overflow:'hidden'},children:(0,P.jsx)(d.default,{style:{width:100*(x&&!y?1:y/k.STEP_IDS.length)+"%",height:8,backgroundColor:S.colours.ok}})}),(0,P.jsx)(c.Muted,{children:n.onboardedAt&&!y?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${y} of ${k.STEP_IDS.length} pages checked on this device.`}),(0,P.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(c.Button,{kind:"success",label:x?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>f.useOnboard.getState().setReplay(s)}),(0,P.jsx)(c.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),o.any?(0,P.jsx)(_,{}):null,k.STEP_IDS.map(s=>{const r=a?.steps[s],n=A[s].map(e=>o.mark(...e)),l=n.filter(e=>'q'===e).length,i=n.filter(e=>'edited'===e).length;return(0,P.jsx)(c.Card,{onPress:()=>e('more',q[s].page),children:(0,P.jsxs)(c.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,P.jsx)(t.Icon,{name:B[s],size:20,colour:S.colours.gold}),(0,P.jsxs)(d.default,{style:{flex:1},children:[(0,P.jsx)(c.T,{weight:"medium",children:k.STEP_TITLE[s]}),(0,P.jsx)(c.Muted,{size:13,children:q[s].label}),l||i?(0,P.jsxs)(c.Row,{gap:6,style:{marginTop:4},children:[l?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(O,{mark:"q"}),(0,P.jsx)(c.Muted,{size:12,children:'team'===s||'suppliers'===s||'accounts'===s||'features'===s?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,i?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(O,{mark:"edited"}),(0,P.jsxs)(c.Muted,{size:12,children:[i," changed"]})]}):null]}):null]}),(0,P.jsx)(c.Badge,{kind:'done'===r?'ok':'skipped'===r?'amber':'neutral',label:'done'===r?'Checked':'skipped'===r?'Skipped':'To check'})]})},s)}),(0,P.jsxs)(c.Card,{children:[(0,P.jsx)(c.T,{weight:"semibold",children:"Your questionnaire answers"}),(0,P.jsxs)(c.Muted,{children:['signup-form'===n.source?`From your sign-up questionnaire${n.submittedAt?`, ${(0,w.ukDate)(n.submittedAt)}`:''}.`:'imported'===n.source?'Imported on this device.':'Built from your current setup (you joined before the questionnaire).'," They pre-fill the walkthrough; nothing is sent anywhere."]}),(0,P.jsx)(c.Row,{wrap:!0,gap:6,children:(0,P.jsx)(c.Button,{small:!0,kind:"secondary",label:p?'Hide answers':'Show answers (JSON)',onPress:()=>m(!p)})}),p?(0,P.jsx)(c.T,{size:11,style:{fontFamily:'monospace'},children:JSON.stringify(n,null,2)}):null,(0,P.jsx)(c.Field,{label:"Import answers (paste JSON from the questionnaire page)",value:l,onChangeText:i,multiline:!0,numberOfLines:4,placeholder:"{\"version\":1, \u2026}"}),(0,P.jsx)(c.Button,{small:!0,kind:"success",label:"Import answers",disabled:!l.trim(),onPress:()=>{let e;try{e=JSON.parse(l)}catch{return void h('That isn\u2019t valid JSON. Copy the whole file from the questionnaire page.')}const t=(0,k.cleanQuestionnaire)(e,s);t?(f.useOnboard.getState().saveAnswers(s,{...t,venueId:s,source:'imported',onboardedAt:void 0}),i(''),h('Imported. Tap Resume setup / Replay welcome to check each page.')):h('That doesn\u2019t look like CoverCharge questionnaire answers.')}}),u?(0,P.jsx)(c.Muted,{children:u}):null]}),(0,P.jsxs)(c.Card,{children:[(0,P.jsx)(c.T,{weight:"semibold",colour:S.colours.gold,children:"Free lifetime support"}),(0,P.jsx)(c.Muted,{children:N})]})]})};var s=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=e(_r(_d[3])),a=e(_r(_d[4])),o=e(_r(_d[5])),l=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),m=_r(_d[13]),y=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),b=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),S=_r(_d[21]),v=_r(_d[22]),T=_r(_d[23]),E=_r(_d[24]),P=_r(_d[25]);function C(e){const t=(0,p.useRestaurant)(e),n=(0,m.useOwner)(e=>e.staff),a=(0,m.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,f.useOnboard)(s=>s.answers[e]),i=(0,h.useBrand)(e);return(0,r.useMemo)(()=>{if(!t)return null;const r=e===j.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,b.planCounts)(o),c=(0,k.questionnaireFromFacts)({id:e,name:t.name,tagline:t.tagline,address:t.address??t.location,phone:t.phone,website:t.website,hasLogo:!!i.logo,hours:t.kitchenHours,hoursNote:t.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:r?n.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:r?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:t.settings.pay,orderAtTable:t.settings.orderAtTable,takeaway:!t.settings.takeawayPaused,games:t.settings.games}),h=x.SEEDED_ANSWERS[e],p=h?(0,k.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,s.withWildingsQuestionnaireAddress)(e,(0,k.mergeQuestionnaire)((0,k.mergeQuestionnaire)(c,p),l??null))},[t,n,a,o,l,e,i.logo])}const D=(e,s)=>s.reduce((e,s)=>null==e?void 0:e[s],e),R=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function I(e){const s=(0,f.useOnboard)(s=>s.answers[e]);return(0,r.useMemo)(()=>{const t='imported'===s?.source,r=t?s:x.SEEDED_ANSWERS[e],n=t||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(r,e);if(!n&&'pay'!==e[0])return null;if(!R(a))return null;if(!t&&s){const t=D(s,e);if(void 0!==t&&JSON.stringify(t)!==JSON.stringify(a))return'edited'}return'q'},any:n||R(D(r,['pay']))}},[s,e])}const A={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function O({mark:e,testID:s}){return e?'q'===e?(0,P.jsx)(d.default,{testID:s??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:S.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(c.T,{size:12,weight:"bold",colour:S.colours.onGold,children:"\u2713"})}):(0,P.jsx)(d.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(c.T,{size:11,colour:S.colours.gold,children:"\u270e edited"})}):(0,P.jsx)(d.default,{style:{width:20}})}function _({edited:e=!0}){return(0,P.jsxs)(c.Row,{gap:12,wrap:!0,children:[(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(O,{mark:"q",testID:"q-legend"}),(0,P.jsx)(c.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(O,{mark:"edited"}),(0,P.jsx)(c.Muted,{size:12,children:"Changed by you"})]}):null]})}function M(e,s){const t=(0,f.useOnboard)(s=>s.setup[e]);return(0,f.useOnboard)(e=>e.replay)===e||!(!s||s.onboardedAt)&&(!t?.welcomed&&!t?.finished)}const q={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},B={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},z={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},N='Free lifetime support from the CoverCharge team: message us any time from Settings \u203a Help. We help by message and email.';function $({children:e}){const s=(0,r.useRef)(new n.default.Value(0)).current;return(0,r.useEffect)(()=>{n.default.loop(n.default.sequence([n.default.timing(s,{toValue:1,duration:900,easing:a.default.inOut(a.default.quad),useNativeDriver:!1}),n.default.timing(s,{toValue:0,duration:900,easing:a.default.inOut(a.default.quad),useNativeDriver:!1})])).start()},[]),(0,P.jsx)(n.default.View,{style:{opacity:s.interpolate({inputRange:[0,1],outputRange:[.45,1]})},children:e})}function L({at:e}){return(0,P.jsx)(c.Row,{gap:6,style:{justifyContent:'center'},children:k.STEP_IDS.map((s,t)=>(0,P.jsx)(d.default,{style:{width:t===e?22:8,height:8,borderRadius:4,backgroundColor:ts.replay===e),x=(0,f.useOnboard)(s=>s.setup[e]),j=k.STEP_IDS.findIndex(e=>!x?.steps[e]),[b,w]=(0,r.useState)(y||!x?.welcomed?-1:j<0?k.STEP_IDS.length:j),v=(0,r.useRef)(new n.default.Value(0)).current;(0,r.useEffect)(()=>{v.setValue(0),n.default.timing(v,{toValue:1,duration:350,useNativeDriver:!1}).start()},[b]);const C=f.useOnboard.getState(),D=()=>{x?.welcomed||C.welcome(e),C.setReplay(null)},R=(t,r)=>{'accounts'===t&&'done'===r&&(0,E.importQuestionnaireAccounts)(e,s,m),C.markStep(e,t,r),w(b+1)};return(0,P.jsx)(o.default,{visible:!0,animationType:"fade",onRequestClose:D,children:(0,P.jsx)(u.SafeAreaView,{style:{flex:1,backgroundColor:S.colours.bg},children:-1===b?(0,P.jsxs)(l.default,{testID:"onboard-welcome",accessibilityRole:"button",accessibilityLabel:"Tap to continue",onPress:()=>{C.welcome(e),w(0)},style:{flex:1,alignItems:'center',justifyContent:'center',padding:28,gap:18},children:[(0,P.jsxs)(n.default.View,{style:{opacity:v,transform:[{translateY:v.interpolate({inputRange:[0,1],outputRange:[16,0]})}],alignItems:'center',gap:16},children:[p.logo?(0,P.jsx)(h.RestaurantLogo,{rid:e,size:128}):(0,P.jsx)(d.default,{style:{width:112,height:112,borderRadius:56,borderWidth:2,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(c.T,{size:44,weight:"bold",colour:S.colours.gold,children:s.venue.name.slice(0,1)})}),(0,P.jsx)(c.T,{size:15,colour:S.colours.gold,weight:"semibold",style:{letterSpacing:1.5},children:"HELLO FROM THE COVERCHARGE TEAM"}),(0,P.jsx)(c.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"Thanks for choosing CoverCharge"}),(0,P.jsxs)(c.T,{size:17,colour:S.colours.muted,style:{textAlign:'center',maxWidth:420},children:["Let\u2019s get ",s.venue.name," ready. We\u2019ve filled in everything from the questionnaire you sent us, so it\u2019s mostly a case of checking."]})]}),(0,P.jsx)($,{children:(0,P.jsx)(c.T,{size:16,colour:S.colours.goldLight,children:"Tap to continue"})}),(0,P.jsxs)(d.default,{style:{position:'absolute',bottom:22,alignItems:'center',gap:6},children:[(0,P.jsx)(h.PoweredBy,{size:12}),(0,P.jsx)(c.Muted,{center:!0,size:12,children:"Free lifetime support, whenever you need it."})]})]}):b>=k.STEP_IDS.length?(0,P.jsx)(Q,{rid:e,q:s,onDone:()=>{C.finish(e)}}):(0,P.jsxs)(d.default,{style:{flex:1},children:[(0,P.jsxs)(d.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:S.colours.border},children:[(0,P.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(c.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>w(b-1)}),(0,P.jsxs)(c.T,{size:13,colour:S.colours.muted,children:["Step ",b+1," of ",k.STEP_IDS.length]}),(0,P.jsx)(c.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:D})]}),(0,P.jsx)(L,{at:b})]}),(0,P.jsx)(i.default,{contentContainerStyle:{padding:18,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,P.jsxs)(n.default.View,{style:{opacity:v,gap:14},children:[(0,P.jsxs)(c.Row,{gap:10,children:[(0,P.jsx)(t.Icon,{name:B[k.STEP_IDS[b]],size:34,colour:S.colours.gold}),(0,P.jsxs)(d.default,{style:{flex:1},children:[(0,P.jsx)(c.T,{size:24,weight:"bold",children:k.STEP_TITLE[k.STEP_IDS[b]]}),(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(c.Badge,{kind:"gold",label:'signup-form'===s.source?'From your questionnaire':'imported'===s.source?'From your imported answers':'From your current setup'}),x?.steps[k.STEP_IDS[b]]?(0,P.jsx)(c.Badge,{kind:'done'===x.steps[k.STEP_IDS[b]]?'ok':'neutral',label:'done'===x.steps[k.STEP_IDS[b]]?'Checked':'Skipped'}):null]})]})]}),(0,P.jsx)(V,{rid:e,step:k.STEP_IDS[b],q:s})]})}),(0,P.jsxs)(d.default,{style:{padding:14,gap:8,borderTopWidth:1,borderColor:S.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,P.jsx)(c.Button,{kind:"success",testID:`looks-right-${k.STEP_IDS[b]}`,label:"Looks right \u2713",onPress:()=>R(k.STEP_IDS[b],'done')}),(0,P.jsxs)(c.Row,{gap:8,children:[(0,P.jsx)(c.Button,{kind:"secondary",label:"Edit",onPress:()=>{return s=k.STEP_IDS[b],x?.welcomed||C.welcome(e),C.setReplay(null),void a('more',q[s].page);var s},style:{flex:1}}),(0,P.jsx)(c.Button,{kind:"ghost",label:'suppliers'===k.STEP_IDS[b]||'accounts'===k.STEP_IDS[b]?'Skip (optional)':'Skip for now',onPress:()=>R(k.STEP_IDS[b],'skipped'),style:{flex:1}})]})]})]})})})}function F({k:e,v:s,mark:t}){return(0,P.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:S.colours.border},gap:10,children:[(0,P.jsx)(c.Muted,{children:e}),(0,P.jsx)(c.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==s||''===s?'\u2014':String(s)}),void 0!==t?(0,P.jsx)(O,{mark:t}):null]})}function V({rid:e,step:s,q:t}){const r=(0,h.useBrand)(e),{mark:n}=I(e),a=A[s].some(e=>n(...e))?(0,P.jsx)(_,{edited:A[s].some(e=>'edited'===n(...e))}):null;return(0,P.jsxs)(d.default,{style:{gap:10},children:[a,(0,P.jsx)(H,{rid:e,step:s,q:t,brand:r,mark:n})]})}function H({rid:e,step:s,q:t,brand:n,mark:a}){const[o,l]=(0,r.useState)(t.tables.template),[i,u]=(0,r.useState)(t.features);switch(s){case'venue':return(0,P.jsxs)(c.Card,{children:[(0,P.jsxs)(c.Row,{gap:12,children:[n.logo?(0,P.jsx)(h.RestaurantLogo,{rid:e,size:64}):(0,P.jsx)(d.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:S.colours.border,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(c.Muted,{children:"No logo"})}),(0,P.jsxs)(d.default,{style:{flex:1},children:[(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(c.T,{size:20,weight:"bold",children:t.venue.name}),(0,P.jsx)(O,{mark:a('venue','name')})]}),t.venue.tagline?(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(c.Muted,{children:t.venue.tagline}),(0,P.jsx)(O,{mark:a('venue','tagline')})]}):null]})]}),(0,P.jsx)(F,{k:"Address",v:t.venue.address,mark:a('venue','address')}),(0,P.jsx)(F,{k:"Phone",v:t.venue.phone,mark:a('venue','phone')}),(0,P.jsx)(F,{k:"Email",v:t.venue.email,mark:a('venue','email')}),(0,P.jsx)(F,{k:"Website",v:t.venue.website,mark:a('venue','website')}),n.logo?null:(0,P.jsx)(c.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,P.jsxs)(c.Card,{children:[k.WEEK_ORDER.map(e=>(0,P.jsx)(F,{k:k.DAY_NAMES[e],v:t.hours.days[e]?`${t.hours.days[e][0]} to ${t.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),t.hours.note?(0,P.jsx)(c.Muted,{children:t.hours.note}):null,(0,P.jsx)(c.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,P.jsxs)(c.Card,{children:[(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(O,{mark:a('tables','tables')}),(0,P.jsx)(c.Muted,{style:{flex:1},children:t.tables.tables?`Your answers: ${t.tables.tables} tables${t.tables.covers?`, ${t.tables.covers} covers`:''}${t.tables.areas?.length?` in ${t.tables.areas.join(' and ')}`:''}.`:'Pick a starting layout; you can move every table afterwards.'})]}),(0,P.jsx)(d.default,{style:{gap:6},children:Object.keys(k.TEMPLATE_LABEL).map(s=>(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(d.default,{style:{flex:1},children:(0,P.jsx)(c.Chip,{label:k.TEMPLATE_LABEL[s],selected:o===s,onPress:()=>{l(s),f.useOnboard.getState().saveAnswers(e,{...t,tables:{...t.tables,template:s}})}})}),o===s?(0,P.jsx)(O,{mark:a('tables','template')}):(0,P.jsx)(d.default,{style:{width:20}})]},s))}),(0,P.jsx)(c.Muted,{children:"Your table plan drives bookings, walk-ins and the floor screen. Tap Edit to drag tables into place in the editor."})]});case'team':{const e=t.team.filter(e=>'owner'!==e.role);return(0,P.jsxs)(c.Card,{children:[t.team.length?t.team.map((e,s)=>(0,P.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:S.colours.border},children:[(0,P.jsxs)(d.default,{style:{flex:1},children:[(0,P.jsx)(c.T,{weight:"medium",children:e.name}),(0,P.jsxs)(c.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(c.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,P.jsx)(O,{mark:a('team',s,'name')})]})]},s)):(0,P.jsx)(c.Muted,{children:"No team listed yet. Add people with Edit."}),(0,P.jsx)(c.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,P.jsx)(c.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,P.jsxs)(c.Card,{children:[(0,P.jsx)(c.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),t.suppliers.length?t.suppliers.map((e,s)=>(0,P.jsx)(F,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',s,'name')},s)):(0,P.jsx)(c.Muted,{children:"None listed. Skip, and add them later if you like."}),(0,P.jsx)(c.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,P.jsx)(c.Muted,{size:13,children:"Use Bidfood or Booker? Add them here to order and log in from CoverCharge. The account number is optional."}),(0,P.jsx)(E.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,P.jsx)(E.AccountsStep,{q:t,mark:a});case'pay':{const e=t.pay?(0,w.cleanPay)(t.pay):null,s=(0,w.ymdOf)(new Date);if(!e)return(0,P.jsx)(c.Card,{children:(0,P.jsx)(c.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const r=(0,w.nextToPay)(e,'tips',s).period,n=(0,w.nextToPay)(e,'wage',s).period;return(0,P.jsxs)(c.Card,{children:[(0,P.jsx)(F,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,P.jsx)(F,{k:"Next tips payday",v:r.payday?`${(0,w.ukDate)(r.payday)} (${(0,w.rangeText)(r.start,r.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,P.jsx)(F,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,P.jsx)(F,{k:"Next payday",v:n.payday?`${(0,w.ukDate)(n.payday)} (${(0,w.rangeText)(n.start,n.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,P.jsx)(c.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,P.jsxs)(c.Card,{children:[(0,P.jsx)(c.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(z).map(s=>(0,P.jsxs)(c.Row,{gap:6,children:[(0,P.jsx)(d.default,{style:{flex:1},children:(0,P.jsx)(c.Toggle,{label:z[s],value:i[s],onChange:r=>{return n={...i,[s]:r},u(n),void f.useOnboard.getState().saveAnswers(e,{...t,features:n});var n}})}),(0,P.jsx)(O,{mark:a('features',s)})]},s)),(0,P.jsx)(c.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function Q({rid:e,q:s,onDone:t}){const a=(0,f.useOnboard)(s=>s.setup[e]),o=k.STEP_IDS.filter(e=>'done'===a?.steps[e]).length,l=k.STEP_IDS.filter(e=>'skipped'===a?.steps[e]),d=(0,r.useRef)(new n.default.Value(0)).current;return(0,r.useEffect)(()=>{n.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,P.jsxs)(i.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,P.jsx)(n.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:S.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(c.T,{size:52,weight:"bold",children:"\u2713"})}),(0,P.jsx)(c.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,P.jsxs)(c.T,{size:16,colour:S.colours.muted,style:{textAlign:'center',maxWidth:440},children:[s.venue.name," is ready to go. ",o," of ",k.STEP_IDS.length," checked",l.length?`; ${l.map(e=>k.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,P.jsxs)(c.Card,{style:{maxWidth:440},children:[(0,P.jsx)(c.T,{weight:"semibold",colour:S.colours.gold,children:"We\u2019re here for you"}),(0,P.jsx)(c.Muted,{children:N})]}),(0,P.jsx)(c.Button,{kind:"success",label:"Open my dashboard",onPress:t,testID:"onboard-finish"})]})}},905,[1018,959,30,120,224,256,263,151,127,289,813,860,1019,854,825,1020,1021,5,1022,1023,864,821,806,954,906,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.ProviderLogo=w,_e.SupplierPortals=k,_e.importQuestionnaireAccounts=T,_e.AccountsStep=function({q:e,mark:n}){const s=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Listing them lets the Assistant help with them later. Nothing signs in during setup."}),s.length?s.map((e,s)=>{const t=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[t?(0,y.jsx)(w,{p:t,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:t?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',s,'provider')})]},s)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,B=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],A=(0,p.useQuestionnaire)(e),{mark:M}=(0,p.useProvenance)(e),[P,$]=(0,s.useState)(null),[z,D]=(0,s.useState)(null),[L,N]=(0,s.useState)(!1),O=(0,s.useMemo)(()=>(A?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!B.some(n=>n.provider===e.provider)),[A,B]),E=(A?.accounts??[]).some((e,n)=>M('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),E?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:s})=>{const t=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[t?(0,y.jsx)(w,{p:t,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:t?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:M('accounts',s,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>A&&T(e,A,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${B.length}`})]}),B.length?B.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),s=(A?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&s>=0?(0,y.jsx)(p.Tick,{mark:M('accounts',s,'provider')}):null,(0,y.jsx)(a.Badge,{kind:R[e.status].kind,label:R[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{t.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{t.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>$({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(k,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=B.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>$({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(I,{rid:e,sheet:P,owner:j,by:l,onClose:()=>$(null)}),z?(0,y.jsx)(C,{rid:e,c:z,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),s=r(d[1]),t=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function k({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,k]=(0,s.useState)({}),[T,B]=(0,s.useState)(null),R=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(s=>{const o=v.find(e=>e.provider===s.id),c=s.links,u=f[s.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${s.id}`,style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:n?34:40}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]}),o?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]}),(0,y.jsxs)(a.Row,{gap:8,wrap:!0,children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-order-${s.id}`,label:"Open ordering",onPress:()=>{t.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",testID:`portal-login-${s.id}`,label:"Log in",onPress:()=>{t.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>k({...f,[s.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${s.id}`}),(0,y.jsx)(a.Row,{gap:8,children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>R.update(e,o.id,{accountNo:u},l,`Updated ${s.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${s.id}`,label:"Remove",onPress:()=>B(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${s.id}`,label:`Add ${s.name}`,onPress:()=>R.add(e,{provider:s.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{size:12,children:["You sign in on ",s.name,"\u2019s own website. CoverCharge only keeps the account number, never your password."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},s.id)}),T?(0,y.jsx)(C,{rid:e,c:T,by:l,onClose:()=>B(null)}):null]})}function C({rid:e,c:n,by:s,onClose:t}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:t,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["The Assistant will stop using ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,s),t()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:t})]})})}function T(e,n,s){const t=u.useAccounts.getState(),o=t.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||t.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:s})}function B({rid:e,p:t,existing:p,owner:x,by:j,onClose:b}){const[v,k]=(0,s.useState)(p?.handle??''),[C,T]=(0,s.useState)(p?.customName??''),[B,R]=(0,s.useState)(!1),[I,S]=(0,s.useState)(!1);if(!t)return null;const A=t.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${A?'another service':t.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:t,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:A?c.CATEGORY_TITLE[t.category]:t.name}),t.note?(0,y.jsx)(a.Muted,{size:13,children:t.note}):null]})]}),A?(0,y.jsx)(a.Field,{label:"Service name",value:C,onChangeText:T,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${t.name}`,onPress:()=>R(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",t.name,"\u2019s own page; CoverCharge never sees your password."]})]}),B?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${t.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below so the Assistant knows you use it, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${t.handleLabel} (public name only, optional)`,value:v,onChangeText:k,placeholder:t.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:A?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:A&&C.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:t.id,customName:A?C.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:A&&!C.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!I),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[I?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),I?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const R={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function I({rid:e,sheet:n,owner:s,by:t,onClose:o}){return n?(0,y.jsx)(B,{rid:e,p:n.p,existing:n.existing,owner:s,by:t,onClose:o},n.existing?.id??n.p.id):null}},906,[874,30,239,263,151,127,813,907,908,821,905,954,854,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},907,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.looksSecret=l,Object.defineProperty(_e,"useAccounts",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),s=r(d[2]);const c=/^\s*(password|passwd|pwd|passcode|pin|otp|secret|token|api[ _-]?key)\s*[:=]/i,u=/\b(sk|pk|rk)_(live|test)_|\bghp_|\bxox[abp]-|\bAKIA[0-9A-Z]{12}|\beyJ[A-Za-z0-9_-]{10,}\./;function l(e){return!(!c.test(e)&&!u.test(e))||e.split(/\s+/).some(e=>e.length>=24&&/[A-Za-z]/.test(e)&&/\d/.test(e)&&!/^[\w.+-]+@[\w-]+\.[\w.]+$/.test(e)&&!/^(https?:\/\/|www\.)/i.test(e))}const b=e=>e&&!l(e)&&e.trim().slice(0,120)||void 0,p=e=>{const t=e?.trim();return t&&/^[A-Za-z0-9 -]{1,20}$/.test(t)?t:void 0},y=(0,n.create)()((0,s.persist)(e=>({byVenue:{},log:{},add:(t,o)=>e(e=>{const n={...o,handle:b(o.handle),customName:b(o.customName),accountNo:p(o.accountNo),id:`c-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,addedAt:(new Date).toISOString()};return{byVenue:{...e.byVenue,[t]:[...e.byVenue[t]??[],n]},log:{...e.log,[t]:[{at:n.addedAt,by:o.addedBy,what:`Added ${o.customName??o.provider}`},...e.log[t]??[]].slice(0,200)}}}),update:(t,o,n,s,c)=>e(e=>({byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).map(e=>e.id===o?{...e,...n,handle:void 0!==n.handle?b(n.handle):e.handle,accountNo:void 0!==n.accountNo?p(n.accountNo):e.accountNo}:e)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:s,what:c},...e.log[t]??[]].slice(0,200)}})),remove:(t,o,n)=>e(e=>{const s=(e.byVenue[t]??[]).find(e=>e.id===o);return{byVenue:{...e.byVenue,[t]:(e.byVenue[t]??[]).filter(e=>e.id!==o)},log:{...e.log,[t]:[{at:(new Date).toISOString(),by:n,what:`Removed ${s?.customName??s?.provider??'an account'}`},...e.log[t]??[]].slice(0,200)}}})}),{name:'covercharge-accounts-v1',version:1,storage:(0,s.createJSONStorage)(()=>o.default)}))},908,[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}),_e.Forecasts=function({go:e}){const{rid:v,r:C,now:M,today:$}=(0,y.useCtx)(3e4),{width:B}=(0,d.default)(),S=(0,i.useBookings)(v),T=(0,i.useOrders)(v),D=(0,i.useEvents)(v),[H,R]=(0,t.useState)(7),P=(0,p.useRealHistory)(v,M),A=(0,t.useMemo)(()=>(0,s.forecastToday)(C,S,T,D,M,P??void 0),[C,S,T,D,P,M.getTime()/6e4|0]),E=(0,t.useMemo)(()=>Array.from({length:H},(e,t)=>{const o=(0,c.addMins)((0,c.parseYmd)($),1440*t);return{d:o,f:(0,s.forecastToday)(C,S,T,D,o,P??void 0)}}),[C,S,T,D,$,H,P]),F=A.hours.reduce((e,s)=>e+s.booked,0),O=Math.max(C.settings.capacityPerHour,...A.hours.map(e=>e.coversHigh)),_=Math.max(1,...E.map(e=>e.f.restOfDay.high)),N=(0,n.showTakeaway)(C),[Y,I]=(0,t.useState)(N),L=D.filter(e=>e.date>=$).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),z=Math.min(B,900)-60;return A.enough?(0,k.jsxs)(a.default,{style:{gap:12},children:[(0,k.jsxs)(r.Card,{children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(r.T,{weight:"semibold",colour:h.colours.gold,children:["Today by hour \xb7 ",(0,c.niceDate)(M)]}),A.example?(0,k.jsx)(p.ExampleBadge,{}):(0,k.jsx)(r.Badge,{kind:"amber",label:"ESTIMATE"})]}),A.open?(0,k.jsx)(x.Bars,{data:A.hours.map(e=>({key:String(e.hour),label:String(e.hour),a:e.booked,b:e.walkIns})),max:O,highlight:A.nextHour?String(A.nextHour.hour):void 0}):(0,k.jsx)(r.Muted,{children:"Closed today."}),(0,k.jsxs)(r.Row,{gap:12,children:[(0,k.jsxs)(r.Row,{gap:4,children:[(0,k.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#9C7C45'}}),(0,k.jsx)(r.Muted,{children:"Booked"})]}),(0,k.jsxs)(r.Row,{gap:4,children:[(0,k.jsx)(a.default,{style:{width:10,height:10,backgroundColor:'#6B5A3A'}}),(0,k.jsx)(r.Muted,{children:"Expected walk-ins and later bookings"})]})]}),A.hours.map(e=>{const t=(0,x.busyLevel)(e.covers,C.settings.capacityPerHour);return(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{size:14,children:(0,y.fmtH)(e.hour)}),(0,k.jsxs)(r.T,{size:14,colour:h.colours.muted,children:[(0,s.coversRange)(e.coversLow,e.coversHigh),N?` \xb7 about ${e.takeaway} takeaway`:'']}),(0,k.jsx)(r.T,{size:14,weight:"semibold",colour:t.colour,children:t.label})]},e.hour)})]}),(0,k.jsxs)(r.Card,{children:[(0,k.jsx)(r.T,{weight:"semibold",colour:h.colours.gold,children:"Suggested actions"}),A.suggestions.map((e,s)=>(0,k.jsxs)(r.T,{size:14,children:["\u2022 ",e]},s)),(0,k.jsx)(r.Muted,{children:A.example?`${l.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,k.jsxs)(r.Card,{children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(r.T,{weight:"semibold",colour:h.colours.gold,children:["Next ",H," days (covers)"]}),(0,k.jsx)(r.Row,{gap:4,children:[7,14].map(e=>(0,k.jsx)(r.Chip,{label:`${e}d`,selected:H===e,onPress:()=>R(e)},e))})]}),(0,k.jsx)(x.Bars,{data:E.map(e=>({key:(0,c.ymd)(e.d),label:(0,c.niceDate)(e.d).slice(0,3),a:e.f.open?e.f.restOfDay.covers:0,note:e.f.open?String(e.f.restOfDay.covers):'shut'})),max:_,highlight:$,height:100}),E.filter(e=>e.f.flags.length).map(e=>(0,k.jsxs)(r.Muted,{children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,k.jsxs)(r.Card,{children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",colour:N?h.colours.gold:h.colours.muted,children:"Takeaway"}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:Y?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>I(!Y)})]}),Y?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(r.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,k.jsx)(j.LineChart,{width:z,series:[A.hours.map(e=>e.takeaway),A.hours.map(e=>e.takeawayPlaced)],labels:A.hours.map(e=>String(e.hour))}),(0,k.jsxs)(r.Row,{gap:12,children:[(0,k.jsx)(r.Muted,{children:"Gold: forecast"}),(0,k.jsx)(r.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,k.jsx)(x.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),L.map(s=>(0,k.jsxs)(r.Card,{children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(s.title)}),(0,k.jsx)(r.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,k.jsxs)(r.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,k.jsx)(r.Muted,{children:[s.time?`From ${(0,n.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,n.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${f(s.date,$)}`,onPress:()=>{u.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${f(s.date,$)}`,body:`${s.title} at ${C.name} ${f(s.date,$)}${s.time?` from ${(0,n.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,n.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{u.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${C.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,k.jsx)(r.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,k.jsxs)(a.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,k.jsx)(p.NotEnoughHistory,{weeks:A.minWeeks,booked:F}),(0,k.jsxs)(r.Card,{children:[(0,k.jsxs)(r.T,{weight:"semibold",colour:h.colours.gold,children:["Booked, next ",H," days"]}),(0,k.jsx)(x.Bars,{data:E.map(e=>{const s=e.f.hours.reduce((e,s)=>e+s.booked,0);return{key:(0,c.ymd)(e.d),label:(0,c.niceDate)(e.d).slice(0,3),a:s,note:e.f.open?String(s):'shut'}}),max:Math.max(1,...E.map(e=>e.f.hours.reduce((e,s)=>e+s.booked,0))),highlight:$,height:100}),(0,k.jsx)(r.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,k.jsx)(x.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),L.slice(0,6).map(e=>(0,k.jsxs)(r.Card,{children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",style:{flex:1},children:(0,o.holidayName)(e.title)}),(0,k.jsx)(r.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,k.jsxs)(r.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,k.jsx)(r.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=e(_r(_d[3])),d=e(_r(_d[4])),r=_r(_d[5]),i=_r(_d[6]),l=_r(_d[7]),n=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),x=_r(_d[12]),y=_r(_d[13]),j=_r(_d[14]),p=_r(_d[15]),k=_r(_d[16]);const f=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,o.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},909,[868,30,828,127,287,813,819,1026,809,818,821,854,953,954,893,981,24]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=P,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,x]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)).slice(0,8),R=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),A=R.filter(e=>'due'===e.state||'overdue'===e.state),M=R.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,B.jsxs)(o.default,{style:{gap:12},children:[(0,B.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),b?(0,B.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,B.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,B.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,B.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,B.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,B.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===A.length?(0,B.jsx)(i.Muted,{children:"Nothing due right now."}):null,A.map(e=>(0,B.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,y.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,B.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,B.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),M.map(e=>(0,B.jsxs)(i.Muted,{children:[(0,y.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,y.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,B.jsx)(k.SectionHead,{title:"Live orders",right:(0,B.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,B.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,B.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,B.jsx)(P,{o:e},e.id)),v.length?(0,B.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,B.jsx)(i.Card,{style:{opacity:.7},children:(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,B.jsx)(O,{onClose:e=>{h(!1),e&&x(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),x=_r(d[13]),y=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]);const R={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function O({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),y=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,R]=(0,r.useState)(''),[O,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[N,$]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,F]=(0,r.useState)(''),[_,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,x.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries(N).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(y.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.ukPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(_),J=K.length>0&&Y&&(Q?O.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(y.map(e=>e.section)));return(0,B.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,B.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,B.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,B.jsx)(i.Field,{label:"Table number",value:O,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,B.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:R,placeholder:"e.g. Mrs Reid"}),Q?null:(0,B.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:F,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,B.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,B.jsx)(i.Field,{label:"Email (optional)",value:_,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too"}),'phone'===T?(0,B.jsxs)(o.default,{style:{gap:4},children:[(0,B.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,B.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,B.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,B.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),y.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,B.jsxs)(o.default,{style:{flex:1},children:[(0,B.jsx)(i.T,{size:15,children:e.name}),(0,B.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,B.jsx)(i.Stepper,{value:N[e.id]??0,min:0,max:20,label:e.name,onChange:t=>$({...N,[e.id]:t})})]},e.id)),(0,B.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,B.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,B.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,B.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,B.jsx)(l.GreensideCashOnly,{}):(0,B.jsx)(i.Banner,{kind:"demo",title:"Card payments: not set up yet",children:"Pay on collection or at the table. Nothing is charged in the app."}),(0,B.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?O.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:_.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${O.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function P({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),x=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,B.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,B.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,B.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,y.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",R[e.channel??(e.type,'app')]," \xb7 ",(0,y.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,B.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,B.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,B.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,B.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,B.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,B.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,y.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,B.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,B.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,B.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,B.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,B.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:x,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,B.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,B.jsx)(i.Button,{small:!0,kind:"ghost",label:"Reject",onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},910,[5,991,808,964,30,127,813,819,1019,979,814,816,978,817,818,821,953,954,960,986,987,1027,823,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return ae}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),p=_r(d[8]),b=_r(d[9]),h=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),v=_r(d[16]),w=_r(d[17]),E=_r(d[18]),N=_r(d[19]),P=_r(d[20]),A=_r(d[21]),T=_r(d[22]),W=(e=T)&&e.__esModule?e:{default:e},R=_r(d[23]),M=_r(d[24]),B=_r(d[25]),x=_r(d[26]),G=_r(d[27]),O=_r(d[28]),D=_r(d[29]),L=_r(d[30]),H=_r(d[31]),I=_r(d[32]),F=_r(d[33]),_=_r(d[34]),V=_r(d[35]),q=_r(d[36]),Q=_r(d[37]),Y=_r(d[38]),U=_r(d[39]),j=_r(d[40]),z=_r(d[41]),$=_r(d[42]),J=_r(d[43]),K=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]);const ae=()=>{const e=n.useOwner.getState().site;return(0,u.orderAtTableOn)(l.useStore.getState().restaurants.find(t=>t.id===e))},se=e=>n.CAN.manage(e);(0,h.register)([{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>se(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:se,C:o.ServiceBoard},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:se,C:b.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:se,C:b.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',badge:'NEW',C:C.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:se,C:b.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:se,C:b.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:se,C:b.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:se,C:b.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:c.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:se,badge:'NEW',C:y.BrandingSettings},{id:'plan',title:'Plan & billing',sub:p.PLAN_SUB,group:'Account',can:n.CAN.billing,C:p.PlanBilling}]),(0,h.register)([{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo',group:'Team',badge:'NEW',C:N.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',badge:'NEW',C:w.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:w.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',badge:'NEW',can:se,C:E.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:w.Timesheets}]),(0,h.register)([{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:P.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:P.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',badge:'NEW',can:se,C:k.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',badge:'NEW',can:se,C:v.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'Photo of the cash up sheet, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',badge:'NEW',can:se,C:S.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:P.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:P.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:P.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:se,C:P.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:se,C:P.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:se,C:P.Marketing},{id:'reviews',title:'Reviews',sub:'Sentiment, low-rating alerts, reply drafts',group:'Grow',can:se,C:P.Reviews},{id:'compliance',title:'Daily checks & allergen log',sub:'Fridge temps, opening checks, audit log',group:'Compliance',C:P.Compliance},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:P.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:se,badge:'NEW',C:P.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:P.DemoTools}]),(0,h.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:A.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>ae(),C:A.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:se,C:A.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:se,C:A.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:A.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:se,C:A.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:se,C:A.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:se,C:A.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:se,C:A.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:A.TabletPreview}]);const ie=e=>'staff'!==e;(0,h.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',badge:'NEW',C:()=>W.default.createElement(M.MyHoursPay)},{id:'mytips',title:'My tips',sub:'Your share of tips, approved periods',group:'Team',C:R.MyTips},{id:'tips',title:'Tips (tronc)',sub:'Split tips fairly, approve, compliance checklist',group:'Team',badge:'NEW',can:ie,C:R.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',badge:'NEW',can:ie,C:M.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',badge:'NEW',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:B.Suppliers}]),(0,h.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',badge:'NEW',C:x.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:se,C:x.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:se,badge:'NEW',C:x.QuickLinksSettings}]),(0,h.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:se,badge:'NEW',C:G.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:se,badge:'NEW',C:G.DisplaySettingsPage}]);const re=e=>'owner'===e||'manager'===e;O.ASSISTANT_AVAILABLE&&(0,h.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:re,badge:'NEW',C:O.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off, voice, connected services',group:'Account',can:re,C:O.AssistantSettings}]);const oe=e=>'owner'===e||'manager'===e;(0,h.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:oe,badge:'NEW',C:D.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:oe,badge:'NEW',C:D.SafetyPages.Creator},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning, allergen checks; filters; CSV and print for the EHO',group:'Compliance',can:oe,badge:'NEW',C:D.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:oe,badge:'NEW',C:f.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',badge:'NEW',C:D.SafetyPages.Accidents}]),(0,h.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:se,badge:'NEW',C:L.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:se,badge:'NEW',C:L.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:se,badge:'NEW',C:L.Outbox}]);const ne=e=>'owner'===e||'manager'===e;(0,h.register)([{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:ne,badge:'NEW',C:I.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:ne,badge:'NEW',C:H.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:ne,badge:'NEW',C:F.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:ne,badge:'NEW',C:_.OrderSheetSettings},...V.SETUP_STEPS.map(e=>({id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:ne,C:(0,H.stepPage)(e.id)}))]),(0,h.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:ne,badge:'NEW',C:q.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:se,badge:'NEW',C:q.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:ne,badge:'NEW',C:q.BreakRoomSettings}]),(0,h.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:se,badge:'NEW',C:Q.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:se,badge:'NEW',C:Q.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:se,badge:'NEW',C:Q.PayTipsSettings}]),(0,h.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:se,badge:'NEW',C:Y.SetupChecklist}]),(0,h.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos, Show me where, or ask the Assistant',group:'Start here',can:se,badge:'NEW',C:U.HelpPage}]),(0,h.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and suppliers (Bidfood, Booker)',group:'Settings',can:se,badge:'NEW',C:z.ConnectionsPage}]),(0,h.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, Booker and Bidfood lists, offers, events and specials the voice helper prepared; nothing is sent',group:'Run the day',can:se,badge:'NEW',C:$.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift, left by voice or typing',group:'Run the day',badge:'NEW',C:$.ShiftNotesPage},{id:'voice',title:'Voice helper',sub:'Hold-to-talk input, text-only replies, who gets it and microphone privacy',group:'Settings',can:se,badge:'NEW',C:$.VoiceSettingsPage}]),(0,h.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,X.useCtx)(6e4),o=(0,X.useSignedIn)();return W.default.createElement(J.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update',group:'Compliance',can:oe,badge:'NEW',C:function(){return W.default.createElement(K.FoodSafetyCard,null)}}]),(0,h.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',badge:'NEW',C:function(){const{rid:e,role:t,me:s,today:r}=(0,X.useCtx)(6e4),o=(0,X.useSignedIn)();return W.default.createElement(Z.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs covers each night, shout-outs. Anonymous',group:'Team',can:oe,badge:'NEW',C:function(){const{rid:e,today:t}=(0,X.useCtx)(6e4);return W.default.createElement(Z.MoraleTrend,{rid:e,today:t})}}]),(0,h.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',badge:'NEW',C:function(){const{rid:e,me:t}=(0,X.useCtx)(6e4),s=(0,X.useSignedIn)();return W.default.createElement(ee.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,h.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:se,badge:'NEW',C:j.PrinterHelpPage}]),(0,h.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',badge:'NEW',C:function(){const{me:e,role:t}=(0,X.useCtx)(6e4),s=(0,X.useSignedIn)();return W.default.createElement(te.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}])},911,[833,912,806,913,854,870,979,914,917,920,902,1028,921,923,924,1029,925,1030,977,927,901,928,30,1031,1032,1009,985,903,961,929,930,894,884,904,931,1007,1033,988,905,932,964,906,933,1034,996,954,992,1035,1036]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LookBackResult=x,_e.LookBack=function(){const{rid:e,today:s}=(0,c.useCtx)(3e4),[k,j]=(0,o.useState)((0,l.addDays)(s,-1)),[y,v]=(0,o.useState)(k),[T,p]=(0,o.useState)(0),f=(0,n.useHistoricalBookingDay)(e,k,s,T),z=(0,u.validPastDate)(y,s);if(!f.allowed)return(0,b.jsx)(i.Card,{children:(0,b.jsx)(i.T,{size:20,children:"Sign in to the Managers app with manager or owner access to Look back."})});const _=e=>{j(e),v(e)};return(0,b.jsxs)(t.default,{style:{gap:14},testID:"look-back",children:[(0,b.jsx)(i.Card,{children:(0,b.jsxs)(t.default,{style:{gap:12},children:[(0,b.jsx)(i.T,{size:26,weight:"bold",colour:h.colours.gold,accessibilityRole:"header",children:"Look back"}),(0,b.jsx)(i.T,{size:18,children:"Find bookings for one exact past date. Read-only; nothing is sent or changed."}),(0,b.jsx)(i.Field,{label:"Past booking date (YYYY-MM-DD)",value:y,onChangeText:v,placeholder:"2025-11-05",accessibilityLabel:"Exact past booking date, year month day",autoCapitalize:"none",autoCorrect:!1,testID:"look-back-date"}),z?null:(0,b.jsx)(i.T,{size:18,children:"Enter a valid past date, including the four-digit year."}),(0,b.jsxs)(i.Row,{wrap:!0,gap:10,children:[(0,b.jsx)(i.Button,{label:"Show bookings",accessibilityLabel:`Look back at bookings for ${z?(0,u.historyDateLabel)(y):'a valid past date'}`,disabled:!z,onPress:()=>{_(y),p(T+1)}}),(0,b.jsx)(i.Button,{kind:"secondary",label:"Previous day",onPress:()=>_((0,l.addDays)(k,-1))}),(0,b.jsx)(i.Button,{kind:"secondary",label:"Next day",disabled:!(0,u.validPastDate)((0,l.addDays)(k,1),s),onPress:()=>_((0,l.addDays)(k,1))})]})]})}),f.data?(0,b.jsx)(x,{day:f.data}):(0,b.jsx)(i.Card,{children:(0,b.jsx)(i.T,{size:20,children:f.error||'Loading booking history\u2026'})})]})};var e,o=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},i=r(d[2]),l=r(d[3]),c=r(d[4]),n=r(d[5]),u=r(d[6]),h=r(d[7]),b=r(d[8]);function x({day:e}){return(0,b.jsxs)(t.default,{testID:"look-back-result",style:{gap:14},children:[(0,b.jsx)(i.Card,{children:(0,b.jsxs)(t.default,{style:{gap:10},children:[(0,b.jsx)(i.T,{size:24,weight:"bold",colour:h.colours.gold,accessibilityRole:"header",children:(0,u.historyDateLabel)(e.date)}),(0,b.jsxs)(t.default,{accessible:!0,accessibilityLabel:`Booked covers: ${null===e.booked_covers?'not recorded':e.booked_covers}`,children:[(0,b.jsx)(i.T,{size:20,children:"Booked covers"}),(0,b.jsx)(i.T,{size:36,weight:"bold",colour:h.colours.gold,children:null===e.booked_covers?'Not recorded':e.booked_covers})]}),e.historical_records?(0,b.jsx)(i.T,{size:20,colour:h.colours.gold,weight:"semibold",children:u.HISTORY_LABEL}):null,(0,b.jsx)(i.T,{size:18,children:u.HISTORY_NOTE}),e.missing_covers?(0,b.jsxs)(i.T,{size:18,children:[e.missing_covers," booking records have no party size; not filled in."]}):null]})}),e.bookings.length?null:(0,b.jsx)(i.Card,{children:(0,b.jsx)(i.T,{size:20,children:"No booking records found for this date. The history is incomplete; this does not prove there were no bookings."})}),e.bookings.map((e,o)=>(0,b.jsx)(i.Card,{children:(0,b.jsxs)(t.default,{testID:"look-back-booking",style:{gap:8},accessible:!0,accessibilityLabel:`${e.time??'Time not recorded'}, party size ${null===e.covers?'not recorded':`${e.covers} Covers`}, ${e.table?`table ${e.table}`:'table not recorded'}, ${e.status??'status not recorded'}${e.counted?'':', excluded from Booked covers'}`,children:[(0,b.jsxs)(i.Row,{wrap:!0,gap:20,children:[(0,b.jsx)(i.T,{size:26,weight:"bold",colour:h.colours.gold,children:e.time??'Time not recorded'}),(0,b.jsxs)(i.T,{size:22,children:["Party size: ",null===e.covers?'Not recorded':`${e.covers} Covers`]})]}),(0,b.jsxs)(i.T,{size:20,children:["Table: ",e.table??'Not recorded']}),(0,b.jsxs)(i.T,{size:18,children:[e.status??'Status not recorded',e.counted?'':' \xb7 excluded from Booked covers']}),(0,b.jsxs)(i.T,{size:18,colour:h.colours.muted,children:['favourite_table'===e.source?'previous booking system':'CoverCharge'," \xb7 ",e.ref]})]})},`${e.source}:${e.ref}:${o}`))]})}},912,[30,127,813,1037,954,1038,1039,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.ServiceBoard=function(){const{role:e}=(0,h.useCtx)(3e4),[p,f]=(0,s.useState)(!0);return c.CAN.manage(e)?(0,y.jsxs)(o.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,y.jsx)(l.T,{size:18,weight:"semibold",colour:b.colours.goldLight,children:"The same live board as the Display"}),(0,y.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,y.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),(0,y.jsx)(t.default,{visible:p,animationType:"none",presentationStyle:"fullScreen",onRequestClose:()=>f(!1),children:(0,y.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:b.colours.bg},edges:['top','bottom','left','right'],children:[(0,y.jsx)(o.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:b.colours.gold},children:(0,y.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:()=>f(!1),style:{minHeight:48}})}),p?(0,y.jsx)(u.DisplayBoard,{embedded:!0}):null]})})]}):(0,y.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."})};var s=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),b=r(d[7]),h=r(d[8]),y=r(d[9])},913,[30,256,127,289,813,877,854,821,954,24]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,h.useHourly)(),l=!!(0,h.useSignedIn)(),{role:f,meId:w,rid:x}=(0,h.useCtx)(6e4),j=(0,h.useSignedIn)(),D=(0,c.useOwner)(e=>e.staff),L=(0,c.useOwner)(e=>e.previewRole),[O,B]=(0,n.useState)(''),[P,_]=(0,n.useState)(''),[z,H]=(0,n.useState)('staff'),[E,N]=(0,n.useState)({}),Y=c.CAN.staffAdmin(f),[F,G]=(0,n.useState)(null),[U,J]=(0,n.useState)(''),[W,K]=(0,n.useState)({});return(0,k.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,k.jsx)(r.default,{testID:"access-tip",children:(0,k.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,k.jsx)(r.default,{testID:"cashup-access-tip",children:(0,k.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, take a picture of the taking sheet and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,k.jsx)(r.default,{testID:"temp-access-tip",children:(0,k.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,k.jsx)(R,{ask:F,onClose:()=>G(null)}),(0,k.jsx)(I,{}),(0,k.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,k.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,k.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,h.clampRole)(e,j.role)===e).map(e=>(0,k.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:L===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,k.jsx)(i.Muted,{children:$[L]})]}),'owner'===f||'manager'===f?(0,k.jsx)(v.AddTempStaffButton,{}):null,(0,k.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:U,onChangeText:J,placeholder:"Search by name, nickname or job",placeholderTextColor:u.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:u.colours.hairline,backgroundColor:u.colours.surface2,color:u.colours.text,paddingHorizontal:10,fontSize:15}}),D.filter(e=>(0,c.staffMatches)(e,U)).map(n=>(0,k.jsxs)(i.Card,{style:{opacity:n.active?1:.5},children:[(0,k.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,k.jsx)(p.StaffAvatar,{id:n.id,size:44}):(0,k.jsx)(t.StaffLinkChip,{m:n,actorRole:j.role,size:36}),(0,k.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(n)})]}),(0,k.jsx)(i.Badge,{kind:'owner'===n.role?'gold':'manager'===n.role?'blue':'neutral',label:n.level??c.ROLE_LABEL[n.role]})]}),(0,k.jsx)(C,{id:n.id}),!j||'owner'!==f&&'manager'!==f?null:(0,k.jsx)(i.Row,{gap:6,children:(0,k.jsx)(S.CashUpAccessBadge,{m:n})}),(0,k.jsxs)(i.Muted,{children:[n.job,n.dept?` \xb7 ${n.dept}`:'',n.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,k.jsxs)(r.default,{style:{gap:4},children:[(0,k.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${n.id}`,label:E[n.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>N(e=>({...e,[n.id]:!e[n.id]}))}),E[n.id]?(0,k.jsxs)(i.Muted,{children:[(0,c.wageLabel)(n,e[n.id],o.gbp),n.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||n.managerAccess||n.ownerAccess?null:(0,k.jsx)(T,{person:n,actor:j,onAsk:G}),!j||'owner'!==j.role||j.ownerAccess||'owner'===n.role&&!n.ownerAccess?null:(0,k.jsx)(M,{person:n,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===n.role||!n.managerAccess&&'staff'!==n.role?null:(0,k.jsx)(A,{person:n,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,k.jsx)(b.InviteLinkControls,{m:n,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,k.jsxs)(i.Row,{gap:6,children:[(0,k.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,k.jsx)(s.TextInput,{testID:`nickname-${n.id}`,accessibilityLabel:`Nickname for ${n.name}`,value:W[n.id]??n.nickname??'',placeholder:"Optional",placeholderTextColor:u.colours.muted,onChangeText:e=>K(s=>({...s,[n.id]:e})),onBlur:()=>{const e=(W[n.id]??n.nickname??'').trim().slice(0,40);e!==(n.nickname??'')&&c.useOwner.getState().updateStaff(n.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:u.colours.hairline,color:u.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f||!n.active||n.name.includes('(example)')?null:(0,k.jsx)(S.CashUpAccessToggle,{m:n}),'owner'!==f&&'manager'!==f||!n.active||n.name.includes('(example)')?null:(0,k.jsx)(v.StaffDisplayControls,{m:n}),j&&('owner'===f||'manager'===f)&&n.active?(0,k.jsx)(y.DailyTasksEditor,{rid:x,person:n,actor:j}):null,Y&&n.id!==w&&'owner'!==n.role?(0,k.jsx)(i.Row,{wrap:!0,gap:6,children:(0,k.jsx)(i.Chip,{label:n.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(n.id,{active:!n.active})})}):null]},n.id)),Y?(0,k.jsxs)(i.Card,{children:[(0,k.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,k.jsx)(i.Field,{label:"Name",value:O,onChangeText:B}),(0,k.jsx)(i.Field,{label:"Job title",value:P,onChangeText:_,placeholder:"e.g. Kitchen porter"}),(0,k.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,k.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:z===e,onPress:()=>H(e)},e))}),(0,k.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:O.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(O.trim(),z,P.trim()||'Team member'),B(''),_('')}})]}):(0,k.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),S=_r(d[17]),k=_r(d[18]);const $={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function C({id:e}){const{role:s,meId:t,me:n}=(0,h.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,k.jsxs)(i.Row,{gap:8,children:[(0,k.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,k.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:t,role:s,name:n.replace(' (example)','')})})]}):null}function T({person:e,actor:s,onAsk:t}){const n=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,k.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,k.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!n.ok,onChange:s=>t({id:e.id,on:s})}),(0,k.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',n.ok||'owner'===e.role?'':` \xb7 ${n.why}`]})]})}function A({person:e,actor:s}){const t=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,n.useState)(null),[u,h]=(0,n.useState)('temporary manager access'),[p,f]=(0,n.useState)(!1),[j,y]=(0,n.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,u);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,k.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,k.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!t.ok||p,onChange:e=>c(e)}),(0,k.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',t.ok?'':` \xb7 ${t.why}`]}),j?(0,k.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,k.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,k.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,k.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,k.jsx)(i.Field,{label:"Reason (kept in the log)",value:u,onChangeText:h}),(0,k.jsxs)(i.Row,{gap:8,children:[(0,k.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,k.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function M({person:e,actor:s}){const t='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,n.useState)(null),[u,h]=(0,n.useState)('temporary owner access'),[p,f]=(0,n.useState)(!1),[w,j]=(0,n.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,u);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,k.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,k.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!t.ok||p,onChange:e=>c(e)}),(0,k.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',t.ok?'':` \xb7 ${t.why}`]}),w?(0,k.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,k.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,k.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,k.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,k.jsx)(i.Field,{label:"Reason (kept in the log)",value:u,onChangeText:h}),(0,k.jsxs)(i.Row,{gap:8,children:[(0,k.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,k.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function R({ask:e,onClose:s}){const t=(0,c.useOwner)(e=>e.staff),[o,l]=(0,n.useState)(!1),r=e?t.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const u=(0,w.accessResult)(r,e.on),h=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const t=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!t.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:t.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:u.role,level:u.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${h} now has manager access`:`${h}\u2019s manager access is off`,body:`${h} now uses the ${u.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,k.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${h} manager access?`:`Switch off ${h}\u2019s manager access?`,testID:"access-confirm",children:[(0,k.jsx)(i.T,{children:e.on?`${h} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${h} will use the ${u.app}. They keep their job title (${r.job||'none'}).`}),(0,k.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,k.jsxs)(i.Row,{gap:8,children:[(0,k.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,k.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function I(){const[e,s]=(0,n.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,k.jsxs)(r.default,{style:{gap:4},children:[(0,k.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,k.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,k.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},914,[874,900,30,816,127,813,854,821,954,955,1040,915,820,1041,948,898,916,1042,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},915,[]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffDisplayControls=function({m:e}){const s=(0,p.usePinStatus)(t=>t[e.id]),[c,m]=(0,l.useState)(''),[h,y]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),b='owner'===e.role||'manager'===e.role?6:4,j=async()=>{S(!0);const t=await(0,p.setStaffPin)(e.id,c,b);S(!1),m(''),y(t.ok?`PIN ${s?.hasPin?'reset':'set'}. Tell ${e.name} in person; it isn\u2019t shown again.`:t.error??'Could not set the PIN.'),t.ok&&(0,p.refreshPinStatus)()};return(0,f.jsxs)(n.default,{testID:`display-controls-${e.id}`,style:{gap:6,paddingTop:4},children:[(0,f.jsx)(o.Toggle,{testID:`display-clock-${e.id}`,label:"Can clock in at the Display",value:!!e.displayClock,onChange:t=>u.useOwner.getState().updateStaff(e.id,{displayClock:t})}),e.displayClock?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Muted,{size:12,children:s?.locked?'PIN locked (5 wrong tries)':s?.hasPin?e.temp?'Code set':'PIN set':'No PIN yet'}),(0,f.jsx)(t.TextInput,{testID:`pin-input-${e.id}`,accessibilityLabel:`New PIN for ${e.name}`,value:c,onChangeText:e=>m(e.replace(/\D/g,'').slice(0,8)),placeholder:`${b}\u20138 digits`,placeholderTextColor:r.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",maxLength:8,style:{width:110,minHeight:34,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,f.jsx)(o.Button,{small:!0,kind:"secondary",testID:`set-pin-${e.id}`,label:s?.hasPin?'Reset PIN':'Set PIN',disabled:x||c.length{j()}})]}):null,h?(0,f.jsx)(o.Muted,{children:h}):null,e.temp?(0,f.jsxs)(o.Row,{gap:6,wrap:!0,children:[(0,f.jsx)(o.Badge,{kind:"gold",label:"Temp"}),(0,f.jsxs)(o.Muted,{size:12,children:[e.tempUntil?`Until ${e.tempUntil}`:'No end date'," \xb7 Display only, no phone app"]}),(0,f.jsx)(o.Button,{small:!0,kind:"ghost",testID:`make-full-${e.id}`,label:"Make full staff",onPress:()=>u.useOwner.getState().updateStaff(e.id,{temp:!1,tempUntil:void 0,job:'Temp'===e.job?'':e.job})})]}):null]})},_e.AddTempStaffButton=function({initialOpen:e}){const[t,s]=(0,l.useState)(!!e),[n,r]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),[y,x]=(0,l.useState)(null);(0,l.useEffect)(()=>{(0,p.refreshPinStatus)()},[]);const S=()=>{s(!1),x(null),h(null)},b=async e=>{r(!0);const t=await(0,p.addTempStaff)(e);r(!1),t.ok&&t.ref&&t.code?(u.useOwner.setState(l=>({staff:[...l.staff.filter(e=>e.id!==t.ref),{id:t.ref,name:t.name??e.name,role:'staff',job:'Temp',active:!0,level:'Staff',dept:e.dept??'',displayClock:!0,temp:!0,tempUntil:e.until??void 0}],hourly:null!=e.rate?{...l.hourly,[t.ref]:Math.round(100*e.rate)}:l.hourly})),x({name:t.name??e.name,code:t.code})):h(t.error??'Could not add them.')};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Button,{testID:"add-temp-btn",kind:"secondary",label:"Add temp staff",onPress:()=>s(!0)}),t?(0,f.jsx)(o.Sheet,{visible:!0,onClose:S,title:y?'Temp added':'Add temp staff',maxWidth:560,testID:"add-temp",children:y?(0,f.jsx)(c.TempCode,{name:y.name,code:y.code,onClose:S}):(0,f.jsx)(c.AddTempForm,{busy:n,error:m,onSubmit:e=>{b(e)}})}):null]})};var e,t=_r(d[0]),l=_r(d[1]),s=_r(d[2]),n=(e=s)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),u=_r(d[5]),p=_r(d[6]),c=_r(d[7]),f=_r(d[8])},916,[874,30,127,813,821,854,1043,1044,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PRICING_AVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return C}}),_e.PlanBilling=function(){const{now:e,role:i,rid:b}=(0,p.useCtx)(6e4),j=(0,c.trialStatus)((0,l.defaultSimStart)(),e),[x,_]=(0,s.useState)(!1);return u.CAN.billing(i)?x?(0,y.jsx)(L,{onBack:()=>_(!1)}):(0,y.jsxs)(n.default,{style:{gap:10},children:[(0,y.jsx)(o.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,y.jsx)(t.VoiceUsageCard,{rid:b,now:e}),(0,y.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,y.jsxs)(n.default,{testID:"plan-founding",children:[(0,y.jsx)(o.T,{size:12,weight:"semibold",colour:h.colours.goldMuted,children:"FOUNDING OFFER \xb7 FIRST 50 VENUES"}),(0,y.jsxs)(o.T,{size:30,weight:"bold",children:["\xa345",(0,y.jsx)(o.T,{size:14,colour:h.colours.muted,children:" a month + VAT if applicable, per venue"})]})]}),(0,y.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(o.Badge,{kind:"gold",label:"The whole package"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"One month free"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"\xa345 net locked in"})]}),(0,y.jsx)(o.Muted,{children:"\xa345 net stays locked in while your subscription stays active."}),(0,y.jsx)(o.Muted,{children:"From venue 51, usual prices:"}),(0,y.jsxs)(n.default,{testID:"plan-usual-lite",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[w," \xb7 ",P," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:k})]}),(0,y.jsxs)(n.default,{testID:"plan-usual-pro",style:{gap:2,marginTop:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:[A," \xb7 ",T," a month + VAT if applicable, per venue"]}),(0,y.jsx)(o.Muted,{children:C})]}),S.map(e=>(0,y.jsxs)(o.T,{size:13,children:["\u2713 ",e]},e)),(0,y.jsx)(o.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>_(!0),style:{marginTop:6}})]}),(0,y.jsx)(o.Card,{children:(0,y.jsxs)(n.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,y.jsxs)(o.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,y.jsx)(o.T,{weight:"bold",colour:h.colours.gold,children:"free"}),"."]}),(0,y.jsx)(o.Muted,{children:"Your own app would cost about \xa398 in store fees in the first year alone (Apple \xa378.99 a year in the UK, Google US$25 one-off), then \xa378.99 a year."})]})}),(0,y.jsx)(o.Muted,{children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, and subscribers get free lifetime 24/7 customer support. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{children:"Free trial"}),(0,y.jsxs)(o.T,{weight:"bold",colour:h.colours.gold,children:[j.daysLeft," day",1===j.daysLeft?'':'s'," left"]})]}),(0,y.jsx)(n.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(n.default,{style:{height:8,width:`${Math.round(100*(1-j.daysLeft/j.total))}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),(0,y.jsxs)(o.Muted,{children:["Then \xa3",c.PLAN.monthlyPence/100," a month + VAT if applicable. The trial start date is not set up yet."]})]}),(0,y.jsx)(f.AssistantPlanCard,{}),(0,y.jsxs)(o.Card,{children:[(0,y.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(o.T,{weight:"semibold",children:"Free lifetime customer support"}),(0,y.jsx)(o.Badge,{kind:"gold",label:"Included"})]}),(0,y.jsx)(o.Muted,{children:"Free for as long as you subscribe, day or night. Setup is all done digitally. Support contact details: not set up yet."})]})]}):(0,y.jsx)(o.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(d[0]),s=r(d[1]),i=r(d[2]),n=(e=i)&&e.__esModule?e:{default:e},o=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),p=r(d[8]),f=r(d[9]),y=r(d[10]);const b=!0,j='Founding offer, free trial, set-up guide',x=', \xa345 a month + VAT if applicable',w='Customer & Takeaway App',A='Full Restaurant Pro App',P='\xa349',T='\xa399',k='A lite version of CoverCharge: 3 core functions tailored to you, set up digitally with the in-app guided setup and step-by-step guides, free lifetime 24/7 customer support while subscribed, and unlimited self-edits of your basic info.',C='Every feature, every app, set up digitally with the in-app guided setup and step-by-step guides, the Assistant (fair use 300 tasks a month), free lifetime 24/7 customer support while subscribed, and unlimited self-edits.',S=['Every feature, every app','Set up digitally: in-app guided setup and step-by-step guides','The Assistant, fair use 300 tasks a month','Voice assistant (hold to talk): fair usage 1,000 voice tasks a month per venue','Free lifetime 24/7 customer support while you subscribe','Unlimited self-edits'],_=[['Choose your 3 core functions','Pick what matters most to you, for example menu & allergens, takeaway ordering or the stamp card.'],['Add your logo and colours','More \u203a Branding: upload your logo; the apps use it everywhere.'],['Check your opening hours','More \u203a Opening hours: set your normal week and any closed days.'],['Add your menu and allergens','Menu & allergens: add dishes, prices and the 14 allergens, then sign each dish off.'],['Invite your team','More \u203a Team: add staff so they can use CoverCharge for Staff.'],['Share the customer app','More \u203a Your apps: copy the link or show the QR code at the counter.'],['Try a test order','Place a test order in the customer app and watch it arrive.']];function L({onBack:e}){const[t,i]=(0,s.useState)([]);return(0,y.jsxs)(n.default,{style:{gap:10},testID:"setup-guide",children:[(0,y.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,y.jsx)(o.H2,{children:"Set-up guide"}),(0,y.jsxs)(o.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",t.length," of ",_.length," done."]}),(0,y.jsx)(n.default,{style:{height:8,backgroundColor:h.colours.border,borderRadius:4},children:(0,y.jsx)(n.default,{style:{height:8,width:`${Math.round(t.length/_.length*100)}%`,backgroundColor:h.colours.gold,borderRadius:4}})}),_.map(([e,s],l)=>{const u=t.includes(l);return(0,y.jsx)(o.Card,{children:(0,y.jsxs)(o.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,y.jsx)(n.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:u?h.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(o.T,{size:14,weight:"bold",colour:u?'#1a1610':h.colours.gold,children:u?'\u2713':String(l+1)})}),(0,y.jsxs)(n.default,{style:{flex:1,gap:4},children:[(0,y.jsx)(o.T,{weight:"semibold",children:e}),(0,y.jsx)(o.Muted,{children:s}),(0,y.jsx)(o.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>i(u?t.filter(e=>e!==l):[...t,l])})]})]})},e)}),(0,y.jsx)(o.Muted,{children:"Stuck? Free lifetime customer support is included while you subscribe. Ticks on this guide are not saved."})]})}},917,[918,30,127,813,1045,854,919,821,954,961,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VoiceUsageCard=function({rid:e,now:o}){const h=(0,l.useVoiceUsage)(e,o);return(0,c.jsx)(s.Card,{children:(0,c.jsxs)(n.default,{testID:"voice-usage",style:{gap:6},children:[(0,c.jsx)(s.T,{weight:"semibold",children:h.line}),(0,c.jsx)(n.default,{style:{height:8,borderRadius:4,backgroundColor:t.colours.surface2,overflow:'hidden'},children:(0,c.jsx)(n.default,{style:{width:`${Math.min(100,Math.round(100*h.pct))}%`,height:8,backgroundColor:h.reached?t.colours.red:h.warn?t.colours.amber:t.colours.ok}})}),(0,c.jsxs)(s.Muted,{children:[l.VOICE_FAIR_USAGE,", shared by all of this venue\u2019s apps and devices. Food safety logging always works."]}),h.reached?(0,c.jsx)(s.Banner,{kind:"info",title:"Allowance reached for this month",children:l.REACHED_TEXT}):h.warn?(0,c.jsx)(s.Banner,{kind:"warn",title:"80% of this month\u2019s allowance used",children:"The voice helper keeps working until 1,000; it starts again on the 1st."}):null,(0,c.jsx)(s.Muted,{children:"For now the count is kept on each device; it will become one venue-wide count."})]})})},r(d[0]);var e,o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),l=r(d[4]),c=r(d[5])},918,[30,127,813,821,1046,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PLAN",{enumerable:!0,get:function(){return t}}),e.trialStatus=function(n,o){const l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),u=new Date(l.getFullYear(),l.getMonth()+t.trialMonths,l.getDate()),c=Math.max(0,Math.ceil((u.getTime()-o.getTime())/864e5));return{start:l,end:u,daysLeft:c,total:Math.round((u.getTime()-l.getTime())/864e5)}};const t={name:'CoverCharge',monthlyPence:4500,trialMonths:1,vatNote:'+ VAT if applicable'}},919,[]); +__d(function(_g,_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.InfoHours=function(){const{r:e}=(0,w.useCtx)(6e4),[t,s]=(0,d.useState)(e.tagline),[n,i]=(0,d.useState)(e.phone??''),[a,r]=(0,d.useState)(e.about??''),[o,h]=(0,d.useState)(e.kitchenHours),[g,x]=(0,d.useState)(!1);return(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"info",title:"Edit basic info yourself anytime",children:"Prices, sold-out, hours and specials are free to change on any plan, as often as you like."}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.location}),(0,T.jsx)(p.Field,{label:"Tagline",value:t,onChangeText:s}),(0,T.jsx)(p.Field,{label:"Phone",value:n,onChangeText:i,keyboardType:"phone-pad"}),(0,T.jsx)(p.Field,{label:"About",value:a,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Kitchen hours"}),k.map((e,t)=>{const s=P[t],n=o[s];return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{style:{width:44},children:e}),n?(0,T.jsxs)(p.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>h({...o,[s]:[e,n[1]]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,T.jsx)(p.T,{children:"\u2013"}),(0,T.jsx)(l.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>h({...o,[s]:[n[0],e]}),style:[p.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,T.jsx)(p.Muted,{style:{flex:1},children:"Closed"}),(0,T.jsx)(c.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>h({...o,[s]:e?['12:00','20:00']:null}),trackColor:{true:b.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:b.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,T.jsx)(p.Muted,{children:e.hoursNote}):null]}),(0,T.jsx)(p.Button,{label:"Save changes",onPress:()=>{R().updateRestaurant(e.id,{tagline:t,phone:n,about:a,kitchenHours:o}),x(!0)}}),g?(0,T.jsx)(p.Banner,{kind:"success",title:"Saved",children:"Shared with your other devices and the customer app. Guests see it next time they open the app."}):null]})},_e.Photos=function(){const e=(0,x.useOwner)(e=>e.photos),[t,s]=(0,d.useState)('');return i.LIVE_VENUE_BUILD?(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,T.jsx)(p.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,T.jsxs)(u.default,{style:{gap:12},children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Placeholder photos",children:"Adding photos from the camera or gallery isn\u2019t set up yet. Tiles stand in for uploaded photos."}),(0,T.jsx)(p.Row,{wrap:!0,gap:8,children:e.map(e=>(0,T.jsxs)(u.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,T.jsx)(p.T,{size:13,children:e.caption}),(0,T.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>x.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,T.jsx)(p.T,{size:13,colour:b.colours.gold,children:"Remove"})})]},e.id))}),(0,T.jsx)(p.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,T.jsx)(p.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{x.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:n,role:l}=(0,w.useCtx)(6e4),a=(0,g.useAllMenu)(t),[r,c]=(0,d.useState)(null),[h,x]=(0,d.useState)(!1),[f,m]=(0,d.useState)(5),[C,v]=(0,d.useState)([]),[k,P]=(0,d.useState)('all'),B=(0,g.useStore)(e=>e.menu),O=e=>!!B.find(t=>t.id===e)?.hidden,$=a.filter(e=>!e.signOff&&!O(e.id)).length;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Button,{small:!0,label:"Add dish",onPress:()=>c('new')}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{x(!h),v([])}}),!e||'owner'!==l&&'manager'!==l?null:(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),$?(0,T.jsx)(o.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,T.jsx)(p.Banner,{kind:"warn",title:`${$} dish${1===$?'':'es'} awaiting the head chef's sign-off`,children:"Allergens, section and price come from each dish\u2019s recipe card. The head chef signs cards off in the Head Chef app. Tap to open Recipe cards."})}):null,h?(0,T.jsx)(p.Banner,{kind:"warn",title:"Price changes reset sign-off",children:"Each dish\u2019s price is on its recipe card, so a price change sets that card back to \u201cAwaiting sign-off\u201d until the head chef signs it off."}):null,i.LIVE_VENUE_BUILD?(0,T.jsx)(p.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Scheduled menus"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:"All day",selected:'all'===k,onPress:()=>P('all')}),(0,T.jsx)(p.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>P('lunch')}),(0,T.jsx)(p.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>P('dinner')})]}),(0,T.jsx)(p.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,T.jsxs)(p.Card,{highlight:b.colours.gold,children:[(0,T.jsxs)(p.T,{weight:"semibold",children:["Bulk price edit \xb7 ",C.length," selected"]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Change by %"}),(0,T.jsx)(p.Stepper,{value:f,onChange:m,min:-30,max:30,label:"percent"})]}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>v(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,T.jsx)(p.Button,{small:!0,label:`Apply ${f>0?'+':''}${f}%`,disabled:!C.length||0===f,onPress:()=>{C.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&R().updateMenuItem(e,{price:5*Math.round(t.price*(100+f)/100/5)})}),v([])}})]}),(0,T.jsx)(p.Muted,{children:"Prices round to the nearest 5p."})]}):null,s.sections.map(e=>{const t=a.filter(t=>t.section===e&&('all'===k||'lunch'!==k||!/supper|steak|lobster/i.test(t.name)));return t.length?(0,T.jsxs)(u.default,{style:{gap:6},children:[(0,T.jsx)(y.SectionHead,{title:e}),t.map(e=>(0,T.jsxs)(u.default,{style:[p.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,T.jsx)(p.Toggle,{label:`select ${e.name}`,value:C.includes(e.id),onChange:t=>v(t?[...C,e.id]:C.filter(t=>t!==e.id))}):null,(0,T.jsxs)(o.default,{style:{flex:1},onPress:()=>c(e),accessibilityRole:"button",children:[(0,T.jsx)(p.T,{weight:"medium",children:e.name}),(0,T.jsxs)(p.Muted,{children:[null!=e.price?(0,j.gbp)(e.price):e.priceNote??'Board price'," \xb7 ",Object.keys(e.allergens).length," allergens \xb7 ",e.signOff?`signed off by ${e.signOff.by}, ${e.signOff.at}`:'awaiting sign-off']})]})]}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(p.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>(R().updateMenuItem(e.id,{soldOut:!e.soldOut}),(0,S.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,T.jsx)(p.Chip,{label:O(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:O(e.id),onPress:()=>R().updateMenuItem(e.id,{hidden:!O(e.id)})})]})]},e.id))]},e):null}),r?(0,T.jsx)(M,{item:'new'===r?null:r,onClose:()=>c(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:s}=(0,w.useCtx)(6e4),n=(0,g.useEvents)(t).filter(e=>e.restaurantId===t),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[h,x]=(0,d.useState)(null),f=(()=>{const e=a.trim(),t=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{4})$/.exec(e);if(t){const e=Number(t[1]),s=Number(t[2]);return e>=1&&e<=31&&s>=1&&s<=12?`${t[3]}-${String(s).padStart(2,'0')}-${String(e).padStart(2,'0')}`:''}return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:''})(),j=l.trim().length>2&&!!f&&!Number.isNaN((0,m.parseYmd)(f).getTime());return(0,T.jsxs)(u.default,{style:{gap:10},children:[n.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:t.date=s?(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{g.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),x(null)}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>x(null)})]}):(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>x(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Add an event"}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i,placeholder:"e.g. Seafood night"}),(0,T.jsx)(p.Field,{label:"Date (DD/MM/YYYY)",value:a,onChangeText:r,placeholder:"20/11/2026"}),(0,T.jsx)(p.Field,{label:"Description",value:o,onChangeText:c,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add event",disabled:!j,onPress:()=>{R().addEvent({restaurantId:t,date:f,title:l.trim(),kind:'event',description:o.trim(),example:!1}),i(''),r(''),c('')}}),(0,T.jsx)(p.Muted,{children:"Events show in the customer app\u2019s What\u2019s on and on its booking dates, and feed the forecast."})]})]})},_e.GiftCardsPage=function(){const{rid:e}=(0,w.useCtx)(6e4),n=(0,g.useStore)((0,h.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[l,i]=(0,d.useState)(25),[a,r]=(0,d.useState)(''),o=n.reduce((e,t)=>e+t.initial,0),c=n.reduce((e,t)=>e+t.balance,0);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Sold (all time)"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(o)})]}),(0,T.jsxs)(p.Card,{style:{flex:1},children:[(0,T.jsx)(p.Muted,{children:"Outstanding balance"}),(0,T.jsx)(p.T,{size:20,weight:"bold",children:(0,j.gbp)(c)})]})]}),n.map(e=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,T.jsx)(p.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,T.jsxs)(p.Muted,{children:[e.code," \xb7 ",(0,j.gbp)(e.balance)," of ",(0,j.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,T.jsx)(p.Chip,{label:`\xa3${e}`,selected:l===e,onPress:()=>i(e)},e))}),(0,T.jsx)(p.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,T.jsx)(s.GreensideCashOnly,{}):(0,T.jsx)(p.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,T.jsx)(p.Button,{label:`Issue \xa3${l} card`,disabled:a.trim().length<2,onPress:()=>{R().buyGiftCard(e,100*l,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,w.useCtx)(6e4),t=(0,g.useRatings)(e),[s,n]=(0,d.useState)('all'),l=t.filter(e=>'all'===s||e.stars<=3).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),i=t.length?t.reduce((e,t)=>e+t.stars,0)/t.length:0;return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,T.jsxs)(p.Row,{gap:4,children:[(0,T.jsx)(p.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,T.jsx)(p.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,T.jsx)(p.Banner,{kind:"danger",title:"Low-rating alert",children:`${t.filter(e=>e.stars<=2).length} rating(s) at 2\u2605 or below. Reply within 24 hours.`}):null,l.map(e=>(0,T.jsxs)(p.Card,{highlight:e.stars<=2?b.colours.red:void 0,children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.customerName}),(0,T.jsxs)(p.T,{colour:b.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,T.jsx)(p.T,{size:14,children:e.comment||'(no comment)'}),(0,T.jsx)(p.Muted,{children:e.context??''})]},e.id)),(0,T.jsx)(p.Banner,{kind:"info",title:"No review gating",children:"After private feedback, every customer (whatever their rating) is shown the link to leave a public Google review. Low ratings alert you here so you can put it right."}),(0,T.jsx)(p.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return y.DemoTag}}),_e.StampSettings=function(){return i.LIVE_VENUE_BUILD||(0,a.staffServer)()?(0,T.jsx)(r.LoyaltySettingsPanel,{}):(0,T.jsx)(O,{})},_e.Offers=function({go:e}){return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,a.staffServer)()?(0,T.jsx)(p.Banner,{kind:"info",title:"Stamp card offers are in Settings \u203a Advanced \u203a Loyalty",children:"Offers there are saved on the server and shown on every guest\u2019s stamp card. Specials below stay as they were."}):null,(0,T.jsx)(B,{go:e})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),l=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),o=e(_r(_d[8])),c=e(_r(_d[9])),u=e(_r(_d[10])),h=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),m=_r(_d[17]),b=_r(_d[18]),y=_r(_d[19]),w=_r(_d[20]),S=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]);const k=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],P=[1,2,3,4,5,6,0],R=()=>g.useStore.getState();function M({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,w.useCtx)(6e4),[i,a]=(0,d.useState)(e?.name??''),[r,o]=(0,d.useState)(e?.description??''),[c,u]=(0,d.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,g]=(0,d.useState)(e?.section??l.sections[0]??'Mains'),[x,j]=(0,d.useState)(e?.prepMins??0),m=''===c.trim()?null:Math.round(100*Number(c)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},S=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,T.jsx)(p.Field,{label:"Name",value:i,onChangeText:a}),(0,T.jsx)(p.Field,{label:"Description",value:r,onChangeText:o,multiline:!0}),(0,T.jsx)(p.Field,{label:"Price \xa3 (blank = board price)",value:c,onChangeText:u,keyboardType:"decimal-pad"}),(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,T.jsx)(p.Chip,{label:e,selected:h===e,onPress:()=>g(e)},e))}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Prep time (min)"}),(0,T.jsx)(p.Stepper,{value:x,onChange:j,min:1,max:60,label:"prep minutes"})]}),(0,T.jsx)(p.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,T.jsxs)(p.Row,{wrap:!0,gap:6,children:[f.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,T.jsx)(p.Badge,{label:'may'===y[e.id]?`May contain ${e.short.toLowerCase()}`:e.short,kind:'may'===y[e.id]?'amber':'red'},e.id)),e&&!Object.keys(y).length?(0,T.jsx)(p.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,T.jsx)(p.Muted,{children:e?e.signOff?`Signed off by ${e.signOff.by} on ${e.signOff.at}.`:'Awaiting sign-off by the head chef.':'Saving adds the dish and its recipe card. Add the ingredients and allergens on the card; the dish stays off the menu until the head chef signs it off.'}),s?(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,S&&e?.signOff?(0,T.jsx)(p.Banner,{kind:"warn",title:"Sign-off resets",children:"Name, price and section live on the recipe card. Changing them sets the card back to \u201cAwaiting sign-off\u201d until the head chef signs it off again."}):null,(0,T.jsx)(p.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?R().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:x}):R().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:x,soldOut:!1,signOff:null}),t()}})]})}function B({go:e}){const{now:t}=(0,w.useCtx)(6e4),s=(0,x.useOwner)(e=>e.offers),[l,i]=(0,d.useState)(''),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)('special'),[h,g]=(0,d.useState)(null);return(0,T.jsxs)(u.default,{style:{gap:10},children:[s.map(t=>(0,T.jsxs)(p.Card,{children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,T.jsx)(p.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,T.jsxs)(p.Muted,{children:[t.body,t.until?` \xb7 until ${(0,m.niceDate)((0,m.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,T.jsx)(p.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Toggle,{label:"Live in app",value:t.live,onChange:e=>x.useOwner.getState().updateOffer(t.id,{live:e})}),(0,T.jsx)(p.Muted,{children:t.live?'Live in app':'Hidden'}),(0,T.jsx)(u.default,{style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>g(t.id)})]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,C.shareToSocial)(e,(0,C.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"New special or offer"}),(0,T.jsxs)(p.Row,{gap:6,children:[(0,T.jsx)(p.Chip,{label:"Special",selected:'special'===o,onPress:()=>c('special')}),(0,T.jsx)(p.Chip,{label:"Offer",selected:'offer'===o,onPress:()=>c('offer')})]}),(0,T.jsx)(p.Field,{label:"Title",value:l,onChangeText:i}),(0,T.jsx)(p.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,T.jsx)(p.Button,{label:"Add",disabled:l.trim().length<3,onPress:()=>{x.useOwner.getState().addOffer({title:l.trim(),body:a.trim(),kind:o,live:!0}),i(''),r('')}})]}),h?(()=>{const e=s.find(e=>e.id===h);return(0,T.jsxs)(p.Sheet,{visible:!0,onClose:()=>g(null),title:"Push notification composer",children:[(0,T.jsx)(p.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,T.jsxs)(u.default,{style:{backgroundColor:(0,n.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,T.jsx)(p.Muted,{children:"CoverCharge \xb7 now"}),(0,T.jsx)(p.T,{weight:"semibold",children:e.title}),(0,T.jsx)(p.T,{size:14,children:e.body})]}),(0,T.jsxs)(p.Muted,{children:["Audience: customers who opted in to ",(0,v.venueInfo)().name," offers. No audience count is available."]}),(0,T.jsx)(p.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{x.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,m.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),g(null)}})]})})():null]})}function O(){const{r:e}=(0,w.useCtx)(6e4),t=e.settings,[s,n]=(0,d.useState)(t.stampReward);return(0,T.jsxs)(u.default,{style:{gap:10},children:[(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.T,{weight:"semibold",children:"Stamp card"}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Stamps for a reward"}),(0,T.jsx)(p.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>R().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{children:"Minimum spend"}),(0,T.jsx)(p.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>R().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,T.jsxs)(p.Muted,{children:[(0,j.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,T.jsx)(p.Field,{label:"Reward",value:s,onChangeText:n}),(0,T.jsx)(p.Button,{small:!0,label:"Save reward",onPress:()=>R().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,T.jsxs)(p.Card,{children:[(0,T.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,T.jsx)(u.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:b.colours.gold,backgroundColor:t<3?b.colours.gold:'transparent'}},t))}),(0,T.jsxs)(p.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},920,[5,991,878,874,833,836,891,30,263,271,127,871,813,819,854,814,816,818,821,953,954,960,985,1010,24]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BrandingSettings=function(){const{rid:e,r:t}=(0,h.useCtx)(6e4),p=(0,l.useBrand)(e),x=(0,c.useOwner)(e=>e.setBranding),[j,f]=(0,r.useState)(''),y=(0,c.useOwner)(o=>o.branding[e]?.recent)??[],[w,C]=(0,r.useState)(p.accent);(0,r.useEffect)(()=>{C(p.accent)},[p.accent]);const v=(0,r.useMemo)(()=>(0,a.checkAccent)(w,u.colours.bg,u.colours.onGold,u.colours.text),[w]);return(0,b.jsxs)(n.default,{style:{gap:10},children:[(0,b.jsx)(d.Muted,{children:"Your logo, name and accent colour lead every CoverCharge app: Managers, Staff, Display, Head Chef and the customer app. A small \u201cpowered by CoverCharge\u201d stays at the top left."}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Customer header preview"}),(0,b.jsxs)(n.default,{testID:"branding-preview",style:{backgroundColor:u.colours.bg,borderRadius:12,borderWidth:1,borderColor:u.colours.border,padding:12,gap:4},children:[(0,b.jsx)(l.PoweredBy,{}),(0,b.jsxs)(d.Row,{gap:10,children:[(0,b.jsx)(l.RestaurantLogo,{rid:e,size:52}),(0,b.jsxs)(n.default,{style:{flex:1},children:[(0,b.jsx)(d.T,{weight:"semibold",size:18,children:t.name}),(0,b.jsx)(d.T,{size:12,colour:v.accentText,children:t.location})]})]}),(0,b.jsx)(n.default,{testID:"branding-preview-button",style:{marginTop:8,backgroundColor:w,borderRadius:10,paddingVertical:10,alignItems:'center'},children:(0,b.jsx)(d.T,{weight:"semibold",colour:v.onAccent,children:"Book a table"})})]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Logo"}),(0,b.jsxs)(d.Muted,{children:[p.custom?'Your uploaded logo.':'anchorage'===e?'Built in: The Anchorage logo in black and gold.':l.BUILTIN_LOGOS[e]?`Built in: ${t.name} logo.`:'Built in: placeholder initials for this demo venue.'," Square images work best."]}),(0,b.jsxs)(d.Row,{gap:8,wrap:!0,children:[(0,b.jsx)(d.Button,{label:"Upload a logo",onPress:async()=>{const r=await o.launchImageLibraryAsync({mediaTypes:['images'],allowsEditing:!0,aspect:[1,1],quality:.7,base64:!0});if(r.canceled||!r.assets?.[0])return;const t=r.assets[0],n=t.base64?`data:${t.mimeType??'image/png'};base64,${t.base64}`:t.uri;x(e,{logoUri:n}),f('Logo updated in all apps on this device.')},testID:"branding-upload"}),p.custom?(0,b.jsx)(d.Button,{kind:"secondary",label:"Use the built-in logo",onPress:()=>{x(e,{logoUri:void 0}),f('Back to the built-in logo.')}}):null]})]}),(0,b.jsxs)(d.Card,{children:[(0,b.jsx)(d.T,{weight:"semibold",children:"Accent colour"}),(0,b.jsx)(d.Muted,{children:"Any colour you like for your own brand. The preview above changes as you drag."}),(0,b.jsx)(s.ColourPicker,{value:w,onChange:C,onCommit:o=>{o===p.accent&&y[0]===o||(x(e,{accent:o,recent:(0,a.pushRecent)(y,o)}),f(`Accent set to ${o}.`))},quick:l.ACCENTS,recent:y}),v.tips.length?(0,b.jsx)(n.default,{testID:"accent-tip",style:{borderWidth:1,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg,borderRadius:10,padding:10,gap:4},children:v.tips.map(e=>(0,b.jsx)(d.T,{size:13,colour:u.colours.amber,children:e},e))}):null,(0,b.jsx)(d.Muted,{children:"Used for the restaurant line in headers, the logo ring and main buttons. Text on it is picked to stay readable."})]}),j?(0,b.jsx)(d.Banner,{kind:"success",title:"Saved",children:j}):null,(0,b.jsx)(d.Button,{kind:"ghost",label:"Restore default branding",onPress:()=>{x(e,null),f('Default branding restored.')}}),(0,b.jsx)(d.Muted,{children:"Saved the same way as your logo: on this device, shared by all the apps on it. Nothing is uploaded."})]})};var e,o=(function(e){if(e&&e.__esModule)return e;var o={};return e&&Object.keys(e).forEach(function(r){if('default'!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),o.default=e,o})(_r(_d[0])),r=_r(_d[1]),t=_r(_d[2]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[3]),a=_r(_d[4]),l=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),b=_r(_d[10])},921,[1006,30,127,922,1047,860,813,854,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}),_e.ColourPicker=function({value:e,onChange:p,onCommit:v,quick:y,recent:w}){const[R,C]=(0,t.useState)(()=>(0,c.hexToHsv)(e)),[H,T]=(0,t.useState)(e),[S,M]=(0,t.useState)(!1),F=(0,t.useRef)(e);(0,t.useEffect)(()=>{(0,c.normaliseHex)(e)!==(0,c.normaliseHex)(F.current)&&(F.current=e,C((0,c.hexToHsv)(e)),T(e))},[e]);const k=e=>{C(e);const o=(0,c.hsvToHex)(e);F.current=o,T(o),M(!1),p(o)},D=(0,t.useMemo)(()=>(0,c.hsvToHex)({h:R.h,s:R.s,v:1}),[R.h,R.s]),E=(0,t.useMemo)(()=>f.map(e=>(0,c.hsvToHex)({h:e,s:1,v:1})),[]),I=e=>{const o=(0,c.normaliseHex)(e);o&&(F.current=o,C((0,c.hexToHsv)(o)),T(o),M(!1),p(o),v(o))},z=(o,t,n)=>(0,x.jsx)(s.default,{testID:`accent-${n}-${t}`,accessibilityRole:"button",accessibilityLabel:`Accent ${o}`,onPress:()=>I(o),hitSlop:4,style:{width:40,height:40,borderRadius:20,backgroundColor:o,borderWidth:3,borderColor:(0,c.normaliseHex)(e)===(0,c.normaliseHex)(o)?u.colours.text:u.colours.border}},n+o+t);return(0,x.jsxs)(n.default,{testID:"colour-picker",style:{gap:10},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Drag across for the colour, up and down for how strong it is"}),(0,x.jsxs)(b,{testID:"picker-area",label:"Colour and strength",height:170,onMove:(e,o)=>k({h:360*e,s:1-o,v:R.v}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 100",children:[(0,x.jsxs)(l.Defs,{children:[(0,x.jsx)(l.LinearGradient,{id:"cpHue",x1:"0",y1:"0",x2:"1",y2:"0",children:E.map((e,o)=>(0,x.jsx)(l.Stop,{offset:o/(E.length-1),stopColor:e},o))}),(0,x.jsxs)(l.LinearGradient,{id:"cpSat",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#FFFFFF",stopOpacity:0}),(0,x.jsx)(l.Stop,{offset:1,stopColor:"#FFFFFF",stopOpacity:1})]})]}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpHue)"}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"100",fill:"url(#cpSat)"})]}),(0,x.jsx)(j,{x:R.h/360*100+"%",y:100*(1-R.s)+"%",colour:D})]}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Brightness"}),(0,x.jsxs)(b,{testID:"picker-brightness",label:"Brightness",height:36,onMove:e=>k({...R,v:Math.max(.04,e)}),onEnd:()=>v(F.current),children:[(0,x.jsxs)(i.default,{width:"100%",height:"100%",preserveAspectRatio:"none",viewBox:"0 0 100 10",children:[(0,x.jsx)(l.Defs,{children:(0,x.jsxs)(l.LinearGradient,{id:"cpVal",x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,x.jsx)(l.Stop,{offset:0,stopColor:"#000000"}),(0,x.jsx)(l.Stop,{offset:1,stopColor:D})]})}),(0,x.jsx)(l.Rect,{x:"0",y:"0",width:"100",height:"10",fill:"url(#cpVal)"})]}),(0,x.jsx)(j,{x:100*R.v+"%",y:"0%",colour:(0,c.hsvToHex)(R),round:!1})]}),(0,x.jsxs)(h.Row,{gap:10,style:{alignItems:'center'},children:[(0,x.jsx)(n.default,{testID:"picker-swatch",style:{width:46,height:46,borderRadius:10,backgroundColor:(0,c.normaliseHex)(H)??e,borderWidth:1,borderColor:u.colours.border}}),(0,x.jsxs)(n.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Hex code"}),(0,x.jsx)(o.TextInput,{testID:"picker-hex",value:H,autoCapitalize:"characters",autoCorrect:!1,maxLength:7,placeholder:"#CFA45F",placeholderTextColor:u.colours.muted,accessibilityLabel:"Hex code",onChangeText:e=>{T(e);const o=(0,c.normaliseHex)(e);M(!o&&e.replace('#','').length>=6),o&&6===e.replace('#','').length&&(F.current=o,C((0,c.hexToHsv)(o)),p(o))},onBlur:()=>{const e=(0,c.normaliseHex)(H);e?I(e):(T(F.current),M(!1))},onSubmitEditing:()=>{const e=(0,c.normaliseHex)(H);e?I(e):M(!0)},style:{minHeight:46,borderRadius:10,borderWidth:1,borderColor:S?u.colours.amber:u.colours.accentBorder,backgroundColor:u.colours.surface2,color:u.colours.text,paddingHorizontal:12,fontSize:16}})]})]}),S?(0,x.jsx)(h.T,{size:13,colour:u.colours.amber,children:"Use six letters or numbers after #, like #CFA45F."}):null,(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Quick picks"}),(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:y.map((e,o)=>z(e,o,'quick'))}),(0,x.jsx)(h.T,{size:13,colour:u.colours.muted,children:"Recent colours"}),w.length?(0,x.jsx)(h.Row,{wrap:!0,gap:10,children:w.map((e,o)=>z(e,o,'recent'))}):(0,x.jsx)(h.Muted,{children:"Colours you choose show here."})]})};var o=r(d[0]),t=r(d[1]);r(d[2]);var s=e(r(d[3])),n=e(r(d[4])),l=r(d[5]),i=e(l),c=r(d[6]),u=r(d[7]),h=r(d[8]),x=r(d[9]);const p={touchAction:'none',cursor:'crosshair',userSelect:'none'},f=[0,30,60,90,120,150,180,210,240,270,300,330,360];function b({height:e,onMove:o,onEnd:s,children:l,testID:i,label:c}){const h=(0,t.useRef)({w:1,h:e}),f=e=>{const{locationX:t,locationY:s}=e.nativeEvent;o(Math.min(1,Math.max(0,t/h.current.w)),Math.min(1,Math.max(0,s/h.current.h)))};return(0,x.jsx)(n.default,{testID:i,accessibilityLabel:c,onLayout:e=>{h.current={w:Math.max(1,e.nativeEvent.layout.width),h:Math.max(1,e.nativeEvent.layout.height)}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:f,onResponderMove:f,onResponderRelease:s,onResponderTerminate:s,style:[{height:e,borderRadius:10,overflow:'hidden',borderWidth:1,borderColor:u.colours.border},p],children:(0,x.jsx)(n.default,{pointerEvents:"none",style:{flex:1},children:l})})}const j=({x:e,y:o,colour:t,round:s=!0})=>(0,x.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:e,top:o,width:26,height:s?26:'100%',marginLeft:-13,marginTop:s?-13:0,borderRadius:s?13:6,borderWidth:3,borderColor:u.colours.text,backgroundColor:t,shadowColor:'#000',shadowOpacity:.6,shadowRadius:3}})},922,[874,30,122,263,127,1005,1047,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.RecipeCardsPage=function(){const{rid:s,role:c,me:f}=(0,n.useCtx)(),u='owner'===c?'owner':'manager'===c?'manager':'staff';return(0,o.jsx)(t.RecipeCards,{rid:s,actor:{name:f,role:u},mode:'staff'===u?'read':'edit'})},r(d[0]);var t=r(d[1]),n=r(d[2]),o=r(d[3])},923,[30,1048,954,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:c,role:s,me:u,meId:l,today:p}=(0,t.useCtx)(6e4),_='owner'===s||'manager'===s;return(0,o.jsx)(n.CashUpScreen,{rid:c,today:p,canEdit:_,who:{id:l??'me',name:u.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),t=r(d[2]),o=r(d[3])},924,[30,949,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.TrendLine=x,_e.SpendPerHeadPage=function(){const{rid:e,today:l}=(0,h.useCtx)(6e4),n=(0,a.useBookings)(e),y=(0,r.useCashUp)(e=>e.cashUps),[k,w]=(0,s.useState)('day'),b=(0,i.hasAnyTakings)(y,e),j=(0,i.dayRows)(y,n,e,l,14),f=(0,i.weekRows)(y,n,e,l,8),v=(0,i.averageSph)(j),$=(e,s,l,n,a)=>(0,c.jsxs)(t.default,{testID:`sph-row-${e}`,style:{flexDirection:'row',paddingVertical:6,borderTopWidth:1,borderTopColor:d.colours.hairline},accessible:!0,accessibilityLabel:`${s}: ${'No takings entered'===n?'no takings entered':`spend per head ${n}`}, ${l}${a?`, ${a}`:''}`,children:[(0,c.jsx)(o.T,{style:{flex:1.3},children:s}),(0,c.jsx)(o.T,{style:{flex:1},colour:d.colours.muted,children:l}),(0,c.jsx)(o.T,{style:{flex:1.2,textAlign:'right'},weight:"semibold",colour:'No takings entered'===n?d.colours.muted:d.colours.goldLight,size:'No takings entered'===n?13:16,children:n})]},e);return(0,c.jsxs)(t.default,{style:{gap:12},testID:"sph-screen",children:[(0,c.jsx)(o.Muted,{children:"Tip: spend per head is Gross takings \xf7 Covers. 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."}),(0,c.jsxs)(o.Card,{highlight:d.colours.gold,children:[(0,c.jsx)(o.T,{size:12,weight:"semibold",colour:d.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==v?(0,c.jsx)(o.T,{size:22,weight:"semibold",colour:d.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,c.jsxs)(o.T,{size:34,weight:"bold",colour:d.colours.goldLight,testID:"sph-avg",children:[u(v)," ",(0,c.jsx)(o.T,{size:16,colour:d.colours.muted,children:"per head"})]}),(0,c.jsx)(o.Muted,{children:b?'Only days with gross takings entered are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has Gross takings.'})]}),(0,c.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(o.Chip,{testID:"sph-day",label:"By day",selected:'day'===k,onPress:()=>w('day')}),(0,c.jsx)(o.Chip,{testID:"sph-week",label:"By week",selected:'week'===k,onPress:()=>w('week')})]}),'day'===k?(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"semibold",children:"Spend per head by day"}),(0,c.jsx)(x,{testID:"sph-trend-day",label:"Spend per head trend by day",points:j.map(e=>({label:p(e.date),value:e.sph}))}),[...j].reverse().map(e=>$(e.date,p(e.date),`${e.covers} covers`,null==e.sph?'No takings entered':u(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${u(e.foodPh)}, drink ${u(e.drinkPh)} per head`:void 0))]}):null,'week'===k?(0,c.jsxs)(o.Card,{children:[(0,c.jsx)(o.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,c.jsx)(x,{testID:"sph-trend-week",label:"Spend per head trend by week",points:f.map(e=>({label:`w/c ${p(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...f].reverse().map(e=>$(e.weekStart,`w/c ${p(e.weekStart)}`,e.days?`${e.covers} covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':u(e.sph)))]}):null,(0,c.jsx)(o.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var s=_r(_d[0]),t=e(_r(_d[1])),l=_r(_d[2]),n=e(l),o=_r(_d[3]),a=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),h=_r(_d[8]),c=_r(_d[9]);const u=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,p=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function x({points:e,testID:a,label:r}){const[i,h]=(0,s.useState)(320),p=e.map(e=>e.value).filter(e=>null!=e),x=Math.max(1,...p),y=p.length?.8*Math.min(...p):0,k=s=>14+s*(i-28)/Math.max(1,e.length-1),w=e=>126-(e-y)/Math.max(1,x-y)*112,b=[];let j=[];e.forEach((e,s)=>{null==e.value?(j.length&&b.push(j),j=[]):j.push({i:s,v:e.value})}),j.length&&b.push(j);const f=e.filter(e=>null!=e.value).map(e=>`${e.label} ${u(e.value)}`).join(', ');return(0,c.jsxs)(t.default,{testID:a,accessible:!0,accessibilityLabel:`${r}. ${f||'No takings entered'}`,onLayout:e=>h(e.nativeEvent.layout.width),style:{gap:4},children:[(0,c.jsxs)(n.default,{width:i,height:140,children:[(0,c.jsx)(l.Line,{x1:14,x2:i-14,y1:126,y2:126,stroke:d.colours.border,strokeWidth:1}),b.map((e,s)=>(0,c.jsx)(l.Polyline,{points:e.map(e=>`${k(e.i)},${w(e.v)}`).join(' '),fill:"none",stroke:d.colours.gold,strokeWidth:2.5},s)),e.map((e,s)=>null==e.value?(0,c.jsx)(l.Circle,{cx:k(s),cy:126,r:2,fill:"#444"},s):(0,c.jsx)(l.Circle,{cx:k(s),cy:w(e.value),r:4,fill:d.colours.goldLight},s))]}),(0,c.jsxs)(t.default,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,c.jsx)(o.T,{size:11,colour:d.colours.muted,children:e[0]?.label}),(0,c.jsx)(o.T,{size:11,colour:d.colours.muted,children:e[e.length-1]?.label})]})]})}},925,[30,127,1005,813,819,983,926,821,954,24]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COUNTED",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"serviceOfBooking",{enumerable:!0,get:function(){return o}}),e.coversOn=d,e.dayRows=i,e.weekRows=function(n,t,s,o,d){const u=(0,r.weekStartOf)(o);return Array.from({length:d},(l,f)=>{const h=(0,r.addDaysYmd)(u,7*(f-d+1)),m=i(n,t,s,(0,r.addDaysYmd)(h,6),7).filter(r=>r.date<=o&&null!=r.gross),p=m.length?Math.round(100*m.reduce((r,n)=>r+n.gross,0))/100:null,v=m.reduce((r,n)=>r+n.covers,0);return{weekStart:h,gross:p,covers:v,days:m.length,sph:c(p,v)}})},e.serviceRows=function(n,t,s,o,i,l=1020){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r])),h=[];for(let n=0;nnull!=r.gross&&r.covers>0);return n.length?c(n.reduce((r,n)=>r+n.gross,0),n.reduce((r,n)=>r+n.covers,0)):null},Object.defineProperty(e,"hasAnyTakings",{enumerable:!0,get:function(){return l}});var r=_r(_d[0]);const n=['seated','finished'],t=r=>n.includes(r.status),s=r=>{const[n,t]=r.split(':').map(Number);return 60*n+(t||0)},o=(r,n)=>s(r.time)r.restaurantId===n&&r.date===s&&t(r)&&(!d||o(r,u)===d)).reduce((r,n)=>r+(n.partySize||0),0)}const u=r=>'number'==typeof r&&Number.isFinite(r)?r:null,c=(r,n)=>null==r||n<=0?null:Math.round(r/n*100)/100;function i(n,t,s,o,i){const l=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,f)=>{const h=(0,r.addDaysYmd)(o,f-i+1),m=l.get(h)?.vals??{},p=(0,r.grossOf)(m),v=d(t,s,h),y=u(m.food),b=u(m.drink);return{date:h,gross:p,covers:v,sph:c(p,v),food:y,drink:b,foodPh:c(y,v),drinkPh:c(b,v)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.grossOf)(n.vals))},926,[984]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},927,[30,1049,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.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,$.jsx)(V,{}):(0,$.jsx)(G,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,$.jsx)(V,{}):(0,$.jsx)(H,{})},_e.TablesQr=function({go:e}={}){const{rid:s,r:t,now:r,me:n}=(0,I.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsx)(l.StaffTableOrders,{rid:s,me:n}),(0,$.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(t)?(0,$.jsx)(_,{rid:s,now:r,me:n}):(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,$.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:s,r:t,now:r}=(0,I.useCtx)(3e4),a=(0,T.useOrders)(s),n=t.settings,l=(0,P.takeawaySlots)(t,a,r).slice(0,10),i=e=>z().updateSettings(s,e),o=a.filter(e=>'takeaway'===e.type&&(0,E.LIVE)(e));return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsxs)(v.Card,{highlight:n.takeawayPaused?B.colours.red:B.colours.ok,children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{weight:"semibold",children:n.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,$.jsx)(v.Toggle,{label:"Takeaway on",value:!n.takeawayPaused,onChange:e=>i({takeawayPaused:!e})})]}),(0,$.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Slot length (min)"}),(0,$.jsx)(v.Stepper,{value:n.slotMinutes,min:5,max:30,onChange:e=>i({slotMinutes:e}),label:"slot minutes"})]}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Orders per slot"}),(0,$.jsx)(v.Stepper,{value:n.slotCap,min:1,max:20,onChange:e=>i({slotCap:e}),label:"orders per slot"})]}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,$.jsx)(v.Stepper,{value:n.leadMins,min:5,max:60,onChange:e=>i({leadMins:e}),label:"lead minutes"})]}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,$.jsx)(v.Stepper,{value:n.bufferMins,min:0,max:20,onChange:e=>i({bufferMins:e}),label:"buffer minutes"})]}),(0,$.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Next slots"}),l.map(e=>(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{size:14,children:e.label}),(0,$.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:B.colours.border,borderRadius:4},children:(0,$.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?B.colours.red:B.colours.gold,borderRadius:4}})}),(0,$.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,$.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,$.jsxs)(v.Muted,{children:[e.slotTime?(0,O.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,E.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:r,r:a}=(0,I.useCtx)(6e4),n=a.settings,l=(0,S.useOwner)(e=>e.reminders),i=e=>z().updateSettings(r,e),o=e=>S.useOwner.getState().setOwner({reminders:{...l,...e}});return(0,$.jsxs)(w.default,{style:{gap:10},children:[s.IS_GREENSIDE?(0,$.jsx)(t.GreensideCashOnly,{}):(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,$.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(n);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,$.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,$.jsx)(v.Toggle,{label:"24h reminder",value:l.h24,onChange:e=>o({h24:e})})]}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,$.jsx)(v.Toggle,{label:"2h reminder",value:l.h2,onChange:e=>o({h2:e})})]}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,$.jsx)(v.Toggle,{label:"confirm",value:l.confirmText,onChange:e=>o({confirmText:e})})]}),(0,$.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,$.jsx)(v.Stepper,{value:n.bookingCoversPerSlot,min:2,max:60,onChange:e=>i({bookingCoversPerSlot:e}),label:"covers per slot"})]}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Typical table turn (min)"}),(0,$.jsx)(v.Stepper,{value:n.turnMins,min:30,max:180,onChange:e=>i({turnMins:e}),label:"turn minutes"})]}),(0,$.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,$.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:s,today:t}=(0,I.useCtx)(1e4),r=(0,T.useAllMenu)(s),a=(0,T.useOrders)(s),n=(0,T.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===s&&e.date===t))),l=(0,T.useAudit)(s).filter(e=>'allergy'===e.kind),i=r.filter(e=>!e.signOff),o=(0,T.useStore)(e=>e.bookings),d=a.filter(e=>(0,E.LIVE)(e)&&(0,D.chainNeedsAction)(e,o)).length+n.filter(e=>'cancelled'!==e.status&&(0,D.bookingNeedsAction)(e,a.filter(E.LIVE))).length;return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,$.jsxs)(v.Row,{gap:8,children:[(0,$.jsxs)(v.Card,{style:{flex:1},highlight:d?B.colours.red:void 0,children:[(0,$.jsx)(v.Muted,{children:"Awaiting verification"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:d})]}),(0,$.jsxs)(v.Card,{style:{flex:1},highlight:i.length?B.colours.amber:void 0,children:[(0,$.jsx)(v.Muted,{children:"Dishes not signed off"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:i.length})]})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,$.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,$.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,$.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,$.jsxs)(v.Row,{gap:6,children:[(0,$.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,$.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,$.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,$.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),l.slice(0,6).map(e=>(0,$.jsxs)(v.Muted,{children:[(0,O.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),l.length?null:(0,$.jsx)(v.Muted,{children:"No allergy events yet."}),(0,$.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,$.jsx)(w.default,{style:{gap:10},children:(0,$.jsxs)(v.Card,{highlight:B.colours.gold,style:{alignItems:'center'},children:[(0,$.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:B.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,$.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,$.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,$.jsx)(v.T,{size:20,weight:"bold",colour:B.colours.gold,children:"CoverCharge for Display"}),(0,$.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:s,r:t}=(0,I.useCtx)(6e4),r=(0,d.useLiveVenue)(),a=s=>s.startsWith('tab:')?e(s.slice(4)):e('more',s),n=e=>e.startsWith('tab:')?'tab:forecast'!==e||S.CAN.forecasts(s):(()=>{const t=L.PAGES.find(s=>s.id===e);return!!t&&(!t.can||t.can(s))})();return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsxs)(v.Card,{highlight:B.colours.gold,children:[(0,$.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(t)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,s,t])=>(0,$.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsxs)(w.default,{style:{flex:1},children:[(0,$.jsx)(v.T,{weight:"medium",children:e}),(0,$.jsx)(v.Muted,{children:s})]}),(0,$.jsx)(v.Badge,{kind:'This app'===t?'ok':'gold',label:t})]},e)),'owner'===s?(0,$.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{S.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,$.jsx)(v.Muted,{children:r?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,$.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...Q].filter(e=>4!==e.n||(0,M.orderAtTableOn)(t)).sort((e,s)=>e.n-s.n).map(e=>(0,$.jsxs)(v.Card,{children:[(0,$.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,$.jsxs)(v.T,{weight:"bold",colour:B.colours.gold,style:{width:26},children:[e.n,"."]}),(0,$.jsxs)(w.default,{style:{flex:1},children:[(0,$.jsx)(v.T,{weight:"semibold",children:e.title}),(0,$.jsx)(v.Muted,{children:e.note})]})]}),(0,$.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>n(e)).map(([e,s])=>(0,$.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(s)},s))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,$.jsx)(K,{kind:"card"}):(0,$.jsx)(F,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,$.jsx)(K,{kind:"referrals"}):(0,$.jsx)(U,{})};var s=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),x=_r(_d[14]),b=_r(_d[15]),m=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),T=_r(_d[24]),S=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),E=_r(_d[31]),I=_r(_d[32]),A=_r(_d[33]),N=_r(_d[34]),L=_r(_d[35]),D=_r(_d[36]),$=_r(_d[37]);const z=()=>T.useStore.getState();function F(){const{rid:e,r:t,me:a}=(0,I.useCtx)(3e4),n=t.settings,l=(0,T.useStore)((0,k.useShallow)(s=>s.stampCards.filter(s=>s.restaurantId===e))),i=(0,T.useStore)(e=>e.customer.name),o=(0,T.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,A.crmCustomers)(),[]),[c,h]=(0,b.useState)(n.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,N.examplesAllowed)()&&e===s.VENUE_RID&&!l.some(e=>e.customerId.startsWith('cr-'))&&T.useStore.setState(s=>({stampCards:[...s.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((s,t)=>({restaurantId:e,customerId:s.id,stamps:s.stamps%n.stampTarget,rewardsAvailable:t%5==0?1:0,history:[{at:'2026-10-20',source:t%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(s=>s.id===e)?.name??(e===T.useStore.getState().customer.id?i||'Guest':e),x=l.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,s)=>s.stamps-e.stamps),m=(0,N.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(m?31:0);return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsxs)(v.Row,{gap:8,children:[(0,$.jsxs)(v.Card,{style:{flex:1},children:[(0,$.jsx)(v.Muted,{children:"Active cards"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:l.length})]}),(0,$.jsxs)(v.Card,{style:{flex:1},children:[(0,$.jsx)(v.Muted,{children:"Rewards ready"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:l.reduce((e,s)=>e+s.rewardsAvailable,0)})]}),(0,$.jsxs)(v.Card,{style:{flex:1},children:[(0,$.jsx)(v.Muted,{children:"Redeemed"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,$.jsx)(v.Muted,{children:m?'all time (example)':'all time'})]})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Stamps for a reward"}),(0,$.jsx)(v.Stepper,{value:n.stampTarget,min:3,max:15,onChange:s=>z().updateSettings(e,{stampTarget:s}),label:"stamps"})]}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{children:"Min spend \xa3"}),(0,$.jsx)(v.Stepper,{value:n.stampMinSpend/100,min:0,max:50,onChange:s=>z().updateSettings(e,{stampMinSpend:100*s}),label:"minimum spend"})]}),(0,$.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,$.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>z().updateSettings(e,{stampReward:c.trim()||n.stampReward})}),(0,$.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,$.jsx)(E.SectionHead,{title:"Members"}),(0,$.jsx)(r.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),x.map(s=>(0,$.jsxs)(w.default,{style:v.styles.card,children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(s.customerId)}),s.rewardsAvailable?(0,$.jsx)(v.Badge,{kind:"ok",label:`${s.rewardsAvailable} reward ready`}):null]}),(0,$.jsx)(v.Row,{gap:4,children:Array.from({length:n.stampTarget},(e,t)=>(0,$.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:te.source))).join(', ')||'\u2013']}),(0,$.jsxs)(v.Row,{gap:6,children:[(0,$.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>z().addStamp(e,s.customerId,`Manual (${a})`)}),(0,$.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!s.rewardsAvailable,onPress:()=>z().redeemReward(e,s.customerId)})]})]},s.customerId))]})}function U(){const e=(0,S.useOwner)(e=>e.referral),s=(0,S.useOwner)(e=>e.referrals),[t,r]=(0,b.useState)(e.giverReward),[a,n]=(0,b.useState)(e.friendReward),l=e=>s.filter(s=>s.status===e).length,i=(0,N.examplesAllowed)();return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsxs)(v.Row,{gap:8,children:[i?(0,$.jsxs)(v.Card,{style:{flex:1},children:[(0,$.jsx)(v.Muted,{children:"Invites sent"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,$.jsx)(v.Muted,{children:"example"})]}):null,(0,$.jsxs)(v.Card,{style:{flex:1},children:[(0,$.jsx)(v.Muted,{children:"Sign-ups"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:s.length+(i?23:0)})]}),(0,$.jsxs)(v.Card,{style:{flex:1},children:[(0,$.jsx)(v.Muted,{children:"Ordered"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:l('first order')+l('rewarded')+(i?9:0)})]})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,$.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:s=>S.useOwner.getState().setOwner({referral:{...e,active:s}})})]}),(0,$.jsx)(v.Field,{label:"Reward for the customer who invites",value:t,onChangeText:r}),(0,$.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:n}),(0,$.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>S.useOwner.getState().setOwner({referral:{...e,giverReward:t.trim(),friendReward:a.trim()}})}),(0,$.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,$.jsx)(E.SectionHead,{title:"Referrals"}),s.map(e=>(0,$.jsxs)(v.Card,{children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,$.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,$.jsx)(v.Muted,{children:e.at})]},e.id))]})}function V(){const{me:e}=(0,I.useCtx)(6e4),s=(0,I.useSignedIn)();return(0,$.jsx)(p.GiftCardsPage,{me:(s?.name??e).replace(' (example)','')})}function G(){const{rid:e,me:s}=(0,I.useCtx)(6e4),t=(0,T.useStore)((0,k.useShallow)(s=>s.giftCards.filter(s=>s.restaurantId===e))),[a,n]=(0,b.useState)(25),[l,i]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,x]=(0,b.useState)(''),[m,f]=(0,b.useState)(null),j=t.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=t.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsxs)(v.Row,{gap:8,children:[(0,$.jsxs)(v.Card,{style:{flex:1},children:[(0,$.jsx)(v.Muted,{children:"Sold"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.initial,0))})]}),(0,$.jsxs)(v.Card,{style:{flex:1},children:[(0,$.jsx)(v.Muted,{children:"Outstanding"}),(0,$.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(t.reduce((e,s)=>e+s.balance,0))})]})]}),m?(0,$.jsx)(v.Banner,{kind:"success",title:m}):null,(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,$.jsx)(r.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,$.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,$.jsx)(v.T,{size:13,colour:B.colours.red,children:"No card with that code."}):null,(0,$.jsx)(v.Field,{label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,$.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{z().redeemGiftCard(o,Math.round(100*Number(c)),s)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,$.jsx)(r.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,$.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,$.jsx)(v.Field,{label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:x,keyboardType:"decimal-pad"}),(0,$.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const t=z().honourLegacyCard(e,u,Math.round(100*Number(p)),s);f(`Website bookings card ${t.code} honoured`),d(t.code),g(''),x('')}})]}):null]}),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,$.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,$.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>n(e)},e))}),(0,$.jsx)(v.Field,{label:"Recipient",value:l,onChangeText:i}),(0,$.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:l.trim().length<2,onPress:()=>{const s=z().buyGiftCard(e,100*a,l.trim(),'Sold at the till');f(`Created ${s.code}`),i('')}}),(0,$.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,$.jsx)(E.SectionHead,{title:"All cards"}),t.map(e=>(0,$.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,$.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,$.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function _({rid:e,now:s,me:t}){const r=(0,T.useOrders)(e).filter(e=>'table'===e.type),[a,l]=(0,b.useState)(null),i=(0,m.useTableUse)(e,s),o=(0,m.useTableNames)(e);return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,$.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,$.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const s=r.filter(s=>s.tableNo===e&&(0,E.LIVE)(s)),t=s.reduce((e,s)=>e+s.total-s.paid,0);return(0,$.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,n.tableNumbers)(e)}`,onPress:()=>l(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:s.length?B.colours.gold:B.colours.border,backgroundColor:B.colours.surface,gap:2},children:[(0,$.jsx)(v.T,{weight:"bold",children:(0,n.tableNumbers)(e)}),(0,$.jsx)(v.T,{size:12,colour:i[e]?.busy?'#FFD9D4':'#E2C489',children:i[e]?.busy?i[e].label:'Free'}),(0,$.jsx)(v.Muted,{children:s.length?`${s.length} order${s.length>1?'s':''}`:'No orders'}),t?(0,$.jsxs)(v.T,{size:12,colour:B.colours.amber,children:[(0,R.gbp)(t)," to pay"]}):(0,$.jsx)(v.T,{size:12,colour:B.colours.muted,children:"View QR"})]},e)})}),(0,$.jsx)(E.SectionHead,{title:"Live table orders"}),r.filter(E.LIVE).map(e=>(0,$.jsxs)(v.Card,{children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(v.T,{weight:"semibold",children:[(0,n.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,$.jsx)(v.Badge,{kind:(0,E.statusKind)(e.status),label:(0,E.statusLabel)(e)})]}),(0,$.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,O.minsBetween)(new Date(e.createdAt),s)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),r.filter(E.LIVE).length?null:(0,$.jsx)(v.Muted,{children:"No live table orders."}),a?(0,$.jsxs)(v.Sheet,{visible:!0,onClose:()=>l(null),title:`${(0,n.tableNumbers)(a)} QR code`,children:[(0,$.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,$.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,$.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,$.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,$.jsx)(v.Button,{label:`Preview customer table ordering (${(0,n.tableNumbers)(a)})`,onPress:()=>{const e=a;l(null),j.router.push(`/table/${e}`)}}),(0,$.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>l(a)})]}):null]})}function H(){const e=(0,S.useOwner)(e=>e.merch),s=(0,S.useOwner)(e=>e.merchOrders),[t,r]=(0,b.useState)(''),[a,n]=(0,b.useState)(''),l=(s,t)=>S.useOwner.getState().setOwner({merch:e.map(e=>e.id===s?{...e,...t}:e)});return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,$.jsx)(E.SectionHead,{title:"Products & stock"}),e.map(e=>(0,$.jsxs)(w.default,{style:v.styles.card,children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,$.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,$.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:s=>l(e.id,{live:s})})}),(0,$.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:s=>l(e.id,{stock:s}),label:`${e.name} stock`})]}),0===e.stock?(0,$.jsx)(v.T,{size:13,colour:B.colours.red,children:"Out of stock"}):e.stock<8?(0,$.jsx)(v.T,{size:13,colour:B.colours.amber,children:"Low stock"}):null]},e.id)),(0,$.jsxs)(v.Card,{children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,$.jsx)(v.Field,{label:"Name",value:t,onChangeText:r}),(0,$.jsx)(v.Field,{label:"Price \xa3",value:a,onChangeText:n,keyboardType:"decimal-pad"}),(0,$.jsx)(v.Button,{small:!0,label:"Add product",disabled:t.trim().length<2||!(Number(a)>0),onPress:()=>{S.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:t.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),r(''),n('')}})]}),(0,$.jsx)(E.SectionHead,{title:"Shop orders"}),s.map(t=>{const r=e.find(e=>e.id===t.productId);return(0,$.jsxs)(v.Card,{children:[(0,$.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,$.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[t.qty,"\xd7 ",r?.name," \xb7 ",t.customer]}),(0,$.jsx)(v.Badge,{kind:'new'===t.status?'amber':'ready'===t.status?'blue':'ok',label:t.status})]}),(0,$.jsxs)(v.Muted,{children:[t.at," \xb7 ",(0,R.gbp)((r?.price??0)*t.qty)]}),'collected'!==t.status?(0,$.jsx)(v.Button,{small:!0,label:'new'===t.status?'Mark ready':'Mark collected',onPress:()=>S.useOwner.getState().setOwner({merchOrders:s.map(e=>e.id===t.id?{...e,status:'new'===t.status?'ready':'collected'}:e)})}):null]},t.id)})]})}const Q=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter (tronc)',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const W=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},q=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function K({kind:e}){const{r:s}=(0,I.useCtx)(6e4),t=(0,S.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:t},W,q).catch(()=>{})},[]);const r=(0,u.can)('venue.settings');return(0,$.jsxs)(w.default,{style:{gap:10},children:[(0,$.jsx)(x.LoyaltySummaryCard,{kind:e}),(0,$.jsx)(g.StaffLoyalty,{venue:s.name,canRemove:r,onOpenSettings:r?()=>{i.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),r?(0,$.jsx)(v.Card,{children:(0,$.jsxs)(w.default,{style:{gap:8},children:[(0,$.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,$.jsx)(x.LoyaltySettingsPanel,{})]})}):null]})}},928,[5,991,874,833,808,1050,890,966,943,13,836,820,1051,1052,891,30,989,917,804,263,127,871,867,813,819,854,816,979,817,818,821,953,954,980,1053,902,987,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SafetyPages",{enumerable:!0,get:function(){return l}}),r(d[0]);var n=r(d[1]),t=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),u=r(d[6]);const l={Creator:()=>{const{rid:n,role:o}=(0,c.useCtx)(3e4);return(0,u.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===o||'manager'===o})},Haccp:()=>{const{me:n,meId:t,now:s}=(0,c.useCtx)(3e4);return(0,u.jsx)(o.HaccpLog,{mode:"managers",me:n,meId:t,now:s})},Specials:()=>{const{rid:n,me:t,now:o}=(0,c.useCtx)(3e4);return(0,u.jsx)(s.SpecialsEditor,{rid:n,me:t,app:"managers",now:o})},Accidents:()=>{const{me:t,meId:o,now:s,role:l}=(0,c.useCtx)(3e4);return(0,u.jsx)(n.AccidentBook,{app:"managers",me:t,meId:o,now:s,seeAll:'owner'===l||'manager'===l})}}},929,[30,1054,1055,1056,1057,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.EmailFrame=T,_e.SmsBubble=k,_e.AlertSettings=function({go:e}){const{rid:s}=(0,f.useCtx)(6e4),t=(0,p.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,p.systemSupport)()),[r,m]=(0,n.useState)(null),x='granted'===l?'Allowed on this device':'denied'===l?'Blocked. Turn it back on in your browser or phone settings for this site.':'default'===l?'Not asked yet':'This browser can\u2019t show notifications. On iPhone, add the Managers app to your Home Screen first.';return(0,w.jsxs)(c.default,{style:{gap:10},children:[(0,w.jsxs)(h.Card,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Alert sound"}),(0,w.jsx)(h.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,w.jsx)(h.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>p.useAlerts.getState().setPrefs({muted:!e})}),(0,w.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,j.chime)('bright')}),(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,j.lowChime)(.6)})]}),(0,w.jsx)(h.Muted,{children:"The Display makes no sound: its alerts are visual only. The Head Chef app flashes red with a low, soft chime that starts quiet and builds until the takeaway is confirmed and its allergies are ticked. Animations follow your device\u2019s \u201creduce motion\u201d setting."})]}),(0,w.jsxs)(h.Card,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Which alerts to show"}),(0,w.jsx)(h.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),p.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(c.default,{style:{width:30,height:30,borderRadius:15,borderWidth:1.2,borderColor:p.KIND_META[e].colour,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(u.KindIcon,{kind:e,size:16})}),(0,w.jsx)(c.default,{style:{flex:1},children:(0,w.jsx)(h.Toggle,{label:p.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>p.useAlerts.getState().setType(e,s)})})]},e))]}),(0,w.jsxs)(h.Card,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Send a test alert"}),(0,w.jsx)(h.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,w.jsx)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,w.jsx)(h.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${p.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,p.sendTestAlert)(s,e)},e))})]}),(0,w.jsxs)(h.Card,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,w.jsx)(h.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,w.jsx)(h.Muted,{children:x}),(0,w.jsx)(h.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>p.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,w.jsx)(h.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,p.requestSystemPermission)()),p.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,p.showSystemNotification)({id:`test-sys:${Date.now()}`,kind:'test',rid:s,at:Date.now(),name:'Test guest',when:'Today 19:30',covers:4,source:'Phone',test:!0},!0)}):null,(0,w.jsx)(h.Muted,{children:(0,p.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,w.jsx)(h.Banner,{kind:"info",title:"What works today",children:"Alerts reach this device whenever the Managers app is open or in the background, and bookings made on this device (any app) show up straight away. To get alerts on a phone that is locked or closed, or on a different device from where the booking was made, CoverCharge needs a small push server. That part is ready to plug in but not switched on in this pilot."}),(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Check push for other devices",onPress:async()=>{const e=p.PUSH_BACKEND?await(await _r(d[18])(d[17],d.paths)).subscribeToPush(s):{ok:!1,why:'Not connected yet: needs the CoverCharge push server.'};m(e.ok?'Push connected for this device.':e.why??'Not available.')}}),r?(0,w.jsx)(h.Muted,{children:r}):null]}),(0,w.jsxs)(h.Card,{children:[(0,w.jsxs)(h.Row,{gap:10,children:[(0,w.jsx)(u.KindIcon,{kind:"email"}),(0,w.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,w.jsx)(h.Badge,{kind:"neutral",label:p.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,w.jsx)(h.Muted,{children:p.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${p.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,w.jsx)(h.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,f.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),u=(0,n.useMemo)(()=>(0,b.templatesFor)(r),[r]),p=(0,x.useAssistant)(e=>e.enabled),[j,S]=(0,n.useState)('booking'),[P,M]=(0,n.useState)('sms'),A=u[j],B=s=>m.useStore.getState().setTemplate(e,j,s),R=Object.fromEntries(b.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),I=l.LIVE_VENUE_BUILD?{sms:R,email:R}:'order'===j?(0,b.orderVars)({...C,slotTime:`${o}T18:45:00`},s):(0,b.bookingVars)({...v,date:o},s),N=(0,b.toGsm)((0,b.fill)(A.sms,I.sms)),L=(0,b.fill)(A.subject,I.email),_=(0,b.emailHtml)((0,b.fillEmailText)(A.body,I.email),{venue:s.name,preheader:L}),D=!!r?.[j],O=s.settings;return(0,w.jsxs)(c.default,{style:{gap:10},children:[(0,w.jsx)(h.Banner,{kind:"demo",title:"Preview mode",children:b.PREVIEW_BANNER}),(0,w.jsxs)(h.Muted,{children:["Every booking and takeaway order gets a text (a phone number is needed to book) and an email if they gave one. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest."]}),(0,w.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(b.DEFAULT_TEMPLATES).map(e=>(0,w.jsx)(h.Chip,{label:b.TEMPLATE_LABEL[e].title,selected:j===e,onPress:()=>S(e)},e))}),(0,w.jsx)(h.Muted,{children:b.TEMPLATE_LABEL[j].when}),(0,w.jsxs)(h.Card,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Text message"}),(0,w.jsxs)(h.Muted,{children:[(0,b.smsParts)(N).chars," characters"]})]}),(0,w.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:A.sms,onChangeText:e=>B({sms:e}),style:[h.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,b.smsParts)(N).chars>300?(0,w.jsx)(h.T,{size:13,colour:y.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,w.jsx)(h.T,{weight:"semibold",children:"Email subject"}),(0,w.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:A.subject,onChangeText:e=>B({subject:e}),style:h.styles.input}),(0,w.jsx)(h.T,{weight:"semibold",children:"Email message"}),(0,w.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:A.body,onChangeText:e=>B({body:e}),style:[h.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,w.jsxs)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:[p?(0,w.jsx)(h.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>B(E(A))}):null,D?(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,j,null)}):null]}),p?(0,w.jsx)(h.Muted,{children:"\u201cMake it warmer\u201d is an on-device wording tool: it rewrites on this device and keeps every detail. Check it reads right before you leave it."}):null,(0,w.jsxs)(h.Muted,{children:["Placeholders: ",b.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,w.jsxs)(h.Card,{children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Live preview"}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:"Text",selected:'sms'===P,onPress:()=>M('sms')}),(0,w.jsx)(h.Chip,{label:"Email",selected:'email'===P,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,w.jsx)(h.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,w.jsxs)(h.Muted,{children:["Sample guest: Alex, ",'order'===j?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===P?(0,w.jsx)(k,{text:N,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,w.jsxs)(c.default,{style:{gap:6},children:[(0,w.jsxs)(h.T,{size:14,children:[(0,w.jsx)(h.T,{size:14,colour:y.colours.muted,children:"Subject: "}),L]}),(0,w.jsx)(T,{html:_})]})]}),(0,w.jsxs)(h.Card,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,w.jsx)(h.Muted,{children:"Online bookings above this size wait for you to confirm. The guest gets a \u201cwe\u2019ve got your request\u201d message first, then the confirmation once you accept."}),(0,w.jsx)(h.Stepper,{label:"Auto-accept online bookings up to",value:O.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,w.jsx)(h.Toggle,{label:"Also check online bookings with a special request",value:!!O.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,w.jsxs)(h.Card,{children:[(0,w.jsx)(h.T,{weight:"semibold",children:"Going live"}),(0,w.jsxs)(h.Muted,{children:["Nothing is sent yet. To send real texts and emails: a text service account (for example Twilio) and an email service (for example Postmark), a small CoverCharge server to keep the keys safe, and your sender name (",s.name,") registered. Your venue name, address and phone come from Info & hours."]})]})]})},_e.Outbox=function(){const{rid:e}=(0,f.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[u,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),p=t.filter(e=>'all'===l||e.channel===l);return(0,w.jsxs)(c.default,{style:{gap:10},children:[(0,w.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:y.colours.gold,borderRadius:12,padding:12},children:[(0,w.jsx)(h.T,{weight:"semibold",colour:y.colours.gold,children:(0,b.isLive)()?'Live: messages are sent through your text and email service.':b.PREVIEW_BANNER}),(0,b.isLive)()?null:(0,w.jsx)(h.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,w.jsx)(h.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,w.jsx)(h.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),p.length?null:(0,w.jsx)(h.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),p.map(e=>(0,w.jsxs)(h.Card,{children:[(0,w.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(u===e.id?null:e.id),style:{gap:4},children:[(0,w.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(h.Row,{gap:6,children:[(0,w.jsx)(h.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,w.jsxs)(h.T,{weight:"semibold",children:[S[e.kind]," \xb7 ",e.ref]})]}),(0,w.jsx)(h.Muted,{children:e.at.slice(11,16)})]}),(0,w.jsxs)(h.Muted,{children:["To ",e.toName,", ",e.to]}),(0,w.jsx)(h.T,{size:13,colour:'sent'===e.status?y.colours.ok:'failed'===e.status?y.colours.red:y.colours.amber,children:(0,b.statusLabel)(e)})]}),'sms'===e.channel?(0,w.jsx)(k,{text:e.body}):u===e.id?(0,w.jsxs)(c.default,{style:{gap:6},children:[(0,w.jsxs)(h.T,{size:14,children:[(0,w.jsx)(h.T,{size:14,colour:y.colours.muted,children:"Subject: "}),e.subject]}),(0,w.jsx)(T,{html:e.html??'',height:560})]}):(0,w.jsxs)(h.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,w.jsx)(h.Button,{small:!0,kind:"ghost",label:"Clear the Outbox",onPress:()=>m.useStore.getState().clearOutbox(e)}):null]})};var s=_r(d[0]),t=_r(d[1]),l=_r(d[2]),n=_r(d[3]),o=e(n);_r(d[4]);var r=e(_r(d[5])),c=e(_r(d[6])),h=_r(d[7]),u=_r(d[8]),m=_r(d[9]),x=_r(d[10]),b=_r(d[11]),p=_r(d[12]),j=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]);function T({html:e,height:s=520}){return o.default.createElement('iframe',{srcDoc:e,title:'Email preview',sandbox:'',style:{width:'100%',height:s,border:'1px solid #2a2a2a',borderRadius:12,background:'#f4efe6'}})}function k({text:e,to:t}){const l=(0,b.smsParts)(e);return(0,w.jsxs)(c.default,{style:{gap:4},children:[t?(0,w.jsxs)(h.Muted,{children:["To ",t]}):null,(0,w.jsx)(c.default,{style:{alignSelf:'flex-start',maxWidth:420,backgroundColor:(0,s.soutersSurface)('#1f1f22'),borderRadius:18,borderBottomLeftRadius:4,padding:12,borderWidth:1,borderColor:'#2c2c30'},children:(0,w.jsx)(h.T,{size:15,children:e})}),(0,w.jsxs)(h.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const v={name:'Alex Morgan',partySize:4,date:'',time:'19:30',ref:'B-1042',allergies:[{allergen:'peanuts',severity:'allergy'}],notes:'It\u2019s my mum\u2019s birthday',table:void 0},C={customerName:'Alex Morgan',ref:'T-2093',total:3150,slotTime:void 0,readyBy:void 0,allergies:[{allergen:'milk',severity:'intolerance'}],lines:[{qty:2,name:'Fish and chips',choices:[]},{qty:1,name:'Sticky toffee pudding',choices:[]}]};function E(e){const s=e.sms.replace(/^Hi \{first\},/,'Hi {first}, lovely news!').replace(/See you soon,/,'We can\u2019t wait to see you,');let t=e.body;return/can\u2019t wait/.test(t)||(t=t.replace(/(Hi \{first\},\n\n)/,'$1We\u2019re so glad you chose us. ')),t=t.replace(/Warm wishes,/,'With very warm wishes from all of us,'),{sms:s,subject:e.subject,body:t}}const S={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},930,{"0":878,"1":874,"2":833,"3":30,"4":122,"5":263,"6":127,"7":813,"8":963,"9":819,"10":1058,"11":823,"12":965,"13":1012,"14":821,"15":954,"16":24,"17":965,"18":28,"paths":{}}); +__d(function(g,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.OrderSheetSettings=function(){const e=(0,o.useOwner)(e=>e.site),h=(0,i.useSheets)(e),[c,m]=(0,l.useState)(null);return c?(0,p.jsxs)(s.Card,{children:[(0,p.jsx)(s.T,{weight:"semibold",children:h.some(e=>e.id===c.id)?`Edit ${c.name}`:'New supplier'}),(0,p.jsx)(x,{rid:e,s:c,onDone:()=>m(null)})]}):(0,p.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,p.jsx)(s.Banner,{kind:"info",title:"Used by the Head Chef app",children:"Each supplier gets an order sheet in Head Chef \u203a Ordering. Text, WhatsApp and phone orders open the phone\u2019s own app with the order written out, and the chef presses Send. Nothing is sent automatically."}),h.map(e=>(0,p.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,p.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':u.METHOD_LABEL[e.method]})]}),(0,p.jsx)(s.Muted,{children:[e.goods,e.deliveryDays.length?`delivers ${(0,u.dayRange)(e.deliveryDays)}`:'',e.orderDays.length?`order ${(0,u.dayRange)(e.orderDays)}`:'',e.frequency,e.priceCapPerKg?`cap ${(0,d.gbp)(e.priceCapPerKg)}/kg`:''].filter(Boolean).join(' \xb7 ')}),'text'!==e.method&&'whatsapp'!==e.method&&'phone'!==e.method||e.number?null:(0,p.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,p.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,p.jsx)(s.Row,{wrap:!0,gap:8,children:(0,p.jsx)(s.Button,{label:"Add supplier",testID:"sheet-add",onPress:()=>m({id:(0,u.sid)(),name:'',goods:'',method:'text',number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:''})})})]})};var l=r(_d[0]),t=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]),u=r(_d[7]),h=r(_d[8]),p=r(_d[9]);const c=['online','phone','text','whatsapp','tbc'];function m({label:e,value:l,onChange:t}){return(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:h.colours.muted,children:e}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:u.DAY3.map((e,n)=>(0,p.jsx)(s.Chip,{label:e,selected:l.includes(n),onPress:()=>t(l.includes(n)?l.filter(e=>e!==n):[...l,n].sort())},e))})]})}function x({rid:e,s:t,onDone:o}){const d=(0,i.useOrderSheets)(e=>e.upsert),x=(0,i.useOrderSheets)(e=>e.remove),[b,f]=(0,l.useState)(t),[j,y]=(0,l.useState)(t.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[C,v]=(0,l.useState)(t.priceCapPerKg?(t.priceCapPerKg/100).toFixed(2):''),[w,T]=(0,l.useState)(!1),D=e=>f(l=>({...l,...e}));return(0,p.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10},children:[(0,p.jsx)(s.Field,{label:"Supplier name",value:b.name,onChangeText:e=>D({name:e})}),(0,p.jsx)(s.Field,{label:"What they supply",value:b.goods,onChangeText:e=>D({goods:e})}),(0,p.jsxs)(n.default,{style:{gap:4},children:[(0,p.jsx)(s.T,{size:14,weight:"medium",colour:h.colours.muted,children:"How to order"}),(0,p.jsx)(s.Row,{wrap:!0,gap:6,children:c.map(e=>(0,p.jsx)(s.Chip,{label:u.METHOD_LABEL[e],selected:b.method===e,onPress:()=>D({method:e})},e))})]}),'text'===b.method||'whatsapp'===b.method||'phone'===b.method?(0,p.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:b.number,keyboardType:"phone-pad",onChangeText:e=>D({number:e})}):null,'online'===b.method?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:b.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>D({url:e.trim()})}),(0,p.jsx)(s.Field,{label:"Button label",value:b.urlLabel??'',placeholder:"Open website",onChangeText:e=>D({urlLabel:e})})]}):null,(0,p.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:b.contact??'',onChangeText:e=>D({contact:e})}),(0,p.jsx)(m,{label:"Delivery days",value:b.deliveryDays,onChange:e=>D({deliveryDays:e})}),(0,p.jsx)(m,{label:"Order days (a reminder shows in the Head Chef app)",value:b.orderDays,onChange:e=>D({orderDays:e})}),(0,p.jsxs)(s.Row,{gap:10,children:[(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:b.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>D({cutoff:e})})}),(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(s.Field,{label:"Price cap \xa3/kg (optional)",value:C,keyboardType:"decimal-pad",onChangeText:v})})]}),(0,p.jsx)(s.Field,{label:"Reminder text (optional)",value:b.reminder,onChangeText:e=>D({reminder:e})}),(0,p.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:b.frequency,onChangeText:e=>D({frequency:e})}),b.priceCapPerKg||C?(0,p.jsx)(s.Field,{label:"Seller",value:b.seller,onChangeText:e=>D({seller:e})}):null,(0,p.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:y}),(0,p.jsx)(s.Field,{label:"Notes for the chef",value:b.notes,multiline:!0,onChangeText:e=>D({notes:e})}),(0,p.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,p.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const l=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,l)=>{const[n,s]=e.split('|').map(e=>e.trim()),o=t.items.find(e=>e.name===n);return{id:o?.id??`${b.id}-i${l}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*parseFloat(C.replace(/[\xa3,]/g,'')));d(e,{...b,items:l,priceCapPerKg:n>0?n:0,placeholder:b.placeholder&&'tbc'===b.method}),o()},disabled:!b.name.trim()}),(0,p.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:o}),w?(0,p.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{x(e,t.id),o()}}):(0,p.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>T(!0)})]})]})}},931,[30,263,127,813,854,1059,816,1060,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.showMe=f,_e.HelpPage=function({go:e}){const[i,o]=(0,s.useState)(''),[u,x]=(0,s.useState)(null),[f,y]=(0,s.useState)(null),w=(0,s.useMemo)(()=>i.trim()?(0,c.searchHelp)(r.HELP,i,10).map(e=>e.a):r.HELP.filter(e=>!u||e.topic===u),[i,u]);return(0,p.jsxs)(n.default,{style:{gap:10},testID:"help-page",children:[(0,p.jsxs)(n.default,{style:[a.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,p.jsx)(a.T,{colour:h.colours.muted,children:"\ud83d\udd0d"}),(0,p.jsx)(t.TextInput,{testID:"help-search",value:i,onChangeText:o,placeholder:"Search help: e.g. walk in, tips, export hours",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,color:h.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),i?(0,p.jsx)(l.default,{onPress:()=>o(''),accessibilityLabel:"Clear search",children:(0,p.jsx)(a.T,{colour:h.colours.muted,children:"\u2715"})}):null]}),(0,p.jsx)(m,{go:e}),i?(0,p.jsx)(a.Muted,{children:w.length?`${w.length} result${1===w.length?'':'s'} for \u201c${i.trim()}\u201d`:`Nothing for \u201c${i.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:[null,...r.HELP_TOPICS].map(e=>(0,p.jsx)(a.Chip,{label:e??'All',selected:u===e,onPress:()=>x(e)},e??'all'))}),w.map((t,s)=>(0,p.jsx)(j,{a:t,go:e,open:f===t.id||!!i&&0===s&&null===f,onToggle:()=>y(f===t.id?'':t.id)},t.id)),(0,p.jsxs)(a.Card,{children:[(0,p.jsx)(a.T,{weight:"semibold",colour:h.colours.gold,children:"Free lifetime support"}),(0,p.jsx)(a.Muted,{children:"Still stuck? Message the CoverCharge team from Settings, or email us. We help by message and email."})]})]})},_e.AskAssistant=m;var t=_r(d[0]),s=_r(d[1]),l=e(_r(d[2])),n=e(_r(d[3])),a=_r(d[4]),i=_r(d[5]),o=_r(d[6]),r=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),x=_r(d[11]),p=_r(d[12]);function f(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>o.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function j({a:e,go:t,open:s,onToggle:i}){return(0,p.jsx)(n.default,{testID:`help-${e.id}`,children:(0,p.jsxs)(a.Card,{children:[(0,p.jsx)(l.default,{accessibilityRole:"button",onPress:i,children:(0,p.jsxs)(a.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,p.jsxs)(n.default,{style:{flex:1},children:[(0,p.jsx)(a.T,{weight:"semibold",children:e.title}),(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(a.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,p.jsx)(a.Muted,{size:12,children:e.topic})]})]}),(0,p.jsx)(a.T,{colour:h.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,p.jsxs)(n.default,{style:{gap:6},children:[(0,p.jsx)(a.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,p.jsxs)(a.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,p.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(a.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,p.jsx)(a.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:(0,p.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>f(e,t)})}):null]})})}function m({go:e}){const{rid:t,today:l}=(0,x.useCtx)(6e4),i={rid:t,today:l,go:(t,s)=>e(t,s??null)},[o,c]=(0,s.useState)(''),[j,m]=(0,s.useState)(null),[b,k]=(0,s.useState)(null),C=async()=>{const e=o.trim();if(!e)return;k(null),m(null);const t=(0,u.matchIntent)(e,l);if('action'!==t.kind)'help'!==t.kind?k({text:'Sorry, I didn\u2019t follow that. Try \u201cadd a walk-in for 4 at table 7\u201d, \u201cput Ellie on Friday 5 till 11\u201d, or ask \u201chow do I export hours?\u201d.',kind:'note'}):k({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,u.needsConfirm)(t.action.risk)){const e=await(0,u.runAction)(t.action.id,t.params,i);return void k({text:'done'===e.status?e.message:e.message??'',kind:'done'})}m({action:t.action,params:{...y(t.action,l),...t.params},asked:e})}};return(0,p.jsx)(n.default,{testID:"ask-assistant",children:(0,p.jsxs)(a.Card,{highlight:h.colours.gold,children:[(0,p.jsxs)(a.Row,{gap:8,children:[(0,p.jsx)(n.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(a.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,p.jsx)(a.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"}),(0,p.jsx)(a.Badge,{kind:"amber",label:"On-device"})]}),(0,p.jsxs)(a.Row,{gap:6,style:{alignItems:'flex-end'},children:[(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(a.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:c,placeholder:"Add a walk-in for 4 at table 7",onSubmitEditing:C,returnKeyType:"send"})}),(0,p.jsx)(a.Button,{kind:"success",label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C})]}),(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:['Add a walk-in for 4 at table 7','Put a shift on Friday 5 till 11','How do I export hours for payroll?','Pay out the tips'].map(e=>(0,p.jsx)(a.Chip,{label:e,onPress:()=>c(e)},e))}),j?(0,p.jsx)(w,{p:j,today:l,onChange:e=>m({...j,params:e}),onConfirm:async()=>{if(!j)return;const e=await(0,u.runAction)(j.action.id,j.params,i,!0);m(null),c(''),k('done'===e.status?{text:e.message,kind:'done'}:'demo_only'===e.status?{text:e.message,kind:'demo'}:{text:e.message??'Couldn\u2019t do that.',kind:'error'})},onCancel:()=>{m(null),k({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,b?(0,p.jsxs)(n.default,{style:{gap:6},testID:"assistant-reply",children:[(0,p.jsx)(a.Banner,{kind:'done'===b.kind?'success':'error'===b.kind?'warn':'demo'===b.kind?'demo':'info',title:b.text}),b.help?.map(t=>{const s=(0,r.helpById)(t);return(0,p.jsxs)(a.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,p.jsx)(a.T,{style:{flex:1},children:s.title}),s.showMe?(0,p.jsx)(a.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>f(s,e)}):null]},t)})]}):null,(0,p.jsx)(a.Muted,{size:12,children:"It always shows you what it will do and waits for your tap. Anything that would send, pay or delete is marked in red and isn\u2019t carried out in this version."})]})})}function y(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function w({p:e,today:t,onChange:s,onConfirm:l,onCancel:o}){const r=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,u.demoOnly)(e.action.risk),x=(t,l)=>s({...e.params,[t]:l}),f=e.action,j=e.params,m=f.params.every(e=>!e.required||void 0!==j[e.name]&&''!==j[e.name]);return(0,p.jsxs)(n.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?h.colours.red:h.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':h.colours.okBg},children:[(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(a.Badge,{kind:c?'red':'ok',label:u.RISK_LABEL[f.risk]}),(0,p.jsx)(a.T,{weight:"semibold",style:{flex:1},children:f.title})]}),f.form&&'add_walkin'===f.id?(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(a.Field,{label:"Covers",value:void 0===j.covers?'':String(j.covers),onChangeText:e=>x('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(a.Field,{label:"Table (optional)",value:void 0===j.table?'':String(j.table),onChangeText:e=>x('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,f.form&&'add_rota_shift'===f.id?(0,p.jsxs)(n.default,{style:{gap:6},children:[(0,p.jsx)(a.Muted,{size:12,children:"Who"}),(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:r.slice(0,14).map(e=>(0,p.jsx)(a.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:j.staffId===e.id,onPress:()=>x('staffId',e.id)},e.id))}),(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(n.default,{style:{flex:1.3},children:(0,p.jsx)(a.Field,{label:"Date (YYYY-MM-DD)",value:String(j.date??t),onChangeText:e=>x('date',e)})}),(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(a.Field,{label:"Start (24h)",value:String(j.start??''),onChangeText:e=>x('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,p.jsx)(n.default,{style:{flex:1},children:(0,p.jsx)(a.Field,{label:"End (24h)",value:String(j.end??''),onChangeText:e=>x('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,p.jsx)(a.T,{children:m?f.preview(j,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,p.jsx)(a.Muted,{children:"The Assistant never sends, pays or deletes without asking you first. In this version it won\u2019t do it at all: confirming just explains what would happen."}):(0,p.jsx)(a.Muted,{children:"Nothing happens until you tap Confirm."}),(0,p.jsxs)(a.Row,{gap:8,children:[(0,p.jsx)(a.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!m,onPress:l,style:{flex:1}}),(0,p.jsx)(a.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},932,[874,30,263,127,813,854,957,1061,1062,1063,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}),_e.VoiceSettingsPage=function(){const{rid:e,r:s,now:t}=(0,f.useCtx)(6e4),o=(0,p.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"Staff hold the gold button, say what they need and let go. It sits at the top right in Managers, Head Chef, the Staff app (the full voice assistant, without team financial or HR information) and on the Display (no money, tips or HR either), never in the customer app. Tap it to type or open the Assistant. Replies and change confirmations are shown in text, never spoken. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts for you."}),(0,x.jsx)(c.VoiceUsageCard,{rid:e,now:t}),(0,x.jsxs)(i.Card,{children:[(0,x.jsxs)(i.T,{weight:"semibold",children:["Who gets the voice button at ",s.name]}),(0,x.jsx)(n.default,{style:{gap:6,marginTop:8},children:p.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:p.VOICE_ROLE_LABEL[s],value:(0,p.voiceOn)(o.enabled,e,s),onChange:t=>o.setEnabled(e,s,t)},s))}),(0,x.jsx)(i.Muted,{children:"Saved on this device for now; set it on each device."})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{testID:"voice-text-only",weight:"semibold",children:"The helper replies in text only. It never speaks."}),(0,x.jsx)(i.Row,{gap:8,wrap:!0,style:{marginTop:8},children:(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Show the microphone explanation again",onPress:()=>o.setMicExplained(!1)})})]}),(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{weight:"semibold",children:"Privacy"}),(0,x.jsxs)(i.Muted,{children:["What is said while the button is held (up to 30 seconds) is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. Each device asks once to use the microphone. ",(0,u.canListen)()?'This device can listen.':'This device can\u2019t listen, so the button offers \u201ctype instead\u201d.']})]})]})},_e.DraftsPage=function(){const{rid:e,me:o,role:h}=(0,f.useCtx)(6e4),p=(0,r.useDrafts)(e=>e.drafts),u=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[j,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=p.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),C='owner'===h||'manager'===h,D=e=>e.supplier?d.SUPPLIER_PORTALS.find(s=>s.id===e.supplier):void 0,P=e=>(0,x.jsx)(i.Card,{children:(0,x.jsxs)(n.default,{testID:`draft-${e.id}`,style:{gap:6},children:[(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Badge,{label:r.DRAFT_LABEL[e.kind],kind:"gold"}),'draft'!==e.status?(0,x.jsx)(i.Badge,{label:'approved'===e.status?'Approved':'Dismissed',kind:'approved'===e.status?'ok':'neutral'}):null]}),(0,x.jsx)(i.T,{weight:"semibold",children:e.title}),e.lines.map((s,t)=>(0,x.jsxs)(i.T,{size:15,children:['shopping'===e.kind?'\u2022 ':'',s]},t)),(0,x.jsxs)(i.Muted,{children:["From ",e.by," (",e.app,"), ",b(e.at),e.decidedBy?` \xb7 ${e.status} by ${e.decidedBy}, ${b(e.decidedAt)}`:'']}),'draft'===e.status&&C?(0,x.jsxs)(i.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(i.Button,{small:!0,kind:"success",label:"Approve",testID:`draft-approve-${e.id}`,onPress:()=>y({d:e,status:'approved'})}),(0,x.jsx)(i.Button,{small:!0,kind:"secondary",label:"Dismiss",testID:`draft-dismiss-${e.id}`,onPress:()=>y({d:e,status:'dismissed'})}),D(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${D(e).name} ordering`,onPress:()=>{t.default.openURL(D(e).links.order)}}):null]}):null]})},e.id);return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Nothing here has been sent, ordered or paid",children:"The voice helper and the Assistant save bookings, supplier shopping lists, offers, events, specials, messages and payments here for you to check. Approving marks it approved and takes you to the right screen; you still do the booking, the order or the post yourself."}),C?null:(0,x.jsx)(i.Banner,{kind:"warn",title:"Owners and managers approve drafts",children:"You can see the drafts but not approve them."}),B.length?B.map(P):(0,x.jsx)(i.Muted,{children:"No drafts waiting. Try holding the voice button and saying \u201cadd blue roll to the Booker list\u201d."}),S.length?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:k?'Hide approved and dismissed':`Show approved and dismissed (${S.length})`,onPress:()=>w(!k)}):null,k?S.map(P):null,(0,x.jsx)(i.Sheet,{visible:!!j,onClose:()=>y(null),title:'approved'===j?.status?'Approve this draft?':'Dismiss this draft?',children:j?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:j.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===j.status?`This marks it approved${v[j.d.kind]?` and opens ${v[j.d.kind].label}`:''}. Nothing is sent, ordered or paid automatically.`:'It moves to the dismissed list. Nothing is sent.'}),(0,x.jsx)(i.Button,{kind:'approved'===j.status?'success':'danger',label:'approved'===j.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{u(j.d.id,j.status,o.replace(' (example)',''));const e=v[j.d.kind];y(null),'approved'===j.status&&e&&c&&c(e.tab,e.sub)}}),(0,x.jsx)(i.Button,{kind:"secondary",label:"Back",onPress:()=>y(null)})]}):null})]})},_e.ShiftNotesPage=function(){const{rid:e}=(0,f.useCtx)(6e4),s=(0,h.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,h.useShiftNotes)(e=>e.setDone);return(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.Muted,{children:"Notes left for the next shift, by voice (\u201ctell the next shift the glass washer is leaking\u201d) or the Assistant. Kept on this device for now."}),s.length?s.slice(0,60).map(e=>(0,x.jsxs)(i.Card,{children:[(0,x.jsx)(i.T,{style:{textDecorationLine:e.done?'line-through':'none'},colour:e.done?o.colours.muted:o.colours.text,children:e.text}),(0,x.jsxs)(i.Row,{style:{justifyContent:'space-between',marginTop:6},children:[(0,x.jsxs)(i.Muted,{children:[e.by," (",e.app,"), ",b(e.at)]}),(0,x.jsx)(i.Button,{small:!0,kind:e.done?'ghost':'success',label:e.done?'Reopen':'Done',onPress:()=>t(e.id,!e.done)})]})]},e.id)):(0,x.jsx)(i.Muted,{children:"No shift notes yet."})]})};var s=_r(_d[0]),t=e(_r(_d[1])),n=e(_r(_d[2])),i=_r(_d[3]),o=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),l=_r(_d[7]),h=_r(_d[8]),p=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),f=_r(_d[12]),x=_r(_d[13]);const b=e=>new Date(e).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});const v={booking:{tab:'bookings',sub:null,label:'Bookings'},offer:{tab:'more',sub:'offers',label:'Specials & offers'},event:{tab:'more',sub:'events',label:'Events'},special:{tab:'more',sub:'specialsboard',label:'Specials board'},shopping:{tab:'more',sub:'suppliers',label:'Suppliers'}}},933,[30,239,127,813,821,907,1064,966,1065,1066,1067,918,954,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},934,[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}),_e.DesktopShell=function(){const{rid:e,r:c,role:g,today:_,now:$,meId:F,me:Q}=(0,z.useCtx)(3e4);(0,m.useTipsPosted)(e,_);const Y=(0,z.useSignedIn)();(0,x.useSoldOutLink)(!0,(Y?.name??Q).replace(' (example)',''));const[ee,te]=(0,a.useState)({kind:'tab',tab:'home'}),[se,ae]=(0,a.useState)(''),oe=(0,a.useRef)(null);(0,a.useEffect)(()=>{(0,z.ensureAttendance)(_,$),(0,M.ensureChat)($)},[_]),globalThis.__ccNow=$.getTime();const ne=(0,a.useCallback)((e,t=null)=>{if('more'===e&&t){const e=q[t];return void te(e?{kind:'edit',id:e}:{kind:'page',id:t})}te('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,a.useEffect)(()=>(S.useVoiceNav.setState({go:ne}),()=>S.useVoiceNav.setState({go:null})),[ne]),(0,a.useEffect)(()=>{D.PITCH&&(globalThis.__pitchGo=ne,globalThis.__deskGo=e=>te(e))},[ne]),(0,E.useAlertWatcher)(e,{nag:'staff'!==g}),(0,w.useScheduledNotices)({rid:e,staffId:Y?.id??'',name:Q,onOpen:()=>ne('more','orderlists')}),(0,y.useOffRotaAlerts)({enabled:'staff'!==g&&!!Y}),(0,a.useEffect)(()=>((0,T.warmDesktopStt)(),(0,C.installVoiceKeys)()),[]);const re=(0,a.useMemo)(()=>[...G,...U].map(e=>e.s),[]);(0,a.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void oe.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=re[Number(e.key)-1];return void(t&&(e.preventDefault(),te(t)))}if('z'===t&&!Z(e.target)){const t=(0,W.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!Z(e.target)){const t=(0,W.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[re]);const ie=I.PAGES.filter(e=>(!e.can||e.can(g))&&!q[e.id]),le=(0,a.useMemo)(()=>{const e=se.trim().toLowerCase(),t={};return ie.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[ie,se]),de=G.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(g)),ue=p.CAN.forecasts(g)?U:U.filter(e=>'rota'===e.s.id),ce='page'===ee.kind?(0,I.pageFor)(ee.id):void 0,be='tab'===ee.kind?G.find(e=>X(e.s,ee))?.label:'edit'===ee.kind?U.find(e=>X(e.s,ee))?.label:ce?.title,he='tab'===ee.kind?G.find(e=>X(e.s,ee))?.tip:'page'===ee.kind?`${ce?.sub??''}. Press ${(0,N.CMD)()}K to jump to any page, or hold Space and ask.`:'',fe=({label:e,s:t,n:s})=>{const a=X(t,ee);return(0,K.jsxs)(o.default,{accessibilityRole:"button",accessibilityState:{selected:a},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>te(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:a?A.colours.goldTint:e?A.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:a?A.colours.gold:'transparent'}),children:[(0,K.jsx)(f.T,{size:14,weight:a?'semibold':'regular',colour:a?A.colours.gold:A.colours.text,style:{flex:1},numberOfLines:1,children:e}),s?(0,K.jsxs)(f.T,{size:11,colour:A.colours.muted,children:[(0,N.CMD)(),s]}):null]})},ge=({t:e})=>(0,K.jsx)(f.T,{size:11,weight:"semibold",colour:A.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),pe='owner'===g?'OWNER':'manager'===g?'MANAGER':'STAFF';return(0,K.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:A.colours.bg},testID:"desktop-shell",children:[(0,K.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,K.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(f.Row,{gap:10,children:[(0,K.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsx)(f.T,{weight:"semibold",numberOfLines:1,children:c.name}),(0,K.jsx)(f.Row,{gap:6,children:(0,K.jsx)(l.AppBadge,{label:pe})})]})]}),(0,K.jsx)(u.PoweredBy,{}),(0,K.jsx)(s.TextInput,{ref:oe,testID:"side-filter",value:se,onChangeText:ae,placeholder:`Find a page (${(0,N.CMD)()}K)`,placeholderTextColor:A.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,K.jsxs)(n.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[se?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{t:"Run the day"}),de.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:t+1},e.label)),(0,K.jsx)(ge,{t:"Drag-and-drop editors"}),ue.map((e,t)=>(0,K.jsx)(fe,{label:e.label,s:e.s,n:de.length+t+1},e.label))]}),Object.entries(le).map(([e,t])=>(0,K.jsxs)(r.default,{children:[(0,K.jsx)(ge,{t:e}),t.map(e=>(0,K.jsx)(fe,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,K.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,K.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:A.colours.border},children:[(0,K.jsxs)(r.default,{style:{flex:1},children:[(0,K.jsx)(r.default,{testID:"desk-title",children:(0,K.jsx)(f.T,{size:24,weight:"bold",children:be??''})}),(0,K.jsxs)(f.Muted,{size:12,children:[Y?`Signed in as ${Y.name} \xb7 ${p.ROLE_LABEL[g]}`:`Preview \xb7 ${p.ROLE_LABEL[g]}`," \xb7 ",c.name]})]}),(0,K.jsxs)(r.default,{style:{alignItems:'flex-end'},children:[(0,K.jsx)(f.T,{size:15,weight:"bold",colour:A.colours.gold,children:"Talk to CoverCharge"}),(0,K.jsxs)(f.Muted,{size:12,children:["Hold Space, or ",(0,N.CMD)(),"\u21e7G"]})]}),(0,K.jsx)(v.VoiceSlot,{size:76})]}),(0,K.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[he?(0,K.jsx)(V.Tip,{children:he}):null,'edit'===ee.kind?(0,K.jsx)(J,{id:ee.id,rid:e,me:Q,role:'owner'===g?'owner':'manager',today:_,venue:c.name}):(0,K.jsxs)(n.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===ee.kind&&'home'===ee.tab?(0,K.jsx)(H.Dashboard,{go:ne}):null,'tab'===ee.kind&&'orders'===ee.tab?(0,K.jsx)(B.Orders,{}):null,'tab'===ee.kind&&'bookings'===ee.tab?(0,K.jsx)(R.Bookings,{}):null,'tab'===ee.kind&&'forecast'===ee.tab?(0,K.jsx)(O.Forecasts,{go:ne}):null,'tab'===ee.kind&&'chat'===ee.tab?(0,K.jsx)(M.Chat,{go:ne}):null,ce?(0,K.jsx)(ce.C,{go:ne}):'page'===ee.kind?(0,K.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,K.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==g?(0,K.jsx)(h.PrintHost,{rid:e}):null,'staff'!==g?(0,K.jsx)(b.AlertHost,{variant:"managers",rid:e,me:Q,onOpen:e=>ne('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,K.jsx)(L.AssistantSheet,{}),(0,K.jsx)(P.OnboardingHost,{go:ne}),(0,K.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),s=_r(d[1]),a=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),i=_r(d[6]),l=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]),f=_r(d[12]),g=_r(d[13]),p=_r(d[14]),x=_r(d[15]),m=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),S=_r(d[22]),v=_r(d[23]),T=_r(d[24]),E=_r(d[25]),D=_r(d[26]),A=_r(d[27]),L=_r(d[28]),R=_r(d[29]),M=_r(d[30]),z=_r(d[31]),H=_r(d[32]),O=_r(d[33]),P=_r(d[34]),B=_r(d[35]),I=_r(d[36]);_r(d[37]);var _=_r(d[38]),N=_r(d[39]),W=_r(d[40]),$=_r(d[41]),F=_r(d[42]),V=_r(d[43]),K=_r(d[44]);const G=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Hold Space and say \u201chow many covers tonight?\u201d for a quick answer without leaving this screen.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first. Say \u201cshow new orders\u201d to jump back any time.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber. Hold Space and say \u201caccept the 7 o\u2019clock\u201d.'},{label:'Forecasts',s:{kind:'tab',tab:'forecast'},tip:'The forecast learns from your past weeks; the more you trade, the better it gets.'},{label:'Staff chat',s:{kind:'tab',tab:'chat'},tip:'Messages here go to staff in the Staff app only, never by text or WhatsApp.'}],U=[{label:'Table plan',s:{kind:'edit',id:'plan'},tip:''},{label:'Menu',s:{kind:'edit',id:'menu'},tip:''},{label:'Rota',s:{kind:'edit',id:'rota'},tip:''},{label:'Branding & Display',s:{kind:'edit',id:'brand'},tip:''}],q={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},X=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),Z=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function J({id:e,rid:t,me:s,role:o,today:n,venue:i}){const l=(0,g.usePlan)(t),[u,b]=(0,a.useState)(0),[h,p]=(0,a.useState)('');return'menu'===e?(0,K.jsx)($.MenuEditor,{rid:t,me:s,role:o}):'rota'===e?(0,K.jsx)(F.RotaEditor,{today:n}):'brand'===e?(0,K.jsx)(_.BrandEditor,{rid:t}):(0,K.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,K.jsxs)(V.Tip,{children:["Drag tables to move them; they snap to the grid and line up with their neighbours (gold lines). Hold Option (Alt) to move freely. \u201cTidy up\u201d lines up a whole area. ",(0,N.CMD)(),"Z undoes, then Save."]}),h?(0,K.jsx)(f.T,{size:13,colour:A.colours.goldLight,children:h}):null,(0,K.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:A.colours.border,borderRadius:12,overflow:'hidden'},children:(0,K.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{g.useFloor.getState().setPlan(t,e),p('Table plan saved. The Display uses it straight away.'),b(e=>e+1)},onCancel:()=>{p('Changes thrown away.'),b(e=>e+1)}},u)})]})}},935,[878,874,30,263,151,127,289,970,860,1015,963,964,813,825,854,946,949,957,951,968,967,1068,966,962,1067,965,2,821,961,952,960,954,883,909,905,910,902,911,936,934,938,940,942,939,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.BrandEditor=function({rid:e}){const w=(0,l.useBrand)(e),k=(0,u.useOwner)(t=>t.branding[e]?.recent)??[],[D,B]=(0,t.useState)(w.accent);(0,t.useEffect)(()=>B(w.accent),[w.accent]);const[S,v]=(0,t.useState)(!1),[O,C]=(0,t.useState)(''),P=(0,j.useHistory)(()=>{const t=u.useOwner.getState().branding[e];return t?{...t}:void 0},t=>{u.useOwner.getState().setBranding(e,null),t&&u.useOwner.getState().setBranding(e,t)},'branding'),R=(0,h.checkAccent)(D,x.colours.bg,x.colours.onGold,x.colours.text),T=async t=>{t.preventDefault(),v(!1);const o=(0,b.filesOf)(t)[0];if(o)try{const t=await(0,b.shrinkImage)(o,512,'image/png'===o.type?'image/png':'image/jpeg');P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:t}),C('Logo updated in all apps.')}catch{C('That picture couldn\u2019t be read.')}else C('Drop a picture file (PNG or JPEG).')};return(0,y.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:30},testID:"desk-brand",children:[(0,y.jsx)(f.Tip,{children:"Drop your logo from Finder onto the box, then pick an accent colour. \u2318Z undoes. Display layout settings are further down."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(n.default,{style:{flex:1}}),O?(0,y.jsx)(c.T,{size:13,colour:x.colours.goldLight,children:O}):null,(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"brand-undo"}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"brand-redo"})]}),(0,y.jsxs)(n.default,{style:{flexDirection:'row',gap:16,flexWrap:'wrap'},children:[(0,y.jsxs)(n.default,{style:{width:320,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Logo"}),(0,y.jsxs)("div",{"data-testid":"brand-logo-drop",onDragOver:e=>{(0,b.hasFiles)(e)&&(e.preventDefault(),v(!0))},onDragLeave:()=>v(!1),onDrop:e=>{T(e)},style:(0,f.box)({height:200,borderRadius:14,border:`2px dashed ${S?x.colours.gold:x.colours.accentBorder}`,background:S?x.colours.accentBg:x.colours.surface,display:'flex',flexDirection:'column',alignItems:'center',justifyContent:'center',gap:10}),children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:96}),(0,y.jsx)("span",{style:(0,f.box)({fontSize:13,color:x.colours.muted}),children:"Drop a logo here (PNG with a clear background is best)"})]}),w.custom&&u.useOwner.getState().branding[e]?.logoUri?(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Use the standard logo",onPress:()=>{P.record('logo'),u.useOwner.getState().setBranding(e,{logoUri:void 0})}}):null,(0,y.jsx)(c.T,{weight:"semibold",children:"Preview"}),(0,y.jsxs)(n.default,{style:{backgroundColor:x.colours.bg,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12,gap:8},children:[(0,y.jsxs)(c.Row,{gap:10,children:[(0,y.jsx)(l.RestaurantLogo,{rid:e,size:44}),(0,y.jsx)(c.T,{weight:"bold",children:w.name})]}),(0,y.jsx)(n.default,{style:{backgroundColor:D,borderRadius:10,padding:10,alignItems:'center'},children:(0,y.jsx)(c.T,{weight:"semibold",colour:R.onAccent,children:"Book a table"})})]})]}),(0,y.jsxs)(n.default,{style:{width:380,gap:10},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Accent colour"}),(0,y.jsx)(s.ColourPicker,{value:D,onChange:B,onCommit:t=>{t!==w.accent&&(P.record('accent colour'),u.useOwner.getState().setBranding(e,{accent:t,recent:(0,h.pushRecent)(k,t)}),C(`Accent set to ${t}.`))},quick:l.ACCENTS,recent:k}),R.tips.length?(0,y.jsx)(c.Banner,{kind:"warn",children:R.tips.join(' ')}):(0,y.jsx)(c.Muted,{size:12,children:"Easy to read on the dark background."})]})]}),(0,y.jsxs)(n.default,{style:{maxWidth:760,gap:8},children:[(0,y.jsx)(c.T,{size:18,weight:"bold",children:"Display layout"}),(0,y.jsx)(p.DisplaySettingsPage,{})]})]})};var t=r(d[0]),o=e(r(d[1])),n=e(r(d[2])),s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7]),p=r(d[8]),x=r(d[9]),b=r(d[10]),j=r(d[11]),f=r(d[12]),y=r(d[13])},936,[30,151,127,922,860,813,854,1047,903,821,937,938,939,24]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dragData",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"readDrag",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"filesOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"hasFiles",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"readDataUrl",{enumerable:!0,get:function(){return i}}),_e.shrinkImage=async function(e,t=1024,r="image/jpeg"){const n=await i(e),o=await new Promise((e,t)=>{const r=new Image;r.onload=()=>e(r),r.onerror=t,r.src=n}),s=Math.min(1,t/Math.max(o.width,o.height)),c=document.createElement('canvas');return c.width=Math.round(o.width*s),c.height=Math.round(o.height*s),c.getContext('2d').drawImage(o,0,0,c.width,c.height),c.toDataURL(r,.82)};const e=(e,t,r)=>{try{e.dataTransfer.setData('text/plain',`${t}:${r}`),e.dataTransfer.effectAllowed='copyMove'}catch{}},t=e=>{const t=e.dataTransfer?.getData('text/plain')??'',r=t.indexOf(':');return r>0?{kind:t.slice(0,r),id:t.slice(r+1)}:null},r=e=>Array.from(e.dataTransfer?.files??[]).filter(e=>/^image\//.test(e.type)),n=e=>Array.from(e.dataTransfer?.types??[]).includes('Files'),i=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(String(n.result)),n.onerror=()=>r(n.error),n.readAsDataURL(e)})},937,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"activeUndo",{enumerable:!0,get:function(){return u}}),e.useHistory=function(u,c,s="change",l=60){const o=(0,t.useRef)([]),f=(0,t.useRef)([]),[,h]=(0,t.useState)(0),[v,b]=(0,t.useState)(''),w=(0,t.useRef)(u);w.current=u;const R=(0,t.useRef)(c);R.current=c;const p=(0,t.useCallback)((t=s)=>{o.current=[...o.current,{v:w.current(),what:t}].slice(-l),f.current=[],b(t),h(t=>t+1)},[s,l]),_=(0,t.useCallback)(()=>{const t=o.current.pop();t&&(f.current.unshift({v:w.current(),what:t.what}),R.current(t.v),b(`Undid: ${t.what}`),h(t=>t+1))},[]),k=(0,t.useCallback)(()=>{const t=f.current.shift();t&&(o.current.push({v:w.current(),what:t.what}),R.current(t.v),b(`Redid: ${t.what}`),h(t=>t+1))},[]),y={undo:_,redo:k,canUndo:o.current.length>0,canRedo:f.current.length>0,label:s,record:p,last:v};return(0,t.useEffect)(()=>(n=y,()=>{n===y&&(n=null)})),y};var t=r(d[0]);let n=null;const u=()=>n},938,[30]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Tip=function({children:e}){return(0,c.jsxs)(t.default,{testID:"desk-tip",style:{flexDirection:'row',gap:8,alignItems:'flex-start',borderWidth:1,borderColor:n.colours.accentBorder,backgroundColor:n.colours.accentBg,borderRadius:10,paddingHorizontal:12,paddingVertical:8},children:[(0,c.jsx)(l.T,{size:13,weight:"semibold",colour:n.colours.gold,children:"Tip"}),(0,c.jsx)(l.T,{size:13,colour:n.colours.text,style:{flex:1},children:e})]})},Object.defineProperty(_e,"box",{enumerable:!0,get:function(){return s}}),r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},l=r(d[2]),n=r(d[3]),c=r(d[4]);const s=(e={})=>({fontFamily:'Poppins_400Regular',color:n.colours.text,boxSizing:'border-box',...e})},939,[30,127,813,821,24]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuEditor=function({rid:e,me:o,role:s}){const a=(0,d.useAllMenu)(e),c=(0,l.useStore)(o=>o.restaurants.find(o=>o.id===e)),[u,h]=(0,t.useState)('dishes'),[D,O]=(0,t.useState)(null),[k,w]=(0,t.useState)(null),[C,I]=(0,t.useState)(''),z=(0,t.useMemo)(()=>{const e=[...c?.sections??[]];return a.forEach(o=>{e.includes(o.section)||e.push(o.section)}),e},[c?.sections,a]),M=a.filter(e=>!e.hidden||e.recipeCardId),P=e=>(0,p.hasRecipeCards)()?(0,p.recipeCards)().byMenuItem(e):void 0,T={name:o,role:s},R=(0,b.useHistory)(()=>({sections:[...z],items:Object.fromEntries(l.useStore.getState().menu.filter(o=>o.restaurantId===e).map(e=>{const o=a.find(o=>o.id===e.id)??e;return[e.id,{section:o.section,sort:e.sort,price:o.price,allergens:{...o.allergens},soldOut:e.soldOut,photo:P(e.id)?.photo}]}))}),o=>{const t=l.useStore.getState();c&&o.sections.join('|')!==(c.sections??[]).join('|')&&t.updateRestaurant(e,{sections:o.sections});for(const[e,s]of Object.entries(o.items)){const o=a.find(o=>o.id===e),n=t.menu.find(o=>o.id===e);if(!o||!n)continue;const r={};o.section!==s.section&&(r.section=s.section),n.sort!==s.sort&&(r.sort=s.sort),o.price!==s.price&&(r.price=s.price),JSON.stringify(o.allergens)!==JSON.stringify(s.allergens)&&(r.allergens=s.allergens),n.soldOut!==s.soldOut&&(r.soldOut=s.soldOut),Object.keys(r).length&&t.updateMenuItem(e,r);const d=P(e);d&&d.photo!==s.photo&&(0,p.recipeCards)().update(d.id,{photo:s.photo},T)}},'menu change'),B=(e,o,t)=>{const s=a.find(o=>o.id===e);if(!s)return;R.record(`moved ${s.name}`);const n=l.useStore.getState(),r=a.map(t=>t.id===e?{...t,section:o}:t);s.section!==o&&n.updateMenuItem(e,{section:o}),(0,y.reorder)(r,e,o,t).forEach(e=>n.updateMenuItem(e.id,{sort:e.sort})),I(`${s.name} moved${s.section!==o?` to ${o}`:''}.`)},F=async(o,t)=>{const s=P(o),n=a.find(e=>e.id===o);if(s&&n)try{const o=await(0,f.shrinkImage)(t,1024);R.record(`photo for ${n.name}`);const r=await(0,p.recipeCards)().savePhoto(e,s.id,{dataUrl:o,width:0,height:0,bytes:Math.round(.75*o.length)});await(0,p.recipeCards)().update(s.id,{photo:r},T),I(`Photo added to ${n.name}. The dish needs the Head Chef\u2019s sign-off again.`)}catch{I('That picture couldn\u2019t be read. Try a JPEG or PNG.')}else I('This dish has no recipe card yet, so it can\u2019t hold a photo.')},_=a.find(e=>e.id===D),E=({m:e})=>{const o=P(e.id),t=o?.photo&&(0,p.hasRecipeCards)()?(0,p.recipeCards)().photoSource(o.photo):null,s=t?.uri,n=D===e.id,r=k===`d:${e.id}`;return(0,S.jsxs)("div",{"data-testid":`menu-dish-${e.id}`,draggable:!0,onDragStart:o=>(0,f.dragData)(o,'dish',e.id),onClick:()=>O(e.id),onDragOver:o=>{o.preventDefault(),w(`d:${e.id}`)},onDragLeave:()=>w(null),onDrop:o=>{o.preventDefault(),o.stopPropagation(),w(null);const t=(0,f.filesOf)(o)[0];if(t)return void F(e.id,t);const s=(0,f.readDrag)(o);'dish'===s?.kind&&s.id!==e.id&&B(s.id,e.section,e.id)},style:(0,j.box)({display:'flex',alignItems:'center',gap:10,padding:'8px 10px',borderRadius:10,cursor:'grab',userSelect:'none',marginBottom:6,background:n?x.colours.goldTint:x.colours.tile,border:`1px solid ${r?x.colours.gold:n?x.colours.accentBorder:x.colours.hairline}`,borderTop:r?`3px solid ${x.colours.gold}`:void 0}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted,fontSize:16}),children:"\u283f"}),(0,S.jsx)("div",{style:(0,j.box)({width:40,height:40,borderRadius:8,background:x.colours.surface2,backgroundImage:s?`url(${s})`:void 0,backgroundSize:'cover',backgroundPosition:'center',flexShrink:0,display:'flex',alignItems:'center',justifyContent:'center',fontSize:10,color:x.colours.muted}),children:s?'':'photo'}),(0,S.jsxs)("div",{style:(0,j.box)({flex:1,minWidth:0}),children:[(0,S.jsx)("div",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',fontSize:14,whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',textDecoration:e.soldOut?'line-through':void 0}),children:e.name}),(0,S.jsxs)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[Object.keys(e.allergens).length?Object.keys(e.allergens).length+' allergens':'No allergens',e.hidden?' \xb7 hidden':'']})]}),e.soldOut?(0,S.jsx)("span",{style:(0,j.box)({fontSize:11,color:x.colours.amber,border:`1px solid ${x.colours.amber}`,borderRadius:6,padding:'1px 6px'}),children:"Sold out"}):null,(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_600SemiBold',color:x.colours.gold,fontSize:14}),children:v(e.price)})]})};return(0,S.jsxs)(n.default,{style:{flex:1,gap:10},testID:"desk-menu",children:[(0,S.jsx)(j.Tip,{children:"Drag a dish (\u283f) to put it in order or onto another section. Drag a section name to move the whole section. Drop a photo from Finder onto a dish. \u2318Z undoes."}),(0,S.jsxs)(r.Row,{gap:8,children:[(0,S.jsx)(r.Chip,{label:"Dishes",selected:'dishes'===u,onPress:()=>h('dishes'),testID:"menu-tab-dishes"}),(0,S.jsx)(r.Chip,{label:"Sold out & counts",selected:'soldout'===u,onPress:()=>h('soldout'),testID:"menu-tab-soldout"}),(0,S.jsx)(n.default,{style:{flex:1}}),C?(0,S.jsx)(r.T,{size:13,colour:x.colours.goldLight,children:C}):null,(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!R.canUndo,onPress:R.undo,testID:"menu-undo"}),(0,S.jsx)(r.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!R.canRedo,onPress:R.redo,testID:"menu-redo"})]}),'soldout'===u?(0,S.jsx)(n.default,{style:{maxWidth:760},children:(0,S.jsx)(m.SoldOutList,{rid:e,by:o})}):(0,S.jsxs)(n.default,{style:{flex:1,flexDirection:'row',gap:14,minHeight:0},children:[(0,S.jsx)("div",{style:(0,j.box)({flex:1,overflowY:'auto',paddingRight:6}),"data-testid":"menu-sections",children:z.map(o=>{const t=M.filter(e=>e.section===o),s=k===`s:${o}`;return(0,S.jsxs)("div",{style:(0,j.box)({marginBottom:14}),onDragOver:e=>{e.preventDefault(),w(`s:${o}`)},onDragLeave:()=>w(null),onDrop:t=>{t.preventDefault(),w(null);const s=(0,f.readDrag)(t);var n,r;'dish'===s?.kind&&B(s.id,o,null),'section'===s?.kind&&s.id!==o&&(n=s.id,r=o,c&&(R.record(`moved section ${n}`),l.useStore.getState().updateRestaurant(e,{sections:(0,y.moveSection)(z,n,r)}),I(`${n} moved.`)))},children:[(0,S.jsxs)("div",{draggable:!0,onDragStart:e=>(0,f.dragData)(e,'section',o),"data-testid":`menu-section-${o}`,style:(0,j.box)({display:'flex',alignItems:'center',gap:8,padding:'6px 4px',cursor:'grab',borderBottom:`${s?2:1}px solid ${s?x.colours.gold:x.colours.border}`,marginBottom:8}),children:[(0,S.jsx)("span",{style:(0,j.box)({color:x.colours.muted}),children:"\u283f"}),(0,S.jsx)("span",{style:(0,j.box)({fontFamily:'Poppins_700Bold',fontSize:16,color:x.colours.goldMuted,letterSpacing:.5,textTransform:'uppercase'}),children:o}),(0,S.jsxs)("span",{style:(0,j.box)({fontSize:12,color:x.colours.muted}),children:[t.length," dishes"]})]}),t.map(e=>(0,S.jsx)(E,{m:e},e.id)),t.length?null:(0,S.jsx)("div",{style:(0,j.box)({fontSize:12,color:x.colours.muted,padding:8,border:`1px dashed ${x.colours.border}`,borderRadius:8}),children:"Drop a dish here"})]},o)})}),(0,S.jsx)(n.default,{style:{width:340,gap:10},testID:"menu-inspector",children:_?(0,S.jsx)($,{rid:e,m:_,me:o,record:R.record,onPhoto:e=>{F(_.id,e)}},_.id):(0,S.jsx)(r.Muted,{children:"Click a dish to change its price, allergens and sold-out state."})})]})]})};var e,o=_r(_d[0]),t=_r(_d[1]),s=_r(_d[2]),n=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[3]),d=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),m=_r(_d[11]),x=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),j=_r(_d[15]),y=_r(_d[16]),S=_r(_d[17]);const v=e=>null==e?'Board':`\xa3${(e/100).toFixed(2)}`,D={none:'contains',contains:'may',may:void 0};function $({rid:e,m:s,me:d,record:p,onPhoto:m}){const[b,y]=(0,t.useState)(null==s.price?'':(s.price/100).toFixed(2)),v=(e,o)=>{p(o),l.useStore.getState().updateMenuItem(s.id,e)},$=(0,c.dishUsesFor)(e).find(e=>e.id===s.id),O=(0,c.itemsFor)(e),k=()=>{const e=b.trim(),o=''===e?null:Number(e.replace('\xa3',''));if(null!==o&&(!isFinite(o)||o<0))return void y(null==s.price?'':(s.price/100).toFixed(2));const t=null==o?null:Math.round(100*o);t!==s.price&&v({price:t},`price of ${s.name}`)},w=e=>{const o=s.allergens[e]??'none',t=D[o],n={...s.allergens};t?n[e]=t:delete n[e],v({allergens:n},`allergens on ${s.name}`)};return(0,S.jsxs)(n.default,{style:{gap:10,backgroundColor:x.colours.surface,borderRadius:12,borderWidth:1,borderColor:x.colours.border,padding:12},children:[(0,S.jsx)(r.T,{size:17,weight:"bold",children:s.name}),(0,S.jsxs)(r.Muted,{size:12,children:[s.section,s.signOff?` \xb7 signed off by ${s.signOff.by}`:' \xb7 awaiting Head Chef sign-off']}),(0,S.jsx)("div",{onDragOver:e=>{(0,f.hasFiles)(e)&&e.preventDefault()},onDrop:e=>{e.preventDefault();const o=(0,f.filesOf)(e)[0];o&&m(o)},"data-testid":"menu-photo-drop",style:(0,j.box)({border:`1px dashed ${x.colours.accentBorder}`,borderRadius:10,padding:12,textAlign:'center',fontSize:12,color:x.colours.muted}),children:"Drop a photo from Finder here"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Price (\xa3)"}),(0,S.jsx)(o.TextInput,{testID:"menu-price",value:b,onChangeText:y,onBlur:k,onSubmitEditing:k,placeholder:"Blank = on the specials board",placeholderTextColor:x.colours.muted,style:[r.styles.input,{width:160}]})]}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Allergens"}),(0,S.jsx)(r.Muted,{size:12,children:"Click to cycle: contains \u2192 may contain \u2192 none. Changes go to the recipe card and need the Head Chef\u2019s sign-off."}),(0,S.jsx)(r.Row,{gap:6,wrap:!0,children:h.ALLERGENS.map(e=>{const o=s.allergens[e.id];return(0,S.jsx)(r.Chip,{testID:`menu-al-${e.id}`,label:'may'===o?`${e.short} (may)`:e.short,selected:!!o,onPress:()=>w(e.id)},e.id)})})]}),(0,S.jsx)(r.Toggle,{label:"Sold out now",value:s.soldOut,onChange:e=>{p(`sold out ${s.name}`),(0,a.setSoldOut)(s.id,e,d)},testID:"menu-soldout"}),(0,S.jsxs)(n.default,{style:{gap:4},children:[(0,S.jsx)(r.T,{size:13,weight:"semibold",children:"Sold-out link"}),$&&$.uses.length?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r.Muted,{size:12,children:(0,u.usesText)($.uses,O)}),(0,S.jsx)(r.Badge,{kind:"gold",label:"Sells out on its own when the count runs out"})]}):(0,S.jsx)(r.Muted,{size:12,children:"Not linked to a count. Link it in \u201cSold out & counts\u201d."})]})]})}},940,[874,30,127,813,1019,870,946,1069,1070,814,831,1035,821,937,938,939,941,24]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},941,[854]); +__d(function(g,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.RotaEditor=function({today:e}){const y=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[$,j]=(0,t.useState)((0,i.mondayOfDate)(e)),[v,k]=(0,t.useState)(null),[w,D]=(0,t.useState)(''),B=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),O=b.map((e,t)=>(0,i.addDays)($,t)),P=(e,t,o)=>{e.preventDefault(),k(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=y.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=$&&e.date<=O[6]),I=T.filter(e=>!e.published||e.changed).length;return(0,p.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,p.jsx)(h.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,p.jsxs)(s.Row,{gap:8,children:[(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>j((0,i.addDays)($,-7))}),(0,p.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date($+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>j((0,i.addDays)($,7))}),(0,p.jsx)(d.default,{style:{flex:1}}),w?(0,p.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:w}):null,(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!B.canUndo,onPress:B.undo,testID:"rota-undo"}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!B.canRedo,onPress:B.redo,testID:"rota-redo"}),(0,p.jsx)(s.Button,{small:!0,label:I?`Publish (${I})`:'Published',disabled:!I,onPress:()=>{B.record('published the week');const e=i.useOwner.getState().publishWeek($);D(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,p.jsx)("div",{style:(0,h.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,p.jsxs)("div",{style:(0,h.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,p.jsx)("div",{style:(0,h.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),O.map((t,o)=>(0,p.jsxs)("div",{style:(0,h.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[b[o]," ",Number(t.slice(8))]},t)),y.map(e=>(0,p.jsxs)(o.default.Fragment,{children:[(0,p.jsxs)("div",{style:(0,h.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,p.jsx)("div",{style:(0,h.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,p.jsx)("div",{style:(0,h.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),O.map(t=>{const o=`${e.id}|${t}`,d=T.filter(o=>o.staffId===e.id&&o.date===t);return(0,p.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',k(o)},onDragLeave:()=>k(null),onDrop:o=>P(o,e.id,t),style:(0,h.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,p.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,h.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,p.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),h=r(_d[8]),f=r(_d[9]),p=r(_d[10]);const b=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],x=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},942,[30,127,813,854,1071,821,937,938,939,941,24]); \ No newline at end of file diff --git a/rupeeroom/owner-app/_expo/static/js/web/index-e196fd8b19ecc6189ee08bcd5ff2f404.js b/rupeeroom/owner-app/_expo/static/js/web/index-e196fd8b19ecc6189ee08bcd5ff2f404.js new file mode 100644 index 0000000000000000000000000000000000000000..7bf89ab1699e6c796b29ce846baaabc589ec891a --- /dev/null +++ b/rupeeroom/owner-app/_expo/static/js/web/index-e196fd8b19ecc6189ee08bcd5ff2f404.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 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,877,876,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,"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,'')}},876,[5,878,860,30,122,263,127,287,820,821,813,879,880,24]); \ No newline at end of file diff --git a/rupeeroom/owner-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js b/rupeeroom/owner-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js new file mode 100644 index 0000000000000000000000000000000000000000..4d9a73d71ffd62c3089157ea2588c631ec337d88 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js b/rupeeroom/owner-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js new file mode 100644 index 0000000000000000000000000000000000000000..a534e34d23b28c8163bfa4753865db324a0513e1 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js b/rupeeroom/owner-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js new file mode 100644 index 0000000000000000000000000000000000000000..3ab717191bcd90764a474563c7290eb5929d59d2 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js b/rupeeroom/owner-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js new file mode 100644 index 0000000000000000000000000000000000000000..ea3361d55a8675d860bd00d378b50912a5428b0e --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js b/rupeeroom/owner-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js new file mode 100644 index 0000000000000000000000000000000000000000..7bfbd86f471e6c28562bfd7ecbbd06fb9e2bc062 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js b/rupeeroom/owner-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js new file mode 100644 index 0000000000000000000000000000000000000000..800311dcfb451004ce8b256207faf0bc18c1ac2e --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js b/rupeeroom/owner-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js new file mode 100644 index 0000000000000000000000000000000000000000..9b0d57b1966cd21e63f1a8d5d559c2dde5583bff --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js b/rupeeroom/owner-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js new file mode 100644 index 0000000000000000000000000000000000000000..0e02e37f4afff03dd2b7a53da0e5ea294dec6428 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js b/rupeeroom/owner-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js new file mode 100644 index 0000000000000000000000000000000000000000..abf259f4e2342c74ccd15500939171c44aad5f27 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/apple-touch-icon.png b/rupeeroom/owner-app/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b365f35becdf94ec3f7e9ca99683bb2d6db493c7 Binary files /dev/null and b/rupeeroom/owner-app/apple-touch-icon.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png b/rupeeroom/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png new file mode 100644 index 0000000000000000000000000000000000000000..2e446272d0a845beb3088e0cee34196647e29c23 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png b/rupeeroom/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png new file mode 100644 index 0000000000000000000000000000000000000000..b1c9eb1238803902dadd5dea27bc70e2534fe9c9 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png b/rupeeroom/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png new file mode 100644 index 0000000000000000000000000000000000000000..f550533d646bcb7d389c44eecdb00faa8e36c8f7 --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:144e6f6ee416b17ca8788dbd6604d155a549776a1e854022f319dd3b28aff3d0 +size 1171759 diff --git a/rupeeroom/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png b/rupeeroom/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png new file mode 100644 index 0000000000000000000000000000000000000000..e6e9f97e4ad6abf195ee05237a360fe8f537fb85 --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3282ea7bd813e92290ac444934e842d56c700c5cf88b1449e1ec95444644f08f +size 250526 diff --git a/rupeeroom/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png b/rupeeroom/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png new file mode 100644 index 0000000000000000000000000000000000000000..e1ae9637ced07300241f6f312bf00149b2edcc3e --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 +size 358247 diff --git a/rupeeroom/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png b/rupeeroom/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png new file mode 100644 index 0000000000000000000000000000000000000000..bcc9605c6f772578dd8ba94d2a8513e04a4926ce --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f029f7a7153fc60b56a630c266c0b5eccb93e0b99bbf651cff6d5fc9f9844627 +size 120270 diff --git a/rupeeroom/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png b/rupeeroom/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png new file mode 100644 index 0000000000000000000000000000000000000000..0b50942b9ddfccd10a213cb26ff35c8b5b95abc5 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png b/rupeeroom/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png new file mode 100644 index 0000000000000000000000000000000000000000..eaa9f86fe6bf1d3686094aade77c5affd33a83e9 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png b/rupeeroom/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png new file mode 100644 index 0000000000000000000000000000000000000000..b8f03a0d4fc5f27c9e12ed2c9608768e4ea99b13 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png b/rupeeroom/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png new file mode 100644 index 0000000000000000000000000000000000000000..d8d873eb2a092b421971a45e74cc781ac1e662ce --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png b/rupeeroom/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png new file mode 100644 index 0000000000000000000000000000000000000000..1bc0d9301938d1b596ec309c50666999e6d21f91 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png b/rupeeroom/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png new file mode 100644 index 0000000000000000000000000000000000000000..e2044a8d09a621b585b0f5e8e4b9872d48f1f660 --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b80e0478632d04767e419259066f7d65d69b021d3d5fa28a1c551f6975c0bcc +size 199939 diff --git a/rupeeroom/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png b/rupeeroom/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png new file mode 100644 index 0000000000000000000000000000000000000000..e9d4883b54b031792f87b1f82dffee02a5061457 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png b/rupeeroom/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png new file mode 100644 index 0000000000000000000000000000000000000000..4baf091ce529428b971b586128453ce814fff020 --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49dc0730ea9f262a80daceece5bcb106e30152ad3c5d8e67815479c3694d6f8a +size 814344 diff --git a/rupeeroom/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png b/rupeeroom/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png new file mode 100644 index 0000000000000000000000000000000000000000..4baf091ce529428b971b586128453ce814fff020 --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49dc0730ea9f262a80daceece5bcb106e30152ad3c5d8e67815479c3694d6f8a +size 814344 diff --git a/rupeeroom/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png b/rupeeroom/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png new file mode 100644 index 0000000000000000000000000000000000000000..d8d60b04ed9846958359df66871b6ab394647f3e --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f781f4e6fbb1985779392891126553415f6259e5a56dbbb84fcaa7f2df3cc0ff +size 1100170 diff --git a/rupeeroom/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png b/rupeeroom/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png new file mode 100644 index 0000000000000000000000000000000000000000..bfd7d6c76aa6e67d9fade93cbfa18ed06c22373e --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92e2a382d922f52c08f9b6a7027e8d02fde5838279ec6cbd259316d307a5a3b6 +size 123819 diff --git a/rupeeroom/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png b/rupeeroom/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png new file mode 100644 index 0000000000000000000000000000000000000000..590e0a14d8a11a4c7dfca5af0fff386f6a3745cf --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png b/rupeeroom/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png new file mode 100644 index 0000000000000000000000000000000000000000..72c07bb4c5de417a700e024030f077064d431eca --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png b/rupeeroom/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png new file mode 100644 index 0000000000000000000000000000000000000000..1fef9aa933df510cfa5ba55cbfbc5cbff8650358 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png b/rupeeroom/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png new file mode 100644 index 0000000000000000000000000000000000000000..5d69e071543c661a62c2867a9d18caf668fcabfd Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png b/rupeeroom/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png new file mode 100644 index 0000000000000000000000000000000000000000..1a9cfd3eb85d39201414d471e3b0fdd04fa6fc0a --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png b/rupeeroom/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png new file mode 100644 index 0000000000000000000000000000000000000000..ea53304d845f739a27d457d23301c62c0251dc30 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png b/rupeeroom/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png new file mode 100644 index 0000000000000000000000000000000000000000..76b6e345536ebcaa68676b3cc2be7bb034beac42 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png differ diff --git a/rupeeroom/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png b/rupeeroom/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png new file mode 100644 index 0000000000000000000000000000000000000000..41eb90d496d436c5a1c9bd75a7a7d582a87cf8b2 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png b/rupeeroom/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png new file mode 100644 index 0000000000000000000000000000000000000000..a3469248aaae9eddb25cb731a5c97aa238999047 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png b/rupeeroom/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png new file mode 100644 index 0000000000000000000000000000000000000000..293f7b8d442acc72587c0fb8cd54be2151fa8721 --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a36975639adbc7f97caf9db03aaea46b856b6fcb57d9cae4bf9cb390e3bb2c59 +size 153340 diff --git a/rupeeroom/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png b/rupeeroom/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png new file mode 100644 index 0000000000000000000000000000000000000000..f8a219f58bffefd58c5a0b88c2bcd0386b0981e3 --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:396e9806beea65b2c1bd296b3e16de5780bd4e6c7ca3879f55226dc3a3ccd131 +size 127507 diff --git a/rupeeroom/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png b/rupeeroom/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png new file mode 100644 index 0000000000000000000000000000000000000000..121861c905e8064a9592990f18871a26aa2a78b8 --- /dev/null +++ b/rupeeroom/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e9647df1989d384a28bf05427e5ecd0e43e6423aacfa47dc8d6d4126ab3bb6a +size 213177 diff --git a/rupeeroom/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png b/rupeeroom/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png new file mode 100644 index 0000000000000000000000000000000000000000..adbf5b12d5896e877b06bb17e331b9fd5bb78b3b --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png b/rupeeroom/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png new file mode 100644 index 0000000000000000000000000000000000000000..850387113149eb9b7d42f28791bbd7240675b494 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png b/rupeeroom/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png new file mode 100644 index 0000000000000000000000000000000000000000..399d860a2021715fdd9dbe901ac330ab234aa2b2 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png b/rupeeroom/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png new file mode 100644 index 0000000000000000000000000000000000000000..47d980eaa2835e4895b50488e62f23708063ce30 --- /dev/null +++ b/rupeeroom/owner-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/rupeeroom/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg b/rupeeroom/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3a47cda38c23e353eedc9c022023dcf179f050eb Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg differ diff --git a/rupeeroom/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg b/rupeeroom/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4a58aad923acc6cb9081adac3f49d06220661855 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg differ diff --git a/rupeeroom/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg b/rupeeroom/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg new file mode 100644 index 0000000000000000000000000000000000000000..571a38ece0dcbf6bdb9597f8a53639bf7794968b Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg differ diff --git a/rupeeroom/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg b/rupeeroom/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg new file mode 100644 index 0000000000000000000000000000000000000000..de493a0e2d82556309ba1be90e50bee5c79e7fb1 Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg differ diff --git a/rupeeroom/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg b/rupeeroom/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d2abede3262c1fe8ef9860158cd49eb0fbc7197b Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg differ diff --git a/rupeeroom/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg b/rupeeroom/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b6db6b2f00e358c3687e30ad0367d9fe1be930ba Binary files /dev/null and b/rupeeroom/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg differ diff --git a/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf b/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf new file mode 100644 index 0000000000000000000000000000000000000000..9d6366e199b9abeb268629513f12b69cbc6edd8b --- /dev/null +++ b/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:707fdc5c8bab57a90061c6a8ed7b70d5ffb82fc810e994e79f90bace890c255a +size 158240 diff --git a/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf b/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf new file mode 100644 index 0000000000000000000000000000000000000000..be10957dc7401ba736c1109dad3b5e2419ee477e --- /dev/null +++ b/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d909883de81344e0fbcfef30e931872e92d9aeecdf85b6dcf6e0b28c078e98e +size 156520 diff --git a/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf b/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf new file mode 100644 index 0000000000000000000000000000000000000000..1610c6423a4a34725dfcbc647c2e967f25b520d4 --- /dev/null +++ b/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:248c0244b350ec68880996aa6be6d7796274b49992d5fcbbefe251906aa4ea36 +size 155232 diff --git a/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf b/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf new file mode 100644 index 0000000000000000000000000000000000000000..acce884bab965ba94f76a09a0c0e29ea1808d396 --- /dev/null +++ b/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7219547ee25334cbac0fe4b3acf0bf631e48ebb622c71af038edaaa652c60875 +size 153944 diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png new file mode 100644 index 0000000000000000000000000000000000000000..f81adec02af440824e7d722dead33c3dd8ca1a7f Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png new file mode 100644 index 0000000000000000000000000000000000000000..13dfd1036a883a2fcd0014072cd4685bb048a74e Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png new file mode 100644 index 0000000000000000000000000000000000000000..f8441bc4f8c5ceed1c7dda29b5578ab302e3aa8f Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png new file mode 100644 index 0000000000000000000000000000000000000000..2a5bc8e77129da741157c757ad32d6afea9e1f95 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png new file mode 100644 index 0000000000000000000000000000000000000000..828e6322aaa3f44cda9483e9917473a82e08fb7f Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png new file mode 100644 index 0000000000000000000000000000000000000000..7c1fd8493d91711b33e87bd36d6e9ae4363ed656 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png new file mode 100644 index 0000000000000000000000000000000000000000..17e52e8550e5668f7117bcb755beb70c3a21c9e9 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png new file mode 100644 index 0000000000000000000000000000000000000000..01a7b6365ff7b18cc92aebac3b40a0c5138ef37c Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..c852b6ba50fd2ed8b46ad189685664bac454bf82 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..5f44c5464f7ea1331a49cd4709cfdd06b4517ec1 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png new file mode 100644 index 0000000000000000000000000000000000000000..d9af7b68070ef97abf8b805a32b99bdb7e2c340d Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png new file mode 100644 index 0000000000000000000000000000000000000000..4e3e31b8c10f677b1acc8374da60dbd114c6159d Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..12981d865dff2856895900be499751454c9528f7 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..b4f5127fdaace81e584b0087bff62afd10bc6847 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png new file mode 100644 index 0000000000000000000000000000000000000000..34396d478f85572dd50c67a708cd3a752d785005 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png new file mode 100644 index 0000000000000000000000000000000000000000..87a30caff95ccb0bc812f8ee77abbe8a7a8f0ac6 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png new file mode 100644 index 0000000000000000000000000000000000000000..8e3297fc67665cb61e5f4b0b84819c9cac7c2546 Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png differ diff --git a/rupeeroom/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png new file mode 100644 index 0000000000000000000000000000000000000000..ca8d666e4034705257bd2165771f56610101c4ea Binary files /dev/null and b/rupeeroom/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png differ diff --git a/rupeeroom/owner-app/brand-hero.png b/rupeeroom/owner-app/brand-hero.png new file mode 100644 index 0000000000000000000000000000000000000000..1a9cfd3eb85d39201414d471e3b0fdd04fa6fc0a --- /dev/null +++ b/rupeeroom/owner-app/brand-hero.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78d996318f4f42b1487cd98a0388afeed74b203f0affd751b560c4800d7245fc +size 202873 diff --git a/rupeeroom/owner-app/brand-logo.png b/rupeeroom/owner-app/brand-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..ea53304d845f739a27d457d23301c62c0251dc30 --- /dev/null +++ b/rupeeroom/owner-app/brand-logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e5d3c42d7bad91f89b6f8fa5175690af0715c0a3530e9cb29f03711c5485584 +size 328985 diff --git a/rupeeroom/owner-app/favicon.ico b/rupeeroom/owner-app/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..21ff1e159c3e9bb888668dc065a68550538f0918 Binary files /dev/null and b/rupeeroom/owner-app/favicon.ico differ diff --git a/rupeeroom/owner-app/icon-192.png b/rupeeroom/owner-app/icon-192.png new file mode 100644 index 0000000000000000000000000000000000000000..eeafdf488c93540fe07e5a750b748b36afeb7838 Binary files /dev/null and b/rupeeroom/owner-app/icon-192.png differ diff --git a/rupeeroom/owner-app/icon-512.png b/rupeeroom/owner-app/icon-512.png new file mode 100644 index 0000000000000000000000000000000000000000..a8ce723627788c0388c73097466b7b5d7def4e60 Binary files /dev/null and b/rupeeroom/owner-app/icon-512.png differ diff --git a/rupeeroom/owner-app/index.html b/rupeeroom/owner-app/index.html new file mode 100644 index 0000000000000000000000000000000000000000..d9211a0aa69d28f8753c3b5597ca5b720ad37bb6 --- /dev/null +++ b/rupeeroom/owner-app/index.html @@ -0,0 +1,35 @@ + + + + + + + The Rupee Room · Managers + + + + + + + + +
The Rupee Room

26A Wellington Square, Ayr, KA7 1HH

+ + + diff --git a/rupeeroom/owner-app/manifest.webmanifest b/rupeeroom/owner-app/manifest.webmanifest new file mode 100644 index 0000000000000000000000000000000000000000..6f6715063815ecd64849b4c38fe118081fe73bf1 --- /dev/null +++ b/rupeeroom/owner-app/manifest.webmanifest @@ -0,0 +1,23 @@ +{ + "id": "/rupeeroom/owner-app/", + "name": "The Rupee Room \u00b7 Managers", + "short_name": "The Rupee Room", + "start_url": "/rupeeroom/owner-app/index.html", + "scope": "/rupeeroom/owner-app/", + "display": "standalone", + "background_color": "#0C0C0C", + "theme_color": "#0C0C0C", + "lang": "en-GB", + "icons": [ + { + "src": "/rupeeroom/owner-app/icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/rupeeroom/owner-app/icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} \ No newline at end of file diff --git a/rupeeroom/owner-app/owner.html b/rupeeroom/owner-app/owner.html new file mode 100644 index 0000000000000000000000000000000000000000..d9211a0aa69d28f8753c3b5597ca5b720ad37bb6 --- /dev/null +++ b/rupeeroom/owner-app/owner.html @@ -0,0 +1,35 @@ + + + + + + + The Rupee Room · Managers + + + + + + + + +
The Rupee Room

26A Wellington Square, Ayr, KA7 1HH

+ + + diff --git a/rupeeroom/owner-app/sw.js b/rupeeroom/owner-app/sw.js new file mode 100644 index 0000000000000000000000000000000000000000..c39296591d4650fd97da7d14b02760bda65c1d32 --- /dev/null +++ b/rupeeroom/owner-app/sw.js @@ -0,0 +1,4 @@ +const V="cc-rupeeroom-owner-27dfbbb2002aacad",B="/rupeeroom/owner-app/",P=["/rupeeroom/owner-app/apple-touch-icon.png", "/rupeeroom/owner-app/favicon.ico", "/rupeeroom/owner-app/icon-192.png", "/rupeeroom/owner-app/icon-512.png", "/rupeeroom/owner-app/brand-logo.png", "/rupeeroom/owner-app/index.html", "/rupeeroom/owner-app/manifest.webmanifest", "/rupeeroom/owner-app/brand-hero.png", "/rupeeroom/owner-app/owner.html", "/rupeeroom/owner-app/_expo/static/js/web/__common-2d23b943f4d72c3b2882f2305cbf6fe0.js", "/rupeeroom/owner-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/rupeeroom/owner-app/_expo/static/js/web/index-69e9b3092653f025409ec2a95a47a2b9.js", "/rupeeroom/owner-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/rupeeroom/owner-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/rupeeroom/owner-app/_expo/static/js/web/index-e196fd8b19ecc6189ee08bcd5ff2f404.js", "/rupeeroom/owner-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/rupeeroom/owner-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/rupeeroom/owner-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js", "/rupeeroom/owner-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/rupeeroom/owner-app/_expo/static/js/web/index-c7e2d26b899345aed640aa075a97d318.js", "/rupeeroom/owner-app/_expo/static/js/web/[token]-3c722cbf6e54dbbeb30a3a3ee3ece670.js", "/rupeeroom/owner-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/rupeeroom/owner-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/rupeeroom/owner-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js", "/rupeeroom/owner-app/_expo/static/js/web/index-abf44c56ecfe3a6ee457b5a1c56cb955.js", "/rupeeroom/owner-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js", "/rupeeroom/owner-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/rupeeroom/owner-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js", "/rupeeroom/owner-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js", "/rupeeroom/owner-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js", "/rupeeroom/owner-app/_expo/static/js/web/index-0b428a479ff6b089927064a714ba6dc8.js", "/rupeeroom/owner-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/rupeeroom/owner-app/_expo/static/js/web/_layout-315e81be64744bc3c5b60506fcf7bbf0.js", "/rupeeroom/owner-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js", "/rupeeroom/owner-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/rupeeroom/owner-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/rupeeroom/owner-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js", "/rupeeroom/owner-app/_expo/static/js/web/index-10b44538fce9f65ce117321a623552df.js", "/rupeeroom/owner-app/_expo/static/js/web/basket-4d740db9aeba1d77232a0091a5892917.js", "/rupeeroom/owner-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/rupeeroom/owner-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/rupeeroom/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/rupeeroom/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/rupeeroom/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/rupeeroom/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/rupeeroom/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/rupeeroom/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/rupeeroom/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/rupeeroom/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/rupeeroom/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/rupeeroom/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/rupeeroom/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/rupeeroom/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/rupeeroom/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/rupeeroom/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/rupeeroom/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/rupeeroom/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/rupeeroom/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/rupeeroom/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/rupeeroom/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/rupeeroom/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/rupeeroom/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/rupeeroom/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/rupeeroom/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/rupeeroom/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/rupeeroom/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/rupeeroom/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/rupeeroom/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/rupeeroom/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/rupeeroom/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/rupeeroom/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/rupeeroom/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/rupeeroom/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/rupeeroom/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/rupeeroom/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/rupeeroom/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/rupeeroom/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/rupeeroom/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/rupeeroom/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/rupeeroom/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/rupeeroom/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/rupeeroom/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=>{if(!r.ok)throw Error('cache');return c.put(u,r)})))).then(()=>self.skipWaiting()))); +self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-rupeeroom-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).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/rupeeroom/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js b/rupeeroom/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js new file mode 100644 index 0000000000000000000000000000000000000000..cf2e6d94e8ca98606e0f8533c347ea51139bfdb7 --- /dev/null +++ b/rupeeroom/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/rupeeroom/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js b/rupeeroom/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js new file mode 100644 index 0000000000000000000000000000000000000000..1f0ffb8d5093d5a183dc2a9c0fb7062951faa5c1 --- /dev/null +++ b/rupeeroom/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/rupeeroom/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js b/rupeeroom/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ced89e3ab9de89839af726f375c95f9fe94a33 --- /dev/null +++ b/rupeeroom/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/rupeeroom/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js b/rupeeroom/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js new file mode 100644 index 0000000000000000000000000000000000000000..f0fcaabb7a82273cae61ec240fcab227e980b17e --- /dev/null +++ b/rupeeroom/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/rupeeroom/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js b/rupeeroom/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js new file mode 100644 index 0000000000000000000000000000000000000000..11f3bab84de38d8d8874b5ec2723dd3ea24b04a1 --- /dev/null +++ b/rupeeroom/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/rupeeroom/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js b/rupeeroom/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js new file mode 100644 index 0000000000000000000000000000000000000000..bbb9c120ac56fbfa8ba9e0a1c2e306f6558c994f --- /dev/null +++ b/rupeeroom/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/rupeeroom/staff-app/_expo/static/js/web/__common-08dc2a76040610821846b98bc52b3134.js b/rupeeroom/staff-app/_expo/static/js/web/__common-08dc2a76040610821846b98bc52b3134.js new file mode 100644 index 0000000000000000000000000000000000000000..87de22240a52964963a6dbad6c961ca200b95f3c --- /dev/null +++ b/rupeeroom/staff-app/_expo/static/js/web/__common-08dc2a76040610821846b98bc52b3134.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=u,e.requireRealData=function(){t=!0,u(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return c}}),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("rupeeroom");let t=n,o=n;const s=new Set;function u(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const c=()=>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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},1242,[]); +__d(function(s,t,r,e,i,a,c){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},1243,[]); +__d(function(s,t,r,e,i,a,n){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png",width:1024,height:1024,toString(){return this.uri}}},1244,[]); +__d(function(t,s,a,e,i,r,n){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png",width:1024,height:1024,toString(){return this.uri}}},1245,[]); +__d(function(e,t,r,s,i,o,u){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png",width:1024,height:1024,toString(){return this.uri}}},1246,[]); +__d(function(t,s,a,r,e,i,n){"use strict";e.exports={uri:"/rupeeroom/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:"/rupeeroom/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png",width:1024,height:1024,toString(){return this.uri}}},1248,[]); +__d(function(t,e,r,s,a,i,n){"use strict";a.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png",width:1024,height:1024,toString(){return this.uri}}},1249,[]); +__d(function(t,s,r,a,e,i,o){"use strict";e.exports={uri:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png",width:1024,height:1024,toString(){return this.uri}}},1252,[]); +__d(function(t,s,i,r,e,a,f){"use strict";e.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png",width:1024,height:1024,toString(){return this.uri}}},1253,[]); +__d(function(t,e,r,s,i,a,c){"use strict";i.exports={uri:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/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:"/rupeeroom/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png",width:1024,height:1024,toString(){return this.uri}}},1260,[]); +__d(function(r,s,t,e,i,a,c){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png",width:1024,height:1024,toString(){return this.uri}}},1261,[]); +__d(function(e,s,t,r,a,i,f){"use strict";a.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png",width:1024,height:1024,toString(){return this.uri}}},1262,[]); +__d(function(t,s,e,r,i,a,d){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png",width:1024,height:1024,toString(){return this.uri}}},1263,[]); +__d(function(r,t,a,e,s,i,o){"use strict";s.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png",width:1024,height:1024,toString(){return this.uri}}},1264,[]); +__d(function(t,e,s,r,i,o,d){"use strict";i.exports={uri:"/rupeeroom/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:"/rupeeroom/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png",width:1024,height:1024,toString(){return this.uri}}},1266,[]); +__d(function(t,r,e,s,i,n,o){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png",width:1600,height:900,toString(){return this.uri}}},1267,[]); +__d(function(t,e,r,s,i,o,a){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png",width:1024,height:1024,toString(){return this.uri}}},1268,[]); +__d(function(t,r,s,e,i,n,o){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png",width:1024,height:1024,toString(){return this.uri}}},1269,[]); +__d(function(e,t,r,s,i,a,c){"use strict";i.exports={uri:"/rupeeroom/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:"/rupeeroom/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png",width:1024,height:1024,toString(){return this.uri}}},1271,[]); +__d(function(t,e,r,s,i,a,c){"use strict";i.exports={uri:"/rupeeroom/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1272,[]); +__d(function(t,r,e,s,i,a,f){"use strict";i.exports={uri:"/rupeeroom/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=/ + + + + + + + +
The Rupee Room

26A Wellington Square, Ayr, KA7 1HH

+ + + diff --git a/rupeeroom/staff-app/manifest.webmanifest b/rupeeroom/staff-app/manifest.webmanifest new file mode 100644 index 0000000000000000000000000000000000000000..abaa04865c26cc9a9a9034c1b844618daaf7dff6 --- /dev/null +++ b/rupeeroom/staff-app/manifest.webmanifest @@ -0,0 +1,23 @@ +{ + "id": "/rupeeroom/staff-app/", + "name": "The Rupee Room \u00b7 Staff", + "short_name": "The Rupee Room", + "start_url": "/rupeeroom/staff-app/index.html", + "scope": "/rupeeroom/staff-app/", + "display": "standalone", + "background_color": "#0C0C0C", + "theme_color": "#0C0C0C", + "lang": "en-GB", + "icons": [ + { + "src": "/rupeeroom/staff-app/icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/rupeeroom/staff-app/icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} \ No newline at end of file diff --git a/rupeeroom/staff-app/sw.js b/rupeeroom/staff-app/sw.js new file mode 100644 index 0000000000000000000000000000000000000000..b3c36594554066f8c3dc1f6fcc3478c97dc58935 --- /dev/null +++ b/rupeeroom/staff-app/sw.js @@ -0,0 +1,4 @@ +const V="cc-rupeeroom-staff-40c587d0804b1f02",B="/rupeeroom/staff-app/",P=["/rupeeroom/staff-app/apple-touch-icon.png", "/rupeeroom/staff-app/favicon.ico", "/rupeeroom/staff-app/team.html", "/rupeeroom/staff-app/icon-192.png", "/rupeeroom/staff-app/icon-512.png", "/rupeeroom/staff-app/brand-logo.png", "/rupeeroom/staff-app/index.html", "/rupeeroom/staff-app/manifest.webmanifest", "/rupeeroom/staff-app/brand-hero.png", "/rupeeroom/staff-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/rupeeroom/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/rupeeroom/staff-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/rupeeroom/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/rupeeroom/staff-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/rupeeroom/staff-app/_expo/static/js/web/loyalty-679d7aa42c3cddfce82c3e1207d2d4cf.js", "/rupeeroom/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/rupeeroom/staff-app/_expo/static/js/web/index-5c634de6ad187be6c30eaf496c8cd727.js", "/rupeeroom/staff-app/_expo/static/js/web/refer-01535dadf727412eb1a34a61dcc6d53d.js", "/rupeeroom/staff-app/_expo/static/js/web/_layout-048210999277171fa490352150279406.js", "/rupeeroom/staff-app/_expo/static/js/web/index-a87fa345a0c01a0150c6e7893fe81768.js", "/rupeeroom/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/rupeeroom/staff-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/rupeeroom/staff-app/_expo/static/js/web/historicalBookingApi-2cd603463f8e0769db6a7ead5b608069.js", "/rupeeroom/staff-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js", "/rupeeroom/staff-app/_expo/static/js/web/profile-b82887516ccba728915e95d502c0081a.js", "/rupeeroom/staff-app/_expo/static/js/web/offers-eba5409c285b6031064e79e9f1ea19e0.js", "/rupeeroom/staff-app/_expo/static/js/web/index-1ca3ee630447c7d027b33568fe68d67d.js", "/rupeeroom/staff-app/_expo/static/js/web/merch-63634eac687774d71f27698748247bd2.js", "/rupeeroom/staff-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/rupeeroom/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js", "/rupeeroom/staff-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/rupeeroom/staff-app/_expo/static/js/web/__common-08dc2a76040610821846b98bc52b3134.js", "/rupeeroom/staff-app/_expo/static/js/web/basket-b17831f04afc73d6dfc4107f720f1f19.js", "/rupeeroom/staff-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/rupeeroom/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/rupeeroom/staff-app/_expo/static/js/web/index-a74042ee5c7fba23fb2d91d5ef984049.js", "/rupeeroom/staff-app/_expo/static/js/web/lost-817d2886f8973bfa630e2a69674dc584.js", "/rupeeroom/staff-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/rupeeroom/staff-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js", "/rupeeroom/staff-app/_expo/static/js/web/index-6373c4dab6b3f510ce3b82b6cf380086.js", "/rupeeroom/staff-app/_expo/static/js/web/index-d87f9d3a113cde7a590672183ebf209b.js", "/rupeeroom/staff-app/_expo/static/js/web/waitlist-119a5ba8531abfe81734f2106aefa476.js", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/rupeeroom/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/rupeeroom/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/rupeeroom/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/rupeeroom/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/rupeeroom/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/rupeeroom/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/rupeeroom/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/rupeeroom/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/rupeeroom/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/rupeeroom/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/rupeeroom/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/rupeeroom/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/rupeeroom/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/rupeeroom/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/rupeeroom/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/rupeeroom/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/rupeeroom/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/rupeeroom/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/rupeeroom/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/rupeeroom/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/rupeeroom/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/rupeeroom/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/rupeeroom/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/rupeeroom/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/rupeeroom/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/rupeeroom/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/rupeeroom/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/rupeeroom/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/rupeeroom/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/rupeeroom/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/rupeeroom/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/rupeeroom/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/rupeeroom/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/rupeeroom/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/rupeeroom/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/rupeeroom/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/rupeeroom/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/rupeeroom/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/rupeeroom/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/rupeeroom/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/rupeeroom/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/rupeeroom/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/rupeeroom/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/rupeeroom/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=>{if(!r.ok)throw Error('cache');return c.put(u,r)})))).then(()=>self.skipWaiting()))); +self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-rupeeroom-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).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/rupeeroom/staff-app/team.html b/rupeeroom/staff-app/team.html new file mode 100644 index 0000000000000000000000000000000000000000..3ccabe4b18e32a2765568a2f4f180285186de820 --- /dev/null +++ b/rupeeroom/staff-app/team.html @@ -0,0 +1,35 @@ + + + + + + + The Rupee Room · Staff + + + + + + + + +
The Rupee Room

26A Wellington Square, Ayr, KA7 1HH

+ + +