!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9c4c1ddc-e014-4842-bf41-2e67b603ed45",e._sentryDebugIdIdentifier="sentry-dbid-9c4c1ddc-e014-4842-bf41-2e67b603ed45")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[705],{35748:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/apps",function(){return n(25905)}])},25905:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSG:function(){return p},default:function(){return AppsIndexPage}});var r=n(2026),l=n(61050),a=n(39258),u=n(23136),o=n(89263);n(81744);var i=n(79363),s=n(22094),c=n(45451),d=n(22956),p=!0;function AppsIndexPage(e){let{snapshot:t,fallback:n}=e,p=(0,c.w)();return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(u.J$,{value:{fallback:n},children:[(0,r.jsx)(l.PB,{canonical:(0,s.l)(null==p?void 0:p.href),languageAlternates:[{hrefLang:"en-au",href:"".concat((0,o.SV)("en-AU"),"/apps/")},{hrefLang:"en-gb",href:"".concat((0,o.SV)("en-GB"),"/apps/")},{hrefLang:"en-us",href:"".concat((0,o.SV)("en-US"),"/apps/")},{hrefLang:"x-default",href:"".concat((0,o.SV)(),"/apps/")}],openGraph:{url:(0,s.l)(null==p?void 0:p.href)}}),(0,r.jsx)(d.c$,{children:(0,r.jsx)(a.T3,{snapshot:t,runtime:i.G})})]})})}},22956:function(e,t,n){"use strict";let r;n.d(t,{Gf:function(){return useAppCategoryCount},c$:function(){return AppsProvider},gb:function(){return useAppsCurrentcategories},nz:function(){return useAppFilters}});var l=n(2026),a=n(27978),u=n(23073),o=n(25955),i=n(25897),s=n(34159),c=n(29503),d=n(25131),p=n(23045);let f=(0,o.x)("QUTLQTIH9V","31920dc2da27b2d1e8153f87eafae69b");function getPageFromQueryParams(e){return"string"==typeof e.page?parseInt(e.page):1}let v=(0,a.createContext)({parentCategory:null,childCategory:null});function useAppFilters(){let{query:e}=(0,u.useRouter)(),[t,n]=(0,a.useState)("string"==typeof e.query?e.query:""),[r,l]=(0,a.useState)("all"),[o,i]=(0,a.useState)("featured"),[s,c]=(0,a.useState)("all"),[d,p]=(0,a.useState)("all"),[f,v]=(0,a.useState)("all"),[g,m]=(0,a.useState)("all"),[y,h]=(0,a.useState)(getPageFromQueryParams(e));return(0,a.useEffect)(()=>{function getQueryParamFromUrl(t){let n=e[t];return n?Array.isArray(n)?n.join(""):n:""}let t=getQueryParamFromUrl("query");n(null!=t?t:"");let r=getQueryParamFromUrl("sort");i(r||"featured");let a=getQueryParamFromUrl("min-rating");l(a||"all");let u=getQueryParamFromUrl("tier");c(u||"all");let o=getQueryParamFromUrl("type");p(o||"all");let s=getQueryParamFromUrl("costPlans");v(s||"all");let d=getQueryParamFromUrl("compatibleWith");m(d||"all");let f=getPageFromQueryParams(e);h(f)},[e,n,i,l,c,p,h,v]),{searchQuery:t,ratingFilter:r,sortFilter:o,tierFilter:s,appTypeFilter:d,costPlansFilter:f,compatibleWithFilter:g,page:y}}function useAppCategoryCount(){let[e,t]=(0,a.useState)(0),[n,l]=(0,a.useState)([]),[u,o]=(0,a.useState)([]),{searchQuery:i,ratingFilter:s,sortFilter:p,tierFilter:f,appTypeFilter:v,costPlansFilter:g,compatibleWithFilter:m}=useAppFilters();return(0,a.useEffect)(()=>{r&&clearTimeout(r),r=setTimeout(async()=>{var e,n,r,a,u,y,h,P,S,w;let _;let b="/api/algolia/marketplace/apps/total-count/?env=production";i&&(b="".concat(b,"&searchQuery=").concat(i)),p&&(b="".concat(b,"&sortFilter=").concat(p)),f&&(b="".concat(b,"&tierFilter=").concat(f)),s&&(b="".concat(b,"&ratingFilter=").concat(s)),v&&(b="".concat(b,"&appTypeFilter=").concat(v)),g&&(b="".concat(b,"&costPlansFilter=").concat(g)),m&&(b="".concat(b,"&compatibleWithFilter=").concat(m));let C=await fetch(b);_=await C.json();let F=null===(e=Object.entries(null!==(S=null===(a=_.results)||void 0===a?void 0:null===(r=a[0])||void 0===r?void 0:null===(n=r.facets)||void 0===n?void 0:n["heirarchicalCategories.lvl0"])&&void 0!==S?S:{}))||void 0===e?void 0:e.map(e=>{let[t,n]=e;return{slug:t,count:n}}),A=null===(u=Object.entries(null!==(w=null==_?void 0:null===(P=_.results)||void 0===P?void 0:null===(h=P[0])||void 0===h?void 0:null===(y=h.facets)||void 0===y?void 0:y["heirarchicalCategories.lvl1"])&&void 0!==w?w:{}))||void 0===u?void 0:u.map(e=>{let[t,n]=e,[r,l]=t.split(" > ");return{parentCategory:r,childCategory:l,count:n}});(async function(){var e;let{categoryCollection:n}=await (0,d.L)().request(c.SJE,{where:{slug_in:[...null==F?void 0:F.map(e=>{let{slug:t}=e;return t}),...null==A?void 0:A.map(e=>{let{childCategory:t}=e;return t})]}});l(F.map(e=>{var t,r,l;let{slug:a,count:u}=e;return{name:null!==(l=null==n?void 0:null===(r=n.items)||void 0===r?void 0:null===(t=r.find(e=>(null==e?void 0:e.slug)===a))||void 0===t?void 0:t.name)&&void 0!==l?l:"",slug:a,count:u}})),o(A.map(e=>{var t,r,l,a,u,o;let{parentCategory:i,childCategory:s,count:c}=e;return{parentCategory:{name:null!==(u=null==n?void 0:null===(r=n.items)||void 0===r?void 0:null===(t=r.find(e=>(null==e?void 0:e.slug)===i))||void 0===t?void 0:t.name)&&void 0!==u?u:"",slug:i},childCategory:{name:null!==(o=null==n?void 0:null===(a=n.items)||void 0===a?void 0:null===(l=a.find(e=>(null==e?void 0:e.slug)===s))||void 0===l?void 0:l.name)&&void 0!==o?o:"",slug:s},count:c}})),t(null==_?void 0:null===(e=_.results[0])||void 0===e?void 0:e.nbHits)})()},300)},[i,s,p,f,v,g,m]),{totalCount:e,parentCategoriesWithAppCount:n,childCategoriesWithAppCount:u}}function AppsProvider(e){let{serverState:t,parentCategory:n,childCategory:r,children:a}=e;return(0,l.jsx)(i.H,{...t,"data-sentry-element":"InstantSearchSSRProvider","data-sentry-component":"AppsProvider","data-sentry-source-file":"AppsProvider.tsx",children:(0,l.jsx)(s.p,{searchClient:f,indexName:"www_prod_marketplaceApps_en-US","data-sentry-element":"InstantSearch","data-sentry-source-file":"AppsProvider.tsx",children:(0,l.jsx)(v.Provider,{value:{parentCategory:n,childCategory:r},"data-sentry-element":"unknown","data-sentry-source-file":"AppsProvider.tsx",children:a})})})}function useAppsCurrentcategories(){let{parentCategory:e,childCategory:t}=(0,a.useContext)(v);return{parentCategory:e?{title:(0,p.L)(null!=e?e:""),slug:e}:null,childCategory:t?{title:(0,p.L)(null!=t?t:""),slug:t}:null}}},23045:function(e,t,n){"use strict";function toTitleCase(e){return e.replace(/[\W_]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}n.d(t,{L:function(){return toTitleCase}})},45451:function(e,t,n){"use strict";n.d(t,{w:function(){return useUrl}});var r=n(27978);function useUrl(){let{locale:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[t,n]=(0,r.useState)(null);return(0,r.useEffect)(()=>{n(window.location.href)},[]),t?new URL(t):null}n(89263)}},function(e){e.O(0,[4771,4503,418,710,1744,9774,2888,179],function(){return e(e.s=35748)}),_N_E=e.O()}]);
//# sourceMappingURL=apps-af24c4df71ca12ee.js.map