(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9603],{457:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/search",function(){return r(6824)}])},9035:(e,t,r)=>{"use strict";r.d(t,{k:()=>d});var s=r(2322),n=r(2238),l=r(5447),a=r(8269),i=r(3642);let d=()=>{let{t:e}=(0,l.$G)();return(0,s.jsx)(i.r,{href:"/apps/submit/",children:(0,s.jsx)(a.Zb,{className:"col-span-1 p-8 text-center hover:bg-accent",children:(0,s.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,s.jsx)(n.Z,{className:"mx-auto size-14"}),(0,s.jsx)("p",{className:"text-normal mt-6 truncate font-medium text-foreground",children:e("submitNewApp")}),(0,s.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:(0,s.jsx)("br",{})})]})})})}},6824:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSG:()=>G,default:()=>T});var s=r(2322),n=r(186),l=r(7782),a=r(8078),i=r(3105),d=r(7370),c=r.n(d),o=r(2238),m=r(4697),x=r(7409),u=r(4680),p=r(5447),h=r(5351),f=r(5632),g=r(2784),j=r(4166),v=r(3318),N=r(2910),w=r(1694),b=r(6095),y=r(7233),_=r(9035),C=r(2166),P=r(6071);let k=e=>{let{onChange:t,value:r,onSubmit:n}=e,{t:l}=(0,p.$G)();return(0,s.jsxs)("form",{onSubmit:n,className:"flex w-full items-center gap-x-2",children:[(0,s.jsx)(P.M,{type:"text",value:r,onChange:e=>t(e.currentTarget.value),placeholder:l("searchForAppsGames"),maxLength:100}),(0,s.jsxs)(j.z,{type:"submit",variant:"outline",children:[(0,s.jsx)("span",{className:"sr-only",children:l("search")}),(0,s.jsx)(C.Z,{className:"size-4"})]})]})};var F=r(3642);let Z=new i.Z({searchKey:N.P_.searchKey,engineName:N.P_.appEngineName,endpointBase:N.P_.endpointBase}),z=e=>{var t;return(null===(t=e.match(/\?(.+)/))||void 0===t?void 0:t[1])||""};var G=!0;let T=()=>{let{t:e}=(0,p.$G)(),t=(0,f.useRouter)(),{locale:r}=t,i=(0,g.useMemo)(()=>({apiConnector:Z,initialState:{resultsPerPage:59,sortField:"",sortDirection:""},alwaysSearchOnInitialLoad:!0,searchQuery:{result_fields:{id:{raw:{}},slug:{raw:{}},name:{raw:{}},unlisted:{raw:{}},url:{raw:{}},landing_url:{raw:{}},icon_filled_128_png:{raw:{}},icon_filled_128:{raw:{}},description:{raw:{}},["description_".concat(c()(r))]:{raw:{}}}},trackUrlState:!0,routingOptions:{readUrl:()=>z(t.asPath),writeUrl:(e,r)=>{let{replaceUrl:s}=r;(0,t[s?"replace":"push"])("?".concat(e),void 0,{scroll:!1})},routeChangeHandler:e=>{let r=t=>{t.includes("https://webcatalog.io")&&e(z(t))};return t.events.on("routeChangeComplete",r),()=>{t.events.off("routeChangeComplete",r)}}}}),[]),d=[{name:e("apps"),gameFilter:!1},{name:e("games"),gameFilter:!0}];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.PB,{title:"".concat(e("search")," - ").concat(e("games"))}),(0,s.jsxs)(n.Z,{config:i,children:[(0,s.jsx)("div",{className:"mx-auto max-w-4xl py-4",children:(0,s.jsx)(l.Z,{searchAsYouType:!0,debounceLength:300,view:k,shouldClearFilters:!1})}),(0,s.jsxs)("div",{className:"py-8",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-y-4 md:flex-row md:gap-y-0",children:[(0,s.jsxs)("div",{className:"flex flex-1 flex-col gap-4 sm:flex-row",children:[(0,s.jsx)("div",{children:(0,s.jsx)("h1",{className:"text-2xl font-bold sm:text-3xl sm:tracking-tight",children:e("searchResults")})}),(0,s.jsx)("div",{children:(0,s.jsx)(j.z,{asChild:!0,children:(0,s.jsxs)(F.r,{href:"/apps/submit/",children:[(0,s.jsx)(o.Z,{className:"size-4 ltr:mr-2 rtl:ml-2"}),e("submitNewApp")]})})})]}),(0,s.jsx)("div",{children:(0,s.jsx)(a.Z,{mapContextToProps:e=>{let{clearFilters:t,setFilter:r,filters:s}=e;return{clearFilters:t,setFilter:r,filters:s}},children:e=>{let{clearFilters:t,setFilter:r,filters:n}=e,l=n.some(e=>{var t;return"category"===e.field&&(null===(t=e.values[0])||void 0===t?void 0:t.includes("Games"))&&"any"===e.type});return(0,s.jsx)("div",{className:"flex flex-1 gap-x-2 md:justify-end",children:d.map(e=>(0,s.jsx)(j.z,{variant:e.gameFilter===l?"default":"ghost",onClick:()=>{t(),r("category",["Games"],e.gameFilter?"any":"none")},children:e.name},e.name))})}})})]}),(0,s.jsx)(a.Z,{mapContextToProps:e=>{let{current:t,error:r,isLoading:s,results:n,resultsPerPage:l,searchTerm:a,setCurrent:i,setSearchTerm:d,totalResults:c,trackClickThrough:o,wasSearched:m,filters:x}=e;return{current:t,error:r,isLoading:s,results:n,resultsPerPage:l,searchTerm:a,setCurrent:i,setSearchTerm:d,totalResults:c,trackClickThrough:o,wasSearched:m,filters:x}},children:t=>{let{current:n,error:l,isLoading:a,results:i,resultsPerPage:d,searchTerm:o,setCurrent:p,setSearchTerm:f,totalResults:g,trackClickThrough:N,wasSearched:y,filters:C}=t,P=C.some(e=>{var t;return"category"===e.field&&(null===(t=e.values[0])||void 0===t?void 0:t.includes("Games"))&&"any"===e.type}),k=Math.min(100,Math.ceil(g/d)),F=i.map(e=>{var t;return{id:e.id.raw,slug:e.slug.raw,name:e.name.raw,iconFilled128:e.icon_filled_128.raw,iconFilled128Png:e.icon_filled_128_png.raw,url:e.url.raw||"",landingUrl:e.landing_url.raw,unlisted:1===e.unlisted.raw,description:(0,w.tr)((null===(t=e["description_".concat(c()(r))])||void 0===t?void 0:t.raw)||e.description.raw,300)}}),Z=e=>(0,s.jsx)("button",{type:"button",onClick:t=>{t.preventDefault(),p(e),document.body.scrollIntoView()},className:(0,v.cn)("inline-flex items-center border-t-2 px-4 pt-4 text-sm font-medium",n===e?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:e}),z="".concat(e("search")," - ").concat(e("apps"));return(o&&(z="".concat(o," - ").concat(z)),n>1&&(z=e("pageInfo",{currentPage:n,title:z})),l)?(0,s.jsxs)("div",{className:"py-16 text-center sm:py-24",children:[(0,s.jsx)(h.PB,{title:z}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-extrabold tracking-tight text-foreground sm:text-4xl",children:e("failedToConnectToServer")}),(0,s.jsx)("p",{className:"mt-1 text-base text-muted-foreground",children:e("checkInternetConnection")}),(0,s.jsx)("div",{className:"mt-10 flex justify-center gap-x-2 sm:border-l sm:border-transparent ltr:sm:pl-6 rtl:sm:pr-6",children:(0,s.jsx)(j.z,{onClick:()=>{f(o,{refresh:!0,debounce:0,shouldClearFilters:!1})},children:e("tryAgain")})})]})]}):a&&i.length<1?(0,s.jsxs)("div",{className:"py-16 text-center sm:px-6",children:[(0,s.jsx)(h.PB,{title:z}),(0,s.jsx)(m.Z,{className:"mx-auto size-10 animate-spin text-muted-foreground"})]}):y&&i.length<1?(0,s.jsxs)("div",{className:"py-16 text-center sm:py-24",children:[(0,s.jsx)(h.PB,{title:z}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-extrabold tracking-tight text-foreground sm:text-4xl",children:e("noMatchingResults")}),(0,s.jsx)("p",{className:"mt-1 text-base text-muted-foreground",children:e("noMatchingResultsDesc")})]}),(0,s.jsx)("div",{className:"mx-auto my-16 max-w-sm",children:(0,s.jsx)(_.k,{})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.PB,{title:z}),(0,s.jsx)("div",{className:"my-6 grid grid-cols-1 gap-6",children:F.map(e=>(0,s.jsx)(b.p,{slug:e.slug,name:e.name,iconFilled128:e.iconFilled128,iconFilled128Png:e.iconFilled128Png,url:e.url,landingUrl:e.landingUrl,description:e.description,unlisted:e.unlisted,onClick:N?()=>{N(e.id)}:void 0,isGame:P},e.id))}),(0,s.jsxs)("nav",{className:"flex items-center justify-between border-t sm:px-0",children:[(0,s.jsx)("div",{className:"flex w-0 flex-1",children:n>1&&(0,s.jsxs)("button",{type:"button",onClick:e=>{e.preventDefault(),p(n-1),document.body.scrollIntoView()},className:"inline-flex items-center border-t-2 border-transparent pr-1 pt-4 text-sm font-medium text-muted-foreground hover:text-foreground",children:[(0,s.jsx)(x.Z,{className:"size-4 text-muted-foreground ltr:mr-2 rtl:ml-2 rtl:-scale-x-100","aria-hidden":"true"}),e("previous")]})}),(0,s.jsxs)("div",{className:"hidden md:flex",children:[Z(1),n-2>2&&(0,s.jsx)("span",{className:"inline-flex items-center border-t-2 border-transparent px-4 pt-4 text-sm font-medium text-muted-foreground",children:"..."}),n-2>1&&Z(n-2),n-1>1&&Z(n-1),n>1&&n!==k&&Z(n),n+1<k&&Z(n+1),n+2<k&&Z(n+2),n+2<k-1&&(0,s.jsx)("span",{className:"inline-flex items-center border-t-2 border-transparent px-4 pt-4 text-sm font-medium text-muted-foreground",children:"..."}),k>1&&Z(k)]}),(0,s.jsx)("div",{className:"-mt-px flex w-0 flex-1 justify-end",children:n<k&&(0,s.jsxs)("button",{type:"button",onClick:e=>{e.preventDefault(),p(n+1),document.body.scrollIntoView()},className:"inline-flex items-center border-t-2 border-transparent pt-4 text-sm font-medium text-muted-foreground hover:text-foreground ltr:pl-1 rtl:pr-1",children:[e("next"),(0,s.jsx)(u.Z,{className:"size-4 text-muted-foreground ltr:ml-2 rtl:mr-2 rtl:-scale-x-100","aria-hidden":"true"})]})})]})]})}})]}),(0,s.jsx)(y.h,{})]})]})}},3260:()=>{}},e=>{var t=t=>e(e.s=t);e.O(0,[730,332,2888,9774,179],()=>t(457)),_N_E=e.O()}]);