const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-xgGnDRzG.js","assets/index-BW07AEtf.js","assets/index-Br4roydv.css","assets/SimpleGrid-D6wGvcje.js"])))=>i.map(i=>d[i]);
import{r as k,j as t,F as v,dZ as f,eE as h,aP as y,b8 as E,be as I,eF as R,eG as O,eH as S,eI as T,dO as x,dP as P,d as b,f as w,cg as p,ce as L,ch as M,ep as D,aM as N}from"./index-BW07AEtf.js";const _=(e,n)=>{const s=e.getDay();return s===0?n:s-1},z=(e,n)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()-_(e,n)),V=(e,n)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+(n-_(e,n))),j=(e,n,s=6)=>n&&O(z(n,s),V(n,s),e),C=e=>{const[n,s]=k.useState(null),[i,o]=k.useState(null),{onChange:g,onDateChange:a,...c}=e;return t.jsxs(v,{className:`week-picker-wrapper ${e.view}`,gap:"md",justify:"center",align:"flex-start",direction:"row",wrap:"nowrap",children:[t.jsx(f,{...c,onChange:h(g),onDateChange:a?h(a):void 0,level:"month",withCellSpacing:!1,getDayProps:u=>{const r=I(u),l=j(r,n),m=j(r,i),d=l||m;return{onMouseEnter:()=>s(r),onMouseLeave:()=>s(null),inRange:d,firstInRange:d&&r.getDay()===1,lastInRange:d&&r.getDay()===0,selected:m,onClick:()=>o(r),className:y(E(r),new Date,"day")?"current-day-picker":""}}}),t.jsx(R,{...c,onChange:h(g),onDateChange:a?h(a):void 0})]})},$=x(()=>P(()=>import("./index-xgGnDRzG.js"),__vite__mapDeps([0,1,2,3])),{resolveComponent:e=>e.DatePicker}),A=x(()=>P(()=>import("./index-xgGnDRzG.js"),__vite__mapDeps([0,1,2,3])),{resolveComponent:e=>e.MonthPicker}),F=x(()=>P(()=>import("./index-xgGnDRzG.js"),__vite__mapDeps([0,1,2,3])),{resolveComponent:e=>e.YearPicker}),W=e=>{const n=S(),{onChange:s,onDateChange:i,...o}=e,g=e.view,a={...o,onChange:h(s),onDateChange:i?h(i):void 0},c={month:t.jsx(A,{...a}),year:t.jsx(F,{...a}),week:t.jsx(C,{...e}),work_week:t.jsx(C,{...e}),day:t.jsx($,{...a})};return t.jsx(T,{settings:{timezone:n},children:c[g]})},B=({label:e,date:n,goToDate:s,view:i,endDate:o})=>{const[g,a]=k.useState(!1),{i18n:c}=b(),u={value:n,date:n,onDateChange:s,onChange:s,locale:c.language,size:"sm",p:"md",view:i,endDate:o},r=()=>{const l=m=>N(m,"LLLL yyyy",!1,c.language);return o&&D(n).isSame(o,"month")&&D(n).isSame(o,"year")?l(n):`${l(n)}${o?" - "+l(o):""}`};return i==="agenda"?t.jsx(w,{className:"date-label",mr:5,children:r()}):t.jsxs(p,{opened:g,onChange:a,position:"bottom-start",withArrow:!0,arrowSize:12,shadow:"md",children:[t.jsx(p.Target,{children:t.jsx(L,{onClick:()=>a(l=>!l),children:t.jsxs(v,{align:"center",className:"date-picker-box",children:[t.jsx(w,{className:"date-label",mr:5,children:e}),t.jsx(M,{size:16,color:"#98A2B3"})]})})}),t.jsx(p.Dropdown,{children:t.jsx(W,{...u})})]})};export{B as default};
