PageSourceSearch

https://refocus-awards.com/_next/static/chunks/pages/dashboard/adm…/edit/[contest_slug]-6428bb3680cbf1bb.js

js refocus-awards.com collected 2026-10-02 06:58:44 UTC 118,196 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9518],{68244:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/admin/contests/edit/[contest_slug]",function(){return t(34825)}])},60718:function(e,n,t){"use strict";var i=t(43692),r=t(5447),a=t(44453),o=t.n(a),s=t(8014),l=t(97129),c=t(72263),u=t(29237),d=t(34237),p=t(33453),x=t(14970),h=t(56168),f=t(8403),v=t(49823),m=t(94644),g=t(14131),b=(0,m.Ry)({title:(0,m.Z_)().nullable()});n.Z=function(e){var n=e.uploadId,t=e.button,a=(0,l.qY)(),m=a.isOpen,j=a.onOpen,C=a.onClose,Z=(0,h.useState)(),y=Z[0],_=Z[1],k=(0,f.Z)({position:"top-right"}),S=function(e){var n="Something went wrong. Please try again.",t="error";200!==e&&201!==e||(n="Image credits have been updated.",t="success"),k({title:n,status:t})},w=function(){var e=(0,i.Z)(o().mark((function e(t){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.ZP)({path:"/api/uploads-update/".concat(n,"/"),method:"PATCH",body:{title:t.title||"",partial:!0}});case 2:i=e.sent,S(i.status),C();case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),E=(0,h.useCallback)((0,i.Z)(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.ZP)({path:"/api/uploads/".concat(n,"/")});case 2:t=e.sent.data,_((null===t||void 0===t?void 0:t.title)||"");case 4:case"end":return e.stop()}}),e)}))),[n]);return(0,h.useEffect)((function(){E()}),[E]),n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g.Z,{variant:"flat",size:"sm",onClick:j,children:t}),(0,s.jsxs)(c.u_,{isOpen:m,onClose:C,isCentered:!0,children:[(0,s.jsx)(c.ZA,{}),(0,s.jsx)(c.hz,{bg:"support1.4",borderRadius:"0",children:(0,s.jsx)(x.J9,{onSubmit:w,initialValues:{title:y},validationSchema:b,children:function(e){var n=e.isSubmitting;return(0,s.jsxs)(x.l0,{children:[(0,s.jsx)(c.fe,{children:(0,s.jsx)(p.Z,{name:"title",render:function(e){var n=e.field;return(0,s.jsx)(u.II,(0,r.Z)({maxLength:200,placeholder:"Image Credits"},n))}})}),(0,s.jsx)(c.mz,{children:(0,s.jsxs)(d.Kq,{direction:"row",spacing:"10px",children:[(0,s.jsx)(g.Z,{variant:"base.1.outline",size:"md",onClick:C,children:"Cancel"}),(0,s.jsx)(g.Z,{isLoading:n,size:"md",type:"submit",children:"Save"})]})})]})}})})]})]}):null}},51123:function(e,n,t){"use strict";var i=t(5447),r=t(99728),a=t(27427),o=t(8014),s=t(34237),l=t(56168),c=t(65035);n.Z=function(e){var n=e.delay,t=void 0===n?0:n,u=e.children,d=e.initialY,p=void 0===d?50:d,x=(0,a.Z)(e,["delay","children","initialY"]),h=(0,l.useState)(!1),f=h[0],v=h[1],m=(0,c.YD)({threshold:0}),g=m.ref,b=m.inView;return(0,l.useEffect)((function(){!f&&b&&v(!0)}),[b,f]),(0,o.jsx)(s.xu,(0,r.Z)((0,i.Z)({ref:g,transform:"translate3d(0px, ".concat(b||f?0:p,"px, 0px)"),opacity:b||f?1:0,transition:"0.5s ease-in-out ".concat(t,"s")},x),{children:u}))}},9211:function(e,n,t){"use strict";t.d(n,{Z:function(){return h}});var i=t(5447),r=t(99728),a=t(27427),o=t(8014),s=t(77567),l=t(56168),c=t(71246),u=t(31687),d=t(34237),p=t(39266),x=function(e){var n=e.visible,t=e.children,s=(0,a.Z)(e,["visible","children"]),x=(0,c.Z)().isMobile,h=(0,l.useRef)(null),f=(0,l.useRef)(!1),v=(0,l.useState)(!1),m=v[0],g=v[1],b=function(e){var n=h.current;if(n){var t=15,i=window.innerWidth,r=window.innerHeight,a=n.offsetHeight,o=n.offsetWidth,s=e.clientX+o+t,l=e.clientY+a+t,c=s>i-t?i-o-t:e.clientX+t,u=l>r-t?r-a-t:e.clientY+t;n.style.left=c+"px",n.style.top=u+"px"}};return(0,l.useEffect)((function(){return f.current=!0,function(){f.current=!1}}),[]),(0,l.useEffect)((function(){n?setTimeout((function(){f.current&&g(!0)}),x?0:1e3):g(!1)}),[x,n]),(0,l.useEffect)((function(){return n&&window.addEventListener("mousemove",b),function(){window.removeEventListener("mousemove",b)}}),[n]),n?(0,o.jsx)(u.h_,{children:(0,o.jsx)(d.xu,(0,r.Z)((0,i.Z)({bg:"base.1",color:"base.6",pointerEvents:"none",p:"5px 10px",borderRadius:"4px",ref:h,position:"fixed",zIndex:2020,h:"auto",whiteSpace:"nowrap",opacity:m?1:0,transition:(0,p.eR)("opacity")},s),{children:(0,o.jsx)(d.xv,{variant:"ctaSecondary",children:t})}))}):null},h=function(e){var n=e.caption,t=e.alt,u=(0,a.Z)(e,["caption","alt"]),d=(0,c.Z)().isMobile,p=(0,l.useState)(!1),h=p[0],f=p[1],v=function(){return f(!1)};return(0,l.useEffect)((function(){return h&&d&&window.addEventListener("scroll",v),function(){window.removeEventListener("scroll",v)}}),[d,h]),(0,o.jsxs)(o.Fragment,{children:[n?(0,o.jsx)(x,{visible:h,children:(0,o.jsx)("span",{children:"Credit: ".concat(n)})}):null,(0,o.jsx)(s.Z,(0,r.Z)((0,i.Z)({alt:t},u),{onMouseOver:function(){return f(!0)},onMouseLeave:function(){return f(!1)},onTouchStart:function(){return f((function(e){return!e}))}}))]})}},5731:function(e,n,t){"use strict";t.d(n,{V:function(){return m}});
1var i=t(43692),r=t(5447),a=t(99728),o=t(27427),s=t(44453),l=t.n(s),c=t(8014),u=t(72263),d=t(34237),p=t(23434),x=t(56168),h=t(21607),f=t(14131),v=function(e){return[{label:"Cancel",variant:"base.1.outline"},{label:"Delete",onClick:e,variant:"system.error.outline"}]},m=function(e){var n=e.title,t=void 0===n?"Are you sure?":n,i=e.body,a=void 0===i?"This action cannot be undone.":i,s=e.onDelete,l=(0,o.Z)(e,["title","body","onDelete"]);return(0,c.jsx)(g,(0,r.Z)({title:t,body:a,buttons:v(s)},l))},g=function(e){var n=e.title,t=void 0===n?"Are you sure?":n,s=e.body,v=e.maxW,m=void 0===v?"650px":v,g=e.open,b=e.setOpen,j=e.confirmDefault,C=void 0!==j&&j,Z=e.trigger,y=e.showOnce,_=e.buttons,k=(0,o.Z)(e,["title","body","maxW","open","setOpen","confirmDefault","trigger","showOnce","buttons"]),S=(0,x.useState)(!1),w=S[0],E=S[1],T=(0,x.useRef)(!1),I=(0,x.useState)(!1),D=I[0],P=I[1],R="undefined"!==typeof g?g:D,N="undefined"!==typeof b?b:P;(0,x.useEffect)((function(){return T.current=!0,function(){T.current=!1}}),[]);var A=(0,x.useRef)(null),L=(0,x.useRef)(null),z=(0,x.useCallback)((function(){return E((function(e){return!e}))}),[]);return(0,x.useEffect)((function(){if(y){var e=h.Z.getDataFromStorage(y);T.current&&E(!!e)}}),[y]),(0,c.jsxs)(c.Fragment,{children:[Z&&Z({setOpen:N}),(0,c.jsx)(u.aR,(0,a.Z)((0,r.Z)({isOpen:R,leastDestructiveRef:C?L:A,onClose:function(){return N(!1)},isCentered:!0},k),{children:(0,c.jsx)(u.dh,{h:"100vh",w:"100vw",children:(0,c.jsxs)(u._T,{maxW:m,m:{base:"0 20px",md:"0 30px"},py:{base:"20px",md:"30px"},children:[(0,c.jsx)(u.fY,{fontSize:"lg",fontWeight:"bold",px:{base:"30px",md:"60px"},children:(0,c.jsx)(d.xv,{children:t})}),(0,c.jsx)(u.iP,{py:{base:"10px",md:"20px"},px:{base:"30px",md:"60px"},children:(0,c.jsx)(d.kC,{direction:"column",width:"100%",children:"string"===typeof s?(0,c.jsx)(d.xv,{variant:"description",mb:"10px",children:s}):s})}),_&&(0,c.jsx)(u.xo,{px:{base:"30px",md:"60px"},children:(0,c.jsxs)(d.kC,{direction:"column",w:"100%",children:[y?(0,c.jsx)(p.XZ,{mb:"20px",isChecked:w,onChange:z,w:{base:"100%",md:"auto"},saturate:"sm",children:(0,c.jsx)(d.xv,{variant:"description",children:"Do Not Show This Message Again"})}):null,(0,c.jsx)(d.kC,{gap:"10px",w:"100%",children:_.map((function(e,n){var t=e.label,s=e.onClick,u=(0,o.Z)(e,["label","onClick"]);return(0,c.jsx)(f.Z,(0,a.Z)((0,r.Z)({ref:0===n?L:A,onClick:(0,i.Z)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=3;break}return e.next=3,s();case 3:0===n&&y&&w&&h.Z.saveDataToStorage(y,!0),N(!1);case 5:case"end":return e.stop()}}),e)}))),variant:0===n?"accent1.3.fill":"base.1.outline",size:"md",minW:"120px"},u),{children:t}),n)}))})]})})]})})}))]})};n.Z=g},10160:function(e,n,t){"use strict";var i=t(5447),r=t(99728),a=t(27427),o=t(8014),s=t(34237),l=t(79647),c=(0,t(56168).forwardRef)((function(e,n){var t=e.children,c=e.placeholder,u=e.containerProps,d=void 0===u?{}:u,p=(0,a.Z)(e,["children","placeholder","containerProps"]);return(0,o.jsxs)(s.kC,(0,r.Z)((0,i.Z)({position:"relative",direction:"column-reverse",w:"100%"},d),{children:[(0,o.jsx)(l.Ph,(0,r.Z)((0,i.Z)({},p),{ref:n,css:"\n          &:placeholder-shown + .placeholder {\n            opacity: 0;\n            transform: translateY(5px);\n          }\n        ",children:t})),c&&(0,o.jsx)(s.xv,{variant:"fieldsTitleS",color:"base_2.2",opacity:"1",transform:"translateY(0px)",transition:"opacity .1s linear, transform .1s linear",position:"absolute",top:"0",left:"0",pointerEvents:"none",children:c})]}))}));n.Z=c},53963:function(e,n,t){"use strict";var i=t(5447),r=t(99728),a=t(27427),o=t(8014),s=t(34237),l=t(30153),c=(0,t(56168).forwardRef)((function(e,n){var t=e.containerProps,c=void 0===t?{}:t,u=e.placeholderProps,d=void 0===u?{}:u,p=(0,a.Z)(e,["containerProps","placeholderProps"]);return(0,o.jsxs)(s.kC,(0,r.Z)((0,i.Z)({position:"relative",direction:"column-reverse"},c),{children:[(0,o.jsx)(l.g,(0,r.Z)((0,i.Z)({},p),{ref:n,css:"\n          &:placeholder-shown + .placeholder {\n            opacity: 0;\n            transform: translateY(5px);\n          }\n        "})),p.placeholder&&(0,o.jsx)(s.xv,(0,r.Z)((0,i.Z)({w:"100%",bg:p.bg,className:"placeholder",variant:"fieldsTitleS",color:"base_2.2",opacity:"1",transform:"translateY(0px)",transition:"opacity .1s linear, transform .1s linear",position:"absolute",top:"0",left:"0",pointerEvents:"none"},d),{children:p.placeholder}))]}))}));n.Z=c},34825:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return li},default:function(){return ci}});var i,r=t(8014),a=t(43692),o=t(5447),s=t(99728),l=t(27427),c=t(2746),u=t(44453),d=t.n(u),p=t(34237),x=t(37816),h=t(12803),f=t(40137),v=t(63940),m=t(27548),g=t(51578),b=t(26571),j=t(21350),C=t(85085),Z=t(30095),y=t(84911),_=t(56168),k=t(80174),S=t(65090),w=(0,C.Pi)((function(e){var n=e.index,t=Z.h_.contest,i=Z.h_.sponsors,a=(0,_.useMemo)((function(){return{title:"",description:"",url:"#",type:k.wF.AFFILIATE,image:null,order:0,contest:null===t||void 0===t?void 0:t.id}}),[null===t||void 0===t?void 0:t.id]),l=(0,_.useCallback)((function(){(0,j.z)((function(){return Z.h_.sponsors=(0,y.Z)(i.slice(0,n)).concat([(0,s.Z)((0,o.Z)({},a),{id:(0,S.kb)(),order:n})],(0,y.Z)(i.slice(n)))}))}),[n,a,i]);return(0,r.jsx)(p.kC,{w:"100%",justify:"center",opacity:.2,cursor:"pointer",position:"relative",transition:"opacity 0.25s ease-in-out",m:"20px 0",p:"20px 0",onClick:l,_before:{content:"''",position:"absolute",left:"50%",right:"50%",top:"50%",height:"1px",bg:"base.1",transition:"left 0.25s ease-in-out, right 0.25s ease-in-out",zIndex:-1},_hover:{opacity:1,_before:{left:0,right:0}},children:(0,r.jsx)(f.Z,{icon:"plusboxedicon",fill:"base.1",bg:"support1.4"})})})),E=t(8344),T=t(65034),I=t(24113),D=t(5731),P=t(10160),R=t(98421),N=t(8403),A=t(49823),L=t(21293),z=t(86584),O=t(77567),F=t(42003),K=t(90319),M=t(14131),q=t(60718),U=function(e){var n,t,i=e.text,l=e.image,u=e.onAdd,x=e.onRemove,h=e.placeholderProps,v=void 0===h?{}:h,m=e.previewProps,g=void 0===m?{}:m,b=e.hideIcon,j=void 0!==b&&b,C=e.hidePopup,Z=void 0!==C&&C,y=(0,_.useState)(!1),k=y[0],S=y[1],w=(0,_.useCallback)(function(){var e=(0,a.Z)(d().mark((function e(n){var t,i,r;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(0,c.Z)(n,1),i=t[0],S(!0),e.prev=2,e.next=5,(0,K.Ix)(i);case 5:r=e.sent,u(r),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error(e.t0);case 12:S(!1);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}
1)));return function(n){return e.apply(this,arguments)}}(),[u]),E=(0,F.uI)({onDrop:w,accept:K.KL.join(", "),noDrag:!0,maxSize:K.Tb}),T=E.getInputProps,I=E.open;return(null===l||void 0===l?void 0:l.url)?(0,r.jsxs)(p.kC,(0,s.Z)((0,o.Z)({position:"relative",h:"300px",border:"1px solid",borderColor:"base_2.2",borderRadius:"4px"},g),{children:[(0,r.jsxs)(p.xu,{m:"20px",position:"relative",width:"100%",children:[(0,r.jsx)(O.Z,{objectFit:"contain",src:(0,K.Jn)(null===l||void 0===l||null===(n=l.sizes)||void 0===n||null===(t=n.small)||void 0===t?void 0:t.url),layout:"fill",alt:l.name}),Z?null:(0,r.jsx)(q.Z,{uploadId:l.id,button:(0,r.jsx)(z.hU,{"aria-label":"Edit Image",variant:"flat",icon:(0,r.jsx)(f.Z,{icon:"editicon",size:20,fill:"base.6"}),bg:"base.4",borderRadius:"50%",mt:"5px",ml:"5px",p:"0",minW:"0",minH:"0",w:"40px",height:"40px",as:"span"})})]}),(0,r.jsx)(p.kC,{align:"center",justify:"center",bg:"system.error",h:"40px",w:"40px",borderRadius:"50%",position:"absolute",top:"25px",right:"25px",cursor:"pointer",onClick:x,children:(0,r.jsx)(f.Z,{icon:"trashicon",size:20,fill:"base.6"})})]})):(0,r.jsx)(p.Kq,(0,s.Z)((0,o.Z)({h:"300px",dir:"column",spacing:"20px",align:"center",justify:"center",borderRadius:"4px",border:"1px solid",borderColor:"base_2.2",p:"30px"},v),{children:k?(0,r.jsx)(L.D8,{isIndeterminate:!0,color:"accent1.3"}):(0,r.jsxs)(r.Fragment,{children:[j?null:(0,r.jsx)(f.Z,{icon:"upload",size:50}),(0,r.jsx)(p.xv,{variant:"description",maxW:"300px",align:"center",children:i}),(0,r.jsx)(M.Z,{variant:"base.1.outline",size:"md",onClick:function(){return I()},children:"Upload Image"}),(0,r.jsx)("input",(0,o.Z)({},T()))]})}))},W={w:"300px",h:"300px",minW:"300px",px:"0px"},B=(0,C.Pi)((function(e){var n=e.sponsor,t=Z.h_.sponsors,i=(0,N.Z)(),l=(0,b.nB)(n),c=l.attributes,u=l.listeners,x=l.setNodeRef,h=l.transform,v=l.transition,m=l.isDragging,g=(0,_.useMemo)((function(){return t.findIndex((function(e){return e.id===n.id}))}),[n.id,t]),C=(0,_.useCallback)((0,a.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null===n||void 0===n?void 0:n.realId)){e.next=7;break}return e.next=3,(0,A.ZP)({path:"/api/admin/sponsors/".concat(n.realId,"/"),method:"DELETE"});case 3:e.sent.status===R.RS.HTTP_204_NO_CONTENT?(i({status:"success",title:"Sponsor was deleted"}),(0,j.z)((function(){Z.h_.sponsors.splice(g,1)}))):i({status:"error",title:R.FI}),e.next=8;break;case 7:(0,j.z)((function(){Z.h_.sponsors.splice(g,1)})),i({status:"success",title:"Sponsor was deleted"});case 8:case"end":return e.stop()}}),e)}))),[g,n.realId,i]),y=(0,_.useCallback)((function(e,n){(0,j.z)((function(){Z.h_.sponsors[g][e]=n}))}),[g]),S=(0,_.useCallback)((function(e){(0,j.z)((function(){Z.h_.sponsors[g][e]=null}))}),[g]),L=(0,_.useCallback)((function(e,n){(0,j.z)((function(){Z.h_.sponsors[g][e]=n.target.value}))}),[g]),z=function(e,n){(0,j.z)((function(){Z.h_.sponsors[g].additional_meta[e]=n}))},O={transform:T.ux.Transform.toString(h),transition:v},F=n.id,K=n.name,M=n.description,q=n.url,B=n.type,Y=(0,_.useCallback)((function(e){return{text:"Upload ".concat("image"===e?"Dark":"Light"," image"),image:n[e],onAdd:function(n){return y(e,n)},onRemove:function(){return S(e)},placeholderProps:W,previewProps:W}}),[y,S,n]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w,{index:g}),(0,r.jsxs)(p.kC,{ref:x,style:O,position:"relative",role:"group",w:"100%",bg:"support1.4",zIndex:m?9:1,gap:"40px",border:"1px solid",borderRadius:"4px",p:"20px 0",borderColor:Z.h_.sponsorHasChanges(F)?"red.200":"transparent",children:[(0,r.jsxs)(p.kC,{direction:"column",opacity:"0",transition:"opacity .25s ease-in-out",_groupHover:{opacity:1},children:[(0,r.jsx)(p.kC,(0,s.Z)((0,o.Z)({cursor:m?"grabbing":"grab",w:"40px",h:"40px",align:"center",justify:"center"},c,u),{children:(0,r.jsx)(f.Z,{icon:"draggableicon",fill:"base.1"})})),(0,r.jsx)(D.V,{body:"You are about to delete this Sponsor.",onDelete:C,trigger:function(e){var n=e.setOpen;return(0,r.jsx)(p.kC,{w:"40px",h:"40px",align:"center",justify:"center",cursor:"pointer",onClick:function(){return n(!0)},children:(0,r.jsx)(f.Z,{icon:"trashicon",fill:"base.1"})})}})]}),(0,r.jsxs)(E.mQ,{variant:"unstyled",children:[(0,r.jsxs)(E.td,{borderBottomWidth:1,borderBottomColor:"base_2.2",children:[(0,r.jsx)(E.OK,{py:"15px",flex:1,_selected:{color:"accent1.2"},children:(0,r.jsx)(p.xv,{variant:"ctaPrimary",children:"Dark Image"})}),(0,r.jsx)(E.OK,{py:"15px",flex:1,_selected:{color:"accent1.2"},children:(0,r.jsx)(p.xv,{variant:"ctaPrimary",children:"Light Image"})})]}),(0,r.jsx)(E.cb,{mt:"-1.5px",height:"2px",bg:"accent1.2"}),(0,r.jsx)(E.nP,{children:["image","light_image"].map((function(e){return(0,r.jsx)(E.x4,{px:"0",children:(0,r.jsx)(U,(0,o.Z)({},Y(e)))},e)}))})]}),(0,r.jsxs)(p.kC,{direction:"column",w:"100%",gap:"10px",children:[(0,r.jsxs)(P.Z,{placeholder:"Sponsor Type",value:B,onChange:function(e){(0,j.z)((function(){Z.h_.sponsors[g].type=e.target.value}))},children:[(0,r.jsx)("option",{value:k.wF.AFFILIATE,children:"Affiliate"}),(0,r.jsx)("option",{value:k.wF.AWARD,children:"Award"}),(0,r.jsx)("option",{value:k.wF.TITLE,children:"Title"})]}),(0,r.jsx)(I.Z,{label:"Name",value:K||"",variant:"dark",onChange:function(e){return L("name",e)}}),(0,r.jsx)(I.Z,{label:"Description",value:M||"",variant:"dark",onChange:function(e){return L("description",e)}}),(0,r.jsx)(I.Z,{label:"Link",value:q||"",variant:"dark",onChange:function(e){return L("url",e)}}),n.type===k.wF.TITLE?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I.Z,{label:"Button Label",value:n.additional_meta.button_label||"",variant:"dark",onChange:function(e){return z("button_label",e.target.value)}}),(0,r.jsx)(I.Z,{label:"Button Url",value:n.additional_meta.button_url||"",variant:"dark",onChange:function(e){return z("button_url",e.target.value)}})]}):null]})]})]})})),Y=(0,C.Pi)((function(){var e=Z.h_.sponsors,n=(0,g.Dy)((0,g.VT)(g.we),(0,g.VT)(g.Lg,{coordinateGetter:b.is}));return(0,r.jsx)(p.kC,{direction:"column",align:"flex-start",children:(0,r.jsx)(g.LB,{sensors:n,collisionDetection:g.pE,onDragEnd:function(n){var t=n.active,i=n.over;if(t.id!==(null===i||void 0===i?void 0:i.id)){var r=e.slice(),a=r.findIndex((function(e){return"".concat(e.id)==="".concat(t.id)})),o=r.findIndex((function(e){return"".concat(e.id)==="".concat(null===i||void 0===i?void 0:i.id)}));(0,j.z)((function(){return Z.h_.sponsors=(0,b.Rp)(r,a,o)}))}},children:(0,r.jsxs)(b.Fo,{items:e,strategy:b.qw,children:[e.map((function(e,n){return(0,r.jsx)(B,{sponsor:e},"".concat(n))})),(0,r.jsx)(w,{index:e.length})]})})})})),H=t(62139),G=new(function(){function e(){(0,H.Z)(this,e),this.reset(),(0,j.rC)(this,{currentSlide:j.LO,editingCouponId:j.LO,coupons:j.LO,reset:j.aD})}return e.prototype.reset=function(){this.currentSlide=null,this.editingCouponId=null,this.coupons=[]},e}()),J=t(17325),V=t(71246),X=t(33609),Q=t(78846),$=t(82857),ee=t(60461),ne=function(e){var n=e.children,t=(0,l.Z)(e,["children"]);return(0,r.jsx)(p.kC,(0,s.Z)((0,o.Z)({direction:{base:"column",md:"row"},sx:{columnCount:{md:2},gap:{md:"40px",lg:"135px"}}},t),{children:n}))},te=t(4822),ie=(0,y.Z)(te.GF),re=function(e){var n=e.tooltip,t=(0,l.Z)(e,["tooltip"]);return(0,r.jsxs)(p.kC,{align:"center",children:[(0,r.jsx)(Q.Z,(0,o.Z)({},t)),n?(0,r.jsx)(p.xu,{ml:"20px",children:(0,r.jsx)($.Z,{label:n,placement:"right",children:(0,r.jsx)(f.Z,{icon:"infoicon",size:18})})}):null]})},ae=(0,ee.Pi)((function(e){var n=e.buttonLabel,t=e.onSave,i=e.loading,a=function(e){(0,j.z)((function(){Z.h_.data[e]=!Z.h_.data[e]}))};return(0,r.jsxs)(ne,{transition:"padding .2s linear",p:{base:"10px 20px",lg:"10px 60px"},justify:"space-between",align:{base:"flex-start",lg:"center"}
1,position:"fixed",bottom:"0px",w:"100vw",pr:{base:"20px",lg:"60px"},left:"0",bg:"support1.4",borderTop:"1px solid",borderTopColor:"base_2.4",zIndex:9,children:[(0,r.jsxs)(p.Kq,{direction:"row",spacing:"20px",pl:"60px",display:{base:"none",lg:"flex"},children:[(0,r.jsx)(P.Z,{placeholder:"Template",containerProps:{w:"200px"},value:Z.h_.data.template,onChange:function(e){return(0,j.z)((function(){Z.h_.data.template=e.target.value}))},children:ie.map((function(e){var n=e.value,t=e.label;return(0,r.jsx)("option",{value:n,children:t},n)}))}),(0,r.jsx)(re,{label:"Private",isChecked:!Z.h_.data.is_published,tooltip:"Enabling this checkbox will hide the contest from everyone except admins",onChange:function(){return a("is_published")}}),(0,r.jsx)(Q.Z,{label:"Coming Soon",isChecked:Z.h_.data.coming_soon,onChange:function(){return a("coming_soon")}}),(0,r.jsx)(Q.Z,{label:"Viewer Discretion",isChecked:Z.h_.data.viewer_discretion_advised,onChange:function(){return a("viewer_discretion_advised")}})]}),(0,r.jsx)(M.Z,{variant:"accent1.3.fill",size:"md",isLoading:i,onClick:t,leftIcon:(0,r.jsx)(f.Z,{icon:"checkboxicon",fill:"base.1",size:20}),children:n})]})})),oe=t(31811),se=t(76480),le=t(30975),ce=t(60693),ue=t(45966),de=t(29237),pe=function(e){var n=e.label,t=void 0===n?"":n,i=e.leftIcon,a=void 0===i?null:i,s=e.rightIcon,c=void 0===s?null:s,u=(0,l.Z)(e,["label","leftIcon","rightIcon"]),d={pt:"19px",pb:"19px",pl:a?"40px":"0",pr:c?"40px":"0"};return(0,r.jsxs)(de.BZ,{position:"relative",children:[a?(0,r.jsx)(de.Ui,{pointerEvents:"none",p:"0",position:"absolute",left:"0",top:"5px",children:a}):null,(0,r.jsx)(I.Z,(0,o.Z)({placeholder:t},d,u)),c?(0,r.jsx)(de.xW,{pointerEvents:"none",p:"0",position:"absolute",right:"0",top:"5px",children:c}):null]})},xe=function(e){var n=e.label,t=e.value,i=e.options,a=e.buttonProps,l=i.findIndex((function(e){return e.value===t})),c=(0,_.useState)(l>-1?l:0),u=c[0],d=c[1];return(0,r.jsxs)(ue.v2,{placement:"bottom",matchWidth:!0,children:[(0,r.jsx)(ue.j2,(0,s.Z)((0,o.Z)({},a),{css:{".chakra-input":{color:"white !important"}},children:(0,r.jsx)(pe,{isReadOnly:!0,value:i[u].label,label:n,pb:"10px",rightIcon:(0,r.jsx)(f.Z,{icon:"smallarrow",size:8,fill:"base.6"})})})),(0,r.jsx)(ue.qy,{borderRadius:"2px",p:"0",color:"base.1",defaultValue:"enabled",zIndex:9,children:i.map((function(e,n){var t=e.value,a=e.label,o=e.callback;return(0,r.jsx)(ue.sN,{p:"10px 20px",_focus:{bg:"base.1",color:"base.6"},css:u===n?{fontWeight:900}:{},onClick:function(){return function(e,n){var t=i.findIndex((function(n){return n.value===e}));d(t),n()}(t,o||function(){return null})},value:"enabled",children:a},"".concat(t,"--").concat(n))}))})]})},he=t(65817),fe=t(3136),ve=t(34843),me=t(12048),ge=t(41405),be=function(e){var n=e.defaultColor,t=void 0===n?"#fff":n,i=e.expanded,a=void 0!==i&&i,s=e.callback,c=(0,l.Z)(e,["defaultColor","expanded","callback"]),u=(0,_.useState)((0,me.rW)(t)),d=u[0],x=u[1],h=Object.values(ge.Z).reduce((function(e,n){var t=Object.values(n).map((function(e){return e}));return(0,y.Z)(t).concat((0,y.Z)(e))}),[]),f=(0,_.useMemo)((function(){return(0,r.jsx)(p.xu,{width:"24px",height:"24px",bg:(0,me.JX)(d),borderRadius:"100%"})}),[d]),v=(0,_.useMemo)((function(){return a?(0,r.jsxs)(de.BZ,{children:[(0,r.jsx)(de.xH,{top:"18px",children:f}),(0,r.jsx)(de.II,{value:"Color",variant:"light",isReadOnly:!0,cursor:"pointer",userSelect:"none"})]}):(0,r.jsx)(p.xu,{children:f})}),[a,f]);return(0,r.jsxs)(fe.J2,{placement:"bottom-end",children:[(0,r.jsx)(fe.xo,{children:v}),(0,r.jsx)(fe.yk,{w:"auto",color:"base.1",borderWidth:"0",boxShadow:"none !important",children:(0,r.jsx)(ve.xS,(0,o.Z)({color:d,onChange:function(e){return x((n=e).rgb),void(s&&s(n));var n},presetColors:(0,y.Z)(Array.from(new Set(h))),width:"300px"},c))})]})},je=(0,C.Pi)((function(e){var n=e.level,t=(0,he.Z)("contest").t,i=Z.h_.editPrizeData,a=i.index,l=i.primaryKey,c=Z.h_.awardUseSame&&n===k.Kq.PROFESSIONAL,u=Z.h_.data.awards[l][a].level,d=(0,_.useMemo)((function(){return u[n]}),[n,u]),x=(0,_.useCallback)((function(e,t){(0,j.z)((function(){c&&(u[k.Kq.NON_PROFESSIONAL][e]=t),u[n][e]=t}))}),[n,u,c]);return(0,r.jsxs)(p.kC,{direction:"column",borderWidth:"1px",borderColor:"base.2",borderStyle:"solid",borderRadius:"4px",children:[(0,r.jsx)(p.kC,(0,s.Z)((0,o.Z)({p:"20px"},Ce),{children:(0,r.jsx)(m.Z,{label:d.name,bg:d.color})})),(0,r.jsxs)(p.kC,{borderBottomColor:"base.2",borderBottomStyle:"solid",direction:"column",children:[(0,r.jsxs)(p.kC,{direction:"column",p:"20px",children:[(0,r.jsx)(I.Z,{value:d.name,mb:"10px",variant:"light",placeholder:"Label Name for ".concat(t(n)," Entry"),onChange:function(e){var n=e.target;return x("name",n.value)}}),(0,r.jsx)(be,{defaultColor:d.color,callback:function(e){return x("color",e.hex)},disableAlpha:!0,expanded:!0})]}),["has_trophy","has_certificate","has_cash","has_interview","has_review","is_public","press_release","free_entry_credit","email_feature"].map((function(e){return(0,r.jsxs)(p.kC,{w:"100%",direction:"column",borderTopWidth:"1px",p:"20px 20px",borderTopColor:"base.2",children:[(0,r.jsx)(Q.Z,{label:t(e),font:"fieldsTitleL",justifyContent:"space-between",variant:"light",flex:1,isChecked:u[n][e],onChange:function(){return x(e,!u[n][e])},flexDirection:"row-reverse",p:"10px 0",css:"\n                .chakra-checkbox__label {\n                  margin-left: 0;\n                }\n              "}),"has_cash"===e&&u[n][e]?(0,r.jsx)(I.Z,{placeholder:"Set Amount",type:"number",value:"".concat((0,J.Wy)(+u[n].cash_amount||0)),containerProps:{mt:"10px"}
1,variant:"light",onChange:function(e){var n=e.target;return x("cash_amount","".concat((0,J.nP)(+n.value||0)))}}):null,"has_trophy"===e&&u[n][e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I.Z,{placeholder:"Paid Trophy URL",containerProps:{mt:"10px"},value:u[n].secondary_trophy_url,variant:"light",onChange:function(e){var n=e.target;return x("secondary_trophy_url",n.value)}}),(0,r.jsx)(p.xv,{variant:"overline",mt:"5px",color:"base_2.2",children:"Leave this field blank if the trophy is granted for free. If this is a paid trophy, add the Shopify product link here."})]}):null]},e)}))]})]})})),Ce={borderBottomStyle:"solid",borderBottomColor:"base.2",borderBottomWidth:"1px"},Ze=(0,C.Pi)((function(e){var n=e.onClose,t=(0,he.Z)("contest").t,i=Z.h_.editPrizeData,a=i.index,o=i.primaryKey,s=(0,_.useState)(!0),c=s[0],u=s[1],d=(0,_.useState)(!0),x=d[0],h=d[1],f=(0,_.useCallback)((function(){var e=Z.h_.data.awards[o][a].level[k.Kq.NON_PROFESSIONAL],n=(e.id,(0,l.Z)(e,["id"])),t=Z.h_.data.awards[o][a].level[k.Kq.PROFESSIONAL],i=(t.id,(0,l.Z)(t,["id"]));u(JSON.stringify(n)===JSON.stringify(i)),h(!1)}),[a,o]);return(0,_.useEffect)((function(){f()}),[f]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:"Add Prize",icon:ce.Z,iconSize:20,onClose:n}),(0,r.jsx)(le.aF,{pl:"0",pr:"0",align:"flex-start",children:(0,r.jsxs)(p.Kq,{spacing:"20px",direction:"column",p:"0px 30px 20px 30px",w:"100%",children:[(0,r.jsx)(p.xv,{variant:"numeralsS",children:t(k.Kq.PROFESSIONAL)}),(0,r.jsx)(je,{level:k.Kq.PROFESSIONAL}),(0,r.jsx)(p.xv,{variant:"numeralsS",children:t(k.Kq.NON_PROFESSIONAL)}),!x&&(0,r.jsx)(xe,{label:"Entry Type Settings",value:c?"same_as_professional":"custom",options:[{label:"Same as Professional",value:"same_as_professional",callback:function(){u(!0),(0,j.z)((function(){Z.h_.data.awards[o][a].level[k.Kq.NON_PROFESSIONAL]=Z.h_.data.awards[o][a].level[k.Kq.PROFESSIONAL]}))}},{label:"Custom",value:"custom",callback:function(){return u(!1)}}],buttonProps:{p:"20px",borderWidth:"1px",borderRadius:"4px",alignItems:"center",borderColor:"base.2"}}),c?null:(0,r.jsx)(je,{level:k.Kq.NON_PROFESSIONAL})]})})]})}));!function(e){e.EDIT="EDIT"}(i||(i={}));var ye,_e=function(e){return[{key:i.EDIT,component:function(n){var t=n.navToSlideKey;return(0,r.jsx)(Ze,{navToSlideKey:t,onClose:e})}}]},ke=(0,C.Pi)((function(e){var n=e.index,t=e.primaryKey,i=(0,_.useCallback)((function(){(0,j.z)((function(){Z.h_.editPrizeData={index:n,primaryKey:t}}
1))}),[n,t]);return(0,r.jsx)(se.Z,{trigger:function(e){var n=e.onOpen;return(0,r.jsx)(f.Z,{size:20,icon:"circlearrowright",onClick:function(){i(),n()}})},children:function(e){var n=e.onClose;return(0,r.jsx)(le.ZP,{slides:_e(n)})}})})),Se=(0,C.Pi)((function(e){var n=e.title,t=e.enabled,i=e.onChange,a=e.config,c=void 0===a?[]:a,u=e.primaryKey,d=(0,he.Z)("common").t,x=(0,_.useCallback)((function(e){var n=e[k.Kq.PROFESSIONAL],t=(n.id,(0,l.Z)(n,["id"])),i=e[k.Kq.NON_PROFESSIONAL],r=(i.id,(0,l.Z)(i,["id"]));return JSON.stringify(t)===JSON.stringify(r)}),[]);return(0,r.jsxs)(p.kC,{w:"100%",mb:"60px",_last:{mb:0},direction:"column",children:[(0,r.jsxs)(p.kC,{justify:"space-between",align:"center",w:"100%",mb:"20px",children:[(0,r.jsx)(p.xv,{variant:"numeralsTiny",children:n}),(0,r.jsx)(oe.r,{variant:"dark",onChange:i,isChecked:t})]}),t?(0,r.jsx)(p.kC,{borderWidth:"1px",borderStyle:"solid",borderColor:"base_2.3",borderRadius:"4px",direction:"column",children:c.map((function(e,n){var t=e.enabled,i=e.label,a=e.level,l={opacity:t?1:.2};return(0,r.jsx)(p.kC,{borderBottomWidth:"1px",borderBottomStyle:"solid",borderBottomColor:"base_2.3",_last:{borderBottomWidth:0},p:"10px",direction:"column",children:(0,r.jsxs)(p.kC,(0,s.Z)((0,o.Z)({align:"center",flex:"1"},l),{children:[(0,r.jsx)(Q.Z,{label:"",mr:"20px",isChecked:t,onChange:function(){return function(e,n){(0,j.z)((function(){var t=Z.h_.data.awards[u].findIndex((function(n){return n.label===e}));t>-1&&(Z.h_.data.awards[u][t].enabled=!n)}))}(i,t)}}),(0,r.jsx)(p.xv,{variant:"numeralsS",flex:"1",children:d(i)}),x(a)?(0,r.jsx)(m.Z,{bg:a[k.Kq.PROFESSIONAL].color,label:a[k.Kq.PROFESSIONAL].name,mr:"20px"}):(0,r.jsx)(r.Fragment,{children:[k.Kq.PROFESSIONAL,k.Kq.NON_PROFESSIONAL].map((function(e){return(0,r.jsxs)(p.kC,{align:"center",children:[(0,r.jsxs)(p.xv,{variant:"numeralsTiny",mr:"5px",children:[d(e),":"]}),(0,r.jsx)(m.Z,{bg:a[e].color,label:a[e].name,mr:"20px"})]},e)}))}),(0,r.jsx)(p.xu,{css:{pointerEvents:t?"auto":"none",cursor:t?"pointer":"not-allowed"},children:(0,r.jsx)(ke,{primaryKey:u,index:n})})]}))},n)}))}):null]})})),we={categoryWinners:"Category Winners",grandWinners:"Grand Prize Winners"},Ee=(0,C.Pi)((function(){var e=Z.h_.data.awards,n=e.judgeLimit,t=e.honorableMentionsLimit,i=function(e){var n=e.key,t=e.value;return(0,j.z)((function(){return Z.h_.data.awards[n]=t}))};return(0,r.jsxs)(ne,{children:[(0,r.jsxs)(p.kC,{direction:"column",w:"100%",children:[(0,r.jsx)(p.xv,{mb:"10px",variant:"numeralsTiny",children:"How many Images should get to Judges per Category"}),(0,r.jsx)(I.Z,{placeholder:"Choose Number",value:n||"",onChange:function(e){var n=e.target.value;return i({key:"judgeLimit",value:+n})}}),(0,r.jsx)(p.xv,{mt:"20px",mb:"10px",variant:"numeralsTiny",children:"Honorable Mentions per Category"}),(0,r.jsx)(I.Z,{placeholder:"Choose Number",type:"number",value:t||"",onChange:function(e){var n=e.target.value;return i({key:"honorableMentionsLimit",value:+n})}})]}),(0,r.jsxs)(p.kC,{w:"100%",direction:"column",children:[["categoryWinners","grandWinners"].map((function(n,t){return(0,r.jsx)(Se,{primaryKey:n,title:we[n],enabled:e["".concat(n,"Enabled")],onChange:function(){return function(n){(0,j.z)((function(){Z.h_.data.awards[n]=!e[n]}))}("".concat(n,"Enabled"))},config:e[n]},"".concat(n,"--").concat(t))})),(0,r.jsxs)(p.kC,{mt:"40px",items:"center",gap:"12px",children:[(0,r.jsx)(Q.Z,{label:"Show Portfolio Review Benefit",isChecked:Z.h_.data.show_portfolio_review,onChange:function(){return(0,j.z)((function(){Z.h_.data.show_portfolio_review=!Z.h_.data.show_portfolio_review}))}}),(0,r.jsx)($.Z,{label:(0,r.jsxs)(p.kC,{direction:"column",gap:"7px",children:[(0,r.jsx)("img",{src:"/images/portfolio-review/benefits.png",alt:""}),(0,r.jsx)("img",{src:"/images/portfolio-review/table.png",alt:""})]}),children:(0,r.jsx)(f.Z,{icon:"infoicon",size:16})})]})]})]})})),Te=function(e){var n=e.items,t=e.defaultIndex,i=void 0===t?0:t,a=(0,l.Z)(e,["items","defaultIndex"]),c=(0,_.useState)(i),u=c[0],d=c[1];
1return(0,r.jsxs)(E.mQ,(0,s.Z)((0,o.Z)({onChange:function(e){return d(e)},isLazy:!0,index:u},a),{children:[(0,r.jsx)(E.td,{mb:"20px",border:"1px solid",borderColor:"base.1",borderRadius:"4px",overflow:"hidden",children:n.map((function(e,n){var t=e.title,i=e.disabled,a=n===u;return(0,r.jsx)(E.OK,{_focus:{boxShadow:"none"},flex:1,bg:a?"support1.3":"transparent",p:"10px 0",color:"base.1",borderBottom:"none",mb:"0",borderLeft:n>0?"1px solid":"",borderLeftColor:"base.1",isDisabled:i,children:(0,r.jsx)(p.xv,{color:"base.1",variant:a?"fieldsInputValue":"fieldsTitleL",children:t})},"tab-title--".concat(t,"-").concat(n))}))}),(0,r.jsx)(E.nP,{children:n.map((function(e,n){var t=e.body;return(0,r.jsx)(E.x4,{p:"0",children:t&&("function"===typeof t?t(n===u):t)},"tabs-body--".concat(n))}))})]}))},Ie=function(e){var n=e.label,t=e.onClick,i=(0,l.Z)(e,["label","onClick"]),a=(0,me.rd)("base.1");return(0,r.jsxs)(p.kC,(0,s.Z)((0,o.Z)({p:"0px 10px",height:"60px",onClick:t,border:"1px solid",borderColor:"base_2.2",borderRadius:"4px",_hover:{borderColor:"base.1"},cursor:"pointer",transition:"border-color .2s linear",justify:"space-between",align:"center",css:"\n        path {\n          transition: fill 0.2s linear;\n        }\n        &:hover {\n          path {\n            fill: ".concat(a," !important;\n          }\n        }\n      ")},i),{children:[(0,r.jsx)(p.xv,{variant:"fieldsTitleL",children:n}),(0,r.jsx)(f.Z,{icon:"plusboxedicon"})]}))},De=t(905),Pe=t(20570),Re=t.n(Pe),Ne=function(e){var n=e.navToSlideKey,t=e.categories,i=e.setCategories,a=(0,_.useState)(!1),o=a[0],s=a[1],l=(0,_.useState)(""),c=l[0],u=l[1],d=(0,_.useCallback)((function(){var e=(t||[]).filter((function(e){return e.name.toLowerCase().includes(c)}));i(e)}),[t,c,i]);return(0,_.useEffect)((function(){Re()(d,350)()}),[d,c]),(0,r.jsxs)(p.kC,{mb:"20px",flexWrap:"wrap",justify:"space-between",pt:"20px",position:"relative",children:[(0,r.jsx)(M.Z,{variant:"flat",leftIcon:(0,r.jsx)(f.Z,{icon:"searchicon",fill:"base.6"}),size:"sm",onClick:function(){return s(!0)},children:"Search"}),(0,r.jsx)(M.Z,{variant:"flat",leftIcon:(0,r.jsx)(f.Z,{icon:"plusboxedicon",fill:"base.6"}),size:"sm",onClick:function(){return n(ye.ADD)},children:"Add New"}),(0,r.jsx)(M.Z,{variant:"flat",leftIcon:(0,r.jsx)(f.Z,{icon:"editicon",size:20,fill:"base.6"}),size:"sm",onClick:function(){return n(ye.EDIT)},children:"Edit"}),o&&(0,r.jsxs)(de.BZ,{position:"absolute",top:"-3px",left:"0",w:"100%",height:"100%",mt:"10px",bg:"base.1",children:[(0,r.jsx)(de.Z8,{top:"auto",bottom:"0px",height:"85%",children:(0,r.jsx)(f.Z,{icon:"searchicon",fill:"base.6"})}),(0,r.jsx)(de.II,{variant:"light",pl:"34px",placeholder:"Search",autoFocus:!0,value:c,onChange:function(e){var n=e.target.value;return u(n)}}),(0,r.jsx)(de.xH,{top:"auto",bottom:"0px",height:"85%",children:(0,r.jsx)(f.Z,{icon:"closeicon",cursor:"pointer",onClick:function(){s(!1)},size:18,fill:"base.6"})})]})]})},Ae=function(e){var n=e.category,t=e.selectedIndex,i=e.onAdd,a=e.onRemove,o=t>-1,s=function(){o?a(t):i(n)};return(0,r.jsx)(x.Qd,{borderTopWidth:0,borderBottomColor:"transparent",children:function(e){var t=e.isExpanded;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(x.KF,{p:{base:"20px 0px",lg:"20px 0px"},_focus:{boxShadow:"none"},flex:1,borderBottomWidth:1,borderBottomColor:"base.2",children:[(0,r.jsxs)(p.kC,{flex:"1",justify:"flex-start",align:"center",children:[(0,r.jsx)(Q.Z,{isChecked:o,variant:"light",onCh
1ange:s}),(0,r.jsx)(p.xv,{variant:"numeralsS",textAlign:"left",ml:"10px",children:n.name})]}),(0,r.jsx)(p.xu,{transform:"rotate(".concat(t?180:0,"deg)"),children:(0,r.jsx)(f.Z,{icon:"triangledown"})})]}),(0,r.jsx)(x.Hk,{p:{base:"20px 0",lg:"20px 0px 20px 30px"},children:(0,r.jsx)(p.xv,{variant:"description",color:n.description?"base.6":"base.4",children:n.description||"No Description"})})]})}},"category--".concat(n.id))},Le=function(e){var n=e.navToSlideKey,t=e.onClose,i=Z.h_.availableCategories,s=(0,_.useState)(!1),l=s[0],c=s[1],u=(0,_.useState)([]),h=u[0],f=u[1],v=(0,_.useState)([]),m=v[0],g=v[1],b=(0,_.useCallback)((0,a.Z)(d().mark((function e(){var n,t;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i){e.next=7;break}return c(!0),e.next=4,(0,A.ZP)({path:"/api/contests/categories"});case 4:n=e.sent,t=n.data,Array.isArray(t)&&(0,j.z)((function(){Z.h_.availableCategories=t}));case 7:f(Z.h_.availableCategories||[]),g(Z.h_.data.categories.professional),c(!1);case 10:case"end":return e.stop()}}),e)}))),[i]);(0,_.useEffect)((function(){b()}),[b]);var C=(0,_.useCallback)((function(){(0,j.z)((function(){Z.h_.data.categories.professional=m,Z.h_.data.categories.non_professional=m})),t()}),[t,m]),y=(0,_.useCallback)((function(e){var n=m.slice();n.push((0,o.Z)({},e)),g(n)}),[m]),k=(0,_.useCallback)((function(e){var n=m.slice();n.splice(e,1),g(n)}),[m]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:"Choose Categories",onClose:t,icon:De.Z,children:(0,r.jsx)(Ne,{navToSlideKey:n,categories:i,setCategories:f})}),l?(0,r.jsx)(p.kC,{flex:1,align:"center",justify:"center",children:(0,r.jsx)(L.D8,{color:"accent1.2",isIndeterminate:!0,size:"40px"})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.aF,{children:(0,r.jsx)(x.UQ,{w:"100%",allowToggle:!0,children:(0,S.Vf)(h).map((function(e){var n=m.findIndex((function(n){var t=n.id;return e.id===t}));return(0,r.jsx)(Ae,{category:e,selectedIndex:n,onAdd:y,onRemove:k},e.id)}))})}),(0,r.jsxs)(le.Zy,{children:[(0,r.jsx)(M.Z,{variant:"accent1.3.fill",size:"md",onClick:C,children:"Confirm"}),(0,r.jsx)(M.Z,{variant:"base.6.outline",size:"md",onClick:t,children:"Cancel"})]})]})]})},ze=function(e){var n=e.navToSlideKey;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:"Pick From Template",onClose:function(){return n(ye.LIST)},icon:ce.Z,iconSize:20}),(0,r.jsx)(le.aF,{children:(0,r.jsx)(M.Z,{size:"md",onClick:function(){return n(ye.LIST)},children:"Select This template"})})]})},Oe=t(42299),Fe=t(53963),Ke=function(e){var n=e.name,t=e.description,i=e.onChange,a=e.onDelete,o=e.withDelete,s=void 0===o||o;return(0,r.jsxs)(p.kC,{w:"100%",children:[(0,r.jsxs)(p.kC,{direction:"column",flex:1,children:[(0,r.jsx)(I.Z,{variant:"light",mb:"10px",type:"text",placeholder:"Name",value:n,onChange:function(e){var n=e.target.value;return i({key:"name",value:n})}}),(0,r.jsx)(Fe.Z,{variant:"light",rows:4,placeholder:"Description",value:t,onChange:function(e){var n=e.target.value;return i({key:"description",value:n})}})]}),s?(0,r.jsx)(p.kC,{ml:"10px",h:"50px",align:"center",cursor:"pointer",onClick:a,children:(0,r.jsx)(f.Z,{icon:"trashicon",size:20,fill:"base_2.2"})}):null]})},Me=(0,C.Pi)((function(e){var n=e.navToSlideKey,t=(0,_.useState)(!1),i=t[0],l=t[1],c=(0,_.useState)((0,j.ZN)((null===Z.h_||void 0===Z.h_?void 0:Z.h_.availableCategories)||[])),u=c[0],x=c[1],h=(0,_.useState)({}),f=h[0],v=h[1],m=(0,_.useCallback)((0,a.Z)(d().mark((function e(){var t;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l(!0),e.prev=1,!Object.keys(f).length){e.next=12;break}return e.next=6,(0,A.ZP)({path:"/api/contests/categories-admin/",method:"PUT",body:f});case 6:if(200!==(t=e.sent).status){e.next=11;break}Z.h_.updateCategories((null===t||void 0===t?void 0:t.data)||[]),n(ye.LIST),e.next=12;break;case 11:throw"Something went wrong, most likely validation failed";case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(1),console.error(e.t0);case 17:l(!1);case 18:case"end":return e.stop()}}),e,null,[[1,14]])}))),[f,n]),g=(0,_.useCallback)((function(e){var n=e.id,t=e.key,i=e.value;x((function(e){var r=e.findIndex((function(e){return e.id===n}));if(r>-1){var a=e.slice();a[r][t]=i;var l=a[r];return v((0,s.Z)((0,o.Z)({},f),(0,Oe.Z)({},n,(0,o.Z)({},l)))),a}return e}))}),[f]),b=function(){var e=(0,a.Z)(d().mark((function e(n){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return alert("delete category id: "+n),e.next=3,(0,A.ZP)({path:"/api/contests/categories-admin/".concat(n),method:"DELETE"});case 3:204===e.sent.status?alert("delete"):alert("failed");case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:"Edit Categories",onClose:function(){return n(ye.LIST)},icon:De.Z}
1),(0,r.jsx)(le.aF,{children:(0,r.jsx)(p.Kq,{spacing:"20px",children:u.map((function(e){var n=e.id,t=e.name,i=e.description,a=e.slug;return(0,r.jsx)(Ke,{name:t,description:i,onChange:function(e){var t=e.key,i=e.value;return g({id:n,key:t,value:i})},withDelete:!1,onDelete:function(){return b(a)}},n)}))})}),(0,r.jsxs)(le.Zy,{children:[(0,r.jsx)(M.Z,{variant:"accent1.3.fill",size:"md",onClick:m,isLoading:i,isDisabled:i,children:"Update"}),(0,r.jsx)(M.Z,{variant:"base.6.outline",size:"md",onClick:function(){return n(ye.LIST)},children:"Cancel"})]})]})})),qe=function(e){var n=e.navToSlideKey,t=(0,_.useState)(!1),i=t[0],o=t[1],s=(0,_.useState)([{name:"",description:""}]),l=s[0],c=s[1],u=(0,_.useCallback)((function(){c((function(e){return(0,y.Z)(e).concat([{name:"",description:""}])}))}),[]),x=(0,_.useCallback)((function(e){c((function(n){var t=n.slice();return t.splice(e,1),t}))}),[]),h=(0,_.useCallback)((0,a.Z)(d().mark((function e(){var t;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o(!0),e.prev=1,e.next=4,(0,A.ZP)({path:"/api/contests/categories-admin/",method:"POST",body:l});case 4:if(201!==(t=e.sent).status){e.next=9;break}(0,j.z)((function(){var e;Z.h_.availableCategories&&(e=Z.h_.availableCategories).push.apply(e,(0,y.Z)((null===t||void 0===t?void 0:t.data)||[]))})),Z.h_.sortAvailableCategories(),n(ye.LIST),e.next=10;break;case 9:throw"Something went wrong when creating categories, most likely validation failed";case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(1),console.error(e.t0);case 15:o(!1);case 16:case"end":return e.stop()}}),e,null,[[1,12]])}))),[l,n]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:"Add Categories",icon:ce.Z,iconSize:20,onClose:function(){return n(ye.LIST)}}),(0,r.jsxs)(le.aF,{pl:"0",pr:"0",align:"flex-start",children:[(0,r.jsx)(p.Kq,{spacing:"20px",direction:"column",p:"0px 30px 20px 30px",borderBottom:"1px solid",borderBottomColor:"base.2",w:"100%",children:l.map((function(e,n){var t=e.name,i=e.description;return(0,r.jsx)(Ke,{name:t,description:i,withDelete:l.length>1,onChange:function(e){var t=e.value,i=e.key;return function(e){var n=e.index,t=e.key,i=e.value,r=l.slice();r[n][t]=i,c(r)}({index:n,key:i,value:t})},onDelete:function(){return x(n)}},n)}))}),(0,r.jsx)(M.Z,{mt:"20px",leftIcon:(0,r.jsx)(f.Z,{icon:"plusboxedicon",fill:"base.6"}),variant:"flat",ml:"30px",onClick:u,children:"Add one more"})]}),(0,r.jsx)(le.Zy,{children:(0,r.jsx)(M.Z,{variant:"accent1.3.fill",size:"md",onClick:h,isLoading:i,isDisabled:i,children:"Add categories"})})]})};!function(e){e.LIST="LIST",e.TEMPLATES="TEMPLATES",e.EDIT="EDIT",e.ADD="ADD"}(ye||(ye={}));var Ue,We=function(e){return[{key:ye.LIST,component:function(n){var t=n.navToSlideKey;return(0,r.jsx)(Le,{navToSlideKey:t,onClose:e})}},{key:ye.EDIT,component:function(n){var t=n.navToSlideKey;return(0,r.jsx)(Me,{navToSlideKey:t,onClose:e})}},{key:ye.TEMPLATES,component:function(n){var t=n.navToSlideKey;return(0,r.jsx)(ze,{navToSlideKey:t,onClose:e})}},{key:ye.ADD,component:function(n){var t=n.navToSlideKey;return(0,r.jsx)(qe,{navToSlideKey:t,onClose:e})}}]},Be=function(){return(0,r.jsx)(se.Z,{trigger:function(e){var n=e.onOpen;return(0,r.jsx)(Ie,{mt:"10px",label:"Edit Categories",onClick:n})},children:function(e){var n=e.onClose;return(0,r.jsx)(le.ZP,{slides:We(n)})}})},Ye=function(e){var n=e.categories;e.handleEdit;return(0,r.jsxs)(p.kC,{direction:"column",children:[(0,r.jsx)(p.xu,{css:"\n          gap: 20px;\n          column-count: ".concat(+(1!==n.length)+1,";\n        "),children:n.map((function(e){var n=e.id,t=e.name;return(0,r.jsx)(p.xv,{display:"inline-flex",variant:"numeralsS",pb:"10px",mb:"10px",width:"100%",borderBottomWidth:1,borderBottomColor:"base.1",flex:1,children:t},n)}))}),(0,r.jsx)(Be,{})]})},He=[{label:"Entry Level",name:"entry_level",options:[{label:"Professional",value:k.Kq.PROFESSIONAL},{label:"Non-Professional",value:k.Kq.NON_PROFESSIONAL}]},{label:"Entry Type",name:"entry_type",options:[{label:"Single",value:k.UZ.SINGLE},{label:"Series",value:k.UZ.SERIES}]}],Ge=t(96779),Je=(0,C.Pi)((function(){var e=(0,he.Z)("common").t,n=Z.h_.data.general,t=n.slug,i=n.sendgrid_tag,a=Z.h_.data.categories.professional,o=(0,_.useMemo)((function(){return[{title:"Single",disabled:!0,body:(0,r.jsx)(Ye,{categories:a.length?[a[0]]:[],handleEdit:function(){return alert('open "single categories" sidebar')}})},{title:"Multiple",body:(0,r.jsx)(Ye,{categories:a,handleEdit:function(){return alert('open "multiple categories" sidebar')}})}]}
1),[a]),s=(0,_.useCallback)((function(e,n){(0,j.z)((function(){return Z.h_.data.general[e]=n}))}),[]),l=(0,_.useCallback)((function(e,n){var t=Z.h_.data.general[e].findIndex((function(e){return e===n}));t>-1?(0,j.z)((function(){return Z.h_.data.general[e].splice(t,1)})):(0,j.z)((function(){return Z.h_.data.general[e].push(n)}))}),[]);return(0,r.jsxs)(ne,{children:[(0,r.jsxs)(p.xu,{w:"100%",children:[["name","description","excerpt","abbreviation","categories_description"].map((function(t){return(0,r.jsx)(I.Z,{placeholder:e(t),mb:"10px",value:n[t],onChange:function(e){return s(t,e.target.value)}},t)})),(0,r.jsx)(p.kC,{direction:"column",mb:"10px",children:(0,r.jsx)(Ge.Z,{value:"".concat(n.display_year||""),onChange:function(e){(0,j.z)((function(){Z.h_.data.general.display_year=e?e.getFullYear():null}))},placeholderText:"Display Year",showYearPicker:!0,dateFormat:"yyyy"})}),(0,r.jsxs)(de.BZ,{mb:"10px",children:[(0,r.jsx)(I.Z,{placeholder:e("sendgrid_tag"),value:i,onChange:function(e){return s("sendgrid_tag",e.target.value)}}),(0,r.jsx)(de.xH,{alignItems:"center",h:"100%",children:(0,r.jsx)($.Z,{label:'The way this works is that when a user enters a contest, this tag, as well as any others from contests they may have entered in the past, gets added to their sendgrid user profile under the "contests" custom field. Old tags on their profile will get overwritten during this process. When searching for users who entered into a contest from within Sendgrid, you will need to search for this tag value using the "Includes" criteria, as all contests tags are separated by a comma when appended to the users profile.',children:(0,r.jsx)(p.xu,{alignSelf:"center",children:(0,r.jsx)(f.Z,{icon:"infoicon",size:18})})})})]}),(0,r.jsxs)(de.BZ,{mb:{base:"30px",md:0},children:[(0,r.jsx)(I.Z,{placeholder:e("slug"),value:t,onChange:function(e){return s("slug",e.target.value)}}),(0,r.jsx)(de.xH,{alignItems:"center",h:"100%",children:(0,r.jsx)($.Z,{label:"Leave empty if you want this value to be auto-generated",children:(0,r.jsx)(p.xu,{alignSelf:"center",children:(0,r.jsx)(f.Z,{icon:"infoicon",size:18})})})})]}),(0,r.jsx)(p.xu,{mt:"5px",children:(0,r.jsxs)(p.xv,{variant:"overline",color:"base_2.2",children:["When reusing this template make sure old contests get an updated slug which includes the year. Example: ",'"one-shot-contest-2022"']})})]}),(0,r.jsxs)(p.xu,{w:"100%",children:[(0,r.jsx)(p.kC,{sx:{columnCount:2,gap:{base:"20px",lg:"40px"}},children:He.map((function(n,t){var i=n.label,a=n.name,o=n.options;return(0,r.jsxs)(p.kC,{direction:"column",w:"100%",mt:{base:"20px",md:"0px"},children:[(0,r.jsx)(p.xv,{variant:"numeralsTiny",mb:{base:"10px",md:"20px"},children:i}),(0,r.jsx)(p.Kq,{direction:"column",spacing:{base:"5px",md:"20px"},children:o.map((function(n,i){var o=n.value,s=Z.h_.data.general[a].includes(o);return(0,r.jsx)(Q.Z,{label:e(n.value),isChecked:s,onChange:function(){return l(a,n.value)}},[a,t,i].join("--"))}))})]},"".concat(i,"--").concat(t))}))}),(0,r.jsxs)(p.kC,{direction:"column",mt:{base:"20px",md:"40px"},children:[(0,r.jsx)(p.xv,{variant:"numeralsTiny",mb:{base:"10px",md:"20px"},children:"Categories"}),(0,r.jsx)(Te,{defaultIndex:1,items:o})]})]})]})})),Ve=t(8115),Xe=t(63778),Qe=(0,C.Pi)((function(e){var n,t,i,a,c=e.assignee,u=e.showFavorite,d=void 0!==u&&u,x=e.selected,h=void 0!==x&&x,v=e.onAddCategories,m=(0,l.Z)(e,["assignee","showFavorite","selected","onAddCategories"]),g=c.id,b=c.categories,j=c.name,C=c.favorite,y=Z.h_.data.categories.professional.filter((function(e){return b.includes(e.id)}
1)),k=(0,_.useCallback)((function(e){e.stopPropagation(),Z.h_.toggleFavoriteJudge(g)}),[g]),S=(0,_.useCallback)((function(e){e.stopPropagation(),v()}),[v]);return(0,r.jsxs)(p.kC,(0,s.Z)((0,o.Z)({},$e.containerProps,m),{"data-selected":h,children:[(0,r.jsx)(p.kC,{flexShrink:0,children:(0,r.jsx)(Xe.Z,{src:(0,K.Jn)(null===c||void 0===c||null===(n=c.avatar)||void 0===n||null===(t=n.sizes)||void 0===t||null===(i=t.small)||void 0===i?void 0:i.url),name:j,boxSize:"80px"})}),(0,r.jsxs)(p.kC,{pl:"20px",direction:"column",flex:1,align:"flex-start",children:[(0,r.jsxs)(p.kC,{mb:"10px",justifyContent:"space-between",width:"100%",children:[(0,r.jsx)(p.xv,{variant:"numeralsS",pr:"10px",flex:1,children:j}),d?(0,r.jsx)(f.Z,{icon:"star",fill:C?"accent1.2":"transparent",stroke:C?"accent1.2":"base_2.1",size:20,className:"user-add-to-favorite",opacity:+!!C,onClick:function(e){return k(e)}}):null]}),y.length?(0,r.jsxs)(p.kC,{flexWrap:"wrap",children:[y.slice(0,3).map((function(e){return(0,r.jsx)(M.Z,(0,s.Z)((0,o.Z)({},$e.categoryButtonProps),{onClick:S,children:e.name}),e.id)})),y.length>=4?(0,r.jsx)(M.Z,(0,s.Z)((0,o.Z)({},$e.categoryButtonProps),{onClick:S,children:y.length>4?"+".concat(y.length-3):(null===(a=y[3])||void 0===a?void 0:a.name)||null})):null]}):(0,r.jsx)(M.Z,{leftIcon:(0,r.jsx)(f.Z,{icon:"plusboxedicon",fill:"base_2.2",size:18}),variant:"flat",size:"sm",onClick:S,children:"Assign to Category"})]})]}))})),$e={containerProps:{mr:"calc(20px * 2 / 3)",w:"353px",mb:"20px",borderWidth:"1px",borderRadius:"4px",borderColor:"transparent",cursor:"pointer",userSelect:"none",p:"20px 30px 20px 20px",transition:"border-color .12s linear",css:{'&[data-selected="true"]':{borderColor:"var(--chakra-colors-base-1)"}},_hover:{borderColor:"base_2.2",".user-add-to-favorite":{opacity:1}}},categoryButtonProps:{variant:"base.1.outline",size:"xs",mr:"10px",mb:"10px"}},en=function(e){var n=e.categories,t=e.setCategories,i=e.selectAllProps,a=(0,_.useState)(!1),s=a[0],l=a[1],c=(0,_.useState)(""),u=c[0],d=c[1],x=(0,_.useCallback)((function(){var e=(n||[]).filter((function(e){return e.name.toLowerCase().includes(u)}));t(e)}),[n,u,t]);return(0,_.useEffect)((function(){Re()(x,350)()}),[x,u]),(0,r.jsxs)(p.kC,{mb:"20px",flexWrap:"wrap",justify:"space-between",pt:"20px",position:"relative",children:[(0,r.jsx)(Q.Z,(0,o.Z)({},i)),(0,r.jsx)(M.Z,{variant:"flat",leftIcon:(0,r.jsx)(f.Z,{icon:"searchicon",fill:"base.6"}),size:"sm",onClick:function(){return l(!0)},children:"Search"}),s&&(0,r.jsxs)(de.BZ,{position:"absolute",top:"-3px",left:"0",w:"100%",height:"100%",mt:"10px",bg:"base.1",children:[(0,r.jsx)(de.Z8,{top:"auto",bottom:"0px",height:"85%",children:(0,r.jsx)(f.Z,{icon:"searchicon",fill:"base.6"})}),(0,r.jsx)(de.II,{variant:"light",pl:"34px",placeholder:"Search",autoFocus:!0,value:u,onChange:function(e){var n=e.target.value;return d(n)}}),(0,r.jsx)(de.xH,{top:"auto",bottom:"0px",height:"85%",children:(0,r.jsx)(f.Z,{icon:"closeicon",cursor:"pointer",onClick:function(){l(!1)},size:18,fill:"base.6"})})]})]})},nn=function(e){var n=e.category,t=e.isChecked,i=e.isIndeterminate,a=e.onChange;return(0,r.jsxs)(p.kC,{flex:"1",justify:"flex-start",align:"center",p:"20px 0",borderTop:"1px solid",borderTopColor:"base.2",children:[(0,r.jsx)(Q.Z,{isIndeterminate:i,isChecked:t,variant:"light",onCh
1ange:a}),(0,r.jsx)(p.xv,{variant:"numeralsS",textAlign:"left",ml:"10px",children:n.name})]})};!function(e){e.NOT_SELECTED="NOT_SELECTED",e.INDETERMINATE="INDETERMINATE",e.SELECTED="SELECTED"}(Ue||(Ue={}));var tn,rn=function(e){var n=e.onClose,t=Z.h_.data.categories.professional,i=Z.h_.editingAssignees,a=Z.h_.data.assigned,l=i.type,c=i.ids,u=a[l].filter((function(e){var n=e.id;return c.includes(n)})),d=(0,_.useState)((0,j.ZN)(u)),p=d[0],h=d[1],f=(0,_.useState)(t),v=f[0],m=f[1],g=(0,_.useCallback)((function(e){var n=p.reduce((function(n,t){return t.categories.findIndex((function(n){return n===e}))>-1&&n++,n}),0);return n===p.length?Ue.SELECTED:n>0?Ue.INDETERMINATE:Ue.NOT_SELECTED}),[p]),b=(0,_.useMemo)((function(){var e=v.map((function(e){var n=e.id;return g(n)}));return e.every((function(e){return e===Ue.SELECTED}))?Ue.SELECTED:e.some((function(e){return e===Ue.INDETERMINATE||e===Ue.SELECTED}))?Ue.INDETERMINATE:Ue.NOT_SELECTED}),[v,g]),C=(0,_.useCallback)((function(){var e=p.reduce((function(e,n){var t=(0,o.Z)({},n);return b===Ue.SELECTED||b===Ue.INDETERMINATE?t.categories=[]:t.categories=v.map((function(e){return e.id})),e.push(t),e}),[]);h(e)}),[b,v,p]),k=(0,_.useCallback)((function(){var e=Z.h_.data.assigned[l].map((function(e){var n=(0,o.Z)({},e);if(i.ids.includes(e.id)){var t=p.find((function(n){return n.id===e.id}));t&&(n.categories=(0,y.Z)(t.categories))}return n}));(0,j.z)((function(){Z.h_.data.assigned[l]=e,Z.h_.assigneesMultiSelect.ids=[]})),n()}),[i.ids,n,p,l]),S=(0,_.useCallback)((function(e){h((function(n){return n.map((function(n){return(0,s.Z)((0,o.Z)({},n),{categories:Array.from(new Set((0,y.Z)(n.categories).concat([e])))})}))}))}),[]),w=(0,_.useCallback)((function(e){h((function(n){return n.map((function(n){var t=n.categories.slice(),i=t.findIndex((function(n){return n===e}));return i>-1&&t.splice(i,1),(0,s.Z)((0,o.Z)({},n),{categories:t})}))}))}),[]),E=(0,_.useCallback)((function(e,n){e===Ue.SELECTED?w(n):S(n)}),[w,S]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:"Choose Categories",onClose:n,icon:De.Z,children:(0,r.jsx)(en,{categories:t,setCategories:m,selectAllProps:{isIndeterminate:b===Ue.INDETERMINATE,isChecked:b===Ue.SELECTED,variant:"light",label:b!==Ue.NOT_SELECTED?"Deselect All":"Select All",onChange:C}})}),(0,r.jsx)(le.aF,{pt:"0",children:(0,r.jsx)(x.UQ,{w:"100%",allowToggle:!0,children:v.map((function(e){var n=g(e.id);return(0,r.jsx)(nn,{category:e,isChecked:n===Ue.SELECTED,isIndeterminate:n===Ue.INDETERMINATE,onChange:function(){return E(n,e.id)}},e.id)}))})}),(0,r.jsxs)(le.Zy,{children:[(0,r.jsx)(M.Z,{variant:"accent1.3.fill",size:"md",onClick:k,children:"Confirm"}),(0,r.jsx)(M.Z,{variant:"base.6.outline",size:"md",onClick:n,children:"Cancel"})]})]})};!function(e){e.LIST="LIST"}(tn||(tn={}));var an,on,sn=function(e){return[{key:tn.LIST,component:function(n){var t=n.navToSlideKey;return(0,r.jsx)(rn,{navToSlideKey:t,onClose:e})}}]},ln=(0,C.Pi)((function(){var e=Z.h_.editingAssignees;return(0,r.jsx)(se.Z,{externalOpen:!!e.ids.length,externalClose:function(){return(0,j.z)((function(){return Z.h_.editingAssignees.ids=[]}))},children:function(e){var n=e.onClose;return(0,r.jsx)(le.ZP,{slides:sn(n)})}})})),cn=(an={},(0,Oe.Z)(an,Ve.F.STAFF,{typeLabel:"Staff",typeLabelPlural:"Staff",storeKey:Ve.F.STAFF}),(0,Oe.Z)(an,Ve.F.JUDGE,{typeLabel:"Judge",typeLabelPlural:"Judges",storeKey:Ve.F.JUDGE}),an),un=function(e){return cn[e]},dn=t(33453),pn=t(14970),xn=t(94644),hn={first_name:"",last_name:"",email:""},fn=(0,xn.Ry)().shape({first_name:(0,xn.Z_)().required("Required"),last_name:(0,xn.Z_)().required("Required"),email:(0,xn.Z_)().email("Invalid email").required("Required")}),vn=(0,C.Pi)((function(e){var n=e.type,t=e.navToSlideKey,i=e.addUser,l=un(n).typeLabel,c=(0,N.Z)(),u=function(){var e=(0,a.Z)(d().mark((function e(r){var a,l;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,A.ZP)({path:"/api/users/invite/",method:"POST",body:(0,s.Z)((0,o.Z)({},r),{role:n}),returnErrors:!0});case 2:201===(a=e.sent).status&&a.data?(l=a.data,i(l),t(on.LIST)):c({status:"error",title:"Error: user with ".concat(r.email," email already exists")});case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,r.jsx)(pn.J9,{initialValues:hn,validationSchema:fn,onSubmit:u,children:function(e){var n=e.isSubmitting;
1return(0,r.jsxs)(pn.l0,{children:[(0,r.jsx)(le.B4,{title:"Create ".concat(l," Account"),onClose:function(){return t(on.LIST)},icon:De.Z}),(0,r.jsx)(le.aF,{children:(0,r.jsxs)(p.Kq,{spacing:"15px",children:[(0,r.jsx)(dn.Z,{name:"first_name",render:function(e){var n=e.field;return(0,r.jsx)(I.Z,(0,o.Z)({variant:"light",placeholder:"First Name"},n))}}),(0,r.jsx)(dn.Z,{name:"last_name",render:function(e){var n=e.field;return(0,r.jsx)(I.Z,(0,o.Z)({variant:"light",placeholder:"Last Name"},n))}}),(0,r.jsx)(dn.Z,{name:"email",render:function(e){var n=e.field;return(0,r.jsx)(I.Z,(0,o.Z)({variant:"light",placeholder:"Email",type:"email"},n))}})]})}),(0,r.jsx)(le.Zy,{children:(0,r.jsx)(M.Z,{isLoading:n,disabled:n,type:"submit",size:"md",variant:"accent1.3.fill",children:"Send Invitation"})})]})}})})),mn=t(2612),gn=(0,C.Pi)((function(e){var n=e.users,t=e.setUsers,i=e.navToSlideKey,a=(0,_.useState)(""),l=a[0],u=a[1],d=(0,_.useState)(!1),x=d[0],h=d[1],v=(0,_.useMemo)((function(){var e=(0,c.Z)(n.reduce((function(e,n){var t=(0,c.Z)(e,2),i=t[0],r=t[1],a=n.selected,o=n.visible;return[i+=+(a&&o),r+=+o]}),[0,0]),2),t=e[0],i=e[1],r=t===i;return[r,t>0&&!r,0===i]}),[n]),m=v[0],g=v[1],b=v[2],j=(0,_.useCallback)((function(e){(0,mn.debounce)((function(){t((function(n){return n.map((function(n){return(0,s.Z)((0,o.Z)({},n),{visible:(t=e,t.toLowerCase().trim().split(" ").filter((function(e){return e.length}))).every((function(e){return n.name.toLowerCase().trim().includes(e)}))});var t}))}))}),300)()}),[t]);return(0,_.useEffect)((function(){j(l)}),[l,j]),(0,r.jsxs)(p.kC,{direction:"column",children:[(0,r.jsx)(p.kC,{h:"64px",borderBottom:"1px solid",borderBottomColor:"base.2",children:x?(0,r.jsxs)(de.BZ,{children:[(0,r.jsx)(I.Z,{containerProps:{mt:"10px"},autoFocus:!0,variant:"light",placeholder:"Search User",value:l,onChange:function(e){var n=e.target.value;return u(n)}}),(0,r.jsx)(de.xH,{bottom:"0",p:"15px 0",top:"auto",children:(0,r.jsx)(p.xu,{cursor:"pointer",onClick:function(){h(!1),u("")},children:(0,r.jsx)(f.Z,{icon:"closeicon",size:20,fill:"base.6"})})})]}):(0,r.jsx)(M.Z,{size:"sm",onClick:function(){return h(!0)},leftIcon:(0,r.jsx)(f.Z,{icon:"searchicon",fill:"base.6"}),variant:"flat",children:"Search"})}),(0,r.jsxs)(p.kC,{mt:"20px",justify:"space-between",pb:"20px",children:[(0,r.jsx)(Q.Z,{variant:"light",font:"ctaSubtle",onChange:function(){t((function(e){return e.map((function(e){var n=(0,o.Z)({},e);return e.visible&&(m&&e.selected?n.selected=!1:m||e.selected||(n.selected=!0)),n}))}))},label:"".concat(m&&n.length?"Deselect":"Select"," All"),isChecked:m,isDisabled:b,isIndeterminate:g,flexShrink:0,mr:"20px"}),(0,r.jsx)(M.Z,{size:"sm",leftIcon:(0,r.jsx)(f.Z,{icon:"plusboxedicon",fill:"base.6"}),variant:"flat",onClick:function(){return i(on.CREATE)},children:"Create new"})]})]})})),bn=t(69194),jn=t.n(bn),Cn=function(e){var n,t,i,a=e.onChange,o=e.isChecked,s=e.error,l=e.user,c=(0,K.Jn)(null===l||void 0===l||null===(n=l.avatar)||void 0===n||null===(t=n.sizes)||void 0===t||null===(i=t.small)||void 0===i?void 0:i.url);return(0,r.jsx)(Q.Z,{p:"10px 0",onChange:a,isChecked:o,variant:"light",label:(0,r.jsxs)(p.kC,{ml:"20px",align:"center",justify:"space-between",children:[(0,r.jsxs)(p.kC,{position:"relative",align:"center",children:[(0,r.jsx)(Xe.Z,{src:c,name:(null===l||void 0===l?void 0:l.name)||"",boxSize:"50px"}),(0,r.jsxs)(p.kC,{ml:"10px",direction:"column",children:[(0,r.jsx)(p.xv,{variant:"numeralsS",children:l.name}),(0,r.jsx)(p.xv,{variant:"overline",children:l.email})]})]}),s&&(0,r.jsx)($.Z,{variant:"light",label:"User did not login yet",placement:"left",children:(0,r.jsx)(f.Z,{icon:"erroricon",fill:"base_2.2"})})]})})},Zn=(0,C.Pi)((function(e){var n=e.onClose,t=e.type,i=e.navToSlideKey,a=e.loading,o=e.users,s=(0,_.useState)(o),l=s[0],c=s[1],u=un(t).typeLabelPlural,d=(0,_.useCallback)((function(){(0,j.z)((function(){Z.h_.data.assigned[t]=l.reduce((function(e,n){return n.selected&&e.push(jn()(n,{$unset:["visible","selected"]})),e}),[])})),n()}),[n,t,l]),x=(0,_.useCallback)((function(e){c((function(n){var t=n,i=t.findIndex((function(n){var t=n.id;return e.id===t}));if(i>-1){var r=!t[i].selected;t=jn()(t,(0,Oe.Z)({},i,{selected:{$set:r}}))}return t}))}),[]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:"Assign ".concat(u),onClose:n,icon:De.Z,children:a?null:(0,r.jsx)(gn,{users:l,setUsers:c,navToSlideKey:i})}),a?(0,r.jsx)(p.kC,{align:"center",justify:"center",flex:1,children:(0,r.jsx)(v.Z,{})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.aF,{pt:"0",h:"100%",children:l.length?l.map((function(e){return e.visible?(0,r.jsx)(Cn,{onChange:function(){return x(e)},isChecked:e.selected,user:e,error:!e.is_verified},"".concat(t,"--").concat(e.id)):null})):(0,r.jsx)(p.xv,{color:"base.5",children:"No results"})}),(0,r.jsxs)(le.Zy,{children:[(0,r.jsx)(M.Z,{size:"md",variant:"accent1.3.fill",onClick:d,children:"Update"}),(0,r.jsx)(M.Z,{size:"md",variant:"base.6.outline",onClick:n,children:"Cancel"})]})]})]})}));!function(e){e.LIST="LIST",e.CREATE="CREATE"}(on||(on={}));var yn,_n,kn,Sn=(0,C.Pi)((function(e){var n=e.trigger,t=e.type,i=(0,_.useState)(!1),l=i[0],c=i[1],u=(0,_.useState)([]),p=u[0],x=u[1],h=Z.h_.data.assigned[t],f=Z.h_.availableUsers[t],v=(0,_.useCallback)((0,a.Z)(d().mark((function e(){var n;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c(!0),f){e.next=6;break}return e.next=4,(0,A.ZP)({path:"/api/users/role/?role=".concat(t)});case 4:200===(n=e.sent).status&&(0,j.z)((function(){Z.h_.availableUsers[t]=n.data}));case 6:x((null===f||void 0===f?void 0:f.map((function(e){var n=h.findIndex((function(n){return n.id===e.id})),t=n>-1,i=t?h[n].categories:[];return(0,s.Z)((0,o.Z)({},e),{categories:i,selected:t,visible:!0})}
1)))||[]),c(!1);case 8:case"end":return e.stop()}}),e)}))),[h,f,t]),m=(0,_.useCallback)((function(e){Z.h_.addCreatedUser(t,e),v()}),[v,t]),g=(0,_.useCallback)((function(){v()}),[v]);return(0,r.jsx)(se.Z,{trigger:n,onOpen:g,children:function(e){var n,i=e.onClose;return(0,r.jsx)(le.ZP,{slides:(n={type:t,users:p,setUsers:x,loading:l,addUser:m,onClose:function(){x([]),i()}},[{key:on.LIST,component:function(e){var t=e.navToSlideKey;return(0,r.jsx)(Zn,(0,o.Z)({navToSlideKey:t},n))}},{key:on.CREATE,component:function(e){var t=e.navToSlideKey;return(0,r.jsx)(vn,(0,o.Z)({navToSlideKey:t},n))}}])})}})})),wn=function(e){var n=e.text;return(0,r.jsx)(p.kC,{h:"150px",border:"1px solid",borderColor:"base_2.2",borderRadius:4,align:"center",justify:"center",padding:"0 30px",children:(0,r.jsx)(p.xv,{variant:"numeralsTiny",children:n})})},En=(0,C.Pi)((function(e){var n=e.type,t=un(n).typeLabelPlural,i=Z.h_.data.assigned,a=Z.h_.assigneesMultiSelect;return(0,r.jsxs)(p.Kq,{spacing:"40px",children:[(0,r.jsxs)(p.kC,{direction:"row",align:"center",justify:"space-between",children:[(0,r.jsxs)(p.xv,{variant:"numeralsXS",children:["Assign ",t]}),(0,r.jsx)(Sn,{type:n,trigger:function(e){var i=e.onOpen;return(0,r.jsxs)(M.Z,{onClick:i,className:"click-me--".concat(n),size:"md",leftIcon:(0,r.jsx)(f.Z,{icon:"assignicon",width:18,height:19}),children:["Assign ",t]})}})]}),i[n].length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.kC,{direction:"row",flexWrap:"wrap",align:"flex-start",children:i[n].map((function(e){return(0,r.jsx)(Qe,{assignee:e,showFavorite:n===Ve.F.JUDGE,selected:a.ids.includes(e.id),onAddCategories:function(){return(0,j.z)((function(){Z.h_.editingAssignees={type:n,ids:[e.id]}}))},onClick:function(){return Z.h_.toggleAssigneeMultiselect(n,e.id)}},"".concat(n,"--").concat(e.id))}))}),(0,r.jsx)(ln,{})]}):(0,r.jsx)(wn,{text:"Your ".concat(t," List is Empty. Assign ").concat(t," first.")})]})})),Tn=t(80427),In=t(49430),Dn=function(e){var n=e.value;return(0,r.jsx)(p.kC,{w:"22px",h:"22px",borderRadius:"50%",sx:{aspectRatio:1},bg:"base.6",align:"center",justify:"center",children:(0,r.jsx)(p.xv,{variant:"overline",color:"base.1",children:n})})},Pn=(0,ee.Pi)((function(){var e=Z.h_.assigneesMultiSelect.ids;return(0,r.jsx)(Tn.M,{children:e.length?(0,r.jsxs)(p.Kq,{direction:"row",align:"center",justify:"flex-end",p:"0 60px",position:"fixed",left:"0",bottom:"0",w:"100%",h:"80px",bg:"support1.4",borderTop:"1px solid",borderTopColor:"base_2.4",as:In.E.div,initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},zIndex:20,children:[(0,r.jsx)(M.Z,{size:"md",leftIcon:(0,r.jsx)(Dn,{value:e.length}),rightIcon:(0,r.jsx)(f.Z,{icon:"plusboxedicon",size:20,fill:"base.6"}),onClick:function(){(0,j.z)((function(){Z.h_.editingAssignees=(0,o.Z)({},Z.h_.assigneesMultiSelect)}))},children:"Assign to Category"}),(0,r.jsx)(M.Z,{size:"md",variant:"base.1.outline",onClick:function(){(0,j.z)((function(){Z.h_.assigneesMultiSelect.ids=[]}))},children:"Cancel"})]}):null})})),Rn=function(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(p.Kq,{spacing:"60px",children:[(0,r.jsx)(En,{type:Ve.F.STAFF}),(0,r.jsx)(En,{type:Ve.F.JUDGE})]}),(0,r.jsx)(Pn,{})]})},Nn=function(e){var n=e.title,t=void 0===n?"":n,i=e.children,a=(0,l.Z)(e,["title","children"]);return(0,r.jsxs)(p.kC,{direction:"column",w:"100%",flex:0,children:[(0,r.jsx)(p.xv,{variant:"numeralsS",mb:"20px",children:t}),(0,r.jsx)(p.kC,(0,s.Z)((0,o.Z)({flex:0,direction:{base:"column",md:"row"},sx:{columnCount:{md:3},gap:"40px"}},a),{children:i}))]})},An=(0,C.Pi)((function(e){var n=e.title,t=void 0===n?"":n,i=e.globalKey,a=e.priceKey,o=e.entryType,s=void 0===o?"single":o,l=e.onChange,c=Z.h_.data.prices[i][a],u=(0,_.useMemo)((function(){return[{label:"single"===s?"Single Image":"Single Series",rightIcon:(0,r.jsx)(f.Z,{icon:"rewarddollars",fill:"base_2.2"}),subKey:"base"},{label:"Additional Category",rightIcon:(0,r.jsx)(f.Z,{icon:"rewarddollars",fill:"base_2.2"}),subKey:"additional"},{label:"Rewards Back",rightIcon:(0,r.jsx)(f.Z,{icon:"percent",width:14,height:13,fill:"base_2.2"}),subKey:"cashback"}]}),[s]);return(0,r.jsxs)(p.kC,{flex:1,direction:"column",children:[(0,r.jsx)(p.xv,{variant:"numeralsTiny",mb:"20px",children:t}),(0,r.jsx)(p.Kq,{spacing:"10px",children:u.map((function(e){var n=e.label,t=e.rightIcon,o=e.subKey;return(0,r.jsx)(pe,{type:"number",pb:"10px",label:n,rightIcon:t,value:(null===c||void 0===c?void 0:c[o])||"",onChange:function(e){var n=e.target.value;return l({key:i,priceKey:a,subKey:o,value:+n})}},o)}))})]})})),Ln=[{title:"Single Image",items:[{title:(0,S.k4)(k.Kq.PROFESSIONAL),priceKey:"single_professional"},{title:(0,S.k4)(k.Kq.NON_PROFESSIONAL),priceKey:"single_non_professional"},{title:"Student",priceKey:"single_student"}]},{title:"Series",items:[{title:(0,S.k4)(k.Kq.PROFESSIONAL),priceKey:"series_professional",entryType:"series"},{title:(0,S.k4)(k.Kq.NON_PROFESSIONAL),priceKey:"series_non_professional",entryType:"series"},{title:"Student",priceKey:"series_student",entryType:"series"}]}],zn=(0,C.Pi)((function(e){var n=e.type,t=(0,_.useCallback)((function(e){var n=e.key,t=e.priceKey,i=e.subKey,r=e.value;(0,j.z)((function(){return Z.h_.data.prices[n][t][i]=r}))}),[]);return(0,r.jsx)(p.Kq,{spacing:{base:"20px",lg:"40px"},p:{base:"0px 30px",lg:"0px 60px"},children:Ln.map((function(e,i){return(0,r.jsx)(Nn,{title:e.title,children:e.items.map((function(e,i){return(0,r.jsx)(An,(0,s.Z)((0,o.Z)({},e),{entryType:e.entryType,globalKey:n,onChange:function(e){return t(e)}}),i)}))},i)}))})})),On=(0,C.Pi)((function(){var e=Z.h_.data.globalAccesibilityEnabled;return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(p.Kq,{spacing:"40px",flexWrap:"wrap",w:"100%",direction:"column",children:[(0,r.jsx)(zn,{type:"normal"}),(0,r.jsxs)(p.kC,{align:"center",justify:"space-between",borderTopWidth:"1px",borderTopColor:"base_2.4",p:{base:"40px 30px 0 30px",lg:"40px 60px 0 60px"},children:[(0,r.jsx)(p.xv,{variant:"titleM",children:"Global Accessibility"}),(0,r.jsxs)(p.kC,{align:"center",children:[(0,r.jsx)(p.xv,{mr:"10px",variant:"fieldsTitleL",children:"12 countries"}),(0,r.jsx)($.Z,{placement:"left",label:"Countries can be picked in the website settings",children:(0,r.jsx)(f.Z,{icon:"infoicon",size:18})}),(0,r.jsx)(oe.r,{ml:"42px",isChecked:e,onChange:function(e){var n=e.target.checked;return(0,j.z)((function(){Z.h_.data.globalAccesibilityEnabled=n}))}})]})]}),e&&(0,r.jsx)(zn,{type:"global"}),(0,r.jsx)(p.xu,{mt:"0px !important",h:"40px"}),(0,r.jsx)(Nt,{})]})})})),Fn=t(47513),Kn=t(63717),Mn=function(e){var n=e.tags,t=e.value,i=e.onCh
1ange,a=e.heightAuto,c=void 0===a||a,u=e.flexProps,d=void 0===u?{}:u,x=(0,l.Z)(e,["tags","value","onChange","heightAuto","flexProps"]),h=(0,_.useState)(!1),f=h[0],v=h[1],m=(0,_.useRef)(null);(0,_.useEffect)((function(){var e=m.current;return e&&c&&(0,Kn.Z)(e),function(){e&&c&&Kn.Z.destroy(e)}}),[c]);return(0,r.jsxs)(p.kC,(0,s.Z)((0,o.Z)({direction:"column"},d),{children:[(0,r.jsx)(Fe.Z,(0,o.Z)({ref:m,onFocus:function(){f||v(!0)},onBlur:function(){setTimeout((function(){m.current!==document.activeElement&&v(!1)}),200)},value:t,onChange:i},x)),f&&(0,r.jsx)(p.Kq,{mt:"10px",direction:"row",spacing:"5px",children:n.map((function(e){return(0,r.jsx)(Fn.Vp,{p:"4px 8px",bg:"transparent",borderWidth:1,borderColor:"support2.2",borderRadius:"2px",onClick:function(){return function(e){if("undefined"!==typeof t&&i){var n,r;null===(n=m.current)||void 0===n||n.focus();var a=null===(r=m.current)||void 0===r?void 0:r.selectionStart,o=t+"",s=o.slice(0,a),l=o.slice(a),u="".concat(s).concat(e," ").concat(l);i({target:{value:u}});var d=m.current;d&&c&&setTimeout((function(){Kn.Z.update(d)}),20)}}(e.value)},_hover:{borderColor:"base.1"},cursor:"pointer",userSelect:"none",children:(0,r.jsx)(p.xv,{variant:"fieldsDescription",children:e.label})},e.value)}))})]}))},qn=[{label:"Artist Name",value:"{artist_name}"},{label:"Entry Title",value:"{entry_title}"},{label:"Contest Title",value:"{contest_title}"},{label:"Contest Year",value:"{contest_year}"},{label:"Award Name",value:"{award_name}"},{label:"Category",value:"{category_name}"}],Un=(0,C.Pi)((function(e){var n=e.id,t=e.label,i=Z.h_.data.socialSnippets[n],a=i.title,o=i.description,s=(0,_.useCallback)((function(e){var t=e.key,i=e.value;(0,j.z)((function(){Z.h_.data.socialSnippets[n][t]=i}))}),[n]),l=(0,_.useCallback)((function(e){return s({key:"title",value:e.target.value})}),[s]),c=(0,_.useCallback)((function(e){return s({key:"description",value:e.target.value})}),[s]);return(0,r.jsxs)(p.Kq,{display:"inline-flex",w:"100%",spacing:"20px",direction:"column",mb:"40px",children:[(0,r.jsx)(p.xv,{pb:"20px",borderBottomWidth:1,borderBottomColor:"base.1",variant:"numeralsS",children:t}),(0,r.jsx)(Mn,{tags:qn,placeholder:"Title",rows:2,value:a,onChange:l}),(0,r.jsx)(Mn,{tags:qn,placeholder:"Description",rows:4,value:o,onChange:c})]})})),Wn=[{label:"Contest Share",id:k.v1.CONTEST_SHARE},{label:"PVA Entry Share",id:k.v1.PCA_ENTRY_SHARE},{label:"Award Share",id:k.v1.AWARD_SHARE}],Bn=function(){return(0,r.jsx)(p.xu,{sx:{columnCount:{md:2},gap:{md:40,lg:135}},children:Wn.map((function(e,n){return(0,r.jsx)(Un,(0,o.Z)({},e),"".concat(e.label,"--").concat(n))}))})},Yn=t(79872),Hn=t(75501),Gn=t(54012),Jn=t(6203),Vn=t(90302),Xn=t(36189),Qn=t.n(Xn),$n=t(49673),et=function(e){return Qn().tz(e,"YYYY-MM-DD",$n.Xu).format("MMM DD")},nt=(yn={},(0,Oe.Z)(yn,k.Lo.EARLY_BIRD_SUBMISSION,"Early Bird"),(0,Oe.Z)(yn,k.Lo.REGULAR_SUBMISSION,"Regular Submission"),(0,Oe.Z)(yn,k.Lo.EXTENDED_SUBMISSION,"Extended Entry"),yn),tt=function(e){var n,t,i,o,s=e.stage,l=e.contestSlug,c=e.stageEndDate,u=e.maxNewEndDate,x=e.extensions,h=e.onUpsert,v=e.onRemove,m=(0,Hn.Z)(c),g=x.find((function(e){return e.stage===s&&!e.applied})),b=x.filter((function(e){return e.stage===s&&e.applied})).sort((function(e,i){return new Date(null!==(n=e.applied_at)&&void 0!==n?n:e.execute_at).getTime()-new Date(null!==(t=i.applied_at)&&void 0!==t?t:i.execute_at).getTime()})),j=(0,_.useState)(!1),C=j[0],Z=j[1],y=(0,_.useState)(null),k=y[0],S=y[1],w=(0,_.useState)(null),E=w[0],T=w[1],I=(0,_.useState)(!1),D=I[0],P=I[1],N=(0,_.useState)(!1),L=N[0],z=N[1],O=(0,_.useState)(null),F=O[0],K=O[1],q=(0,_.useCallback)((function(e){e?(S((0,Yn.Wp)(e.execute_at)),T(new Date(e.new_end_date+"T12:00:00"))):(S((0,Gn.Z)(c,{hours:23,minutes:55,seconds:0,milliseconds:0})),T(null)),K(null),Z(!0)}),[c]),U=function(){Z(!1),S(null),T(null),K(null)},W=function(){var e=(0,a.Z)(d().mark((function e(){var n,t,i;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(k&&E){e.next=2;break}return e.abrupt("return");case 2:return P(!0),K(null),e.next=6,(0,A.ZP)({path:"/api/admin/contests/manage/".concat(l,"/stage-extensions/"),method:"POST",body:{stage:s,execute_at:(0,Yn.oY)(k),new_end_date:(0,Jn.default)(E,"yyyy-MM-dd")}});case 6:n=e.sent,t=n.status,i=n.data,P(!1),t!==R.RS.HTTP_200_OK&&t!==R.RS.HTTP_201_CREATED||!i?K("Failed to save. Please try again."):(h(i),U());case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(){var e=(0,a.Z)(d().mark((function e(){var n;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return z(!0),e.next=3,(0,A.ZP)({path:"/api/admin/contests/manage/".concat(l,"/stage-extensions/").concat(s,"/"),method:"DELETE"});case 3:n=e.sent.status,z(!1),n!==R.RS.HTTP_204_NO_CONTENT&&n!==R.RS.HTTP_200_OK||v(s);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Y=null!==(i=nt[s])&&void 0!==i?i:s;return(0,r.jsxs)(p.kC,{p:"16px",borderWidth:1,borderColor:"#E8E8E3",borderRadius:"8px",opacity:m?.5:1,pointerEvents:m?"none":"auto",direction:"column",justify:"space-between",minH:"160px",children:[(0,r.jsxs)(p.kC,{align:"center",justify:"space-between",mb:"10px",children:[(0,r.jsx)(p.xv,{variant:"numeralsS",fontWeight:"semibold",children:Y}),m&&(0,r.jsx)(p.xv,{variant:"numeralsTiny",color:"base.4",children:"Ended"})]}),b.length>0&&!C&&(0,r.jsxs)(p.kC,{direction:"column",children:[(0,r.jsx)(p.xv,{variant:"numeralsTiny",color:"base.4",mb:"4px",children:"Applied:"}),b.map((function(e){return(0,r.jsxs)(p.xv,{variant:"numeralsTiny",children:[(0,$n.p6)(null!==(o=e.applied_at)&&void 0!==o?o:e.execute_at,"MMM dd, HH:mm"),":"," ",e.old_end_date?et(e.old_end_date):"\u2014"," \u2192"," ",et(e.new_end_date)]},e.id)}))]}),!C&&g&&(0,r.jsxs)(p.kC,{direction:"column",justify:"space-between",flex:1,gap:"4px",borderTopWidth:1,borderTopColor:"#E8E8E3",mt:"10px",pt:"10px",children:[(0,r.jsxs)(p.kC,{direction:"column",gap:"2px",children:[(0,r.jsxs)(p.kC,{align:"baseline",gap:"6px",children:[(0,r.jsx)(p.xv,{variant:"numeralsTiny",fontWeight:"semibold",children:"Scheduled:"}),(0,r.jsx)(p.xv,{variant:"numeralsTiny",children:(0,$n.p6)(g.execute_at,"MMM dd, HH:mm")}
1)]}),(0,r.jsxs)(p.xv,{variant:"numeralsTiny",children:["New end: ",et(g.new_end_date)]})]}),(0,r.jsxs)(p.kC,{gap:"6px",mt:"8px",children:[(0,r.jsx)(M.Z,{size:"sm",variant:"base.1.outline",leftIcon:(0,r.jsx)(f.Z,{icon:"editicon",size:14}),onClick:function(){return q(g)},children:"Edit"}),(0,r.jsx)(M.Z,{size:"sm",variant:"base.1.outline",leftIcon:(0,r.jsx)(f.Z,{icon:"closeicon",size:14}),isLoading:L,onClick:B,children:"Cancel extension"})]})]}),!C&&!g&&!m&&(0,r.jsx)(p.kC,{flex:1,align:"flex-end",mt:"8px",children:(0,r.jsx)(M.Z,{size:"sm",onClick:function(){return q()},children:"+ Schedule"})}),C&&(0,r.jsxs)(p.kC,{direction:"column",justify:"space-between",flex:1,gap:"10px",children:[(0,r.jsxs)(p.kC,{direction:"column",gap:"10px",children:[(0,r.jsx)(Ge.Z,{selected:k,onChange:function(e){return S(e)},showTimeInput:!0,timeIntervals:5,maxDate:c,placeholderText:"Execute at (date & time)",isClearable:!1}),(0,r.jsx)(Ge.Z,{selected:E,onChange:function(e){return T(e)},minDate:(0,Vn.default)(c,1),maxDate:u,placeholderText:"New end date",isClearable:!1}),F&&(0,r.jsx)(p.xv,{variant:"numeralsTiny",color:"red.500",children:F})]}),(0,r.jsxs)(p.kC,{gap:"6px",mt:"8px",children:[(0,r.jsx)(M.Z,{size:"sm",isLoading:D,isDisabled:!k||!E,onClick:W,children:"Save"}),(0,r.jsx)(M.Z,{size:"sm",variant:"base.1.outline",onClick:U,children:"Close"})]})]})]})},it=t(87556),rt=function(e){var n=e.label,t=e.current,i=e.enabled,a=e.onDateToggle,o=(0,c.Z)(e.dates,2),s=o[0],l=o[1],u=e.setDates,d=e.append,x=e.devAction,h=function(e){u(e)};return(0,r.jsxs)(ne,{w:"100%",align:"center",children:[(0,r.jsxs)(p.kC,{w:"100%",justify:"space-between",align:"center",p:"40px 0",borderBottomWidth:1,borderBottomColor:"base.1",children:[(0,r.jsxs)(p.kC,{align:"center",gap:1,children:[t&&(0,r.jsx)(f.Z,{fill:"accent1.2",icon:"checkboxicon"}),(0,r.jsx)(p.xv,{color:t?"accent1.1":void 0,variant:"numeralsS",children:n})]}),(0,r.jsx)(oe.r,{isChecked:i,onChange:function(){return a(!i)}})]}),(0,r.jsxs)(p.kC,{w:"100%",mt:{base:"20px",lg:"0"},align:"center",children:[(0,r.jsxs)(p.kC,{pointerEvents:i?"auto":"none",opacity:i?1:.2,flexShrink:0,flex:1,position:"relative",role:"group",gap:"15px",children:[(0,r.jsx)(Ge.Z,{onChange:function(e){return h([e,l])},placeholderText:"Start Date",selected:s||null,maxDate:l||void 0,isClearable:!1,containerProps:{flex:1}}),(0,r.jsx)(Ge.Z,{onChange:function(e){return h([s,e])},placeholderText:"End Date",selected:l||null,minDate:s||void 0,isClearable:!1,containerProps:{flex:1}}),R.Ts&&(0,r.jsx)(M.Z,{ml:"10px",size:"md",onClick:x,_groupHover:{opacity:1},zIndex:2,opacity:0,rightIcon:(0,r.jsx)(f.Z,{icon:"tagicon",fill:"base.6"}),position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)",children:"Today"})]}),(0,r.jsx)(p.kC,{pointerEvents:i?"auto":"none",opacity:i?1:.2,children:d||null})]})]})},at=[k.D7.EARLY_BIRD_SPECIAL,k.D7.NORMALENTRY,k.D7.EXTENDEDENTRY],ot=(_n={},(0,Oe.Z)(_n,k.D7.EARLY_BIRD_SPECIAL,k.Lo.EARLY_BIRD_SUBMISSION),(0,Oe.Z)(_n,k.D7.NORMALENTRY,k.Lo.REGULAR_SUBMISSION),(0,Oe.Z)(_n,k.D7.EXTENDEDENTRY,k.Lo.EXTENDED_SUBMISSION),_n),st=[k.D7.EARLY_BIRD_SPECIAL,k.D7.NORMALENTRY,k.D7.EXTENDEDENTRY,k.D7.INTERNALVOTING],lt={early_bird_discount:"Discount",regular_discount:"Discount",extended_discount:"Discount"},ct=(0,C.Pi)((function(e){var n=e.discountType,t=e.publicPricingEnabled;return(0,r.jsxs)(p.kC,{children:[(0,r.jsx)(p.kC,{w:"60px",p:"0 10px",children:"extended_discount"===n&&(0,r.jsxs)(p.kC,{direction:"column",justify:"flex-start",children:[(0,r.jsx)(p.xv,{variant:"fieldsTitleS",mb:"7px",color:"base_2.2",children:"Public"}),(0,r.jsx)(oe.r,{isChecked:t,onChange:function(e){var n=e.target.checked;return(0,j.z)((function(){Z.h_.data.extendedPricingVisible=n}))}})]})}),(0,r.jsxs)(de.BZ,{maxW:"110px",alignItems:"center",children:[(0,r.jsx)(I.Z,{type:"number",placeholder:lt[n],value:Z.h_.data[n],onChange:function(e){return(0,j.z)((function(){Z.h_.data[n]=e.target.value}))}}),(0,r.jsx)(de.xH,{h:"100%",children:(0,r.jsx)($.Z,{placement:"left",label:"Use negative values (-10) for cheaper entry prices and larger than zero values for more expensive entries",children:(0,r.jsx)(f.Z,{icon:"infoicon",size:18})})})]})]})})),ut=(0,C.Pi)((function(e){var n=e.dateKey;
1if(n===k.D7.EARLY_BIRD_SPECIAL)return(0,r.jsx)(ct,{discountType:"early_bird_discount",publicPricingEnabled:!1});if(n===k.D7.NORMALENTRY)return(0,r.jsx)(ct,{discountType:"regular_discount",publicPricingEnabled:!1});if(n===k.D7.EXTENDEDENTRY){var t=Z.h_.data.extendedPricingVisible;return(0,r.jsx)(ct,{discountType:"extended_discount",publicPricingEnabled:t})}return n===k.D7.WINNERANNOUNCEMENT?(0,r.jsx)(p.kC,{position:"relative",children:(0,r.jsx)($.Z,{placement:"bottom-end",label:"Winner Announcement end date is set at 00:00 of the chosen date",children:(0,r.jsx)(f.Z,{p:"10px",icon:"infoicon",size:18})})}):null})),dt=(0,C.Pi)((function(){var e=Z.h_.data.timeframes,n=Z.h_.contest,t=(0,_.useState)([]),i=t[0],s=t[1],l=(0,_.useCallback)((0,a.Z)(d().mark((function e(){var t,i,r;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===n||void 0===n?void 0:n.slug){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,A.ZP)({path:"/api/admin/contests/manage/".concat(n.slug,"/stage-extensions/")});case 4:t=e.sent,i=t.status,r=t.data,i===R.RS.HTTP_200_OK&&r&&s(r);case 8:case"end":return e.stop()}}),e)}))),[null===n||void 0===n?void 0:n.slug]);(0,_.useEffect)((function(){l()}),[l]);var u=function(e){s((function(n){var t=n.findIndex((function(n){return n.stage===e.stage&&!n.applied}));if(t>=0){var i=(0,y.Z)(n);return i[t]=e,i}return[e].concat((0,y.Z)(n))}))},x=function(e){s((function(n){return n.filter((function(n){return!(n.stage===e&&!n.applied)}))}))},h=function(n){for(var t=st.indexOf(n)+1;t<st.length;t++){var i=st[t],r=e[i];if((null===r||void 0===r?void 0:r.enabled)&&r.endDate)return r.endDate}return null},v=function(e){var n=(0,Yn.NP)(e);(0,j.z)((function(){Z.h_.data.timeframes=n}))},m=(null===n||void 0===n?void 0:n.slug)?at.filter((function(n){var t=e[n];if(!(null===t||void 0===t?void 0:t.enabled)||!t.endDate)return!1;var i=h(n);return(i?(0,it.default)(i,1):t.endDate)>t.endDate})):[];return(0,r.jsxs)(p.kC,{w:"100%",direction:"column",children:[Object.entries(e).map((function(n){var t=(0,c.Z)(n,2),i=t[0],a=t[1],s=a.enabled,l=a.startDate,u=a.endDate,d=i,p=Qn()().isBetween(l,u);return(0,r.jsx)(rt,{current:p,label:Yn.Ex[d],enabled:s,onDateToggle:function(){return function(n){var t=!Z.h_.data.timeframes[n].enabled;(0,j.z)((function(){Z.h_.data.timeframes[n].enabled=t,n!==k.D7.EXTENDEDENTRY||t||(Z.h_.data.extendedPricingVisible=!1)})),v((0,j.ZN)(e))}(d)},dates:[l,u],setDates:function(n){return function(n,t){var i=(0,c.Z)(t,2),r=i[0],a=i[1],o=(0,j.ZN)(e);o[n].startDate=r,o[n].endDate=a,v(o)}(d,n)},devAction:function(){return function(e){var n=Yn.hC.slice(),t=n.indexOf(e),i=n.splice(0,t),r=n.reduce((function(e,n,t){var i=n;if(t){var r=Qn()(Object.values(e)[t-1].endDate).add(1,"d").toDate(),a=Qn()(Object.values(e)[t-1].endDate).add(6,"d").toDate();e[i]={startDate:r,endDate:a,duration:0,enabled:!0}}else{var o=Qn()().toDate(),s=Qn()().add(5,"d").toDate();e[i]={startDate:o,endDate:s,duration:0,enabled:!0}}return e}),{}),a=i.reverse().reduce((function(e,n,t){var i=n;if(t){var r=Qn()(Object.values(e)[t-1].startDate).subtract(1,"d").toDate(),a=Qn()(Object.values(e)[t-1].startDate).subtract(6,"d").toDate();e[i]={startDate:a,endDate:r,duration:0,enabled:!0}}else{var o=Qn()().subtract(6,"d").toDate(),s=Qn()().subtract(1,"d").toDate();e[i]={startDate:o,endDate:s,duration:0,enabled:!0}}return e}),{});v((0,o.Z)({},a,r))}(d)},append:(0,r.jsx)(ut,{dateKey:d})},d)})),m.length>0&&(0,r.jsxs)(p.kC,{direction:"column",mt:"48px",mb:"16px",children:[(0,r.jsxs)(p.kC,{align:"center",gap:"8px",mb:"16px",children:[(0,r.jsx)(f.Z,{icon:"saveforlater",size:24}),(0,r.jsx)(p.X6,{variant:"titleS",children:"Stage Extension Scheduling"})]}),(0,r.jsx)(p.MI,{columns:{base:1,md:m.length},gap:"12px",children:m.map((function(t){var a=ot[t],o=e[t].endDate,s=h(t),l=s?(0,it.default)(s,1):o;return(0,r.jsx)(tt,{stage:a,contestSlug:n.slug,stageEndDate:o,maxNewEndDate:l,extensions:i,onUpsert:u,onRemove:x},a)}))})]})]})})),pt=t(84855),xt=function(e){var n,t,i=e.text,s=e.image,l=e.onAdd,u=e.onRemove,x=(0,_.useState)(!1),h=x[0],v=x[1],m=(0,pt.Z)({toastErrors:!0}),g=(0,_.useCallback)(function(){var e=(0,a.Z)(d().mark((function e(n){var t,i,r;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(0,c.Z)(n,1),i=t[0],v(!0),e.next=4,m(i);case 4:r=e.sent,l(r),v(!1);case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),[l,m]),b=(0,F.uI)({onDrop:g,accept:K.KL.join(", "),noDrag:!0,maxSize:K.Tb}),j=b.getInputProps,C=b.open;return(null===s||void 0===s?void 0:s.url)?(0,r.jsxs)(p.kC,{position:"relative",h:"290px",border:"1px solid",borderColor:"base_2.2",borderRadius:"4px",children:[(0,r.jsxs)(p.xu,{m:"20px",position:"relative",width:"100%",children:[(0,r.jsx)(O.Z,{objectFit:"contain",src:(0,K.Jn)(null===s||void 0===s||null===(n=s.sizes)||void 0===n||null===(t=n.small)||void 0===t?void 0:t.url),layout:"fill",alt:(null===s||void 0===s?void 0:s.title)||""}),(0,r.jsx)(q.Z,{uploadId:s.id,button:(0,r.jsx)(z.hU,{"aria-label":"Edit Image",variant:"flat",icon:(0,r.jsx)(f.Z,{icon:"editicon",size:20,fill:"base.6"}
1),bg:"base.4",borderRadius:"15px",p:"0",minW:"0",minH:"0",w:"30px",height:"30px",as:"span"})})]}),(0,r.jsx)(p.kC,{align:"center",justify:"center",bg:"system.error",h:"40px",w:"40px",borderRadius:"50%",position:"absolute",top:"20px",right:"20px",cursor:"pointer",onClick:u,children:(0,r.jsx)(f.Z,{icon:"trashicon",size:20,fill:"base.6"})})]}):(0,r.jsx)(p.Kq,{h:"290px",dir:"column",spacing:"20px",align:"center",justify:"center",borderRadius:"4px",border:"1px solid",borderColor:"base_2.2",p:"30px",children:h?(0,r.jsx)(L.D8,{isIndeterminate:!0,color:"accent1.3"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",(0,o.Z)({},j())),(0,r.jsx)(f.Z,{icon:"upload",size:50}),(0,r.jsx)(p.xv,{variant:"description",maxW:"300px",align:"center",children:i}),(0,r.jsx)(M.Z,{variant:"base.1.outline",size:"md",onClick:function(){return C()},children:"Upload Image"})]})})},ht=[{title:"Main Contest Image",tabs:[{key:"featured_image_desktop",title:"Desktop",text:"Upload Desktop Contest Cover. We recommend 3:2 Ratio and max width 2880px"},{key:"featured_image_mobile",title:"Mobile",text:"Upload Mobile Contest Cover. We recommend 2:3 Ratio and max width 1125px. Leave empty to use the desktop image."}]},{title:"Entry Type Images",tabs:[{key:"single_image",title:"Single",text:"Upload Single Entry Cover. We recommend 2:3 Ratio and max width 1680px"},{key:"series_image",title:"Series",text:"Upload Series Entry Cover. We recommend 2:3 Ratio and max width 1680px"}]},{title:"Entry Level Images",tabs:[{key:"professional_image",title:"Professional",text:"Upload Professional Entry Cover. We recommend 2:3 Ratio and max width 1680px"},{key:"non_professional_image",title:"Non-Professional",text:"Upload Non-Professional Entry Cover. We recommend 2:3 Ratio and max width 1680px"}]}],ft=function(e){var n=e.title,t=e.children;return(0,r.jsx)(p.xu,{display:"inline-flex",w:"100%",mb:"40px",children:(0,r.jsxs)(p.kC,{direction:"column",w:"100%",children:[(0,r.jsx)(p.xv,{variant:"numeralsTiny",mb:"20px",children:n}),t]})})},vt=(0,ee.Pi)((function(){var e=(0,_.useCallback)((function(e){var n=e.key,t=e.image;(0,j.z)((function(){Z.h_.data.images[n]=t}))}),[]);return(0,r.jsx)(p.xu,{sx:{columnCount:{md:2},gap:{md:"40px",lg:"135px"}},children:ht.map((function(n){var t=n.tabs.map((function(n){var t=n.title,i=n.text,a=n.key;return{title:t,body:(0,r.jsx)(xt,{text:i,image:Z.h_.data.images[a],onAdd:function(n){return e({key:a,image:n})},onRemove:function(){return e({key:a,image:null})}})}}));return(0,r.jsx)(ft,{title:n.title,children:(0,r.jsx)(Te,{items:t})},n.title)}))})})),mt=t(98935),gt=function(e){var n=e.color,t=e.data,i=(0,me.rd)("base_2.2"),a=t.type,o=t.code,s=t.description,l=t.name,c=t.rule_set,u=t.value,d=c.validity,x=d.start_date,h=d.end_date,v=(0,_.useMemo)((function(){return x&&h?"".concat((0,$n.p6)(x,"MMMM dd, yyyy")," - ").concat((0,$n.p6)(h,"MMMM dd, yyyy")):"Unlimited"}),[h,x]),m=(0,_.useMemo)((function(){return a===mt.Lb.PERCENTAGE?"".concat(u,"%"):"$".concat((0,J.Wy)(+u))}),[a,u]);return(0,r.jsxs)(p.Kq,{spacing:"15px",p:"20px",border:"1px solid",borderColor:n,borderRadius:"4px",color:n,children:[(0,r.jsxs)(p.kC,{align:"flex-start",justify:"space-between",children:[(0,r.jsx)(p.xv,{pr:"20px",variant:"numeralsXS",children:l}),(0,r.jsx)(p.xu,{cursor:"pointer",onClick:function(){(0,j.z)((function(){G.currentSlide=kn.DETAIL,G.editingCouponId=t.id}))},css:"\n            path {\n              fill: ".concat(i,";\n              transition: fill 0.2s linear;\n            }\n            &:hover {\n              path {\n                fill: ").concat(n,";\n              }\n            }\n          "),children:(0,r.jsx)(f.Z,{icon:"editicon",size:20})})]}),(0,r.jsx)(p.xv,{variant:"description",wordBreak:"break-all",children:s}),(0,r.jsxs)(p.Kq,{spacing:"3px",align:"flex-start",direction:"column",children:[(0,r.jsxs)(p.xv,{variant:"numeralsTiny",children:["Amount: ",m]}),(0,r.jsxs)(p.xv,{variant:"numeralsTiny",textAlign:"left",pr:"10px",children:["Active Period: ",v]}),(0,r.jsxs)(p.xv,{variant:"numeralsTiny",children:["Code: ",o]})]})]})},bt=function(e){var n=e.label,t=e.icon,i=e.onClick;return(0,r.jsx)(M.Z,{variant:"flat",size:"sm",leftIcon:t,onClick:i,children:n})},jt=(0,C.Pi)((function(e){var n,t=e.navToSlideKey,i=e.onClose;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:"Discounts",onClose:i,children:(0,r.jsxs)(p.kC,{align:"center",justify:"space-between",pt:"20px",pb:"10px",children:[(0,r.jsx)(bt,{label:"Create New",icon:(0,r.jsx)(f.Z,{icon:"plusboxedicon",fill:"base.6"}),onClick:function(){return t(kn.DETAIL)}}),(0,r.jsx)(bt,{label:"Search",icon:(0,r.jsx)(f.Z,{icon:"searchicon",fill:"base.6"}),onClick:function(){return t(kn.DETAIL)}})]})}
1),(0,r.jsx)(le.aF,{children:(null===G||void 0===G||null===(n=G.coupons)||void 0===n?void 0:n.length)?(0,r.jsx)(p.Kq,{spacing:"15px",children:G.coupons.map((function(e){return(0,r.jsx)(gt,{data:e},e.id)}))}):(0,r.jsx)(p.xv,{children:"No coupons"})})]})})),Ct=t(47011),Zt=t(37824),yt=function(e){return(0,r.jsx)(I.Z,(0,o.Z)({variant:"light"},e))},_t=(0,C.Pi)((function(){var e=(0,Ct.L)().contests.map((function(e){return{value:e.id,label:e.name}})),n=(0,pn.u6)().values;return(0,r.jsx)(pn.l0,{children:(0,r.jsxs)(p.Kq,{spacing:"20px",children:[(0,r.jsx)(dn.Z,{name:"name",render:function(e){var n=e.field;return(0,r.jsx)(yt,(0,o.Z)({placeholder:"Name"},n))}}),(0,r.jsx)(dn.Z,{name:"description",render:function(e){var n=e.field;return(0,r.jsx)(Fe.Z,(0,o.Z)({variant:"light",rows:4,placeholder:"Description"},n))}}),(0,r.jsx)(dn.Z,{name:"accessibility",render:function(e){var n=e.field;return(0,r.jsxs)(P.Z,(0,s.Z)((0,o.Z)({variant:"light",placeholder:"Accessibility"},n),{children:[(0,r.jsx)("option",{value:mt.OF.SITE_WIDE,children:"Site-Wide"}),(0,r.jsx)("option",{value:mt.OF.CONTEST,children:"Contest"})]}))}}),n.accessibility===mt.OF.CONTEST&&(0,r.jsx)(dn.Z,{name:"contests",render:function(n){var t=n.field,i=n.helpers;return(0,r.jsx)(Zt.Z,(0,s.Z)((0,o.Z)({},t),{isMulti:!0,placeholder:"Contest",value:t.value,onChange:function(e){return i.setValue(e)},options:e}))}}),(0,r.jsxs)(p.Kq,{direction:"row",spacing:"10px",align:"flex-start",children:[(0,r.jsx)(dn.Z,{name:"type",render:function(e){var n=e.field;return(0,r.jsxs)(P.Z,(0,s.Z)((0,o.Z)({variant:"light",placeholder:"Type"},n),{children:[(0,r.jsx)("option",{value:mt.Lb.PERCENTAGE,children:"Percentage"}),(0,r.jsx)("option",{value:mt.Lb.AMOUNT,children:"Fixed amount"})]}))}}),(0,r.jsx)(dn.Z,{name:"value",render:function(e){var t=e.field;return(0,r.jsxs)(de.BZ,{children:[(0,r.jsx)(yt,(0,o.Z)({type:"number",placeholder:"Amount Off"},t)),(0,r.jsx)(de.xH,{h:"100%",top:"auto",bottom:"0px",children:n.type===mt.Lb.PERCENTAGE?(0,r.jsx)(f.Z,{icon:"percent",width:14,height:13,fill:"base_2.2"}):(0,r.jsx)(f.Z,{icon:"rewarddollars",fill:"base_2.2"})})]})}})]}),(0,r.jsx)(dn.Z,{name:"activePeriod",render:function(e){var n=e.field;return(0,r.jsxs)(P.Z,(0,s.Z)((0,o.Z)({variant:"light",placeholder:"Active Period"},n),{children:[(0,r.jsx)("option",{value:mt.g_.UNLIMITED,children:"Unlimited"}),(0,r.jsx)("option",{value:mt.g_.TIME_RANGE,children:"Time range"})]}))}}),n.activePeriod===mt.g_.TIME_RANGE&&(0,r.jsxs)(p.Kq,{direction:"row",spacing:"10px",align:"flex-start",children:[(0,r.jsx)(dn.Z,{name:"start_date",render:function(e){var n=e.field,t=e.helpers;return(0,r.jsx)(Ge.Z,(0,s.Z)((0,o.Z)({},n),{placeholderText:"From",inputProps:{variant:"light"},selected:n.value,onChange:function(e){return t.setValue(e)}}))}}),(0,r.jsx)(dn.Z,{name:"end_date",render:function(e){var n=e.field,t=e.helpers;return(0,r.jsx)(Ge.Z,(0,s.Z)((0,o.Z)({},n),{placeholderText:"To",inputProps:{variant:"light"},selected:n.value,onChange:function(e){return t.setValue(e)}}))}})]}),(0,r.jsx)(dn.Z,{name:"is_unlimited",render:function(e){var n=e.field;return(0,r.jsx)(Q.Z,(0,s.Z)((0,o.Z)({variant:"light",label:"Unlimited use (overall)"},n),{isChecked:n.value}))}}),!n.is_unlimited&&(0,r.jsx)(dn.Z,{name:"overallMaxUses",render:function(e){var n=e.field;return(0,r.jsx)(yt,(0,o.Z)({placeholder:"Max. Uses (overall)"},n))}}),(0,r.jsx)(dn.Z,{name:"is_unlimited_for_user",render:function(e){var n=e.field;return(0,r.jsx)(Q.Z,(0,s.Z)((0,o.Z)({variant:"light",label:"Unlimited per user"},n),{isChecked:n.value}))}}),!n.is_unlimited_for_user&&(0,r.jsx)(dn.Z,{name:"perUserMaxUses",render:function(e){var n=e.field;return(0,r.jsx)(yt,(0,o.Z)({placeholder:"Max. Uses per user"},n))}}),(0,r.jsx)(dn.Z,{name:"code",render:function(e){var n=e.field;return(0,r.jsx)(yt,(0,o.Z)({placeholder:"Code"},n))}})]})})})),kt=t(54425),St=t.n(kt),wt={name:"",description:"",code:"",type:mt.Lb.PERCENTAGE,value:0,contests:[],accessibility:mt.OF.SITE_WIDE,activePeriod:mt.g_.UNLIMITED,start_date:null,end_date:null,is_unlimited:!0,overallMaxUses:1,is_unlimited_for_user:!0,perUserMaxUses:1,usesCount:1},Et=(0,xn.Ry)({name:(0,xn.Z_)().required("Required"),description:(0,xn.Z_)(),code:(0,xn.Z_)().required("Required").max(20,"Max ".concat(20," characters")),type:(0,xn.nK)().oneOf(Object.values(mt.Lb)).required("Required"),accessibility:(0,xn.nK)().oneOf(Object.values(mt.OF)).required("Required"),value:(0,xn.Rx)().min(1,"Discount value must be greater than 0").required("Required").when("type",{is:mt.Lb.PERCENTAGE,then:function(e){return e.max(100,"Discount percentage c
1annot be bigger than 100")},otherwise:function(e){return e}}),contests:(0,xn.IX)().required("Required").of((0,xn.Ry)({label:(0,xn.Z_)(),value:(0,xn.Rx)()})).when("accessibility",{is:mt.OF.CONTEST,then:function(e){return e.min(1,"Select at least one contest")},otherwise:function(e){return e}}),activePeriod:(0,xn.nK)().oneOf(Object.values(mt.g_)).required("Required"),start_date:(0,xn.hT)().nullable().when("activePeriod",{is:mt.g_.TIME_RANGE,then:function(e){return e.when("end_date",(function(e,n){return e?n.max(e,"cannot be later than discount end date"):n})).required("Required")},otherwise:function(e){return e}}),end_date:(0,xn.hT)().nullable().when("activePeriod",{is:mt.g_.TIME_RANGE,then:function(e){return e.required("Required")},otherwise:function(e){return e}}),is_unlimited:(0,xn.O7)(),is_unlimited_for_user:(0,xn.O7)(),overallMaxUses:(0,xn.Rx)().when("is_unlimited",{is:!1,then:function(e){return e.min(1,"Value must be greater than zero").required("Required")},otherwise:function(e){return e}}),perUserMaxUses:(0,xn.Rx)().when("is_unlimited_for_user",{is:!1,then:function(e){return e.min(1,"Value must be greater than zero").required("Required")},otherwise:function(e){return e}})}),Tt=function(e){var n=e.name,t=e.accessibility,i=e.activePeriod,r=e.code,a=e.contests,o=void 0===a?[]:a,s=e.description,l=e.end_date,c=e.start_date,u=e.type,d=e.is_unlimited,p=e.is_unlimited_for_user,x=e.overallMaxUses,h=e.perUserMaxUses,f=e.value,v=i!==mt.g_.UNLIMITED,m=t===mt.OF.CONTEST?o.map((function(e){return e.value})):[];return{name:n,description:s,type:u,value:u===mt.Lb.AMOUNT?100*f:f,code:r,rule_set:{contests:m,uses:{max:x,per_user:h,is_unlimited:d,is_unlimited_for_user:p},validity:{start_date:v?St()(c).format("YYYY-MM-DD"):null,end_date:v?St()(l).format("YYYY-MM-DD"):null}}}},It=(0,C.Pi)((function(e){var n=e.navToSlideKey,t=(0,N.Z)(),i=(0,Ct.L)().contests,s=(0,_.useState)((0,o.Z)({},wt)),l=s[0],c=s[1],u=function(){var e=(0,a.Z)(d().mark((function e(n){var i,a,o,s,l,c,u;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Tt(n),a=G.editingCouponId?"/api/admin/coupons/".concat(G.editingCouponId,"/"):"/api/admin/coupons/",o=G.editingCouponId?"PUT":"POST",e.next=5,(0,A.ZP)({path:a,method:o,body:i,returnErrors:!0});case 5:if(201===(s=e.sent).status||200===s.status)t({status:"success",title:201===s.status?"Coupon created":"Coupon updated"}),l=G.coupons.slice(),201===s.status?l.push(s.data):(c=l.findIndex((function(e){return e.id===s.data.id})),c>-1&&(l[c]=s.data)),(0,j.z)((function(){G.currentSlide=kn.LIST,G.editingCouponId=null,G.coupons=l}));else{u=[];try{u=(0,S.Eo)(s.data)}catch(d){u=[R.FI]}t({status:"error",title:(0,r.jsx)(r.Fragment,{children:u.map((function(e,n){return(0,r.jsxs)("span",{children:[e,(0,r.jsx)("br",{})]},n)}))})})}case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),p=(0,_.useCallback)((function(){var e=(0,o.Z)({},wt);if(G.editingCouponId){var n=G.coupons.find((function(e){return e.id===G.editingCouponId}));n&&(e.code=n.code,e.type=n.type,n.type===mt.Lb.PERCENTAGE?e.value=n.value:e.value=n.value/100,e.name=n.name,e.description=n.description,e.is_unlimited=n.rule_set.uses.is_unlimited,e.is_unlimited_for_user=n.rule_set.uses.is_unlimited_for_user,e.overallMaxUses=n.rule_set.uses.max,e.perUserMaxUses=n.rule_set.uses.per_user,n.rule_set.contests.length&&(e.accessibility=mt.OF.CONTEST,e.contests=i.filter((function(e){var t=e.id;return n.rule_set.contests.includes(t)})).map((function(e){return{value:e.id,label:e.name}}))),n.rule_set.validity.start_date&&n.rule_set.validity.end_date&&(e.activePeriod=mt.g_.TIME_RANGE,e.start_date=new Date(n.rule_set.validity.start_date),e.end_date=new Date(n.rule_set.validity.end_date)))}c(e)}),[i]);return(0,_.useEffect)((function(){return(0,j.U5)((function(){return G.editingCouponId}),p,{fireImmediately:!0})}),[p]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.B4,{title:G.editingCouponId?"Update Discount":"Create Discount",icon:De.Z,onClose:function(){n(kn.LIST),(0,j.z)((function(){G.editingCouponId=null}))}}),(0,r.jsx)(pn.J9,{initialValues:l,validationSchema:Et,onSubmit:u,enableReinitialize:!0,children:function(e){var n=e.isSubmitting,t=e.handleSubmit;
1return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le.aF,{children:(0,r.jsx)(_t,{})}),(0,r.jsx)(le.Zy,{children:(0,r.jsx)(M.Z,{variant:"accent1.3.fill",type:"submit",isLoading:n,onClick:function(){return t()},children:G.editingCouponId?"Update":"Create"})})]})}})]})}));!function(e){e.LIST="LIST",e.DETAIL="DETAIL"}(kn||(kn={}));var Dt=(0,C.Pi)((function(){var e=function(e){(0,j.z)((function(){G.currentSlide=e}))},n=function(){(0,j.z)((function(){G.editingCouponId=null})),e(null)},t=(0,_.useCallback)((0,a.Z)(d().mark((function e(){var n;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,A.ZP)({path:"/api/admin/coupons/"});case 2:n=e.sent,(0,j.z)((function(){G.coupons=n.data||[]}));case 4:case"end":return e.stop()}}),e)}))),[]);return(0,_.useEffect)((function(){t()}),[t]),(0,r.jsx)(se.Z,{externalOpen:!!G.currentSlide,externalClose:n,trigger:function(){return(0,r.jsx)(Ie,{label:"Add Discount",onClick:function(){return e(kn.LIST)}})},children:function(){return(0,r.jsx)(le.ZP,{activeSlide:G.currentSlide,slides:(t=n,i=function(n){return e(n)},[{key:kn.LIST,component:function(){return(0,r.jsx)(jt,{navToSlideKey:i,onClose:t})}},{key:kn.DETAIL,component:function(){return(0,r.jsx)(It,{navToSlideKey:i,onClose:t})}}])});var t,i}})})),Pt=(0,ee.Pi)((function(){var e=(0,_.useState)([]),n=e[0],t=e[1],i=(0,_.useCallback)((0,a.Z)(d().mark((function e(){var n,i,r;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=null===(n=Z.h_.contest)||void 0===n?void 0:n.slug)){e.next=7;break}return e.next=5,(0,A.ZP)({path:"/api/admin/contests/".concat(i,"/coupons/")});case 5:r=e.sent,t((null===r||void 0===r?void 0:r.data)||[]);case 7:case"end":return e.stop()}}),e)}))),[]);return(0,_.useEffect)((function(){return(0,j.U5)((function(){return G.coupons}),i,{fireImmediately:!0})}),[i]),(0,r.jsxs)(p.rj,{mt:"40px",columnGap:{base:"20px",lg:"40px"},rowGap:{base:"20px",lg:"40px"},templateColumns:{base:"1fr",md:"repeat(2, 1fr)",lg:"repeat(3, 1fr)"},children:[n.map((function(e){return(0,r.jsx)(p.xu,{w:"100%",children:(0,r.jsx)(gt,{data:e,color:"base.1"})},e.id)})),(0,r.jsx)(p.xu,{w:"100%",children:(0,r.jsx)(Dt,{})})]})})),Rt=(0,r.jsxs)(r.Fragment,{children:["You cannot attach discounts to a non-existing contest. You have to create the contest first. If you don't want the contest to be visible on the site, you can make it private by enabling the ",(0,r.jsx)("u",{children:"Private"})," checkbox from the bottom of the page."]}),Nt=function(){var e=Z.h_.contest;return(0,r.jsxs)(p.kC,{direction:"column",p:{base:"40px 30px",lg:"40px 60px"},borderTopWidth:"1px",borderTopColor:"base_2.4",children:[(0,r.jsxs)(p.kC,{align:"center",children:[(0,r.jsx)(p.xv,{variant:"titleM",children:"Discounts"}),(null===e||void 0===e?void 0:e.id)?null:(0,r.jsx)(p.xu,{ml:"20px",children:(0,r.jsx)($.Z,{label:Rt,placement:"right",children:(0,r.jsx)(f.Z,{icon:"erroricon",size:30,fill:"system.error"})})})]}),(null===e||void 0===e?void 0:e.id)?(0,r.jsx)(Pt,{}):null]})},At=t(86818),Lt=(0,C.Pi)((function(){var e,n,t,i,a=(null===(e=Z.h_.data.general)||void 0===e||null===(n=e.bundles_content)||void 0===n?void 0:n.text_rows)||["","",""];return(0,r.jsxs)(p.kC,{w:"100%",direction:{base:"column",md:"row"},gap:{md:40,lg:135},children:[(0,r.jsx)(p.kC,{direction:"column",gap:"20px",flex:1,mb:{base:"40px",md:0},children:a.map((function(e,n){return(0,r.jsxs)(p.kC,{gap:"20px",align:"flex-end",children:[(0,r.jsx)(f.Z,{icon:At.W[n],fill:"accent1.2",size:24,mb:"10px"}),(0,r.jsx)(I.Z,{value:e,onChange:function(e){!function(e,n){var t=(0,y.Z)(a);t[e]=n,(0,j.z)((function(){Z.h_.data.general.bundles_content.text_rows=t}))}(n,e.target.value)}})]},n)}))}),(0,r.jsx)(p.kC,{direction:"column",flex:1,children:(0,r.jsx)(Fe.Z,{placeholder:"Popup Description",rows:7,value:(null===(t=Z.h_.data.general)||void 0===t||null===(i=t.bundles_content)||void 0===i?void 0:i.popup_description)||"",onChange:function(e){return(0,j.z)((function(){Z.h_.data.general.bundles_content.popup_description=e.target.value}))}})})]})})),zt=[{label:"Artist Name",value:"{artist_name}"},{label:"Contest Title",value:"{contest_title}"},{label:"Contest Year",value:"{contest_year}"}
1],Ot=(0,C.Pi)((function(e){var n=e.label,t=e.accessor,i=e.limit,a=Z.h_.data[t];return(0,r.jsxs)(p.kC,{direction:"column",w:"100%",children:[(0,r.jsx)(Mn,{value:a,onChange:function(e){(0,j.z)((function(){Z.h_.data[t]=e.target.value}))},rows:10,heightAuto:!1,placeholder:n,tags:zt,maxLength:i}),(0,r.jsxs)(p.xv,{mt:"5px",variant:"overline",children:[a.length," / ",i]})]})})),Ft=function(){return(0,r.jsx)(p.kC,{w:"100%",direction:{base:"column",md:"row"},gap:{md:40,lg:135},children:(0,r.jsx)(Ot,{label:"Left paragraph",accessor:"press_release_left_column",limit:875})})},Kt=t(96198),Mt=t(97129),qt=t(72263),Ut=(0,xn.Ry)({title:(0,xn.Z_)().nullable()}),Wt=function(e){var n=e.title,t=e.saveTitle,i=e.button,s=(0,Mt.qY)(),l=s.isOpen,c=s.onOpen,u=s.onClose,x=function(){var e=(0,a.Z)(d().mark((function e(n){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t(n.title||""),u();case 2:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(M.Z,{variant:"flat",size:"sm",onClick:c,children:i}),(0,r.jsxs)(qt.u_,{isOpen:l,onClose:u,isCentered:!0,children:[(0,r.jsx)(qt.ZA,{}),(0,r.jsx)(qt.hz,{bg:"support1.4",borderRadius:"0",children:(0,r.jsx)(pn.J9,{onSubmit:x,initialValues:{title:n||""},validationSchema:Ut,children:function(e){var n=e.isSubmitting;return(0,r.jsxs)(pn.l0,{children:[(0,r.jsx)(qt.fe,{children:(0,r.jsx)(dn.Z,{name:"title",render:function(e){var n=e.field;return(0,r.jsx)(de.II,(0,o.Z)({maxLength:200,placeholder:"Image Credits"},n))}})}),(0,r.jsx)(qt.mz,{children:(0,r.jsxs)(p.Kq,{direction:"row",spacing:"10px",children:[(0,r.jsx)(M.Z,{variant:"base.1.outline",size:"md",onClick:u,children:"Cancel"}),(0,r.jsx)(M.Z,{isLoading:n,size:"md",type:"submit",children:"Save"})]})})]})}})})]})]})},Bt={accept:K.KL.join(", "),noDrag:!0,maxSize:K.Tb},Yt=function(e){var n=e.onReplace,t=(0,pt.Z)({toastErrors:!0}),i=(0,_.useCallback)(function(){var e=(0,a.Z)(d().mark((function e(i){var r,a,o;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=(0,c.Z)(i,1),a=r[0],e.next=3,t(a);case 3:(o=e.sent)&&n(o);case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),[n,t]),l=(0,F.uI)((0,s.Z)((0,o.Z)({},Bt),{onDrop:i,maxFiles:1})),u=l.getInputProps,p=l.open;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",(0,o.Z)({},u())),(0,r.jsx)(M.Z,{leftIcon:(0,r.jsx)(f.Z,{icon:"reloadicon",fill:"base.6"}),size:"sm",onClick:p,children:"Replace"})]})},Ht=function(e){var n=e.images,t=e.setImages,i=e.maxFiles,l=(0,pt.Z)({toastErrors:!0}),c=(0,_.useCallback)(function(){var e=(0,a.Z)(d().mark((function e(r){var a,o,s;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=r.slice(0,i),e.next=3,Promise.all(a.map((function(e){return l(e)})));case 3:o=e.sent,s=o.filter((function(e){return null!==e})),t((0,y.Z)(n).concat((0,y.Z)(s)));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),[n,i,t,l]),u=function(){var e=(0,a.Z)(d().mark((function e(i,r){var a,o;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=(0,y.Z)(n),o=a.findIndex((function(e){return e.id===i})),a[o]=r,t(a);case 4:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),x=(0,F.uI)((0,s.Z)((0,o.Z)({},Bt),{onDrop:c})),h=x.getInputProps,v=x.open;return(0,r.jsxs)(p.xu,{w:"100%",display:"grid",gridTemplateColumns:"repeat(4, 1fr)",placeItems:"center",gap:"30px",children:[(0,r.jsx)("input",(0,o.Z)({},h())),n.map((function(e){var i,a,o,s,l,c;return(0,r.jsx)(p.kC,{position:"relative",onClick:function(e){return e.stopPropagation()},children:(0,r.jsxs)(p.kC,{position:"relative",width:"100%",role:"group",children:[(0,r.jsx)(O.Z,{src:(0,K.Jn)(null===e||void 0===e||null===(i=e.sizes)||void 0===i||null===(a=i.small)||void 0===a?void 0:a.url),width:(null===e||void 0===e||null===(o=e.sizes)||void 0===o||null===(s=o.small)||void 0===s?void 0:s.width)||0,height:(null===e||void 0===e||null===(l=e.sizes)||void 0===l||null===(c=l.small)||void 0===c?void 0:c.height)||0,alt:""}),(0,r.jsxs)(p.kC,{_groupHover:{opacity:1},opacity:"0",direction:"column",transition:"opacity .2s linear",w:"100%",position:"absolute",gap:"10px",align:"center",justify:"center",inset:0,p:"15px",bg:(0,me.wc)("base.1",.3),children:[(0,r.jsx)(Wt,{title:e.title,saveTitle:function(i){return function(e,i){var r=(0,y.Z)(n),a=r.findIndex((function(n){return n.id===e}));r[a].title=i,t(r)}(e.id,i)},button:(0,r.jsx)(M.Z,{leftIcon:(0,r.jsx)(f.Z,{icon:"editicon",size:20}),variant:"accent1.3.fill",size:"sm",as:"span",children:"Credits"})}),(0,r.jsx)(Yt,{onReplace:function(n){return u(e.id,n)}}),(0,r.jsx)(M.Z,{bg:"system.error",leftIcon:(0,r.jsx)(f.Z,{icon:"trashicon",size:20,fill:"base.6"}),size:"sm",onClick:function(){return i=e.id,t(n.filter((function(e){return e.id!==i})));var i},children:"Remove"})]})]})},e.id)})),i>0&&(0,r.jsxs)(p.kC,{direction:"column",align:"center",justify:"center",gap:"20px",onClick:v,cursor:"pointer",border:"1px dashed",borderColor:"base.5",p:"20px",w:"100%",css:"\n            aspect-ratio: 1.6;\n          ",children:[(0,r.jsx)(f.Z,{icon:"imagegraphic",size:40}),(0,r.jsx)(p.xv,{variant:"numeralsM",children:"Add Images"})]})]})},Gt=function(e){var n=e.initialImages,t=e.saveImages,i=e.onCancel,a=e.config,o=(0,_.useState)(n),s=o[0],l=o[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(p.kC,{position:"absolute",top:"15p
1x",right:"20px",gap:"10px",children:[(0,r.jsx)(M.Z,{size:"sm",onClick:function(){return t(s)},disabled:s.length>0&&s.length<a.imageCount&&!a.allowLessImages,children:"Update"}),(0,r.jsx)(M.Z,{size:"sm",variant:"base.1.outline",onClick:i,children:"Cancel"})]}),(0,r.jsx)(Ht,{images:s,setImages:l,maxFiles:a.imageCount-s.length})]})},Jt=(0,C.Pi)((function(e){var n=e.sectionKey,t=e.config,i=e.open,a=e.setOpen,o=Z.h_.data.template_images[n]||[];return(0,r.jsxs)(p.kC,{border:"1px solid",borderColor:i?"base.4":"base_2.3",width:"100%",direction:"column",borderRadius:"8px",zIndex:i?1001:0,position:"relative",bg:"support1.4",children:[(0,r.jsxs)(p.kC,{onClick:function(){return a(!0)},p:"20px",gap:"10px",cursor:i?"default":"pointer",role:"group",align:"center",children:[(0,r.jsx)(p.xv,{variant:"numeralsS",children:t.title}),t.preview?(0,r.jsx)($.Z,{placement:"right",maxW:"400px",label:(0,r.jsx)(O.Z,{width:500,height:300,objectFit:"contain",src:t.preview,alt:""}),children:(0,r.jsx)(f.Z,{icon:"imageinfoicon",fill:"base.1",cursor:"pointer",opacity:i?1:0,transition:"opacity .2s linear",_groupHover:{opacity:1}})}):null,i?null:(0,r.jsx)(f.Z,{ml:"auto",icon:o.length?"checkboxicon":"closeframed",fill:o.length?"green.500":"base.1"})]}),i&&(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(p.kC,{direction:"column",gap:"20px",p:"20px",borderTop:"1px solid",borderTopColor:"base.4",children:[(0,r.jsxs)(p.xv,{children:[(0,r.jsx)("b",{children:"Requirements"}),": ",t.description]}),(0,r.jsx)(Gt,{initialImages:o,onCancel:function(){return a(!1)},config:t,saveImages:function(e){(0,j.z)((function(){Z.h_.data.template_images[n]=e})),a(!1)}})]})})]})})),Vt={slideshowSection:{title:"Framed Slideshow",description:"Any amount of images allowed, recommended up to 15, at least 5. Recommended image resolution: 720x480.",imageCount:30,shouldRender:function(e){return!!Kt.pu[e]},preview:"/images/template-previews/framed-slideshow.png",allowLessImages:!0},intro:{title:"Intro Section",description:"2 images required, first image (big) 840x1200, second image (small) 600x400",imageCount:2,shouldRender:function(e){return!!Kt.R5[e]},preview:"/images/template-previews/intro-section.png"},seriesSubmissionsGrid:{title:"Series Submissions Grid",description:"6 images required: 420x420. IMPORTANT: Images will not be cropped in this layout, so make sure to pick images accordingly.",imageCount:6,shouldRender:function(e){return!!Kt.hN[e]},preview:"/images/template-previews/series-submissions-grid.png"},framedSingleImage:{title:"Framed Image (Single)",description:"1 image required: 460x320",imageCount:1,shouldRender:function(e){var n;return!!(null===(n=Kt.hN[e])||void 0===n?void 0:n.image)},preview:"/images/template-previews/framed-section.png"},powerSection:{title:"Post-Quote #1",description:"2 images required, first image (big) 3
160x538, second image (small) 220x328",imageCount:2,shouldRender:function(e){return!!Kt.Vc[e]},preview:"/images/template-previews/post-quote-1.png"},winnersChance:{title:"Post-Quote #2",description:"1 image required: 420x600",imageCount:1,shouldRender:function(e){return!!Kt.Zg[e]},preview:"/images/template-previews/post-quote-2.png"},pricingTable:{title:"Pricing Table Header",description:"1 image required: 2560x960",imageCount:1,shouldRender:function(e){return!!Kt.ut[e]},preview:"/images/template-previews/pricing-table-header.jpeg"},bundlesImages:{title:"Bundles Images",description:"4 images required: 600x400",imageCount:4,shouldRender:function(){return!0},preview:"/images/template-previews/bundles-images.png"}},Xt=(0,C.Pi)((function(){var e=(0,_.useState)(null),n=e[0],t=e[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.kC,{direction:"column",gap:"10px",children:Object.entries(Vt).filter((function(e){return(0,c.Z)(e,2)[1].shouldRender(Z.h_.data.template)})).map((function(e){var i=(0,c.Z)(e,2),a=i[0],o=i[1];return(0,r.jsx)(Jt,{sectionKey:a,config:o,open:n===a,setOpen:function(e){return t(e?a:null)}},a)}))}),!!n&&(0,r.jsx)(p.xu,{bg:(0,me.wc)("support1.4",.8),position:"fixed",inset:"0",zIndex:1e3})]})})),Qt=[{title:"Info",Slide:Je},{title:"Images",Slide:vt},{title:"Template Images",Slide:Xt},{title:"Awards",Slide:Ee},{title:"Stages & Deadlines",Slide:dt},{title:"Pricing & Discounts",Slide:On,noPadding:!0},{title:"Judges",Slide:Rn},{title:"Sponsors",Slide:Y},{title:"Social Snippets",Slide:Bn},{title:"Press Release",Slide:Ft},{title:"Bundles",Slide:Lt}],$t=function(e){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=null===(n=Object.entries(e))||void 0===n?void 0:n[0];if(r){var a=(0,c.Z)(r,2),o=a[0],s=a[1];if(Array.isArray(s)){var l=s.map((function(e){return e.replace("null","empty")})).join(". ");i.push("".concat(t?"".concat(t," - "):"").concat(o,": ").concat(l))}else{var u="".concat(t?"".concat(t," - "):"").concat(o);$t(s,u,i)}}return i},ei=(0,C.Pi)((function(e){var n,t,i=e.contest,u=(0,_.useState)(!0),g=u[0],b=u[1],C=(0,_.useState)(!1),y=C[0],k=C[1],S=(0,N.Z)(),w=(0,V.Z)().tabletDown,E=null===(n=Z.h_.data)||void 0===n||null===(t=n.general)||void 0===t?void 0:t.display_year,T=(0,_.useCallback)((function(e){e.start_date=(0,Yn.Wp)("".concat(e.start_date)),e.end_date=(0,Yn.Wp)("".concat(e.end_date));var n=(0,J.SW)((0,o.Z)({},e));(0,j.z)((function(){Z.h_.contest=(0,o.Z)({},e)||null})),(0,j.z)((function(){if(null===e||void 0===e?void 0:e.sponsors){var n=e.sponsors.sort((function(e,n){return e.order-n.order})).map((function(e){return(0,s.Z)((0,o.Z)({},e),{realId:e.id})}));Z.h_.sponsors=n,Z.h_.sponsorsCache=n}})),Z.h_.initializeExistingContest(n)}),[]);(0,_.useEffect)((function(){i&&T(i),b(!1)}),[i,T]),(0,_.useEffect)((function(){return function(){Z.h_.reset(),G.reset()}}),[]);var I=function(){var e=(0,a.Z)(d().mark((function e(){var n,t,a,l,u,p,x,h,f,v,m,g,b,j,C;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(k(!0),n=Z.h_.data.assigned,t=Z.h_.sponsors,a=void 0===t?[]:t,l=Object.entries(n).every((function(e){return(0,c.Z)(e,2)[1].every((function(e){return e.categories.length}))})),u=Z.h_.data.general.display_year,u&&u>0&&4==="".concat(u).length){e.next=10;break}return S({status:"error",description:"Display year is invalid"}),k(!1),e.abrupt("return");case 10:if(l){e.next=14;break}return S({status:"error",description:"Some of the contest assignees (judge or staff) do not have a category assigned. Please correct this in the \u201cJudges\u201d tab."}),k(!1),e.abrupt("return");case 14:return p=(0,s.Z)((0,o.Z)({},Z.h_.requestData),{sponsors:a.map((function(e,n){var t,i;return(0,s.Z)((0,o.Z)({},e),{image:(null===(t=e.image)||void 0===t?void 0:t.id)||null,light_image:(null===(i=e.light_image)||void 0===i?void 0:i.id)||null,order:n})}))}),x=(null===i||void 0===i?void 0:i.id)?"PUT":"POST",h=(null===i||void 0===i?void 0:i.id)?"/api/admin/contests/".concat(i.slug,"/"):"/api/admin/contests/",e.next=19,(0,A.ZP)({path:h,method:x,body:p,returnErrors:!0});case 19:if(f=e.sent,v=f.status,m=f.data,v!==R.RS.HTTP_200_OK&&v!==R.RS.HTTP_201_CREATED||!m){g=[];try{g=$t(m).map((function(e){return(0,r.jsx)(r.Fragment,{children:e})}))}catch(d){(null===(b=m)||void 0===b?void 0:b.sponsors)?(j=b.sponsors.find((function(e){return 0!==Object.keys(e).length})),g=j&&(null===(C=Object.keys(j))||void 0===C?void 0:C[0])?["Sponsors: ".concat(Object.entries(j)[0])]:[R.FI]):g=[R.FI]}S({status:"error",title:(0,r.jsx)(r.Fragment,{children:g.map((function(e,n){return(0,r.jsx)("span",{children:e},n)}))})})}else S({title:200===v?"Contest updated":"Contest created",status:"success"}),v===R.RS.HTTP_201_CREATED?(0,X.ZP)("".concat(R.yw.EDIT_CONTEST,"/").concat(m.slug,"/")):T(m);k(!1);case 24:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return g?(0,r.jsx)(p.kC,{h:"100vh",align:"center",justify:"center",children:(0,r.jsx)(v.Z,{})}):(0,r.jsxs)(r.Fragment,{children:[w&&(0,r.jsxs)(p.kC,{align:"center",p:{base:"20px 0 0",lg:"20px 0"},m:{base:"0 20px",lg:"0 60px"},children:[(0,r.jsx)(p.xv,{variant:"numeralsS",mr:"10px",children:null===i||void 0===i?void 0:i.name}),E?(0,r.jsx)(m.Z,{border:"1px solid",borderColor:"base.1",bg:"#F8F4EF",label:"".concat(E)}):null]}),(0,r.jsx)(x.UQ,{defaultIndex:[0],reduceMotion:!0,borderTopColor:"base_2.4",mb:"70px",children:Qt.map((function(e,n){var t=e.Slide,i=(0,l.Z)(e,["Slide"]),a="".concat(i.title,"--").concat(n);return(0,r.jsx)(x.Qd,{borderTopWidth:+!!n,id:a,children:function(e){var n=e.isExpanded;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(x.KF,{p:{base:"20px 30px",lg:"20px 60px"},display:n?"none":"flex",_focus:{boxShadow:"none"},children:[(0,r.jsx)(p.xu,{flex:"1",textAlign:"left",children:(0,r.jsx)(p.X6,{variant:"ctaPrimary",children:i.title})}),(0,r.jsx)(f.Z,{icon:"plusicon"})]}),(0,r.jsx)(x.Hk,{p:i.noPadding?0:{base:"40px 20px",lg:"40px 60px"},children:(0,r.jsxs)(h.UO,{in:n,transition:{enter:{duration:.3}},children:[(0,r.jsxs)(p.kC,{p:i.noPadding?{base:"40px 30px",lg:"40px 60px"}:0,flex:"1",justify:"space-between",mb:i.noPadding?0:"40px",children:[(0,r.jsx)(p.X6,{variant:"titleM",children:i.title}),(0,r.jsx)(f.Z,{icon:"minusicon"})]}),(0,r.jsx)(t,{})]})})]})}},a)}))}),(0,r.jsx)(ae,{onSave:I,buttonLabel:(null===i||void 0===i?void 0:i.id)?"Update":"Create",loading:y})]})})),ni=t(35838),ti=t(75657),ii=t.n(ti),ri=t(960),ai=(0,C.Pi)((function(){var e,n,t=Z.h_.contest,i=(0,V.Z)(),a=i.isMobile,o=i.tabletDown,s=null===(e=Z.h_.data)||void 0===e||null===(n=e.general)||void 0===n?void 0:n.display_year;return(0,r.jsxs)(p.kC,{align:"center",justify:{base:"flex-start",md:"space-between"},flex:1,direction:"row",children:[o?a?(0,r.jsx)(ri.ZP,{}):null:(0,r.jsxs)(p.kC,{mr:"10px",align:"center",justify:"space-between",children:[(0,r.jsx)(p.xv,{variant:"numeralsS",mr:"10px",children:(null===t||void 0===t?void 0:t.name)||"New Contest"}),s&&(0,r.jsx)(m.Z,{border:"1px solid",borderColor:"base.1",bg:"#F8F4EF",label:"".concat(s)})]}),(null===t||void 0===t?void 0:t.slug)?(0,r.jsxs)(p.kC,{mr:{base:0,md:"40px"},ml:{base:0,lg:"auto"},justify:"space-between",flex:1,children:[o&&(0,r.jsx)(p.xv,{variant:"numeralsS",mr:"10px",children:"Edit Contest"}),(0,r.jsxs)(p.kC,{gap:{base:"20px",md:"30px"},align:"center",ml:"auto",children:[(0,r.jsx)(ii(),{href:"/contests/".concat(null===t||void 0===t?void 0:t.slug),children:(0,r.jsx)("a",{target:"_blank",rel:"noreferrer noopener",children:(0,r.jsx)(M.Z,{size:a?"sm":"md",variant:"flat",rightIcon:(0,r.jsx)(f.Z,{icon:"globeicon",fill:"base.1",size:20}),children:"Open"})})}),(0,r.jsx)(ii(),{href:"".concat(R.yw.MANAGE_CONTEST,"/").concat(t.slug),passHref:!0,children:(0,r.jsx)("a",{children:(0,r.jsx)(M.Z,{variant:"flat",size:a?"sm":"md",rightIcon:(0,r.jsx)(f.Z,{icon:"linkarrowicon",fill:"base.1",size:20}),children:"Manage"})})})]})]}):null,(0,r.jsx)(ni.Z,{triggerProps:{mt:"-13px",pt:"13px",mb:"-13px",pb:"13px"}})]})})),oi=t(61975),si=t(62985),li=!0,ci=(0,si.Z)((function(e){var n=e.contest;return 200!==e.status?(0,r.jsx)(oi.Z,{}):(0,r.jsx)(ei,{contest:n})}),{title:function(e){var n=e.contest;return n?"Edit Contest: ".concat(n.name):"Create Contest"},header:(0,r.jsx)(ai,{})})},98935:function(e,n,t){"use strict";var i,r,a;t.d(n,{Lb:function(){return i},OF:function(){return a},g_:function(){return r}}),function(e){e.PERCENTAGE="PERCENTAGE",e.AMOUNT="AMOUNT"}(i||(i={})),function(e){e.UNLIMITED="UNLIMITED",e.TIME_RANGE="TIME_RANGE"}(r||(r={})),function(e){e.CONTEST="CONTEST",e.SITE_WIDE="SITE_WIDE"}(a||(a={}))},84855:function(e,n,t){"use strict";var i=t(43692),r=t(44453),a=t.n(r),o=t(90319),s=t(8403);n.Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.toastErrors,t=void 0!==n&&n,r=(0,s.Z)();return function(){var e=(0,i.Z)(a().mark((function e(n,i){var s,l,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,o.Ix)(n,i,!0);case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),t&&(c=e.t0,r({title:"Upload Failed",description:(null===c||void 0===c||null===(s=c.response)||void 0===s||null===(l=s.data)||void 0===l?void 0:l.detail)||void 0,status:"error"})),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(n,t){return e.apply(this,arguments)}}()}}}
1,function(e){e.O(0,[2783,3434,695,9464,9966,8400,6571,6886,6531,5274,8029,4519,6818,9774,2888,179],(function(){return n=68244,e(e.s=n);var n}));var n=e.O();_N_E=n}]);

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.