import{slicedToArray as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as t,jsx as r}from"react/jsx-runtime";import{useState as a}from"react";import i from"moment";import{CSSTransition as n}from"react-transition-group";import s from"classnames";import{YEAR_FORMAT as o}from"../constants.js";import c from"../DateNavigationItem/DateNavigationItem.js";import{Direction as m}from"../types.js";import p from"./YearPicker.module.scss.js";import{calcNewYearsPage as l}from"../date-picker-utils.js";import d from"./YearsList.js";var f={classNames:"slide-down",timeout:{enter:400,exit:400}},u=function(u){var v=u.selectedDate,g=u.isYearBlocked,j=u.changeCurrentDate,k=u["data-testid"],h=v?v.format(o):i().format(o),N=a(l(parseInt(h)-4,12)),b=e(N,2),x=b[0],O=b[1],Y=function(e){var t=x[0],r=[];e===m.prev?r=l(t-12,12):e===m.next&&(r=l(t+12,12)),O(r)};return t("div",Object.assign({"data-testid":"".concat(k,"-year-picker"),className:p.monthYearPicker},{children:[r("div",Object.assign({className:s(p.navigationWrapper,p.navigationLeft)},{children:r(c,{kind:m.prev,onClick:function(){return Y(m.prev)}})})),r("div",Object.assign({className:s(p.navigationWrapper,p.navigationRight)},{children:r(c,{kind:m.next,onClick:function(){return Y(m.next)}})})),r(n,Object.assign({},f,{in:!0,appear:!0},{children:r("div",Object.assign({className:p.pickerOptions},{children:r(d,{selectedYear:h,onSelect:function(e){j(i().year(e))},yearsItems:x,isYearBlocked:g})}))}))]}))};export{u as default};
