@oneclick.dev/cms-core-modules 0.0.82 → 0.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/{ContentEditor-Dk-iDEjl.mjs → ContentEditor-DPhhOkx3.mjs} +7085 -5936
  2. package/dist/{ContentEditor-4e80zFyn.js → ContentEditor-DrxtH_Hq.js} +42 -42
  3. package/dist/{Create-DtFzwxn_.mjs → Create-6uT9HWar.mjs} +35 -35
  4. package/dist/{Create-CRn2sMHp.js → Create-DuZ5nZrX.js} +1 -1
  5. package/dist/{DateFormatter-DfIwyrnF.mjs → DateFormatter-2B0R-DY4.mjs} +213 -406
  6. package/dist/DateFormatter-DbtOLV0L.js +1 -0
  7. package/dist/{Detail-Bxi7lG9x.js → Detail-BZ-iE9vf.js} +1 -1
  8. package/dist/{Detail-B4b_FLDa.mjs → Detail-C1Blq61w.mjs} +90 -90
  9. package/dist/{Detail-BayNaAg9.js → Detail-C8wQiDcv.js} +1 -1
  10. package/dist/{Detail-BwDnY42G.mjs → Detail-CJVMJDP7.mjs} +17 -17
  11. package/dist/{Detail-CnK-qbhE.js → Detail-CPqug27l.js} +1 -1
  12. package/dist/Detail-CjuhjPby.js +1 -0
  13. package/dist/{Detail-U0mgLKt6.mjs → Detail-CtItxMX4.mjs} +62 -63
  14. package/dist/{Detail-CVgWHbMC.mjs → Detail-Dnpnmy4-.mjs} +158 -158
  15. package/dist/{Entries-D7MHylQE.mjs → Entries-BkOPae4R.mjs} +49 -49
  16. package/dist/Entries-CcEW98F5.js +1 -0
  17. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-Ds7z0qeH.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-Bc946oSc.mjs} +1 -1
  18. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-C5YczjNb.js → NewReservationDialog.vue_vue_type_script_setup_true_lang-CqERfyYb.js} +1 -1
  19. package/dist/{Overview-CwCAeBnX.js → Overview-CA8wh_BI.js} +1 -1
  20. package/dist/{Overview-CgViRnNc.mjs → Overview-D4MFwRI_.mjs} +67 -68
  21. package/dist/{Overview-pCO_47Zt.js → Overview-Da0XexiT.js} +1 -1
  22. package/dist/Overview-DeQQ0FY3.js +1 -0
  23. package/dist/{Overview--XpvBbqz.mjs → Overview-DoOASlNz.mjs} +1 -3
  24. package/dist/{Overview-CuCQgqVp.mjs → Overview-gJSvftdE.mjs} +34 -34
  25. package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-B7ks5mbf.mjs → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cohhnd5x.mjs} +0 -1
  26. package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Vxubki_v.js → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js} +1 -1
  27. package/dist/{SeoHealth-CC0rW1AG.mjs → SeoHealth-Bc5chnaa.mjs} +14 -14
  28. package/dist/{SeoHealth-EZzDmPDM.js → SeoHealth-BkpJ1F2Y.js} +1 -1
  29. package/dist/TableView-BPWAx--G.mjs +5743 -0
  30. package/dist/TableView-D63QrVlK.js +4 -0
  31. package/dist/View-BL70u98U.js +1 -0
  32. package/dist/{View-DDXN0tKD.mjs → View-BO5N911y.mjs} +5 -5
  33. package/dist/{agenda-XqvbrU72.mjs → agenda-C5grvzSa.mjs} +166 -169
  34. package/dist/agenda-DXMwVWpN.js +1 -0
  35. package/dist/{availability-B-tRp8hB.mjs → availability-C1NqOFsQ.mjs} +81 -81
  36. package/dist/{availability-BiBbzEIM.js → availability-D_wnfLsH.js} +1 -1
  37. package/dist/cms-core-modules.css +1 -1
  38. package/dist/{exceptions-CLgeeUSy.mjs → exceptions-BIwMhYa4.mjs} +1 -1
  39. package/dist/{exceptions-wEQEVzIs.js → exceptions-Cn7zooEu.js} +1 -1
  40. package/dist/{index-DTzdHh6g.js → index-C9pSS15N.js} +2 -2
  41. package/dist/{index-N0NoDEsI.mjs → index-MwjeLHPP.mjs} +3 -3
  42. package/dist/index.cjs.js +1 -1
  43. package/dist/index.mjs +50 -36
  44. package/dist/orders-CG1QUCN8.js +1 -0
  45. package/dist/orders-CeixEBcU.mjs +396 -0
  46. package/dist/server-handlers.cjs.js +1 -1
  47. package/dist/server-handlers.mjs +292 -256
  48. package/dist/src/contentManager/config.d.ts +28 -0
  49. package/dist/src/contentManager/index.d.ts +28 -0
  50. package/dist/src/contentManager/server.d.ts +7 -0
  51. package/dist/src/server-handlers.d.ts +1 -0
  52. package/package.json +2 -2
  53. package/dist/DateFormatter-C9qfmQnP.js +0 -1
  54. package/dist/Detail-BcboL7NF.js +0 -1
  55. package/dist/Entries-BPkZ7Jg5.js +0 -1
  56. package/dist/Overview-B-8TLLjh.js +0 -1
  57. package/dist/TableView-Ce8H65pL.js +0 -586
  58. package/dist/TableView-DRQvOW85.mjs +0 -89190
  59. package/dist/View-DfzaVOzS.js +0 -1
  60. package/dist/agenda-wNFDKn0G.js +0 -1
  61. package/dist/floating-ui.dom-BO2Hr6mz.mjs +0 -1292
  62. package/dist/floating-ui.dom-CAr9LGoC.js +0 -1
  63. package/dist/index-DYpruS-A-CA2jEOA3.js +0 -88
  64. package/dist/index-DYpruS-A-D38FBcI3.mjs +0 -4211
  65. package/dist/index-YMaY4uuk-BgpTtr73.js +0 -1
  66. package/dist/index-YMaY4uuk-C_xV5K9Z.mjs +0 -1300
  67. package/dist/orders-Bqa3Z3tH.mjs +0 -356
  68. package/dist/orders-D5GJOZXN.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("@oneclick.dev/cms-kit"),a={class:"flex-1 bg-[#fcfcfc] dark:bg-muted/20 rounded-lg border shadow overflow-hidden mt-4"},d=e.defineComponent({__name:"View",setup(i){const s=r.useRoute(),{config:u}=r.useModule(),c=t=>{console.log("Form submitted with result:",t),document.documentElement.dataset.moduleOverlayMode==="true"&&window.parent.postMessage({type:"module-overlay:close"},"*")},l=e.computed(()=>Object.entries(s.query).reduce((t,[n,o])=>(t[n]=o,t),{}));return(t,n)=>{const o=e.resolveComponent("FormDisplayer");return e.openBlock(),e.createElementBlock("div",a,[e.createVNode(o,{settings:e.unref(u).formLayout,onFinish:c,variables:[],inputValues:l.value,style:{background:"transparent"}},null,8,["settings","inputValues"])])}}});exports.default=d;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),U=require("./DateFormatter-C9qfmQnP.js"),B=require("lucide-vue-next"),te=require("./EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js"),F=require("@oneclick.dev/cms-kit"),K=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Vxubki_v.js"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.js"),Q=require("./NewReservationDialog.vue_vue_type_script_setup_true_lang-C5YczjNb.js"),ne={class:"mb-6"},se={class:"flex items-end gap-px h-24 bg-muted/30 rounded-lg p-2 overflow-visible"},re=["onClick"],ae={class:"absolute -top-8 left-1/2 -translate-x-1/2 bg-popover border shadow-md rounded px-2 py-1 text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10"},le={class:"font-medium"},ie={class:"text-muted-foreground"},ce={class:"w-full flex-1 flex items-end justify-center"},de={key:1,class:"text-[10px] mt-1"},ue={key:0,class:"mt-2 text-sm text-muted-foreground flex items-center gap-2"},me={class:"font-medium text-foreground"},pe={class:"font-medium text-foreground"},fe=e.defineComponent({__name:"TimelineChart",props:{timeSlots:{},slotStats:{},selectedTimeSlot:{},maxSpots:{}},emits:["select","clear"],setup(u,{emit:h}){const v=h,y=s=>{v("select",s)},E=()=>{v("clear")};return(s,a)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",ne,[a[2]||(a[2]=e.createElementVNode("h3",{class:"font-semibold text-sm mb-2"},"Timeline",-1)),e.createElementVNode("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.timeSlots,o=>(e.openBlock(),e.createElementBlock("div",{key:o.startTime,class:"flex-1 min-w-0 flex flex-col items-center cursor-pointer group h-full relative",onClick:x=>y(o.startTime)},[e.createElementVNode("div",ae,[e.createElementVNode("div",le,e.toDisplayString(o.startTime),1),e.createElementVNode("div",ie,e.toDisplayString(u.slotStats[o.startTime]?.spots||0)+" spots",1)]),e.createElementVNode("div",ce,[e.createElementVNode("div",{class:e.normalizeClass(["w-full transition-all duration-200",[u.selectedTimeSlot===o.startTime?"bg-primary":u.slotStats[o.startTime]?.spots>0?"bg-primary/60 group-hover:bg-primary/80":"bg-muted-foreground/20 group-hover:bg-muted-foreground/30"]]),style:e.normalizeStyle({height:u.slotStats[o.startTime]?.spots>0?`${u.slotStats[o.startTime].spots/u.maxSpots*100}%`:"2px",minHeight:u.slotStats[o.startTime]?.spots>0?"4px":"2px"})},null,6)]),o.startTime.endsWith(":00")?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["text-[10px] text-muted-foreground mt-1 transition-colors truncate",{"text-primary font-medium":u.selectedTimeSlot===o.startTime}])},e.toDisplayString(o.label),3)):(e.openBlock(),e.createElementBlock("span",de," "))],8,re))),128))]),u.selectedTimeSlot?(e.openBlock(),e.createElementBlock("div",ue,[e.createVNode(i,{variant:"ghost",size:"icon",class:"h-6 w-6 p-0",onClick:E},{default:e.withCtx(()=>[e.createVNode(e.unref(B.X),{size:14})]),_:1}),e.createElementVNode("span",null,[a[0]||(a[0]=e.createTextVNode(" Showing ",-1)),e.createElementVNode("span",me,e.toDisplayString(u.slotStats[u.selectedTimeSlot]?.bookings||0),1),a[1]||(a[1]=e.createTextVNode(" bookings at ",-1)),e.createElementVNode("span",pe,e.toDisplayString(u.selectedTimeSlot),1)])])):e.createCommentVNode("",!0)])}}}),ve={class:"flex items-center justify-between mb-3"},ge={class:"font-semibold"},he={key:0,class:"text-muted-foreground font-normal"},xe={class:"relative mb-3"},ye={key:0,class:"flex items-center justify-center py-8"},ke={key:1,class:"text-center py-8 text-muted-foreground"},be={key:2,class:"space-y-2 max-h-80 overflow-y-auto"},_e=["onClick"],Ne={class:"flex items-start justify-between"},Ee={class:"flex-1"},we={class:"font-medium"},Ve={class:"text-sm text-muted-foreground"},Se={class:"text-sm text-muted-foreground"},Ce={class:"flex items-center gap-4"},Be={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},$e={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},De={class:"text-right"},Te={key:0,class:"inline-block px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"},ze={key:1,class:"inline-block px-2 py-1 text-xs rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"},Me={key:2,class:"inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},Le={key:3,class:"inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},Ie={key:4,class:"inline-block px-2 py-1 text-xs rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"},Ue={key:5,class:"text-sm font-medium mt-1"},je=e.defineComponent({__name:"BookingsList",props:{orders:{},filteredOrders:{},isLoading:{type:Boolean},selectedTimeSlot:{},searchQuery:{}},emits:["update:searchQuery","refresh"],setup(u,{emit:h}){const v=h,y=e.ref(null),E=i=>{v("update:searchQuery",i)},s=()=>{v("update:searchQuery","")},a=()=>{v("refresh")};return(i,o)=>{const x=e.resolveComponent("Input"),g=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ve,[e.createElementVNode("h3",ge,[o[0]||(o[0]=e.createTextVNode(" Bookings ",-1)),u.selectedTimeSlot||u.searchQuery?(e.openBlock(),e.createElementBlock("span",he," ("+e.toDisplayString(u.filteredOrders.length)+" of "+e.toDisplayString(u.orders.length)+") ",1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",xe,[e.createVNode(e.unref(B.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(x,{"model-value":u.searchQuery,placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9","onUpdate:modelValue":E},null,8,["model-value"]),u.searchQuery?(e.openBlock(),e.createBlock(g,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:s},{default:e.withCtx(()=>[e.createVNode(e.unref(B.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),u.isLoading?(e.openBlock(),e.createElementBlock("div",ye,[...o[1]||(o[1]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):u.filteredOrders.length===0?(e.openBlock(),e.createElementBlock("div",ke,e.toDisplayString(u.selectedTimeSlot?"No bookings for this time slot":"No bookings for this event"),1)):(e.openBlock(),e.createElementBlock("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.filteredOrders,p=>(e.openBlock(),e.createElementBlock("div",{key:p.res_id||p.id,class:"p-3 border rounded-lg hover:bg-muted/50 transition-colors",onClick:w=>e.unref(y).openDialog(p)},[e.createElementVNode("div",Ne,[e.createElementVNode("div",Ee,[e.createElementVNode("div",we,e.toDisplayString(p.customerInfo.firstName+" "+p.customerInfo.lastName||"Unknown Customer"),1),e.createElementVNode("div",Ve,e.toDisplayString(p.customerInfo.email),1),e.createElementVNode("div",Se,e.toDisplayString(p.customerInfo.phone),1),e.createElementVNode("div",Ce,[e.createElementVNode("div",Be,[e.createVNode(e.unref(B.Clock),{size:12}),e.createElementVNode("span",null,e.toDisplayString(p.startTime)+" - "+e.toDisplayString(p.endTime),1)]),e.createElementVNode("div",$e,[e.createVNode(e.unref(B.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(p.spots),1)])])]),e.createElementVNode("div",De,[p.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",Te,"Needs Approval")):p.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",ze,"Approved")):p.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",Me,"Rejected")):p.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",Le,"Cancelled")):(e.openBlock(),e.createElementBlock("span",Ie,"Pending")),p.reservationPrice||p.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",Ue," €"+e.toDisplayString(p.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,_e))),128))])),e.createVNode(K._sfc_main,{ref_key:"reservationDetailDialog",ref:y,onCancelled:a,onConfirmed:a,onRejected:a},null,512)])}}}),Fe={class:"flex items-center gap-4 mt-2 text-sm"},Re={class:"flex items-center gap-1"},Pe={key:0,class:"flex items-center gap-1"},Oe={class:"flex items-center gap-1"},Ae={class:"py-4"},qe=e.defineComponent({__name:"EventDialog",props:{resources:{default:()=>[]}},setup(u,{expose:h}){const v=u,{config:y}=F.useModule(),{params:E}=F.useModuleRoute(),s=F.useFirebaseIntegration(y.project),a=e.ref(!1),i=e.ref(null),o=e.ref([]),x=e.ref(!1),g=e.ref(null),p=e.ref("");e.provide("event",i);const w=e.computed(()=>{if(!i.value)return[];const d=i.value.resource?.interval||60,n=[],[c,_]=i.value.startTime.split(":").map(Number),[T,b]=i.value.endTime.split(":").map(Number),$=c*60+_,t=T*60+b;for(let l=$;l<t;l+=d){const f=Math.floor(l/60),m=l%60,N=Math.min(l+d,t),C=Math.floor(N/60),r=N%60,z=`${f.toString().padStart(2,"0")}:${m.toString().padStart(2,"0")}`,L=`${C.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`;n.push({startTime:z,endTime:L,label:z})}return n}),k=d=>{const n=d.getFullYear(),c=String(d.getMonth()+1).padStart(2,"0"),_=String(d.getDate()).padStart(2,"0");return`${n}-${c}-${_}`},M=e.computed(()=>{const d={};return w.value.forEach(n=>{d[n.startTime]={bookings:0,spots:0,orders:[]}}),o.value.forEach(n=>{w.value.forEach(c=>{n.startTime<c.endTime&&n.endTime>c.startTime&&(d[c.startTime].bookings++,d[c.startTime].spots+=n.spots||0,d[c.startTime].orders.push(n))})}),d}),V=e.computed(()=>Math.max(1,...Object.values(M.value).map(d=>d.spots))),S=e.computed(()=>{let d=o.value;return g.value&&(d=M.value[g.value]?.orders||[]),p.value.trim()&&(d=new K.Fuse(d,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone"],threshold:.3,ignoreLocation:!0}).search(p.value).map(c=>c.item)),d}),D=e.computed(()=>({spots:o.value.reduce((d,n)=>d+(n.spots||0),0),bookings:o.value.length})),R=d=>{g.value===d?g.value=null:g.value=d},I=()=>{g.value=null},P=async d=>{a.value=!0,i.value=d,g.value=null,p.value="",await j()},j=async()=>{if(i.value){x.value=!0,o.value=[];try{const d=E.value.id,n=k(new Date(i.value.date)),c=new Set;v.resources?.forEach(b=>{const $=`${b.id}_${n}`;c.add($)});const _=await s.find(y.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:d},{field:"status",operator:"==",value:"confirmed"},{field:"flattenedReservationDates",operator:"array-contains-any",value:Array.from(c)}]});let T=[];_.forEach(b=>{const $=b.reservations?.filter(t=>t.date===n)||[];console.log("dateReservations",$),$.forEach(t=>{const l=v.resources.find(f=>f.id===t.resourceId);(t.status==="approved"||t.status==="needs_approval")&&T.push({customerInfo:b.customerInfo,amountDue:b.amountDue,amountPaid:b.amountPaid,status:b.status,reservationStatus:t.status,subtotal:b.subtotal,total:b.total,discount:b.discount,id:b.id,res_id:t.id,resourceId:t.resourceId,spots:t.spots,date:n,startTime:t.timeslot?.startTime,endTime:t.timeslot?.endTime,reservationPrice:t.totalPrice,reservationBasePrice:t.basePrice,reservationAddOnsPrice:t.addOnsPrice,pricingOptionId:t.pricingOptionId,pricingOption:t.pricingOption,resourceName:l?.name||"Unknown",resourceColor:l?.color})})}),o.value=T.sort((b,$)=>b.startTime?.localeCompare($.startTime||"")||0)}catch(d){console.error("Error loading orders:",d),o.value=[]}finally{x.value=!1}}},q=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],O=["January","February","March","April","May","June","July","August","September","October","November","December"];return h({openDialog:P}),(d,n)=>{const c=e.resolveComponent("DialogTitle"),_=e.resolveComponent("DialogDescription"),T=e.resolveComponent("DialogHeader"),b=e.resolveComponent("Button"),$=e.resolveComponent("DialogFooter"),t=e.resolveComponent("DialogScrollContent"),l=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(l,{open:a.value,"onUpdate:open":n[2]||(n[2]=f=>a.value=f)},{default:e.withCtx(()=>[e.createVNode(t,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(T,null,{default:e.withCtx(()=>[i.value?.date?(e.openBlock(),e.createBlock(c,{key:0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(q[new Date(i.value.date).getUTCDay()])+" "+e.toDisplayString(O[new Date(i.value.date).getUTCMonth()])+" "+e.toDisplayString(new Date(i.value.date).getUTCDate())+", "+e.toDisplayString(new Date(i.value.date).getUTCFullYear()),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(_,null,{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createElementVNode("div",Re,[e.createVNode(e.unref(B.Clock),{size:14}),e.createElementVNode("span",null,e.toDisplayString(i.value?.startTime)+" – "+e.toDisplayString(i.value?.endTime),1)]),i.value?.resource?(e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("div",{class:"w-4 h-4 rounded-full",style:e.normalizeStyle({backgroundColor:i.value.resource.color||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(i.value.resource.name),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Oe,[e.createVNode(e.unref(B.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(D.value.spots)+" spots in "+e.toDisplayString(D.value.bookings)+" reservations",1)])])]),_:1})]),_:1}),e.createElementVNode("div",Ae,[w.value.length>1?(e.openBlock(),e.createBlock(fe,{key:0,"time-slots":w.value,"slot-stats":M.value,"selected-time-slot":g.value,"max-spots":V.value,onSelect:R,onClear:I},null,8,["time-slots","slot-stats","selected-time-slot","max-spots"])):e.createCommentVNode("",!0),e.createVNode(je,{orders:o.value,"filtered-orders":S.value,"is-loading":x.value,"selected-time-slot":g.value,"search-query":p.value,"onUpdate:searchQuery":n[0]||(n[0]=f=>p.value=f),onRefresh:j},null,8,["orders","filtered-orders","is-loading","selected-time-slot","search-query"])]),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(b,{variant:"outline",onClick:n[1]||(n[1]=f=>a.value=!1)},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("Close",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}}),He={class:"flex-1 border-r shadow-sm overflow-hidden min-h-[1536px]"},We={class:"relative h-full min-h-[1536px]"},Qe={class:"divide-y divide-input/80 h-full flex flex-col min-h-[1536px] border-y border-input/80"},Xe={class:"absolute inset-0 pointer-events-none"},Ye={class:"relative mr-3 h-full ml-2"},Je=["onClick"],Ke={key:0,class:"absolute bottom-0 left-0 right-0 h-1 bg-black/20"},Ge={class:"flex items-start justify-between gap-2 mb-1"},Ze={class:"font-semibold text-sm leading-tight line-clamp-1 flex-1"},et={class:"flex items-center gap-1 shrink-0"},tt=["title"],ot={class:"font-medium"},X=e.defineComponent({__name:"EventTimeline",props:{date:{},events:{},firstDay:{type:Boolean,default:!1},resources:{default:()=>[]}},setup(u){const h=u,v=e.ref(null),y=a=>{const[i,o]=a.split(":").map(Number);return i*60+o};e.computed(()=>!h.events||!h.resources?[]:h.resources.map(a=>{const o=h.events.filter(x=>x.resourceId===a.id).map(x=>{const g=y(x.startTime),w=y(x.endTime)-g,k=g/1440*100,M=w/1440*100,V=(x.bookings??0)>0,S=x.maxBookings?(x.bookings??0)/x.maxBookings*100:0;return{...x,top:`${k}%`,height:`${M}%`,color:x.resource?.color||"#3b82f6",hasBookings:V,fillPercentage:S,isSmall:w<60}});return{resource:a,events:o}}));const E=e.computed(()=>h.events?h.events.map(a=>{const i=y(a.startTime),x=y(a.endTime)-i,g=i/1440*100,p=x/1440*100,w=(a.bookings??0)>0,k=a.maxBookings?(a.bookings??0)/a.maxBookings*100:0;return{...a,top:`${g}%`,height:`${p}%`,color:a.resource?.color||"#3b82f6",hasBookings:w,fillPercentage:k,isSmall:x<60}}):[]),s=Array.from({length:24},(a,i)=>({hour:i,label:`${i.toString().padStart(2,"0")}:00`}));return(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",He,[e.createElementVNode("div",We,[e.createElementVNode("div",Qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),o=>(e.openBlock(),e.createElementBlock("div",{key:o.hour,class:"flex-1 flex transition-all duration-200"},[...i[0]||(i[0]=[e.createElementVNode("div",{class:"flex-1 relative"},[e.createElementVNode("div",{class:"absolute top-1/2 left-0 right-0 border-t border-dashed border-input/50"})],-1)])]))),128))]),e.createElementVNode("div",Xe,[e.createElementVNode("div",Ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,style:e.normalizeStyle({top:o.top,height:o.height,opacity:o.hasBookings?"1":"0.5"}),class:"event-card absolute left-2 right-2 rounded-lg pointer-events-auto cursor-pointer group/event transition-all duration-200 hover:shadow-xl overflow-hidden",onClick:x=>v.value?.openDialog(o)},[e.createElementVNode("div",{style:e.normalizeStyle({backgroundColor:o.color}),class:"absolute inset-0 shadow-lg"},[o.maxBookings?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",{class:"h-full bg-white/40 transition-all duration-300",style:e.normalizeStyle({width:`${o.fillPercentage}%`})},null,4)])):e.createCommentVNode("",!0)],4),e.createElementVNode("div",{class:e.normalizeClass(["relative h-full p-3 flex flex-col",`${o.hasBookings?"text-white":"text-gray-600 dark:text-gray-100"}`])},[e.createElementVNode("div",Ge,[e.createElementVNode("h3",Ze,e.toDisplayString(o.title),1),e.createElementVNode("div",et,[o.resource?(e.openBlock(),e.createElementBlock("div",{key:0,class:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold bg-white/30 backdrop-blur-sm text-white border border-white/40",title:o.resource.name},e.toDisplayString(o.resource.avatarLabel||o.resource.name.charAt(0).toUpperCase()),9,tt)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium",o.hasBookings?"bg-white text-black backdrop-blur-sm":"bg-black/10 backdrop-blur-sm"])},[e.createVNode(e.unref(B.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(o.bookings),1)],2)])]),e.createElementVNode("div",{class:e.normalizeClass(["flex items-center gap-2 text-xs opacity-90 mt-auto",{"-translate-x-1 -translate-y-2 scale-80 origin-[0_0]":o.isSmall}])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center gap-1 px-2 py-0.5 rounded backdrop-blur-sm",{"bg-black/10":!o.isSmall}])},[e.createVNode(e.unref(B.Clock),{size:10}),e.createElementVNode("span",ot,e.toDisplayString(o.startTime)+" – "+e.toDisplayString(o.endTime),1)],2)],2)],2),i[1]||(i[1]=e.createElementVNode("div",{class:"absolute inset-0 border-2 border-white/0 group-hover/event:border-white/30 rounded-lg transition-colors duration-200 pointer-events-none"},null,-1))],12,Je))),128))])])])]),e.createVNode(qe,{resources:u.resources,ref_key:"eventDialog",ref:v},null,8,["resources"])],64))}}),nt={class:"sticky left-0 mt-auto z-10 divide-y divide-border/50 h-full flex flex-col min-h-[1536px] bg-input"},st={class:"flex-shrink-0 text-xs font-medium text-muted-foreground px-3 pb-3 border-r border-border/50 w-14"},rt={class:"flex items-center gap-1.5"},Y=e.defineComponent({__name:"Event24hSidebar",setup(u){const h=Array.from({length:24},(v,y)=>({hour:y,label:`${y.toString().padStart(2,"0")}:00`}));return(v,y)=>(e.openBlock(),e.createElementBlock("div",nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h),E=>(e.openBlock(),e.createElementBlock("div",{key:E.hour,class:"flex-1 flex transition-all duration-200"},[e.createElementVNode("div",st,[e.createElementVNode("div",rt,[e.createElementVNode("span",{class:e.normalizeClass({"-translate-y-1/2":E.hour!==0})},e.toDisplayString(E.label),3)])])]))),128))]))}}),at={class:"absolute top-0 w-full pointer-events-none"},lt={key:0,class:"absolute -right-2 -top-0.5 px-2 py-0.5 bg-red-500 text-white text-xs font-medium rounded shadow-lg"},J=e.defineComponent({__name:"EventTimeIndicator",props:{currentDate:{type:Object,required:!1}},setup(u){const h=e.ref(Date.now());let v;e.onMounted(()=>{v=window.setInterval(()=>{h.value=Date.now()},1e3)}),e.onUnmounted(()=>{v&&clearInterval(v)});const y=e.computed(()=>{const s=new Date(h.value);return`${(s.getHours()*60+s.getMinutes()+s.getSeconds()/60)/1440*100}%`}),E=e.computed(()=>new Date(h.value).getFullYear()+"-"+(new Date(h.value).getMonth()+1).toString().padStart(2,"0")+"-"+new Date(h.value).getDate().toString().padStart(2,"0"));return(s,a)=>(e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("div",{class:"absolute left-0 right-0 h-0.5 bg-red-500 z-30 pointer-events-none transition-[top] duration-300 ease-linear",style:e.normalizeStyle({top:y.value})},[a[0]||(a[0]=e.createElementVNode("div",{class:"absolute -left-2 -top-1.5 w-3 h-3 bg-red-500 rounded-full shadow-lg shadow-red-500/50"},null,-1)),u.currentDate&&u.currentDate==E.value?(e.openBlock(),e.createElementBlock("div",lt," Now ")):e.createCommentVNode("",!0)],4)]))}}),it={key:0,class:"relative flex flex-1 min-w-0"},ct={key:1,class:"flex-1 min-w-0 relative"},dt={key:0,class:"absolute top-0 right-0 z-10 px-3 py-1.5 bg-primary/90 text-primary-foreground text-xs font-medium rounded-bl-lg shadow-lg backdrop-blur-sm flex items-center gap-1.5 animate-pulse-subtle"},ut={class:"flex pb-4 min-w-[200px]"},mt=["onClick"],pt={key:0,class:"absolute top-2 right-2 flex items-center gap-1 px-2 py-0.5 bg-primary/20 backdrop-blur-sm rounded-full border border-primary/30"},ft={class:"text-xs text-muted-foreground font-medium group-hover:text-foreground/70 transition-colors"},vt={key:0,class:"absolute bottom-0 left-0 w-full h-1 bg-orange-500"},gt=e.defineComponent({__name:"EventView",setup(u){const h=e.inject("activeDate",e.ref(U.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(U.$14e0f24ef4ac5c92$export$aa8b41735afcabd2()))),v=e.inject("viewMode",e.ref(1)),y=e.inject("events",e.ref([])),E=e.inject("resources",e.ref([])),s=e.ref(null),a=e.ref(!1),i=e.ref(!1);e.computed(()=>E.value.length>1);const o=e.computed(()=>{const n=[],c=h.value;for(let _=0;_<v.value;_++)n.push(c.add({days:_}));return n}),x=(n,c)=>{const _=`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`;return y.value?.filter(T=>T.date===_)||[]},g=n=>{const c=U.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(U.$14e0f24ef4ac5c92$export$aa8b41735afcabd2());return n.year===c.year&&n.month===c.month&&n.day===c.day},p=n=>{h.value=n,v.value=1};let w=null,k=null;const M=()=>{s.value&&(S(),s.value.scrollBy({left:-300,behavior:"smooth"}),k=window.setTimeout(()=>{w=window.setInterval(()=>{s.value&&s.value.scrollBy({left:-20,behavior:"auto"})},50)},300))},V=()=>{s.value&&(S(),s.value.scrollBy({left:300,behavior:"smooth"}),k=window.setTimeout(()=>{w=window.setInterval(()=>{s.value&&s.value.scrollBy({left:20,behavior:"auto"})},50)},300))},S=()=>{k&&(clearTimeout(k),k=null),w&&(clearInterval(w),w=null)},D=()=>{if(!s.value)return;const{scrollLeft:n,scrollWidth:c,clientWidth:_}=s.value;a.value=n>10,i.value=n<c-_-10},R=n=>{s.value&&Math.abs(n.deltaY)>Math.abs(n.deltaX)&&(n.preventDefault(),s.value.scrollBy({left:n.deltaY,behavior:"auto"}))},I=e.ref(!1),P=e.ref(0),j=e.ref(0),q=n=>{!s.value||v.value===1||n.target.closest(".event-card")||(I.value=!0,P.value=n.pageX,j.value=s.value.scrollLeft,s.value.style.userSelect="none",n.preventDefault())},O=n=>{if(!I.value||!s.value)return;const c=n.pageX,_=(P.value-c)*1.2;s.value.scrollLeft=j.value+_},d=()=>{s.value&&(I.value=!1,s.value.style.userSelect="")};return e.onMounted(()=>{s.value&&(s.value.addEventListener("scroll",D),s.value.addEventListener("wheel",R,{passive:!1}),e.nextTick(()=>{D(),setTimeout(D,50),setTimeout(D,150),setTimeout(D,300),setTimeout(D,500)})),document.addEventListener("mousemove",O),document.addEventListener("mouseup",d)}),e.onBeforeUnmount(()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",d)}),e.watch(v,()=>{v.value>1?e.nextTick(()=>{setTimeout(()=>{if(!s.value)return;const{scrollWidth:n,clientWidth:c}=s.value;n>c&&(i.value=!0,a.value=!1)},100)}):s.value&&(s.value.style.cursor="")}),e.onUnmounted(()=>{S(),s.value&&(s.value.removeEventListener("scroll",D),s.value.removeEventListener("wheel",R))}),(n,c)=>{const _=e.resolveComponent("Button"),T=e.resolveComponent("TooltipTrigger"),b=e.resolveComponent("TooltipContent"),$=e.resolveComponent("Tooltip");return e.unref(v)===1?(e.openBlock(),e.createElementBlock("div",it,[e.createVNode(Y),e.createVNode(J,{class:"h-full","current-date":e.unref(h)},null,8,["current-date"]),e.createVNode(X,{date:e.unref(h),events:x(e.unref(h)),resources:e.unref(E)},null,8,["date","events","resources"])])):(e.openBlock(),e.createElementBlock("div",ct,[e.unref(v)===7?(e.openBlock(),e.createElementBlock("div",dt,[e.createVNode(e.unref(B.ChevronLeft),{size:12}),c[0]||(c[0]=e.createElementVNode("span",null,"Scroll to view all days",-1)),e.createVNode(e.unref(B.ChevronRight),{size:12})])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(_,{key:1,variant:"outline",size:"icon",onMousedown:M,onMouseup:S,onMouseleave:S,onTouchstart:M,onTouchend:S,class:"sticky top-1/2 left-2 -translate-y-1/2 z-40 h-10 w-10 rounded-full shadow-lg bg-background/95 backdrop-blur-sm hover:bg-background border-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ChevronLeft),{size:20})]),_:1})):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createBlock(_,{key:2,variant:"outline",size:"icon",onMousedown:V,onMouseup:S,onMouseleave:S,onTouchstart:V,onTouchend:S,class:"sticky top-1/2 right-2 -translate-y-1/2 z-40 h-10 w-10 rounded-full shadow-lg bg-background/95 backdrop-blur-sm hover:bg-background border-2 float-right"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ChevronRight),{size:20})]),_:1})):e.createCommentVNode("",!0),e.createVNode(J,{class:"h-[calc(100%-164px)] mt-[122px]"}),e.createElementVNode("div",{class:e.normalizeClass(["absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-background to-transparent z-10 pointer-events-none transition-opacity duration-300",i.value?"opacity-100":"opacity-0"])},null,2),e.createElementVNode("div",{ref_key:"scrollContainer",ref:s,class:"absolute inset-0 overflow-x-auto overflow-y-visible",onScroll:D,onMousedown:q},[e.createElementVNode("div",ut,[e.createVNode(Y),c[5]||(c[5]=e.createElementVNode("div",{class:"absolute w-14 h-[125px] bg-input"},null,-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(t,l)=>(e.openBlock(),e.createElementBlock("div",{key:t.toString(),class:e.normalizeClass(["flex-shrink-0",{"min-w-[200px] w-[33.33%]":e.unref(v)===3,"min-w-[280px]":e.unref(v)===7}])},[e.createElementVNode("div",{onClick:f=>p(t),class:e.normalizeClass(["relative p-3 border cursor-pointer transition-all duration-200 group relative",g(t)?"bg-gradient-to-br from-primary/10 to-primary/5 border-primary/30 hover:from-primary/20 hover:to-primary/10 hover:border-primary/50 hover:shadow-md":"bg-gradient-to-br from-muted/50 to-muted/30 border-border hover:from-accent/50 hover:to-accent/30 hover:border-accent-foreground/20 hover:shadow-md"])},[g(t)?(e.openBlock(),e.createElementBlock("div",pt,[...c[1]||(c[1]=[e.createElementVNode("div",{class:"w-1.5 h-1.5 bg-primary rounded-full animate-pulse"},null,-1),e.createElementVNode("span",{class:"text-[9px] font-bold text-primary uppercase tracking-wide"},"Today",-1)])])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["text-xs font-semibold uppercase tracking-wider transition-colors",g(t)?"text-primary group-hover:text-primary/80":"text-muted-foreground group-hover:text-foreground"])},e.toDisplayString(new Date(t.year,t.month-1,t.day).toLocaleDateString("en-US",{weekday:"short"})),3),e.createElementVNode("div",{class:e.normalizeClass(["text-2xl font-bold transition-colors",g(t)?"text-foreground":"text-foreground group-hover:text-primary"])},e.toDisplayString(t.day),3),e.createElementVNode("div",ft,e.toDisplayString(new Date(t.year,t.month-1,t.day).toLocaleDateString("en-US",{month:"long",year:"numeric"})),1),c[4]||(c[4]=e.createElementVNode("div",{class:"mt-2 pt-2 border-t border-border/0 group-hover:border-border/50 transition-all"},[e.createElementVNode("div",{class:"text-[10px] text-muted-foreground/0 group-hover:text-muted-foreground/100 uppercase tracking-wide transition-all"}," Click to view ")],-1)),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(T,{"as-child":""},{default:e.withCtx(()=>[x(t).filter(f=>f.isException).length>0?(e.openBlock(),e.createBlock(e.unref(B.Asterisk),{key:0,class:"absolute top-3 right-3 size-4 text-orange-500"})):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(b,null,{default:e.withCtx(()=>[...c[2]||(c[2]=[e.createElementVNode("p",null," This day has exceptions applied to it. ",-1)])]),_:1})]),_:2},1024),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(T,{"as-child":""},{default:e.withCtx(()=>[x(t).filter(f=>f.isException).length>0?(e.openBlock(),e.createElementBlock("div",vt)):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(b,null,{default:e.withCtx(()=>[...c[3]||(c[3]=[e.createElementVNode("p",null," This day has exceptions applied to it. ",-1)])]),_:1})]),_:2},1024)],10,mt),e.createVNode(X,{date:t,events:x(t),resources:e.unref(E)},null,8,["date","events","resources"])],2))),128))])],544)]))}}}),ht=oe._export_sfc(gt,[["__scopeId","data-v-99339cf2"]]),xt={class:"flex flex-col gap-2 md:gap-4 w-full h-full"},yt={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 px-1"},kt={class:"flex items-center justify-between sm:justify-start gap-4"},bt={class:"flex flex-col"},_t={class:"flex items-center gap-2"},Nt={class:"text-lg sm:text-2xl font-bold tracking-tight truncate"},Et={class:"text-xs sm:text-sm text-muted-foreground ml-7 truncate"},wt={class:"flex items-center justify-between sm:justify-end gap-2"},Vt={class:"flex items-center gap-1 sm:mr-2"},St={key:0,class:"flex items-center gap-2 px-1 overflow-x-auto pb-2 -mx-1 scrollbar-hide"},Ct=["onClick"],Bt={class:"flex gap-4 flex-1 min-h-0 md:min-h-[1700px]"},$t={class:"hidden md:flex flex-shrink-0 flex-col gap-4"},Dt={key:0,class:"rounded-md border p-3"},Tt={class:"space-y-1"},zt=["onClick"],Mt={class:"min-w-0 flex-1"},Lt={class:"text-sm font-medium truncate"},It={key:0,class:"pt-2 mt-2 border-t"},Ut={key:0,class:"mt-1 space-y-1"},jt={class:"min-w-0 flex-1"},Ft={class:"text-sm font-medium truncate text-muted-foreground"},Rt=e.defineComponent({__name:"agenda",setup(u){const{hasPermission:h}=F.useModulePermissions(),{params:v}=F.useModuleRoute(),{config:y}=F.useModule(),E=F.useFirebaseIntegration(y.project),s=e.ref(U.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(U.$14e0f24ef4ac5c92$export$aa8b41735afcabd2())),a=e.ref(1),i=e.ref(typeof window<"u"?window.innerWidth:1024),o=e.computed(()=>i.value<768),x=()=>{i.value=window.innerWidth};e.onMounted(()=>{window.addEventListener("resize",x)}),e.onUnmounted(()=>{window.removeEventListener("resize",x)}),e.watch(o,t=>{t&&a.value!==1&&(a.value=1)},{immediate:!0});const g=e.ref(null),p=e.ref(new Map),w=e.computed(()=>g.value?.resources||[]),k=e.computed(()=>w.value.filter(t=>t.isActive)),M=e.computed(()=>w.value.filter(t=>!t.isActive)),V=e.ref(null),S=e.ref(!1);e.watch(k,t=>{t.length>0&&!V.value&&(V.value=t[0].id)},{immediate:!0});const D=e.computed(()=>{if(!V.value)return k.value.length>0?[k.value[0]]:[];const t=k.value.find(l=>l.id===V.value);return t?[t]:k.value.length>0?[k.value[0]]:[]}),R=e.computed(()=>g.value?.pricingOptions?.find(l=>l.isDefault)?.duration||30),I=t=>{V.value=t};e.watch(s,()=>{$()});const P=e.computed(()=>{const t=s.value,l=new Date(t.year,t.month-1,t.day),f=l.toLocaleDateString("en-US",{weekday:"long"}).toUpperCase(),m=t.day,N=l.toLocaleDateString("en-US",{month:"short"}).toUpperCase();return{dayName:f,day:m,monthName:N,full:`${f} ${m} ${N}`}}),j=()=>{s.value=s.value.subtract({days:a.value})},q=()=>{s.value=s.value.add({days:a.value})},O=()=>{s.value=U.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(U.$14e0f24ef4ac5c92$export$aa8b41735afcabd2())},d=t=>{const[l,f]=t.split(":").map(Number);return l*60+f},n=(t,l)=>(g.value?.exceptions||[]).find(m=>l>=m.startDate&&l<=m.endDate?m.resourceIds===null?!0:m.resourceIds?.includes(t):!1)||null,c=(t,l,f)=>{const m=n(t.id,f);if(m)return m.isClosed?[]:m.timeslots.map(r=>({startTime:r.startTime,endTime:r.endTime,isException:!0}));const N=l.getDay(),C=t.openingHours?.[N]||[];return C.length===0?[]:C.map(r=>({startTime:r.start,endTime:r.end,isException:!1}))},_=(t,l,f,m)=>{if(!g.value)return 0;const N=p.value.get(l);if(!N)return 0;const C=N.filter(r=>r.resourceId===t).reduce((r,z)=>{const L=d(z.startTime),A=d(z.endTime),H=d(f),W=d(m);return L<W&&A>H?r+(z.reserved||0):r},0);return C>0&&console.log(`Found ${C} total bookings for ${t} on ${l} ${f}-${m}`),C},T=e.computed(()=>{if(!g.value)return[];p.value.size;let t=[],l=[];for(let m=0;m<a.value;m++){const N=s.value.add({days:m});l.push(N)}const f=D.value.length>0?D.value:[];return f.length===0?[]:(l.forEach(m=>{let N=new Date(m.year,m.month-1,m.day);const C=`${m.year}-${String(m.month).padStart(2,"0")}-${String(m.day).padStart(2,"0")}`;f.forEach(r=>{const z=c(r,N,C);t=t.concat(z.map((L,A)=>{const H=_(r.id,C,L.startTime,L.endTime);return{id:`block-${C}-${r.id}-${A}`,title:g.value.serviceName,date:C,startTime:L.startTime,endTime:L.endTime,theme:r.color||"#3b82f6",bookings:H,maxBookings:r.capacity,isException:L.isException||!1,resourceId:r.id,resource:r,interval:r.interval||30,serviceDuration:R.value}}))})}),t)}),b=async()=>{g.value=await E.get(y.agendaCollection,v.value.id)},$=async()=>{const t=v.value.id,l=s.value;p.value.clear();const f=[];for(let m=0;m<a.value;m++){const N=l.add({days:m}),C=`${N.year}-${String(N.month).padStart(2,"0")}-${String(N.day).padStart(2,"0")}`,r=`${t}_${C}`;f.push(E.get(y.reservedSpotsCollection,r).then(z=>{if(z){let L=[];for(const A of k.value){const H=z?.[A.id]||{};Object.entries(H).forEach(([W,G])=>{const[Z,ee]=W.split("-");L.push({resourceId:A.id,startTime:Z,endTime:ee,reserved:G})})}p.value.set(C,L)}}).catch(()=>{}))}await Promise.all(f),console.log("Loaded reserved spots:",p.value)};return b(),$(),e.watch(a,()=>{$()}),e.provide("agendaData",g),e.provide("activeDate",s),e.provide("viewMode",a),e.provide("events",T),e.provide("resources",D),e.provide("allResources",k),(t,l)=>{const f=e.resolveComponent("Button"),m=e.resolveComponent("SegmentedControlButton"),N=e.resolveComponent("SegmentedControl"),C=e.resolveComponent("Calendar");return e.openBlock(),e.createBlock(te._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",xt,[e.createElementVNode("div",yt,[e.createElementVNode("div",kt,[e.createElementVNode("div",bt,[e.createElementVNode("div",_t,[e.createVNode(e.unref(B.CalendarDays),{size:20,class:"text-primary flex-shrink-0"}),e.createElementVNode("h2",Nt,e.toDisplayString(P.value.full),1)]),e.createElementVNode("p",Et,e.toDisplayString(g.value?.serviceName),1)]),o.value&&e.unref(h)("manage-reservations")?(e.openBlock(),e.createBlock(Q._sfc_main,{key:0})):e.createCommentVNode("",!0)]),e.createElementVNode("div",wt,[e.createElementVNode("div",Vt,[e.createVNode(f,{variant:"outline",size:"icon",class:"size-8 sm:size-9",onClick:j},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ChevronLeft),{size:16})]),_:1}),e.createVNode(f,{variant:"outline",size:"sm",class:"h-8 sm:h-9 px-2 sm:px-3 text-xs sm:text-sm",onClick:O},{default:e.withCtx(()=>[...l[3]||(l[3]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(f,{variant:"outline",size:"icon",class:"size-8 sm:size-9",onClick:q},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ChevronRight),{size:16})]),_:1})]),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(N,{key:0,modelValue:a.value,"onUpdate:modelValue":l[0]||(l[0]=r=>a.value=r)},{default:e.withCtx(()=>[e.createVNode(m,{value:1},{default:e.withCtx(()=>[...l[4]||(l[4]=[e.createElementVNode("span",{class:"whitespace-nowrap"},"1 Day",-1)])]),_:1}),e.createVNode(m,{value:3},{default:e.withCtx(()=>[...l[5]||(l[5]=[e.createElementVNode("span",{class:"whitespace-nowrap"},"3 Days",-1)])]),_:1}),e.createVNode(m,{value:7},{default:e.withCtx(()=>[...l[6]||(l[6]=[e.createElementVNode("span",{class:"whitespace-nowrap"},"7 Days",-1)])]),_:1})]),_:1},8,["modelValue"])),!o.value&&e.unref(h)("manage-reservations")?(e.openBlock(),e.createBlock(Q._sfc_main,{key:1})):e.createCommentVNode("",!0)])]),o.value&&k.value.length>0?(e.openBlock(),e.createElementBlock("div",St,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,r=>(e.openBlock(),e.createElementBlock("button",{key:r.id,class:e.normalizeClass(["flex items-center gap-2 px-3 py-1.5 rounded-full border text-sm whitespace-nowrap transition-colors flex-shrink-0",{"bg-primary text-primary-foreground border-primary":V.value===r.id,"bg-background hover:bg-muted":V.value!==r.id}]),onClick:z=>I(r.id)},[e.createElementVNode("div",{class:"size-5 rounded-full flex items-center justify-center text-white text-[10px] font-medium",style:e.normalizeStyle({backgroundColor:V.value===r.id?"rgba(255,255,255,0.3)":r.color||"#6b7280"})},e.toDisplayString(r.avatarLabel||r.name.charAt(0).toUpperCase()),5),e.createElementVNode("span",null,e.toDisplayString(r.name),1)],10,Ct))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",Bt,[e.createElementVNode("div",$t,[e.createVNode(C,{modelValue:s.value,"onUpdate:modelValue":l[1]||(l[1]=r=>s.value=r),"weekday-format":"short",class:"rounded-md border"},null,8,["modelValue"]),w.value.length>0?(e.openBlock(),e.createElementBlock("div",Dt,[l[7]||(l[7]=e.createElementVNode("div",{class:"flex items-center justify-between mb-3"},[e.createElementVNode("span",{class:"text-sm font-medium"},"Resources")],-1)),e.createElementVNode("div",Tt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:e.normalizeClass(["flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors",{"bg-muted ring-2 ring-primary/20":V.value===r.id,"opacity-50":V.value&&V.value!==r.id}]),onClick:z=>I(r.id)},[e.createElementVNode("div",{class:"size-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:e.normalizeStyle({backgroundColor:r.color||"#6b7280"})},e.toDisplayString(r.avatarLabel||r.name.charAt(0).toUpperCase()),5),e.createElementVNode("div",Mt,[e.createElementVNode("div",Lt,e.toDisplayString(r.name),1)]),e.createElementVNode("div",{class:e.normalizeClass(["size-2 rounded-full flex-shrink-0",V.value===r.id?"bg-primary":"bg-muted-foreground/30"])},null,2)],10,zt))),128)),M.value.length>0?(e.openBlock(),e.createElementBlock("div",It,[e.createElementVNode("button",{class:"flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground w-full py-1 transition-colors",onClick:l[2]||(l[2]=r=>S.value=!S.value)},[e.createVNode(e.unref(B.ChevronRight),{size:14,class:e.normalizeClass(["transition-transform",{"rotate-90":S.value}])},null,8,["class"]),e.createElementVNode("span",null,"Inactive ("+e.toDisplayString(M.value.length)+")",1)]),S.value?(e.openBlock(),e.createElementBlock("div",Ut,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id,class:"flex items-center gap-2 p-2 rounded-md opacity-50"},[e.createElementVNode("div",{class:"size-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0 grayscale",style:e.normalizeStyle({backgroundColor:r.color||"#6b7280"})},e.toDisplayString(r.avatarLabel||r.name.charAt(0).toUpperCase()),5),e.createElementVNode("div",jt,[e.createElementVNode("div",Ft,e.toDisplayString(r.name),1)])]))),128))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]),e.createVNode(ht)])])]),_:1})}}});exports.default=Rt;