define(['exports', 'preact/jsx-runtime', './dayUtils-619d141a', './getFormatParse-3d7186b3', './logger-0f873e29', './calendarDateUtils-5e25297c', 'preact/hooks', './StyledDatePickerButton-e886e52a', 'preact/compat', './useTranslationBundle-7c40cb58', './useCellNavigation-4138513e', './PRIVATE_MonthView/themes/DayCellStyles.css', './useUser-797287de', './Grid-a8a51c37', './PRIVATE_MonthView/themes/redwood/MonthViewTheme', './useComponentTheme-5aa41a8f', './PRIVATE_MonthView/themes/MonthViewContract.css', './PRIVATE_MonthView/themes/WeekNumberCellStyle.css'], (function(e,t,a,s,o,r,n,i,l,d,c,u,h,m,y,p,g,D){"use strict";const w=()=>({state:"enabled"}),T=e=>{const{buttonProps:a}=(({date:e,dayFormatter:t=w,dateFormatter:a,isAdjacentMonth:s,isDisabled:o,isFocusable:n,isFocused:i,isHidden:u,isReadonly:h,isSelected:m,isToday:y,onAction:p,onNavigation:g})=>{const{state:D}=t(e),T="disabled"===D,b="restricted"===D,f=c.useFocusableCell({isFocusable:n,isFocused:i}),k=l.useCallback((e=>{o||h||T||b||p(e)}),[o,T,h,b,p]),S=c.useCellNavigation({navigationMap:{ArrowLeft:{ltr:"previousDay",rtl:"nextDay"},ArrowRight:{ltr:"nextDay",rtl:"previousDay"},ArrowDown:"nextWeek",ArrowUp:"previousWeek",PageDown:"nextMonth",PageUp:"previousMonth",Home:"firstDayOfMonth",End:"lastDayOfMonth",ShiftPageDown:"nextYear",ShiftPageUp:"previousYear",CtrlAltT:"today"},payload:{date:e},onAction:k,onNavigation:g}),x=d.useTranslationBundle("@oracle/oraclejet-preact"),C=x.datePicker_today(),M=x.datePicker_selected(),v=x.datePicker_restricted(),j=a(r.getIsoDateStr(e.year,e.month,e.day));let P=y?`${C}, ${j}`:j;P=b?`${P}, ${v}`:P,P=m?`${P}, ${M}`:P;const V=r.toJSDate(e.year,e.month,e.day).getDate().toString();return{buttonProps:{"aria-label":P,...(u||o||T||b)&&{"aria-disabled":!0},isActivable:!(o||h||T||b),isAdjacentMonth:s,isDimmed:o||T,isHidden:u,isHoverable:!(o||h||T||b),isReadonly:h,isSelected:m,isRestricted:b,isToday:y,label:V,...f,...S}}})(e);return t.jsx("div",{role:"gridcell",class:u.dayCellStyles,children:t.jsx(i.StyledDatePickerButton,{...a})})},b=({startDateOfWeek:e})=>{const a=(e=>{const t=r.toJSDate(e.year,e.month,e.day),a=t.getUTCDay();0!==a&&1!==a&&6!==a&&o.warn("calculateWeekNumber's date property's getUTCDay() is assumed to be 0 (Sunday), 1 (Monday) or 6 (Saturday)\n      since that is the first day of the week for the locale's JET supports."),1!==a&&t.setUTCDate(t.getUTCDate()+(0===a?1:2)),t.setUTCDate(t.getUTCDate()+3);const s=r.toJSDate(t.getUTCFullYear(),1,1);return Math.floor(Math.round((t.getTime()-s.getTime())/864e5)/7)+1})(e),s=d.useTranslationBundle("@oracle/oraclejet-preact");return t.jsx("div",{"aria-label":s.datePicker_weekNum({NUM:String(a)}),class:D.weekNumberCellStyles,role:"rowheader",children:t.jsx("span",{class:D.weekNumberStyles,children:a})})};function f(e,t){return e.year===t.year&&e.month===t.month&&e.day===t.day}e.MonthView=({dayFormatter:e,daysOutsideMonth:o="hidden",isReadonly:i=!1,max:l,min:d,onAction:c,onNavigation:u,selectedDate:D,focusableDate:w,isFocused:k=!1,testId:S,todaysDate:x,weekDisplay:C="none"})=>{const{locale:M}=h.useUser(),v=a.getWeeksInMonth(w.year,w.month,M),{baseTheme:j,styles:P}=p.useComponentTheme(y.MonthViewRedwoodTheme,{}),V="number"===C,A=`repeat(${V?8:7}, 1fr)`,F=n.useMemo((()=>{r.checkNoCalendarExtension(M);const e={locale:M,dateStyle:"full"},{format:t}=s.getFormatParse(e);return t}),[M]),U=r.formatFullCalendarDate(M,w,"month");return t.jsx("div",{class:j,children:t.jsxs(m.Grid,{gap:g.monthViewScaleVars.rowGap,"aria-label":U,role:"grid",testId:S,children:[(()=>{const e=a.getDaysOfWeekNames(M,"short");return t.jsx("div",{class:P.sticky,children:t.jsxs(m.Grid,{role:"row","aria-hidden":"true",gridTemplateColumns:A,gap:g.monthViewScaleVars.columnGap,children:[V&&t.jsx("div",{role:"presentation"}),e.map((e=>t.jsx("div",{role:"columnheader",class:P.dayOfTheWeek,children:t.jsx("span",{children:e})})))]})})})(),(()=>{const s=[];for(let n=0;n<v;n++){const h=a.getStartOfWeek(w.year,w.month,1,M),y=a.getDatesInWeek(n,h.year,h.month,h.day),p=y.map((a=>{const s=r.isDateOutOfRange(a,d,l),n=!!D&&f(a,D),h=f(a,x),m=f(a,w),y=(p=w,a.month!==p.month);var p;const g=y&&"hidden"===o;return t.jsx(T,{date:a,dateFormatter:F,dayFormatter:e,isAdjacentMonth:y,isDisabled:s,isFocusable:m,isFocused:m&&k,isHidden:g,isReadonly:i,isSelected:n,isToday:h,onAction:c,onNavigation:u},`${a.year}-${a.month}-${a.day}`)}));s.push(t.jsxs(m.Grid,{role:"row",gridTemplateColumns:A,gap:g.monthViewScaleVars.columnGap,children:[V&&t.jsx(b,{startDateOfWeek:y[0]}),p]},n))}return s})()]})})}}));
//# sourceMappingURL=MonthView-67179db3.js.map
