PageSourceSearch

https://mission-tracker-111.emergent.host/static/js/8182.56b65816.chunk.js

js mission-tracker-111.emergent.host collected 2026-10-03 03:21:21 UTC 27,697 bytes, 3 lines download raw bytes

1/*! For license information please see 8182.56b65816.chunk.js.LICENSE.txt */
2"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[8182],{8182(e,t,s){s.r(t),s.d(t,{default:()=>M});var a=s(9379),n=s(5544),i=s(5043),l=s(6767),o=s(6328),r=s(1250),d=s(5469),c=s(7118),x=s(5088),m=s(1130),p=s(2024),h=s(8326),u=s(5077),b=s(4980),f=s(8003),g=s(614);const j=(0,s(7784).A)("image-plus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);var v=s(5746),w=s(9855),y=s(5040),N=s(5087),k=s(4918),A=s(2574),F=s(9989),C=s(1360),_=s(6833),E=s(4528),B=s(579);const z=[{emoji:"\ud83e\udd47",label:"1st",cls:"bg-[#FFC800] text-[#3F2A00]"},{emoji:"\ud83e\udd48",label:"2nd",cls:"bg-[#CBD5E1] text-[#1E293B]"},{emoji:"\ud83e\udd49",label:"3rd",cls:"bg-[#FB923C] text-[#3F1F00]"}];function W(e){let t=e.path,s=e.className,a=void 0===s?"":s,l=e.alt,o=void 0===l?"":l;const r=(0,i.useState)(null),d=(0,n.A)(r,2),c=d[0],x=d[1];return(0,i.useEffect)(()=>{if(!t)return;let e=null,s=!0;return b.F.get("/files/".concat(t),{responseType:"blob"}).then(t=>{s&&(e=URL.createObjectURL(t.data),x(e))}).catch(()=>{}),()=>{s=!1,e&&URL.revokeObjectURL(e)}},[t]),t?c?(0,B.jsx)("img",{src:c,alt:o,className:a||"rounded-2xl max-h-44 w-full object-cover"}):(0,B.jsx)("div",{className:"bg-[#F7F9FC] dark:bg-[#1E293B] animate-pulse rounded-2xl ".concat(a||"h-40 w-full")}):null}function S(e){const t=new Date(e).getTime()-Date.now();if(t<=0)return"Closed";const s=Math.floor(t/864e5),a=Math.floor(t%864e5/36e5);if(s>0)return"".concat(s,"d ").concat(a,"h left");const n=Math.floor(t%36e5/6e4);return"".concat(a,"h ").concat(n,"m left")}function R(e){let t=e.challenge,s=e.mine,a=e.onClose,l=e.onSaved;const r=(0,i.useState)((null===s||void 0===s?void 0:s.text)||""),d=(0,n.A)(r,2),c=d[0],x=d[1],m=(0,i.useState)((null===s||void 0===s?void 0:s.link)||""),p=(0,n.A)(m,2),h=p[0],u=p[1],f=(0,i.useState)((null===s||void 0===s?void 0:s.image_url)||""),y=(0,n.A)(f,2),N=y[0],k=y[1],A=(0,i.useState)(!1),F=(0,n.A)(A,2),C=F[0],_=F[1],E=(0,i.useState)(!1),z=(0,n.A)(E,2),S=z[0],R=z[1],D=!!s;return(0,B.jsx)("div",{className:"fixed inset-0 bg-black/50 z-[60] flex items-end sm:items-center justify-center p-0 sm:p-4",onClick:a,children:(0,B.jsxs)("div",{className:"bg-white dark:bg-[#0F172A] w-full sm:max-w-md max-h-[92dvh] overflow-y-auto pb-[env(safe-area-inset-bottom)] rounded-t-3xl sm:rounded-3xl",onClick:e=>e.stopPropagation(),"data-testid":"submission-composer",children:[(0,B.jsxs)("div",{className:"sticky top-0 z-10 bg-white dark:bg-[#0F172A] px-5 pt-4 pb-3 border-b-2 border-[#E5E5E5] flex items-center justify-between",children:[(0,B.jsx)("h3",{className:"text-lg font-extrabold",children:D?"Edit your submission":"Submit your answer"}),(0,B.jsx)("button",{onClick:a,"aria-label":"Close",className:"p-2 -mr-2",children:(0,B.jsx)(g.A,{size:22,strokeWidth:3})})]}),(0,B.jsxs)("div",{className:"px-5 pb-5 pt-3 space-y-3",children:[(0,B.jsx)("textarea",{value:c,onChange:e=>x(e.target.value),rows:5,maxLength:1500,placeholder:"Be specific. Concrete > clever.",className:"gm-input text-sm","data-testid":"submission-text"}),(0,B.jsxs)("p",{className:"text-[10px] font-bold text-[#94A3B8] text-right",children:[c.length,"/1500"]}),t.image_allowed&&(0,B.jsxs)("div",{children:[(0,B.jsx)("label",{className:"text-[10px] uppercase font-extrabold text-[#AFAFAF] tracking-wider",children:"Image (optional)"}),N?(0,B.jsxs)("div",{className:"relative mt-1","data-testid":"composer-image-preview",children:[(0,B.jsx)(W,{path:N,className:"rounded-2xl max-h-44 w-full object-cover",alt:"preview"}),(0,B.jsx)("button",{onClick:()=>k(""),className:"absolute top-1 right-1 p-1 rounded-full bg-black/50 text-white",children:(0,B.jsx)(g.A,{size:14,strokeWidth:3})})]}):(0,B.jsxs)("label",{className:"mt-1 inline-flex items-center gap-2 px-3 py-2 rounded-2xl border-2 border-dashed border-[#CBD5E1] text-[#475569] text-xs font-extrabold cursor-pointer hover:bg-[#F8FAFC]",children:[(0,B.jsx)(j,{size:14,strokeWidth:3})," ",C?"Uploading\u2026":"Add image",(0,B.jsx)("input",{type:"file",accept:"image/*",hidden:!0,onChange:e=>{var t;return(async e=>{if(!e)return;_(!0);const t=new FormData;t.append("file",e);try{const e=(await b.F.post("/upload",t,{headers:{"Content-Type":"multipart/form-data"}})).data;k(e.path)}catch(s){o.oR.error("Image upload failed")}finally{_(!1)}})(null===(t=e.target.files)||void 0===t?void 0:t[0])}})]})]}),t.link_allowed&&(0,B.jsxs)("div",{children:[(0,B.jsx)("label",{className:"text-[10px] uppercase font-extrabold text-[#AFAFAF] tracking-wider",children:"Link (optional)"}),(0,B.jsx)("input",{type:"url",value:h,onChange:e=>u(e.target.value),placeholder:"https://",className:"gm-input text-sm mt-1","data-testid":"submission-link"})]}),(0,B.jsxs)("button",{onClick:async()=>
2{if(c.trim()){R(!0);try{await b.F.post("/challenges/".concat(t.id,"/submissions"),{text:c.trim(),image_url:t.image_allowed&&N||null,link:t.link_allowed&&h.trim()||null}),o.oR.success(D?"Updated":"Submitted!"),l()}catch(a){var e,s;o.oR.error((null===a||void 0===a||null===(e=a.response)||void 0===e||null===(s=e.data)||void 0===s?void 0:s.detail)||"Could not submit")}finally{R(!1)}}else o.oR.error("Tell us your answer first")},disabled:S||C,className:"gm-btn gm-btn-primary w-full py-3 text-sm","data-testid":"submission-submit",children:[(0,B.jsx)(v.A,{size:16,strokeWidth:3})," ",D?"Save changes":"Send submission"]}),D&&(0,B.jsxs)("button",{onClick:async()=>{if(window.confirm("Remove your submission?"))try{await b.F.delete("/challenges/".concat(t.id,"/submissions/me")),o.oR.success("Withdrawn"),l()}catch(e){o.oR.error("Could not withdraw")}},className:"w-full text-xs font-extrabold text-[#FF4B4B] py-2 inline-flex items-center justify-center gap-1","data-testid":"submission-withdraw",children:[(0,B.jsx)(w.A,{size:12,strokeWidth:3})," Withdraw my submission"]})]})]})})}function D(e){let t=e.challenge,s=e.submission,a=e.onClose,l=e.onChanged;const r=(0,E.A)().user,d=(0,i.useState)([]),c=(0,n.A)(d,2),x=c[0],m=c[1],p=(0,i.useState)(""),h=(0,n.A)(p,2),u=h[0],f=h[1],j=(0,i.useState)(!1),F=(0,n.A)(j,2),C=F[0],_=F[1],z=(0,i.useState)(!1),S=(0,n.A)(z,2),R=S[0],D=S[1],U=(0,i.useCallback)(async()=>{try{const e=(await b.F.get("/challenges/".concat(t.id,"/submissions/").concat(s.id,"/comments"))).data;m(e.comments||[])}catch(e){}finally{D(!0)}},[t.id,s.id]);(0,i.useEffect)(()=>{U()},[U]);const L=async()=>{if(u.trim()){_(!0);try{await b.F.post("/challenges/".concat(t.id,"/submissions/").concat(s.id,"/comments"),{text:u.trim()}),f(""),await U()}catch(n){var e,a;o.oR.error((null===n||void 0===n||null===(e=n.response)||void 0===e||null===(a=e.data)||void 0===a?void 0:a.detail)||"Could not comment")}finally{_(!1)}}},M=s.author||{};return(0,B.jsx)("div",{className:"fixed inset-0 bg-black/50 z-[55] flex items-end sm:items-center justify-center p-0 sm:p-4",onClick:a,children:(0,B.jsxs)("div",{className:"bg-white dark:bg-[#0F172A] w-full sm:max-w-md max-h-[92dvh] overflow-y-auto pb-[env(safe-area-inset-bottom)] rounded-t-3xl sm:rounded-3xl",onClick:e=>e.stopPropagation(),"data-testid":"submission-detail-modal",children:[(0,B.jsxs)("div",{className:"sticky top-0 z-10 bg-white dark:bg-[#0F172A] px-5 pt-4 pb-3 border-b-2 border-[#E5E5E5] flex items-center justify-between",children:[(0,B.jsx)("h3",{className:"text-base font-extrabold",children:"Submission"}),(0,B.jsx)("button",{onClick:a,"aria-label":"Close",className:"p-2 -mr-2","data-testid":"submission-detail-close",children:(0,B.jsx)(g.A,{size:22,strokeWidth:3})})]}),(0,B.jsxs)("div",{className:"px-5 pb-5 pt-3 space-y-3",children:[(0,B.jsxs)("div",{className:"flex items-center gap-2",children:[(0,B.jsx)("div",{className:"w-9 h-9 rounded-full flex items-center justify-center text-white text-xs font-extrabold",style:{background:M.avatar_color||"#1CB0F6"},children:(M.display_name||"U")[0].toUpperCase()}),(0,B.jsxs)("div",{className:"min-w-0",children:[(0,B.jsxs)("p",{className:"text-sm font-extrabold truncate",children:[M.display_name,s.is_mine&&(0,B.jsx)("span",{className:"ml-2 text-[#1CB0F6]",children:"\xb7 You"})]}),(0,B.jsxs)("p",{className:"text-[10px] font-bold text-[#94A3B8]",children:["@",M.username||"\u2014"," \xb7 Lv ",M.level||1]})]})]}),(0,B.jsx)("p",{className:"text-sm font-bold whitespace-pre-wrap leading-relaxed",children:s.text}),s.image_url&&(0,B.jsx)(W,{path:s.image_url,className:"rounded-2xl max-h-80 w-full object-cover",alt:"submission"}),s.link&&(0,B.jsxs)("a",{href:s.link,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs font-extrabold text-[#1CB0F6] underline break-all",children:[(0,B.jsx)(y.A,{size:12,strokeWidth:3})," ",s.link]}),(0,B.jsxs)("div",{className:"flex items-center justify-between pt-3 border-t border-[#E5E5E5]",children:[(0,B.jsxs)("span",{className:"text-sm font-extrabold inline-flex items-center gap-3",children:[(0,B.jsxs)("span",{children:[s.votes," ",1===s.votes?"vote":"votes"]}),(0,B.jsxs)("span",{className:"text-[#94A3B8] inline-flex items-center gap-1","data-testid":"detail-view-count",children:[(0,B.jsx)(N.A,{size:12,strokeWidth:3})," ",s.view_count||0]})]}),s.voted_by_me?(0,B.jsxs)("button",{onClick:async()=>{try{await b.F.delete("/challenges/".concat(t.id,"/submissions/").concat(s.id,"/vote")),l()}catch(e){o.oR.error("Could not withdraw vote")}},className:"px-4 py-2 rounded-full text-xs font-extrabold bg-[#FFE4E6] text-[#DC2626] border-2 border-[#FECACA]","data-testid":"detail-unvote",children:[(0,B.jsx)(k.A,{size:14,strokeWidth:3,fill:"#DC2626",className:"inline -mt-0.5"})," Voted"]}):(0,B.jsxs)("button",{onClick:async()=>{try{await b.F.post("/challenges/".concat(t.id,"/submissions/").concat(s.id,"/vote")),l()}catch(n){var e,a;o.oR.error((null===n||void 0===n||null===(e=n.response)||void 0===e||null===(a=e.data)||void 0===a?void 0:a.detail)||"Could not vote")}},className:"px-4 py-2 rounded-full text-xs font-extrabold bg-[#1CB0F6] text-white border-2 border-[#1899D6] border-b-4","data-testid":"detail-vote",children:[(0,B.jsx)(k.A,{size:14,strokeWidth:3,className:"inline -mt-0.5"})," Vote"]})]}
2),(0,B.jsxs)("div",{className:"pt-3 border-t border-[#E5E5E5]",children:[(0,B.jsxs)("p",{className:"text-[10px] uppercase font-extrabold text-[#94A3B8] tracking-wider mb-2 inline-flex items-center gap-1",children:[(0,B.jsx)(A.A,{size:11,strokeWidth:3})," Comments (",x.length,")"]}),R&&0===x.length&&(0,B.jsx)("p",{className:"text-xs font-bold text-[#94A3B8] py-2",children:"No comments yet. Be first to react."}),(0,B.jsx)("div",{className:"space-y-2",children:x.map(e=>{var a,n,i;return(0,B.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-xl bg-[#F8FAFC] dark:bg-[#1E293B]","data-testid":"comment-".concat(e.id),children:[(0,B.jsx)("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-[10px] font-extrabold shrink-0",style:{background:(null===(a=e.author)||void 0===a?void 0:a.avatar_color)||"#1CB0F6"},children:((null===(n=e.author)||void 0===n?void 0:n.display_name)||"U")[0].toUpperCase()}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-[11px] font-extrabold",children:(null===(i=e.author)||void 0===i?void 0:i.display_name)||"Anon"}),(0,B.jsx)("p",{className:"text-xs font-bold whitespace-pre-wrap leading-snug",children:e.text})]}
2),e.user_id===(null===r||void 0===r?void 0:r.id)&&(0,B.jsx)("button",{onClick:()=>(async e=>{if(window.confirm("Delete comment?"))try{await b.F.delete("/challenges/".concat(t.id,"/submissions/").concat(s.id,"/comments/").concat(e)),await U()}catch(a){o.oR.error("Could not delete")}})(e.id),className:"p-1","aria-label":"Delete comment",children:(0,B.jsx)(w.A,{size:12,strokeWidth:3,color:"#FF4B4B"})})]},e.id)})}),(0,B.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,B.jsx)("input",{value:u,onChange:e=>f(e.target.value),onKeyDown:e=>"Enter"===e.key&&L(),placeholder:"Add a comment\u2026",maxLength:500,className:"gm-input text-xs flex-1","data-testid":"comment-input"}),(0,B.jsx)("button",{onClick:L,disabled:C||!u.trim(),className:"gm-btn gm-btn-primary px-3 py-2 text-xs","data-testid":"comment-submit",children:(0,B.jsx)(v.A,{size:12,strokeWidth:3})})]})]})]})]})})}function U(e){let t=e.s,s=e.idx,a=e.votingOpen,n=e.onVote,l=e.onUnvote,o=e.onOpen,r=e.onImpression;const d=s<3&&t.votes>0?z[s]:null,c=t.author||{},x=(0,i.useRef)(null);return(0,i.useEffect)(()=>{const e=x.current;if(!e||!r)return;const s=new IntersectionObserver(e=>{for(const a of e)if(a.isIntersecting){r(t.id),s.disconnect();break}},{threshold:.5});return s.observe(e),()=>s.disconnect()},[t.id,r]),(0,B.jsxs)("button",{ref:x,type:"button",onClick:()=>o(t),className:"gm-card p-4 relative text-left w-full hover:scale-[1.005] transition-transform","data-testid":"submission-card-".concat(t.id),children:[d&&(0,B.jsxs)("span",{className:"absolute -top-3 left-4 text-[10px] uppercase font-extrabold px-2 py-1 rounded-full ".concat(d.cls),children:[d.emoji," ",d.label]}),(0,B.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,B.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-extrabold",style:{background:c.avatar_color||"#1CB0F6"},children:(c.display_name||"U")[0].toUpperCase()}),(0,B.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,B.jsxs)("p",{className:"text-xs font-extrabold truncate",children:[c.display_name||"Anon",t.is_mine&&(0,B.jsx)("span",{className:"ml-2 text-[#1CB0F6]",children:"\xb7 You"})]}),(0,B.jsxs)("p",{className:"text-[10px] font-bold text-[#94A3B8]",children:["@",c.username||"\u2014"," \xb7 Lv ",c.level||1]})]})]}),(0,B.jsx)("p",{className:"text-sm font-bold whitespace-pre-wrap leading-relaxed line-clamp-4",children:t.text}),t.image_url&&(0,B.jsx)(W,{path:t.image_url,className:"mt-2 rounded-2xl max-h-44 w-full object-cover",alt:"submission"}),(0,B.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t border-[#E5E5E5]",children:[(0,B.jsxs)("span",{className:"text-xs font-extrabold inline-flex items-center gap-3 text-[#475569] dark:text-[#CBD5E1]",children:[(0,B.jsxs)("span",{"data-testid":"submission-votes-".concat(t.id),children:[(0,B.jsx)(k.A,{size:12,strokeWidth:3,className:"inline -mt-0.5"})," ",t.votes]}),(0,B.jsxs)("span",{"data-testid":"submission-views-".concat(t.id),title:"Views",children:[(0,B.jsx)(N.A,{size:12,strokeWidth:3,className:"inline -mt-0.5"})," ",t.view_count||0]})]}),a&&(t.voted_by_me?(0,B.jsxs)("span",{onClick:e=>{e.stopPropagation(),l(t.id)},className:"px-3 py-1.5 rounded-full text-xs font-extrabold bg-[#FFE4E6] text-[#DC2626] border-2 border-[#FECACA]","data-testid":"submission-unvote-".concat(t.id),children:[(0,B.jsx)(k.A,{size:12,strokeWidth:3,fill:"#DC2626",className:"inline -mt-0.5"})," Voted"]}):(0,B.jsxs)("span",{onClick:e=>{e.stopPropagation(),n(t.id)},className:"px-3 py-1.5 rounded-full text-xs font-extrabold bg-[#1CB0F6] text-white border-2 border-[#1899D6] border-b-4","data-testid":"submission-vote-".concat(t.id),children:[(0,B.jsx)(k.A,{size:12,strokeWidth:3,className:"inline -mt-0.5"})," Vote"]}))]})]})}function L(e){let t=e.challenge;const s=(0,i.useState)(null),a=(0,n.A)(s,2),l=a[0],r=a[1],d=(0,i.useState)(!0),c=(0,n.A)(d,2),p=c[0],h=c[1],u=(0,i.useState)(!1),f=(0,n.A)(u,2),g=f[0],j=f[1],v=(0,i.useState)(null),w=(0,n.A)(v,2),y=w[0],A=w[1],E=(0,i.useRef)(new Set),z=(0,i.useCallback)(async()=>{h(!0);try{const e=(await b.F.get("/challenges/".concat(t.id,"/submissions"))).data;if(r(e),y){const t=e.submissions.find(e=>e.id===y.id);t&&A(t)}}catch(e){o.oR.error("Could not load submissions")}finally{h(!1)}},[t.id,y]);(0,i.useEffect)(()=>{z()},[t.id]),(0,i.useEffect)(()=>{b.F.post("/challenges/".concat(t.id,"/view")).catch(()=>{})},[t.id]);const W=(0,i.useCallback)(e=>{E.current.has(e)||(E.current.add(e),b.F.post("/challenges/".concat(t.id,"/submissions/").concat(e,"/view")).catch(()=>{}))},[t.id]),L=async e=>{try{await b.F.post("/challenges/".concat(t.id,"/submissions/").concat(e,"/vote")),await z()}catch(n){var s,a;o.oR.error((null===n||void 0===n||null===(s=n.response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.detail)||"Could not vote")}},M=async e=>{try{await b.F.delete("/challenges/".concat(t.id,"/submissions/").concat(e,"/vote")),await z()}catch(s){o.oR.error("Could not withdraw vote")}};if(p||!l)return(0,B.jsx)("p",{className:"text-center font-extrabold text-[#94A3B8] py-12",children:"Loading\u2026"});const V=l.challenge,P=l.voting_open;return(0,B.jsxs)("div",{className:"space-y-4","data-testid":"submission-voting-screen",children:[(0,B.jsxs)("div",{className:"gm-card p-5 relative overflow-hidden",style:{background:"linear-gradient(135deg, ".concat(V.color||"#7E5BE
2F"," 0%, ").concat(V.color||"#5B3DC4","AA 100%)")},children:[(0,B.jsx)("div",{className:"text-3xl mb-2",children:V.emoji||"\ud83d\uddf3\ufe0f"}),(0,B.jsx)("h1",{className:"text-2xl font-extrabold text-white",children:V.title}),V.description&&(0,B.jsx)("p",{className:"text-white/90 text-sm font-bold mt-1",children:V.description}),(0,B.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-[11px] font-extrabold text-white/90 uppercase tracking-wider",children:[(0,B.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,B.jsx)(x.A,{size:12,strokeWidth:3})," ",S(V.ends_at)]}),(0,B.jsxs)("span",{children:["\xb7 ",l.total," entries"]}),(0,B.jsxs)("span",{children:["\xb7 ",l.total_votes," votes"]}),(0,B.jsxs)("span",{className:"inline-flex items-center gap-1 bg-white/20 rounded-full px-2 py-0.5","data-testid":"challenge-view-count",title:"Total board opens",children:[(0,B.jsx)(N.A,{size:12,strokeWidth:3})," ",V.view_count||0," views"]})]})]}),V.submission_prompt&&(0,B.jsxs)("div",{className:"gm-card p-4 border-l-4 border-[#7E5BEF]","data-testid":"submission-prompt",children:[(0,B.jsx)("p",{className:"text-[10px] uppercase font-extrabold text-[#7E5BEF] tracking-wider mb-1",children:"The challenge"}),(0,B.jsx)("p",{className:"text-sm font-bold whitespace-pre-wrap",children:V.submission_prompt})]}),(0,B.jsxs)("div",{className:"gm-card p-4 border-l-4 border-[#FFC800] bg-[#FFFCEC] dark:bg-[#2A2410]","data-testid":"voting-rules",children:[(0,B.jsxs)("p",{className:"text-[10px] uppercase font-extrabold text-[#B58F00] tracking-wider mb-1 flex items-center gap-1",children:[(0,B.jsx)(k.A,{size:11,strokeWidth:3,fill:"#B58F00"})," How winners are chosen"]}),(0,B.jsx)("p",{className:"text-sm font-bold leading-snug text-[#1F2937] dark:text-[#FDE68A]",children:"Pure audience vote \u2014 every BecAim member can vote, and the entries with the most votes when time runs out take the top spots. No admin judging, no algorithm."})]}),(0,B.jsxs)("div",{className:"gm-card p-4 flex items-center gap-3",children:[(0,B.jsx)(m.A,{size:22,strokeWidth:3,color:"#FFC800"}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsx)("p",{className:"text-[11px] uppercase font-extrabold text-[#94A3B8]",children:"Top 3 by audience votes \xb7 split 50 / 30 / 20"}),(0,B.jsxs)("p",{className:"text-xs font-extrabold",children:["+",V.reward_coins," coins \xb7 +",V.reward_xp," XP",V.reward_badge?" \xb7 ".concat(V.reward_badge):""]})]})]}),P&&(0,B.jsx)("button",{onClick:()=>j(!0),className:"gm-btn gm-btn-primary w-full py-4 text-base","data-testid":"open-submission-composer",children:l.my_submission?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(F.A,{size:18,strokeWidth:3})," Edit your submission"]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(C.A,{size:20,strokeWidth:3})," Submit your answer"]})}),!P&&l.my_submission&&(0,B.jsxs)("div",{className:"gm-card p-3 border-l-4 border-[#16A34A]",children:[(0,B.jsx)("p",{className:"text-[10px] uppercase font-extrabold text-[#16A34A]",children:"Your locked submission"}),(0,B.jsx)("p",{className:"text-sm font-bold mt-1 line-clamp-3",children:l.my_submission.text})]}),(0,B.jsxs)("div",{className:"space-y-3",children:[(0,B.jsxs)("h3",{className:"text-sm font-extrabold uppercase tracking-wider text-[#475569] flex items-center gap-2",children:[(0,B.jsx)(_.A,{size:14,strokeWidth:3,color:"#1CB0F6"}),"Submissions (",l.total,") \xb7 tap any to comment"]}),0===l.submissions.length&&(0,B.jsx)("p",{className:"text-center font-bold text-[#94A3B8] py-8",children:"No submissions yet. Be the first!"}),l.submissions.map((e,t)=>(0,B.jsx)(U,{s:e,idx:t,votingOpen:P,onVote:L,onUnvote:M,onOpen:e=>A(e),onImpression:W},e.id))]}),g&&(0,B.jsx)(R,{challenge:V,mine:l.my_submission,onClose:()=>j(!1),onSaved:()=>{j(!1),z()}}),y&&(0,B.jsx)(D,{challenge:V,submission:y,onClose:()=>A(null),onChanged:z})]})}function M(){const e=(0,l.Zp)(),t=(0,i.useState)(null),s=(0,n.A)(t,2),r=s[0],c=s[1],x=(0,i.useState)(!0),m=(0,n.A)(x,2),p=m[0],h=m[1],u=(0,i.useState)(!1),g=(0,n.A)(u,2),j=g[0],v=g[1],w=async()=>{h(!0);try{var e;const t=(await b.F.get("/challenges/current")).data;if("submission_voting"===(null===t||void 0===t||null===(e=t.challenge)||void 0===e?void 0:e.challenge_type))c(t);else{const e=(await b.F.get("/challenges/current/leaderboard")).data;c((0,a.A)((0,a.A)({},t),e))}}catch(t){o.oR.error("Could not load challenge"),t&&console.warn(null===t||void 0===t?void 0:t.message)}finally{h(!1)}};(0,i.useEffect)(()=>{w()},[]);if(p)return(0,B.jsx)(f.A,{});if(null===r||void 0===r||!r.challenge)return null;const y=r.challenge,N=r.top||[],k="submission_voting"===y.challenge_type;return(0,B.jsxs)("div",{className:"gm-page min-h-screen bg-[#F7F9FC] sm:border-x-2 sm:border-[#
2E5E5E5] pb-12",children:[(0,B.jsxs)("header",{className:"sticky top-0 bg-[#F7F9FC] z-10 px-5 pt-5 pb-3 border-b-2 border-[#E5E5E5] flex items-center gap-3",children:[(0,B.jsx)("button",{onClick:()=>e(-1),className:"p-1","data-testid":"challenge-back",children:(0,B.jsx)(d.A,{size:26,strokeWidth:3})}),(0,B.jsx)("h1",{className:"text-xl font-extrabold truncate",children:k?"Challenge: Submit & Vote":"Weekly Challenge"})]}),k&&(0,B.jsx)("div",{className:"px-5 pt-4",children:(0,B.jsx)(L,{challenge:y,onBack:()=>e(-1)})}),!k&&(0,B.jsx)(V,{c:y,data:r,top:N,joining:j,join:async()=>{v(!0);try{await b.F.post("/challenges/current/join"),o.oR.success("Joined \u2014 good luck!"),await w()}catch(e){o.oR.error("Could not join")}finally{v(!1)}},navigate:e})]})}function V(e){var t;let s=e.c,a=e.data,n=e.top,i=e.joining,l=e.join;e.navigate;return(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)("div",{className:"px-5 pt-5",children:[(0,B.jsxs)(r.P.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"rounded-3xl p-5 shadow-lg text-white relative overflow-hidden",style:{background:"linear-gradient(135deg, ".concat(s.color,"E6 0%, #1F2937 120%)")},"data-testid":"challenge-hero",children:[(0,B.jsxs)("div",{className:"flex items-start gap-3",children:[(0,B.jsx)("div",{className:"w-14 h-14 rounded-2xl bg-white/15 flex items-center justify-center text-3xl",children:(0,B.jsx)("span",{"aria-hidden":!0,children:s.emoji})}),(0,B.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,B.jsx)("p",{className:"text-[10px] uppercase font-extrabold opacity-80 tracking-wider",children:"This week"}),(0,B.jsx)("h2",{className:"text-2xl font-extrabold leading-tight",children:s.title}),(0,B.jsx)("p",{className:"text-sm font-bold opacity-90 mt-1",children:s.tagline})]})]}),(0,B.jsxs)("div",{className:"mt-4 flex items-center gap-2 text-xs font-extrabold",children:[(0,B.jsxs)("span",{children:[a.progress,"/",a.target]}),(0,B.jsx)("div",{className:"flex-1 h-2 rounded-full bg-white/15 overflow-hidden",children:(0,B.jsx)(r.P.div,{className:"h-full rounded-full bg-white",initial:{width:0},animate:{width:"".concat(a.percent,"%")},transition:{duration:.5}})}),(0,B.jsxs)("span",{className:"opacity-80",children:[a.percent,"%"]})]}),(0,B.jsxs)("div",{className:"flex items-center gap-3 mt-3 text-xs font-extrabold opacity-90",children:[(0,B.jsxs)("span",{className:"flex items-center gap-1",children:[(0,B.jsx)(c.A,{size:13,strokeWidth:3})," ",null!==(t=a.total_participants)&&void 0!==t?t:a.participants," joined"]}),(0,B.jsxs)("span",{className:"flex items-center gap-1",children:[(0,B.jsx)(x.A,{size:13,strokeWidth:3})," ",a.days_left,"d ",a.hours_left%24,"h left"]}),(0,B.jsxs)("span",{className:"ml-auto flex items-center gap-1",children:[(0,B.jsx)(m.A,{size:13,strokeWidth:3})," +",s.reward_coins," coins"]})]}),!a.joined&&(0,B.jsxs)("button",{onClick:l,disabled:i,className:"mt-4 w-full bg-white text-[#1F2937] rounded-full px-4 py-3 font-extrabold flex items-center justify-center gap-1","data-testid":"challenge-join-cta",children:[i?(0,B.jsx)(p.A,{size:16,className:"animate-spin"}):"Join this challenge"," ",(0,B.jsx)(h.A,{size:16,strokeWidth:3})]}),a.joined&&a.completed&&(0,B.jsx)("p",{className:"mt-4 text-center text-sm font-extrabold bg-[#58CC02] rounded-full py-2","data-testid":"challenge-completed-banner",children:"Completed \u2014 coins delivered \u2713"})]}),(0,B.jsxs)("h3",{className:"text-lg font-extrabold mt-6 mb-2 flex items-center gap-2",children:[(0,B.jsx)(m.A,{size:20,strokeWidth:3,color:"#FFC800"})," Leaderboard"]}),0===n.length?(0,B.jsx)("div",{className:"gm-card p-6 text-center",children:(0,B.jsx)("p",{className:"text-sm font-extrabold text-[#AFAFAF]",children:"No participants yet \u2014 be the first to join."})}):(0,B.jsx)("div",{className:"space-y-2","data-testid":"challenge-leaderboard",children:n.map((e,t)=>(0,B.jsxs)("div",{className:"gm-card p-3 flex items-center gap-3 ".concat(e.is_me?"border-[#1CB0F6] ring-2 ring-[#1CB0F6]/30":""),"data-testid":"leaderboard-row-".concat(t),children:[(0,B.jsx)("div",{className:"w-7 text-center text-sm font-extrabold text-[#94A3B8]",children:t+1}),(0,B.jsx)("div",{className:"w-9 h-9 rounded-full flex items-center justify-center text-white font-extrabold",style:{background:"#1CB0F6"},children:(e.display_name||e.username||"U")[0].toUpperCase()}),(0,B.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,B.jsxs)("p",{className:"text-sm font-extrabold truncate",children:[e.display_name||e.username,e.is_me&&(0,B.jsx)("span",{className:"ml-1 text-[#1CB0F6] text-[10px] font-extrabold uppercase",children:"\xb7 you"})]}),(0,B.jsxs)("p",{className:"text-[10px] font-extrabold text-[#AFAFAF] flex items-center gap-2",children:[(0,B.jsxs)("span",{children:["L",e.level||1]}),(0,B.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,B.jsx)(u.A,{size:10,strokeWidth:3,color:"#FF8E2C"}),e.streak||0,"d"]})]})]}),(0,B.jsxs)("div",{className:"text-right",children:[(0,B.jsx)("p",{className:"text-base font-extrabold",children:e.progress}),(0,B.jsxs)("p",{className:"text-[10px] font-extrabold text-[#94A3B8]",children:[e.percent,"%"]})]})]},e.id))}),null!=a.me_rank&&a.me_rank>n.length&&(0,B.jsxs)("p",{className:"text-center text-xs font-extrabold text-[#94A3B8] mt-2","data-testid":"my-rank-line",children:["You are #",a.me_rank," on the board."]})]})})}},9989(e,t,s){s.d(t,{A:()=>a});const a=(0,s(7784).A)("pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]])},1360(e,t,s){s.d(t,{A:()=>a});const a=(0,s(7784).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},9855(e,t,s){s.d(t,{A:()=>a});const a=(0,s(7784).A)("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
2],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])}}]);
3//# sourceMappingURL=8182.56b65816.chunk.js.map

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.