1import{j as e}from"./editor-BhGk7_S1.js";import{B as r}from"./button-CK76V7Lo.js";import{C as D,a as F,b as q,d as E}from"./card-CaSmhJ1l.js";import{u as R,e as S,d as M,b as o,t as u}from"./index-BjIHAQhU.js";import{g as L}from"./languageTranslations-BWtqfsq5.js";import{D as h,a as j,b,c as P,d as U,e as N}from"./dialog-DDbhAKMR.js";import{b as y}from"./leaflet-DcfcX7a_.js";import{A as O}from"./arrow-left-DCV3pRgt.js";import{S as W}from"./square-pen-syxzeoxO.js";import{U as B}from"./users-CXg3PGFq.js";import{S as x}from"./sprout-aIOD4Rx6.js";import{M as z}from"./map-pin-Cg1SEPDo.js";import{C as Q}from"./calendar-DWvkJ5SF.js";import"./mapbox-BPFQ-Sfv.js";import"./trpc-DqtxhgQo.js";import"./index-CmmlU_cv.js";import"./x-rm1_-8OE.js";function oe(){const{t}=R(),w=S(),[,v]=M(),d=parseInt(w.id||"0"),[T,c]=y.useState(!1),[A,i]=y.useState(!1),{data:m}=o.auth.me.useQuery(),{data:s,isLoading:C}=o.profile.getProfile.useQuery({userId:d}),{data:n}=o.teamRequests.getMyRequests.useQuery(void 0,{enabled:!!m&&m.id===d}),f=o.useUtils(),l=o.teamRequests.requestTeamAccess.useMutation({onSuccess:()=>{u.success(t("profile.teamRequestSent")),c(!1),i(!1),f.teamRequests.getMyRequests.invalidate(),f.profile.getProfile.invalidate({userId:d})},onError:a=>{u.error(a.message)}});if(C)return e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:45",className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:46",className:"text-lg text-muted-foreground",children:t("common.loading")})});if(!s)return e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:53",className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:54",className:"text-lg text-muted-foreground",children:"User not found"})});const g=m?.id===s.id,p=`${s.firstName||""} ${s.lastName||""}`.trim()||"Anonymous";return e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:63",className:"min-h-screen bg-background",children:[e.jsx("header",{"data-loc":"client/src/pages/UserProfile.tsx:65",className:"bg-card border-b border-border sticky top-0 z-10",children:e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:66",className:"container mx-auto px-4 py-4",children:e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:67",className:"flex items-center justify-between",children:[e.jsxs(r,{"data-loc":"client/src/pages/UserProfile.tsx:68",variant:"ghost",onClick:()=>{window.history.length>1?window.history.back():window.location.href="/"},className:"text-blue-400 hover:text-blue-300",children:[e.jsx(O,{"data-loc":"client/src/pages/UserProfile.tsx:79",className:"w-4 h-4 mr-2"}),t("common.back")]}),g&&e.jsxs(r,{"data-loc":"client/src/pages/UserProfile.tsx:83",variant:"outline",onClick:()=>v("/profile/edit"),className:"text-blue-400 hover:text-blue-300",children:[e.jsx(W,{"data-loc":"client/src/pages/UserProfile.tsx:88",className:"w-4 h-4 mr-2"}),t("profile.editProfile")]})]})})}),e.jsx("main",{"data-loc":"client/src/pages/UserProfile.tsx:97",className:"container mx-auto px-4 py-8 max-w-4xl",children:e.jsxs(D,{"data-loc":"client/src/pages/UserProfile.tsx:98",className:"bg-card border-border",children:[e.jsxs(F,{"data-loc":"client/src/pages/UserProfile.tsx:99",className:"text-center",children:[e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:101",className:"flex justify-center mb-4",children:e.jsx("img",{"data-loc":"client/src/pages/UserProfile.tsx:102",src:s.profilePicture||"/default-avatar.svg",alt:p,className:"w-32 h-32 rounded-full object-cover border-4 border-blue-500"})}),e.jsx(q,{"data-loc":"client/src/pages/UserProfile.tsx:110",className:"text-3xl font-bold text-foreground mb-2",children:p}),g&&e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:116",className:"flex flex-col sm:flex-row items-center justify-center gap-2 sm:gap-3 mb-4 w-full px-4",children:[!s.isWelcomeTeamMember&&!n?.some(a=>a.teamType==="welcome"&&a.status==="pending")&&e.jsxs(r,{"data-loc":"client/src/pages/UserProfile.tsx:118",size:"sm",onClick:()=>c(!0),className:"bg-gradient-to-r from-[#002FA7] to-[#0047FF] hover:from-[#0047FF] hover:to-[#00A3FF] text-white border-0 font-semibold transition-all",children:[e.jsx(B,{"data-loc":"client/src/pages/UserProfile.tsx:123",className:"w-4 h-4 mr-2"}),t("profile.joinWelcomeTeam")]}),!s.isEcosystemAmbassador&&!n?.some(a=>a.teamType==="ecosystem"&&a.status==="pending")&&e.jsxs(r,{"data-loc":"client/src/pages/UserProfile.tsx:129",size:"sm",onClick:()=>i(!0),className:"bg-gradient-to-r from-[#0047FF] to-[#00A3FF] hover:from-[#00A3FF] hover:to-[#0047FF] text-white border-0 font-semibold transition-all",children:[e.jsx(x,{"data-loc":"client/src/pages/UserProfile.tsx:134",className:"w-4 h-4 mr-2"}),t("profile.joinEcosystemTeam")]}),n?.some(a=>a.teamType==="welcome"&&a.status==="pending")&&e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:141",className:"inline-flex px-3 py-1.5 bg-orange-500/20 text-orange-500 rounded-full text-sm font-semibold items-center justify-center gap-1.5 w-full sm:w-auto",children:["ð¤ ",t("profile.welcomeTeamPending")]}),n?.some(a=>a.teamType==="ecosystem"&&a.status==="pending")&&e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:147",className:"inline-flex px-3 py-1.5 bg-green-500/20 text-green-500 rounded-full text-sm font-semibold items-center justify-center gap-1.5 w-full sm:w-auto",children:[e.jsx(x,{"data-loc":"client/src/pages/UserProfile.tsx:148",className:"w-4 h-4"})," ",t("profile.ecosystemTeamPending")]})]}),e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:155",className:"flex items-center justify-center gap-2 mb-4",children:[s.role==="admin"&&e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:157",className:"inline-block px-3 py-1 bg-yellow-500/20 text-yellow-400 rounded-full text-sm font-semibold",children:t("profile.admin")}),s.isWelcomeTeamMember&&e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:164",className:"inline-block px-3 py-1 bg-orange-500/20 text-orange-500 rounded-full text-sm font-semibold flex items-center gap-1",children:["ð¤ ",t("profile.welcomeTeam")]}),s.isEcosystemAmbassador&&e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:171",className:"inline-flex px-3 py-1 bg-green-500/20 text-green-400 rounded-full text-sm font-semibold items-center gap-1",children:[e.jsx(x,{"data-loc":"client/src/pages/UserProfile.tsx:172",className:"w-4 h-4"})," ",t("profile.ecosystemTeam")]})]}),(s.country||s.city)&&e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:179",className:"flex items-center justify-center gap-2 text-muted-foreground mb-2",children:[e.jsx(z,{"data-loc":"client/src/pages/UserProfile.tsx:180",className:"w-4 h-4"}),e.jsx("span",{"data-loc":"client/src/pages/UserProfile.tsx:181",children:[s.city,s.region,s.country].filter(
1Boolean).join(", ")})]}),(s.language1||s.language2||s.language3)&&e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:189",className:"flex items-center justify-center gap-2 text-muted-foreground mb-2",children:e.jsx("span",{"data-loc":"client/src/pages/UserProfile.tsx:190",className:"text-sm",children:[s.language1,s.language2,s.language3].filter(Boolean).map(a=>L(a,t("_lang"))).join(", ")})}),s.earthAwards!==null&&s.earthAwards!==void 0&&s.earthAwards>0&&e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:201",className:"flex items-center justify-center gap-2 mb-3",children:[e.jsx("span",{"data-loc":"client/src/pages/UserProfile.tsx:202",className:"text-lg font-semibold text-blue-400",children:"Earth Awards"}),e.jsx("div",{"data-loc":"client/src/pages/UserProfile.tsx:203",className:"flex gap-1",children:Array.from({length:s.earthAwards}).map((a,k)=>e.jsx("span",{"data-loc":"client/src/pages/UserProfile.tsx:205",className:"text-2xl",title:"Earth Award",children:"ð"},k))})]}),e.jsxs("div",{"data-loc":"client/src/pages/UserProfile.tsx:212",className:"flex items-center justify-center gap-2 text-muted-foreground text-sm",children:[e.jsx(Q,{"data-loc":"client/src/pages/UserProfile.tsx:213",className:"w-4 h-4"}),e.jsxs("span",{"data-loc":"client/src/pages/UserProfile.tsx:214",children:[t("profile.memberSince")," ",new Date(s.createdAt).toLocaleDateString()]})]})]}),s.bio&&e.jsxs(E,{"data-loc":"client/src/pages/UserProfile.tsx:222",className:"pt-6",children:[e.jsx("h3",{"data-loc":"client/src/pages/UserProfile.tsx:223",className:"text-xl font-semibold text-foreground mb-3",children:t("profile.about")}),e.jsx("p",{"data-loc":"client/src/pages/UserProfile.tsx:226",className:"text-muted-foreground whitespace-pre-wrap",children:s.bio})]})]})}),e.jsx(h,{"data-loc":"client/src/pages/UserProfile.tsx:235",open:T,onOpenChange:c,children:e.jsxs(j,{"data-loc":"client/src/pages/UserProfile.tsx:236",className:"bg-card border-border",children:[e.jsxs(b,{"data-loc":"client/src/pages/UserProfile.tsx:237",children:[e.jsx(P,{"data-loc":"client/src/pages/UserProfile.tsx:238",className:"text-foreground",children:t("profile.joinWelcomeTeam")}),e.jsxs(U,{"data-loc":"client/src/pages/UserProfile.tsx:239",className:"text-muted-foreground",children:[e.jsx("p",{"data-loc":"client/src/pages/UserProfile.tsx:240",className:"mb-3 italic",children:t("profile.teamRecommendation")}),e.jsx("p",{"data-loc":"client/src/pages/UserProfile.tsx:241",children:t("profile.welcomeTeamDescription")})]})]}),e.jsxs(N,{"data-loc":"client/src/pages/UserProfile.tsx:244",children:[e.jsx(r,{"data-loc":"client/src/pages/UserProfile.tsx:245",variant:"outline",onClick:()=>c(!1),className:"text-muted-foreground",children:t("common.cancel")}),e.jsx(r,{"data-loc":"client/src/pages/UserProfile.tsx:252",onClick:()=>l.mutate({teamType:"welcome"}),disabled:l.isPending,className:"bg-blue-600 hover:bg-blue-700 text-white",children:l.isPending?t("common.loading"):t("common.confirm")})]})]})}),e.jsx(h,{"data-loc":"client/src/pages/UserProfile.tsx:264",open:A,onOpenChange:i,children:e.jsxs(j,{"data-loc":"client/src/pages/UserProfile.tsx:265",className:"bg-card border-border",children:[e.jsxs(b,{"data-loc":"client/src/pages/UserProfile.tsx:266",children:[e.jsx(P,{"data-loc":"client/src/pages/UserProfile.tsx:267",className:"text-foreground",children:t("profile.joinEcosystemTeam")}),e.jsxs(U,{"data-loc":"client/src/pages/UserProfile.tsx:268",className:"text-muted-foreground",children:[e.jsx("p",{"data-loc":"client/src/pages/UserProfile.tsx:269",className:"mb-3 italic",children:t("profile.teamRecommendation")}),e.jsx("p",{"data-loc":"client/src/pages/UserProfile.tsx:270",children:t("profile.ecosystemTeamDescription")})]})]}),e.jsxs(N,{"data-loc":"client/src/pages/UserProfile.tsx:273",children:[e.jsx(r,{"data-loc":"client/src/pages/UserProfile.tsx:274",variant:"outline",onClick:()=>i(!1),className:"text-muted-foreground",children:t("common.cancel")}),e.jsx(r,{"data-loc":"client/src/pages/UserProfile.tsx:281",onClick:()=>l.mutate({teamType:"ecosystem"}),disabled:l.isPending,className:"bg-blue-500 hover:bg-blue-600 text-white",children:l.isPending?t("common.loading"):t("common.confirm")})]})]})})]})}export{oe as default};
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.