1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6040],{5096:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/racing/my-stable/search",function(){return t(33601)}])},33601:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return V}});var r=t(51351),s=t(85893),a=t(67294),i=t(56404),o=t(18897),c=t(39667),u=t(25925),l=t(86850),d=t(47568),h=t(828),f=t(7297),p=t(97582),m=t(45697),y=t.n(m),x=function(){return(0,s.jsxs)("svg",{viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)("title",{children:"Search"}),(0,s.jsx)("path",{d:"M39.567 11.2c3.783 3.783 5.866 8.817 5.866 14.167S43.35 35.75 39.567 39.533C35.783 43.317 30.75 45.4 25.4 45.4s-10.383-2.083-14.167-5.867C7.45 35.75 5.367 30.717 5.367 25.367S7.45 14.983 11.233 11.2C15.017 7.417 20.05 5.333 25.4 5.333S35.783 7.417 39.567 11.2zM46.75 39c2.5-3.933 3.967-8.6 3.967-13.617C50.717 11.367 39.367 0 25.367 0 11.35 0 0 11.367 0 25.383 0 39.4 11.35 50.767 25.35 50.767c5.083 0 9.817-1.5 13.783-4.067l1.15-.8 18.1 18.1L64 58.283l-18.083-18.1L46.75 39z",fillRule:"evenodd"})]})},g=t(27603);function b(){var e=(0,f.Z)(["\n padding: ",";\n position: relative;\n border: 1px solid ",";\n border-radius: ",";\n width: 250px;\n\n input {\n font-size: ",";\n font-family: ",";\n outline: none;\n width: 200px;\n border: none;\n }\n\n @media (max-width: ",") {\n width: 100%;\n }\n"]);return b=function(){return e},e}function S(){var e=(0,f.Z)(["\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n right: -10px;\n border: 0;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n\n svg {\n fill: ",";\n height: 16px;\n vertical-align: text-bottom;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n position: relative;\n }\n"]);return S=function(){return e},e}var v=g.ZP.span.withConfig({displayName:"Search__SearchWrapper",componentId:"sc-3c00534e-0"})(b(),function(e){return e.theme.sizes.smallGap},function(e){return e.theme.colours.lineBreak},function(e){return e.theme.sizes.border.smallRadius},function(e){return e.theme.fonts.size.large},function(e){return e.theme.fonts.family.bodyCopyLight},function(e){return e.theme.breakpoints.maxMobileWidth}),j=g.ZP.button.withConfig({displayName:"Search__SearchIconWrapper",componentId:"sc-3c00534e-1"})(S(),function(e){return e.theme.colours.clockIcon}),k=function(e){var n=e.searchText,t=e.keyDownHandler,r=e.changeHandler,a=e.performSearch,i=e.placeholder;
1return(0,s.jsxs)(v,{children:[(0,s.jsx)("input",{autoFocus:!0,type:"text",value:n,maxLength:20,onKeyDown:t,onChange:r,placeholder:void 0===i?"":i,"data-testid":"search-input"}),(0,s.jsx)(j,{"data-testid":"search-submit",onClick:a,children:(0,s.jsx)(x,{})})]})};k.propTypes={searchText:y().string.isRequired,keyDownHandler:y().func.isRequired,changeHandler:y().func.isRequired,performSearch:y().func.isRequired,placeholder:y().string};var w=t(23279),T=t.n(w),_=function(e){var n=e.performSearch,t=e.setSearchText,r=e.searchText,i=function(e){13===e.keyCode&&n()},o=function(e){t(e.target.value)},c=T()(n,250,{maxWait:1e3});return(0,a.useEffect)(function(){return c(),c.cancel},[r]),(0,s.jsx)(k,{searchText:r,keyDownHandler:i,changeHandler:o,performSearch:n,placeholder:"Enter search criteria"})};_.propTypes={performSearch:y().func.isRequired,setSearchText:y().func.isRequired,searchText:y().string.isRequired};var Z=t(14522),C=t(41664),N=t.n(C);function R(e){var n=e.hasSubscriptions,t=e.saveSubscriptions;return n?(0,s.jsx)("a",{className:"my-stable-already-in-stable",children:"Following"}):(0,s.jsx)("a",{className:"my-stable-add-to-stable",id:"my-stable-add-to-stable",onClick:t,children:"Add to my stable"})}R.defaultProps={hasSubscriptions:!1,saveSubscriptions:function(){}},R.propTypes={hasSubscriptions:y().bool,saveSubscriptions:y().func};var P=t(69474),z=t(71849),M=t(96486),I=t(63168);function E(){var e=(0,f.Z)(["\n min-height: ",";\n"]);return E=function(){return e},e}function q(){var e=(0,f.Z)(["\n width: 100%;\n color: ",";\n"]);return q=function(){return e},e}function L(){var e=(0,f.Z)(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n padding: ","\n ",";\n"]);return L=function(){return e},e}function H(){var e=(0,f.Z)(["\n font-family: ",";\n font-size: ",";\n color: ",";\n"]);return H=function(){return e},e}function B(){var e=(0,f.Z)(["\n a.my-stable-already-in-stable {\n font-family: ",";\n font-size: ",";\n color: ",";\n text-decoration: none;\n cursor: default;\n }\n a.my-stable-add-to-stable {\n font-family: ",";\n font-size: ",";\n color: ",";\n text-decoration: underline;\n cursor: pointer;\n }\n"]);return B=function(){return e},e}var G=g.ZP.div.withConfig({displayName:"MyStableSearchResultsTable__StyledWrapper",componentId:"sc-6ee274f4-0"})(E(),function(e){return e.theme.sizes.mediumGap}),W=g.ZP.table.withConfig({displayName:"MyStableSearchResultsTable__StyledTable",componentId:"sc-6ee274f4-1"})(q(),function(e){return e.theme.colours.textPrimaryLighter}),O=g.ZP.tr.withConfig({displayName:"MyStableSearchResultsTable__StyledRow",componentId:"sc-6ee274f4-2"})(L(),function(e){return e.theme.sizes.smallGap},function(e){return e.theme.sizes.mediumGap}),X=g.ZP.td.withConfig({displayName:"MyStableSearchResultsTable__StyledName",componentId:"sc-6ee274f4-3"})(H(),function(e){return e.theme.fonts.family.bodyCopyLight},function(e){return e.theme.sizes.medium},function(e){return e.theme.colours.textPrimary}),D=g.ZP.td.withConfig({displayName:"MyStableSearchResultsTable__StyledLinkWrapper",componentId:"sc-6ee274f4-4"})(B(),function(e){return e.theme.fonts.family.bodyCopyLight},function(e){return e.theme.sizes.medium},function(e){return e.theme.colours.textPrimaryLighter},function(e){return e.theme.fonts.family.bodyCopyLight},function(e){return e.theme.sizes.medium},function(e){return e.theme.colours.textSecondary});function A(e){var n=e.keyName,t=e.linkType,r=e.results,i=void 0===r?[]:r,o=e.loading,c=e.searchText,u=e.resultMap,l=(0,I.aC)(),d=null==l?void 0:l.authStore,h=(0,P.Pd)().subscriptionStore,f=(0,P.jO)(),p=f.saveSubscriptions,m=f.loadSubscriptions;(0,a.useEffect)(function(){m()},[]);var y=i.map(function(e){return u(e)}),x=(null==d?void 0:d.loggedIn)&&(null==d?void 0:d.ssoBrand)==="sky"||!(null==d?void 0:d.loggedIn);return(0,s.jsx)(G,{children:i.length>0?(0,s.jsx)(W,{"data-testid":"search-results-table-results",children:(0,s.jsx)("tbody",{children:y.map(function(e){var n,r,a,i=e.type,o=e.id,c=e.text;return(0,s.jsxs)(O,{"data-testid":"search-results-table-row-".concat(o),children:[(0,s.jsx)(X,{"data-testid":"search-results-table-name",children:(0,s.jsx)(N(),{href:(0,Z.q9)(t,o),passHref:!0,children:(0,s.jsx)("a",{children:c})})}),x&&(0,s.jsx)(D,{"data-testid":"search-results-table-link",children:(0,s.jsx)(R,{saveSubscriptions:function(){return p([{type:i,id:o,text:c}])},hasSubscriptions:!!(0,M.get)(h,["subscriptions",i,o])})})]},o)})})}):c&&!o&&(0,s.jsx)(z.ZP,{title:"",message:"Sorry, no ".concat(n," profiles found for '").concat(c,"'"),withoutBorder:!0,"data-testid":"search-results-table-no-results"})})}
1A.propTypes={keyName:y().string.isRequired,linkType:y().string.isRequired,results:y().array,loading:y().bool,searchText:y().string,resultMap:y().func.isRequired};var J=t(83938),F=t(35413);function K(){var e=(0,f.Z)(["\n display: flex;\n flex-direction: row;\n margin: "," 0\n ",";\n"]);return K=function(){return e},e}var Y=g.ZP.div.withConfig({displayName:"MyStableSearch__StyledSearchBarWrapper",componentId:"sc-1afe23a9-0"})(K(),function(e){return e.theme.sizes.smallGap},function(e){return e.theme.sizes.mediumGap}),$=function(){var e,n=(0,a.useState)(""),t=n[0],r=n[1],i=(0,a.useState)([]),o=i[0],c=i[1],u=(0,a.useState)([]),l=u[0],f=u[1],m=(0,a.useState)([]),y=m[0],x=m[1],g=(0,a.useState)(!1),b=g[0],S=g[1],v=(e=(0,d.Z)(function(){var e,n,r,s,a,i;return(0,p.__generator)(this,function(o){switch(o.label){case 0:if(!(t.length>0))return[3,5];e=t.replace(/[\|&;\$%@"'<>\(\)\+,]/g,"").trim(),o.label=1;case 1:var u,l,d;return o.trys.push([1,3,,4]),S(!0),[4,Promise.all([(u=e,F.Z.get("/horse-racing/horse",{params:{name:u}})),(l=e,F.Z.get("/horse-racing/jockey",{params:{name:l}})),(d=e,F.Z.get("/horse-racing/trainer",{params:{name:d}}))])];case 2:return r=(n=h.Z.apply(void 0,[o.sent(),3]))[0],s=n[1],a=n[2],S(!1),c(r.data),f(s.data),x(a.data),[3,4];case 3:return i=o.sent(),console.log("error during search",i.stack),[3,4];case 4:return[3,6];case 5:c([]),f([]),x([]),o.label=6;case 6:return[2]}})}),function(){return e.apply(this,arguments)}),j=function(e){return b?"loading results...":e};return(0,s.jsx)(J.Z,{title:"Search",subtitle:(0,s.jsx)(Y,{children:(0,s.jsx)(_,{performSearch:v,setSearchText:r,searchText:t})}),sections:[{key:"horses",title:j("Horses (".concat(o.length," result/s)")),children:(0,s.jsx)(A,{keyName:"Horse",linkType:"horse",results:o,loading:b,searchText:t,resultMap:function(e){return{type:"HORSE",id:e.horse_reference.id,text:e.name}}})},{key:"jockeys",title:j("Jockeys (".concat(l.length," result/s)")),children:(0,s.jsx)(A,{keyName:"Jockey",linkType:"jockey",results:l,loading:b,searchText:t,resultMap:function(e){return{type:"JOCKEY",id:e.person_reference.id,text:e.name}}})},{key:"trainers",title:j("Trainers (".concat(y.length," result/s)")),children:(0,s.jsx)(A,{keyName:"Trainer",linkType:"trainer",results:y,loading:b,searchText:t,resultMap:function(e){return{type:"TRAINER",id:e.business_reference.id,text:e.name}}})},]})},Q=t(91609),U=function(e){var e=null!==e?e:(0,r.Z)(TypeError("Cannot destructure undefined")),n=(0,I.aC)().authStore,t=n.loggedIn&&"sky"!==n.ssoBrand;return(0,s.jsxs)(o.ZP,{sport:"racing",title:"Search - Sporting Life",children:[(0,s.jsx)(u.Z,{children:(0,s.jsx)(c.Z,{isAuthenticatedBrand:t,children:(0,s.jsx)("section",{className:"my-stable-search-container",children:(0,s.jsx)($,{})})})}),(0,s.jsx)(l.Z,{children:(0,s.jsx)(i.Z,{sport:"racing",content:(0,Q.cG)("loginPromptMyStable")})})]})};U.propTypes={};var V=U}},function(e){e.O(0,[1248,8897,4676,4945,5197,6522,4048,9774,2888,179],function(){return e(e.s=5096)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.