"use strict";const e=require("react/jsx-runtime"),l=require("react"),p=require("../global.module.cjs"),j=require("../tools/icons.cjs"),r=require("../tools/tools.cjs"),N=require("../lite.cjs"),k=new Date,D=function(S){const{as:M="div",className:v,dropOldClass:m,locale:c,onDateClick:i,selectedDate:u,style:h,variables:y,...f}=S,[n,W]=l.useState(k.getFullYear()),[o,w]=l.useState(k.getMonth()),[O,C]=l.useState(r.generateCalendar(n,o,[],6,1,void 0,u,c,!0)),[x,g]=l.useState(null),P=l.useMemo(()=>{const a=r.classx(!m&&"card card-body border-0 p-0",v),t=r.stylex((d,s)=>({tKey:r.convertBsKeyToVar(s)}),y,h);return{className:a,style:t}},[v,m,h,y]),b=l.useCallback(a=>{const t=new Date(n,o+a);W(t.getFullYear()),w(t.getMonth())},[o,n]),R=l.useCallback(a=>{const t={...a,active:!0};C(d=>r.updateCalendarWeekActiveState(t,d)),x?(i==null||i({date:r.sortDates(x,t.date)}),g(null)):g(t.date)},[i,x]);return l.useEffect(()=>{C(r.generateCalendar(n,o,[],6,1,void 0,u,c,!0))},[o,n,c,u]),e.jsx(M,{...f,...P,children:e.jsxs("div",{className:"list-group border-0 row-gap-1 px-3",children:[e.jsxs("div",{className:"row align-items-center position-relative text-center w-100 mb-2",children:[e.jsx("div",{className:"col px-1",onClick:()=>b(-1),children:e.jsx("div",{className:r.classxWithOptions(null,"user-select-none list-group-item list-group-item-action border-0 px-0 py-1 rounded text-secondary",p.treeStyles.brlCursorPointer),children:e.jsx(j.BiChevronLeft,{})})}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1",onClick:()=>b(1),children:e.jsx("div",{className:r.classxWithOptions(null,"user-select-none list-group-item list-group-item-action border-0 px-0 py-1 rounded text-secondary",p.treeStyles.brlCursorPointer),children:e.jsx(j.BiChevronRight,{})})}),e.jsx("div",{className:"position-absolute top-50 start-50 translate-middle w-auto text-nowrap",children:N.format(new Date(n,o),"MMMM yyyy",{locale:c})})]}),O.rows.map((a,t)=>{const d=t!==0&&a.every(s=>s.active);return e.jsx("div",{className:r.classxWithOptions(null,"row text-center d-flex list-group-item rounded p-0 border-0",t===0?"w-100":`list-group-item-action ${p.treeStyles.brlCursorPointer}`,d&&"active"),children:a.map((s,q)=>t===0?e.jsx("div",{className:"col px-1",children:e.jsx("div",{className:"px-0 py-1 rounded text-body-secondary",children:s.value})},`${s.value}${q}`):e.jsx("div",{className:"col px-1",onClick:()=>R(s),children:e.jsx("div",{className:r.classxWithOptions(null,"px-0 py-1 rounded",!s.isCurrentMonth&&!s.active&&"text-body-tertiary",s.isToday?"border border-secondary-subtle":"border-0"),children:N.format(s.date,"d",{locale:c})})},s.date.toISOString()))},t)})]})})};D.displayName="BRL.DateRangePickerWeek";exports.DateRangePickerWeek=D;
//# sourceMappingURL=date-range-picker-week.cjs.map
