"use strict";const e=require("react/jsx-runtime"),r=require("react"),p=require("../global.module.cjs"),b=require("../tools/icons.cjs"),a=require("../tools/tools.cjs"),N=require("../lite.cjs"),D=new Date,k=function(S){const{as:M="div",className:v,dropOldClass:m,locale:c,onDateClick:i,selectedDate:d,style:h,variables:y,...f}=S,[n,w]=r.useState(D.getFullYear()),[o,R]=r.useState(D.getMonth()),[P,g]=r.useState(a.generateCalendar(n,o,[],6,1,void 0,d,c)),[u,C]=r.useState(null),q=r.useMemo(()=>{const l=a.classx(!m&&"card card-body border-0 p-0",v),s=a.stylex((t,x)=>({tKey:a.convertBsKeyToVar(x)}),y,h);return{className:l,style:s}},[v,m,h,y]),j=r.useCallback(l=>{const s=new Date(n,o+l);w(s.getFullYear()),R(s.getMonth())},[o,n]),O=r.useCallback(l=>{const s={...l,active:!0};g(t=>a.updateCalendarActiveState(s,t)),u?(i==null||i({date:a.sortDates(u,s.date)}),C(null)):C(s.date)},[i,u]);return r.useEffect(()=>{g(a.generateCalendar(n,o,[],6,1,void 0,d,c))},[o,n,c,d]),e.jsx(M,{...f,...q,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 mb-2",children:[e.jsx("div",{className:"col px-1",onClick:()=>j(-1),children:e.jsx("div",{className:a.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(b.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:()=>j(1),children:e.jsx("div",{className:a.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(b.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})})]}),P.rows.map((l,s)=>e.jsx("div",{className:"row text-center",children:l.map((t,x)=>s===0?e.jsx("div",{className:"col px-1",children:e.jsx("div",{className:"list-group-item border-0 px-0 py-1 rounded text-body-secondary",children:t.value})},`${t.value}${x}`):e.jsx("div",{className:"col px-1",onClick:()=>O(t),children:e.jsx("div",{className:a.classxWithOptions(null,"list-group-item list-group-item-action px-0 py-1 rounded",p.treeStyles.brlCursorPointer,!t.isCurrentMonth&&!t.active&&"text-body-tertiary",t.active&&"active",t.isToday?"border-secondary-subtle":"border-0"),children:N.format(t.date,"d",{locale:c})})},t.date.toISOString()))},s))]})})};k.displayName="BRL.DateRangePickerDate";exports.DateRangePickerDate=k;
//# sourceMappingURL=date-range-picker-date.cjs.map
