(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[230],{9174:function(n,e,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/2022",function(){return i(5460)}])},5460:function(n,e,i){"use strict";i.r(e);var o=i(6042),t=i(9396),s=i(828),r=i(9815),l=i(5893),u=i(7294),a=i(6677),d=i(2603),c=i(2857),v=i(1042),f=i(2453),h=i(3919),m=i(2701),Z=i(6685),g=i(3876),w=i(7908),p=i(9953);e.default=function(n){var e=(0,u.useState)({awards:null,nominees:null,votes:null}),i=e[0],_=e[1],x=(0,s.Z)((0,a.Kx)(v.Z.firestore().collection("noonies-awards").where("year","==",p.zs),{snapshotListenOptions:{includeMetadataChanges:!0}}),2),j=x[0],N=x[1],E=(0,s.Z)((0,a.d4)(v.Z.firestore().collection("noonies-categories").where("years","array-contains",p.zs),{snapshotListenOptions:{includeMetadataChanges:!0}}),2),y=E[0],z=E[1],C=(0,s.Z)((0,a.Xi)(v.Z.firestore().doc("noonies-misc/".concat(p.zs))),2),O=C[0],k=C[1],V=(0,u.useState)([]),S=V[0],X=V[1],b=(0,u.useState)(),H=(b[0],b[1]);return(0,u.useEffect)((function(){if(!N&&!z){var n,e=null!==(n=null===j||void 0===j?void 0:j.docs.map((function(n){return n.data()})))&&void 0!==n?n:[],s=e.reduce((function(n,e){var i;return(null===e||void 0===e?void 0:e.nominees)?n+(null===e||void 0===e||null===(i=e.nominees)||void 0===i?void 0:i.length):n}),0);_((0,t.Z)((0,o.Z)({},i),{awards:e.length,nominees:s}));var l=y.map((function(n){var i=e.filter((function(e){return e.category===n.slug})),o=i.filter((function(n){return n.featured})),t=i.filter((function(n){return!n.featured})),s=(0,r.Z)(o).concat((0,r.Z)(t));return{title:n.title,slug:n.slug,description:n.description,awards:s.slice(0,4)}})),u=l[0];l[0]=l[4],l[4]=u,u=l[1],l[1]=l[4],l[4]=u,X(l)}}),[N,z,j,y]),(0,u.useEffect)((function(){var n,e=null!==(n=null===j||void 0===j?void 0:j.docs.map((function(n){return n.data()})))&&void 0!==n?n:[],i=e.reduce((function(n,e){var i;return(null===e||void 0===e?void 0:e.nominees)?n+(null===e||void 0===e||null===(i=e.nominees)||void 0===i?void 0:i.length):n}),0);k||(_({votes:null===O||void 0===O?void 0:O.castVotes,awards:e.length,nominees:i}),H(O.allowVoting))}),[O,k]),(0,l.jsxs)(d.Z,{children:[(0,l.jsx)(g.Z,{}),(0,l.jsx)(h.Z,{count:i,showWinners:null===O||void 0===O?void 0:O.showWinners,isNominating:null===O||void 0===O?void 0:O.allowNominations,isVotingOpen:null===O||void 0===O?void 0:O.allowVoting}),!z&&(0,l.jsx)(f.Z,{isHome:!0,categories:y}),(0,l.jsx)(c.Z,{children:(0,l.jsx)("div",{className:"my-12 lg:mx-5 z-10",children:N||z?(0,l.jsx)(Z.Z,{}):S.length>0&&S.map((function(n,e){return(0,l.jsx)(m.Z,(0,o.Z)({isCurrentYear:2022===p.zs,isHome:!0},n),e)}))})}),(0,l.jsx)(w.Z,{})]})}}},function(n){n.O(0,[662,436,962,752,643,603,239,818,774,888,179],(function(){return e=9174,n(n.s=e);var e}));var e=n.O();_N_E=e}]);