"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[120],{6002:function(e,t,a){a.d(t,{MJ:function(){return D}});var l,s=a(5893),n=a(6535),r=a(4588),i=a(6010),o=a(7294),c=a(9194),u=a(4941);let d=(0,u.g)("check-all","sc"),m=Object.freeze({wrapper:`${d}__wrapper`,link:`${d}__link`,icon:`${d}__icon`,iconGray:`${d}__icon--gray`}),p=({children:e,className:t,linkClassName:a,iconGrayBackground:l,Link:n=r.rU,event:o,href:u,dataLayerPush:d})=>(0,s.jsx)("div",{className:(0,i.Z)(m.wrapper,t),onClick:()=>{o&&d(o)},children:(0,s.jsxs)(n,{className:(0,i.Z)(m.link,a),href:u,children:[e,(0,s.jsx)("span",{className:(0,i.Z)(m.icon,{[m.iconGray]:l}),children:(0,s.jsx)(c.IconFdsArrowUpRightSmallO,{size:24})})]})});var h=a(9789),x=a(1069),_=a(7769),b=((l=b||{}).light="light",l.gray="gray",l);let g=e=>"kasko"===e||"osago"===e,v=(0,u.g)("best-offers-banner","sc"),f=Object.freeze({bestOffersBaner:v,wrapper:`${v}__wrapper`,wideWrapper:`${v}__wrapper--wide`,whiteWrapper:`${v}__wrapper--white`,content:`${v}__content`,header:`${v}__header`,title:`${v}__title`,subtitle:`${v}__subtitle`,icon:`${v}__icon`,iconBlack:`${v}__icon--black`,image:`${v}__image`}),j=({title:e,image:t,url:a,description:l,backgroundColor:r,textColor:o,wide:u,theme:d,handleBannerDataLayerPush:m,className:p})=>{let h=d===b.gray,x={"--bg-base":(null==r?void 0:r.base)??(h?"var(--color-white)":"var(--color-gray-400)"),"--bg-hover":(null==r?void 0:r.hover)??"var(--color-gray-500)"};return(0,s.jsxs)("div",{className:(0,i.Z)(f.wrapper,p,{[f.wideWrapper]:u}),style:x,onClick:()=>{m(),window.open(a,"_blank")},children:[(0,s.jsxs)("div",{className:f.content,children:[(0,s.jsxs)("div",{className:f.header,children:[(0,s.jsx)(n.xv,{weight:"medium",size:"24",className:f.title,style:{color:o},children:e}),(0,s.jsx)("div",{className:(0,i.Z)(f.icon,{[f.iconBlack]:h}),children:(0,s.jsx)(c.IconFdsArrowUpRightSmallO,{size:32})})]}),l&&(0,s.jsx)(n.xv,{size:"16",style:{color:o},children:l})]}),(null==t?void 0:t.url)&&(0,s.jsx)("picture",{className:f.image,children:(0,s.jsx)("img",{src:t.url,width:t.width??150,height:t.height??"auto",alt:`Баннер ${e}`,loading:"lazy"})})]})},w=(0,u.g)("offer-card","sc"),$=Object.freeze({offerCard:w,wrapper:`${w}__wrapper`,whiteWrapper:`${w}__wrapper--white`,bankInfo:`${w}__bankInfo`,units:`${w}__units`,unitsColumn:`${w}__units--column`,unit:`${w}__unit`,unitRow:`${w}__unit--row`,unitTitleWrapper:`${w}__unitTitleWrapper`,unitTitle:`${w}__unitTitle`,tooltipIcon:`${w}__tooltipIcon`,unitValue:`${w}__unitValue`,bottomBlock:`${w}__bottomBlock`,tags:`${w}__tags`,tag:`${w}__tag`,button:`${w}__button`,buttonRounded:`${w}__button--rounded`}),y=e=>{let t=e.split("₽");return t.map((e,a)=>(0,s.jsxs)(o.Fragment,{children:[e,a<t.length-1&&(0,s.jsx)(n.xv,{fontFamily:"primary",weight:"regular",children:"₽"})]},`${e}-${a}`))},N=({title:e,value:t,tooltip:a,textColor:l,unitsAsColumn:o,isTitleUnit:u})=>(0,s.jsxs)("div",{className:(0,i.Z)($.unit,{[$.unitRow]:o}),children:[(0,s.jsxs)("div",{className:$.unitTitleWrapper,children:[(0,s.jsx)(n.xv,{size:"14",className:$.unitTitle,children:e}),a&&(0,s.jsx)(r.u,{text:a,children:(0,s.jsx)(c.IconFdsQuestionCircleO,{className:$.tooltipIcon})})]}),(0,s.jsx)(n.xv,{weight:"medium",size:u?"18":o?"16":"24",className:$.unitValue,style:{color:l},children:e.includes("Рейтинг")?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.IconFdsStarF,{size:16,style:{color:"var(--color-orange-400)"}}),t]}):y(t)})]}),k=({tags:e,isGrayTheme:t})=>{let a=t?"secondary":"primary";return(0,s.jsx)("div",{className:$.tags,children:e.sort((e,t)=>e.order-t.order).map(e=>(0,s.jsx)(r.Vp,{className:$.tag,label:e.label,variant:e.variant?e.variant:a,rounded:!0},e.label))})},C=({companyName:e,name:t,url:a,logo:l,units:n,tags:o,additionalButton:c,unitsAsColumn:u,dataLayerPush:d,eventCategory:m,productType:p,theme:h,buttonClassName:_,eventValueByUnitTitle:g})=>{let v=h===b.gray,f=a=>{let l={event:"data-event",eventCategory:m,eventAction:`click_button_${(0,x.t)(a)}_${p}`,eventLabel:(0,x.t)(`${e}_${t}`)};if(g){let e=n.find(e=>e.title.toLowerCase()===g.toLowerCase());e&&(l.eventValue=(0,x.t)(e.value))}d(l)};return(0,s.jsxs)("div",{className:(0,i.Z)($.wrapper,{[$.whiteWrapper]:v}),children:[(0,s.jsxs)("div",{className:$.bankInfo,children:[l&&(0,s.jsx)("img",{src:l,width:56,height:56,alt:`${e} logo`}),(0,s.jsx)(N,{title:t,value:e,isTitleUnit:!0})]}),(0,s.jsx)("div",{className:(0,i.Z)($.units,{[$.unitsColumn]:u}),children:n.map(e=>(0,s.jsx)(N,{title:e.title,value:e.value,tooltip:e.tooltip,textColor:e.textColor,unitsAsColumn:u},`${e.title}-${e.value}`))}),(0,s.jsxs)("div",{className:$.bottomBlock,children:[o&&(0,s.jsx)(k,{tags:o,isGrayTheme:v}),c&&(0,s.jsx)(r.zx,{as:"a",className:(0,i.Z)($.button,$.buttonRounded),size:"xs",label:c.text,href:c.url,variant:"white",onClick:()=>f(c.text)}),(0,s.jsx)(r.zx,{as:"a",className:(0,i.Z)($.button,_),size:"xs",label:"Подробнее",href:a,onClick:()=>f("podrobnee_o_kartochke_iz")})]})]})},R=(0,u.g)("offers-list","sc"),z=Object.freeze({offersList:R,wrapper:`${R}__wrapper`,sliderWrapper:`${R}__sliderWrapper`,offerItem:`${R}__offerItem`,compact:`${R}__offerItem--compact`,bannerItem:`${R}__bannerItem`}),P=({offers:e,banner:t,dataLayerPush:a,eventCategory:l,productType:n,theme:o,singleProduct:c})=>{let u=e.length<=2;return(0,s.jsxs)(r.iR,{options:{slidesPerView:"auto",spaceBetween:0,autoplay:{delay:3e3,disableOnInteraction:!1}},breakpoints:{xl:{autoplay:!1}},className:z.sliderWrapper,pagination:!0,children:[e.slice(0,3).map(e=>(0,s.jsx)(r.wI,{className:(0,i.Z)(z.offerItem,{[z.compact]:c}),children:(0,s.jsx)(C,{...e,dataLayerPush:a,eventCategory:l,productType:n,theme:o})},e.id)),t&&(0,s.jsx)(r.wI,{className:z.bannerItem,children:(0,s.jsx)(j,{...t,handleBannerDataLayerPush:()=>{a({event:"data-event",eventCategory:l,eventAction:"click_bnr_banner_top_predlozheniy",eventLabel:n})},wide:u,theme:o})})]})},L=(0,u.g)("osago-tab","sc"),F=Object.freeze({osagoTab:L,wrapper:`${L}__wrapper`,card:`${L}__card`,whiteCard:`${L}__card--white`,image:`${L}__image`,content:`${L}__content`,inputWrapper:`${L}__inputWrapper`,select:`${L}__select`,input:`${L}__input`,buttonLinkWrapper:`${L}__buttonLinkWrapper`,button:`${L}__button`,banner:`${L}__banner`}),T={kasko:{title:"Рассчет Каско за минуту",description:"Выберите лучшие условия для оформления полиса",backgroundColor:{base:"#f1f5ff",hover:"#a3ceec"}},osago:{title:"ОСАГО с экономией до 78%",description:"Предварительная цена после ввода номера ТС",backgroundColor:{base:"#f1f5ff",hover:"#a3ceec"}}},B=[{label:"Мотоцикл",value:"moto"},{label:"Автомобиль",value:"auto"}],I=Object.fromEntries(B.map(e=>[e.value,e])),A={auto:{mask:"a 000 aa 00",placeholder:"A 000 AA 00"},moto:{mask:"0000 aa 00",placeholder:"0000 AA 00"}},O="АВЕКМНОРСТУХ",M=RegExp(`[${O}]`,"i"),W=RegExp(`[^0-9${O}]`,"gi"),Z=({type:e,baseUrl:t,s3Assets:a,banner:l,dataLayerPush:c,eventCategory:u,theme:d})=>{let m="osago"===e,p=(0,_.xn)(t,"osago"),h=(0,_.xn)(p,"step-car"),g=(0,_.xn)(t,"kasko"),v=(0,_.xn)(g,"vehicle"),f=m?h:v,[w,$]=(0,o.useState)(""),[y,N]=(0,o.useState)("auto"),{mask:k,placeholder:C}=A[y],R=d===b.gray,z=`?${new URLSearchParams({type:m?y:"auto",license:w})}`,P=(0,_.xn)(f,z),L=l??{...T[e],url:m?p:g,image:a?{url:(0,_.xn)(a,`pl-common-blocks-renderer/topOffers/${m?"icon_osago":"icons_car"}.png`),width:204,height:160}:void 0},O=I[y].label,Z=(t,a)=>{c({event:"data-event",eventCategory:u,eventAction:t,eventLabel:a??e})};return(0,s.jsxs)("div",{className:F.wrapper,children:[(0,s.jsxs)("div",{className:(0,i.Z)(F.card,{[F.whiteCard]:R}),children:[a&&(0,s.jsx)("picture",{children:(0,s.jsx)("img",{src:`${a}/pl-common-blocks-renderer/topOffers/auto_bg.png`,alt:"Автомобиль",loading:"lazy",className:F.image})}),(0,s.jsxs)("div",{className:F.content,children:[(0,s.jsxs)(n.X6,{as:"h3",type:"h3",children:["Онлайн калькулятор ",m?"ОСАГО":"Каско"]}),(0,s.jsxs)("div",{className:F.inputWrapper,children:[m&&(0,s.jsx)(r.Ph,{options:B,value:I[y],label:"Тип транспорта",variant:R?"primary":"secondary",className:F.select,onChange:e=>{$(""),N(e.value),Z(`selector_item_${(0,x.t)(e.label)}`)}}),(0,s.jsx)(r.An,{label:"Госномер",variant:R?"primary":"secondary",maskOpts:{mask:k,definitions:{a:M}},maskPlaceholder:C,value:w,className:F.input,onChange:(e,t)=>{let a=t.replace(W,"");$(a.toUpperCase())},onClick:()=>Z(`message_field_${(0,x.t)(O)}`),onBlur:()=>Z(`on_message_field_${(0,x.t)(O)}`)}),(0,s.jsxs)(n.xv,{children:["У меня"," ",(0,s.jsx)(r.rU,{href:f,onClick:()=>{Z("click_link_net_nomera",f)},children:"нет номера"})]})]}),(0,s.jsx)(r.zx,{as:"a",href:P,size:"s",className:F.button,onClick:()=>{Z(`click_button_rasschitat_${(0,x.t)(O)}`,P)},children:"Рассчитать"})]})]}),(0,s.jsx)("div",{className:F.banner,children:(0,s.jsx)(j,{...L,handleBannerDataLayerPush:()=>{Z("click_bnr_banner_top_predlozheniy")}})})]})},V=(0,u.g)("best-offers","sc"),U=Object.freeze({bestOffers:V,graySection:`${V}--gray`,singleProduct:`${V}--singleProduct`,title:`${V}__title`,singleProductTitle:`${V}__title--singleProduct`,chips:`${V}__chips`,warning:`${V}__warning`,allOffersLink:`${V}__allOffersLink`}),S={вклады:"вкладам",облигации:"облигациям",кредиты:"кредитам",займы:"займам","Кредитные карты":"кредитным картам",каско:"каско",осаго:"ОСАГО","дебетовые карты":"дебетовым картам",ипотека:"ипотеке",автокредиты:"автокредитам"},D=({tabs:e,baseUrl:t,s3Assets:a,eventCategory:l="best-offers",dataLayerPush:c,singleProduct:u=!1,theme:d=b.light})=>{let m=d===b.gray,x=e.map(e=>({url:e.productType,title:e.name})),[_,v]=(0,o.useState)(x[0].url),f=e.find(e=>e.productType===_)??e[0],j=(0,r._m)("xl"),w=S[f.name.toLowerCase()],$=w?`по ${w}`:f.name,y=g(null==f?void 0:f.productType)&&t?(0,s.jsx)(Z,{type:f.productType,banner:f.banner,baseUrl:t,s3Assets:a,dataLayerPush:c,eventCategory:l,theme:d}):null;return(0,s.jsx)("section",{className:(0,i.Z)(U.bestOffers,{[U.singleProduct]:u,[U.graySection]:m}),children:(0,s.jsxs)(n.W2,{children:[(0,s.jsxs)(n.X6,{as:"h2",type:u?"h2":"display",className:(0,i.Z)(U.title,!u&&(j?"mb-8":"mb-6"),u&&(0,i.Z)("mb-0",U.singleProductTitle)),children:["Лучшие предложения ",u?$:"сегодня"]}),!u&&(0,s.jsx)(h.N,{items:x,maxNumberOfLines:2,activeChipId:_,variant:m?"white":"gray",className:U.chips,onClick:t=>{v(t);let a=e.find(e=>e.productType===t);c({event:"data-event",eventCategory:l,eventAction:"click_chip_top_predlozheniy_vybor",eventLabel:null==a?void 0:a.productType})}}),(0,s.jsxs)("div",{children:[y??(0,s.jsx)(P,{offers:f.offers,banner:f.banner,dataLayerPush:c,eventCategory:l,productType:f.productType,theme:d,singleProduct:u}),f.hasWarning&&(0,s.jsx)(n.xv,{as:"p",size:"16",className:U.warning,children:f.warningCustomText??"Оценивайте свои финансовые возможности и риски. Изучите все условия кредита (займа)"})]}),f.checkAllUrl&&(0,s.jsx)(p,{href:f.checkAllUrl,event:{event:"data-event",eventCategory:l,eventAction:"link",eventLabel:`Показать все предложения ${f.productType}`},dataLayerPush:c,iconGrayBackground:!m,className:U.allOffersLink,linkClassName:f.checkAllLinkClassName,children:"Показать все предложения"})]})})}},9685:function(e,t,a){a.d(t,{$:function(){return V}});var l=a(5893),s=a(6010),n=a(7294),r=a(6535),i=a(4588),o=a(4941),c=a(9194);let u=(e,t)=>(t>0&&!Number.isInteger(e)&&!Number.isNaN(e)&&String(e).split(".")[1].length>t&&(e=+e.toFixed(t)),e),d=(e,t=-1)=>(e=u(e,t),new Intl.NumberFormat("ru-RU").format(e)),m=({type:e="text",unit:t,format:a,defaultValue:l="",maxLength:s=-1}={})=>{let[i,o]=(0,n.useState)(l),c=(0,n.useRef)(i),[u,m]=(0,n.useState)(!1),p=(0,n.useCallback)((t,a)=>{"function"==typeof t&&(t=t(c.current));let l=String(t);if(!(s>-1&&l.length>s)){if(["int","float"].includes(e)){if(isNaN(+t)||"int"===e&&l.includes(".")||l.includes(" "))return;l=String(""===t?"":+t)}c.current=l,o(l),null==a||a(l)}},[s,e]),h=(0,n.useMemo)(()=>({onChange:e=>{p(e)},onFocus:()=>m(!0),onBlur:()=>m(!1)}),[p]),x=(0,n.useMemo)(()=>{let l=i,s=null;switch("currency"===a&&["int","float"].includes(e)&&""!==i&&(l=d(+i)),t){case"year":s=""===l?"":(0,r._6)(+i,"год","года","лет");break;case"day":s=""===l?"":(0,r._6)(+i,"день","дня","дней");break;default:s=""!==l&&t?t:""}return s&&["int","float"].includes(e)?`${l} ${s}`:l},[a,e,t,i]);return(0,n.useMemo)(()=>({events:h,value:i,formattedValue:x,isFocused:u,handleChange:p}),[h,x,p,u,i])},p=(0,o.g)("tax-calculator-banner","sc"),h=Object.freeze({taxCalculatorBaner:p,widget:`${p}--widget`,wrapper:`${p}__wrapper`,content:`${p}__content`,image:`${p}__image`,title:`${p}__title`,subtitle:`${p}__subtitle`,button:`${p}__button`}),x=({isFullPage:e,buttonUrl:t,assets:a})=>(0,l.jsxs)("div",{className:(0,s.Z)(h.wrapper,{[h.widget]:!e}),children:[(0,l.jsxs)("picture",{className:h.image,children:[a.mobile&&(0,l.jsx)("source",{srcSet:a.mobile,media:"(max-width: 1023.02px)"}),(0,l.jsx)("img",{src:a.desktop,alt:"Калькулятор НДФЛ",loading:e?"eager":"lazy"})]}),(0,l.jsxs)("div",{className:h.content,children:[(0,l.jsx)("p",{className:h.title,children:"Оформи налоговый вычет"}),(0,l.jsx)("p",{className:h.subtitle,children:"Вы можете подать заявление на возврат НДФЛ за прошлый год с помощью наших партнеров"}),(0,l.jsx)(i.zx,{stretch:!0,className:h.button,label:"Подать заявление",size:"s",onClick:()=>{window.open(t,"_blank")}})]})]}),_=e=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},n.createElement("path",{fill:"#6c6d78",d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Zm0-18a8 8 0 1 1 0 16 8 8 0 0 1 0-16Z"}),n.createElement("path",{fill:"#6c6d78",d:"M11.62 17.915a1 1 0 0 0 .76 0 1 1 0 0 0 .33-.21c.088-.097.16-.209.21-.33a.84.84 0 0 0 .08-.38 1 1 0 0 0-.29-.71 1.152 1.152 0 0 0-.33-.21 1 1 0 0 0-1.38.92c.004.265.107.518.29.71a.999.999 0 0 0 .33.21Z"}),n.createElement("path",{fill:"#6c6d78",fillRule:"evenodd",d:"M8 9.584C8 7.47 9.935 6 12 6s4 1.47 4 3.584c0 1.632-1.222 2.45-1.981 2.89h-.002c-.74.43-1.017.745-1.017 1.203V14a1 1 0 1 1-2 0v-.323c0-1.653 1.237-2.482 2.015-2.933.722-.42.985-.723.985-1.16C14 8.844 13.25 8 12 8s-2 .844-2 1.584a1 1 0 0 1-2 0Z",clipRule:"evenodd"})),b=(0,o.g)("tax-calculator","sc"),g=Object.freeze({taxCalculator:b,widget:`${b}--widget`,fullPage:`${b}--full-page`,wrapper:`${b}__wrapper`,row:`${b}__row`}),v={Январь:{num:1,genitive:"января",prepositional:"январе"},Февраль:{num:2,genitive:"февраля",prepositional:"феврале"},Март:{num:3,genitive:"марта",prepositional:"марте"},Апрель:{num:4,genitive:"апреля",prepositional:"апреле"},Май:{num:5,genitive:"мая",prepositional:"мае"},Июнь:{num:6,genitive:"июня",prepositional:"июне"},Июль:{num:7,genitive:"июля",prepositional:"июле"},Август:{num:8,genitive:"августа",prepositional:"августе"},Сентябрь:{num:9,genitive:"сентября",prepositional:"сентябре"},Октябрь:{num:10,genitive:"октября",prepositional:"октябре"},Ноябрь:{num:11,genitive:"ноября",prepositional:"ноябре"},Декабрь:{num:12,genitive:"декабря",prepositional:"декабре"}},f=[{limit:24e5,rate:.13},{limit:5e6,rate:.15},{limit:2e7,rate:.18},{limit:5e7,rate:.2},{limit:1/0,rate:.22}];f[0].limit,f[0].rate;let j=f[0].rate,w=(0,o.g)("tax-calculator-form-bonus","sc"),$=Object.freeze({taxCalculatorFormBonus:w,removeButton:`${w}__remove-button`}),y=({bonus:e,index:t,selectedMonths:a,onRemove:s,onUpdate:n})=>{let r=m({defaultValue:()=>e.value,type:"int",maxLength:20,unit:"₽",format:"currency"});return(0,l.jsxs)("div",{className:$.taxCalculatorFormBonus,children:[(0,l.jsx)(i.MA,{size:"m",label:"Сумма до налогов",value:r.isFocused?r.value:r.formattedValue,variant:"secondary",...r.events,onChange:a=>{r.events.onChange(a),n(t,{...e,value:a})}}),(0,l.jsx)(i.Ph,{options:Object.keys(v).filter(t=>!a.includes(t)||t===e.month),variant:"secondary",label:"Месяц",value:e.month,onChange:a=>n(t,{...e,month:a})}),(0,l.jsx)(i.zx,{onClick:()=>s(t),label:"Удалить",appearance:"ghost",variant:"purple",size:"xs",className:$.removeButton})]})},N=(0,o.g)("tax-calculator-form","sc"),k=Object.freeze({taxCalculatorForm:N,fullPage:`${N}--full-page`,wrapper:`${N}__wrapper`,title:`${N}__title`,subtitle:`${N}__subtitle`,fields:`${N}__fields`,bonusToggle:`${N}__bonus-toggle`,addBonusButton:`${N}__add-bonus-button`,iconPlus:`${N}__icon-plus`,tooltip:`${N}__tooltip`}),C=({salary:e,bonuses:t,setBonuses:a,isFullPage:r})=>{let[o,u]=(0,n.useState)(!1),d=t.map(e=>e.month),m=()=>{var e;let a=t.map(e=>v[e.month].num).sort((e,t)=>e-t),l=Object.keys(v).map(e=>({monthName:e,monthIndex:v[e].num})).sort((e,t)=>e.monthIndex-t.monthIndex),s=a[a.length-1],n=l.find(({monthIndex:e})=>e>s&&!a.includes(e));return n?n.monthName:(null==(e=l.find(({monthIndex:e})=>!a.includes(e)))?void 0:e.monthName)??null},p=e=>{a(t=>{let a=t.filter((t,a)=>a!==e);return a.length||u(!1),a})},h=(e,t)=>{a(a=>a.map((a,l)=>l===e?t:a))};return(0,l.jsx)("div",{className:(0,s.Z)(k.taxCalculatorForm,r&&k.fullPage),children:(0,l.jsxs)("div",{className:k.wrapper,children:[(0,l.jsx)(r?"h1":"p",{className:k.title,children:"Калькулятор НДФЛ"}),(0,l.jsx)("p",{className:k.subtitle,children:"Сервис поможет рассчитать новый размер НДФЛ по прогрессивной шкале"}),(0,l.jsxs)("div",{className:k.fields,children:[(0,l.jsx)(i.MA,{size:"m",label:"Оклад до налогов",value:e.isFocused?e.value:e.formattedValue,icon:(0,l.jsx)(i.u,{text:"Указывается сумма заработной платы до удержания налогов",position:"top",children:(0,l.jsx)(_,{className:k.tooltip})}),...e.events}),(0,l.jsx)(i.ZD,{label:"Получаю премию",value:o,onChange:()=>{if(u(e=>!e),o)a([]);else{let e=m();e&&a([{value:"100000",month:e}])}},className:k.bonusToggle,flipped:!0}),o&&(0,l.jsxs)("div",{children:[t.map((e,t)=>(0,l.jsx)(y,{bonus:e,index:t,selectedMonths:d,onRemove:p,onUpdate:h},e.month)),(0,l.jsx)(i.zx,{onClick:()=>{let e=m();e&&a(t=>[...t,{value:"100000",month:e}])},disabled:null===m(),className:k.addBonusButton,label:"Добавить еще премию",iconLeft:(0,l.jsx)(c.IconFdsPlusO,{}),appearance:"ghost",variant:"purple",size:"xs"})]})]})]})})},R=e=>{let t=Object.entries(v).find(([t,a])=>a.num===e);return t?t[0]:""},z=(e,t)=>{let a=0,l=0,s=t,n=`${100*t}%`;for(let r of f){if(e<=a)break;let i=Math.min(e-a,r.limit-a);l+=i*r.rate,a=r.limit,(s=r.rate)>t&&(n=`${100*t}%—${100*s}%`)}return{tax:l,currentRate:s,rateString:n}},P=e=>{let t=[],a=null,l=null;for(let s of e){let e=s.bonusAmount>0;a&&a.taxRate===s.taxRate&&l===e?a.endMonth=s.endMonth:(a&&t.push(a),a={...s},l=e)}return a&&t.push(a),t},L=e=>{let t=[],a=[],l=null;for(let s of e)l===s.taxRate?a.push(s):(a.length>0&&t.push(...P(a)),a=[s],l=s.taxRate);return a.length>0&&t.push(...P(a)),t},F=(e,t)=>{let a=0,l=0,s=f[0].rate,n={};t.forEach(({month:e,value:t})=>{n[v[e].num]=Math.round(Number(t))});let r=[];for(let t=v.Январь.num;t<=v.Декабрь.num;t++){let i=n[t]||0,o=e+i;a+=o;let{tax:c,currentRate:u,rateString:d}=z(a,s),m=Math.round(c-l);l=c;let p=Math.round(e/o*m),h=m-p;i>0&&(h=m-(p=Math.min(p,Math.round(e*s))));let x=e-p,_=i-h;r.push({startMonth:R(t),endMonth:R(t),income:x,taxRate:d,tax:m,bonusAmount:_}),s=u}let i=L(r),o=Math.round(a*j),c=Math.round(l-o);return{taxFixed:o,taxProgressive:Math.round(l),taxDiff:c,monthlyTaxGroups:i}},T=e=>new Intl.NumberFormat("ru-RU").format(e),B=({size:e=24})=>(0,l.jsx)("span",{style:{fontFamily:"var(--font-family-primary)",fontSize:`${e}px`},children:"₽"}),I=(0,o.g)("tax-calculator-result-head","sc"),A=Object.freeze({taxCalculatorResultHead:I,title:`${I}__title`,titleTaxAmount:`${I}__title--tax-amount`,subtitle:`${I}__subtitle`}),O=({data:e})=>{let{taxFixed:t,taxProgressive:a,taxDiff:s}=e,n=new Date().getFullYear(),r="Сумма НДФЛ не изменится",i=T(t),o=(0,l.jsxs)(l.Fragment,{children:["Ставка НДФЛ в ",n," году останется прежней — 13%"]});return 0!==s&&(r="Доход станет меньше",i=`на ${T(s)}`,o=(0,l.jsxs)(l.Fragment,{children:["В ",n," году на уплату НДФЛ уйдет ",T(a)," ",(0,l.jsx)(B,{size:18}),", а в 2024 году — ",T(t)," ",(0,l.jsx)(B,{size:18})," при той же зарплате."]})),(0,l.jsxs)("div",{className:A.taxCalculatorResultHead,children:[(0,l.jsxs)("p",{className:A.title,children:[r,(0,l.jsx)("br",{}),(0,l.jsx)("span",{className:A.titleTaxAmount,children:i})," ",(0,l.jsx)(B,{size:24}),0!==s&&"/год"]}),(0,l.jsx)("p",{className:A.subtitle,children:o})]})},M=(0,o.g)("tax-calculator-result","sc"),W=Object.freeze({taxCalculatorResult:M,taxCalculatorResultFullPage:`${M}--full-page`,title:`${M}__title`,titleTaxAmount:`${M}__title--tax-amount`,subtitle:`${M}__subtitle`,tableWrapper:`${M}__table-wrapper`,tableTitle:`${M}__table-title`,tableBody:`${M}__table-body`,tableBlock:`${M}__table-block`,tableRow:`${M}__table-row`,tableRowDottedLine:`${M}__table-row--dotted-line`,tableRowRowValue:`${M}__table-row--row-value`,tableRowFinalValue:`${M}__table-row--final-value`,tableRowRed:`${M}__table-row--red`,ndflRow:`${M}__ndfl-row`,tooltipIcon:`${M}__tooltip-icon`}),Z=({taxData:e,isFullPage:t})=>{let{taxDiff:a,monthlyTaxGroups:n,taxProgressive:r}=e;return(0,l.jsxs)("div",{className:(0,s.W)(W.taxCalculatorResult,{[W.taxCalculatorResultFullPage]:t}),children:[(0,l.jsx)(O,{data:e}),(0,l.jsx)("div",{children:0!==a&&(0,l.jsxs)("div",{className:W.tableWrapper,children:[(0,l.jsxs)("p",{className:W.tableTitle,children:["Получите доход в ",new Date().getFullYear()," году "]}),(0,l.jsxs)("div",{className:W.tableBody,children:[n.map(e=>{let t=v[e.startMonth],a=e.endMonth.toLowerCase(),n=e.startMonth===e.endMonth?`В ${t.prepositional}`:`С ${t.genitive} по ${a}`;return(0,l.jsxs)("div",{className:W.tableBlock,children:[(0,l.jsxs)("div",{className:W.tableRow,children:[(0,l.jsx)("p",{children:n}),(0,l.jsx)("div",{className:W.tableRowDottedLine}),(0,l.jsxs)("p",{className:(0,s.W)(W.tableRowRowValue,{[W.tableRowRed]:"13%"!==e.taxRate}),children:[T(e.income)," ",(0,l.jsx)(B,{size:18})]})]}),e.bonusAmount>0&&(0,l.jsxs)("div",{className:W.tableRow,children:[(0,l.jsx)("p",{children:"Премия"}),(0,l.jsx)("div",{className:W.tableRowDottedLine}),(0,l.jsxs)("div",{className:W.tableRowRowValue,children:[T(e.bonusAmount)," ",(0,l.jsx)(B,{size:18})]})]}),(0,l.jsxs)("div",{className:W.tableRow,children:[(0,l.jsxs)("div",{className:W.ndflRow,children:["НДФЛ ",e.taxRate,e.taxRate.includes("—")&&(0,l.jsx)(i.u,{text:"Повышенная ставка применяется не ко всему доходу, а только к превышению над пороговым значением",position:"top",children:(0,l.jsx)("span",{className:W.tooltipIcon,children:(0,l.jsx)(_,{})})})]}),(0,l.jsx)("div",{className:W.tableRowDottedLine}),(0,l.jsxs)("p",{className:W.tableRowRowValue,children:[T(e.tax)," ",(0,l.jsx)(B,{size:18})]})]})]},a)}),(0,l.jsxs)("div",{className:W.tableRow,children:[(0,l.jsx)("p",{className:W.tableRowRowValue,children:"Итого НДФЛ"}),(0,l.jsx)("div",{className:W.tableRowDottedLine}),(0,l.jsxs)("p",{className:(0,s.W)(W.tableRowRowValue,W.tableRowFinalValue),children:[T(r)," ",(0,l.jsx)(B,{size:18})]})]})]})]})})]})},V=({className:e,isFullPage:t,bannerButtonUrl:a,assets:r})=>{let i=m({defaultValue:()=>"100000",type:"int",maxLength:20,unit:"₽",format:"currency"}),[o,c]=(0,n.useState)([]),u=F(Number(i.value),o);return(0,l.jsx)("div",{className:(0,s.Z)(g.taxCalculator,t?g.fullPage:g.widget,e),children:(0,l.jsxs)("div",{className:g.wrapper,children:[(0,l.jsxs)("div",{className:g.row,children:[(0,l.jsx)(C,{salary:i,bonuses:o,setBonuses:c,isFullPage:t}),(0,l.jsx)(Z,{taxData:u,isFullPage:t})]}),(0,l.jsx)(x,{buttonUrl:a,isFullPage:t,assets:r})]})})}}}]);