"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32863],{20602:(e,t,n)=>{n.d(t,{Z$:()=>u,qy:()=>c});var r=n(29747),a=n(14232),i=n(36307);let l=(0,i.q6)(),o={handlDuraScore:0,handlDuraScoreRange:"N/A",isDurability:!1,longevityScore:0,longevityScoreRange:"N/A",simpleScore:0,simpleScoreRange:"N/A",tractionScore:0,tractionScoreRange:"N/A"};function c(e){let{children:t}=e,n=function(){let[e,t]=(0,a.useState)(o),[n,r]=(0,a.useState)(!1),i=(0,a.useCallback)(e=>{t(e),r(!0)},[]);return{closeModal:(0,a.useCallback)(()=>{r(!1)},[]),currentModalData:e,isModalOpen:n,openModal:i,resetModal:(0,a.useCallback)(()=>{t(o)},[])}}();return(0,r.Y)(l.Provider,{value:n,"data-element":"unknown","data-component":"SimpleScoreCardModalContextProvider",children:t})}let u=(e,t)=>(0,i.i7)(l,e,t)},32863:(e,t,n)=>{n.r(t),n.d(t,{default:()=>N});var r=n(29747),a=n(10983),i=n(20735),l=n(14232),o=n(57532),c=n(44364);let u=["24px","13px","24px","29px","47px","57px","63px","63px","63px","74px","78px","63px","70px","63px","70px","70px","63px","51px","24px","34px","29px","34px","15px","10px"];var s=n(63381);let d={container:{alignItems:"baseline",display:"flex",justifyContent:"space-between",marginBottom:s.E.SIZE_20,width:"100%"},bar:{backgroundColor:c.l.LIGHT.GRAY_70,borderRadius:"50px",height:"24px",width:"10px"}},p=function(e){let{maxPercentage:t,minPercentage:n}=e,a=e=>{if(u.length<2)return c.l.GLOBAL.ORANGE;let r=100*e/(u.length-1),a=25/u.length;return r<=t+a&&r>=n-a?c.l.GLOBAL.ORANGE:c.l.LIGHT.GRAY_70};return(0,r.Y)("div",{"aria-hidden":"true",css:d.container,"data-component":"Graph",children:u.map((e,t)=>(0,r.Y)("div",{css:[d.bar,{height:e,backgroundColor:a(t)}]},"".concat(e,"_").concat(t)))})};var m=function(e){return e.REGULAR="regular",e.SMALL="small",e}({}),f=n(18079),h=n(32586),g=n(36384);let v={[m.REGULAR]:20,[m.SMALL]:8},S={container:{marginLeft:s.E.SIZE_05,marginRight:s.E.SIZE_10,padding:"".concat(s.E.SIZE_10,"px 0"),position:"relative",width:"100%"},disable:{pointerEvents:"none"},fillColor:{backgroundColor:c.l.GLOBAL.ORANGE,height:2,width:100},indicator:{":active":{cursor:"grabbing"},"> span":{alignItems:"center",color:c.l.GLOBAL.WHITE,display:"flex",height:"100%",justifyContent:"center",left:0,pointerEvents:"none",position:"absolute",width:"100%"},borderRadius:h.Z.CIRCLE,cursor:"grab",position:"absolute"},labels:[g.Il.secondaryHeadline,{display:"flex",justifyContent:"space-between",paddingTop:s.E.SIZE_15,width:"100%"}],labelSm:[g.Il.bodyCopyTight,{minWidth:35}],maxIndicator:{right:0},minIndicator:{left:0},rail:{backgroundColor:c.l.LIGHT.GRAY_20,borderRadius:h.Z.RADIUS_25,height:2,position:"relative",width:"100%"},rootSmall:{display:"flex",width:"100%"},simpleScoreRangeWrapper:{display:"flex",justifyContent:"space-between",marginTop:s.E.SIZE_10,"& > p":[g.Il.smallCopyTight,{color:c.l.LIGHT.GRAY_70,fontWeight:450}]},[m.REGULAR]:{background:c.l.GLOBAL.ORANGE,height:v[m.REGULAR],top:-s.E.SIZE_10,width:v[m.REGULAR]},[m.SMALL]:{background:c.l.GLOBAL.WHITE,border:f.s.SOLID_ORANGE_2PX,height:v[m.SMALL],top:-3,width:v[m.SMALL]},wrapper:{position:"absolute",width:"100%"}},E=(e,t)=>({marginLeft:"calc(".concat(e,"%)"),width:"calc(".concat(t-e,"%)")}),L=e=>({paddingLeft:"".concat(v[e],"px"),paddingRight:"".concat(v[e],"px")});var R=n(69637),b=n(22607);function x(e,t){let{interval:n,railMax:r,railMin:a,railEl:i,railWidth:l,sliderEl:o}=e;function c(t){if(!o.current||!i.current)return;let c=(t instanceof MouseEvent?t.pageX:t.touches[0].pageX)-i.current.getBoundingClientRect().left;C(e,Math.round((a.current+(r.current-a.current)*c/l.current-a.current)/n)*n+a.current),t.preventDefault(),t.stopPropagation()}function u(){e.onMouseUp&&e.onMouseUp(),document.removeEventListener("mousemove",c),document.removeEventListener("touchmove",c),document.removeEventListener("mouseup",u),document.removeEventListener("touchend",u)}o.current&&i.current&&(document.addEventListener("mousemove",c),document.addEventListener("touchmove",c),document.addEventListener("mouseup",u),document.addEventListener("touchend",u),t.preventDefault(),t.stopPropagation())}let A=(e,t)=>parseFloat(e.getAttribute(t)||"0");function C(e,t){let{interval:n,maxEl:r,minEl:a,railEl:i,sliderEl:l,valueNow:o,railMax:c,railMin:u}=e;if(!l.current||!i.current)return;let s=l.current,d=A(s,"aria-valuemax"),p=A(s,"aria-valuemin");t>=d&&(t=d,r.current&&(t=Math.max(d-n,u.current))),t<=p&&(t=p,a.current&&(t=Math.min(p+n,c.current)));let m=Math.round(100*t)/100;o.current=m;let f=m.toString();s.setAttribute("aria-valuenow",f),a.current&&a.current.setAttribute("aria-valuemax",f),r.current&&r.current.setAttribute("aria-valuemin",f),I(e),e.onChange(m)}function I(e){let{minEl:t,railEl:n,railMax:r,railMin:a,railWidth:i,sliderEl:l,valueNow:o}=e;if(!l.current||!n.current)return;let c=Math.round((o.current-a.current)*(i.current-2*l.current.clientWidth)/(r.current-a.current));t.current?l.current.style.left="".concat(c+l.current.clientWidth,"px"):l.current.style.left="".concat(c,"px")}function _(e,t){let n=e.valueNow.current,r=!1;switch(t.keyCode){case b._.ARROW_LEFT:case b._.ARROW_DOWN:C(e,n-e.interval),r=!0;break;case b._.ARROW_RIGHT:case b._.ARROW_UP:C(e,n+e.interval),r=!0;break;case b._.PAGE_DOWN:if(e.interval>1){C(e,n-e.interval);return}C(e,n-10),r=!0;break;case b._.PAGE_UP:if(e.interval>1){C(e,n+e.interval);return}C(e,n+10),r=!0;break;case b._.HOME:C(e,e.railMin.current),r=!0;break;case b._.END:C(e,e.railMax.current),r=!0}r&&(t.preventDefault(),t.stopPropagation())}let M=function(e){let{defaultValue:t=0,max:n=5,min:r=0,shouldReset:a,sliderEl:i,value:o,refreshValues:c,...u}=e,s=(0,l.useRef)(null),d=(0,l.useRef)(null),p=(0,l.useRef)(r),m=(0,l.useRef)(n),f=(0,l.useRef)(0),h=(0,l.useRef)(o||t),{width:g}=(0,R.A)(),v={...u,maxEl:d,minEl:s,railMax:m,railMin:p,railWidth:f,sliderEl:i,valueNow:h};return(0,l.useEffect)(()=>{a&&(h.current=t,I(v))},[a]),(0,l.useEffect)(()=>{u.railEl.current&&(f.current=u.railEl.current.clientWidth),I(v)},[v,u.railEl,g]),(0,l.useEffect)(()=>{!function(e){let{maxEl:t,minEl:n,railEl:r,railMax:a,railMin:i,railWidth:l,sliderEl:o,valueNow:c}=e;if(!o.current||!r.current)return;let{current:u}=o;u.addEventListener("keydown",_.bind(null,e)),u.addEventListener("touchstart",x.bind(null,e)),u.addEventListener("mousedown",x.bind(null,e)),u.previousElementSibling&&(n.current=u.previousElementSibling,i.current=A(n.current,"aria-valuemin")),u.nextElementSibling&&(t.current=u.nextElementSibling,a.current=A(t.current,"aria-valuemax")),l.current=r.current.clientWidth,C(e,c.current)}(v)},[i]),(0,l.useEffect)(()=>{void 0!==o&&c&&h.current!==o&&(h.current=o,I(v))},[c]),{maxCurrent:m.current,minCurrent:p.current,value:h.current}};function G(e){let{label:t,onAriaTextChange:n,size:o,...c}=e,u=(0,l.useRef)(null),{maxCurrent:s,minCurrent:d,value:p}=M({...c,sliderEl:u});return(0,r.Y)("div",{ref:u,role:"slider",tabIndex:0,css:[S.indicator,S[o]],"aria-valuemin":d,"aria-valuenow":p,"aria-valuemax":s,"aria-label":t,"aria-valuetext":n(p),"data-component":"Slider",children:o!==m.SMALL&&(0,r.Y)(a.default,{name:i.Ze.GRIP})})}let y=(0,l.memo)(function(e){let{formatLabel:t,minCurrent:n,maxCurrent:a,getAriaText:i,hasGraph:c,interval:u=1,isDisabled:s,onMinChange:d,refreshValues:f,onMaxChange:h,max:g,min:v,name:R,shouldReset:b,onUpdate:x,size:A=m.REGULAR,isScoreFilter:C}=e,I=A===m.SMALL,_=(0,l.useRef)(null),M=100*(a-v)/(g-v),y=100*(n-v)/(g-v),w=t&&t(a)||a,k=t&&t(n)||n;function Y(e){return i&&i(e)||e.toString()}function D(){x&&x()}return(0,r.FD)("div",{css:[I&&S.rootSmall,s&&S.disable],"data-component":"Range",children:[I&&(0,r.Y)("p",{css:S.labelSm,children:k}),(0,r.FD)("div",{css:S.container,children:[c&&(0,r.Y)(p,{maxPercentage:M,minPercentage:y}),(0,r.Y)("div",{css:[S.wrapper,L(A)],children:(0,r.Y)("div",{css:[S.fillColor,E(y,M)]})}),(0,r.FD)("div",{ref:_,css:S.rail,children:[(0,r.Y)(G,{refreshValues:f,onAriaTextChange:Y,railEl:_,min:v,interval:u,max:g,onChange:d,onMouseUp:D,shouldReset:b,defaultValue:v,label:"".concat(R," ").concat((0,o.ui)("catalog.filters.min")),css:S.minIndicator,size:A,value:n,"data-element":"Slider"}),(0,r.Y)(G,{refreshValues:f,onAriaTextChange:Y,railEl:_,min:v,max:g,shouldReset:b,interval:u,onMouseUp:D,onChange:h,defaultValue:g,label:"".concat(R," ").concat((0,o.ui)("catalog.filters.max")),css:S.maxIndicator,size:A,value:a,"data-element":"Slider"})]})]}),I&&(0,r.Y)("p",{css:S.labelSm,children:w}),!I&&(0,r.FD)("div",{css:S.labels,children:[(0,r.Y)("p",{children:k}),(0,r.Y)("p",{children:w})]}),C&&(0,r.FD)("div",{css:S.simpleScoreRangeWrapper,children:[(0,r.Y)("p",{children:(0,o.ui)("catalog.filters.simpleScoreRange1")}),(0,r.Y)("p",{children:(0,o.ui)("catalog.filters.simpleScoreRange2")}),(0,r.Y)("p",{children:(0,o.ui)("catalog.filters.simpleScoreRange3")})]})]})});var w=n(20602),k=n(84473);let Y={USD:"UnitUSD",MILES:"UnitMiles"},D={[Y.USD]:e=>"$".concat(e),[Y.MILES]:e=>"".concat(e," ").concat((0,o.ui)("catalog.filters.milesAbbr"))},F={[Y.USD]:e=>"$".concat(e),[Y.MILES]:e=>"".concat((0,k._p)(e)," ").concat((0,o.ui)("catalog.filters.milesAbbr"))};var O=n(71116),U=n(63276);let T={header:{display:"flex",justifyContent:"space-between",marginBottom:s.E.SIZE_40,[U.MQ.L]:{color:c.l.LIGHT.GRAY_70,marginBottom:s.E.SIZE_15}},infoIcon:{cursor:"pointer",marginLeft:s.E.SIZE_05},root:{[U.MQ.L]:{minWidth:400}},simpleScoreTitle:{"> span":{display:"flex",alignItems:"center"},color:c.l.GLOBAL.BLACK},title:[g.Il.eyebrow,{display:"flex",alignItems:"center"}]};function N(e){let{filtersToApply:t,header:n,id:c,isLarge:u,isOpen:s,maxValue:d,minValue:p,onChange:m,openStaticModal:f,step:h,isPreviewLoading:g,unit:v}=e,{handleMaxChange:S,handleMinChange:E,handleUpdateFilters:L,maxCurrent:R,minCurrent:b,refreshValues:x,shouldReset:A}=function(e){let{filterGroup:t,isLoading:n,onChange:r,id:a,minValue:i,maxValue:o}=e,c=null==t?void 0:t.split(","),u=c&&parseFloat(c[0])||i,s=c&&parseFloat(c[1])||o,d=(0,l.useRef)((0,k.tN)(u,s)),[p,m]=(0,l.useState)(!t),[f,h]=(0,l.useState)(u),[g,v]=(0,l.useState)(s),[S,E]=(0,l.useState)(!1),L=(0,l.useRef)(n),R=(0,l.useRef)(t),b=(0,l.useCallback)(()=>{r({value:{[a]:d.current},overwrite:!0,isRangeFilter:!0})()},[a,r]),x=(0,l.useCallback)(e=>{v(e)},[]),A=(0,l.useCallback)(e=>{h(e)},[]);return(0,l.useEffect)(()=>{d.current=(0,k.tN)(f,g)},[f,g]),(0,l.useEffect)(()=>{L.current&&!n&&(f!==u&&(h(u),E(!0)),g!==s&&(v(s),E(!0))),S&&E(!1),L.current=n},[n,s,S,g,f,u]),(0,l.useEffect)(()=>{R.current&&!t&&(h(i),v(o),m(!0)),!R.current&&t&&m(!1),R.current=t},[t,i,o]),{handleMaxChange:x,handleMinChange:A,handleUpdateFilters:b,maxCurrent:g,minCurrent:f,refreshValues:S,shouldReset:p}}({filterGroup:t[c],id:c,isLoading:g,maxValue:d,minValue:p,onChange:m}),C="price"===c,I="simpleScore"===c,_=(0,w.Z$)(e=>e.openModal);return(0,r.FD)("div",{css:T.root,"data-component":"FilterRange",children:[(0,r.Y)(O.A,{alwaysShow:C||I,customHeaderStyles:T.header,header:n,title:(0,r.Y)("h2",{css:[T.title,I&&T.simpleScoreTitle],onClick:I?e=>{e.preventDefault(),e.stopPropagation(),_({handlDuraScore:8.5,handlDuraScoreRange:"great",isDurability:!0,longevityScore:7.2,longevityScoreRange:"good",simpleScore:"8.0",simpleScoreRange:"great",tractionScore:"9.0",tractionScoreRange:"excellent"})}:()=>{},children:C?(0,o.ui)("catalog.filters.priceRangeLabel"):I?(0,r.FD)("span",{children:[(0,r.Y)("span",{children:(0,o.ui)("catalog.filters.simpleScoreLabel")}),(0,r.Y)(a.default,{name:i.Ze.INFO,css:T.infoIcon})]}):null==n?void 0:n.title}),isLarge:u,openStaticModal:f,"data-element":"FilterHeader"}),s?(0,r.Y)(y,{refreshValues:x,formatLabel:F[v],getAriaText:D[v],name:(0,o.ui)("catalog.filters.slider",{name:c}),hasGraph:(C||I)&&s,interval:h,onUpdate:L,max:d,shouldReset:A,min:p,minCurrent:b,maxCurrent:R,onMaxChange:S,onMinChange:E,isScoreFilter:I}):null]})}},71116:(e,t,n)=>{n.d(t,{A:()=>u});var r=n(29747),a=n(14232),i=n(26921),l=n(63381),o=n(17262);let c={infoLink:[n(36384).Il.smallCopyTight,o.y.light,{cursor:"pointer",width:"fit-content"}],roomForModalCloseButton:{marginRight:l.E.SIZE_30}},u=function(e){var t,n;let{alwaysShow:l,customHeaderStyles:o,header:u,isLarge:s=!1,isGroupHeader:d=!1,openStaticModal:p,title:m}=e,f=null==u?void 0:null===(t=u.infoLink)||void 0===t?void 0:t.siteStaticModal.contentId,h=(0,a.useMemo)(()=>(null==u?void 0:u.infoLink)&&f&&(0,i.u)(f),[u,f]);return u&&(d||!s||h||l)?(0,r.FD)("div",{css:o,"data-component":"FilterHeader",children:[(0,r.Y)("div",{children:m}),h&&(0,r.Y)("button",{css:[c.infoLink,!(s||d)&&c.roomForModalCloseButton],onClick:function(){f&&p(f)},children:null==u?void 0:null===(n=u.infoLink)||void 0===n?void 0:n.label})]}):null}}}]);