(window.webpackJsonp=window.webpackJsonp||[]).push([[55],{Vx7I:function(e,t,n){"use strict";n.r(t),n.d(t,"HeaderSearch",(function(){return pt}));var r,o,a,c,i,s,l,d,u,h,p,b=n("zygG"),m=n("cxan"),g=n("KD1n"),f=n("ERkP"),v=n("NqqM"),S=n("VU4M"),y=n("booI"),w=n("jiAW"),x=n("jt0n"),k=n("9xD9"),j=n("AU4o"),O=n.n(j),T=n("fYnN"),I=n("KD7D"),P=n("7asP"),C=n("135/"),R=f.createElement,B=S.b.div(r||(r=Object(g.a)(["\n background-color: ",";\n padding: "," "," ",";\n margin-top: 1px;\n\n "," {\n padding: "," ",";\n margin-top: 0;\n }\n"])),(function(e){return e.theme.colors.palette.greys.white}),Object(w.i)(3),Object(w.i)(2),Object(w.i)(2),(function(e){return Object(x.d)(e.theme.breakpointUtils.map,"md")}),Object(w.i)(3),Object(w.i)(2)),D=S.b.a(o||(o=Object(g.a)(["\n ",";\n ","\n display: flex;\n gap: ",";\n width: 100%;\n align-items: center;\n\n &:focus {\n outline: none;\n border: 2px solid ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n }\n"])),(function(e){return Object(C.a)(e.theme.patterns.header.search.linkFont.entry,e.theme.patterns.header.search.linkFont.style)}),(function(e){return"\n text-decoration: ".concat(e.theme.patterns.header.search.linkFont.textDecoration||"underline",";\n text-transform: ").concat(e.theme.patterns.header.search.linkFont.transform||"none",";\n color: ").concat(e.theme.patterns.header.search.linkFont.textColor||"inherit",";\n ")}),Object(w.i)(1),(function(e){return e.theme.colors.palette.brand.base}),(function(e){return e.theme.colors.palette.greys.lighter})),F=S.b.p(a||(a=Object(g.a)(["\n ",";\n"])),Object(C.a)("bodyText","alternate")),E=S.b.span(c||(c=Object(g.a)(["\n text-overflow: ellipsis;\n overflow: hidden;\n max-width: 80%;\n"]))),A=Object(S.b)(P.a)(i||(i=Object(g.a)(["\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n border: 2px solid ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n }\n"])),(function(e){return e.theme.colors.palette.brand.base}),(function(e){return e.theme.colors.palette.greys.lighter})),H=function(e){return R(B,null,R("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:Object(w.i)(3),alignItems:"center"}},R(F,null,e.recentlySearchedTitle),R(A,{sizing:"regular",emphasis:"low",renderedAs:"a",href:"",onClick:function(t){t.stopPropagation(),e.onClick&&e.onClick()}},e.clearRecentSearch)),R("div",{style:{display:"flex",gap:Object(w.i)(1),flexDirection:"column"}},e.recentlySearched&&e.recentlySearched.map((function(t,n){return t.itemName?R("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},key:n},R(D,{key:n,href:"/elysium.search?search=".concat(t.itemName)},R(E,null,t.itemName)),R(A,{sizing:"regular",emphasis:"low",renderedAs:"a",href:"",onClick:function(){return e.removeIndividualSearch&&e.removeIndividualSearch(t.itemName)},onKeyDown:e.recentlySearched&&n===e.recentlySearched.length-1?function(t){"Tab"!==t.key||t.shiftKey||e.movePastInput&&e.movePastInput()}:void 0},R(v.e,null))):null}))))},L=n("xWKk"),V=n("zjfJ"),N=n("KkYj"),M=f.createElement;function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var Q,U,W,J,z,G,Y,q,X,Z,$,_,ee,te,ne,re,oe,ae,ce,ie,se,le,de,ue,he,pe,be,me,ge=S.b.div(s||(s=Object(g.a)(["\n background-color: ",";\n margin-top: ",";\n padding: "," 0;\n"])),(function(e){return e.theme.colors.palette.greys.white}),Object(w.i)(1),Object(w.i)(1)),fe=S.b.li(l||(l=Object(g.a)(["\n position: relative;\n padding: ",";\n border: 2px solid transparent;\n margin: 0;\n overflow: hidden;\n &:hover,\n &:active,\n &:focus {\n background-color: ",";\n }\n\n &:focus-within {\n border-color: ",";\n }\n\n ","\n"])),Object(w.i)(2),(function(e){return e.theme.colors.palette.greys.lighter}),(function(e){return e.theme.colors.palette.brand.base}),(function(e){return e.isSelected&&"\n background-color: ".concat(e.theme.colors.palette.greys.lighter,";\n display: flex;\n justify-content: space-between;\n ")})),ve=S.b.div(d||(d=Object(g.a)(["\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n justify-content: flex-end;\n align-items: center;\n padding-right: ",";\n"])),Object(w.i)(2)),Se=S.b.p(u||(u=Object(g.a)(["\n ",";\n ","\n padding: ",";\n"])),(function(e){return Object(C.a)(e.theme.patterns.header.search.dropdownHeaderFont.entry,e.theme.patterns.header.search.dropdownHeaderFont.style)}),(function(e){return"\n text-decoration: ".concat(e.theme.patterns.header.search.dropdownHeaderFont.textDecoration,";\n text-transform: ").concat(e.theme.patterns.header.search.dropdownHeaderFont.transform,";\n color: ").concat(e.theme.patterns.header.search.dropdownHeaderFont.textColor,";\n ")}),Object(w.i)(2)),ye=Object(S.b)(v.h)(h||(h=Object(g.a)(["\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n g {\n fill: ",";\n }\n"])),(function(e){return e.theme.colors.palette.brand.base})),we=Object(S.b)(N.a)(p||(p=Object(g.a)(["\n &:focus {\n border-color: transparent;\n }\n"]))),xe=function(e){return M(ge,null,M(Se,null,e.productsTitle),M("ul",{"aria-label":e.productsTitle},e.products.map((function(t,n){var r=e.currentIndex===n,o=0!==t.reviews.averageScore||0!==t.reviews.total?function(e){for(var t=1;t=1200?e.theme.patterns.header.search.width:"".concat(e.pageWidth,"px")}),(function(e){return e.cutBottom?"200":"100"}),(function(e){return Object(w.i)(e.paddingTop)}),(function(e){return e.theme.colors.palette.greys.lighter}),Object(w.n)(L.d.Dropdown),(function(e){return Object(x.d)(e.theme.breakpointUtils.map,"lg")}),(function(e){return e.slimHeader&&!e.theme.patterns.header.mobileSearch?"0":"auto"})),Ke=S.b.div(te||(te=Object(g.a)(["\n display: flex;\n height: ",";\n\n "," {\n display: inline-block;\n height: ",";\n\n ",";\n }\n\n ","\n flex-direction: column;\n flex: 1;\n"])),(function(e){return e.theme.patterns.header.search.height.mobile}),(function(e){return Object(x.d)(e.theme.breakpointUtils.map,"lg")}),(function(e){return e.theme.patterns.header.search.height.desktop}),(function(e){var t;return(null===(t=e.theme.patterns.header.search.margin)||void 0===t?void 0:t.bottom)&&"margin-bottom: ".concat(e.theme.patterns.header.search.margin.bottom)}),(function(e){return e.mobileSearch&&"width: 100%"})),Qe=S.b.form(ne||(ne=Object(g.a)(["\n display: flex;\n justify-content: center;\n height: 100%;\n ","\n ","\n\n "," {\n max-width: 458px;\n width: ",";\n\n border-radius: ",";\n\n &:focus-within {\n ","\n }\n }\n"])),(function(e){return e.inputFocused&&"".concat(Object(w.n)(L.d.Dropdown),";\n")}),(function(e){return"border-radius: ".concat(e.theme.patterns.header.search.searchBorders.inactive.radius,";\n\n border-top: ").concat(e.theme.patterns.header.search.searchBorders.inactive.top.display&&"".concat(e.theme.patterns.header.search.searchBorders.inactive.top.width," solid ").concat(e.theme.patterns.header.search.searchBorders.inactive.top.color),";\n border-left: ").concat(e.theme.patterns.header.search.searchBorders.inactive.left.display&&"".concat(e.theme.patterns.header.search.searchBorders.inactive.left.width," solid ").concat(e.theme.patterns.header.search.searchBorders.inactive.left.color),";\n border-right: ").concat(e.theme.patterns.header.search.searchBorders.inactive.right.display&&"".concat(e.theme.patterns.header.search.searchBorders.inactive.right.width," solid ").concat(e.theme.patterns.header.search.searchBorders.inactive.right.color),";\n border-bottom: ").concat(e.theme.patterns.header.search.searchBorders.inactive.bottom.display&&"".concat(e.theme.patterns.header.search.searchBorders.inactive.bottom.width," solid ").concat(e.theme.patterns.header.search.searchBorders.inactive.bottom.color),";\n")}),(function(e){return Object(x.d)(e.theme.breakpointUtils.map,"lg")}),(function(e){return e.mobileSearch?"100%":e.theme.patterns.header.search.width}),(function(e){return e.theme.patterns.header.search.searchBorders.inactive.radius}),(function(e){return"border-radius: ".concat(e.theme.patterns.header.search.searchBorders.active.radius,";\n \n border-top: ").concat(e.theme.patterns.header.search.searchBorders.active.top.display&&"".concat(e.theme.patterns.header.search.searchBorders.active.top.width," solid ").concat(e.theme.patterns.header.search.searchBorders.active.top.color),";\n border-left: ").concat(e.theme.patterns.header.search.searchBorders.active.left.display&&"".concat(e.theme.patterns.header.search.searchBorders.active.left.width," solid ").concat(e.theme.patterns.header.search.searchBorders.active.left.color),";\n border-right: ").concat(e.theme.patterns.header.search.searchBorders.active.right.display&&"".concat(e.theme.patterns.header.search.searchBorders.active.right.width," solid ").concat(e.theme.patterns.header.search.searchBorders.active.right.color),";\n border-bottom: ").concat(e.theme.patterns.header.search.searchBorders.active.bottom.display&&"".concat(e.theme.patterns.header.search.searchBorders.active.bottom.width," solid ").concat(e.theme.patterns.header.search.searchBorders.active.bottom.color),";\n \n ")})),Ue=S.b.div(re||(re=Object(g.a)(["\n ","\n display: flex;\n width: 100%;\n background-color: ",";\n\n border-radius: ",";\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n "," {\n background-color: ",";\n width: 410px;\n\n &:focus-within {\n outline: none;\n padding: 0;\n }\n }\n"])),(function(e){return e.inputFocused&&"".concat(Object(w.n)(L.d.Dropdown),";")}),(function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive}),(function(e){return e.theme.patterns.header.search.searchBorders.inactive.radius}),(function(e){return Object(x.d)(e.theme.breakpointUtils.map,"lg")}),(function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive})),We=Object(S.a)(oe||(oe=Object(g.a)(["\n ",";\n ","\n"])),(function(e){return Object(C.a)(e.theme.patterns.header.search.placeholderFont.entry,e.theme.patterns.header.search.placeholderFont.style)}),(function(e){return"\n text-transform: ".concat(e.theme.patterns.header.search.placeholderFont.transform,";\n text-decoration: ").concat(e.theme.patterns.header.search.placeholderFont.textDecoration,";\n color: ").concat(e.theme.patterns.header.search.placeholderFont.textColor,";\n")})),Je=S.b.input(ae||(ae=Object(g.a)(["\n ",";\n ","\n background-color: ",";\n display: block;\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: ",";\n padding: ",";\n\n ::placeholder {\n ","\n background-color: ",";\n }\n ::-webkit-input-placeholder {\n ","\n background-color: ",";\n }\n :-ms-input-placeholder {\n ","\n background-color: ",";\n }\n\n &:focus {\n outline: none;\n }\n"])),(function(e){return Object(C.a)(e.theme.patterns.header.search.activeFont.entry,e.theme.patterns.header.search.activeFont.style)}),(function(e){return"\n text-transform: ".concat(e.theme.patterns.header.search.activeFont.transform,";\n text-decoration: ").concat(e.theme.patterns.header.search.activeFont.textDecoration,";\n color: ").concat(e.theme.patterns.header.search.activeFont.textColor,";\n ")}),(function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive}),(function(e){return e.theme.patterns.header.search.searchBorders.inactive.radius}),(function(e){return e.theme.patterns.header.search.placeHolderPadding}),We,(function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive}),We,(function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive}),We,(function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive})),ze=S.b.label(ce||(ce=Object(g.a)(["\n width: 100%;\n"]))),Ge=S.b.button(ie||(ie=Object(g.a)(["\n ","\n display: flex;\n justify-content: center;\n align-items: center;\n min-width: ",";\n width: ",";\n height: ",";\n flex: 0;\n height: 100%;\n background-color: ",";\n\n border-radius: ",";\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: ",";\n border-bottom-right-radius: ",";\n\n ","\n\n svg {\n fill: ",";\n }\n\n &:focus {\n outline: none;\n outline-offset: -4px;\n ",";\n }\n\n &:hover,\n &:active,\n &:focus {\n background-color: ",";\n padding: 0 ",";\n }\n\n svg {\n fill: ",";\n }\n"])),(function(e){return e.inputFocused&&"".concat(Object(w.n)(L.d.Dropdown),";")}),Object(w.i)(6),Object(w.i)(6),Object(w.i)(6),(function(e){return e.active?e.theme.patterns.header.search.buttonBackgroundColor.active:e.theme.patterns.header.search.buttonBackgroundColor.inactive}),(function(e){return e.theme.patterns.header.search.searchBorders.inactive.radius}),(function(e){return e.theme.patterns.header.search.buttonBorder.inactive.radius}),(function(e){return e.theme.patterns.header.search.buttonBorder.inactive.radius}),(function(e){return"\n border-top: ".concat(e.theme.patterns.header.search.buttonBorder.inactive.top.display&&"".concat(e.theme.patterns.header.search.buttonBorder.inactive.top.width," solid ").concat(e.theme.patterns.header.search.buttonBorder.inactive.top.color),";\n border-left: ").concat(e.theme.patterns.header.search.buttonBorder.inactive.left.display&&"".concat(e.theme.patterns.header.search.buttonBorder.inactive.left.width," solid ").concat(e.theme.patterns.header.search.buttonBorder.inactive.left.color),";\n border-right: ").concat(e.theme.patterns.header.search.buttonBorder.inactive.right.display&&"".concat(e.theme.patterns.header.search.buttonBorder.inactive.right.width," solid ").concat(e.theme.patterns.header.search.buttonBorder.inactive.right.color),";\n border-bottom: ").concat(e.theme.patterns.header.search.buttonBorder.inactive.bottom.display&&"".concat(e.theme.patterns.header.search.buttonBorder.inactive.bottom.width," solid ").concat(e.theme.patterns.header.search.buttonBorder.inactive.bottom.color),";\n")}),(function(e){return e.theme.patterns.header.search.mobileIcon.color}),(function(e){return e.active?"outline: 2px solid ".concat(e.theme.colors.palette.greys.white):"border: 2px solid ".concat(e.theme.patterns.header.search.focusBorderColor||e.theme.colors.palette.brand.base)}),(function(e){return e.active?e.theme.patterns.header.search.buttonBackgroundColor.active:e.theme.patterns.header.search.buttonBackgroundColor.inactive}),Object(w.i)(1),(function(e){return e.active?e.theme.patterns.header.search.iconColor.active:e.theme.patterns.header.search.iconColor.inactive})),Ye=Object(S.b)((function(e){var t,n,r,o=document.documentElement.clientWidth,a=f.useRef(null),c=f.useRef(null);f.useEffect((function(){if(c.current&&a.current){var e=a.current.offsetHeight/2,t=c.current.offsetTop,n=e>t?0:t-e;a.current.scrollTo(0,n)}}),[e.correctionsIndex,e.suggestionsIndex,e.productsIndex]);var i=(null===(t=e.searchResults.corrections)||void 0===t?void 0:t.length)>0;return Ne("div",{style:{position:"relative",display:"flex",justifyContent:"center"},"data-testid":"header-search-results-dropdown"},Ne(Me,Object(m.a)({pageWidth:o,cutBottom:y.a,ref:a,"aria-label":e.searchI18nText.searchResultsAria,onKeyDown:function(t){return"Escape"===t.key&&e.clearInput()},paddingTop:e.isDesktop?0:2},e),i&&Ne(Re,Object(m.a)({currentIndex:e.correctionsIndex,corrections:e.searchResults.corrections,correctionsTitle:e.searchI18nText.correctionsTitle,autocompleteLink:e.autocompleteLink,selectedRef:c},e.onClickSearchSuggestions&&{onClickSearchSuggestions:e.onClickSearchSuggestions})),(null===(n=e.searchResults.suggestedSearchQueries)||void 0===n?void 0:n.length)>0&&Ne(Ve,Object(m.a)({currentIndex:e.suggestionsIndex,showTitle:i,suggestions:e.searchResults.suggestedSearchQueries,suggestionsTitle:e.searchI18nText.suggestionsTitle,autocompleteLink:e.autocompleteLink,selectedRef:c},e.onClickSearchSuggestions&&{onClickSearchSuggestions:e.onClickSearchSuggestions})),(null===(r=e.searchResults.products)||void 0===r?void 0:r.length)>0&&Ne(xe,{currentIndex:e.productsIndex,products:e.searchResults.products,productsTitle:e.searchI18nText.productsTitle,selectedRef:c,fromText:e.fromText,rrpText:e.rrpText,freeText:e.freeText,movePastInput:e.movePastInput,inputValue:e.inputValue,showPowerReview:e.showPowerReview})))}))(se||(se=Object(g.a)(["\n ",";\n display: ",";\n ",";\n"])),(function(e){return e.mobileSearch&&"top:15px; max-height: 500px; overflow-y: auto;"}),(function(e){return e.shouldDisplay?"initial":"none"}),(function(e){return e.mobileSearch?" width: 470px":null})),qe=S.b.button(le||(le=Object(g.a)(["\n ",";\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: ",";\n border: 2px solid transparent;\n color: ",";\n\n &:hover,\n &:active,\n &:focus {\n opacity: 0.8;\n cursor: pointer;\n outline: none;\n }\n\n &:focus {\n border-color: ",";\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n"])),(function(e){return Object(C.a)(e.theme.formgroup.icon.scale,e.theme.formgroup.icon.style)}),Object(w.i)(1),(function(e){return e.theme.colors.palette.greys.darker}),(function(e){return e.theme.colors.palette.brand.base}),(function(e){return e.theme.patterns.header.search.clearTextIcon})),Xe=Object(S.b)(I.b)(de||(de=Object(g.a)(["\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n display: block;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n ",";\n"])),Object(w.n)(L.d.Overlay)),Ze=(Object(S.b)(Me)(ue||(ue=Object(g.a)(["\n display: flex;\n align-items: center;\n flex-direction: column;\n width: 100%;\n min-width: 393px;\n padding: 0 ",";\n"])),Object(w.i)(2)),S.b.div(he||(he=Object(g.a)(["\n position: relative;\n display: flex;\n justify-content: center;\n z-index: ",";\n border-top: 1px solid ",";\n "," {\n border-top: 0;\n }\n"])),w.d.Highest,(function(e){return e.theme.colors.palette.greys.light}),(function(e){return Object(x.d)(e.theme.breakpointUtils.map,"md")}))),$e=function(e){return e.up="UP",e.down="DOWN",e}($e||{}),_e=function(e,t,n,r,o,a,c,i,s){var l,d,u,h,p,b,m,g,f;(null===t||void 0===t?void 0:null===(l=t.corrections)||void 0===l?void 0:l.length)?h=null===t||void 0===t?void 0:null===(m=t.corrections)||void 0===m?void 0:m.length:h=0;(null===t||void 0===t?void 0:null===(d=t.suggestedSearchQueries)||void 0===d?void 0:d.length)?p=null===t||void 0===t?void 0:null===(g=t.suggestedSearchQueries)||void 0===g?void 0:g.length:p=0;(null===t||void 0===t?void 0:null===(u=t.products)||void 0===u?void 0:u.length)?b=null===t||void 0===t?void 0:null===(f=t.products)||void 0===f?void 0:f.length:b=0;switch(e){case $e.up:!function(e,t,n,r,o,a,c,i,s){e||(t>-1?n(t-1):c>-1?(0===c&&n(a-1),r(c-1)):s>-1&&(0===s&&r(i-1),o(s-1)))}(n,r,o,c,i,h,s,p,a);break;case $e.down:!function(e,t,n,r,o,a,c,i,s){e!==t-1&&(n>-1?n===r-1?(i(0),s(-1)):o(e+1):a>-1?a===c-1?(o(0),i(-1)):i(a+1):e>-1&&o(e+1))}(a,b,r,h,i,s,p,c,o)}},et=function(e,t){var n=T.getJSON("recentlySearchedProducts")||[];n.push({itemName:e,itemCategory:null!==t&&void 0!==t?t:"",timeStamp:(new Date).getTime()});var r=n.slice(-5).reduce((function(e,t){return e.some((function(e){return e.itemName===t.itemName}))||e.push(t),e}),[]).filter((function(e){return""!==e.itemName.trim()}));0!==r.length&&T.set("recentlySearchedProducts",JSON.stringify(r))},tt=function(){T.remove("recentlySearchedProducts")},nt=f.createElement,rt=O()((function(){return n.e(317).then(n.bind(null,"e8UE")).then((function(e){return e.SearchComponentsDropdown}))}),{ssr:!0,loadableGenerated:{webpack:function(){return["e8UE"]},modules:["../HeaderSearch/SearchComponentsDropdown"]}}),ot=function(e){var t=e.execSearchQuery,n=e.placeholder,r=e.data,o=e.setValue,a=e.setInstantSearchResults,c=e.inputValue,i=e.inputRef,s=e.restartIndexes,l=e.setAnnounceMessage,d=e.resultsAvailable,u=e.onKeyDown,h=e.debounceDelay,p=e.minSearchLength,m=e.onFocusDropdown,g=e.currency,v=e.shippingDestination,S=e.concessionCode,y=e.vipPriceEnabled;if(!t)return null;var w=p||1,x=function(e,t){var n=f.useState(e),r=Object(b.a)(n,2),o=r[0],a=r[1];return f.useEffect((function(){var n=setTimeout((function(){a(e)}),t);return function(){clearTimeout(n)}}),[e,t]),o}(c,h||25);return f.useEffect((function(){var e=x.length>=w?x:"";t({variables:{concessionCode:S,vipPriceEnabled:y,currency:g||"GBP",shippingDestination:v||"GB",query:x,limit:5}}),e||(a(null),s())}),[x]),f.useEffect((function(){(null===r||void 0===r?void 0:r.instantSearch)&&x.length>=w&&(a(r.instantSearch),l(d))}),[r]),nt(Je,{type:"text","aria-label":n,placeholder:n,onChange:function(e){o(e.target.value)},value:c,ref:i,"data-testid":"header-search-form-input",title:n,onKeyDown:u,onFocus:m})},at=function(e){var t,n,r,o,a,c=e.placeholder,i=e.searchButtonAriaLabel,s=e.clearAriaLabel,l=e.setScrollLock,d=f.useState(""),u=Object(b.a)(d,2),h=u[0],p=u[1],g=f.useState(null),S=Object(b.a)(g,2),y=S[0],w=S[1],x=f.useState(-1),k=Object(b.a)(x,2),j=k[0],O=k[1],I=f.useState(-1),P=Object(b.a)(I,2),C=P[0],R=P[1],B=f.useState(-1),D=Object(b.a)(B,2),F=D[0],E=D[1],A=f.useState(!1),H=Object(b.a)(A,2),L=H[0],V=H[1],N=f.useState([]),M=Object(b.a)(N,2),K=M[0],Q=M[1],U=f.useRef(null),W=f.createRef(),J=f.useState(null),z=Object(b.a)(J,2),G=z[0],Y=z[1];f.useEffect((function(){var e=T.get("recentlySearchedProducts");e&&e.length>0&&Q(JSON.parse(e))}),[]),f.useEffect((function(){var t;(Y(null),-1!==j&&(null===y||void 0===y?void 0:y.corrections))&&Y("".concat(e.searchI18nText.correctionsTitle,": ").concat(null===y||void 0===y?void 0:null===(t=y.corrections[j])||void 0===t?void 0:t.correction));if(-1!==C&&(null===y||void 0===y?void 0:y.suggestedSearchQueries)&&Y("".concat(e.searchI18nText.suggestionsTitle,": ").concat(null===y||void 0===y?void 0:y.suggestedSearchQueries[C])),-1!==F&&(null===y||void 0===y?void 0:y.products)){var n=(null===y||void 0===y?void 0:y.products.length)-1===F,r=null===y||void 0===y?void 0:y.products[F];Y(n?"".concat(e.searchI18nText.lastResult,", ").concat(e.searchI18nText.productsTitle,": ").concat(r.title):"".concat(e.searchI18nText.productsTitle,": ").concat(r.title))}}),[j,C,F]);var q=-1===j&&-1===C&&-1===F,X=function(){O(-1),R(-1),E(-1)};f.useEffect((function(){""!==h&&e.isDesktop&&"undefined"!==typeof document&&l(!0,document,window)}),[h]);var Z=function(){p(""),e.isDesktop&&"undefined"!==typeof document&&l(!1,document,window),w(null),X()},$=function(t){var n;"undefined"!==typeof document&&l(!0,document,window),(null===(n=U.current)||void 0===n?void 0:n.contains(t.currentTarget))&&(V(!0),e.onFocus&&e.onFocus(t))};f.useEffect((function(){var t;e.focusOnMount&&(null===(t=U.current)||void 0===t||t.focus())}),[]);var _=function(){var t,n,r;-1!==j&&(null===y||void 0===y?void 0:y.corrections)&&(e.enableRecentSearches&&et(null===y||void 0===y?void 0:null===(t=y.corrections[j])||void 0===t?void 0:t.correction),window.location.assign("".concat(e.autocompleteLink,"correction&search=").concat(null===y||void 0===y?void 0:null===(n=y.corrections[j])||void 0===n?void 0:n.correction)));(-1!==C&&(null===y||void 0===y?void 0:y.suggestedSearchQueries)&&(e.enableRecentSearches&&et(null===y||void 0===y?void 0:y.suggestedSearchQueries[C]),window.location.assign("".concat(e.autocompleteLink,"searchsuggestion&search=").concat(null===y||void 0===y?void 0:y.suggestedSearchQueries[C]))),-1!==F&&(null===y||void 0===y?void 0:y.products))&&window.location.assign(null===y||void 0===y?void 0:null===(r=y.products[F])||void 0===r?void 0:r.url)},ee=e.InstantSearchInjector;return nt(Ke,{ref:W,mobileSearch:e.mobileSearch},nt(Qe,{onSubmit:function(t){t.preventDefault(),e.onSubmit(h),e.enableRecentSearches&&et(h)},inputFocused:!e.isDesktop&&L,mobileSearch:e.mobileSearch},nt(Ue,{inputFocused:e.isDesktop&&L,value:h},nt(ze,null,nt(ee,null,(function(t){return nt(ot,{placeholder:c,setValue:p,setInstantSearchResults:w,inputValue:h,inputRef:U,restartIndexes:X,setAnnounceMessage:Y,resultsAvailable:e.searchI18nText.resultsAvailable,onKeyDown:function(t){return function(e,t,n,r,o,a,c,i,s,l,d,u,h,p,b){var m,g,f,v,S,y=0;switch(v=(null===t||void 0===t?void 0:null===(m=t.corrections)||void 0===m?void 0:m.length)?t.corrections.length:0,S=(null===t||void 0===t?void 0:null===(g=t.suggestedSearchQueries)||void 0===g?void 0:g.length)?t.suggestedSearchQueries.length:0,(null===t||void 0===t?void 0:null===(f=t.products)||void 0===f?void 0:f.length)&&(y=t.products.length),e.key){case"Escape":n(),r&&o(!0,document,window);break;case"Enter":i||(e.preventDefault(),b());break;case"ArrowUp":-1===s&&-1===p&&-1===d||e.preventDefault(),_e($e.up,t,i,s,l,d,u,h,p);break;case"ArrowDown":!function(e,t,n,r,o,a,c){e&&(t>0?n(0):r>0?o(0):a>0&&c(0))}(i,v,l,S,u,y,h),_e($e.down,t,i,s,l,d,u,h,p);break;case"Tab":e.shiftKey?(n(),c(!1)):a()}}(t,y,Z,e.isDesktop,l,X,V,q,j,O,F,R,E,C,_)},data:t.data,execSearchQuery:t.execSearchQuery,onFocusDropdown:$,currency:e.currency,concessionCode:e.concessionCode,shippingDestination:e.shippingDestination,vipPriceEnabled:null===e||void 0===e?void 0:e.vipPriceEnabled})}))),h&&nt(qe,{"data-testid":"clear-button",type:"button",onKeyPress:function(e){var t;"Enter"===e.key&&(Z(),null===(t=U.current)||void 0===t||t.focus())},onClick:function(){var e;Z(),null===(e=U.current)||void 0===e||e.focus()},"aria-label":s,title:s},nt(v.g,{"data-testid":"input-delete-icon"}))),nt(Ge,{type:"submit","aria-label":i,active:Boolean(h),"data-testid":"header-search-form-submit-button",inputFocused:e.isDesktop&&L,onKeyDown:function(t){return function(e,t,n,r,o,a,c,i){"Tab"===e.key&&""===t&&(a||c||i)&&(n(),r(!0),o&&o()),"Tab"!==e.key||""!==t||a&&c&&i||(n(),r(!1),o&&o())}(t,h,Z,V,e.externalClose,e.enableRecentSearches,e.enablePromotionalSearch,e.trendingTerms)}},""!==(null===(t=e.icon)||void 0===t?void 0:t.svgPath)?nt("svg",{width:null===(n=e.icon)||void 0===n?void 0:n.width,height:null===(r=e.icon)||void 0===r?void 0:r.height,viewBox:null===(o=e.icon)||void 0===o?void 0:o.viewBox,xmlns:"http://www.w3.org/2000/svg"},nt("path",{d:null===(a=e.icon)||void 0===a?void 0:a.svgPath,"fill-rule":"evenodd"})):nt(v.i,null))),nt(it,Object(m.a)({},e,{instantSearchResults:y,movePastInput:function(){p(""),e.isDesktop&&l(!1,document,window),w(null),X(),V(!1),e.externalClose&&e.externalClose()},inputValue:h,correctionsIndex:j,productsIndex:F,suggestionsIndex:C,clearInput:Z,inputFocused:L,clickAway:function(){Z(),V(!1)}},e.enableRecentSearches&&{setRecentSearches:Q,enableRecentSearches:e.enableRecentSearches,recentlySearched:K,recentlySearchedTitle:e.recentlySearchedTitle,recentlySearchedText:e.recentlySearchedText,onClick:tt,clearRecentSearch:e.clearRecentSearch,onClickSearchSuggestions:function(e){return et(e)}},{promotionalProducts:e.promotionalProducts,enablePromotionalSearch:e.enablePromotionalSearch,trendingTerms:e.trendingTerms,enableTrendingSearch:e.enableTrendingSearch,onClickSearchComponent:function(t){e.enableRecentSearches&&et(t)},displaySocialEngagement:e.displaySocialEngagement})),G&&e.renderAnnouncer("assertive",G))},ct=function(e){var t="undefined"!==typeof document&&document?document.documentElement.clientWidth:0;return nt(Ze,null,nt(Me,{pageWidth:t,cutBottom:y.a,slimHeader:e.slimHeader,style:{overflow:"auto"},paddingTop:e.isDesktop?0:2},e.enableRecentSearches&&e.recentlySearched&&e.recentlySearched.length>0&&nt(H,Object(m.a)({recentlySearched:e.recentlySearched,recentlySearchedTitle:e.recentlySearchedTitle,recentlySearchedText:e.recentlySearchedText,onClick:tt,clearRecentSearch:e.clearRecentSearch},!e.enablePromotionalSearch&&!e.trendingTerms&&{movePastInput:e.movePastInput},{removeIndividualSearch:function(t){!function(e,t){var n=JSON.parse(T.get("recentlySearchedProducts")).filter((function(t){return t.itemName!==e}));T.set("recentlySearchedProducts",JSON.stringify(n)),t&&t(n)}(t,e.setRecentSearches)}})),nt(rt,{promotionalProducts:e.promotionalProducts,enablePromotionalSearch:e.enablePromotionalSearch,trendingTerms:e.trendingTerms,movePastInput:e.movePastInput,onClickSearchComponent:e.onClickSearchComponent,enableTrendingSearch:e.enableTrendingSearch})))},it=function(e){var t=f.useState(null),n=Object(b.a)(t,2),r=n[0],o=n[1];f.useEffect((function(){o(e.instantSearchResults)}),[e.instantSearchResults]);var a,c,i,s,l,d,u=(a=e.enableTrendingSearch,c=e.enablePromotionalSearch,i=e.enableRecentSearches,s=e.inputFocused,l=e.inputValue,d=e.displaySocialEngagement,(a||c||i)&&(s||d)&&(!l||(null===l||void 0===l?void 0:l.length)<=2));return nt(I.a,null,nt(f.Fragment,null,r&&!u&&nt(Ye,{shouldDisplay:Boolean(e.inputValue&&e.instantSearchResults),isDesktop:e.isDesktop,searchResults:r,searchI18nText:e.searchI18nText,autocompleteLink:e.autocompleteLink,inputValue:e.inputValue,correctionsIndex:e.correctionsIndex,suggestionsIndex:e.suggestionsIndex,productsIndex:e.productsIndex,clearInput:e.clearInput,movePastInput:e.movePastInput,fromText:e.searchI18nText.fromText,rrpText:e.searchI18nText.rrpText,freeText:e.searchI18nText.freeText,mobileSearch:e.mobileSearch,slimHeader:e.slimHeader,showPowerReview:e.showPowerReview,onClickSearchSuggestions:e.onClickSearchSuggestions&&e.onClickSearchSuggestions})),u&&nt(ct,{inputFocused:e.inputFocused,inputValue:e.inputValue,isDesktop:e.isDesktop,slimHeader:e.slimHeader,movePastInput:e.movePastInput,recentlySearched:e.recentlySearched,recentlySearchedTitle:e.recentlySearchedTitle,recentlySearchedText:e.recentlySearchedText,clearRecentSearch:e.clearRecentSearch,enablePromotionalSearch:e.enablePromotionalSearch,trendingTerms:e.trendingTerms,setRecentSearches:e.setRecentSearches,promotionalProducts:e.promotionalProducts,onClickSearchComponent:e.onClickSearchComponent,enableRecentSearches:e.enableRecentSearches,enableTrendingSearch:e.enableTrendingSearch}),e.isDesktop&&e.inputFocused&&nt(Xe,{onClick:e.clickAway,onTouchStart:e.clickAway,key:"search-overlay","data-testid":"search-overlay",variants:{enter:{opacity:0},center:{opacity:1},exit:{opacity:0}},initial:"enter",animate:"center",exit:"exit",transition:{ease:"easeInOut",duration:.3}}))},st=f.createElement,lt=S.b.div(pe||(pe=Object(g.a)(["\n ","\n"])),(function(e){return e.removePadding?"\n border-bottom: ".concat(e.theme.patterns.header.navigation.borderBottom,";\n\n form {\n border: none;\n }"):"padding: ".concat(Object(w.i)(2),";\n background-color: ").concat(e.theme.colors.palette.greys.lighter,";")})),dt=S.b.div(be||(be=Object(g.a)(["\n visibility: ",";\n\n "," {\n visibility: visible;\n }\n"])),(function(e){return e.mobileVisible?"visible":"hidden"}),(function(e){return Object(x.d)(e.theme.breakpointUtils.map,"lg")})),ut=S.b.div(me||(me=Object(g.a)(["\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n\n svg {\n fill: ",";\n }\n"])),(function(e){return e.theme.patterns.header.search.mobileIcon.color})),ht=function(e){var t=Object(y.b)();return st(lt,{removePadding:e.showExposedSearch},st(at,Object(m.a)({setScrollLock:t,placeholder:e.headerSearchI18nText.placeholder,searchButtonAriaLabel:e.headerSearchI18nText.searchButtonAriaLabel,clearAriaLabel:e.headerSearchI18nText.clearAriaLabel,isDesktop:!e.isMobile,InstantSearchInjector:e.InstantSearchInjector,searchI18nText:e.searchI18nText,onSubmit:e.onSubmit,autocompleteLink:e.autocompleteLink,renderAnnouncer:e.renderAnnouncer,currency:e.currency,shippingDestination:e.shippingDestination,externalClose:e.close,icon:e.mobileIcon,concessionCode:e.concessionCode,onFocus:e.onFocus,mobileSearch:e.mobileSearch,slimHeader:e.slimHeader,focusOnMount:e.focusOnMount,vipPriceEnabled:null===e||void 0===e?void 0:e.vipPriceEnabled,showPowerReview:e.showPowerReview},e.enableRecentSearches&&{enableRecentSearches:e.enableRecentSearches,recentlySearchedTitle:e.recentlySearchedTitle,recentlySearchedText:e.recentlySearchedText,clearRecentSearch:e.clearRecentSearch},e.promotionalProducts&&{promotionalProducts:e.promotionalProducts},{enablePromotionalSearch:e.enablePromotionalSearch,trendingTerms:e.trendingTerms,enableTrendingSearch:e.enableTrendingSearch,displaySocialEngagement:e.displaySocialEngagement})))},pt=function(e){var t,n,r,o,a,c=f.useState(!1),i=Object(b.a)(c,2),s=i[0],l=i[1],d=f.useState(!1),u=Object(b.a)(d,2),h=u[0],p=u[1],g=Object(y.b)();return f.useEffect((function(){s&&l(!1),g(!1,document,window)}),[e.isMobile]),e.isMobile||e.mobileSearch?st(k.a,{dropdownType:L.a.SEARCH,tabIndex:e.isMobile?3:e.mobileSearch?void 0:0,i18nAriaLabels:{close:e.triggerAriaLabels.close,trigger:e.triggerAriaLabels.search},isMobile:e.isMobile||e.mobileSearch,isDesktop:!e.isMobile,dropdownWidth:e.mobileSearch?"470px":void 0,trigger:{icon:st(ut,{"data-testid":"search-icon-wrapper"},""!==(null===(t=e.mobileIcon)||void 0===t?void 0:t.svgPath)?st("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:null===(n=e.mobileIcon)||void 0===n?void 0:n.viewBox,height:null===(r=e.mobileIcon)||void 0===r?void 0:r.height,width:null===(o=e.mobileIcon)||void 0===o?void 0:o.width},st("path",{d:null===(a=e.mobileIcon)||void 0===a?void 0:a.svgPath,"fill-rule":"evenodd"})):st(v.i,null)),text:"",triggerHref:""},disableFocusLogic:!0,disableAnimation:!0,content:function(t){return st(ht,Object(m.a)({close:t,focusOnMount:!1,displaySocialEngagement:h},e))},mobileSearch:e.mobileSearch,setDisplaySocialEngagement:p}):st(dt,{mobileVisible:e.showExposedSearch},st(at,Object(m.a)({setScrollLock:g,placeholder:e.headerSearchI18nText.placeholder,searchButtonAriaLabel:e.headerSearchI18nText.searchButtonAriaLabel,clearAriaLabel:e.headerSearchI18nText.clearAriaLabel,isDesktop:!e.isMobile||!e.mobileSearch,InstantSearchInjector:e.InstantSearchInjector,searchI18nText:e.searchI18nText,onSubmit:e.onSubmit,autocompleteLink:e.autocompleteLink,renderAnnouncer:e.renderAnnouncer,currency:e.currency,shippingDestination:e.shippingDestination,icon:e.mobileIcon,onFocus:e.onFocus,mobileSearch:e.mobileSearch,slimHeader:e.slimHeader,vipPriceEnabled:e.vipPriceEnabled,showPowerReview:e.showPowerReview},e.enableRecentSearches&&{enableRecentSearches:e.enableRecentSearches,recentlySearchedTitle:e.recentlySearchedTitle,recentlySearchedText:e.recentlySearchedText,clearRecentSearch:e.clearRecentSearch},{promotionalProducts:e.promotionalProducts,enablePromotionalSearch:e.enablePromotionalSearch,trendingTerms:e.trendingTerms,enableTrendingSearch:e.enableTrendingSearch,displaySocialEngagement:h})))}}}]);