Socket
Socket
Sign inDemoInstall

@aldabil/react-scheduler

Package Overview
Dependencies
110
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.8.1 to 2.8.2

2

index.js

@@ -1,1 +0,1 @@

(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Scheduler:()=>lt});const n=require("react/jsx-runtime"),r=require("react"),a=require("@mui/material"),i=require("date-fns"),s=(e,t,n)=>{var r;const a=(null===(r=e.config)||void 0===r?void 0:r.multiple)&&!Array.isArray((null==n?void 0:n[e.name])||e.default),i=a?t?[t]:[]:t;return{value:i,validity:a?i.length:i}},o=(e,t,n,r)=>{var a;const i=n.idField,s=r.find((e=>e.name===i)),o=!!(null===(a=null==s?void 0:s.config)||void 0===a?void 0:a.multiple),l=[];for(const r of e){const e=o&&!Array.isArray(r[i])?[r[i]]:r[i];(o||Array.isArray(e)?e.includes(t[i]):e===t[i])&&l.push(Object.assign(Object.assign({},r),{color:r.color||t[n.colorField||""]}))}return l},l=(e,t)=>Math.ceil(e)/t,d=(e,t)=>Math.max(e/t,60),c=(e,t)=>(0,i.differenceInDays)((0,i.endOfDay)((0,i.addSeconds)(t,-1)),(0,i.startOfDay)(e)),u=(e,t,n)=>{const r=[];for(let n=0;n<e.length;n++){const a=e[n];a.allDay||!(0,i.isSameDay)(t,a.start)||c(a.start,a.end)||r.push(a)}return h(r)},g=(e,t,n)=>{const r=e.filter((e=>(0,i.isWithinInterval)(t,{start:(0,i.startOfDay)(e.start),end:(0,i.endOfDay)(e.end)})));return v(r)},h=e=>e.sort(((e,t)=>{const n=e.end.getTime()-e.start.getTime();return t.end.getTime()-t.start.getTime()-n})),v=e=>e.sort(((e,t)=>e.start.getTime()-t.start.getTime())),y=(e,t,n,r)=>{var a;const s=Array.isArray(t),o=[],l={};for(let n=0;n<e.length;n++){const r=e[n];let a=r.allDay||c(r.start,r.end)>0;if(a&&(a=s?t.some((e=>(0,i.isWithinInterval)(e,{start:(0,i.startOfDay)(r.start),end:(0,i.endOfDay)(r.end)}))):(0,i.isWithinInterval)(t,{start:(0,i.startOfDay)(r.start),end:(0,i.endOfDay)(r.end)}),a))if(o.push(r),s)for(const e of t){const t=(0,i.format)(e,"yyyy-MM-dd");(0,i.isWithinInterval)(e,{start:(0,i.startOfDay)(r.start),end:(0,i.endOfDay)(r.end)})&&(l[t]=(l[t]||[]).concat(r))}else{const e=(0,i.format)(r.start,"yyyy-MM-dd");l[e]=(l[e]||[]).concat(r)}}return s&&r?(null===(a=Object.values(l).sort(((e,t)=>t.length-e.length)))||void 0===a?void 0:a[0])||[]:o},p=(e,t)=>new Date(new Intl.DateTimeFormat("en-US",{dateStyle:"short",timeStyle:"medium",timeZone:t}).format(e)),m=({dateLeft:e,dateRight:t,timeZone:n})=>(0,i.isSameDay)(e,p(t||new Date,n)),f=e=>"12"===e?"hh:mm a":"HH:mm",j=require("date-fns/locale/en-US");var b=e.n(j),x=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};const O={weekDays:[0,1,2,3,4,5,6],weekStartOn:6,startHour:9,endHour:17,navigation:!0,disableGoToDay:!1},_={weekDays:[0,1,2,3,4,5,6],weekStartOn:6,startHour:9,endHour:17,step:60,navigation:!0,disableGoToDay:!1},w={startHour:9,endHour:17,step:60,navigation:!0},D={idField:"assignee",textField:"text",subTextField:"subtext",avatarField:"avatar",colorField:"color"},k=(e={})=>{const{navigation:t,form:n,event:r}=e,a=x(e,["navigation","form","event"]);return Object.assign({navigation:Object.assign({month:"Month",week:"Week",day:"Day",agenda:"Agenda",today:"Today"},t),form:Object.assign({addTitle:"Add Event",editTitle:"Edit Event",confirm:"Confirm",delete:"Delete",cancel:"Cancel"},n),event:Object.assign({title:"Title",start:"Start",end:"End",allDay:"All Day"},r)},Object.assign({moreEvents:"More...",loading:"Loading...",noDataToDisplay:"No data to display"},a))},C=e=>{const{month:t,week:n,day:r,translations:a,resourceFields:i,view:s}=e,o=x(e,["month","week","day","translations","resourceFields","view"]),l=(e=>{const{month:t,week:n,day:r}=e;return{month:null!==t?Object.assign(O,t):null,week:null!==n?Object.assign(_,n):null,day:null!==r?Object.assign(w,r):null}})(e),d=s||"week",c=l[d]?d:(e=>{if(e.month)return"month";if(e.week)return"week";if(e.day)return"day";throw new Error("No views were selected")})(l);return Object.assign(Object.assign(Object.assign({},l),{translations:k(a),resourceFields:Object.assign(D,i),view:c}),Object.assign({height:600,navigation:!0,selectedDate:new Date,agenda:!1,disableViewNavigator:!1,events:[],fields:[],loading:void 0,customEditor:void 0,onConfirm:void 0,onDelete:void 0,viewerExtraComponent:void 0,resources:[],resourceHeaderComponent:void 0,resourceViewMode:"default",direction:"ltr",dialogMaxWidth:"md",locale:b(),deletable:!0,editable:!0,hourFormat:"12",draggable:!0},o))},M=Object.assign(Object.assign({},C({})),{setProps:()=>{},dialog:!1,selectedRange:void 0,selectedEvent:void 0,selectedResource:void 0,handleState:()=>{},getViews:()=>[],toggleAgenda:()=>{},triggerDialog:()=>{},triggerLoading:()=>{},handleGotoDay:()=>{},confirmEvent:()=>{},onDrop:()=>{}}),T=(0,r.createContext)(M),S=()=>(0,r.useContext)(T),E=({date:e,onClick:t,locale:r})=>{const{timeZone:s}=S(),o=m({dateLeft:e,timeZone:s});return(0,n.jsxs)("div",{children:[(0,n.jsx)(a.Typography,Object.assign({style:{fontWeight:o?"bold":"inherit"},color:o?"primary":"inherit",className:t?"rs__hover__op":"",onClick:n=>{n.stopPropagation(),t&&t(e)}},{children:(0,i.format)(e,"dd",{locale:r})})),(0,n.jsx)(a.Typography,Object.assign({color:o?"primary":"inherit",style:{fontWeight:o?"bold":"inherit",fontSize:11}},{children:(0,i.format)(e,"eee",{locale:r})}))]})},F=require("@mui/icons-material/ArrowRightRounded");var I=e.n(F);const R=require("@mui/icons-material/ArrowLeftRounded");var N=e.n(R);const P=(0,a.styled)("div")((({theme:e,dialog:t})=>({position:"relative","& .rs__table_loading":{position:"absolute",left:0,right:0,top:0,bottom:0,zIndex:999999,"& .rs__table_loading_internal":{background:t?"":(0,a.alpha)(e.palette.background.paper,.4),height:"100%","& > span":{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",flexDirection:"column","& >span":{marginBottom:15}}}}}))),$=(0,a.styled)("div")((({resource_count:e})=>({position:"relative",display:"flex",flexDirection:e>1?"row":"column",width:"100%",boxSizing:"content-box","& > div":{flexShrink:0,flexGrow:1}}))),W=(0,a.styled)(a.Paper)((({sticky:e="0"})=>({display:"flex",justifyContent:"space-between",alignItems:"center",position:"1"===e?"sticky":"relative",top:"1"===e?0:void 0,zIndex:"1"===e?999:void 0,boxShadow:"none",padding:"2px 0","& > .rs__view_navigator":{display:"flex",alignItems:"center"}}))),L=(0,a.styled)("div")((({theme:e})=>({borderStyle:"solid",borderColor:e.palette.grey[300],borderWidth:"1px 1px 0 0","& > .rs__agenda_row":{display:"flex","& >.rs__agenda__cell":{padding:4,width:"100%",maxWidth:60,"& > .MuiTypography-root":{position:"sticky",top:0,"&.rs__hover__op":{cursor:"pointer","&:hover":{opacity:.7,textDecoration:"underline"}}}},"& .rs__cell":{borderStyle:"solid",borderColor:e.palette.grey[300],borderWidth:"0 0 1px 1px"},"& > .rs__agenda_items":{flexGrow:1}}}))),q=(0,a.styled)("div")((({days:e,sticky:t="0",stickyNavigation:n,indent:r="1",theme:i})=>({display:"grid",gridTemplateColumns:+r>0?`10% repeat(${e}, 1fr)`:`repeat(${e}, 1fr)`,overflowX:"auto",overflowY:"hidden",position:"1"===t?"sticky":"relative",top:"1"===t?n?36:0:void 0,zIndex:"1"===t?99:void 0,[i.breakpoints.down("sm")]:{gridTemplateColumns:+r>0?`30px repeat(${e}, 1fr)`:""},borderStyle:"solid",borderColor:i.palette.grey[300],borderWidth:"0 0 0 1px","&:first-of-type":{borderWidth:"1px 0 0 1px"},"&:last-of-type":{borderWidth:"0 0 1px 1px"},"& .rs__cell":{background:i.palette.background.paper,position:"relative",borderStyle:"solid",borderColor:i.palette.grey[300],borderWidth:"0 1px 1px 0","&.rs__header":{"& > :first-of-type":{padding:"2px 5px"}},"&.rs__header__center":{padding:"6px 0px"},"&.rs__time":{display:"flex",alignItems:"center",justifyContent:"center",position:"sticky",left:0,zIndex:99,[i.breakpoints.down("sm")]:{writingMode:"vertical-rl"}},"& > button":{width:"100%",height:"100%",borderRadius:0,cursor:"pointer","&:hover":{background:(0,a.alpha)(i.palette.primary.main,.1)}},"& .rs__event__item":{position:"absolute",zIndex:1},"& .rs__multi_day":{position:"absolute",zIndex:1,textOverflow:"ellipsis"},"& .rs__block_col":{display:"block",position:"relative"},"& .rs__hover__op":{cursor:"pointer","&:hover":{opacity:.7,textDecoration:"underline"}},"&:not(.rs__time)":{minWidth:65}}}))),z=(0,a.styled)(a.Paper)((({disabled:e})=>({width:"99.5%",height:"100%",display:"block",cursor:e?"not-allowed":"pointer",overflow:"hidden","& .MuiButtonBase-root":{width:"100%",height:"100%",display:"block",textAlign:"left","& > div":{height:"100%"}}}))),A=(0,a.styled)("div")((({theme:e})=>({maxWidth:"100%",width:400,"& > div":{padding:"5px 10px","& .rs__popper_actions":{display:"flex",alignItems:"center",justifyContent:"space-between","& .MuiIconButton-root":{color:e.palette.primary.contrastText}}}}))),B=(0,a.styled)("div")((({theme:e})=>({display:"inherit","& .MuiIconButton-root":{color:e.palette.primary.contrastText},"& .MuiButton-root":{"&.delete":{color:e.palette.error.main},"&.cancel":{color:e.palette.action.disabled}}}))),H=(0,a.styled)("div")((({theme:e})=>({position:"absolute",zIndex:9,width:"100%",display:"flex","& > div:first-of-type":{height:12,width:12,borderRadius:"50%",background:e.palette.error.light,marginLeft:-6,marginTop:-5},"& > div:last-of-type":{borderTop:`solid 2px ${e.palette.error.light}`,width:"100%"}}))),V=require("@mui/icons-material/DeleteRounded");var Z=e.n(V);const G=require("@mui/icons-material/EditRounded");var K=e.n(G);const X=({event:e,onDelete:t,onEdit:i})=>{const{translations:s,direction:o,editable:l,deletable:d}=S(),[c,u]=(0,r.useState)(!1),g=()=>{if(!c)return u(!0);t()},h=(0,r.useMemo)((()=>void 0!==e.deletable?e.deletable:d),[d,e.deletable]),v=(0,r.useMemo)((()=>void 0!==e.editable?e.editable:l),[l,e.editable]);return(0,n.jsxs)(B,{children:[(0,n.jsx)(a.Grow,Object.assign({in:!c,exit:!1,timeout:400,unmountOnExit:!0},{children:(0,n.jsxs)("div",{children:[v&&(0,n.jsx)(a.IconButton,Object.assign({size:"small",onClick:i},{children:(0,n.jsx)(K(),{})})),h&&(0,n.jsx)(a.IconButton,Object.assign({size:"small",onClick:g},{children:(0,n.jsx)(Z(),{})}))]})})),(0,n.jsx)(a.Slide,Object.assign({in:c,direction:"rtl"===o?"right":"left",unmountOnExit:!0,timeout:400,exit:!1},{children:(0,n.jsxs)("div",{children:[(0,n.jsx)(a.Button,Object.assign({className:"delete",size:"small",onClick:g},{children:s.form.delete.toUpperCase()})),(0,n.jsx)(a.Button,Object.assign({className:"cancel",size:"small",onClick:()=>u(!1)},{children:s.form.cancel.toUpperCase()}))]})}))]})},U=require("@mui/icons-material/EventNoteRounded");var Q=e.n(U);const Y=require("@mui/icons-material/ClearRounded");var J=e.n(Y);const ee=require("@mui/icons-material/SupervisorAccountRounded");var te=e.n(ee);const ne=({anchorEl:e,event:t,onTriggerViewer:r})=>{const{triggerDialog:s,onDelete:o,events:l,handleState:d,triggerLoading:u,customViewer:g,viewerExtraComponent:h,fields:v,resources:y,resourceFields:p,locale:m,viewerTitleComponent:j,hourFormat:b,translations:x}=S(),O=(0,a.useTheme)(),_=c(t.start,t.end)<=0&&t.allDay,w=f(b),D=p.idField,k=y.filter((e=>Array.isArray(t[D])?t[D].includes(e[D]):e[D]===t[D]));return(0,n.jsx)(a.Popover,Object.assign({open:Boolean(e),anchorEl:e,onClose:()=>{r()},anchorOrigin:{vertical:"center",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},onClick:e=>{e.stopPropagation()}},{children:"function"==typeof g?g(t,(()=>r())):(0,n.jsxs)(A,{children:[(0,n.jsxs)(a.Box,Object.assign({sx:{bgcolor:t.color||O.palette.primary.main,color:O.palette.primary.contrastText}},{children:[(0,n.jsxs)("div",Object.assign({className:"rs__popper_actions"},{children:[(0,n.jsx)("div",{children:(0,n.jsx)(a.IconButton,Object.assign({size:"small",onClick:()=>{r()}},{children:(0,n.jsx)(J(),{color:"disabled"})}))}),(0,n.jsx)(X,{event:t,onDelete:()=>{return e=void 0,n=void 0,i=function*(){try{u(!0);let e=t.event_id;if(o){const t=yield o(e);e=t||""}if(e){r();const t=l.filter((t=>t.event_id!==e));d(t,"events")}}catch(e){console.error(e)}finally{u(!1)}},new((a=void 0)||(a=Promise))((function(t,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function o(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof a?n:new a((function(e){e(n)}))).then(s,o)}l((i=i.apply(e,n||[])).next())}));var e,n,a,i},onEdit:()=>{r(),s(!0,t)}})]})),j instanceof Function?j(t):(0,n.jsx)(a.Typography,Object.assign({style:{padding:"5px 0"},noWrap:!0},{children:t.title}))]})),(0,n.jsxs)("div",Object.assign({style:{padding:"5px 10px"}},{children:[(0,n.jsxs)(a.Typography,Object.assign({style:{display:"flex",alignItems:"center",gap:8},color:"textSecondary",variant:"caption",noWrap:!0},{children:[(0,n.jsx)(Q(),{}),_?x.event.allDay:`${(0,i.format)(t.start,`dd MMMM yyyy ${w}`,{locale:m})} - ${(0,i.format)(t.end,`dd MMMM yyyy ${w}`,{locale:m})}`]})),k.length>0&&(0,n.jsxs)(a.Typography,Object.assign({style:{display:"flex",alignItems:"center",gap:8},color:"textSecondary",variant:"caption",noWrap:!0},{children:[(0,n.jsx)(te(),{}),k.map((e=>e[p.textField])).join(", ")]})),h instanceof Function?h(v,t):h]}))]})}))},re=({event:e,multiday:t,hasPrev:s,hasNext:o,showdate:l=!0})=>{const{direction:d,locale:u,hourFormat:g,eventRenderer:h,onEventClick:v,view:y,draggable:p,editable:m}=S(),j=(e=>{const t=(0,a.useTheme)();return{draggable:!0,onDragStart:n=>{n.stopPropagation(),n.dataTransfer.setData("text/plain",`${e.event_id}`),n.currentTarget.style.backgroundColor=t.palette.error.main},onDragEnd:n=>{n.currentTarget.style.backgroundColor=e.color||t.palette.primary.main},onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDragEnter:e=>{e.stopPropagation(),e.preventDefault()}}})(e),[b,x]=(0,r.useState)(null),[O,_]=(0,r.useState)(!1),w=(0,a.useTheme)(),D=f(g),k="rtl"===d?N():I(),C="rtl"===d?I():N(),M=c(e.start,e.end)<=0&&e.allDay,T=e=>{!(null==e?void 0:e.currentTarget)&&O&&_(!1),x((null==e?void 0:e.currentTarget)||null)},E=(0,r.useMemo)((()=>{if(e.disabled||!m)return!1;let t=void 0===p||p;return void 0!==e.draggable&&(t=e.draggable),t}),[p,m,e.disabled,e.draggable]),F=(0,r.useMemo)((()=>{if("function"==typeof h&&!t&&"month"!==y){const t=h(Object.assign({event:e,onClick:T},j));if(t)return(0,n.jsx)(z,{children:t},`${e.start.getTime()}_${e.end.getTime()}_${e.event_id}`)}let r=(0,n.jsxs)("div",Object.assign({style:{padding:"2px 6px"}},{children:[(0,n.jsx)(a.Typography,Object.assign({variant:"subtitle2",style:{fontSize:12},noWrap:!0},{children:e.title})),l&&(0,n.jsx)(a.Typography,Object.assign({style:{fontSize:11},noWrap:!0},{children:`${(0,i.format)(e.start,D,{locale:u})} - ${(0,i.format)(e.end,D,{locale:u})}`}))]}));return t&&(r=(0,n.jsxs)("div",Object.assign({style:{padding:2,display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[(0,n.jsx)(a.Typography,Object.assign({sx:{fontSize:11},noWrap:!0},{children:s?(0,n.jsx)(C,{fontSize:"small",sx:{display:"flex"}}):l&&!M&&(0,i.format)(e.start,D,{locale:u})})),(0,n.jsx)(a.Typography,Object.assign({variant:"subtitle2",align:"center",sx:{fontSize:12},noWrap:!0},{children:e.title})),(0,n.jsx)(a.Typography,Object.assign({sx:{fontSize:11},noWrap:!0},{children:o?(0,n.jsx)(k,{fontSize:"small",sx:{display:"flex"}}):l&&!M&&(0,i.format)(e.end,D,{locale:u})}))]}))),(0,n.jsx)(z,Object.assign({disabled:e.disabled,sx:{bgcolor:e.disabled?"#d0d0d0":e.color||w.palette.primary.main,color:e.disabled?"#808080":e.textColor||w.palette.primary.contrastText}},{children:(0,n.jsx)(a.ButtonBase,Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),T(t),"function"==typeof v&&v(e)},disabled:e.disabled},{children:(0,n.jsx)("div",Object.assign({},j,{draggable:E},{children:r}))}))}),`${e.start.getTime()}_${e.end.getTime()}_${e.event_id}`)}),[s,o,e,E,u,w.palette]);return(0,n.jsxs)(r.Fragment,{children:[F,(0,n.jsx)(ne,{anchorEl:b,event:e,onTriggerViewer:T})]})},ae=({resource:e})=>{const{resourceHeaderComponent:t,resourceFields:i,resources:s,direction:o,resourceViewMode:l}=S(),{width:d}=function(){const[e,t]=(0,r.useState)({width:0,height:0});return(0,r.useEffect)((()=>{if("undefined"==typeof window)return;const e=()=>{t((e=>{const{innerWidth:t,innerHeight:n}=window;return e.width!==t||e.height!==n?{width:t,height:n}:e}))};return e(),window.addEventListener("resize",e,{capture:!1,passive:!0}),()=>{window.removeEventListener("resize",e)}}),[]),e}(),c=(0,a.useTheme)(),u=e[i.textField],g=e[i.subTextField||""],h=e[i.avatarField||""],v=e[i.colorField||""];if(t instanceof Function)return t(e);const y="tabs"===l?{}:{borderColor:c.palette.grey[300],borderStyle:"solid",borderWidth:"1px 1px 0 1px"};return(0,n.jsxs)(a.ListItem,Object.assign({sx:Object.assign({padding:"2px 10px",textAlign:"rtl"===o?"right":"left"},y),component:"span"},{children:[(0,n.jsx)(a.ListItemAvatar,{children:(0,n.jsx)(a.Avatar,{style:{background:v},alt:u,src:h})}),(0,n.jsx)(a.ListItemText,{primary:(0,n.jsx)(a.Typography,Object.assign({variant:"body2",noWrap:!0},{children:u})),secondary:(0,n.jsx)(a.Typography,Object.assign({variant:"caption",color:"textSecondary",noWrap:!0},{children:g})),style:{width:d/(s.length+1)}})]}))},ie=require("prop-types");var se=e.n(ie);const oe=require("@mui/material/styles");function le(e){const{children:t,value:r,index:a}=e;return r===a?(0,n.jsx)(n.Fragment,{children:t}):(0,n.jsx)(n.Fragment,{})}le.propTypes={children:se().node,index:se().any.isRequired,value:se().any.isRequired};const de=(0,oe.styled)("div")((({theme:e})=>({flexGrow:1,width:"100%",backgroundColor:e.palette.background.paper,alignSelf:"center","& .tabs":{borderColor:e.palette.grey[300],borderStyle:"solid",borderWidth:1,"& button.MuiTab-root":{borderColor:e.palette.grey[300],borderRightStyle:"solid",borderWidth:1}},"& .primary":{background:e.palette.primary.main},"& .secondary":{background:e.palette.secondary.main},"& .error":{background:e.palette.error.main},"& .info":{background:e.palette.info.dark},"& .text_primary":{color:e.palette.primary.main},"& .text_secondary":{color:e.palette.secondary.main},"& .text_error":{color:e.palette.error.main},"& .text_info":{color:e.palette.info.dark}}))),ce=({tabs:e,variant:t="scrollable",tab:r,setTab:i,indicator:s="primary",style:o})=>(0,n.jsxs)(de,Object.assign({style:o},{children:[(0,n.jsx)(a.Tabs,Object.assign({value:r,variant:t,scrollButtons:!0,className:"tabs",classes:{indicator:s}},{children:e.map(((e,t)=>{return(0,n.jsx)(a.Tab,Object.assign({label:e.label,value:e.id},{id:`scrollable-auto-tab-${r=e.id}`,"aria-controls":`scrollable-auto-tabpanel-${r}`},{onClick:()=>i(e.id),onDragEnter:()=>i(e.id)}),e.id||t);var r}))})),e.map(((e,t)=>e.component&&(0,n.jsx)(le,Object.assign({value:r,index:e.id},{children:e.component}),t)))]})),ue=({renderChildren:e})=>{const{resourceViewMode:t}=S();return"tabs"===t?(0,n.jsx)(he,{renderChildren:e}):(0,n.jsx)(ge,{renderChildren:e})},ge=({renderChildren:e})=>{const{resources:t,resourceFields:r}=S();return(0,n.jsx)(n.Fragment,{children:t.map(((t,a)=>(0,n.jsxs)("div",{children:[(0,n.jsx)(ae,{resource:t}),e(t)]},`${t[r.idField]}_${a}`)))})},he=({renderChildren:e})=>{const{resources:t,resourceFields:a,selectedResource:i,handleState:s}=S(),o=t.map((t=>({id:t[a.idField],label:(0,n.jsx)(ae,{resource:t}),component:(0,n.jsx)(n.Fragment,{children:e(t)})}))),l=(0,r.useMemo)((()=>{const e=t[0][a.idField];return i?t.findIndex((e=>e[a.idField]===i))<0?e:i:e}),[t,i,a.idField]);return(0,n.jsx)(ce,{tabs:o,tab:l,setTab:e=>{s(e,"selectedResource")},style:{display:"grid"}})},ve=({day:e,start:t,end:r,resourceKey:i,resourceVal:s,cellRenderer:o,height:l,children:d})=>{const{editable:c}=S(),u=(({start:e,end:t,resourceKey:n,resourceVal:r})=>{const{triggerDialog:i,onDrop:s}=S(),o=(0,a.useTheme)();return{onClick:()=>{i(!0,{start:e,end:t,[n]:r})},onDragOver:e=>{e.currentTarget.style.backgroundColor=(0,a.alpha)(o.palette.secondary.main,.3),e.preventDefault()},onDragEnter:e=>{e.currentTarget.style.backgroundColor=(0,a.alpha)(o.palette.secondary.main,.3)},onDragLeave:e=>{e.currentTarget.style.backgroundColor=""},onDrop:t=>{t.preventDefault(),t.currentTarget.style.backgroundColor="";const a=t.dataTransfer.getData("text");s(a,e,n,r)},[n]:r}})({start:t,end:r,resourceKey:i,resourceVal:s});return o?o(Object.assign({day:e,start:t,end:r,height:l},u)):c?(0,n.jsx)(a.Button,Object.assign({fullWidth:!0,"aria-label":`${t.toLocaleString("en",{dateStyle:"full",timeStyle:"long"})} - ${r.toLocaleString("en",{dateStyle:"full",timeStyle:"long"})}`},u,{children:d})):null},ye=1;function pe({startHour:e,step:t,minuteHeight:n,timeZone:r}){const a=p(new Date,r),s=(0,i.differenceInMinutes)(a,(0,i.set)(a,{hours:e,minutes:0}));return s*n+(s/t+ye)}const me=e=>{const[t,a]=(0,r.useState)(pe(e));return(0,r.useEffect)((()=>{const t=setInterval((()=>a(pe(e))),6e4);return()=>clearInterval(t)}),[]),t<0?null:(0,n.jsxs)(H,Object.assign({style:{top:t,zIndex:e.zIndex}},{children:[(0,n.jsx)("div",{}),(0,n.jsx)("div",{})]}))},fe=({todayEvents:e,today:t,startHour:a,step:s,minuteHeight:o,direction:l,timeZone:d})=>{const c=[];return(0,n.jsxs)(r.Fragment,{children:[m({dateLeft:t,timeZone:d})&&(0,n.jsx)(me,{startHour:a,step:s,minuteHeight:o,timeZone:d,zIndex:2*e.length+1}),e.map(((r,d)=>{const u=(0,i.differenceInMinutes)(r.end,r.start)*o-ye,g=(0,i.differenceInMinutes)(r.start,(0,i.setHours)(t,a)),h=u/60*ye,v=g*o+g/s,y=((e,t)=>e.filter((e=>e.event_id!==t.event_id&&((0,i.isWithinInterval)((0,i.addMinutes)(t.start,1),{start:e.start,end:e.end})||(0,i.isWithinInterval)((0,i.addMinutes)(t.end,-1),{start:e.start,end:e.end})||(0,i.isWithinInterval)((0,i.addMinutes)(e.start,1),{start:t.start,end:t.end})||(0,i.isWithinInterval)((0,i.addMinutes)(e.end,-1),{start:t.start,end:t.end})))))(e,r),p=y.filter((e=>c.includes(e.event_id)));return c.push(r.event_id),(0,n.jsx)("div",Object.assign({className:"rs__event__item",style:{height:u+h,top:v,width:p.length>0?`calc(100% - ${100-98/(p.length+1)}%)`:"98%",zIndex:e.length+d,["rtl"===l?"right":"left"]:p.length>0?100/(y.length+1)*p.length+"%":""}},{children:(0,n.jsx)(re,{event:r})}),r.event_id)}))]})},je=()=>{const e=(0,r.useRef)(null),t=(0,r.useRef)(null);return(0,r.useEffect)((()=>{const n=e.current,r=t.current,a=e=>{const t=e.currentTarget;null==r||r.scroll({left:t.scrollLeft}),null==n||n.scroll({left:t.scrollLeft})};return null==n||n.addEventListener("scroll",a),null==r||r.addEventListener("scroll",a),()=>{null==n||n.removeEventListener("scroll",a),null==r||r.removeEventListener("scroll",a)}})),{headersRef:e,bodyRef:t}},be=(0,r.createContext)({renderedSlots:{},setRenderedSlot:()=>{}}),xe=()=>(0,r.useContext)(be),Oe=({day:e,events:t})=>{const[s,o]=(0,r.useState)(null),[l,d]=(0,r.useState)(),[c,u]=(0,r.useState)(!1),{locale:g,hourFormat:h,eventRenderer:v,onEventClick:y,timeZone:p}=S(),j=(0,a.useTheme)(),b=f(h),x=e=>{!(null==e?void 0:e.currentTarget)&&c&&u(!1),o((null==e?void 0:e.currentTarget)||null)};return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(a.List,{children:t.map((t=>{const r=m({dateLeft:t.start,dateRight:e,timeZone:p})?b:`MMM d, ${b}`,s=(0,i.format)(t.start,r,{locale:g}),o=m({dateLeft:t.end,dateRight:e,timeZone:p})?b:`MMM d, ${b}`,l=(0,i.format)(t.end,o,{locale:g});return"function"==typeof v?v({event:t,onClick:x}):(0,n.jsxs)(a.ListItemButton,Object.assign({disabled:t.disabled,onClick:e=>{e.preventDefault(),e.stopPropagation(),x(e),d(t),"function"==typeof y&&y(t)}},{children:[(0,n.jsx)(a.ListItemAvatar,{children:(0,n.jsx)(a.Avatar,Object.assign({sx:{bgcolor:t.disabled?"#d0d0d0":t.color||j.palette.primary.main,color:t.disabled?"#808080":t.textColor||j.palette.primary.contrastText}},{children:" "}))}),(0,n.jsx)(a.ListItemText,{primary:t.title,secondary:`${s} - ${l}`})]}),`${t.start.getTime()}_${t.end.getTime()}_${t.event_id}`)}))}),l&&(0,n.jsx)(ne,{anchorEl:s,event:l,onTriggerViewer:x})]})},_e=()=>{const{height:e,translations:t}=S();return(0,n.jsx)(L,Object.assign({sx:{borderWidth:1,padding:1,height:e/2,display:"flex",alignItems:"center",justifyContent:"center"}},{children:(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda_items"},{children:(0,n.jsx)(a.Typography,{children:t.noDataToDisplay})}))}))},we=({daysList:e,events:t})=>{const{week:s,handleGotoDay:o,locale:l,timeZone:d}=S(),{disableGoToDay:c,headRenderer:u}=s;return(0,r.useMemo)((()=>e.some((e=>g(t,e).length>0))),[e,t])?(0,n.jsx)(L,{children:e.map(((e,r)=>{const s=m({dateLeft:e,timeZone:d}),h=g(t,e);return h.length?(0,n.jsxs)("div",Object.assign({className:"rs__agenda_row "+((0,i.isToday)(e)?"rs__today_cell":"")},{children:[(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda__cell"},{children:"function"==typeof u?(0,n.jsx)("div",{children:u(e)}):(0,n.jsx)(a.Typography,Object.assign({sx:{fontWeight:s?"bold":"inherit"},color:s?"primary":"inherit",variant:"body2",className:c?"":"rs__hover__op",onClick:t=>{t.stopPropagation(),c||o(e)}},{children:(0,i.format)(e,"dd E",{locale:l})}))})),(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda_items"},{children:(0,n.jsx)(Oe,{day:e,events:h})}))]}),r):null}))}):(0,n.jsx)(_e,{})};const De=()=>{const{week:e,selectedDate:t,height:s,events:g,handleGotoDay:h,getRemoteEvents:v,triggerLoading:p,handleState:m,resources:j,resourceFields:b,resourceViewMode:x,fields:O,direction:_,locale:w,hourFormat:D,timeZone:k,stickyNavigation:C,agenda:M}=S(),{renderedSlots:T}=xe(),{weekStartOn:F,weekDays:I,startHour:R,endHour:N,step:P,cellRenderer:$,disableGoToDay:W,headRenderer:L,hourRenderer:z}=e,A=(0,i.startOfWeek)(t,{weekStartsOn:F}),B=I.map((e=>(0,i.addDays)(A,e))),H=(0,i.startOfDay)(B[0]),V=(0,i.endOfDay)(B[B.length-1]),Z=(0,i.set)(t,{hours:R,minutes:0,seconds:0}),G=(0,i.set)(t,{hours:N,minutes:-P,seconds:0}),K=(0,i.eachMinuteOfInterval)({start:Z,end:G},{step:P}),X=d(s,K.length),U=l(X,P),Q=f(D),{headersRef:Y,bodyRef:J}=je(),ee=(0,r.useCallback)((()=>{return e=void 0,t=void 0,r=function*(){try{p(!0);const e=yield v({start:H,end:V,view:"week"});Array.isArray(e)&&m(e,"events")}catch(e){throw e}finally{p(!1)}},new((n=void 0)||(n=Promise))((function(a,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}),[t,v]);(0,r.useEffect)((()=>{v instanceof Function&&ee()}),[ee,v]);const te=(e,t,r)=>{const a=(0,i.isSameDay)(H,t);return y(e,B).filter((e=>(0,i.isBefore)(e.start,H)?a:(0,i.isSameDay)(e.start,t))).sort(((e,t)=>t.end.getTime()-e.end.getTime())).map(((e,a)=>{var s;const o=(0,i.isBefore)((0,i.startOfDay)(e.start),H),l=(0,i.isAfter)((0,i.endOfDay)(e.end),V),d=c(o?H:e.start,l?V:e.end)+1,u=(0,i.format)(t,"yyyy-MM-dd"),g=r?r[b.idField]:"all",h=null===(s=null==T?void 0:T[g])||void 0===s?void 0:s[u],v=(null==h?void 0:h[e.event_id])||0;return(0,n.jsx)("div",Object.assign({className:"rs__multi_day",style:{top:28*v+45,width:99.9*d+"%",overflowX:"hidden"}},{children:(0,n.jsx)(re,{event:e,hasPrev:o,hasNext:l,multiday:!0})}),e.event_id)}))},ne=e=>{let t=g;if(e&&(t=o(g,e,b,O)),M)return(0,n.jsx)(we,{daysList:B,events:t});const s=j.length&&"tabs"!==x,l=28*y(s?g:t,B,0,!0).length+45;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(q,Object.assign({days:B.length,ref:Y,sticky:"1",stickyNavigation:C},{children:[(0,n.jsx)("span",{className:"rs__cell rs__time"}),B.map(((r,a)=>(0,n.jsxs)("span",Object.assign({className:"rs__cell rs__header "+((0,i.isToday)(r)?"rs__today_cell":""),style:{height:l}},{children:["function"==typeof L?(0,n.jsx)("div",{children:L(r)}):(0,n.jsx)(E,{date:r,onClick:W?void 0:h,locale:w}),te(t,r,e)]}),a)))]})),(0,n.jsx)(q,Object.assign({days:B.length,ref:J},{children:K.map(((s,o)=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)("span",Object.assign({style:{height:X},className:"rs__cell rs__header rs__time"},{children:"function"==typeof z?(0,n.jsx)("div",{children:z((0,i.format)(s,Q,{locale:w}))}):(0,n.jsx)(a.Typography,Object.assign({variant:"caption"},{children:(0,i.format)(s,Q,{locale:w})}))})),B.map(((r,a)=>{const l=new Date(`${(0,i.format)(r,"yyyy/MM/dd")} ${(0,i.format)(s,Q)}`),d=(0,i.addMinutes)(l,P),c=b.idField;return(0,n.jsxs)("span",Object.assign({className:"rs__cell "+((0,i.isToday)(r)?"rs__today_cell":"")},{children:[0===o&&(0,n.jsx)(fe,{todayEvents:u(t,r),today:r,minuteHeight:U,startHour:R,step:P,direction:_,timeZone:k}),(0,n.jsx)(ve,{start:l,end:d,day:r,height:X,resourceKey:c,resourceVal:e?e[c]:null,cellRenderer:$})]}),a)}))]},o)))}))]})};return j.length?(0,n.jsx)(ue,{renderChildren:ne}):ne()},ke=require("@mui/x-date-pickers/LocalizationProvider"),Ce=require("@mui/x-date-pickers/AdapterDateFns"),Me=({children:e})=>{const{locale:t}=S();return(0,n.jsx)(ke.LocalizationProvider,Object.assign({dateAdapter:Ce.AdapterDateFns,adapterLocale:t},{children:e}))},Te=require("@mui/icons-material/NavigateBeforeRounded");var Se=e.n(Te);const Ee=require("@mui/icons-material/NavigateNextRounded");var Fe=e.n(Ee);const Ie=e=>{var{type:t,onClick:r}=e,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(e,["type","onClick"]);const{direction:s}=S();let o=Fe();return"prev"===t?o="rtl"===s?Fe():Se():"next"===t&&(o="rtl"===s?Se():Fe()),(0,n.jsx)(a.IconButton,Object.assign({style:{padding:2},onClick:r,onDragOver:e=>{e.preventDefault(),r&&r()}},i,{children:(0,n.jsx)(o,{})}))},Re=require("@mui/x-date-pickers"),Ne=({selectedDate:e,onChange:t,weekProps:s})=>{const{locale:o,navigationPickerProps:l}=S(),[d,c]=(0,r.useState)(null),{weekStartOn:u}=s,g=(0,i.startOfWeek)(e,{weekStartsOn:u}),h=(0,i.endOfWeek)(e,{weekStartsOn:u}),v=()=>{c(null)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ie,{type:"prev",onClick:()=>{const e=(0,i.addDays)(g,-1);t(e)},"aria-label":"previous week"}),(0,n.jsx)(a.Button,Object.assign({style:{padding:4},onClick:e=>{c(e.currentTarget)},"aria-label":"selected week"},{children:`${(0,i.format)(g,"dd",{locale:o})} - ${(0,i.format)(h,"dd MMM yyyy",{locale:o})}`})),(0,n.jsx)(a.Popover,Object.assign({open:Boolean(d),anchorEl:d,onClose:v,anchorOrigin:{vertical:"bottom",horizontal:"left"}},{children:(0,n.jsx)(Me,{children:(0,n.jsx)(Re.DateCalendar,Object.assign({},l,{openTo:"day",views:["month","day"],value:e,onChange:e=>{t(e||new Date),v()}}))})})),(0,n.jsx)(Ie,{type:"next",onClick:()=>{const e=(0,i.addDays)(h,1);t(e)},"aria-label":"next week"})]})},Pe=({selectedDate:e,onChange:t})=>{const{locale:s,navigationPickerProps:o}=S(),[l,d]=(0,r.useState)(null),c=()=>{d(null)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ie,{type:"prev",onClick:()=>{const n=(0,i.addDays)(e,-1);t(n)},"aria-label":"previous day"}),(0,n.jsx)(a.Button,Object.assign({style:{padding:4},onClick:e=>{d(e.currentTarget)},"aria-label":"selected date"},{children:(0,i.format)(e,"dd MMMM yyyy",{locale:s})})),(0,n.jsx)(a.Popover,Object.assign({open:Boolean(l),anchorEl:l,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"left"}},{children:(0,n.jsx)(Me,{children:(0,n.jsx)(Re.DateCalendar,Object.assign({},o,{openTo:"day",views:["month","day"],value:e,onChange:e=>{t(e||new Date),c()}}))})})),(0,n.jsx)(Ie,{type:"next",onClick:()=>{const n=(0,i.addDays)(e,1);t(n)},"aria-label":"next day"})]})},$e=({selectedDate:e,onChange:t})=>{const{locale:s,navigationPickerProps:o}=S(),l=(0,i.getMonth)(e),[d,c]=(0,r.useState)(null),u=()=>{c(null)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ie,{type:"prev",onClick:()=>{const n=l-1;t((0,i.setMonth)(e,n))},"aria-label":"previous month"}),(0,n.jsx)(a.Button,Object.assign({style:{padding:4},onClick:e=>{c(e.currentTarget)},"aria-label":"selected month"},{children:(0,i.format)(e,"MMMM yyyy",{locale:s})})),(0,n.jsx)(a.Popover,Object.assign({open:Boolean(d),anchorEl:d,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"left"}},{children:(0,n.jsx)(Me,{children:(0,n.jsx)(Re.DateCalendar,Object.assign({},o,{openTo:"month",views:["year","month"],value:e,onChange:e=>{t(e||new Date),u()}}))})})),(0,n.jsx)(Ie,{type:"next",onClick:()=>{const n=l+1;t((0,i.setMonth)(e,n))},"aria-label":"next month"})]})},We=require("@mui/icons-material/MoreVert");var Le=e.n(We);const qe=require("@mui/icons-material/ViewAgenda");var ze=e.n(qe);const Ae=()=>{const{selectedDate:e,view:t,week:i,handleState:s,getViews:o,translations:l,navigation:d,day:c,month:u,disableViewNavigator:g,onSelectedDateChange:h,onViewChange:v,stickyNavigation:y,timeZone:m,agenda:f,toggleAgenda:j}=S(),[b,x]=(0,r.useState)(null),O=(0,a.useTheme)(),_=(0,a.useMediaQuery)(O.breakpoints.up("sm")),w=o(),D=e=>{x(e||null)},k=e=>{s(e,"selectedDate"),h&&"function"==typeof h&&h(e)},C=e=>{s(e,"view"),v&&"function"==typeof v&&v(e)};return!d&&g?null:(0,n.jsxs)(W,Object.assign({sticky:y?"1":"0"},{children:[(0,n.jsx)("div",Object.assign({"data-testid":"date-navigator"},{children:d&&(()=>{switch(t){case"month":return(null==u?void 0:u.navigation)&&(0,n.jsx)($e,{selectedDate:e,onChange:k});case"week":return(null==i?void 0:i.navigation)&&(0,n.jsx)(Ne,{selectedDate:e,onChange:k,weekProps:i});case"day":return(null==c?void 0:c.navigation)&&(0,n.jsx)(Pe,{selectedDate:e,onChange:k});default:return""}})()})),(0,n.jsxs)("div",Object.assign({className:"rs__view_navigator","data-testid":"view-navigator",style:{visibility:g?"hidden":"visible"}},{children:[(0,n.jsx)(a.Button,Object.assign({onClick:()=>k(p(new Date,m)),"aria-label":l.navigation.today},{children:l.navigation.today})),_?(0,n.jsx)(a.Button,Object.assign({color:f?"primary":"inherit",onClick:j,"aria-label":l.navigation.agenda},{children:l.navigation.agenda})):(0,n.jsx)(a.IconButton,Object.assign({color:f?"primary":"default",style:{padding:5},onClick:j},{children:(0,n.jsx)(ze(),{})})),w.length>1&&(_?w.map((e=>(0,n.jsx)(a.Button,Object.assign({color:e===t?"primary":"inherit",onClick:()=>C(e),onDragOver:t=>{t.preventDefault(),C(e)}},{children:l.navigation[e]}),e))):(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(a.IconButton,Object.assign({style:{padding:5},onClick:e=>{D(e.currentTarget)}},{children:(0,n.jsx)(Le(),{})})),(0,n.jsx)(a.Popover,Object.assign({open:Boolean(b),anchorEl:b,onClose:()=>{D()},anchorOrigin:{vertical:"center",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},{children:(0,n.jsx)(a.MenuList,Object.assign({autoFocusItem:!!b,disablePadding:!0},{children:w.map((e=>(0,n.jsx)(a.MenuItem,Object.assign({selected:e===t,onClick:()=>{D(),C(e)}},{children:l.navigation[e]}),e)))}))}))]}))]}))]}))},Be=require("@mui/x-date-pickers/DatePicker"),He=require("@mui/x-date-pickers/DateTimePicker"),Ve=({type:e="datetime",value:t,label:a,name:i,onChange:s,variant:o="outlined",error:l,errMsg:d,touched:c,required:u})=>{var g;const{translations:h}=S(),[v,y]=(0,r.useState)({touched:!1,valid:!!t,errorMsg:d||(u?(null===(g=null==h?void 0:h.validation)||void 0===g?void 0:g.required)||"Required":void 0)}),p="date"===e?Be.DatePicker:He.DateTimePicker,m=v.touched&&(l||!v.valid);(0,r.useEffect)((()=>{c&&f(t)}),[c]);const f=e=>{var t;const n=!isNaN(Date.parse(e)),r="string"==typeof e&&n?new Date(e):e;let a=!0,o=d;u&&!r&&(a=!1,o=d||(null===(t=null==h?void 0:h.validation)||void 0===t?void 0:t.required)||"Required"),y((e=>Object.assign(Object.assign({},e),{touched:!0,valid:a,errorMsg:o}))),s(i,r)};return(0,n.jsx)(Me,{children:(0,n.jsx)(p,{value:t,label:a,onChange:e=>{f(e)},minutesStep:5,slotProps:{textField:{variant:o,helperText:m&&v.errorMsg,error:m,fullWidth:!0}}})})},Ze=({variant:e="outlined",label:t,placeholder:i,value:s,name:o,required:l,min:d,max:c,email:u,decimal:g,onChange:h,disabled:v,multiline:y,rows:p,touched:m})=>{const[f,j]=(0,r.useState)({touched:!1,valid:!1,errorMsg:""}),{translations:b}=S();(0,r.useEffect)((()=>{m&&x(s)}),[m]);const x=e=>{var t,n,r,a,i,s,v,y,p;const m=e;let f=!0,x="";u&&(f=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(m)&&f,x=(null===(t=null==b?void 0:b.validation)||void 0===t?void 0:t.invalidEmail)||"Invalid Email"),g&&(f=/^[0-9]+(\.[0-9]*)?$/.test(m)&&f,x=(null===(n=null==b?void 0:b.validation)||void 0===n?void 0:n.onlyNumbers)||"Only Numbers Allowed"),d&&`${m}`.trim().length<d&&(f=!1,x="function"==typeof(null===(r=null==b?void 0:b.validation)||void 0===r?void 0:r.min)?null===(a=null==b?void 0:b.validation)||void 0===a?void 0:a.min(d):(null===(i=null==b?void 0:b.validation)||void 0===i?void 0:i.min)||`Minimum ${d} letters`),c&&`${m}`.trim().length>c&&(f=!1,x="function"==typeof(null===(s=null==b?void 0:b.validation)||void 0===s?void 0:s.max)?null===(v=null==b?void 0:b.validation)||void 0===v?void 0:v.max(c):(null===(y=null==b?void 0:b.validation)||void 0===y?void 0:y.max)||`Maximum ${c} letters`),l&&`${m}`.trim().length<=0&&(f=!1,x=(null===(p=null==b?void 0:b.validation)||void 0===p?void 0:p.required)||"Required"),j({touched:!0,valid:f,errorMsg:x}),h(o,m,f)};return(0,n.jsx)(a.TextField,{variant:e,label:t&&(0,n.jsx)(a.Typography,Object.assign({variant:"body2"},{children:`${t} ${l?"*":""}`})),value:s,name:o,onChange:e=>x(e.target.value),disabled:v,error:f.touched&&!f.valid,helperText:f.touched&&!f.valid&&f.errorMsg,multiline:y,rows:p,style:{width:"100%"},InputProps:{placeholder:i||""}})},Ge=require("@mui/icons-material/ExpandMore");var Ke=e.n(Ge);const Xe=({options:e,value:t,name:i,required:s,onChange:o,label:l,disabled:d,touched:c,variant:u="outlined",loading:g,multiple:h,placeholder:v,errMsg:y})=>{var p;const m=(0,a.useTheme)(),{translations:f}=S(),[j,b]=(0,r.useState)({touched:!1,valid:!!t,errorMsg:y||(s?(null===(p=null==f?void 0:f.validation)||void 0===p?void 0:p.required)||"Required":void 0)});(0,r.useEffect)((()=>{c&&x(t)}),[c]);const x=e=>{var t;const n=e;let r=!0,a=y;!s||(h?n.length:n)||(r=!1,a=y||(null===(t=null==f?void 0:f.validation)||void 0===t?void 0:t.required)||"Required"),b((e=>Object.assign(Object.assign({},e),{touched:!0,valid:r,errorMsg:a}))),o(i,n,r)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.FormControl,Object.assign({variant:u||"outlined",fullWidth:!0,error:s&&j.touched&&!j.valid,disabled:d},{children:[l&&(0,n.jsx)(a.InputLabel,Object.assign({id:`input_${i}`},{children:(0,n.jsx)(a.Typography,Object.assign({variant:"body2"},{children:`${l} ${s?"*":""}`}))})),(0,n.jsxs)(a.Select,Object.assign({label:l,labelId:`input_${i}`,value:t,onBlur:()=>{j.touched||b((e=>Object.assign(Object.assign({},e),{touched:!0,errorMsg:y||e.errorMsg})))},onChange:e=>x(e.target.value),IconComponent:g?()=>(0,n.jsx)(a.CircularProgress,{size:5}):Ke(),multiple:!!h,classes:{select:"chips"===h?"flex__wrap":void 0},renderValue:t=>{if(!t||0===t.length)return(0,n.jsx)("em",{children:l});const r=[];if(h){for(const n of e)t.includes(n.value)&&r.push([n.text]);return"chips"===h?r.map(((e,t)=>(0,n.jsx)(a.Chip,{label:e,style:{margin:"0 2px"},color:"primary"},`${e}_${t}`))):r.join(",")}for(const n of e)t===n.value&&r.push([n.text]);return r.join(",")}},{children:[v&&(0,n.jsx)(a.MenuItem,Object.assign({value:""},{children:(0,n.jsx)("em",{children:v})})),e.map((e=>(0,n.jsxs)(a.MenuItem,Object.assign({value:e.value},{children:[h&&(0,n.jsx)(a.Checkbox,{checked:t.indexOf(e.value)>-1,color:"primary"}),e.text]}),e.id||e.value)))]}))]})),(0,n.jsx)(a.FormHelperText,Object.assign({style:{color:m.palette.error.main}},{children:j.touched&&!j.valid&&j.errorMsg}))]})};const Ue=(e,t)=>{var n;const r={};for(const a of e){const e=s(a,a.default,t),i=s(a,null==t?void 0:t[a.name],t);r[a.name]={value:i.value||e.value||"",validity:!(null===(n=a.config)||void 0===n?void 0:n.required)||!!i.validity||!!e.validity,type:a.type,config:a.config}}return Object.assign({event_id:{value:(null==t?void 0:t.event_id)||null,validity:!0,type:"hidden"},title:{value:(null==t?void 0:t.title)||"",validity:!!(null==t?void 0:t.title),type:"input",config:{label:"Title",required:!0,min:3}},start:{value:(null==t?void 0:t.start)||new Date,validity:!0,type:"date",config:{label:"Start",sm:6}},end:{value:(null==t?void 0:t.end)||new Date,validity:!0,type:"date",config:{label:"End",sm:6}}},r)},Qe=()=>{const{fields:e,dialog:t,triggerDialog:s,selectedRange:o,selectedEvent:l,resourceFields:d,selectedResource:c,triggerLoading:u,onConfirm:g,customEditor:h,confirmEvent:v,dialogMaxWidth:y,translations:p}=S(),[m,f]=(0,r.useState)(Ue(e,l||o)),[j,b]=(0,r.useState)(!1),x=(0,a.useTheme)(),O=(0,a.useMediaQuery)(x.breakpoints.down("sm")),_=(e,t,n)=>{f((r=>Object.assign(Object.assign({},r),{[e]:Object.assign(Object.assign({},r[e]),{value:t,validity:n})})))},w=t=>{t&&f(Ue(e)),s(!1)},D=()=>{return e=void 0,t=void 0,r=function*(){let e={};for(const t in m)if(e[t]=m[t].value,!h&&!m[t].validity)return b(!0);try{u(!0),e.end=e.start>=e.end?(0,i.addMinutes)(e.start,(0,i.differenceInMinutes)(null==o?void 0:o.end,null==o?void 0:o.start)):e.end;const t=(null==l?void 0:l.event_id)?"edit":"create";g?e=yield g(e,t):e.event_id=(null==l?void 0:l.event_id)||Date.now().toString(36)+Math.random().toString(36).slice(2),v(e,t),w(!0)}catch(e){console.error(e)}finally{u(!1)}},new((n=void 0)||(n=Promise))((function(a,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r},k=t=>{var r,a,i;const s=m[t];switch(s.type){case"input":return(0,n.jsx)(Ze,Object.assign({value:s.value,name:t,onChange:_,touched:j},s.config,{label:p.event[t]||(null===(r=s.config)||void 0===r?void 0:r.label)}));case"date":return(0,n.jsx)(Ve,Object.assign({value:s.value,name:t,onChange:(...e)=>_(...e,!0),touched:j},s.config,{label:p.event[t]||(null===(a=s.config)||void 0===a?void 0:a.label)}));case"select":const o=e.find((e=>e.name===t));return(0,n.jsx)(Xe,Object.assign({value:s.value,name:t,options:(null==o?void 0:o.options)||[],onChange:_,touched:j},s.config,{label:p.event[t]||(null===(i=s.config)||void 0===i?void 0:i.label)}));default:return""}};return(0,n.jsx)(a.Dialog,Object.assign({open:t,fullScreen:O,maxWidth:y},{children:(()=>{if(h){const e={state:m,close:()=>s(!1),loading:e=>u(e),edited:l,onConfirm:v,[d.idField]:c};return h(e)}return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(a.DialogTitle,{children:l?p.form.editTitle:p.form.addTitle}),(0,n.jsx)(a.DialogContent,Object.assign({style:{overflowX:"hidden"}},{children:(0,n.jsx)(a.Grid,Object.assign({container:!0,spacing:2},{children:Object.keys(m).map((e=>{var t;const r=m[e];return(0,n.jsx)(a.Grid,Object.assign({item:!0,sm:null===(t=r.config)||void 0===t?void 0:t.sm,xs:12},{children:k(e)}),e)}))}))})),(0,n.jsxs)(a.DialogActions,{children:[(0,n.jsx)(a.Button,Object.assign({color:"inherit",fullWidth:!0,onClick:()=>w()},{children:p.form.cancel})),(0,n.jsx)(a.Button,Object.assign({color:"primary",fullWidth:!0,onClick:D},{children:p.form.confirm}))]})]})})()}))},Ye=({events:e,resourceId:t,today:s,eachWeekStart:o,eachFirstDayInCalcRow:l,daysList:d,onViewMore:u,cellHeight:g})=>{const h=Math.round((g-27)/28-1),{translations:v,month:y,locale:p}=S(),{renderedSlots:m}=xe(),f=(0,r.useMemo)((()=>{var r;const g=[];for(let f=0;f<Math.min(e.length,h+1);f++){const j=e[f],b=!!l&&(0,i.isBefore)(j.start,l),x=b&&l?l:j.start;let O=c(x,j.end)+1;const _=(0,i.differenceInCalendarWeeks)(j.end,x,{weekStartsOn:null==y?void 0:y.weekStartOn,locale:p})>0;if(_){const e=(0,i.startOfWeek)(j.start,{weekStartsOn:null==y?void 0:y.weekStartOn,locale:p}),t=(0,i.closestTo)(e,o);t&&(O=d.length-(l?0:(0,i.differenceInDays)(j.start,t)))}const w=(0,i.format)(s,"yyyy-MM-dd"),D=null===(r=null==m?void 0:m[t||"all"])||void 0===r?void 0:r[w],k=(null==D?void 0:D[j.event_id])||0,C=28*Math.min(k,h)+27;if(k>=h){g.push((0,n.jsx)(a.Typography,Object.assign({width:"100%",className:"rs__multi_day rs__hover__op",style:{top:C,fontSize:11},onClick:e=>{e.stopPropagation(),u(j.start)}},{children:`${Math.abs(e.length-f)} ${v.moreEvents}`}),f));break}g.push((0,n.jsx)("div",Object.assign({className:"rs__multi_day",style:{top:C,width:100*O+"%"}},{children:(0,n.jsx)(re,{event:j,showdate:!1,multiday:c(j.start,j.end)>0,hasPrev:b,hasNext:_})}),`${j.event_id}_${f}`))}return g}),[t,m,e,h,l,null==y?void 0:y.weekStartOn,p,s,o,d.length,v.moreEvents,u]);return(0,n.jsx)(r.Fragment,{children:f})},Je=({events:e})=>{const{month:t,handleGotoDay:s,locale:o,timeZone:l,selectedDate:d}=S(),{disableGoToDay:c,headRenderer:u}=t,h=(0,i.getDaysInMonth)(d),v=Array.from({length:h},((e,t)=>t+1));return(0,r.useMemo)((()=>e.filter((e=>(0,i.isSameMonth)(e.start,d)))),[e,d]).length?(0,n.jsx)(L,{children:v.map((t=>{const r=new Date(d.getFullYear(),d.getMonth(),t),h=m({dateLeft:r,timeZone:l}),v=g(e,r);return v.length?(0,n.jsxs)("div",Object.assign({className:"rs__agenda_row "+((0,i.isToday)(r)?"rs__today_cell":"")},{children:[(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda__cell"},{children:"function"==typeof u?(0,n.jsx)("div",{children:u(r)}):(0,n.jsx)(a.Typography,Object.assign({sx:{fontWeight:h?"bold":"inherit"},color:h?"primary":"inherit",variant:"body2",className:c?"":"rs__hover__op",onClick:e=>{e.stopPropagation(),c||s(r)}},{children:(0,i.format)(r,"dd E",{locale:o})}))})),(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda_items"},{children:(0,n.jsx)(Oe,{day:r,events:v})}))]}),t):null}))}):(0,n.jsx)(_e,{})};const et=()=>{const{month:e,selectedDate:t,height:s,events:l,handleGotoDay:d,getRemoteEvents:c,triggerLoading:u,handleState:g,resources:h,resourceFields:y,fields:p,locale:j,hourFormat:b,stickyNavigation:x,timeZone:O,agenda:_}=S(),{weekStartOn:w,weekDays:D,startHour:k,endHour:C,cellRenderer:M,headRenderer:T,disableGoToDay:E}=e,F=(0,i.startOfMonth)(t),I=(0,i.endOfMonth)(t),R=(0,i.eachWeekOfInterval)({start:F,end:I},{weekStartsOn:w}),N=f(b),P=D.map((e=>(0,i.addDays)(R[0],e))),$=s/R.length,W=(0,a.useTheme)(),{headersRef:L,bodyRef:z}=je(),A=(0,r.useCallback)((()=>{return e=void 0,t=void 0,r=function*(){try{u(!0);const e=R[0],t=(0,i.addDays)(R[R.length-1],P.length),n=yield c({start:e,end:t,view:"month"});n&&(null==n?void 0:n.length)&&g(n,"events")}catch(e){throw e}finally{u(!1)}},new((n=void 0)||(n=Promise))((function(a,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}),[t,c]);(0,r.useEffect)((()=>{c instanceof Function&&A()}),[A,c]);const B=(0,r.useCallback)((e=>{let s=v(l);e&&(s=o(l,e,y,p));const c=[];for(const o of R){const l=D.map((l=>{const c=(0,i.addDays)(o,l),u=new Date(`${(0,i.format)((0,i.setHours)(c,k),`yyyy/MM/dd ${N}`)}`),g=new Date(`${(0,i.format)((0,i.setHours)(c,C),`yyyy/MM/dd ${N}`)}`),h=y.idField,v=(0,i.isSameDay)(o,c)?c:null,p=s.filter((e=>v&&(0,i.isWithinInterval)(v,{start:(0,i.startOfDay)(e.start),end:(0,i.endOfDay)(e.end)})||(0,i.isSameDay)(e.start,c))),f=m({dateLeft:c,timeZone:O});return(0,n.jsxs)("span",Object.assign({style:{height:$},className:"rs__cell"},{children:[(0,n.jsx)(ve,{start:u,end:g,day:t,height:$,resourceKey:h,resourceVal:e?e[h]:null,cellRenderer:M}),(0,n.jsxs)(r.Fragment,{children:["function"==typeof T?(0,n.jsx)("div",Object.assign({style:{position:"absolute",top:0}},{children:T(c)})):(0,n.jsx)(a.Avatar,Object.assign({style:{width:27,height:27,position:"absolute",top:0,background:f?W.palette.secondary.main:"transparent",color:f?W.palette.secondary.contrastText:"",marginBottom:2}},{children:(0,n.jsx)(a.Typography,Object.assign({color:(0,i.isSameMonth)(c,F)?"textPrimary":"#ccc",className:E?"":"rs__hover__op",onClick:e=>{e.stopPropagation(),E||d(c)}},{children:(0,i.format)(c,"dd")}))})),(0,n.jsx)(Ye,{events:p,resourceId:null==e?void 0:e[h],today:c,eachWeekStart:R,eachFirstDayInCalcRow:v,daysList:P,onViewMore:e=>{d(e)},cellHeight:$})]})]}),l.toString())}));c.push((0,n.jsx)(r.Fragment,{children:l},o.toString()))}return c}),[$,M,P,E,R,C,l,p,N,d,T,F,y,t,k,W.palette.secondary.contrastText,W.palette.secondary.main,D,O]),H=(0,r.useCallback)((e=>{if(_){let t=v(l);return e&&(t=o(l,e,y,p)),(0,n.jsx)(Je,{events:t})}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(q,Object.assign({days:P.length,ref:L,indent:"0",sticky:"1",stickyNavigation:x},{children:P.map(((e,t)=>(0,n.jsx)(a.Typography,Object.assign({className:"rs__cell rs__header rs__header__center",align:"center",variant:"body2"},{children:(0,i.format)(e,"EE",{locale:j})}),t)))})),(0,n.jsx)(q,Object.assign({days:P.length,ref:z,indent:"0"},{children:B(e)}))]})}),[_,z,P,l,p,L,j,B,y,x]);return h.length?(0,n.jsx)(ue,{renderChildren:H}):H()},tt=({events:e})=>{const{day:t,locale:s,selectedDate:o}=S(),{headRenderer:l}=t,d=(0,r.useMemo)((()=>g(e,o)),[e,o]);return d.length?(0,n.jsx)(L,{children:(0,n.jsxs)("div",Object.assign({className:"rs__agenda_row rs__today_cell"},{children:[(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda__cell"},{children:"function"==typeof l?(0,n.jsx)("div",{children:l(o)}):(0,n.jsx)(a.Typography,Object.assign({variant:"body2"},{children:(0,i.format)(o,"dd E",{locale:s})}))})),(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda_items"},{children:(0,n.jsx)(Oe,{day:o,events:d})}))]}))}):(0,n.jsx)(_e,{})};const nt=()=>{const{day:e,selectedDate:t,events:s,height:c,getRemoteEvents:g,triggerLoading:h,handleState:v,resources:p,resourceFields:m,resourceViewMode:j,fields:b,direction:x,locale:O,hourFormat:_,timeZone:w,stickyNavigation:D,agenda:k}=S(),{startHour:C,endHour:M,step:T,cellRenderer:F,headRenderer:I,hourRenderer:R}=e,N=(0,i.set)(t,{hours:C,minutes:0,seconds:0}),P=(0,i.set)(t,{hours:M,minutes:-T,seconds:0}),$=(0,i.eachMinuteOfInterval)({start:N,end:P},{step:T}),W=d(c,$.length),L=l(W,T),z=f(_),{headersRef:A,bodyRef:B}=je(),H=(0,r.useCallback)((()=>{return e=void 0,t=void 0,r=function*(){try{h(!0);const e=(0,i.addDays)(N,-1),t=(0,i.addDays)(P,1),n=yield g({start:e,end:t,view:"day"});n&&(null==n?void 0:n.length)&&v(n,"events")}catch(e){throw e}finally{h(!1)}},new((n=void 0)||(n=Promise))((function(a,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}),[t,g]);(0,r.useEffect)((()=>{g instanceof Function&&H()}),[H,g]);const V=e=>{const r=y(e,t);return(0,n.jsx)("div",Object.assign({className:"rs__block_col",style:{height:28*r.length}},{children:r.map(((e,r)=>{const a=(0,i.isBefore)(e.start,(0,i.startOfDay)(t)),s=(0,i.isAfter)(e.end,(0,i.endOfDay)(t));return(0,n.jsx)("div",Object.assign({className:"rs__multi_day",style:{top:28*r,width:"99.9%",overflowX:"hidden"}},{children:(0,n.jsx)(re,{event:e,multiday:!0,hasPrev:a,hasNext:s})}),e.event_id)}))}))},Z=e=>{let l=s;if(e&&(l=o(s,e,m,b)),k)return(0,n.jsx)(tt,{events:l});const d=p.length&&"tabs"!==j,c=28*y(d?s:l,t).length+45;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(q,Object.assign({days:1,ref:A,sticky:"1",stickyNavigation:D},{children:[(0,n.jsx)("span",{className:"rs__cell"}),(0,n.jsxs)("span",Object.assign({className:"rs__cell rs__header "+((0,i.isToday)(t)?"rs__today_cell":""),style:{height:c}},{children:["function"==typeof I?(0,n.jsx)("div",{children:I(t)}):(0,n.jsx)(E,{date:t,locale:O}),V(l)]}))]})),(0,n.jsx)(q,Object.assign({days:1,ref:B},{children:$.map(((s,o)=>{const d=new Date(`${(0,i.format)(t,"yyyy/MM/dd")} ${(0,i.format)(s,z)}`),c=(0,i.addMinutes)(d,T),g=m.idField;return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)("span",Object.assign({className:"rs__cell rs__header rs__time",style:{height:W}},{children:"function"==typeof R?(0,n.jsx)("div",{children:R((0,i.format)(s,z,{locale:O}))}):(0,n.jsx)(a.Typography,Object.assign({variant:"caption"},{children:(0,i.format)(s,z,{locale:O})}))})),(0,n.jsxs)("span",Object.assign({className:"rs__cell "+((0,i.isToday)(t)?"rs__today_cell":"")},{children:[0===o&&(0,n.jsx)(fe,{todayEvents:u(l,t),today:N,minuteHeight:L,startHour:C,step:T,direction:x,timeZone:w}),(0,n.jsx)(ve,{start:d,end:c,day:t,height:W,resourceKey:g,resourceVal:e?e[g]:null,cellRenderer:F})]}))]},o)}))}))]})};return p.length?(0,n.jsx)(ue,{renderChildren:Z}):Z()},rt=e=>{const t={};let n=0;for(let r=0;r<e.length;r++){const a=e[r],s=(0,i.eachDayOfInterval)({start:a.start,end:a.end});for(let e=0;e<s.length;e++){const r=(0,i.format)(s[e],"yyyy-MM-dd");if(t[r]){const e=Object.values(t[r]);for(;e.includes(n);)n+=1;t[r][a.event_id]=n}else t[r]={[a.event_id]:n}}n=0}return t},at=(e,t,n,r)=>{const a=v(e),i={};if(t.length)for(const e of t){const t=o(a,e,n,r),s=rt(t);i[e[n.idField]]=s}else i.all=rt(e);return i},it=({children:e})=>{const{events:t,resources:a,resourceFields:i,fields:s}=S(),[o,l]=(0,r.useState)({renderedSlots:at(t,a,i,s)});return(0,r.useEffect)((()=>{l((e=>Object.assign(Object.assign({},e),{renderedSlots:at(t,a,i,s)})))}),[t,s,i,a]),(0,n.jsx)(be.Provider,Object.assign({value:Object.assign(Object.assign({},o),{setRenderedSlot:(e,t,n,r)=>{l((a=>{var i,s,o,l,d;return Object.assign(Object.assign({},a),{renderedSlots:Object.assign(Object.assign({},a.renderedSlots),{[r||"all"]:Object.assign(Object.assign({},null===(i=a.renderedSlots)||void 0===i?void 0:i[r||"all"]),{[e]:(null===(o=null===(s=a.renderedSlots)||void 0===s?void 0:s[r||"all"])||void 0===o?void 0:o[e])?Object.assign(Object.assign({},null===(d=null===(l=a.renderedSlots)||void 0===l?void 0:l[r||"all"])||void 0===d?void 0:d[e]),{[t]:n}):{[t]:n}})})})}))}})},{children:e}))},st=(0,r.forwardRef)((function(e,t){const i=S(),{view:s,dialog:o,loading:l,loadingComponent:d,resourceViewMode:c,resources:u,translations:g}=i,h=(0,r.useMemo)((()=>{switch(s){case"month":return(0,n.jsx)(et,{});case"week":return(0,n.jsx)(De,{});case"day":return(0,n.jsx)(nt,{});default:return""}}),[s]),v=(0,r.useMemo)((()=>(0,n.jsx)("div",Object.assign({className:"rs__table_loading"},{children:d||(0,n.jsx)("div",Object.assign({className:"rs__table_loading_internal"},{children:(0,n.jsxs)("span",{children:[(0,n.jsx)(a.CircularProgress,{size:50}),(0,n.jsx)(a.Typography,Object.assign({align:"center"},{children:g.loading}))]})}))}))),[d,g.loading]);return(0,n.jsxs)(P,Object.assign({dialog:o?1:0,"data-testid":"rs-wrapper",ref:e=>{t&&(t.current={el:e,scheduler:i})}},{children:[l?v:null,(0,n.jsx)(Ae,{}),(0,n.jsx)($,Object.assign({resource_count:"tabs"===c?1:u.length,sx:{overflowX:"default"===c&&u.length>1?"auto":void 0},"data-testid":"grid"},{children:(0,n.jsx)(it,{children:h})})),o&&(0,n.jsx)(Qe,{})]}))}));const ot=({children:e,initial:t})=>{const[a,o]=(0,r.useState)(Object.assign(Object.assign({},M),C(t)));(0,r.useEffect)((()=>{o((e=>Object.assign(Object.assign({},e),{onEventDrop:t.onEventDrop,customEditor:t.customEditor,events:t.events||[]})))}),[t.onEventDrop,t.customEditor,t.events]);const l=()=>(e=>{const t=[];return e.month&&t.push("month"),e.week&&t.push("week"),e.day&&t.push("day"),t})(a),d=e=>{void 0===t.loading&&o((t=>Object.assign(Object.assign({},t),{loading:e})))},c=(e,t)=>{let n;n="edit"===t?Array.isArray(e)?a.events.map((t=>{const n=e.find((e=>e.event_id===t.event_id));return n?Object.assign(Object.assign({},t),n):t})):a.events.map((t=>t.event_id===e.event_id?Object.assign(Object.assign({},t),e):t)):a.events.concat(e),o((e=>Object.assign(Object.assign({},e),{events:n})))};return(0,n.jsx)(T.Provider,Object.assign({value:Object.assign(Object.assign({},a),{handleState:(e,t)=>{o((n=>Object.assign(Object.assign({},n),{[t]:e})))},getViews:l,toggleAgenda:()=>{o((e=>Object.assign(Object.assign({},e),{agenda:!e.agenda})))},triggerDialog:(e,t)=>{const n=t;o((t=>{var r;return Object.assign(Object.assign({},t),{dialog:e,selectedRange:(null==n?void 0:n.event_id)?void 0:n||{start:new Date,end:new Date(Date.now()+36e5)},selectedEvent:(null==n?void 0:n.event_id)?n:void 0,selectedResource:null==n?void 0:n[null===(r=a.resourceFields)||void 0===r?void 0:r.idField]})}))},triggerLoading:d,handleGotoDay:e=>{const t=l();let n="";t.includes("day")?(n="day",o((t=>Object.assign(Object.assign({},t),{view:"day",selectedDate:e})))):t.includes("week")?(n="week",o((t=>Object.assign(Object.assign({},t),{view:"week",selectedDate:e})))):console.warn("No Day/Week views available"),n&&a.onViewChange&&"function"==typeof a.onViewChange&&a.onViewChange(n)},confirmEvent:c,onDrop:(e,t,n,r)=>{return o=void 0,l=void 0,g=function*(){var o;const l=a.events.find((t=>"number"==typeof t.event_id?t.event_id===+e:t.event_id===e)),u=a.fields.find((e=>e.name===n)),g=!!(null===(o=null==u?void 0:u.config)||void 0===o?void 0:o.multiple);let h=r;if(u){const e=l[n],a=s(u,e,l).value;if(g)if(a.includes(r)){if((0,i.isEqual)(l.start,t))return;h=a}else h=a.length>1?[...a,r]:[r]}if((0,i.isEqual)(l.start,t)&&(!h||!g&&h===l[n]))return;const v=(0,i.differenceInMinutes)(l.end,l.start),y=Object.assign(Object.assign({},l),{start:t,end:(0,i.addMinutes)(t,v),[n]:h||""});if(!a.onEventDrop||"function"!=typeof a.onEventDrop)return c(y,"edit");try{d(!0);const e=yield a.onEventDrop(t,y,l);e&&c(e,"edit")}finally{d(!1)}},new((u=void 0)||(u=Promise))((function(e,t){function n(e){try{a(g.next(e))}catch(e){t(e)}}function r(e){try{a(g.throw(e))}catch(e){t(e)}}function a(t){var a;t.done?e(t.value):(a=t.value,a instanceof u?a:new u((function(e){e(a)}))).then(n,r)}a((g=g.apply(o,l||[])).next())}));var o,l,u,g}})},{children:e}))},lt=(0,r.forwardRef)((function(e,t){return(0,n.jsx)(ot,Object.assign({initial:e},{children:(0,n.jsx)(st,{ref:t})}))}));module.exports=t})();
(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Scheduler:()=>lt});const n=require("react/jsx-runtime"),r=require("react"),a=require("@mui/material"),i=require("date-fns"),s=(e,t,n)=>{var r;const a=(null===(r=e.config)||void 0===r?void 0:r.multiple)&&!Array.isArray((null==n?void 0:n[e.name])||e.default),i=a?t?[t]:[]:t;return{value:i,validity:a?i.length:i}},o=(e,t,n,r)=>{var a;const i=n.idField,s=r.find((e=>e.name===i)),o=!!(null===(a=null==s?void 0:s.config)||void 0===a?void 0:a.multiple),l=[];for(const r of e){const e=o&&!Array.isArray(r[i])?[r[i]]:r[i];(o||Array.isArray(e)?e.includes(t[i]):e===t[i])&&l.push(Object.assign(Object.assign({},r),{color:r.color||t[n.colorField||""]}))}return l},l=(e,t)=>Math.ceil(e)/t,d=(e,t)=>Math.max(e/t,60),c=(e,t)=>(0,i.differenceInDays)((0,i.endOfDay)((0,i.addSeconds)(t,-1)),(0,i.startOfDay)(e)),u=(e,t,n)=>{const r=[];for(let n=0;n<e.length;n++){const a=e[n];a.allDay||!(0,i.isSameDay)(t,a.start)||c(a.start,a.end)||r.push(a)}return h(r)},g=(e,t,n)=>{const r=e.filter((e=>(0,i.isWithinInterval)(t,{start:(0,i.startOfDay)(e.start),end:(0,i.endOfDay)(e.end)})));return v(r)},h=e=>e.sort(((e,t)=>{const n=e.end.getTime()-e.start.getTime();return t.end.getTime()-t.start.getTime()-n})),v=e=>e.sort(((e,t)=>e.start.getTime()-t.start.getTime())),y=(e,t,n,r)=>{var a;const s=Array.isArray(t),o=[],l={};for(let n=0;n<e.length;n++){const r=e[n];let a=r.allDay||c(r.start,r.end)>0;if(a&&(a=s?t.some((e=>(0,i.isWithinInterval)(e,{start:(0,i.startOfDay)(r.start),end:(0,i.endOfDay)(r.end)}))):(0,i.isWithinInterval)(t,{start:(0,i.startOfDay)(r.start),end:(0,i.endOfDay)(r.end)}),a))if(o.push(r),s)for(const e of t){const t=(0,i.format)(e,"yyyy-MM-dd");(0,i.isWithinInterval)(e,{start:(0,i.startOfDay)(r.start),end:(0,i.endOfDay)(r.end)})&&(l[t]=(l[t]||[]).concat(r))}else{const e=(0,i.format)(r.start,"yyyy-MM-dd");l[e]=(l[e]||[]).concat(r)}}return s&&r?(null===(a=Object.values(l).sort(((e,t)=>t.length-e.length)))||void 0===a?void 0:a[0])||[]:o},p=(e,t)=>new Date(new Intl.DateTimeFormat("en-US",{dateStyle:"short",timeStyle:"medium",timeZone:t}).format(e)),m=({dateLeft:e,dateRight:t,timeZone:n})=>(0,i.isSameDay)(e,p(t||new Date,n)),f=e=>"12"===e?"hh:mm a":"HH:mm",j=require("date-fns/locale/en-US");var b=e.n(j),x=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n};const O={weekDays:[0,1,2,3,4,5,6],weekStartOn:6,startHour:9,endHour:17,navigation:!0,disableGoToDay:!1},_={weekDays:[0,1,2,3,4,5,6],weekStartOn:6,startHour:9,endHour:17,step:60,navigation:!0,disableGoToDay:!1},w={startHour:9,endHour:17,step:60,navigation:!0},D={idField:"assignee",textField:"text",subTextField:"subtext",avatarField:"avatar",colorField:"color"},k=(e={})=>{const{navigation:t,form:n,event:r}=e,a=x(e,["navigation","form","event"]);return Object.assign({navigation:Object.assign({month:"Month",week:"Week",day:"Day",agenda:"Agenda",today:"Today"},t),form:Object.assign({addTitle:"Add Event",editTitle:"Edit Event",confirm:"Confirm",delete:"Delete",cancel:"Cancel"},n),event:Object.assign({title:"Title",start:"Start",end:"End",allDay:"All Day"},r)},Object.assign({moreEvents:"More...",loading:"Loading...",noDataToDisplay:"No data to display"},a))},C=e=>{const{month:t,week:n,day:r,translations:a,resourceFields:i,view:s}=e,o=x(e,["month","week","day","translations","resourceFields","view"]),l=(e=>{const{month:t,week:n,day:r}=e;return{month:null!==t?Object.assign(O,t):null,week:null!==n?Object.assign(_,n):null,day:null!==r?Object.assign(w,r):null}})(e),d=s||"week",c=l[d]?d:(e=>{if(e.month)return"month";if(e.week)return"week";if(e.day)return"day";throw new Error("No views were selected")})(l);return Object.assign(Object.assign(Object.assign({},l),{translations:k(a),resourceFields:Object.assign(D,i),view:c}),Object.assign({height:600,navigation:!0,selectedDate:new Date,agenda:!1,disableViewNavigator:!1,events:[],fields:[],loading:void 0,customEditor:void 0,onConfirm:void 0,onDelete:void 0,viewerExtraComponent:void 0,resources:[],resourceHeaderComponent:void 0,resourceViewMode:"default",direction:"ltr",dialogMaxWidth:"md",locale:b(),deletable:!0,editable:!0,hourFormat:"12",draggable:!0},o))},M=Object.assign(Object.assign({},C({})),{setProps:()=>{},dialog:!1,selectedRange:void 0,selectedEvent:void 0,selectedResource:void 0,handleState:()=>{},getViews:()=>[],toggleAgenda:()=>{},triggerDialog:()=>{},triggerLoading:()=>{},handleGotoDay:()=>{},confirmEvent:()=>{},setCurrentDragged:()=>{},onDrop:()=>{}}),T=(0,r.createContext)(M),S=()=>(0,r.useContext)(T),E=({date:e,onClick:t,locale:r})=>{const{timeZone:s}=S(),o=m({dateLeft:e,timeZone:s});return(0,n.jsxs)("div",{children:[(0,n.jsx)(a.Typography,Object.assign({style:{fontWeight:o?"bold":"inherit"},color:o?"primary":"inherit",className:t?"rs__hover__op":"",onClick:n=>{n.stopPropagation(),t&&t(e)}},{children:(0,i.format)(e,"dd",{locale:r})})),(0,n.jsx)(a.Typography,Object.assign({color:o?"primary":"inherit",style:{fontWeight:o?"bold":"inherit",fontSize:11}},{children:(0,i.format)(e,"eee",{locale:r})}))]})},F=require("@mui/icons-material/ArrowRightRounded");var I=e.n(F);const R=require("@mui/icons-material/ArrowLeftRounded");var N=e.n(R);const P=(0,a.styled)("div")((({theme:e,dialog:t})=>({position:"relative","& .rs__table_loading":{position:"absolute",left:0,right:0,top:0,bottom:0,zIndex:999999,"& .rs__table_loading_internal":{background:t?"":(0,a.alpha)(e.palette.background.paper,.4),height:"100%","& > span":{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",flexDirection:"column","& >span":{marginBottom:15}}}}}))),$=(0,a.styled)("div")((({resource_count:e})=>({position:"relative",display:"flex",flexDirection:e>1?"row":"column",width:"100%",boxSizing:"content-box","& > div":{flexShrink:0,flexGrow:1}}))),W=(0,a.styled)(a.Paper)((({sticky:e="0"})=>({display:"flex",justifyContent:"space-between",alignItems:"center",position:"1"===e?"sticky":"relative",top:"1"===e?0:void 0,zIndex:"1"===e?999:void 0,boxShadow:"none",padding:"2px 0","& > .rs__view_navigator":{display:"flex",alignItems:"center"}}))),L=(0,a.styled)("div")((({theme:e})=>({borderStyle:"solid",borderColor:e.palette.grey[300],borderWidth:"1px 1px 0 0","& > .rs__agenda_row":{display:"flex","& >.rs__agenda__cell":{padding:4,width:"100%",maxWidth:60,"& > .MuiTypography-root":{position:"sticky",top:0,"&.rs__hover__op":{cursor:"pointer","&:hover":{opacity:.7,textDecoration:"underline"}}}},"& .rs__cell":{borderStyle:"solid",borderColor:e.palette.grey[300],borderWidth:"0 0 1px 1px"},"& > .rs__agenda_items":{flexGrow:1}}}))),q=(0,a.styled)("div")((({days:e,sticky:t="0",stickyNavigation:n,indent:r="1",theme:i})=>({display:"grid",gridTemplateColumns:+r>0?`10% repeat(${e}, 1fr)`:`repeat(${e}, 1fr)`,overflowX:"auto",overflowY:"hidden",position:"1"===t?"sticky":"relative",top:"1"===t?n?36:0:void 0,zIndex:"1"===t?99:void 0,[i.breakpoints.down("sm")]:{gridTemplateColumns:+r>0?`30px repeat(${e}, 1fr)`:""},borderStyle:"solid",borderColor:i.palette.grey[300],borderWidth:"0 0 0 1px","&:first-of-type":{borderWidth:"1px 0 0 1px"},"&:last-of-type":{borderWidth:"0 0 1px 1px"},"& .rs__cell":{background:i.palette.background.paper,position:"relative",borderStyle:"solid",borderColor:i.palette.grey[300],borderWidth:"0 1px 1px 0","&.rs__header":{"& > :first-of-type":{padding:"2px 5px"}},"&.rs__header__center":{padding:"6px 0px"},"&.rs__time":{display:"flex",alignItems:"center",justifyContent:"center",position:"sticky",left:0,zIndex:99,[i.breakpoints.down("sm")]:{writingMode:"vertical-rl"}},"& > button":{width:"100%",height:"100%",borderRadius:0,cursor:"pointer","&:hover":{background:(0,a.alpha)(i.palette.primary.main,.1)}},"& .rs__event__item":{position:"absolute",zIndex:1},"& .rs__multi_day":{position:"absolute",zIndex:1,textOverflow:"ellipsis"},"& .rs__block_col":{display:"block",position:"relative"},"& .rs__hover__op":{cursor:"pointer","&:hover":{opacity:.7,textDecoration:"underline"}},"&:not(.rs__time)":{minWidth:65}}}))),z=(0,a.styled)(a.Paper)((({disabled:e})=>({width:"99.5%",height:"100%",display:"block",cursor:e?"not-allowed":"pointer",overflow:"hidden","& .MuiButtonBase-root":{width:"100%",height:"100%",display:"block",textAlign:"left","& > div":{height:"100%"}}}))),A=(0,a.styled)("div")((({theme:e})=>({maxWidth:"100%",width:400,"& > div":{padding:"5px 10px","& .rs__popper_actions":{display:"flex",alignItems:"center",justifyContent:"space-between","& .MuiIconButton-root":{color:e.palette.primary.contrastText}}}}))),B=(0,a.styled)("div")((({theme:e})=>({display:"inherit","& .MuiIconButton-root":{color:e.palette.primary.contrastText},"& .MuiButton-root":{"&.delete":{color:e.palette.error.main},"&.cancel":{color:e.palette.action.disabled}}}))),H=(0,a.styled)("div")((({theme:e})=>({position:"absolute",zIndex:9,width:"100%",display:"flex","& > div:first-of-type":{height:12,width:12,borderRadius:"50%",background:e.palette.error.light,marginLeft:-6,marginTop:-5},"& > div:last-of-type":{borderTop:`solid 2px ${e.palette.error.light}`,width:"100%"}}))),V=require("@mui/icons-material/DeleteRounded");var Z=e.n(V);const G=require("@mui/icons-material/EditRounded");var K=e.n(G);const X=({event:e,onDelete:t,onEdit:i})=>{const{translations:s,direction:o,editable:l,deletable:d}=S(),[c,u]=(0,r.useState)(!1),g=()=>{if(!c)return u(!0);t()},h=(0,r.useMemo)((()=>void 0!==e.deletable?e.deletable:d),[d,e.deletable]),v=(0,r.useMemo)((()=>void 0!==e.editable?e.editable:l),[l,e.editable]);return(0,n.jsxs)(B,{children:[(0,n.jsx)(a.Grow,Object.assign({in:!c,exit:!1,timeout:400,unmountOnExit:!0},{children:(0,n.jsxs)("div",{children:[v&&(0,n.jsx)(a.IconButton,Object.assign({size:"small",onClick:i},{children:(0,n.jsx)(K(),{})})),h&&(0,n.jsx)(a.IconButton,Object.assign({size:"small",onClick:g},{children:(0,n.jsx)(Z(),{})}))]})})),(0,n.jsx)(a.Slide,Object.assign({in:c,direction:"rtl"===o?"right":"left",unmountOnExit:!0,timeout:400,exit:!1},{children:(0,n.jsxs)("div",{children:[(0,n.jsx)(a.Button,Object.assign({className:"delete",size:"small",onClick:g},{children:s.form.delete.toUpperCase()})),(0,n.jsx)(a.Button,Object.assign({className:"cancel",size:"small",onClick:()=>u(!1)},{children:s.form.cancel.toUpperCase()}))]})}))]})},U=require("@mui/icons-material/EventNoteRounded");var Q=e.n(U);const Y=require("@mui/icons-material/ClearRounded");var J=e.n(Y);const ee=require("@mui/icons-material/SupervisorAccountRounded");var te=e.n(ee);const ne=({anchorEl:e,event:t,onTriggerViewer:r})=>{const{triggerDialog:s,onDelete:o,events:l,handleState:d,triggerLoading:u,customViewer:g,viewerExtraComponent:h,fields:v,resources:y,resourceFields:p,locale:m,viewerTitleComponent:j,hourFormat:b,translations:x}=S(),O=(0,a.useTheme)(),_=c(t.start,t.end)<=0&&t.allDay,w=f(b),D=p.idField,k=y.filter((e=>Array.isArray(t[D])?t[D].includes(e[D]):e[D]===t[D]));return(0,n.jsx)(a.Popover,Object.assign({open:Boolean(e),anchorEl:e,onClose:()=>{r()},anchorOrigin:{vertical:"center",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},onClick:e=>{e.stopPropagation()}},{children:"function"==typeof g?g(t,(()=>r())):(0,n.jsxs)(A,{children:[(0,n.jsxs)(a.Box,Object.assign({sx:{bgcolor:t.color||O.palette.primary.main,color:O.palette.primary.contrastText}},{children:[(0,n.jsxs)("div",Object.assign({className:"rs__popper_actions"},{children:[(0,n.jsx)("div",{children:(0,n.jsx)(a.IconButton,Object.assign({size:"small",onClick:()=>{r()}},{children:(0,n.jsx)(J(),{color:"disabled"})}))}),(0,n.jsx)(X,{event:t,onDelete:()=>{return e=void 0,n=void 0,i=function*(){try{u(!0);let e=t.event_id;if(o){const t=yield o(e);e=t||""}if(e){r();const t=l.filter((t=>t.event_id!==e));d(t,"events")}}catch(e){console.error(e)}finally{u(!1)}},new((a=void 0)||(a=Promise))((function(t,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function o(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof a?n:new a((function(e){e(n)}))).then(s,o)}l((i=i.apply(e,n||[])).next())}));var e,n,a,i},onEdit:()=>{r(),s(!0,t)}})]})),j instanceof Function?j(t):(0,n.jsx)(a.Typography,Object.assign({style:{padding:"5px 0"},noWrap:!0},{children:t.title}))]})),(0,n.jsxs)("div",Object.assign({style:{padding:"5px 10px"}},{children:[(0,n.jsxs)(a.Typography,Object.assign({style:{display:"flex",alignItems:"center",gap:8},color:"textSecondary",variant:"caption",noWrap:!0},{children:[(0,n.jsx)(Q(),{}),_?x.event.allDay:`${(0,i.format)(t.start,`dd MMMM yyyy ${w}`,{locale:m})} - ${(0,i.format)(t.end,`dd MMMM yyyy ${w}`,{locale:m})}`]})),k.length>0&&(0,n.jsxs)(a.Typography,Object.assign({style:{display:"flex",alignItems:"center",gap:8},color:"textSecondary",variant:"caption",noWrap:!0},{children:[(0,n.jsx)(te(),{}),k.map((e=>e[p.textField])).join(", ")]})),h instanceof Function?h(v,t):h]}))]})}))},re=({event:e,multiday:t,hasPrev:s,hasNext:o,showdate:l=!0})=>{const{direction:d,locale:u,hourFormat:g,eventRenderer:h,onEventClick:v,view:y,draggable:p,editable:m}=S(),j=(e=>{const{setCurrentDragged:t}=S(),n=(0,a.useTheme)();return{draggable:!0,onDragStart:r=>{r.stopPropagation(),t(e),r.currentTarget.style.backgroundColor=n.palette.error.main},onDragEnd:r=>{t(),r.currentTarget.style.backgroundColor=e.color||n.palette.primary.main},onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDragEnter:e=>{e.stopPropagation(),e.preventDefault()}}})(e),[b,x]=(0,r.useState)(null),[O,_]=(0,r.useState)(!1),w=(0,a.useTheme)(),D=f(g),k="rtl"===d?N():I(),C="rtl"===d?I():N(),M=c(e.start,e.end)<=0&&e.allDay,T=e=>{!(null==e?void 0:e.currentTarget)&&O&&_(!1),x((null==e?void 0:e.currentTarget)||null)},E=(0,r.useMemo)((()=>{if(e.disabled||!m)return!1;let t=void 0===p||p;return void 0!==e.draggable&&(t=e.draggable),t}),[p,m,e.disabled,e.draggable]),F=(0,r.useMemo)((()=>{if("function"==typeof h&&!t&&"month"!==y){const t=h(Object.assign({event:e,onClick:T},j));if(t)return(0,n.jsx)(z,{children:t},`${e.start.getTime()}_${e.end.getTime()}_${e.event_id}`)}let r=(0,n.jsxs)("div",Object.assign({style:{padding:"2px 6px"}},{children:[(0,n.jsx)(a.Typography,Object.assign({variant:"subtitle2",style:{fontSize:12},noWrap:!0},{children:e.title})),l&&(0,n.jsx)(a.Typography,Object.assign({style:{fontSize:11},noWrap:!0},{children:`${(0,i.format)(e.start,D,{locale:u})} - ${(0,i.format)(e.end,D,{locale:u})}`}))]}));return t&&(r=(0,n.jsxs)("div",Object.assign({style:{padding:2,display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[(0,n.jsx)(a.Typography,Object.assign({sx:{fontSize:11},noWrap:!0},{children:s?(0,n.jsx)(C,{fontSize:"small",sx:{display:"flex"}}):l&&!M&&(0,i.format)(e.start,D,{locale:u})})),(0,n.jsx)(a.Typography,Object.assign({variant:"subtitle2",align:"center",sx:{fontSize:12},noWrap:!0},{children:e.title})),(0,n.jsx)(a.Typography,Object.assign({sx:{fontSize:11},noWrap:!0},{children:o?(0,n.jsx)(k,{fontSize:"small",sx:{display:"flex"}}):l&&!M&&(0,i.format)(e.end,D,{locale:u})}))]}))),(0,n.jsx)(z,Object.assign({disabled:e.disabled,sx:{bgcolor:e.disabled?"#d0d0d0":e.color||w.palette.primary.main,color:e.disabled?"#808080":e.textColor||w.palette.primary.contrastText}},{children:(0,n.jsx)(a.ButtonBase,Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),T(t),"function"==typeof v&&v(e)},disabled:e.disabled},{children:(0,n.jsx)("div",Object.assign({},j,{draggable:E},{children:r}))}))}),`${e.start.getTime()}_${e.end.getTime()}_${e.event_id}`)}),[s,o,e,E,u,w.palette]);return(0,n.jsxs)(r.Fragment,{children:[F,(0,n.jsx)(ne,{anchorEl:b,event:e,onTriggerViewer:T})]})},ae=({resource:e})=>{const{resourceHeaderComponent:t,resourceFields:i,resources:s,direction:o,resourceViewMode:l}=S(),{width:d}=function(){const[e,t]=(0,r.useState)({width:0,height:0});return(0,r.useEffect)((()=>{if("undefined"==typeof window)return;const e=()=>{t((e=>{const{innerWidth:t,innerHeight:n}=window;return e.width!==t||e.height!==n?{width:t,height:n}:e}))};return e(),window.addEventListener("resize",e,{capture:!1,passive:!0}),()=>{window.removeEventListener("resize",e)}}),[]),e}(),c=(0,a.useTheme)(),u=e[i.textField],g=e[i.subTextField||""],h=e[i.avatarField||""],v=e[i.colorField||""];if(t instanceof Function)return t(e);const y="tabs"===l?{}:{borderColor:c.palette.grey[300],borderStyle:"solid",borderWidth:"1px 1px 0 1px"};return(0,n.jsxs)(a.ListItem,Object.assign({sx:Object.assign({padding:"2px 10px",textAlign:"rtl"===o?"right":"left"},y),component:"span"},{children:[(0,n.jsx)(a.ListItemAvatar,{children:(0,n.jsx)(a.Avatar,{style:{background:v},alt:u,src:h})}),(0,n.jsx)(a.ListItemText,{primary:(0,n.jsx)(a.Typography,Object.assign({variant:"body2",noWrap:!0},{children:u})),secondary:(0,n.jsx)(a.Typography,Object.assign({variant:"caption",color:"textSecondary",noWrap:!0},{children:g})),style:{width:d/(s.length+1)}})]}))},ie=require("prop-types");var se=e.n(ie);const oe=require("@mui/material/styles");function le(e){const{children:t,value:r,index:a}=e;return r===a?(0,n.jsx)(n.Fragment,{children:t}):(0,n.jsx)(n.Fragment,{})}le.propTypes={children:se().node,index:se().any.isRequired,value:se().any.isRequired};const de=(0,oe.styled)("div")((({theme:e})=>({flexGrow:1,width:"100%",backgroundColor:e.palette.background.paper,alignSelf:"center","& .tabs":{borderColor:e.palette.grey[300],borderStyle:"solid",borderWidth:1,"& button.MuiTab-root":{borderColor:e.palette.grey[300],borderRightStyle:"solid",borderWidth:1}},"& .primary":{background:e.palette.primary.main},"& .secondary":{background:e.palette.secondary.main},"& .error":{background:e.palette.error.main},"& .info":{background:e.palette.info.dark},"& .text_primary":{color:e.palette.primary.main},"& .text_secondary":{color:e.palette.secondary.main},"& .text_error":{color:e.palette.error.main},"& .text_info":{color:e.palette.info.dark}}))),ce=({tabs:e,variant:t="scrollable",tab:r,setTab:i,indicator:s="primary",style:o})=>(0,n.jsxs)(de,Object.assign({style:o},{children:[(0,n.jsx)(a.Tabs,Object.assign({value:r,variant:t,scrollButtons:!0,className:"tabs",classes:{indicator:s}},{children:e.map(((e,t)=>{return(0,n.jsx)(a.Tab,Object.assign({label:e.label,value:e.id},{id:`scrollable-auto-tab-${r=e.id}`,"aria-controls":`scrollable-auto-tabpanel-${r}`},{onClick:()=>i(e.id),onDragEnter:()=>i(e.id)}),e.id||t);var r}))})),e.map(((e,t)=>e.component&&(0,n.jsx)(le,Object.assign({value:r,index:e.id},{children:e.component}),t)))]})),ue=({renderChildren:e})=>{const{resourceViewMode:t}=S();return"tabs"===t?(0,n.jsx)(he,{renderChildren:e}):(0,n.jsx)(ge,{renderChildren:e})},ge=({renderChildren:e})=>{const{resources:t,resourceFields:r}=S();return(0,n.jsx)(n.Fragment,{children:t.map(((t,a)=>(0,n.jsxs)("div",{children:[(0,n.jsx)(ae,{resource:t}),e(t)]},`${t[r.idField]}_${a}`)))})},he=({renderChildren:e})=>{const{resources:t,resourceFields:a,selectedResource:i,handleState:s}=S(),o=t.map((t=>({id:t[a.idField],label:(0,n.jsx)(ae,{resource:t}),component:(0,n.jsx)(n.Fragment,{children:e(t)})}))),l=(0,r.useMemo)((()=>{const e=t[0][a.idField];return i?t.findIndex((e=>e[a.idField]===i))<0?e:i:e}),[t,i,a.idField]);return(0,n.jsx)(ce,{tabs:o,tab:l,setTab:e=>{s(e,"selectedResource")},style:{display:"grid"}})},ve=({day:e,start:t,end:r,resourceKey:i,resourceVal:s,cellRenderer:o,height:l,children:d})=>{const{editable:c}=S(),u=(({start:e,end:t,resourceKey:n,resourceVal:r})=>{const{triggerDialog:i,onDrop:s,currentDragged:o,setCurrentDragged:l}=S(),d=(0,a.useTheme)();return{onClick:()=>{i(!0,{start:e,end:t,[n]:r})},onDragOver:e=>{e.preventDefault(),o&&(e.currentTarget.style.backgroundColor=(0,a.alpha)(d.palette.secondary.main,.3))},onDragEnter:e=>{o&&(e.currentTarget.style.backgroundColor=(0,a.alpha)(d.palette.secondary.main,.3))},onDragLeave:e=>{o&&(e.currentTarget.style.backgroundColor="")},onDrop:t=>{o&&o.event_id&&(t.preventDefault(),t.currentTarget.style.backgroundColor="",s(o.event_id.toString(),e,n,r),l())},[n]:r}})({start:t,end:r,resourceKey:i,resourceVal:s});return o?o(Object.assign({day:e,start:t,end:r,height:l},u)):c?(0,n.jsx)(a.Button,Object.assign({fullWidth:!0,"aria-label":`${t.toLocaleString("en",{dateStyle:"full",timeStyle:"long"})} - ${r.toLocaleString("en",{dateStyle:"full",timeStyle:"long"})}`},u,{children:d})):null},ye=1;function pe({startHour:e,step:t,minuteHeight:n,timeZone:r}){const a=p(new Date,r),s=(0,i.differenceInMinutes)(a,(0,i.set)(a,{hours:e,minutes:0}));return s*n+(s/t+ye)}const me=e=>{const[t,a]=(0,r.useState)(pe(e));return(0,r.useEffect)((()=>{const t=setInterval((()=>a(pe(e))),6e4);return()=>clearInterval(t)}),[]),t<0?null:(0,n.jsxs)(H,Object.assign({style:{top:t,zIndex:e.zIndex}},{children:[(0,n.jsx)("div",{}),(0,n.jsx)("div",{})]}))},fe=({todayEvents:e,today:t,startHour:a,step:s,minuteHeight:o,direction:l,timeZone:d})=>{const c=[];return(0,n.jsxs)(r.Fragment,{children:[m({dateLeft:t,timeZone:d})&&(0,n.jsx)(me,{startHour:a,step:s,minuteHeight:o,timeZone:d,zIndex:2*e.length+1}),e.map(((r,d)=>{const u=(0,i.differenceInMinutes)(r.end,r.start)*o-ye,g=(0,i.differenceInMinutes)(r.start,(0,i.setHours)(t,a)),h=u/60*ye,v=g*o+g/s,y=((e,t)=>e.filter((e=>e.event_id!==t.event_id&&((0,i.isWithinInterval)((0,i.addMinutes)(t.start,1),{start:e.start,end:e.end})||(0,i.isWithinInterval)((0,i.addMinutes)(t.end,-1),{start:e.start,end:e.end})||(0,i.isWithinInterval)((0,i.addMinutes)(e.start,1),{start:t.start,end:t.end})||(0,i.isWithinInterval)((0,i.addMinutes)(e.end,-1),{start:t.start,end:t.end})))))(e,r),p=y.filter((e=>c.includes(e.event_id)));return c.push(r.event_id),(0,n.jsx)("div",Object.assign({className:"rs__event__item",style:{height:u+h,top:v,width:p.length>0?`calc(100% - ${100-98/(p.length+1)}%)`:"98%",zIndex:e.length+d,["rtl"===l?"right":"left"]:p.length>0?100/(y.length+1)*p.length+"%":""}},{children:(0,n.jsx)(re,{event:r})}),r.event_id)}))]})},je=()=>{const e=(0,r.useRef)(null),t=(0,r.useRef)(null);return(0,r.useEffect)((()=>{const n=e.current,r=t.current,a=e=>{const t=e.currentTarget;null==r||r.scroll({left:t.scrollLeft}),null==n||n.scroll({left:t.scrollLeft})};return null==n||n.addEventListener("scroll",a),null==r||r.addEventListener("scroll",a),()=>{null==n||n.removeEventListener("scroll",a),null==r||r.removeEventListener("scroll",a)}})),{headersRef:e,bodyRef:t}},be=(0,r.createContext)({renderedSlots:{},setRenderedSlot:()=>{}}),xe=()=>(0,r.useContext)(be),Oe=({day:e,events:t})=>{const[s,o]=(0,r.useState)(null),[l,d]=(0,r.useState)(),[c,u]=(0,r.useState)(!1),{locale:g,hourFormat:h,eventRenderer:v,onEventClick:y,timeZone:p}=S(),j=(0,a.useTheme)(),b=f(h),x=e=>{!(null==e?void 0:e.currentTarget)&&c&&u(!1),o((null==e?void 0:e.currentTarget)||null)};return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(a.List,{children:t.map((t=>{const r=m({dateLeft:t.start,dateRight:e,timeZone:p})?b:`MMM d, ${b}`,s=(0,i.format)(t.start,r,{locale:g}),o=m({dateLeft:t.end,dateRight:e,timeZone:p})?b:`MMM d, ${b}`,l=(0,i.format)(t.end,o,{locale:g});return"function"==typeof v?v({event:t,onClick:x}):(0,n.jsxs)(a.ListItemButton,Object.assign({disabled:t.disabled,onClick:e=>{e.preventDefault(),e.stopPropagation(),x(e),d(t),"function"==typeof y&&y(t)}},{children:[(0,n.jsx)(a.ListItemAvatar,{children:(0,n.jsx)(a.Avatar,Object.assign({sx:{bgcolor:t.disabled?"#d0d0d0":t.color||j.palette.primary.main,color:t.disabled?"#808080":t.textColor||j.palette.primary.contrastText}},{children:" "}))}),(0,n.jsx)(a.ListItemText,{primary:t.title,secondary:`${s} - ${l}`})]}),`${t.start.getTime()}_${t.end.getTime()}_${t.event_id}`)}))}),l&&(0,n.jsx)(ne,{anchorEl:s,event:l,onTriggerViewer:x})]})},_e=()=>{const{height:e,translations:t}=S();return(0,n.jsx)(L,Object.assign({sx:{borderWidth:1,padding:1,height:e/2,display:"flex",alignItems:"center",justifyContent:"center"}},{children:(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda_items"},{children:(0,n.jsx)(a.Typography,{children:t.noDataToDisplay})}))}))},we=({daysList:e,events:t})=>{const{week:s,handleGotoDay:o,locale:l,timeZone:d}=S(),{disableGoToDay:c,headRenderer:u}=s;return(0,r.useMemo)((()=>e.some((e=>g(t,e).length>0))),[e,t])?(0,n.jsx)(L,{children:e.map(((e,r)=>{const s=m({dateLeft:e,timeZone:d}),h=g(t,e);return h.length?(0,n.jsxs)("div",Object.assign({className:"rs__agenda_row "+((0,i.isToday)(e)?"rs__today_cell":"")},{children:[(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda__cell"},{children:"function"==typeof u?(0,n.jsx)("div",{children:u(e)}):(0,n.jsx)(a.Typography,Object.assign({sx:{fontWeight:s?"bold":"inherit"},color:s?"primary":"inherit",variant:"body2",className:c?"":"rs__hover__op",onClick:t=>{t.stopPropagation(),c||o(e)}},{children:(0,i.format)(e,"dd E",{locale:l})}))})),(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda_items"},{children:(0,n.jsx)(Oe,{day:e,events:h})}))]}),r):null}))}):(0,n.jsx)(_e,{})};const De=()=>{const{week:e,selectedDate:t,height:s,events:g,handleGotoDay:h,getRemoteEvents:v,triggerLoading:p,handleState:m,resources:j,resourceFields:b,resourceViewMode:x,fields:O,direction:_,locale:w,hourFormat:D,timeZone:k,stickyNavigation:C,agenda:M}=S(),{renderedSlots:T}=xe(),{weekStartOn:F,weekDays:I,startHour:R,endHour:N,step:P,cellRenderer:$,disableGoToDay:W,headRenderer:L,hourRenderer:z}=e,A=(0,i.startOfWeek)(t,{weekStartsOn:F}),B=I.map((e=>(0,i.addDays)(A,e))),H=(0,i.startOfDay)(B[0]),V=(0,i.endOfDay)(B[B.length-1]),Z=(0,i.set)(t,{hours:R,minutes:0,seconds:0}),G=(0,i.set)(t,{hours:N,minutes:-P,seconds:0}),K=(0,i.eachMinuteOfInterval)({start:Z,end:G},{step:P}),X=d(s,K.length),U=l(X,P),Q=f(D),{headersRef:Y,bodyRef:J}=je(),ee=(0,r.useCallback)((()=>{return e=void 0,t=void 0,r=function*(){try{p(!0);const e=yield v({start:H,end:V,view:"week"});Array.isArray(e)&&m(e,"events")}catch(e){throw e}finally{p(!1)}},new((n=void 0)||(n=Promise))((function(a,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}),[t,v]);(0,r.useEffect)((()=>{v instanceof Function&&ee()}),[ee,v]);const te=(e,t,r)=>{const a=(0,i.isSameDay)(H,t);return y(e,B).filter((e=>(0,i.isBefore)(e.start,H)?a:(0,i.isSameDay)(e.start,t))).sort(((e,t)=>t.end.getTime()-e.end.getTime())).map(((e,a)=>{var s;const o=(0,i.isBefore)((0,i.startOfDay)(e.start),H),l=(0,i.isAfter)((0,i.endOfDay)(e.end),V),d=c(o?H:e.start,l?V:e.end)+1,u=(0,i.format)(t,"yyyy-MM-dd"),g=r?r[b.idField]:"all",h=null===(s=null==T?void 0:T[g])||void 0===s?void 0:s[u],v=(null==h?void 0:h[e.event_id])||0;return(0,n.jsx)("div",Object.assign({className:"rs__multi_day",style:{top:28*v+45,width:99.9*d+"%",overflowX:"hidden"}},{children:(0,n.jsx)(re,{event:e,hasPrev:o,hasNext:l,multiday:!0})}),e.event_id)}))},ne=e=>{let t=g;if(e&&(t=o(g,e,b,O)),M)return(0,n.jsx)(we,{daysList:B,events:t});const s=j.length&&"tabs"!==x,l=28*y(s?g:t,B,0,!0).length+45;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(q,Object.assign({days:B.length,ref:Y,sticky:"1",stickyNavigation:C},{children:[(0,n.jsx)("span",{className:"rs__cell rs__time"}),B.map(((r,a)=>(0,n.jsxs)("span",Object.assign({className:"rs__cell rs__header "+((0,i.isToday)(r)?"rs__today_cell":""),style:{height:l}},{children:["function"==typeof L?(0,n.jsx)("div",{children:L(r)}):(0,n.jsx)(E,{date:r,onClick:W?void 0:h,locale:w}),te(t,r,e)]}),a)))]})),(0,n.jsx)(q,Object.assign({days:B.length,ref:J},{children:K.map(((s,o)=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)("span",Object.assign({style:{height:X},className:"rs__cell rs__header rs__time"},{children:"function"==typeof z?(0,n.jsx)("div",{children:z((0,i.format)(s,Q,{locale:w}))}):(0,n.jsx)(a.Typography,Object.assign({variant:"caption"},{children:(0,i.format)(s,Q,{locale:w})}))})),B.map(((r,a)=>{const l=new Date(`${(0,i.format)(r,"yyyy/MM/dd")} ${(0,i.format)(s,Q)}`),d=(0,i.addMinutes)(l,P),c=b.idField;return(0,n.jsxs)("span",Object.assign({className:"rs__cell "+((0,i.isToday)(r)?"rs__today_cell":"")},{children:[0===o&&(0,n.jsx)(fe,{todayEvents:u(t,r),today:r,minuteHeight:U,startHour:R,step:P,direction:_,timeZone:k}),(0,n.jsx)(ve,{start:l,end:d,day:r,height:X,resourceKey:c,resourceVal:e?e[c]:null,cellRenderer:$})]}),a)}))]},o)))}))]})};return j.length?(0,n.jsx)(ue,{renderChildren:ne}):ne()},ke=require("@mui/x-date-pickers/LocalizationProvider"),Ce=require("@mui/x-date-pickers/AdapterDateFns"),Me=({children:e})=>{const{locale:t}=S();return(0,n.jsx)(ke.LocalizationProvider,Object.assign({dateAdapter:Ce.AdapterDateFns,adapterLocale:t},{children:e}))},Te=require("@mui/icons-material/NavigateBeforeRounded");var Se=e.n(Te);const Ee=require("@mui/icons-material/NavigateNextRounded");var Fe=e.n(Ee);const Ie=e=>{var{type:t,onClick:r}=e,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}(e,["type","onClick"]);const{direction:s}=S();let o=Fe();return"prev"===t?o="rtl"===s?Fe():Se():"next"===t&&(o="rtl"===s?Se():Fe()),(0,n.jsx)(a.IconButton,Object.assign({style:{padding:2},onClick:r,onDragOver:e=>{e.preventDefault(),r&&r()}},i,{children:(0,n.jsx)(o,{})}))},Re=require("@mui/x-date-pickers"),Ne=({selectedDate:e,onChange:t,weekProps:s})=>{const{locale:o,navigationPickerProps:l}=S(),[d,c]=(0,r.useState)(null),{weekStartOn:u}=s,g=(0,i.startOfWeek)(e,{weekStartsOn:u}),h=(0,i.endOfWeek)(e,{weekStartsOn:u}),v=()=>{c(null)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ie,{type:"prev",onClick:()=>{const e=(0,i.addDays)(g,-1);t(e)},"aria-label":"previous week"}),(0,n.jsx)(a.Button,Object.assign({style:{padding:4},onClick:e=>{c(e.currentTarget)},"aria-label":"selected week"},{children:`${(0,i.format)(g,"dd",{locale:o})} - ${(0,i.format)(h,"dd MMM yyyy",{locale:o})}`})),(0,n.jsx)(a.Popover,Object.assign({open:Boolean(d),anchorEl:d,onClose:v,anchorOrigin:{vertical:"bottom",horizontal:"left"}},{children:(0,n.jsx)(Me,{children:(0,n.jsx)(Re.DateCalendar,Object.assign({},l,{openTo:"day",views:["month","day"],value:e,onChange:e=>{t(e||new Date),v()}}))})})),(0,n.jsx)(Ie,{type:"next",onClick:()=>{const e=(0,i.addDays)(h,1);t(e)},"aria-label":"next week"})]})},Pe=({selectedDate:e,onChange:t})=>{const{locale:s,navigationPickerProps:o}=S(),[l,d]=(0,r.useState)(null),c=()=>{d(null)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ie,{type:"prev",onClick:()=>{const n=(0,i.addDays)(e,-1);t(n)},"aria-label":"previous day"}),(0,n.jsx)(a.Button,Object.assign({style:{padding:4},onClick:e=>{d(e.currentTarget)},"aria-label":"selected date"},{children:(0,i.format)(e,"dd MMMM yyyy",{locale:s})})),(0,n.jsx)(a.Popover,Object.assign({open:Boolean(l),anchorEl:l,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"left"}},{children:(0,n.jsx)(Me,{children:(0,n.jsx)(Re.DateCalendar,Object.assign({},o,{openTo:"day",views:["month","day"],value:e,onChange:e=>{t(e||new Date),c()}}))})})),(0,n.jsx)(Ie,{type:"next",onClick:()=>{const n=(0,i.addDays)(e,1);t(n)},"aria-label":"next day"})]})},$e=({selectedDate:e,onChange:t})=>{const{locale:s,navigationPickerProps:o}=S(),l=(0,i.getMonth)(e),[d,c]=(0,r.useState)(null),u=()=>{c(null)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ie,{type:"prev",onClick:()=>{const n=l-1;t((0,i.setMonth)(e,n))},"aria-label":"previous month"}),(0,n.jsx)(a.Button,Object.assign({style:{padding:4},onClick:e=>{c(e.currentTarget)},"aria-label":"selected month"},{children:(0,i.format)(e,"MMMM yyyy",{locale:s})})),(0,n.jsx)(a.Popover,Object.assign({open:Boolean(d),anchorEl:d,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"left"}},{children:(0,n.jsx)(Me,{children:(0,n.jsx)(Re.DateCalendar,Object.assign({},o,{openTo:"month",views:["year","month"],value:e,onChange:e=>{t(e||new Date),u()}}))})})),(0,n.jsx)(Ie,{type:"next",onClick:()=>{const n=l+1;t((0,i.setMonth)(e,n))},"aria-label":"next month"})]})},We=require("@mui/icons-material/MoreVert");var Le=e.n(We);const qe=require("@mui/icons-material/ViewAgenda");var ze=e.n(qe);const Ae=()=>{const{selectedDate:e,view:t,week:i,handleState:s,getViews:o,translations:l,navigation:d,day:c,month:u,disableViewNavigator:g,onSelectedDateChange:h,onViewChange:v,stickyNavigation:y,timeZone:m,agenda:f,toggleAgenda:j}=S(),[b,x]=(0,r.useState)(null),O=(0,a.useTheme)(),_=(0,a.useMediaQuery)(O.breakpoints.up("sm")),w=o(),D=e=>{x(e||null)},k=e=>{s(e,"selectedDate"),h&&"function"==typeof h&&h(e)},C=e=>{s(e,"view"),v&&"function"==typeof v&&v(e)};return!d&&g?null:(0,n.jsxs)(W,Object.assign({sticky:y?"1":"0"},{children:[(0,n.jsx)("div",Object.assign({"data-testid":"date-navigator"},{children:d&&(()=>{switch(t){case"month":return(null==u?void 0:u.navigation)&&(0,n.jsx)($e,{selectedDate:e,onChange:k});case"week":return(null==i?void 0:i.navigation)&&(0,n.jsx)(Ne,{selectedDate:e,onChange:k,weekProps:i});case"day":return(null==c?void 0:c.navigation)&&(0,n.jsx)(Pe,{selectedDate:e,onChange:k});default:return""}})()})),(0,n.jsxs)("div",Object.assign({className:"rs__view_navigator","data-testid":"view-navigator",style:{visibility:g?"hidden":"visible"}},{children:[(0,n.jsx)(a.Button,Object.assign({onClick:()=>k(p(new Date,m)),"aria-label":l.navigation.today},{children:l.navigation.today})),_?(0,n.jsx)(a.Button,Object.assign({color:f?"primary":"inherit",onClick:j,"aria-label":l.navigation.agenda},{children:l.navigation.agenda})):(0,n.jsx)(a.IconButton,Object.assign({color:f?"primary":"default",style:{padding:5},onClick:j},{children:(0,n.jsx)(ze(),{})})),w.length>1&&(_?w.map((e=>(0,n.jsx)(a.Button,Object.assign({color:e===t?"primary":"inherit",onClick:()=>C(e),onDragOver:t=>{t.preventDefault(),C(e)}},{children:l.navigation[e]}),e))):(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(a.IconButton,Object.assign({style:{padding:5},onClick:e=>{D(e.currentTarget)}},{children:(0,n.jsx)(Le(),{})})),(0,n.jsx)(a.Popover,Object.assign({open:Boolean(b),anchorEl:b,onClose:()=>{D()},anchorOrigin:{vertical:"center",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},{children:(0,n.jsx)(a.MenuList,Object.assign({autoFocusItem:!!b,disablePadding:!0},{children:w.map((e=>(0,n.jsx)(a.MenuItem,Object.assign({selected:e===t,onClick:()=>{D(),C(e)}},{children:l.navigation[e]}),e)))}))}))]}))]}))]}))},Be=require("@mui/x-date-pickers/DatePicker"),He=require("@mui/x-date-pickers/DateTimePicker"),Ve=({type:e="datetime",value:t,label:a,name:i,onChange:s,variant:o="outlined",error:l,errMsg:d,touched:c,required:u})=>{var g;const{translations:h}=S(),[v,y]=(0,r.useState)({touched:!1,valid:!!t,errorMsg:d||(u?(null===(g=null==h?void 0:h.validation)||void 0===g?void 0:g.required)||"Required":void 0)}),p="date"===e?Be.DatePicker:He.DateTimePicker,m=v.touched&&(l||!v.valid);(0,r.useEffect)((()=>{c&&f(t)}),[c]);const f=e=>{var t;const n=!isNaN(Date.parse(e)),r="string"==typeof e&&n?new Date(e):e;let a=!0,o=d;u&&!r&&(a=!1,o=d||(null===(t=null==h?void 0:h.validation)||void 0===t?void 0:t.required)||"Required"),y((e=>Object.assign(Object.assign({},e),{touched:!0,valid:a,errorMsg:o}))),s(i,r)};return(0,n.jsx)(Me,{children:(0,n.jsx)(p,{value:t,label:a,onChange:e=>{f(e)},minutesStep:5,slotProps:{textField:{variant:o,helperText:m&&v.errorMsg,error:m,fullWidth:!0}}})})},Ze=({variant:e="outlined",label:t,placeholder:i,value:s,name:o,required:l,min:d,max:c,email:u,decimal:g,onChange:h,disabled:v,multiline:y,rows:p,touched:m})=>{const[f,j]=(0,r.useState)({touched:!1,valid:!1,errorMsg:""}),{translations:b}=S();(0,r.useEffect)((()=>{m&&x(s)}),[m]);const x=e=>{var t,n,r,a,i,s,v,y,p;const m=e;let f=!0,x="";u&&(f=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(m)&&f,x=(null===(t=null==b?void 0:b.validation)||void 0===t?void 0:t.invalidEmail)||"Invalid Email"),g&&(f=/^[0-9]+(\.[0-9]*)?$/.test(m)&&f,x=(null===(n=null==b?void 0:b.validation)||void 0===n?void 0:n.onlyNumbers)||"Only Numbers Allowed"),d&&`${m}`.trim().length<d&&(f=!1,x="function"==typeof(null===(r=null==b?void 0:b.validation)||void 0===r?void 0:r.min)?null===(a=null==b?void 0:b.validation)||void 0===a?void 0:a.min(d):(null===(i=null==b?void 0:b.validation)||void 0===i?void 0:i.min)||`Minimum ${d} letters`),c&&`${m}`.trim().length>c&&(f=!1,x="function"==typeof(null===(s=null==b?void 0:b.validation)||void 0===s?void 0:s.max)?null===(v=null==b?void 0:b.validation)||void 0===v?void 0:v.max(c):(null===(y=null==b?void 0:b.validation)||void 0===y?void 0:y.max)||`Maximum ${c} letters`),l&&`${m}`.trim().length<=0&&(f=!1,x=(null===(p=null==b?void 0:b.validation)||void 0===p?void 0:p.required)||"Required"),j({touched:!0,valid:f,errorMsg:x}),h(o,m,f)};return(0,n.jsx)(a.TextField,{variant:e,label:t&&(0,n.jsx)(a.Typography,Object.assign({variant:"body2"},{children:`${t} ${l?"*":""}`})),value:s,name:o,onChange:e=>x(e.target.value),disabled:v,error:f.touched&&!f.valid,helperText:f.touched&&!f.valid&&f.errorMsg,multiline:y,rows:p,style:{width:"100%"},InputProps:{placeholder:i||""}})},Ge=require("@mui/icons-material/ExpandMore");var Ke=e.n(Ge);const Xe=({options:e,value:t,name:i,required:s,onChange:o,label:l,disabled:d,touched:c,variant:u="outlined",loading:g,multiple:h,placeholder:v,errMsg:y})=>{var p;const m=(0,a.useTheme)(),{translations:f}=S(),[j,b]=(0,r.useState)({touched:!1,valid:!!t,errorMsg:y||(s?(null===(p=null==f?void 0:f.validation)||void 0===p?void 0:p.required)||"Required":void 0)});(0,r.useEffect)((()=>{c&&x(t)}),[c]);const x=e=>{var t;const n=e;let r=!0,a=y;!s||(h?n.length:n)||(r=!1,a=y||(null===(t=null==f?void 0:f.validation)||void 0===t?void 0:t.required)||"Required"),b((e=>Object.assign(Object.assign({},e),{touched:!0,valid:r,errorMsg:a}))),o(i,n,r)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.FormControl,Object.assign({variant:u||"outlined",fullWidth:!0,error:s&&j.touched&&!j.valid,disabled:d},{children:[l&&(0,n.jsx)(a.InputLabel,Object.assign({id:`input_${i}`},{children:(0,n.jsx)(a.Typography,Object.assign({variant:"body2"},{children:`${l} ${s?"*":""}`}))})),(0,n.jsxs)(a.Select,Object.assign({label:l,labelId:`input_${i}`,value:t,onBlur:()=>{j.touched||b((e=>Object.assign(Object.assign({},e),{touched:!0,errorMsg:y||e.errorMsg})))},onChange:e=>x(e.target.value),IconComponent:g?()=>(0,n.jsx)(a.CircularProgress,{size:5}):Ke(),multiple:!!h,classes:{select:"chips"===h?"flex__wrap":void 0},renderValue:t=>{if(!t||0===t.length)return(0,n.jsx)("em",{children:l});const r=[];if(h){for(const n of e)t.includes(n.value)&&r.push([n.text]);return"chips"===h?r.map(((e,t)=>(0,n.jsx)(a.Chip,{label:e,style:{margin:"0 2px"},color:"primary"},`${e}_${t}`))):r.join(",")}for(const n of e)t===n.value&&r.push([n.text]);return r.join(",")}},{children:[v&&(0,n.jsx)(a.MenuItem,Object.assign({value:""},{children:(0,n.jsx)("em",{children:v})})),e.map((e=>(0,n.jsxs)(a.MenuItem,Object.assign({value:e.value},{children:[h&&(0,n.jsx)(a.Checkbox,{checked:t.indexOf(e.value)>-1,color:"primary"}),e.text]}),e.id||e.value)))]}))]})),(0,n.jsx)(a.FormHelperText,Object.assign({style:{color:m.palette.error.main}},{children:j.touched&&!j.valid&&j.errorMsg}))]})};const Ue=(e,t)=>{var n;const r={};for(const a of e){const e=s(a,a.default,t),i=s(a,null==t?void 0:t[a.name],t);r[a.name]={value:i.value||e.value||"",validity:!(null===(n=a.config)||void 0===n?void 0:n.required)||!!i.validity||!!e.validity,type:a.type,config:a.config}}return Object.assign({event_id:{value:(null==t?void 0:t.event_id)||null,validity:!0,type:"hidden"},title:{value:(null==t?void 0:t.title)||"",validity:!!(null==t?void 0:t.title),type:"input",config:{label:"Title",required:!0,min:3}},start:{value:(null==t?void 0:t.start)||new Date,validity:!0,type:"date",config:{label:"Start",sm:6}},end:{value:(null==t?void 0:t.end)||new Date,validity:!0,type:"date",config:{label:"End",sm:6}}},r)},Qe=()=>{const{fields:e,dialog:t,triggerDialog:s,selectedRange:o,selectedEvent:l,resourceFields:d,selectedResource:c,triggerLoading:u,onConfirm:g,customEditor:h,confirmEvent:v,dialogMaxWidth:y,translations:p}=S(),[m,f]=(0,r.useState)(Ue(e,l||o)),[j,b]=(0,r.useState)(!1),x=(0,a.useTheme)(),O=(0,a.useMediaQuery)(x.breakpoints.down("sm")),_=(e,t,n)=>{f((r=>Object.assign(Object.assign({},r),{[e]:Object.assign(Object.assign({},r[e]),{value:t,validity:n})})))},w=t=>{t&&f(Ue(e)),s(!1)},D=()=>{return e=void 0,t=void 0,r=function*(){let e={};for(const t in m)if(e[t]=m[t].value,!h&&!m[t].validity)return b(!0);try{u(!0),e.end=e.start>=e.end?(0,i.addMinutes)(e.start,(0,i.differenceInMinutes)(null==o?void 0:o.end,null==o?void 0:o.start)):e.end;const t=(null==l?void 0:l.event_id)?"edit":"create";g?e=yield g(e,t):e.event_id=(null==l?void 0:l.event_id)||Date.now().toString(36)+Math.random().toString(36).slice(2),v(e,t),w(!0)}catch(e){console.error(e)}finally{u(!1)}},new((n=void 0)||(n=Promise))((function(a,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r},k=t=>{var r,a,i;const s=m[t];switch(s.type){case"input":return(0,n.jsx)(Ze,Object.assign({value:s.value,name:t,onChange:_,touched:j},s.config,{label:p.event[t]||(null===(r=s.config)||void 0===r?void 0:r.label)}));case"date":return(0,n.jsx)(Ve,Object.assign({value:s.value,name:t,onChange:(...e)=>_(...e,!0),touched:j},s.config,{label:p.event[t]||(null===(a=s.config)||void 0===a?void 0:a.label)}));case"select":const o=e.find((e=>e.name===t));return(0,n.jsx)(Xe,Object.assign({value:s.value,name:t,options:(null==o?void 0:o.options)||[],onChange:_,touched:j},s.config,{label:p.event[t]||(null===(i=s.config)||void 0===i?void 0:i.label)}));default:return""}};return(0,n.jsx)(a.Dialog,Object.assign({open:t,fullScreen:O,maxWidth:y},{children:(()=>{if(h){const e={state:m,close:()=>s(!1),loading:e=>u(e),edited:l,onConfirm:v,[d.idField]:c};return h(e)}return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(a.DialogTitle,{children:l?p.form.editTitle:p.form.addTitle}),(0,n.jsx)(a.DialogContent,Object.assign({style:{overflowX:"hidden"}},{children:(0,n.jsx)(a.Grid,Object.assign({container:!0,spacing:2},{children:Object.keys(m).map((e=>{var t;const r=m[e];return(0,n.jsx)(a.Grid,Object.assign({item:!0,sm:null===(t=r.config)||void 0===t?void 0:t.sm,xs:12},{children:k(e)}),e)}))}))})),(0,n.jsxs)(a.DialogActions,{children:[(0,n.jsx)(a.Button,Object.assign({color:"inherit",fullWidth:!0,onClick:()=>w()},{children:p.form.cancel})),(0,n.jsx)(a.Button,Object.assign({color:"primary",fullWidth:!0,onClick:D},{children:p.form.confirm}))]})]})})()}))},Ye=({events:e,resourceId:t,today:s,eachWeekStart:o,eachFirstDayInCalcRow:l,daysList:d,onViewMore:u,cellHeight:g})=>{const h=Math.round((g-27)/28-1),{translations:v,month:y,locale:p}=S(),{renderedSlots:m}=xe(),f=(0,r.useMemo)((()=>{var r;const g=[];for(let f=0;f<Math.min(e.length,h+1);f++){const j=e[f],b=!!l&&(0,i.isBefore)(j.start,l),x=b&&l?l:j.start;let O=c(x,j.end)+1;const _=(0,i.differenceInCalendarWeeks)(j.end,x,{weekStartsOn:null==y?void 0:y.weekStartOn,locale:p})>0;if(_){const e=(0,i.startOfWeek)(j.start,{weekStartsOn:null==y?void 0:y.weekStartOn,locale:p}),t=(0,i.closestTo)(e,o);t&&(O=d.length-(l?0:(0,i.differenceInDays)(j.start,t)))}const w=(0,i.format)(s,"yyyy-MM-dd"),D=null===(r=null==m?void 0:m[t||"all"])||void 0===r?void 0:r[w],k=(null==D?void 0:D[j.event_id])||0,C=28*Math.min(k,h)+27;if(k>=h){g.push((0,n.jsx)(a.Typography,Object.assign({width:"100%",className:"rs__multi_day rs__hover__op",style:{top:C,fontSize:11},onClick:e=>{e.stopPropagation(),u(j.start)}},{children:`${Math.abs(e.length-f)} ${v.moreEvents}`}),f));break}g.push((0,n.jsx)("div",Object.assign({className:"rs__multi_day",style:{top:C,width:100*O+"%"}},{children:(0,n.jsx)(re,{event:j,showdate:!1,multiday:c(j.start,j.end)>0,hasPrev:b,hasNext:_})}),`${j.event_id}_${f}`))}return g}),[t,m,e,h,l,null==y?void 0:y.weekStartOn,p,s,o,d.length,v.moreEvents,u]);return(0,n.jsx)(r.Fragment,{children:f})},Je=({events:e})=>{const{month:t,handleGotoDay:s,locale:o,timeZone:l,selectedDate:d}=S(),{disableGoToDay:c,headRenderer:u}=t,h=(0,i.getDaysInMonth)(d),v=Array.from({length:h},((e,t)=>t+1));return(0,r.useMemo)((()=>e.filter((e=>(0,i.isSameMonth)(e.start,d)))),[e,d]).length?(0,n.jsx)(L,{children:v.map((t=>{const r=new Date(d.getFullYear(),d.getMonth(),t),h=m({dateLeft:r,timeZone:l}),v=g(e,r);return v.length?(0,n.jsxs)("div",Object.assign({className:"rs__agenda_row "+((0,i.isToday)(r)?"rs__today_cell":"")},{children:[(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda__cell"},{children:"function"==typeof u?(0,n.jsx)("div",{children:u(r)}):(0,n.jsx)(a.Typography,Object.assign({sx:{fontWeight:h?"bold":"inherit"},color:h?"primary":"inherit",variant:"body2",className:c?"":"rs__hover__op",onClick:e=>{e.stopPropagation(),c||s(r)}},{children:(0,i.format)(r,"dd E",{locale:o})}))})),(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda_items"},{children:(0,n.jsx)(Oe,{day:r,events:v})}))]}),t):null}))}):(0,n.jsx)(_e,{})};const et=()=>{const{month:e,selectedDate:t,height:s,events:l,handleGotoDay:d,getRemoteEvents:c,triggerLoading:u,handleState:g,resources:h,resourceFields:y,fields:p,locale:j,hourFormat:b,stickyNavigation:x,timeZone:O,agenda:_}=S(),{weekStartOn:w,weekDays:D,startHour:k,endHour:C,cellRenderer:M,headRenderer:T,disableGoToDay:E}=e,F=(0,i.startOfMonth)(t),I=(0,i.endOfMonth)(t),R=(0,i.eachWeekOfInterval)({start:F,end:I},{weekStartsOn:w}),N=f(b),P=D.map((e=>(0,i.addDays)(R[0],e))),$=s/R.length,W=(0,a.useTheme)(),{headersRef:L,bodyRef:z}=je(),A=(0,r.useCallback)((()=>{return e=void 0,t=void 0,r=function*(){try{u(!0);const e=R[0],t=(0,i.addDays)(R[R.length-1],P.length),n=yield c({start:e,end:t,view:"month"});n&&(null==n?void 0:n.length)&&g(n,"events")}catch(e){throw e}finally{u(!1)}},new((n=void 0)||(n=Promise))((function(a,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}),[t,c]);(0,r.useEffect)((()=>{c instanceof Function&&A()}),[A,c]);const B=(0,r.useCallback)((e=>{let s=v(l);e&&(s=o(l,e,y,p));const c=[];for(const o of R){const l=D.map((l=>{const c=(0,i.addDays)(o,l),u=new Date(`${(0,i.format)((0,i.setHours)(c,k),`yyyy/MM/dd ${N}`)}`),g=new Date(`${(0,i.format)((0,i.setHours)(c,C),`yyyy/MM/dd ${N}`)}`),h=y.idField,v=(0,i.isSameDay)(o,c)?c:null,p=s.filter((e=>v&&(0,i.isWithinInterval)(v,{start:(0,i.startOfDay)(e.start),end:(0,i.endOfDay)(e.end)})||(0,i.isSameDay)(e.start,c))),f=m({dateLeft:c,timeZone:O});return(0,n.jsxs)("span",Object.assign({style:{height:$},className:"rs__cell"},{children:[(0,n.jsx)(ve,{start:u,end:g,day:t,height:$,resourceKey:h,resourceVal:e?e[h]:null,cellRenderer:M}),(0,n.jsxs)(r.Fragment,{children:["function"==typeof T?(0,n.jsx)("div",Object.assign({style:{position:"absolute",top:0}},{children:T(c)})):(0,n.jsx)(a.Avatar,Object.assign({style:{width:27,height:27,position:"absolute",top:0,background:f?W.palette.secondary.main:"transparent",color:f?W.palette.secondary.contrastText:"",marginBottom:2}},{children:(0,n.jsx)(a.Typography,Object.assign({color:(0,i.isSameMonth)(c,F)?"textPrimary":"#ccc",className:E?"":"rs__hover__op",onClick:e=>{e.stopPropagation(),E||d(c)}},{children:(0,i.format)(c,"dd")}))})),(0,n.jsx)(Ye,{events:p,resourceId:null==e?void 0:e[h],today:c,eachWeekStart:R,eachFirstDayInCalcRow:v,daysList:P,onViewMore:e=>{d(e)},cellHeight:$})]})]}),l.toString())}));c.push((0,n.jsx)(r.Fragment,{children:l},o.toString()))}return c}),[$,M,P,E,R,C,l,p,N,d,T,F,y,t,k,W.palette.secondary.contrastText,W.palette.secondary.main,D,O]),H=(0,r.useCallback)((e=>{if(_){let t=v(l);return e&&(t=o(l,e,y,p)),(0,n.jsx)(Je,{events:t})}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(q,Object.assign({days:P.length,ref:L,indent:"0",sticky:"1",stickyNavigation:x},{children:P.map(((e,t)=>(0,n.jsx)(a.Typography,Object.assign({className:"rs__cell rs__header rs__header__center",align:"center",variant:"body2"},{children:(0,i.format)(e,"EE",{locale:j})}),t)))})),(0,n.jsx)(q,Object.assign({days:P.length,ref:z,indent:"0"},{children:B(e)}))]})}),[_,z,P,l,p,L,j,B,y,x]);return h.length?(0,n.jsx)(ue,{renderChildren:H}):H()},tt=({events:e})=>{const{day:t,locale:s,selectedDate:o}=S(),{headRenderer:l}=t,d=(0,r.useMemo)((()=>g(e,o)),[e,o]);return d.length?(0,n.jsx)(L,{children:(0,n.jsxs)("div",Object.assign({className:"rs__agenda_row rs__today_cell"},{children:[(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda__cell"},{children:"function"==typeof l?(0,n.jsx)("div",{children:l(o)}):(0,n.jsx)(a.Typography,Object.assign({variant:"body2"},{children:(0,i.format)(o,"dd E",{locale:s})}))})),(0,n.jsx)("div",Object.assign({className:"rs__cell rs__agenda_items"},{children:(0,n.jsx)(Oe,{day:o,events:d})}))]}))}):(0,n.jsx)(_e,{})};const nt=()=>{const{day:e,selectedDate:t,events:s,height:c,getRemoteEvents:g,triggerLoading:h,handleState:v,resources:p,resourceFields:m,resourceViewMode:j,fields:b,direction:x,locale:O,hourFormat:_,timeZone:w,stickyNavigation:D,agenda:k}=S(),{startHour:C,endHour:M,step:T,cellRenderer:F,headRenderer:I,hourRenderer:R}=e,N=(0,i.set)(t,{hours:C,minutes:0,seconds:0}),P=(0,i.set)(t,{hours:M,minutes:-T,seconds:0}),$=(0,i.eachMinuteOfInterval)({start:N,end:P},{step:T}),W=d(c,$.length),L=l(W,T),z=f(_),{headersRef:A,bodyRef:B}=je(),H=(0,r.useCallback)((()=>{return e=void 0,t=void 0,r=function*(){try{h(!0);const e=(0,i.addDays)(N,-1),t=(0,i.addDays)(P,1),n=yield g({start:e,end:t,view:"day"});n&&(null==n?void 0:n.length)&&v(n,"events")}catch(e){throw e}finally{h(!1)}},new((n=void 0)||(n=Promise))((function(a,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function o(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}));var e,t,n,r}),[t,g]);(0,r.useEffect)((()=>{g instanceof Function&&H()}),[H,g]);const V=e=>{const r=y(e,t);return(0,n.jsx)("div",Object.assign({className:"rs__block_col",style:{height:28*r.length}},{children:r.map(((e,r)=>{const a=(0,i.isBefore)(e.start,(0,i.startOfDay)(t)),s=(0,i.isAfter)(e.end,(0,i.endOfDay)(t));return(0,n.jsx)("div",Object.assign({className:"rs__multi_day",style:{top:28*r,width:"99.9%",overflowX:"hidden"}},{children:(0,n.jsx)(re,{event:e,multiday:!0,hasPrev:a,hasNext:s})}),e.event_id)}))}))},Z=e=>{let l=s;if(e&&(l=o(s,e,m,b)),k)return(0,n.jsx)(tt,{events:l});const d=p.length&&"tabs"!==j,c=28*y(d?s:l,t).length+45;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(q,Object.assign({days:1,ref:A,sticky:"1",stickyNavigation:D},{children:[(0,n.jsx)("span",{className:"rs__cell"}),(0,n.jsxs)("span",Object.assign({className:"rs__cell rs__header "+((0,i.isToday)(t)?"rs__today_cell":""),style:{height:c}},{children:["function"==typeof I?(0,n.jsx)("div",{children:I(t)}):(0,n.jsx)(E,{date:t,locale:O}),V(l)]}))]})),(0,n.jsx)(q,Object.assign({days:1,ref:B},{children:$.map(((s,o)=>{const d=new Date(`${(0,i.format)(t,"yyyy/MM/dd")} ${(0,i.format)(s,z)}`),c=(0,i.addMinutes)(d,T),g=m.idField;return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)("span",Object.assign({className:"rs__cell rs__header rs__time",style:{height:W}},{children:"function"==typeof R?(0,n.jsx)("div",{children:R((0,i.format)(s,z,{locale:O}))}):(0,n.jsx)(a.Typography,Object.assign({variant:"caption"},{children:(0,i.format)(s,z,{locale:O})}))})),(0,n.jsxs)("span",Object.assign({className:"rs__cell "+((0,i.isToday)(t)?"rs__today_cell":"")},{children:[0===o&&(0,n.jsx)(fe,{todayEvents:u(l,t),today:N,minuteHeight:L,startHour:C,step:T,direction:x,timeZone:w}),(0,n.jsx)(ve,{start:d,end:c,day:t,height:W,resourceKey:g,resourceVal:e?e[g]:null,cellRenderer:F})]}))]},o)}))}))]})};return p.length?(0,n.jsx)(ue,{renderChildren:Z}):Z()},rt=e=>{const t={};let n=0;for(let r=0;r<e.length;r++){const a=e[r],s=(0,i.eachDayOfInterval)({start:a.start,end:a.end});for(let e=0;e<s.length;e++){const r=(0,i.format)(s[e],"yyyy-MM-dd");if(t[r]){const e=Object.values(t[r]);for(;e.includes(n);)n+=1;t[r][a.event_id]=n}else t[r]={[a.event_id]:n}}n=0}return t},at=(e,t,n,r)=>{const a=v(e),i={};if(t.length)for(const e of t){const t=o(a,e,n,r),s=rt(t);i[e[n.idField]]=s}else i.all=rt(e);return i},it=({children:e})=>{const{events:t,resources:a,resourceFields:i,fields:s}=S(),[o,l]=(0,r.useState)({renderedSlots:at(t,a,i,s)});return(0,r.useEffect)((()=>{l((e=>Object.assign(Object.assign({},e),{renderedSlots:at(t,a,i,s)})))}),[t,s,i,a]),(0,n.jsx)(be.Provider,Object.assign({value:Object.assign(Object.assign({},o),{setRenderedSlot:(e,t,n,r)=>{l((a=>{var i,s,o,l,d;return Object.assign(Object.assign({},a),{renderedSlots:Object.assign(Object.assign({},a.renderedSlots),{[r||"all"]:Object.assign(Object.assign({},null===(i=a.renderedSlots)||void 0===i?void 0:i[r||"all"]),{[e]:(null===(o=null===(s=a.renderedSlots)||void 0===s?void 0:s[r||"all"])||void 0===o?void 0:o[e])?Object.assign(Object.assign({},null===(d=null===(l=a.renderedSlots)||void 0===l?void 0:l[r||"all"])||void 0===d?void 0:d[e]),{[t]:n}):{[t]:n}})})})}))}})},{children:e}))},st=(0,r.forwardRef)((function(e,t){const i=S(),{view:s,dialog:o,loading:l,loadingComponent:d,resourceViewMode:c,resources:u,translations:g}=i,h=(0,r.useMemo)((()=>{switch(s){case"month":return(0,n.jsx)(et,{});case"week":return(0,n.jsx)(De,{});case"day":return(0,n.jsx)(nt,{});default:return""}}),[s]),v=(0,r.useMemo)((()=>(0,n.jsx)("div",Object.assign({className:"rs__table_loading"},{children:d||(0,n.jsx)("div",Object.assign({className:"rs__table_loading_internal"},{children:(0,n.jsxs)("span",{children:[(0,n.jsx)(a.CircularProgress,{size:50}),(0,n.jsx)(a.Typography,Object.assign({align:"center"},{children:g.loading}))]})}))}))),[d,g.loading]);return(0,n.jsxs)(P,Object.assign({dialog:o?1:0,"data-testid":"rs-wrapper",ref:e=>{t&&(t.current={el:e,scheduler:i})}},{children:[l?v:null,(0,n.jsx)(Ae,{}),(0,n.jsx)($,Object.assign({resource_count:"tabs"===c?1:u.length,sx:{overflowX:"default"===c&&u.length>1?"auto":void 0},"data-testid":"grid"},{children:(0,n.jsx)(it,{children:h})})),o&&(0,n.jsx)(Qe,{})]}))}));const ot=({children:e,initial:t})=>{const[a,o]=(0,r.useState)(Object.assign(Object.assign({},M),C(t)));(0,r.useEffect)((()=>{o((e=>Object.assign(Object.assign({},e),{onEventDrop:t.onEventDrop,customEditor:t.customEditor,events:t.events||[]})))}),[t.onEventDrop,t.customEditor,t.events]);const l=()=>(e=>{const t=[];return e.month&&t.push("month"),e.week&&t.push("week"),e.day&&t.push("day"),t})(a),d=e=>{void 0===t.loading&&o((t=>Object.assign(Object.assign({},t),{loading:e})))},c=(e,t)=>{let n;n="edit"===t?Array.isArray(e)?a.events.map((t=>{const n=e.find((e=>e.event_id===t.event_id));return n?Object.assign(Object.assign({},t),n):t})):a.events.map((t=>t.event_id===e.event_id?Object.assign(Object.assign({},t),e):t)):a.events.concat(e),o((e=>Object.assign(Object.assign({},e),{events:n})))};return(0,n.jsx)(T.Provider,Object.assign({value:Object.assign(Object.assign({},a),{handleState:(e,t)=>{o((n=>Object.assign(Object.assign({},n),{[t]:e})))},getViews:l,toggleAgenda:()=>{o((e=>Object.assign(Object.assign({},e),{agenda:!e.agenda})))},triggerDialog:(e,t)=>{const n=t;o((t=>{var r;return Object.assign(Object.assign({},t),{dialog:e,selectedRange:(null==n?void 0:n.event_id)?void 0:n||{start:new Date,end:new Date(Date.now()+36e5)},selectedEvent:(null==n?void 0:n.event_id)?n:void 0,selectedResource:null==n?void 0:n[null===(r=a.resourceFields)||void 0===r?void 0:r.idField]})}))},triggerLoading:d,handleGotoDay:e=>{const t=l();let n="";t.includes("day")?(n="day",o((t=>Object.assign(Object.assign({},t),{view:"day",selectedDate:e})))):t.includes("week")?(n="week",o((t=>Object.assign(Object.assign({},t),{view:"week",selectedDate:e})))):console.warn("No Day/Week views available"),n&&a.onViewChange&&"function"==typeof a.onViewChange&&a.onViewChange(n)},confirmEvent:c,setCurrentDragged:e=>{o((t=>Object.assign(Object.assign({},t),{currentDragged:e})))},onDrop:(e,t,n,r)=>{return o=void 0,l=void 0,g=function*(){var o;const l=a.events.find((t=>"number"==typeof t.event_id?t.event_id===+e:t.event_id===e)),u=a.fields.find((e=>e.name===n)),g=!!(null===(o=null==u?void 0:u.config)||void 0===o?void 0:o.multiple);let h=r;if(u){const e=l[n],a=s(u,e,l).value;if(g)if(a.includes(r)){if((0,i.isEqual)(l.start,t))return;h=a}else h=a.length>1?[...a,r]:[r]}if((0,i.isEqual)(l.start,t)&&(!h||!g&&h===l[n]))return;const v=(0,i.differenceInMinutes)(l.end,l.start),y=Object.assign(Object.assign({},l),{start:t,end:(0,i.addMinutes)(t,v),[n]:h||""});if(!a.onEventDrop||"function"!=typeof a.onEventDrop)return c(y,"edit");try{d(!0);const e=yield a.onEventDrop(t,y,l);e&&c(e,"edit")}finally{d(!1)}},new((u=void 0)||(u=Promise))((function(e,t){function n(e){try{a(g.next(e))}catch(e){t(e)}}function r(e){try{a(g.throw(e))}catch(e){t(e)}}function a(t){var a;t.done?e(t.value):(a=t.value,a instanceof u?a:new u((function(e){e(a)}))).then(n,r)}a((g=g.apply(o,l||[])).next())}));var o,l,u,g}})},{children:e}))},lt=(0,r.forwardRef)((function(e,t){return(0,n.jsx)(ot,Object.assign({initial:e},{children:(0,n.jsx)(st,{ref:t})}))}));module.exports=t})();

@@ -1,1 +0,1 @@

{"name":"@aldabil/react-scheduler","version":"2.8.1","description":"React scheduler component based on Material-UI & date-fns","files":["*"],"repository":{"type":"git","url":"https://github.com/aldabil21/react-scheduler.git"},"keywords":["react","material-ui","calendar","scheduler"],"author":"Aldabil","license":"MIT","homepage":"https://github.com/aldabil21/react-scheduler#readme","bugs":{"url":"https://github.com/aldabil21/react-scheduler/issues"},"peerDependencies":{"@mui/icons-material":">=5.0.0","@mui/material":">=5.0.0","@mui/x-date-pickers":">=6.0.0-alpha","date-fns":">=2.2","react":">=17.0.0"},"eslintConfig":{"extends":["react-app","react-app/jest"]},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]}}
{"name":"@aldabil/react-scheduler","version":"2.8.2","description":"React scheduler component based on Material-UI & date-fns","files":["*"],"repository":{"type":"git","url":"https://github.com/aldabil21/react-scheduler.git"},"keywords":["react","material-ui","calendar","scheduler"],"author":"Aldabil","license":"MIT","homepage":"https://github.com/aldabil21/react-scheduler#readme","bugs":{"url":"https://github.com/aldabil21/react-scheduler/issues"},"peerDependencies":{"@mui/icons-material":">=5.0.0","@mui/material":">=5.0.0","@mui/x-date-pickers":">=6.0.0-alpha","date-fns":">=2.2","react":">=17.0.0"},"eslintConfig":{"extends":["react-app","react-app/jest"]},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]}}

@@ -134,2 +134,3 @@ import { SchedulerProps } from "../types";

confirmEvent: () => void;
setCurrentDragged: () => void;
onDrop: () => void;

@@ -136,0 +137,0 @@ height: number;

@@ -12,2 +12,3 @@ import { View } from "../components/nav/Navigation";

selectedResource?: DefaultRecourse["assignee"];
currentDragged?: ProcessedEvent;
}

@@ -22,3 +23,4 @@ export interface Store extends SchedulerState {

confirmEvent(event: ProcessedEvent | ProcessedEvent[], action: EventActions): void;
setCurrentDragged(event?: ProcessedEvent): void;
onDrop(eventId: string, droppedStartTime: Date, resourceKey?: string, resourceVal?: string | number): void;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc