1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[13164],{3172:(e,t,s)=>{s.d(t,{B:()=>p});var r=s(95155),a=s(19749),i=s(13594),l=s(54203),n=s(73981),o=s(12115),c=s(8191);let d=o.forwardRef((e,t)=>{let s,i,n,o,d=(0,a.c)(9);return d[0]!==e?({className:s,...i}=e,d[0]=e,d[1]=s,d[2]=i):(s=d[1],i=d[2]),d[3]!==s?(n=(0,c.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),d[3]=s,d[4]=n):n=d[4],d[5]!==i||d[6]!==t||d[7]!==n?(o=(0,r.jsx)(l.bL,{ref:t,className:n,...i}),d[5]=i,d[6]=t,d[7]=n,d[8]=o):o=d[8],o});function u(e){let t,s,i,o,c,d,u=(0,a.c)(12);u[0]!==e?({src:i,alt:t,size:o,...s}=e,u[0]=e,u[1]=t,u[2]=s,u[3]=i,u[4]=o):(t=u[1],s=u[2],i=u[3],o=u[4]);let m=void 0===o?"md":o;if(u[5]!==t||u[6]!==m||u[7]!==i){let e={sm:32,md:48,lg:80,xl:128}[m]||48;c=(0,n.getImageProps)({src:i&&i instanceof Blob?URL.createObjectURL(i):i||"",alt:t||"",width:e,height:e,sizes:`${e}px`,quality:80}),u[5]=t,u[6]=m,u[7]=i,u[8]=c}else c=u[8];let{props:x}=c;return u[9]!==x||u[10]!==s?(d=(0,r.jsx)(l._V,{...s,...x}),u[9]=x,u[10]=s,u[11]=d):d=u[11],d}d.displayName=l.bL.displayName,o.forwardRef((e,t)=>{let s,i,n,o,d=(0,a.c)(9);return d[0]!==e?({className:s,...i}=e,d[0]=e,d[1]=s,d[2]=i):(s=d[1],i=d[2]),d[3]!==s?(n=(0,c.cn)("aspect-square h-full w-full",s),d[3]=s,d[4]=n):n=d[4],d[5]!==i||d[6]!==t||d[7]!==n?(o=(0,r.jsx)(l._V,{ref:t,className:n,...i}),d[5]=i,d[6]=t,d[7]=n,d[8]=o):o=d[8],o}).displayName=l._V.displayName;let m=o.forwardRef((e,t)=>{let s,i,n,o,d=(0,a.c)(9);return d[0]!==e?({className:s,...i}=e,d[0]=e,d[1]=s,d[2]=i):(s=d[1],i=d[2]),d[3]!==s?(n=(0,c.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",s),d[3]=s,d[4]=n):n=d[4],d[5]!==i||d[6]!==t||d[7]!==n?(o=(0,r.jsx)(l.H4,{ref:t,className:n,...i}),d[5]=i,d[6]=t,d[7]=n,d[8]=o):o=d[8],o});m.displayName=l.H4.displayName;var x=s(22136),h=s(98357);let p=e=>{let t,s,l,n,o,p,b,f,g=(0,a.c)(24),{userPremiumLevel:y,avatarUrl:j,username:w,size:v,onClick:N}=e,k=void 0===y?x.b.NONE:y,S=void 0===v?"md":v;if(g[0]!==N||g[1]!==S||g[2]!==k){if(s={sm:"!h-8 !w-8",md:"!h-12 !w-12",lg:"!h-20 !w-20",xl:"!h-32 !w-32"},g[8]!==N||g[9]!==k){let e=(0,h.Bl)(k,!0);n=(0,c.cn)("inline-flex aspect-square shrink-0 items-center justify-center overflow-hidden rounded-full",e,N&&"cursor-pointer hover:opacity-90 transition-opacity"),g[8]=N,g[9]=k,g[10]=n}else n=g[10];o=N,t=d,l=(0,c.cn)("bg-slate-800",s[S]),g[0]=N,g[1]=S,g[2]=k,g[3]=t,g[4]=s,g[5]=l,g[6]=n,g[7]=o}else t=g[3],s=g[4],l=g[5],n=g[6],o=g[7];return g[11]!==j||g[12]!==S||g[13]!==s||g[14]!==w?(p=j?(0,r.jsx)(u,{src:j,alt:w||"User",size:S}):(0,r.jsx)(m,{className:"bg-slate-700 text-slate-200",children:(0,r.jsx)(i.A,{size:"h-8 w-8"===s[S]?16:"h-10 w-10"===s[S]?20:24})}),g[11]=j,g[12]=S,g[13]=s,g[14]=w,g[15]=p):p=g[15],g[16]!==t||g[17]!==l||g[18]!==p?(b=(0,r.jsx)(t,{className:l,children:p}),g[16]=t,g[17]=l,g[18]=p,g[19]=b):b=g[19],g[20]!==n||g[21]!==o||g[22]!==b?(f=(0,r.jsx)("div",{className:n,onClick:o,children:b}),g[20]=n,g[21]=o,g[22]=b,g[23]=f):f=g[23],f}},5476:(e,t,s)=>{s.d(t,{Xi:()=>c,av:()=>d,j7:()=>o,tU:()=>n});var r=s(95155),a=s(25213),i=s(12115),l=s(8191);let n=a.bL,o=i.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,r.jsx)(a.B8,{ref:t,className:(0,l.cn)("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...i})});o.displayName=a.B8.displayName;let c=i.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,r.jsx)(a.l9,{ref:t,type:"button",className:(0,l.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",s),...i})});c.displayName=a.l9.displayName;let d=i.forwardRef((e,t)=>{let{className:s,...i}=e;return(0,r.jsx)(a.UC,{ref:t,className:(0,l.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...i})});d.displayName=a.UC.displayName},10625:(e,t,s)=>{async function r(e,t){let s={title:[t.context.entityName,t.context.actionName||t.context.abilityName,"custom"!==t.context.rollType?`(${t.context.rollType}
1)`:null].filter(Boolean).join(" â "),description:`**${t.notation}** â **${t.result}**${t.context.actionDescription?` 2*${t.context.actionDescription.slice(0,200)}*`:""}`,color:t.result>=20?0xf59e0b:t.result<=1?0xef4444:3718648,footer:{text:"Rolled from CharGen"},timestamp:new Date(t.timestamp).toISOString()};await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeds:[s]})})}async function a(e){try{return await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeds:[{title:"CharGen VTT Test Roll",description:"**1d20+5** â **17**\nDice integration is working!",color:3718648,footer:{text:"Test roll from CharGen"}}]})}),!0}catch{return!1}}s.d(t,{Q:()=>a,o:()=>r})},11191:(e,t,s)=>{s.d(t,{W:()=>w});var r=s(95155),a=s(19749),i=s(42601),l=s(36024),n=s(85626),o=s(71945),c=s(83387),d=s(23434),u=s(74454),m=s(86564);function x(){d.oR.success("Preferences updated")}function h(e){return(0,u.fq)(e)}function p(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"space-y-4 py-2 animate-pulse",children:[1,2,3,4].map(b)}),t[0]=e):e=t[0],e}function b(e){return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"h-3 w-20 rounded bg-white/[0.06]"}),[1,2,3].map(f)]},e)}function f(e){return(0,r.jsxs)("div",{className:"flex items-center gap-3 py-3 border-b border-white/[0.04] last:border-b-0",children:[(0,r.jsx)("div",{className:"h-8 w-8 rounded-full bg-white/[0.06] shrink-0"}),(0,r.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,r.jsx)("div",{className:"h-3 w-24 rounded bg-white/[0.06]"}),(0,r.jsx)("div",{className:"h-2.5 w-40 rounded bg-white/[0.06]"})]}),(0,r.jsx)("div",{className:"h-5 w-9 rounded-full bg-white/[0.06] shrink-0"})]},e)}function g(e){let t,s,i,n,o,c,d,u,m,x,h=(0,a.c)(28),{type:p,info:b,enabled:f,onToggle:g}=e,y=b.icon,j=b.iconColor??"text-studio-tertiary",w=f?`bg-sky-500/10 ${j}`:"bg-white/[0.04] text-studio-disabled";h[0]!==w?(t=["h-8 w-8 rounded-full flex items-center justify-center shrink-0 transition-colors",w],h[0]=w,h[1]=t):t=h[1];let v=t.join(" ");h[2]!==y?(s=(0,r.jsx)(y,{size:15}),h[2]=y,h[3]=s):s=h[3],h[4]!==v||h[5]!==s?(i=(0,r.jsx)("div",{className:v,children:s}),h[4]=v,h[5]=s,h[6]=i):i=h[6];let N=f?"text-studio-secondary":"text-studio-disabled";h[7]!==N?(n=["text-studio-body font-medium leading-tight",N],h[7]=N,h[8]=n):n=h[8];let k=n.join(" ");h[9]!==b.label||h[10]!==k?(o=(0,r.jsx)("p",{className:k,children:b.label}),h[9]=b.label,h[10]=k,h[11]=o):o=h[11],h[12]!==b.description?(c=(0,r.jsx)("p",{className:"text-studio-micro text-studio-tertiary mt-0.5 leading-tight",children:b.description}),h[12]=b.description,h[13]=c):c=h[13],h[14]!==c||h[15]!==o?(d=(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[o,c]}),h[14]=c,h[15]=o,h[16]=d):d=h[16],h[17]!==g||h[18]!==p?(u=e=>g(p,e),h[17]=g,h[18]=p,h[19]=u):u=h[19];let S=`${f?"Disable":"Enable"} ${b.label} notifications`;return h[20]!==f||h[21]!==u||h[22]!==S?(m=(0,r.jsx)(l.d,{checked:f,onCheckedChange:u,className:"shrink-0 data-[state=checked]:bg-sky-500","aria-label":S}),h[20]=f,h[21]=u,h[22]=S,h[23]=m):m=h[23],h[24]!==d||h[25]!==m||h[26]!==i?(x=(0,r.jsxs)("div",{className:"flex items-center gap-3 py-3 border-b border-white/[0.04] last:border-b-0",children:[i,d,m]}),h[24]=d,h[25]=m,h[26]=i,h[27]=x):x=h[27],x}function y(e){let t,s,i,l,n=(0,a.c)(14),{group:o,items:c,disabledTypes:d,onToggle:u}=e;if(0===c.length)return null;let x=m.Au[o];if(n[0]!==x?(t=(0,r.jsx)("p",{className:"text-studio-body font-medium text-studio-tertiary uppercase tracking-wider mb-1",children:x}),n[0]=x,n[1]=t):t=n[1],n[2]!==d||n[3]!==c||n[4]!==u){let e;n[6]!==d||n[7]!==u?(e=e=>{let{type:t,info:s}=e;return(0,r.jsx)(g,{type:t,info:s,enabled:!d.has(t),onToggle:u},t)},n[6]=d,n[7]=u,n[8]=e):e=n[8],s=c.map(e),n[2]=d,n[3]=c,n[4]=u,n[5]=s}else s=n[5];return n[9]!==s?(i=(0,r.jsx)("div",{children:s}),n[9]=s,n[10]=i):i=n[10],n[11]!==t||n[12]!==i?(l=(0,r.jsxs)("div",{className:"space-y-0.5",children:[t,i]}),n[11]=t,n[12]=i,n[13]=l):l=n[13],l}let j=["social","content","loras","rewards"];function w(){let e,t,s,l,b,f,g,w,v,N,k,S,C,_,A,T,I,P,E,L,R=(0,a.c)(13),{grouped:U,disabledTypes:z,isLoading:M,error:D,toggleType:O,isSaving:F,refetch:$}=(C=(0,a.c)(25),_=(0,n.jE)(),C[0]===Symbol.for("react.memo_cache_sentinel")?(l=m.qn.preferences(),C[0]=l):l=C[0],!0!==C[1]?(b={queryKey:l,queryFn:u.s2,enabled:!0},C[1]=!0,C[2]=b):b=C[2],A=(0,o.I)(b),C[3]!==A.data?.preferences?.availableTypes?(f=A.data?.preferences?.availableTypes??[],C[3]=A.data?.preferences?.availableTypes,C[4]=f):f=C[4],T=f,C[5]!==A.data?.preferences?.disabledTypes?(g=A.data?.preferences?.disabledTypes??[],C[5]=A.data?.preferences?.disabledTypes,C[6]=g):g=C[6],C[7]!==g?(w=new Set(g),C[7]=g,C[8]=w):w=C[8],I=w,C[9]!==T?(v=(0,m.Yl)(T),C[9]=T,C[10]=v):v=C[10],P=v,C[11]!==_?(N={mutationFn:h,onMutate:async e=>{await _.cancelQueries({queryKey:m.qn.preferences()});let t=_.getQueryData(m.qn.preferences());return _.setQueryData(m.qn.preferences(),t=>({...t,preferences:{availableTypes:t?.preferences?.availableTypes??[],disabledTypes:e}})),{previous:t}},onError:(e,t,s)=>{s?.previous!==void 0&&_.setQueryData(m.qn.preferences(),s.previous),d.oR.error("Failed to update preferences")},onSuccess:x},C[11]=_,C[12]=N):N=C[12],E=(0,c.n)(N),C[13]!==I||C[14]!==E?(k=function(e,t){let s=new Set(I);t?s.delete(e):s.add(e),E.mutate(Array.from(s))},C[13]=I,C[14]=E,C[15]=k):k=C[15],L=k,C[16]!==T||C[17]!==I||C[18]!==A.error||C[19]!==A.isPending||C[20]!==A.refetch||C[21]!==P||C[22]!==E.isPending||C[23]!==L?(S={availableTypes:T,disabledTypes:I,grouped:P,isLoading:A.isPending,error:A.error,toggleType:L,isSaving:E.isPending,refetch:A.refetch},C[16]=T,C[17]=I,C[18]=A.error,C[19]=A.isPending,C[20]=A.refetch,C[21]=P,C[22]=E.isPending,C[23]=L,C[24]=S):S=C[24],S);if(M){let e;return R[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(p,{}),R[0]=e):e=R[0],e}if(D){let e,t;return R[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("p",{className:"text-studio-body text-studio-tertiary",children:"Failed to load notification preferences."}),R[1]=e):e=R[1],R[2]!==$?(t=(0,r.jsxs)("div",{className:"py-10 flex flex-col items-center gap-3 text-center",children:[e,(0,r.jsx)("button",{onClick:()=>$(),className:"text-studio-body text-studio-accent hover:text-sky-300 transition-colors underline underline-offset-2",children:"Try Again"})]}),R[2]=$,R[3]=t):t=R[3],t}return R[4]!==z||R[5]!==U||R[6]!==O?(e=j.map(e=>(0,r.jsx)(y,{group:e,items:U[e]??[],disabledTypes:z,onToggle:O},e)),R[4]=z,R[5]=U,R[6]=O,R[7]=e):e=R[7],R[8]!==F?(t=F&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-1 pb-2",children:[(0,r.jsx)(i.A,{size:13,className:"animate-spin text-sky-400"}),(0,r.jsx)("span",{className:"text-studio-micro text-studio-tertiary",children:"Savingâ¦"})]}),R[8]=F,R[9]=t):t=R[9],R[10]!==e||R[11]!==t?(s=(0,r.jsxs)("div",{className:"space-y-5",children:[e,t]}),R[10]=e,R[11]=t,R[12]=s):s=R[12],s}},13164:(e,t,s)=>{s.r(t),s.d(t,{default:()=>sC});var r=s(95155),a=s(19749),i=s(12115),l=s(8191);let n=e=>{let t,s,n,o,c,d,u=(0,a.c)(15),{children:m,delay:x,duration:h,direction:p,className:b}=e,f=void 0===x?0:x,g=void 0===p?"up":p,[y,j]=i.useState(!1),w=i.useRef(null);u[0]!==f?(t=()=>{let e=w.current;if(!e)return;let t=new IntersectionObserver(s=>{let[r]=s;r.isIntersecting&&(setTimeout(()=>j(!0),f),t.unobserve(e))},{threshold:.1});return t.observe(e),()=>t.disconnect()},s=[f],u[0]=f,u[1]=t,u[2]=s):(t=u[1],s=u[2]),i.useEffect(t,s),u[3]!==g||u[4]!==y?(n=()=>
2{if(!y)switch(g){case"up":default:return"transition-all opacity-0 translate-y-8";case"down":return"transition-all opacity-0 -translate-y-8";case"left":return"transition-all opacity-0 translate-x-8";case"right":return"transition-all opacity-0 -translate-x-8"}return"transition-all opacity-100 translate-x-0 translate-y-0"},u[3]=g,u[4]=y,u[5]=n):n=u[5];let v=n;u[6]!==b||u[7]!==v?(o=(0,l.cn)(v(),b),u[6]=b,u[7]=v,u[8]=o):o=u[8];let N=`${void 0===h?300:h}ms`;return u[9]!==N?(c={transitionDuration:N},u[9]=N,u[10]=c):c=u[10],u[11]!==m||u[12]!==o||u[13]!==c?(d=(0,r.jsx)("div",{ref:w,className:o,style:c,children:m}),u[11]=m,u[12]=o,u[13]=c,u[14]=d):d=u[14],d};var o=s(82222),c=s(56154);let d={"Images Generated":10,"Total Likes":5,"Competitions Won":200,"Competitions Entered":50,"Achievements Earned":100,"Max Login Streak":20,"Comments Made":10},u={legendary:{label:"Legendary",accentClass:"text-amber-400",iconClass:"text-amber-400/70"},epic:{label:"Epic",accentClass:"text-purple-400",iconClass:"text-purple-400/70"},rare:{label:"Rare",accentClass:"text-sky-400",iconClass:"text-sky-400/70"},common:{label:"Common",accentClass:"text-studio-tertiary",iconClass:"text-studio-disabled"}},m=[{key:"Images Generated",icon:"Image",priority:1},{key:"Total Likes",icon:"Heart",priority:2},{key:"Competitions Won",icon:"Award",priority:3},{key:"Competitions Entered",icon:"Trophy",priority:4},{key:"Achievements Earned",icon:"BadgeCheck",priority:5},{key:"Max Login Streak",icon:"TrendingUp",priority:6},{key:"Comments Made",icon:"MessageCircle",priority:7},{key:"Followers",icon:"Users",priority:8},{key:"Following",icon:"UserCheck",priority:9},{key:"Requests Made",icon:"Send",priority:10},{key:"Premium Requests",icon:"Crown",priority:11},{key:"Comment Likes Given",icon:"ThumbsUp",priority:12},{key:"Stat Blocks Created",icon:"Layers",priority:13},{key:"Daily Gold Bonuses Collected",icon:"Coins",priority:14},{key:"Current Login Streak",icon:"Flame",priority:15},{key:"Number of Presets Created",icon:"Sliders",priority:16},{key:"Number of Referrals Made",icon:"Share2",priority:17}];var x=s(71945),h=s(86906),p=s(7294);async function b(){return(await (0,h.getCurrentUserFullInfo)()).user}function f(e){return e}let g=["showcases","gallery","progress","settings","vtt"],y={editMode:!1,socialModal:{open:!1,tab:"followers"}};function j(e,t){switch(t.type){case"SET_EDIT_MODE":return{...e,editMode:t.payload};case"OPEN_SOCIAL_MODAL":return{...e,socialModal:{open:!0,tab:t.payload}};case"CLOSE_SOCIAL_MODAL":return{...e,socialModal:{...e.socialModal,open:!1}};default:return e}}let w=(0,i.createContext)(null);function v(e){var t,s,l;let n,u,m,v,N,k,S,C,_,A,T,I,P,E,{ssrUser:L,children:R}=e,{state:U}=(0,c.As)(),z=(0,o.usePathname)(),M=(0,o.useSearchParams)(),D=(0,o.useParams)(),O=D?.username??void 0,F=!O||U.username===O,{data:$,isLoading:B}=(t={enabled:!F&&!L},(v=(0,a.c)(8))[0]!==O?(n=p.e.user(O??""),v[0]=O,v[1]=n):n=v[1],v[2]!==O?(u=async()=>(await (0,h.getUserInfo)(O)).user,v[2]=O,v[3]=u):u=v[3],N=!!O&&(t?.enabled??!0),v[4]!==n||v[5]!==u||v[6]!==N?(m={queryKey:n,queryFn:u,enabled:N,staleTime:3e4},v[4]=n,v[5]=u,v[6]=N,v[7]=m):m=v[7],(0,x.I)(m)),{data:q,isLoading:G}
2=(s=F&&!L,C=(0,a.c)(3),_=void 0===s||s,C[0]===Symbol.for("react.memo_cache_sentinel")?(k=p.e.user("__self__"),C[0]=k):k=C[0],C[1]!==_?(S={queryKey:k,queryFn:b,enabled:_,staleTime:3e4},C[1]=_,C[2]=S):S=C[2],(0,x.I)(S)),W=L??(F?q??null:$??null),K=F?G:B,{data:V,isLoading:Q}=(l=W?.userId,(P=(0,a.c)(8))[0]!==l?(A=p.e.stats(l??""),P[0]=l,P[1]=A):A=P[1],P[2]!==l?(T=async()=>{let e=await (0,h.getUserStats)(l);return"error"in e?{}:e},P[2]=l,P[3]=T):T=P[3],E=!!l,P[4]!==A||P[5]!==T||P[6]!==E?(I={queryKey:A,queryFn:T,enabled:E,staleTime:6e4,select:f},P[4]=A,P[5]=T,P[6]=E,P[7]=I):I=P[7],(0,x.I)(I)),X=function(e){let t,s,r,i,l,n,o,c=(0,a.c)(14);if(c[0]!==e){var u;n=e?Object.entries(d).reduce((t,s)=>{let[r,a]=s;return t+(e[r]??0)*a},0):0,({level:s,currentXP:t,nextLevelXP:r,progress:i}=function(e){var t,s,r;let a=0;for(;(t=a+1)*t*100<=e;)a++;let i=(s=a)*s*100,l=(r=a+1)*r*100,n=e-i,o=l-i;return{level:a,currentXP:n,nextLevelXP:o,progress:o>0?n/o:1}}(n)),l=(u=s)>=40?"Mythic Creator":u>=35?"Legendary Creator":u>=30?"Grandmaster":u>=25?"Master Artist":u>=20?"Seasoned Creator":u>=15?"Veteran Creator":u>=10?"Skilled Artisan":u>=5?"Apprentice Artist":"Novice Creator",c[0]=e,c[1]=t,c[2]=s,c[3]=r,c[4]=i,c[5]=l,c[6]=n}else t=c[1],s=c[2],r=c[3],i=c[4],l=c[5],n=c[6];let m=l;return c[7]!==t||c[8]!==s||c[9]!==r||c[10]!==i||c[11]!==m||c[12]!==n?(o={level:s,title:m,totalXP:n,currentXP:t,nextLevelXP:r,progress:i},c[7]=t,c[8]=s,c[9]=r,c[10]=i,c[11]=m,c[12]=n,c[13]=o):o=c[13],o}(V),Y=M?.get("tab")??void 0,[J,H]=(0,i.useState)("showcases");(0,i.useEffect)(()=>{H(Y&&g.includes(Y)?Y:"showcases")},[Y]);let Z=(0,i.useCallback)(e=>{H(e),es(null);let t=new URLSearchParams,s=M?.get("username");s&&t.set("username",s),t.set("tab",e);let r=t.toString();window.history.replaceState(null,"",`${z??"/profile"}${r?`?${r}`:""}`)},[z,M]),ee=M?.get("showcase")??null,[et,es]=(0,i.useState)(null);(0,i.useEffect)(()=>{es(ee)},[ee]);let er=(0,i.useCallback)(e=>{es(e);let t=new URLSearchParams,s=M?.get("username");s&&t.set("username",s);let r=M?.get("tab");r&&t.set("tab",r),e&&t.set("showcase",e);let a=t.toString();window.history.replaceState(null,"",`${z??"/profile"}${a?`?${a}`:""}`)},[z,M]),[ea,ei]=(0,i.useReducer)(j,y),el=(0,i.useCallback)(e=>{ei({type:"SET_EDIT_MODE",payload:e})},[]),en=(0,i.useCallback)(e=>{ei({type:"OPEN_SOCIAL_MODAL",payload:e})},[]),eo=(0,i.useCallback)(()=>{ei({type:"CLOSE_SOCIAL_MODAL"})},[]),ec=(0,i.useMemo)(()=>({user:W,isLoading:K,stats:V,statsLoading:Q,isOwnProfile:F,creatorLevel:X,activeTab:J,setActiveTab:Z,activeShowcaseId:et,setActiveShowcase:er,editMode:ea.editMode,setEditMode:el,socialModal:ea.socialModal,openSocialModal:en,closeSocialModal:eo}),[W,K,V,Q,F,X,J,Z,et,er,ea.editMode,el,ea.socialModal,en,eo]);return(0,r.jsx)(w.Provider,{value:ec,children:R})}function N(){let e=(0,i.useContext)(w);if(!e)throw Error("useProfileContext must be used within a <ProfileProvider>");return e}var k=s(42601),S=s(14547),C=s(58079),_=s(6814),A=s(77317),T=s(64523),I=s(43245),P=s(83974),E=s(58652),L=s(15927),R=s(73981),U=s(73549),z=s.n(U),M=s(87809),D=s(52320),O=s(3172),F=s(68668);function $(e){let t,s,r,i=(0,a.c)(8);i[0]!==e?(t=p.e.featuredImages(e??""),i[0]=e,i[1]=t):t=i[1],i[2]!==e?(s=async()=>{let t=await (0,F.searchImages)({filters:{userId:e},sortField:"highestrated",sortOrder:"desc",page:0,pageSize:10});return t?.images??[]},i[2]=e,i[3]=s):s=i[3];let l=!!e;return i[4]!==t||i[5]!==s||i[6]!==l?(r={queryKey:t,queryFn:s,enabled:l,staleTime:3e5},i[4]=t,i[5]=s,i[6]=l,i[7]=r):r=i[7],(0,x.I)(r)}var B=s(85626),q=s(83387);function G(e){return(0,h.updateUser)(e)}function W(e){return(0,h.updateUserProfile)(e)}var K=s(17324);function V(e){let t,s,r=(0,a.c)(3),i=void 0===e||e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(t=p.e.allTasks(),r[0]=t):t=r[0],r[1]!==i?(s={queryKey:t,queryFn:Q,enabled:i,staleTime:6e4},r[1]=i,r[2]=s):s=r[2],(0,x.I)(s)}async function Q(){let e=await (0,K.aC)();return{tasks:e.tasks??[],dailyTasks:e.dailyTasks??[]}}function X(e){let t,s,r,i=(0,a.c)(8);i[0]!==e?(t=p.e.tasks(e??""),i[0]=e,i[1]=t):t=i[1],i[2]!==e?(s=async()=>(await (0,K.m9)(e)).tasks,i[2]=e,i[3]=s):s=i[3];let l=!!e;return i[4]!==t||i[5]!==s||i[6]!==l?(r={queryKey:t,queryFn:s,enabled:l,staleTime:6e4},i[4]=t,i[5]=s,i[6]=l,i[7]=r):r=i[7],(0,x.I)(r)}var Y=s(15497),J=s(22136),H=s(83535);function Z(e){let t,s,i,n,o,c,d,u=(0,a.c)(20),{image:m,active:x,onClick:h}=e,p=m.webpImage??m.image;u[0]!==m.imageMetadata?.description||u[1]!==m.imageMetadata?.theme?(t=m.imageMetadata?.description?.trim()||m.imageMetadata?.theme?.trim()||"Featured artwork",u[0]=m.imageMetadata?.description,u[1]=m.imageMetadata?.theme,u[2]=t):t=u[2];let b=t,f=x?"opacity-100 z-[1]":"opacity-0 z-0";u[3]!==f?(s=(0,l.cn)("absolute inset-0 transition-opacity ease-in-out",f),u[3]=f,u[4]=s):s=u[4],u[5]===Symbol.for("react.memo_cache_sentinel")?(i={transitionDuration:"800ms"},u[5]=i):i=u[5];let g=x&&"scale-[1.03]";return u[6]!==g?(n=(0,l.cn)("object-cover transition-transform duration-[6000ms] ease-out",g),u[6]=g,u[7]=n):n=u[7],u[8]!==x||u[9]!==b||u[10
2]!==p||u[11]!==n?(o=(0,r.jsx)(R.default,{src:p,alt:b,fill:!0,className:n,sizes:"(max-width: 768px) 100vw, 55vw",priority:x}),u[8]=x,u[9]=b,u[10]=p,u[11]=n,u[12]=o):o=u[12],u[13]!==b||u[14]!==h?(c=h&&(0,r.jsx)("button",{onClick:h,className:"absolute inset-0 z-[2] cursor-pointer","aria-label":`View: ${b}`}),u[13]=b,u[14]=h,u[15]=c):c=u[15],u[16]!==s||u[17]!==o||u[18]!==c?(d=(0,r.jsxs)("div",{className:s,style:i,children:[o,c]}),u[16]=s,u[17]=o,u[18]=c,u[19]=d):d=u[19],d}function ee(e){let t,s,i=(0,a.c)(6),{count:n,activeIndex:o,onDotClick:c}=e;return n<=1?null:(i[0]!==n?(t=Array.from({length:n}),i[0]=n,i[1]=t):t=i[1],i[2]!==o||i[3]!==c||i[4]!==t?(s=(0,r.jsx)("div",{className:"flex items-center justify-center gap-1.5 mt-3",children:t.map((e,t)=>(0,r.jsx)("button",{onClick:()=>c(t),className:(0,l.cn)("rounded-full transition-all duration-300",t===o?"w-5 h-1.5 bg-sky-400":"w-1.5 h-1.5 bg-white/20 hover:bg-white/40"),"aria-label":`Go to image ${t+1}`},t))}),i[2]=o,i[3]=c,i[4]=t,i[5]=s):s=i[5],s)}function et(e){let t,s,i,l,n=(0,a.c)(10),{image:o}=e;if(n[0]!==o.imageMetadata?.description||n[1]!==o.imageMetadata?.theme){let e=o.imageMetadata?.description?.trim()||o.imageMetadata?.theme?.trim();t=e&&e.length>60?e.slice(0,60)+"â¦":e,n[0]=o.imageMetadata?.description,n[1]=o.imageMetadata?.theme,n[2]=t}else t=n[2];let c=t;return n[3]!==c?(s=c&&(0,r.jsx)("p",{className:"text-studio-body text-white/90 truncate",style:{textShadow:"0 1px 4px rgba(0,0,0,0.8)"},children:c}),n[3]=c,n[4]=s):s=n[4],n[5]!==o.voteCount?(i=o.voteCount>0&&(0,r.jsxs)("span",{className:"flex items-center gap-1 text-studio-micro text-white/70 shrink-0",children:[(0,r.jsx)(H.A,{size:12,className:"fill-current"}),o.voteCount]}),n[5]=o.voteCount,n[6]=i):i=n[6],n[7]!==s||n[8]!==i?(l=(0,r.jsx)("div",{className:"absolute inset-x-0 bottom-0 z-[3] pointer-events-none",children:(0,r.jsx)("div",{className:"bg-gradient-to-t from-black/70 via-black/30 to-transparent px-4 pb-3 pt-10",children:(0,r.jsxs)("div",{className:"flex items-end justify-between gap-3",children:[s,i]})})}),n[7]=s,n[8]=i,n[9]=l):l=n[9],l}function es(){let e,t,s=(0,a.c)(2);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"absolute inset-0 opacity-[0.03]",style:{backgroundImage:"linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px)",backgroundSize:"40px 40px"}}),s[0]=e):e=s[0],s[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsxs)("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-sky-900/20 via-studio-surface-2 to-purple-900/10 border border-white/[0.04] aspect-[4/3]",children:[e,(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,r.jsx)("p",{className:"text-studio-body text-studio-disabled",children:"No featured artwork yet"})})]}),s[1]=t):t=s[1],t}let er=function(e){let t,s,n,o,c,d,u,m,x,h,p,b,f,g,y,j,w,v,N,k,S=(0,a.c)(50),{userId:C,onImageClick:_,className:A}=e,{data:T}=$(C);S[0]!==T?(t=T??[],S[0]=T,S[1]=t):t=S[1],S[2]!==t?(s=t.slice(0,10),S[2]=t,S[3]=s):s=S[3];let I=s,[P,E]=(0,i.useState)(0),L=(0,i.useRef)(!1),R=(0,i.useRef)(void 0);S[4]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{E(0)},S[4]=n):n=S[4],S[5]!==I.length?(o=[I.length],S[5]=I.length,S[6]=o):o=S[6],(0,i.useEffect)(n,o),S[7]!==I.length?(c=()=>{if(I.length<=1)return;let e=()=>{L.current||E(e=>(e+1)%I.length),R.current=setTimeout(e,5e3)};return R.current=setTimeout(e,5e3),()=>clearTimeout(R.current)},d=[I.length],S[7]=I.length,S[8]=c,S[9]=d):(c=S[8],d=S[9]),(0,i.useEffect)(c,d),S[10]!==I.length?(u=e=>{E(e),clearTimeout(R.current),R.current=setTimeout(()=>{L.current||E(e=>(e+1)%I.length)},5e3)},S[10]=I.length,S[11]=u):u=S[11];let U=u;S[12]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{L.current=!0},S[12]=m):m=S[12];let z=m;S[13]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{L.current=!1},S[13]=x):x=S[13];let M=x;if(0===I.length){let e;return S[14]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(es,{}),S[14]=e):e=S[14],e}let D=I[P];S[15]!==A?(h=A?.includes("h-full"),S[15]=A,S[16]=h):h=S[16];let O=h,F=O?"flex flex-col h-full":"";S[17]!==A||S[18]!==F?(p=(0,l.cn)(F,A),S[17]=A,S[18]=F,S[19]=p):p=S[19];let B=O?"flex-1 min-h-0":"rounded-2xl border border-white/[0.06] shadow-lg shadow-black/20";S[20]!==B?(b=(0,l.cn)("relative overflow-hidden group",B),S[20]=B,S[21]=b):b=S[21];let q=O?"h-full":"aspect-[4/3]";if(S[22]!==q?(f=(0,l.cn)("relative bg-studio-surface-2",q),S[22]=q,S[23]=f):f=S[23],S[24]!==P||S[25]!==_||S[26]!==I){let e;S[28]!==P||S[29]!==_?(e=(e,t)=>(0,r.jsx)(Z,{image:e,active:t===P,onClick:_?()=>_(e.id):void 0},e.id),S[28]=P,S[29]=_,S[30]=e):e=S[30],g=I.map(e),S[24]=P,S[25]=_,S[26]=I,S[27]=g}else g=S[27];return S[31]===Symbol.for("react.memo_cache_sentinel")?(y=(0,r.jsx)("div",{className:"absolute inset-0 z-[2] pointer-events-none shadow-[inset_0_0_60px_rgba(0,0,0,0.15)]"}),S[31]=y):y=S[31],S[32]!==D?(j=D&&(0,r.jsx)(et,{image:D}),S[32]=D,S[33]=j):j=S[33],S[34]!==f||S[35]!==g||S[36]!==j?(w=(0,r.jsxs)("div",{className:f,children:[g,y,j]}),S[34]=f,S[35]=g,S[36]=j,S[37]=w):w=S[37],S[38]!==b||S[39]!==w?(v=(0,r.jsx)("div",{className:b,onMouseEnter:z,onMouseLeave:M,children:w}),S[38]=b,S[39]=w,S[40]=v):v=S[40],S[41]!==P||S[42]!==U||S[43]!==O||S[44]!==I.length?(N=!O&&(0,r.jsx)(ee,{count:I.length,activeIndex:P,onDotClick:U}),S[41]=P,S[42]=U,S[43]=O,S[44]=I.length,S[45]=N):N=S[45],S[46]!==p||S[47]!==v||S[48]!==N?(k=(0,r.jsxs)("div",{className:p,children:[v,N]}),S[46]=p,S[47]=v,S[48]=N,S[49]=k):k=S[49],k},ea=new Intl.NumberFormat("en",{notation:"compact"});
2function ei(e){let t,s,i,n=(0,a.c)(7),{tier:o}=e;if(!o||o===J.b.NONE)return null;if(n[0]!==o){let e,r={[J.b.ULTIMATE]:"bg-amber-500/15 text-amber-300 border-amber-400/20",[J.b.ELITE]:"bg-amber-500/15 text-amber-300 border-amber-400/20",[J.b.PRO]:"bg-purple-500/15 text-purple-300 border-purple-400/20",[J.b.PLUS]:"bg-sky-500/15 text-sky-300 border-sky-400/20",[J.b.BASIC]:"bg-emerald-500/15 text-emerald-300 border-emerald-400/20"};n[3]===Symbol.for("react.memo_cache_sentinel")?(e={[J.b.ULTIMATE]:"Ultimate",[J.b.ELITE]:"Elite",[J.b.PRO]:"Pro",[J.b.PLUS]:"Plus",[J.b.BASIC]:"Basic"},n[3]=e):e=n[3],t=e,s=(0,l.cn)("inline-flex items-center px-2 py-0.5 rounded-full border text-studio-micro font-semibold tracking-wide uppercase",r[o]??"bg-white/[0.06] text-studio-tertiary border-white/[0.08]"),n[0]=o,n[1]=t,n[2]=s}else t=n[1],s=n[2];let c=t[o]??o;return n[4]!==s||n[5]!==c?(i=(0,r.jsx)("span",{className:s,children:c}),n[4]=s,n[5]=c,n[6]=i):i=n[6],i}function el(e){let t,s,i,l,n,o,c,d,u,m=(0,a.c)(23),{badgeName:x,badgeColor:h,badgeIcon:p}=e;m[0]!==p||m[1]!==x?(t=p||x?.charAt(0)?.toUpperCase()||"?",m[0]=p,m[1]=x,m[2]=t):t=m[2];let b=t,f=h||"#94a3b8",g=`${f}15`,y=`${f}30`;m[3]!==f||m[4]!==g||m[5]!==y?(s={backgroundColor:g,borderColor:y,color:f},m[3]=f,m[4]=g,m[5]=y,m[6]=s):s=m[6];let j=`${f}25`;return m[7]!==j?(i={backgroundColor:j},m[7]=j,m[8]=i):i=m[8],m[9]===Symbol.for("react.memo_cache_sentinel")?(l={fontSize:"10px",lineHeight:1},m[9]=l):l=m[9],m[10]!==b?(n=b.length<=2?b:b.charAt(0),m[10]=b,m[11]=n):n=m[11],m[12]!==n?(o=(0,r.jsx)("span",{style:l,children:n}),m[12]=n,m[13]=o):o=m[13],m[14]!==i||m[15]!==o?(c=(0,r.jsx)("span",{className:"w-4 h-4 rounded-full flex items-center justify-center shrink-0",style:i,children:o}),m[14]=i,m[15]=o,m[16]=c):c=m[16],m[17]!==x?(d=(0,r.jsx)("span",{className:"truncate max-w-[120px]",children:x}),m[17]=x,m[18]=d):d=m[18],m[19]!==c||m[20]!==d||m[21]!==s?(u=(0,r.jsxs)("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-studio-micro font-medium cursor-default select-none",style:s,children:[c,d]}),m[19]=c,m[20]=d,m[21]=s,m[22]=u):u=m[22],u}function en(e){let t,s,i,l,n=(0,a.c)(10),{count:o,label:c,onClick:d}=e;if(n[0]!==o)t=null==o?"0":ea.format(o),n[0]=o,n[1]=t;else t=n[1];return n[2]!==t?(s=(0,r.jsx)("span",{className:"font-bold text-white tabular-nums text-studio-heading group-hover:text-studio-accent transition-colors",children:t}),n[2]=t,n[3]=s):s=n[3],n[4]!==c?(i=(0,r.jsx)("span",{className:"text-studio-body text-white/60 group-hover:text-white/80 transition-colors",children:c}),n[4]=c,n[5]=i):i=n[5],n[6]!==d||n[7]!==s||n[8]!==i?(l=(0,r.jsxs)("button",{onClick:d,className:"group inline-flex items-baseline gap-1.5 px-3 py-1.5 rounded-lg bg-white/[0.06] hover:bg-white/[0.10] transition-all cursor-pointer",children:[s,i]}),n[6]=d,n[7]=s,n[8]=i,n[9]=l):l=n[9],l}let eo="w-full bg-black/30 border border-white/[0.15] rounded-lg px-3 py-2 text-white outline-none focus:border-sky-400/40 focus:ring-1 focus:ring-sky-400/20 transition-colors backdrop-blur-sm";function ec(e){let t,s,i,n=(0,a.c)(36),{isOwnProfile:o,editMode:c,isSaving:d,isFollowing:u,followCheckDone:m,isLoggedIn:x,followLoading:h,onSave:p,onCancel:b,onEdit:f,onFollowToggle:g,targetUserId:y,targetUsername:j,isBlocked:w,onBlockStateChange:v}=e,N=void 0===y?"":y,P=void 0===j?"":j,E=void 0!==w&&w;if(o){let e,t,s;if(c){let e,t,s,a,i;return n[0]!==d?(e=d?(0,r.jsx)(k.A,{size:14,className:"animate-spin mr-1.5"}):(0,r.jsx)(S.A,{size:14,className:"mr-1.5"}),n[0]=d,n[1]=e):e=n[1],n[2]!==d||n[3]!==p||n[4]!==e?(t=(0,r.jsxs)("button",{onClick:p,disabled:d,className:"inline-flex items-center h-studio-md px-4 rounded-lg text-studio-body font-medium bg-sky-500/25 border border-sky-400/30 text-sky-300 hover:bg-sky-500/35 transition-colors disabled:opacity-50 backdrop-blur-sm",children:[e,"Save"]}),n[2]=d,n[3]=p,n[4]=e,n[5]=t):t=n[5],n[6]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(C.A,{size:14,className:"mr-1.5"}),n[6]=s):s=n[6],n[7]!==d||n[8]!==b?(a=(0,r.jsxs)("button",{onClick:b,disabled:d,className:"inline-flex items-center h-studio-md px-4 roun
2ded-lg text-studio-body font-medium border border-white/[0.15] text-white/70 hover:bg-white/[0.08] transition-colors disabled:opacity-50 backdrop-blur-sm",children:[s,"Cancel"]}),n[7]=d,n[8]=b,n[9]=a):a=n[9],n[10]!==t||n[11]!==a?(i=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t,a]}),n[10]=t,n[11]=a,n[12]=i):i=n[12],i}return n[13]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsxs)(z(),{href:"/dashboard",prefetch:!1,className:"inline-flex items-center h-studio-md px-4 rounded-lg text-studio-body font-medium bg-sky-500/15 text-sky-300 border border-sky-400/20 hover:bg-sky-500/25 transition-colors backdrop-blur-sm",children:[(0,r.jsx)(_.A,{size:14,className:"mr-1.5"}),"My Campaigns"]}),n[13]=e):e=n[13],n[14]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(A.A,{size:14,className:"mr-1.5"}),n[14]=t):t=n[14],n[15]!==f?(s=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[e,(0,r.jsxs)("button",{onClick:f,className:"inline-flex items-center h-studio-md px-4 rounded-lg text-studio-body font-medium border border-white/[0.15] text-white/70 hover:bg-white/[0.08] hover:text-white transition-colors backdrop-blur-sm",children:[t,"Edit Profile"]})]}),n[15]=f,n[16]=s):s=n[16],s}if(!N||!P)return null;n[17]!==m||n[18]!==h||n[19]!==E||n[20]!==u||n[21]!==x||n[22]!==v||n[23]!==g||n[24]!==N||n[25]!==P?(t=E?(0,r.jsx)(M.hY,{targetUserId:N,username:P,isBlocked:!0,onBlockStateChange:v,trigger:(0,r.jsxs)("button",{type:"button",className:"inline-flex h-studio-md items-center rounded-lg border border-sky-400/25 bg-sky-500/15 px-4 text-studio-body font-medium text-sky-300 transition-colors hover:bg-sky-500/25",children:["Unblock @",P]})}):x&&m?(0,r.jsx)("button",{onClick:g,disabled:h,className:(0,l.cn)("inline-flex items-center h-studio-md px-4 rounded-lg text-studio-body font-medium transition-all disabled:opacity-50 backdrop-blur-sm",u?"bg-white/[0.08] border border-white/[0.15] text-white/70 hover:bg-white/[0.12] hover:text-white":"bg-sky-500/25 border border-sky-400/30 text-sky-300 hover:bg-sky-500/35"),children:u?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(T.A,{size:14,className:"mr-1.5"}),"Following"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I.A,{size:14,className:"mr-1.5"}),"Follow"]})}):null,n[17]=m,n[18]=h,n[19]=E,n[20]=u,n[21]=x,n[22]=v,n[23]=g,n[24]=N,n[25]=P,n[26]=t):t=n[26];let L=!E;return n[27]!==E||n[28]!==v||n[29]!==L||n[30]!==N||n[31]!==P?(s=(0,r.jsx)(M.IX,{targetUserId:N,username:P,isBlocked:E,showBlockEntry:L,onBlockStateChange:v}),n[27]=E,n[28]=v,n[29]=L,n[30]=N,n[31]=P,n[32]=s):s=n[32],n[33]!==t||n[34]!==s?(i=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t,s]}),n[33]=t,n[34]=s,n[35]=i):i=n[35],i}let ed=function(){var e;let t,s,n,o,d,u,m,x,b,f,g,y,j,w,v,k,S,C,_,A,{state:T}=(0,c.As)(),{user:I,isOwnProfile:U,editMode:z,setEditMode:M,openSocialModal:K,setActiveTab:V}=N(),{data:Q}=X(I?.userId),{data:J}=$(I?.userId),{follow:H,unfollow:Z}=(e=I?.userId??"",m=(0,a.c)(16),x=(0,B.jE)(),m[0]!==x||m[1]!==e?(t=()=>{x.invalidateQueries({queryKey:p.e.followers(e)}),x.invalidateQueries({queryKey:p.e.followStatus(e)})},m[0]=x,m[1]=e,m[2]=t):t=m[2],b=t,m[3]!==e?(s=()=>(0,h.followUser)(e),m[3]=e,m[4]=s):s=m[4],m[5]!==b||m[6]!==s?(n={mutationFn:s,onSuccess:b},m[5]=b,m[6]=s,m[7]=n):n=m[7],f=(0,q.n)(n),m[8]!==e?(o=()=>(0,h.unfollowUser)(e),m[8]=e,m[9]=o):o=m[9],m[10]!==b||m[11]!==o?(d={mutationFn:o,onSuccess:b},m[10]=b,m[11]=o,m[12]=d):d=m[12],g=(0,q.n)(d),m[13]!==f||m[14]!==g?(u={follow:f,unfollow:g},m[13]=f,m[14]=g,m[15]=u):u=m[15],u),[ee,et]=(0,i.useState)(!1),[es,ea]=(0,i.useState)(!1),ed=(0,Y.Zf)(I?.userId&&!U?[I.userId]:[],!!T.isLoggedIn&&!!I?.userId&&!U),eu=!!I?.userId&&!!ed.data?.has(I.userId);(0,i.useEffect)(()=>{if(!I?.userId||U||!T.isLoggedIn)return void ea(!0);if(!ed.isSuccess){et(!1),ea(!1);return}if(eu){et(!1),ea(!0);return}ea(!1),(0,h.checkFollowingContains)([I.userId]).then(e=>{let{followedIds:t}=e;et(t.includes(I.userId))}).catch(()=>{}).finally(()=>ea(!0))},[I?.userId,U,T.isLoggedIn,ed.isSuccess,eu]);let em=(0,i.useCallback)(()=>{ed.isSuccess&&!eu&&(ee?(et(!1),Z.mutate()):(et(!0),H.mutate()))},[ed.isSuccess,eu,ee,H,Z]),ex=(0,i.useCallback)(e=>{e&&et(!1)},[]),[eh,ep]=(0,i.useState)(I?.username??""),[eb,ef]=(0,i.useState)(I?.bio??""),[eg,ey]=(0,i.useState)(),[ej,ew]=(0,i.useState)(),[ev,eN]=(0,i.useState)(!1),[ek,eS]=(0,i.useState)(!1);(0,i.useEffect)(()=>{I&&!z&&(ep(I.username),ef(I.bio??""))},[I?.username,I?.bio,z]);let{updateProfile:eC,updateSettings:e_}=(k=(0,a.c)(9),S=(0,B.jE)(),k[0]!==S?(y=()=>{S.invalidateQueries({queryKey:p.e.all})},k[0]=S,k[1]=y):y=k[1],C=y,k[2]!==C?(j={mutationFn:W,onSuccess:C},k[2]=C,k[3]=j):j=k[3],_=(0,q.n)(j),k[4]!==C?(w={mutationFn:G,onSuccess:C},k[4]=C,k[5]=w):w=k[5],A=(0,q.n)(w),k[6]!==_||k[7]!==A?(v={updateProfile:_,updateSettings:A,checkUsernameAvailability:h.checkUsernameAvailability},k[6]=_,k[7]=A,k[8]=v):v=k[8],v),eA=(0,i.useCallback)(async()=>
2{if(I){eS(!0);try{let e={bio:eb};eg&&(e.avatarId=eg),await eC.mutateAsync(e),eh!==I.username&&await e_.mutateAsync({username:eh}),M(!1)}catch{}finally{eS(!1)}}},[I,eb,eg,eh,eC,e_,M]),eT=(0,i.useCallback)(()=>{I&&(ep(I.username),ef(I.bio??""),ey(void 0),ew(void 0)),M(!1)},[I,M]),eI=(0,i.useCallback)(async e=>{ey(e);try{let{image:t}=await (0,F.getImage)(e);t?.image&&ew(t.image)}catch{}eN(!1)},[]),eP=(0,i.useCallback)(e=>{window.open(`/images/${e}`,"_blank","noopener,noreferrer")},[]);if(!I)return null;let eE=z?ej??I.avatarUrl:I.avatarUrl,eL=[...Q??[]].sort((e,t)=>(t.goal??0)-(e.goal??0)).slice(0,4),eR=(Q?.length??0)-eL.length,eU=I.stats?.["Images Generated"],ez=J?.[0]?.webpImage??J?.[0]?.image,eM={isOwnProfile:U,editMode:z,isSaving:ek,isFollowing:ee,followCheckDone:es&&ed.isSuccess,isLoggedIn:T.isLoggedIn,followLoading:H.isPending||Z.isPending,onSave:eA,onCancel:eT,onEdit:()=>M(!0),onFollowToggle:em,targetUserId:I.userId,targetUsername:I.username,isBlocked:eu,onBlockStateChange:ex};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"relative overflow-hidden",children:[ez&&(0,r.jsxs)("div",{className:"absolute inset-0 z-0",children:[(0,r.jsx)(R.default,{src:ez,alt:"",fill:!0,className:"object-cover scale-125 blur-2xl saturate-150",sizes:"100vw",unoptimized:!0}),(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-black/55 via-black/45 to-black/20"}),(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-[rgb(var(--studio-surface-2))]/80 via-transparent to-transparent"})]}),!ez&&(0,r.jsx)("div",{className:"absolute inset-0 z-0 bg-gradient-to-br from-studio-surface-1 via-studio-surface-2 to-studio-surface-1"}),(0,r.jsxs)("div",{className:"relative z-10 flex flex-col md:flex-row",children:[(0,r.jsx)("div",{className:"md:hidden",children:(0,r.jsx)(er,{userId:I.userId,onImageClick:eP})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-3 p-5 md:p-6 lg:py-8 lg:pl-8 lg:pr-6 animate-in fade-in duration-500",style:{animationFillMode:"both"},children:[(0,r.jsxs)("div",{className:"flex items-start gap-4",children:[(0,r.jsxs)("div",{className:"relative shrink-0",children:[(0,r.jsx)("div",{className:"rounded-full ring-2 ring-white/15 shadow-lg shadow-black/30",children:(0,r.jsx)(O.B,{size:"xl",avatarUrl:eE,userPremiumLevel:I.subscriptionType,username:I.username})}),z&&(0,r.jsx)("button",{onClick:()=>eN(!0),className:"absolute inset-0 flex items-center justify-center rounded-full bg-black/60 opacity-0 hover:opacity-100 transition-opacity","aria-label":"Change avatar",children:(0,r.jsx)(P.A,{size:24,className:"text-white"})})]}),(0,r.jsxs)("div",{className:"flex-1 min-w-0 pt-0.5",children:[z?(0,r.jsx)("input",{value:eh,onChange:e=>ep(e.target.value),className:(0,l.cn)(eo,"text-xl font-semibold max-w-[280px]"),placeholder:"Username"}):(0,r.jsx)("h1",{className:"text-2xl font-semibold text-white leading-tight truncate drop-shadow-sm",children:I.username}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-1.5",children:[(0,r.jsx)(ei,{tier:I.subscriptionType}),I.streak>0&&(0,r.jsxs)("span",{className:"flex items-center gap-1 text-studio-micro text-white/50",children:[(0,r.jsx)(E.A,{size:14,className:"text-amber-400"}),(0,r.jsx)("span",{className:"text-amber-300 font-medium",children:I.streak}),(0,r.jsx)("span",{children:"day streak"})]})]})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(en,{count:I.followerCount,label:"Followers",onClick:()=>K("followers")}),(0,r.jsx)(en,{count:I.followingCount,label:"Following",onClick:()=>K("following")}),void 0!==eU&&(0,r.jsx)(en,{count:eU,label:"Images",onClick:()=>V("gallery")})]}),z?(0,r.jsx)("textarea",{value:eb,onChange:e=>ef(e.target.value),placeholder:"Write a short bio...",rows:3,className:(0,l.cn)(eo,"resize-none text-studio-body placeholder:text-white/30")}):I.bio&&(0,r.jsx)("p",{className:"text-studio-body text-white/80 leading-relaxed",children:I.bio}),eL.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[eL.map((e,t)=>(0,r.jsx)("div",{className:"animate-in fade-in",style:{animationDelay:`${200+60*t}ms`,animationFillMode:"both"},children:(0,r.jsx)(el,{badgeName:e.badgeName,badgeColor:e.badgeColor,badgeIcon:e.badgeIcon})},e.id)),eR>0&&(0,r.jsxs)("button",{onClick:()=>V("progress"),className:"flex items-center gap-0.5 text-studio-micro text-sky-400 hover:underline transition-colors",children:["+",eR," more",(0,r.jsx)(L.A,{size:12})]})]}),(0,r.jsx)("div",{className:"pt-1",children:(0,r.jsx)(ec,{...eM})})]}),(0,r.jsx)("div",{className:"hidden md:block md:w-[50%] lg:w-[52%] shrink-0 animate-in fade-in slide-in-from-right-4 duration-700",style:{animationDelay:"150ms",animationFillMode:"both"},children:(0,r.jsx)(er,{userId:I.userId,onImageClick:eP,className:"h-full"})})]})]}),(0,r.jsx)(D.default,{open:ev,onClose:()=>eN(!1),onSelect:eI,userGallery:!0})]})};var eu=s(9718),em=s(47938),ex=s(43294),eh=s(1932),ep=s(25932),eb=s(25270),ef=s(81014),eg=s(74372),ey=s(47650),ej=s(23434),ew=s(94557),ev=s(38602),eN=s(16846);let ek="w-full bg-white/[0.04] border border-white/[0.06] rounded-lg px-3 py-2 text-studio-body text-studio-primary placeholder:text-studio-placeholder outline-none focus:border-white/[0.12] focus:bg-white/[0.06] transition-colors",eS=e=>{let{showcase:t,onSuccess:s,onCancel:a}=e,n=!!t,[o,c]=(0,i.useState)({title:t?.title||"",description:t?.description||"",isPublic:t?.public??!0}),[d,u]=(0,i.useState)(!1),[m,x]=(0,i.useState)({}),h=async e=>{let r;
2if(e.preventDefault(),r={},o.title.trim()?o.title.length>100&&(r.title="Title must be less than 100 characters"):r.title="Title is required",o.description.length>500&&(r.description="Description must be less than 500 characters"),x(r),0===Object.keys(r).length){u(!0);try{let e;if(n&&t){let s={title:o.title.trim(),description:o.description.trim(),isPublic:o.isPublic};e=await (0,ew.updateShowcase)(t.id,s)}else{let t={title:o.title.trim(),description:o.description.trim(),isPublic:o.isPublic};e=await (0,ew.createShowcase)(t)}e.error?ej.oR.error(e.error.toString()):e.showcase&&(ej.oR.success(n?"Showcase updated successfully":"Showcase created successfully"),s(e.showcase))}catch{ej.oR.error(n?"Failed to update showcase":"Failed to create showcase")}finally{u(!1)}}};return(0,r.jsxs)("div",{className:"bg-studio-surface-1 border border-white/[0.08] rounded-xl shadow-[0_8px_40px_rgba(0,0,0,0.5)] max-w-sm sm:max-w-lg lg:max-w-2xl mx-auto",children:[(0,r.jsx)("div",{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-3 sm:pb-4",children:(0,r.jsx)("h2",{className:"text-lg sm:text-xl font-semibold text-studio-primary",children:n?"Edit showcase":"Create new showcase"})}),(0,r.jsx)("div",{className:"px-4 sm:px-6 pb-4 sm:pb-6",children:(0,r.jsxs)("form",{onSubmit:h,className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{htmlFor:"title",className:"text-studio-body text-studio-secondary font-medium",children:"Title *"}),(0,r.jsx)("input",{id:"title",value:o.title,onChange:e=>{c(t=>({...t,title:e.target.value})),m.title&&x(e=>({...e,title:""}))},placeholder:"Enter showcase title...",className:ek,maxLength:100,disabled:d}),m.title&&(0,r.jsx)("p",{className:"text-studio-micro text-red-400",children:m.title}),(0,r.jsxs)("p",{className:"text-studio-micro text-studio-disabled",children:[o.title.length,"/100 characters"]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{htmlFor:"description",className:"text-studio-body text-studio-secondary font-medium",children:"Description"}),(0,r.jsx)("textarea",{id:"description",value:o.description,onChange:e=>{c(t=>({...t,description:e.target.value})),m.description&&x(e=>({...e,description:""}))},placeholder:"Describe your showcase...",className:`${ek} min-h-[100px] resize-none`,maxLength:500,disabled:d}),m.description&&(0,r.jsx)("p",{className:"text-studio-micro text-red-400",children:m.description}),(0,r.jsxs)("p",{className:"text-studio-micro text-studio-disabled",children:[o.description.length,"/500 characters"]})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("label",{className:"text-studio-body text-studio-secondary font-medium",children:"Visibility"}),(0,r.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg bg-white/[0.02] border border-white/[0.06]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[o.isPublic?(0,r.jsx)(ev.A,{className:"h-5 w-5 text-sky-400"}):(0,r.jsx)(eN.A,{className:"h-5 w-5 text-studio-tertiary"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-studio-body text-studio-primary font-medium",children:o.isPublic?"Public":"Private"}),(0,r.jsx)("p",{className:"text-studio-micro text-studio-tertiary",children:o.isPublic?"Anyone can view this showcase":"Only you can view this showcase"})]})]}),(0,r.jsx)("button",{type:"button",role:"switch","aria-checked":o.isPublic,onClick:()=>c(e=>({...e,isPublic:!e.isPublic})),disabled:d,className:(0,l.cn)("relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",o.isPublic?"bg-sky-500/60":"bg-white/[0.12]"),children:(0,r.jsx)("span",{className:(0,l.cn)("pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-in-out",o.isPublic?"translate-x-5":"translate-x-0")})})]})]}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 pt-4",children:[(0,r.jsx)("button",{type:"button",onClick:a,disabled:d,className:"flex-1 px-5 py-2.5 rounded-lg text-studio-body font-medium border text-studio-secondary border-white/[0.06] bg-white/[0.02] hover:text-studio-primary hover:bg-white/[0.06] transition-colors disabled:opacity-50",children:"Cancel"}),(0,r.jsx)("button",{type:"submit",disabled:d||!o.title.trim(),className:"flex-1 inline-flex items-center justify-center gap-2 px-5 py-2.5 rounded-lg text-studio-body font-medium bg-sky-500/15 text-sky-300 border border-sky-400/20 hover:bg-sky-500/25 transition-colors disabled:opacity-50",children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.A,{size:14,className:"animate-spin"}),n?"Updating...":"Creating..."]}):n?"Update showcase":"Create showcase"})]})]})})]})};var eC=s(74593),e_=s(45748),eA=s(69386),eT=s(32664),eI=s(99189),eP=s(21594),eE=s(17163),eL=s(61535),eR=s(99074),eU=s(11190),ez=s(99834);let eM=e=>{let{showcase:t,isOwnProfile:s,onClick:a,onEdit:n,onDelete:o,onVisibilityChange:d}=e,{state:u}=(0,c.As)(),[m,x]=(0,i.useState)(!1),[h,p]=(0,i.useState)(t),[b,f]=(0,i.useState)(!1),g=(0,i.useRef)(null);(0,i.useEffect)(()=>{p(t)},[t]),(0,i.useEffect)(()=>
2{if(b)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){g.current&&!g.current.contains(e.target)&&f(!1)}},[b]);let y=async()=>{if(s){x(!0);try{let e=await (0,ew.toggleShowcaseVisibility)(h.id,!h.public);e.error?ej.oR.error(e.error.toString()):e.showcase&&(p(e.showcase),d?.(e.showcase),ej.oR.success(`Showcase is now ${e.showcase.public?"public":"private"}`))}catch{ej.oR.error("Failed to update visibility")}finally{x(!1),f(!1)}}},j=async()=>{if(s){x(!0);try{let e=await (0,ew.deleteShowcase)(h.id);e.error?ej.oR.error(e.error):(ej.oR.success("Showcase deleted"),o?.())}catch{ej.oR.error("Failed to delete showcase")}finally{x(!1),f(!1)}}},w=async()=>{let e=(0,ez.Xe)(`https://char-gen.com/showcases/${h.id}`,{referralCode:u.referralCode,entityType:"showcase",entityId:h.id}),t=(0,ez.Xe)(e,{channel:"copy_link"});if(navigator.share)try{await navigator.share({title:h.title,text:h.description||`Check out "${h.title}" showcase`,url:(0,ez.Xe)(e,{channel:"web_share"})})}catch{v(t)}else v(t);f(!1)},v=async e=>{try{await navigator.clipboard.writeText(e),ej.oR.success("Showcase link copied to clipboard!")}catch{ej.oR.error("Failed to copy link")}},N=h.items.sort((e,t)=>e.sortOrder-t.sortOrder).slice(0,4);return(0,r.jsxs)("div",{className:"bg-studio-surface-2 border border-white/[0.04] rounded-2xl shadow-lg shadow-black/20 hover:shadow-xl hover:shadow-black/30 hover:-translate-y-0.5 hover:border-white/[0.06] transition-all duration-300 overflow-hidden cursor-pointer group",onClick:a,children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"aspect-video bg-studio-surface-0 relative overflow-hidden",children:N.length>0?(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-0.5 h-full",children:[N.map((e,t)=>(0,r.jsx)("div",{className:`relative overflow-hidden ${1===N.length||3===N.length&&0===t?"col-span-2":""}`,children:(0,r.jsx)(R.default,{src:e.image.webpImage||e.image.image,alt:e.caption||e.image.imageMetadata.description,fill:!0,className:"object-cover group-hover:scale-105 transition-transform duration-300",sizes:"(max-width: 768px) 50vw, 25vw"})},e.id)),Array.from({length:Math.max(0,4-N.length)}).map((e,t)=>(0,r.jsx)("div",{className:"bg-studio-surface-1 flex items-center justify-center",children:(0,r.jsx)("div",{className:"w-8 h-8 rounded-full bg-white/[0.06]"})},`placeholder-${t}`))]}):(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-white/[0.06] mx-auto mb-2 flex items-center justify-center",children:(0,r.jsx)(ev.A,{className:"w-6 h-6 text-studio-disabled"})}),(0,r.jsx)("p",{className:"text-studio-body text-studio-disabled",children:"Empty showcase"})]})})}),(0,r.jsxs)("div",{className:"absolute top-2 left-2 flex gap-1.5",children:[(0,r.jsxs)("span",{className:"inline-flex items-center bg-black/60 backdrop-blur-sm text-studio-secondary border border-white/[0.08] px-2.5 py-1 rounded-full text-studio-micro font-medium",children:[h.items.length," ",1===h.items.length?"item":"items"]}),(0,r.jsxs)("span",{className:(0,l.cn)("inline-flex items-center backdrop-blur-sm px-2.5 py-1 rounded-full text-studio-micro font-medium border",h.public?"bg-sky-500/20 text-sky-300 border-sky-400/20":"bg-black/60 text-studio-tertiary border-white/[0.08]"),children:[h.public?(0,r.jsx)(ev.A,{className:"w-3 h-3 mr-1"}):(0,r.jsx)(eN.A,{className:"w-3 h-3 mr-1"}),h.public?"Public":"Private"]})]}),s&&(0,r.jsxs)("div",{ref:g,className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[(0,r.jsx)("button",{className:"h-8 w-8 flex items-center justify-center rounded-full bg-black/50 backdrop-blur-sm border border-white/10 hover:bg-white/10 text-white/70 hover:text-white transition-all",onClick:e=>{e.stopPropagation(),f(!b)},disabled:m,"aria-label":"Showcase options",children:(0,r.jsx)(eP.A,{className:"h-4 w-4"})}),b&&(0,r.jsxs)("div",{className:"absolute top-full right-0 mt-1 z-50 min-w-[190px] py-1.5 bg-studio-surface-1/95 backdrop-blur-2xl border border-white/[0.08] rounded-xl shadow-[0_8px_40px_rgba(0,0,0,0.6),0_0_0_1px_rgba(255,255,255,0.03)] animate-in fade-in slide-in-from-top-2 duration-150",children:[h.public&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{className:"flex items-center gap-2.5 w-full px-3.5 py-2 text-studio-label text-studio-secondary hover:text-white hover:bg-white/[0.06] transition-colors",onClick:e=>{e.stopPropagation(),w()},children:[(0,r.jsx)(eE.A,{size:14})," Share showcase"]}),(0,r.jsx)("div",{className:"my-1 mx-2 h-px bg-white/[0.06]"})]}),(0,r.jsxs)("button",{className:"flex items-center gap-2.5 w-full px-3.5 py-2 text-studio-label text-studio-secondary hover:text-white hover:bg-white/[0.06] transition-colors",onClick:e=>{e.stopPropagation(),n?.(),f(!1)},children:[(0,r.jsx)(eL.A,{size:14})," Edit showcase"]}),(0,r.jsxs)("button",{className:"flex items-center gap-2.5 w-full px-3.5 py-2 text-studio-label text-studio-secondary hover:text-white hover:bg-white/[0.06] transition-colors disabled:opacity-50",onClick:e=>{e.stopPropagation(),y()},disabled:m,children:[h.public?(0,r.jsx)(eR.A,{size:14}):(0,r.jsx)(ef.A,{size:14}),"Make"," ",h.public?"private":"public"]}),(0,r.jsx)("div",{className:"my-1 mx-2 h-px bg-white/[0.06]"}),(0,r.jsxs)("button",{className:"flex items-center gap-2.5 w-full px-3.5 py-2 text-studio-label text-red-400 hover:text-red-300 hover:bg-red-500/[0.08] transition-colors disabled:opacity-50",onClick:e=>{e.stopPropagation(),j()},disabled:m,children:[(0,r.jsx)(eU.A,{size:14})," Delete showcase"]})]})]})]}),(0,r.jsxs)("div",{className:"p-3 sm:p-4 lg:p-5 space-y-3",children:[(0,r.jsx)("h3",{className:"font-semibold text-studio-primary text-base sm:text-lg leading-tight truncate",children:h.title}),h.description&&(0,r.jsx)("p",{className:"text-studio-body text-studio-tertiary line-clamp-2 leading-relaxed",children:h.description}),(0,r.jsx)("div",{className:"flex items-center justify-between pt-1",children:(0,r.jsx)("span",{className:"text-studio-micro text-studio-disabled font-medium",children:new Date(h.updatedAt).toLocaleDateString(void 0,{month:"short",day:"numeric",year:new Date(h.updatedAt).getFullYear()!==new Date().getFullYear()?"numeric":void 0})})})]})]})},eD=e=>{let t,s,n,o,c,d,u,m,x,h=(0,a.c)(57),{showcases:p,isOwnProfile:b,isLoading:f,onCreateNew:g,onShowcaseClick:y,onEditShowcase:j,onDeleteShowcase:w,onShowcaseUpdate:v,onShowcasesReorder:N}=e,[k,S]=(0,i.useState)(!1),[C,_]=(0,i.useState)(null);h[0]!==p?(t=[...p].sort(eO),h[0]=p,h[1]=t):t=h[1];let A=t;h[2]!==N||h[3]!==A?(s=async(e,t)=>{let s=A.findIndex(t=>t.id===e);if(-1===s)return;let r="up"===t?Math.max(0,s-1):Math.min(A.length-1,s+1);if(s===r)return;let a=[...A],[i]=a.splice(s,1);a.splice(r,0,i),N?.(a)},h[2]=N,h[3]=A,h[4]=s):s=h[4];let T=s;h[5]===Symbol.for("react.memo_cache_sentinel")?(n=(e,t)=>{_(t),e.dataTransfer.effectAllowed="move"},h[5]=n):n=h[5];let I=n;h[6]!==C||h[7]!==N||h[8]!==A?(o=async(e,t)=>{if(e.preventDefault(),!C||C.id===t.id)return void _(null);let s=A.findIndex(e=>e.id===C.id),r=A.findIndex(e=>e.id===t.id),a=[...A],[i]=a.splice(s,1);a.splice(r,0,i),N?.(a),_(null)},h[6]=C,h[7]=N,h[8]=A,h[9]=o):o=h[9];let P=o;if(void 0!==f&&f){let e;return h[10]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6 lg:gap-8",children:Array.from({length:6}).map(e$)}),h[10]=e):e=h[10],e}if(0===p.length){let e,t,s,a,i;h[11]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"w-16 h-16 bg-white/[0.04] rounded-full mx-auto mb-4 flex items-center justify-center",children:(0,r.jsx)(eC.A,{className:"w-8 h-8 text-studio-disabled"})}),h[11]=e):e=h[11];let l=b?"No showcases yet":"No public showcases";
2h[12]!==l?(t=(0,r.jsx)("h3",{className:"text-lg sm:text-xl font-semibold text-studio-primary mb-2",children:l}),h[12]=l,h[13]=t):t=h[13];let n=b?"Create your first showcase to organize and display your favorite images.":"This user hasn't created any public showcases yet.";return h[14]!==n?(s=(0,r.jsx)("p",{className:"text-studio-body text-studio-tertiary mb-6 leading-relaxed px-2",children:n}),h[14]=n,h[15]=s):s=h[15],h[16]!==b||h[17]!==g?(a=b&&(0,r.jsxs)("button",{onClick:g,className:"inline-flex items-center gap-2 px-6 py-2.5 rounded-lg text-studio-body font-medium bg-sky-500/15 text-sky-300 border border-sky-400/20 hover:bg-sky-500/25 transition-colors",children:[(0,r.jsx)(eC.A,{className:"w-4 h-4"}),"Create showcase"]}),h[16]=b,h[17]=g,h[18]=a):a=h[18],h[19]!==s||h[20]!==a||h[21]!==t?(i=(0,r.jsx)("div",{className:"text-center py-8 sm:py-12 lg:py-16",children:(0,r.jsxs)("div",{className:"max-w-sm sm:max-w-md mx-auto",children:[e,t,s,a]})}),h[19]=s,h[20]=a,h[21]=t,h[22]=i):i=h[22],i}if(h[23]!==b||h[24]!==k||h[25]!==g||h[26]!==A.length?(c=b&&(0,r.jsx)("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-center sm:justify-between",children:(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-3",children:[(0,r.jsxs)("button",{onClick:g,className:"inline-flex items-center gap-2 px-6 py-2.5 rounded-lg text-studio-body font-medium bg-sky-500/15 text-sky-300 border border-sky-400/20 hover:bg-sky-500/25 transition-colors",children:[(0,r.jsx)(eC.A,{className:"w-4 h-4"}),"Create showcase"]}),A.length>1&&(0,r.jsx)("button",{onClick:()=>S(!k),className:(0,l.cn)("inline-flex items-center gap-2 px-6 py-2.5 rounded-lg text-studio-body font-medium border transition-colors",k?"bg-sky-500/15 text-sky-300 border-sky-400/20":"text-studio-secondary border-white/[0.06] bg-white/[0.02] hover:text-studio-primary hover:bg-white/[0.04]"),children:k?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e_.A,{className:"w-4 h-4"}),(0,r.jsxs)("span",{className:"hidden sm:inline",children:["Exit"," "]}),"Reorder"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eA.A,{className:"w-4 h-4"}),(0,r.jsxs)("span",{className:"hidden sm:inline",children:["Reorder"," "]}),"Showcases"]})})]})}),h[23]=b,h[24]=k,h[25]=g,h[26]=A.length,h[27]=c):c=h[27],h[28]!==b||h[29]!==k?(d=k&&b&&(0,r.jsxs)("div",{className:"bg-sky-500/[0.06] border border-sky-400/15 rounded-lg p-3 sm:p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sky-400",children:[(0,r.jsx)(eA.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{className:"font-medium text-studio-body",children:"Showcase Reorder Mode Active"})]}),(0,r.jsxs)("p",{className:"text-studio-micro text-sky-300/80 mt-1",children:["Use the up/down arrows on each showcase to change the order.",(0,r.jsxs)("span",{className:"hidden sm:inline",children:[" ","You can also drag & drop on desktop."]})]})]}),h[28]=b,h[29]=k,h[30]=d):d=h[30],h[31]!==P||h[32]!==T||h[33]!==b||h[34]!==k||h[35]!==w||h[36]!==j||h[37]!==y||h[38]!==v||h[39]!==A){let e;h[41]!==P||h[42]!==T||h[43]!==b||h[44]!==k||h[45]!==w||h[46]!==j||h[47]!==y||h[48]!==v||h[49]!==A.length?(e=(e,t)=>(0,r.jsxs)("div",{className:"relative animate-in fade-in duration-300",style:{animationDelay:`${60*t}ms`,animationFillMode:"both"},draggable:b&&!k,onDragStart:t=>I(t,e),onDragOver:eF,onDrop:t=>P(t,e),children:[k&&b&&(0,r.jsx)("div",{className:"absolute inset-0 bg-studio-surface-0/70 backdrop-blur-sm flex items-center justify-center z-10 rounded-2xl",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsxs)("button",{onClick:()=>T(e.id,"up"),disabled:0===t,className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-lg text-studio-body font-medium border bg-studio-surface-2 border-white/[0.08] text-studio-secondary hover:bg-white/[0.06] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,r.jsx)(eT.A,{className:"w-4 h-4"}),"Move Up"]}),(0,r.jsxs)("button",{onClick:()=>T(e.id,"down"),disabled:t===A.length-1,className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-lg text-studio-body font-medium border bg-studio-surface-2 border-white/[0.08] text-studio-secondary hover:bg-white/[0.06] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,r.jsx)(eI.A,{className:"w-4 h-4"}),"Move Down"]})]})}),(0,r.jsx)(eM,{showcase:e,isOwnProfile:b,onClick:()=>!k&&y?.(e),onEdit:()=>!k&&j?.(e),onDelete:()=>!k&&w?.(e.id),onVisibilityChange:v})]},e.id),h[41]=P,h[42]=T,h[43]=b,h[44]=k,h[45]=w,h[46]=j,h[47]=y,h[48]=v,h[49]=A.length,h[50]=e):e
2=h[50],u=A.map(e),h[31]=P,h[32]=T,h[33]=b,h[34]=k,h[35]=w,h[36]=j,h[37]=y,h[38]=v,h[39]=A,h[40]=u}else u=h[40];return h[51]!==u?(m=(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6 lg:gap-8",children:u}),h[51]=u,h[52]=m):m=h[52],h[53]!==c||h[54]!==d||h[55]!==m?(x=(0,r.jsxs)("div",{className:"space-y-6 sm:space-y-8",children:[c,d,m]}),h[53]=c,h[54]=d,h[55]=m,h[56]=x):x=h[56],x};function eO(e,t){return"number"==typeof e.sortOrder&&"number"==typeof t.sortOrder?e.sortOrder-t.sortOrder:"number"==typeof e.sortOrder&&"number"!=typeof t.sortOrder?-1:"number"!=typeof e.sortOrder&&"number"==typeof t.sortOrder?1:new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}function eF(e){e.preventDefault(),e.dataTransfer.dropEffect="move"}function e$(e,t){return(0,r.jsxs)("div",{className:"bg-studio-surface-2 border border-white/[0.04] rounded-2xl animate-pulse overflow-hidden",children:[(0,r.jsx)("div",{className:"aspect-video bg-white/[0.06]"}),(0,r.jsxs)("div",{className:"p-4 space-y-3",children:[(0,r.jsx)("div",{className:"h-5 bg-white/[0.06] rounded-md w-3/4"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"h-3 bg-white/[0.04] rounded w-full"}),(0,r.jsx)("div",{className:"h-3 bg-white/[0.04] rounded w-2/3"})]}),(0,r.jsx)("div",{className:"h-3 bg-white/[0.04] rounded w-1/3"})]})]},t)}var eB=s(65322);function eq(e){let t,s,l,n,o,c,d,u=(0,a.c)(16),{open:m,showcase:x,onSuccess:h,onCancel:p}=e,b=(0,i.useRef)(null);return(u[0]!==p||u[1]!==m?(t=()=>{if(!m)return;let e=e=>{"Escape"===e.key&&p()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},s=[m,p],u[0]=p,u[1]=m,u[2]=t,u[3]=s):(t=u[2],s=u[3]),(0,i.useEffect)(t,s),u[4]!==m?(l=()=>{if(!m)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},n=[m],u[4]=m,u[5]=l,u[6]=n):(l=u[5],n=u[6]),(0,i.useEffect)(l,n),m)?(u[7]!==p?(o=(0,r.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm animate-in fade-in duration-200",onClick:p}),u[7]=p,u[8]=o):o=u[8],u[9]!==p||u[10]!==h||u[11]!==x?(c=(0,r.jsx)("div",{ref:b,className:"relative z-10 w-full max-w-2xl mx-4 animate-in fade-in zoom-in-95 duration-200",children:(0,r.jsx)(eS,{showcase:x,onSuccess:h,onCancel:p})}),u[9]=p,u[10]=h,u[11]=x,u[12]=c):c=u[12],u[13]!==o||u[14]!==c?(d=(0,ey.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[o,c]}),document.body),u[13]=o,u[14]=c,u[15]=d):d=u[15],d):null}let eG=e=>{let{username:t,isOwnProfile:s}=e,{activeShowcaseId:a,setActiveShowcase:l}=N(),[n,o]=(0,i.useState)([]),[c,d]=(0,i.useState)(void 0),[u,m]=(0,i.useState)(!0),x=n.find(e=>e.id===a)??null,h=a?"detail":"grid",[p,b]=(0,i.useState)(null),[f,g]=(0,i.useState)(!1),y=(0,i.useCallback)(async()=>{m(!0),b(null);try{let e;if(s)e=await (0,ew.getUserShowcases)();else{if(!t){b("Username not available"),m(!1);return}e=await (0,ew.getUserShowcasesByUsername)(t)}e.error?b(e.error.toString()):o(e.showcases)}catch{b("Failed to load showcases")}finally{m(!1)}},[s,t]);(0,i.useEffect)(()=>{y()},[y]);let j=e=>{d(e),g(!0)},w=async e=>{try{let t=await (0,ew.deleteShowcase)(e);t.error?ej.oR.error(t.error):(o(t=>t.filter(t=>t.id!==e)),a===e&&l(null),ej.oR.success("Showcase deleted"))}catch{ej.oR.error("Failed to delete showcase")}},v=e=>{o(t=>t.map(t=>t.id===e.id?e:t))},k=async e=>{try{let t={showcaseIds:e.map(e=>e.id)},s=await (0,ew.reorderShowcases)(t);s.error?ej.oR.error(s.error.toString()):(o(s.showcases),ej.oR.success("Showcases reordered successfully"))}catch{ej.oR.error("Failed to reorder showcases")}};return p?(0,r.jsx)("div",{className:"text-center py-8 sm:py-12",children:(0,r.jsxs)("div",{className:"max-w-md mx-auto",children:[(0,r.jsx)("div",{className:"w-16 h-16 bg-red-500/10 rounded-full mx-auto mb-4 flex items-center justify-center",children:(0,r.jsx)(ef.A,{className:"w-8 h-8 text-red-400"})}),(0,r.jsx)("h3",{className:"text-lg sm:text-xl font-semibold text-studio-primary mb-2",children:"Unable to load showcases"}),(0,r.jsx)("p",{className:"text-studio-body text-studio-tertiary mb-6 leading-relaxed",children:p}),(0,r.jsx)("button",{onClick:y,className:"px-6 py-2.5 rounded-lg text-studio-body font-medium border text-studio-secondary border-white/[0.06] hover:text-studio-primary hover:bg-white/[0.06] transition-colors",children:"Try again"})]})}):(0,r.jsxs)("div",{className:"space-y-6 sm:space-y-8",children:[(0,r.jsx)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 sm:gap-0",children:"detail"===h&&x?(0,r.jsxs)("button",{onClick:()=>l(null),className:"inline-flex items-center gap-2 px-3 py-2 rounded-lg text-studio-body font-medium text-studio-tertiary hover:text-studio-primary hover:bg-white/[0.04] transition-colors",children:[(0,r.jsx)(eg.A,{className:"w-4 h-4"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Back to showcases"}),(0,r.jsx)("span",{className:"sm:hidden",children:"Back"})]}):(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[(0,r.jsx)("h2",{className:"text-xl sm:text-2xl lg:text-3xl font-bold text-studio-primary tracking-tight",children:s?"My Showcases":`${t}'s Showcases`}),n.length>0&&(0,r.jsxs)("span",{className:"inline-flex items-center bg-white/[0.04] text-studio-tertiary border border-white/[0.06] px-3 py-1 rounded-full text-studio-body font-medium w-fit",children:[n.length," ",1===n.length?"showcase":"showcases"]})]})}),"detail"===h&&x?(0,r.jsx)(eB.k,{showcase:x,isOwnProfile:s,onEdit:()=>j(x),onShowcaseUpdate:v}):(0,r.jsx)(eD,{showcases:n,isOwnProfile:s,isLoading:u,onCreateNew:()=>{d(void 0),g(!0)},onShowcaseClick:e=>l(e.id),onEditShowcase:j,onDeleteShowcase:w,onShowcaseUpdate:v,onShowcasesReorder:k}),(0,r.jsx)(eq,{open:f,showcase:c,onSuccess:e=>{g(!1),d(void 0),o(t=>t.some(t=>t.id===e.id)?t.map(t=>
2t.id===e.id?e:t):[e,...t])},onCancel:()=>g(!1)})]})};var eW=s(5476),eK=s(32177),eV=s(35834),eQ=s(74105),eX=s(34583),eY=s(95214),eJ=s(76017),eH=s(28068),eZ=s(65611),e0=s(30855),e1=s(25780),e2=s(60152),e4=s(95771),e3=s(73946),e5=s(44882),e6=s(7710),e8=s(46011),e7=s(55711),e9=s(10487),te=s(21853);let tt={Award:eV.A,BadgeCheck:eQ.A,Brush:eX.A,CalendarCheck:eY.A,Coins:eJ.A,Crown:eH.A,Flame:E.A,Heart:H.A,Image:em.A,Layers:eZ.A,MessageCircle:e0.A,MessageSquare:e1.A,Palette:e2.A,Send:e4.A,Share2:eE.A,Sliders:e3.A,Sparkles:e5.A,Star:eK.A,ThumbsUp:e6.A,TrendingUp:ex.A,Trophy:e8.A,UserCheck:e7.A,UserPlus:I.A,Users:e9.A,Wand2:te.A};function ts(e){return e.completed?"completed":e.currentProgress>0?"in-progress":"locked"}let tr=["legendary","epic","rare","common"],ta={legendary:"bg-amber-400",epic:"bg-purple-400",rare:"bg-sky-400",common:"bg-white/30"};function ti(e){let t,s,i=(0,a.c)(6),{label:n,active:o,onClick:c}=e,d=o?"bg-sky-500/15 text-sky-300 border-sky-400/20":"text-studio-tertiary hover:text-studio-primary hover:bg-white/[0.04] border-transparent";return i[0]!==d?(t=(0,l.cn)("px-3 py-1 rounded-full text-studio-body font-medium border transition-colors",d),i[0]=d,i[1]=t):t=i[1],i[2]!==n||i[3]!==c||i[4]!==t?(s=(0,r.jsx)("button",{onClick:c,className:t,children:n}),i[2]=n,i[3]=c,i[4]=t,i[5]=s):s=i[5],s}function tl(e){let t,s,i,n,o=(0,a.c)(9),{tier:c}=e,d=u[c];return o[0]!==d.accentClass?(t=(0,r.jsx)(eK.A,{size:12,className:d.accentClass}),s=(0,l.cn)("text-studio-body font-medium uppercase tracking-wider",d.accentClass),o[0]=d.accentClass,o[1]=t,o[2]=s):(t=o[1],s=o[2]),o[3]!==d.label||o[4]!==s?(i=(0,r.jsx)("span",{className:s,children:d.label}),o[3]=d.label,o[4]=s,o[5]=i):i=o[5],o[6]!==t||o[7]!==i?(n=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[t,i]}),o[6]=t,o[7]=i,o[8]=n):n=o[8],n}function tn(e){let t,s=(0,a.c)(3),{status:i}=e;if("completed"===i){let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(S.A,{size:16,className:"text-emerald-400 shrink-0"}),s[0]=e):e=s[0],e}if("in-progress"===i){let e;return s[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-sky-400 animate-pulse shrink-0 inline-block"}),s[1]=e):e=s[1],e}return s[2]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(eN.A,{size:16,className:"text-studio-disabled shrink-0"}),s[2]=t):t=s[2],t}function to(e){let t,s,i,n=(0,a.c)(8),{current:o,goal:c,tier:d,status:u}=e,m=c>0?Math.min(o/c*100,100):0,x="bg-transparent";"completed"===u?x=ta[d]:"in-progress"===u&&(x="bg-sky-400");let h="in-progress"===u&&"animate-pulse";n[0]!==x||n[1]!==h?(t=(0,l.cn)("h-full rounded-full transition-all duration-300",x,h),n[0]=x,n[1]=h,n[2]=t):t=n[2];let p=`${m}%`;return n[3]!==p?(s={width:p},n[3]=p,n[4]=s):s=n[4],n[5]!==t||n[6]!==s?(i=(0,r.jsx)("div",{className:"w-28 sm:w-36 h-1.5 rounded-full bg-white/[0.04] shrink-0 overflow-hidden",children:(0,r.jsx)("div",{className:t,style:s})}),n[5]=t,n[6]=s,n[7]=i):i=n[7],i}function tc(e){let t,s,i,n,o,c,d,m,x,h,p,b,f=(0,a.c)(37),{task:g,tier:y,index:j}=e;f[0]!==g?(t=ts(g),f[0]=g,f[1]=t):t=f[1];let w=t,v=tt[g.iconName]??eV.A,N=u[y],k="locked"===w,S=`${30*j}ms`;f[2]!==S?(s={animationDelay:S,animationFillMode:"both"},f[2]=S,f[3]=s):s=f[3],f[4]!==w?(i=(0,r.jsx)(tn,{status:w}),f[4]=w,f[5]=i):i=f[5];let C=k&&"opacity-40";f[6]!==N.iconClass||f[7]!==C?(n=(0,l.cn)(N.iconClass,C,"shrink-0"),f[6]=N.iconClass,f[7]=C,f[8]=n):n=f[8],f[9]!==v||f[10]!==n?(o=(0,r.jsx)(v,{size:16,className:n}),f[9]=v,f[10]=n,f[11]=o):o=f[11];let _=k?"text-studio-disabled":"text-studio-primary";f[12]!==_?(c=(0,l.cn)("text-studio-body block truncate",_),f[12]=_,f[13]=c):c=f[13];let A=g.badgeName||g.title;return f[14]!==A||f[15]!==c?(d=(0,r.jsx)("span",{className:c,children:A}),f[14]=A,f[15]=c,f[16]=d):d=f[16],f[17]!==g.description?(m=g.description&&(0,r.jsx)("span",{className:"text-studio-micro text-studio-tertiary block truncate mt-0.5",children:g.description}),f[17]=g.description,f[18]=m):m=f[18],f[19]!==d||f[20]!==m?(x=(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[d,m]}),f[19]=d,f[20]=m,f[21]=x):x=f[21],f[22]!==w||f[23]!==g.currentProgress||f[24]!==g.goal||f[25]!==y?(h=(0,r.jsx)(to,{current:g.currentProgress,goal:g.goal,tier:y,status:w}),f[22]=w,f[23]=g.currentProgress,f[24]=g.goal,f[25]=y,f[26]=h):h=f[26],f[27]!==g.currentProgress||f[28]!==g.goal?(p=(0,r.jsxs)("span",{className:"text-studio-micro text-studio-tertiary tabular-nums shrink-0 w-12 text-right",children:[g.currentProgress,"/",g.goal]}),f[27]=g.currentProgress,f[28]=g.goal,f[29]=p):p=f[29],f[30]!==x||f[31]!==h||f[32]!==p||f[33]!==s||f[34]!==i||f[35]!==o?(b=(0,r.jsxs)("div",{className:"flex items-center gap-3 py-2.5 animate-in fade-in slide-in-from-left-1",style:s,children:[i,o,x,h,p]}),f[30]=x,f[31]=h,f[32]=p,f[33]=s,f[34]=i,f[35]=o,f[36]=b):b=f[36],b}function td(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"space-y-1",children:Array.from({length:8}).map(tu)}),t[0]=e):e=t[0],e}function tu(e,t){return(0,r.jsxs)("div",{className:"flex items-center gap-3 py-2.5 animate-pulse",children:[(0,r.jsx)("div",{className:"w-4 h-4 rounded-full bg-white/[0.06] shrink-0"}),(0,r.jsx)("div",{className:"w-4 h-4 rounded bg-white/[0.06] shrink-0"}),(0,r.jsx)("div",{className:"flex-1 h-3 rounded bg-white/[0.06]"}),(0,r.jsx)("div",{className:"w-20 h-1.5 rounded-full bg-white/[0.06] shrink-0"}),(0,r.jsx)("div",{className:"w-12 h-3 rounded bg-white/[0.06] shrink-0"})]},t)}function tm(){let e,t,s,l,n,o=(0,a.c)(37),{user:c,isOwnProfile:d}=N(),[u,m]=(0,i.useState)("all"),x=V(d),h=X(d?void 0:c?.userId??void 0),p=d?x.isLoading:h.isLoading;e:{let t,s;if(d){let t,s;o[0]!==x.data?.tasks?(t=x.data?.tasks??[],o[0]=x.data?.tasks,o[1]=t):t=o[1],o[2]!==t?(s=t.filter(ty),o[2]=t,o[3]=s):s=o[3],e=s;break e}o[4]!==h.data?(t=h.data??[],o[4]=h.data,o[5]=t):t=o[5],o[6]!==t?(s=t.filter(tg),o[6]=t,o[7]=s):s=o[7],e=s}let b=e;t:{if("completed"===u){let e;o[8]!==b?(e=b.filter(tf),o[8]=b,o[9]=e):e=o[9],t=e;break t}if("in-progress"===u){let e;o[10]!==b?(e=b.filter(tb),o[10]=b,o[11]=e):e=o[11],t=e;break t}t=b}let f=t;if(o[12]!==f){for(let e of(s={},f)){var g;let t=(g=e.goal)>=500?"legendary":g>=100?"epic":g>=20?"rare":"common";s[t]||(s[t]=[]),s[t].push(e)}for(let e of tr)s[e]&&s[e].sort(th);o[12]=f,o[13]=s}else s=o[13];let y=s;
2if(o[14]!==u||o[15]!==y||o[16]!==p){n=Symbol.for("react.early_return_sentinel");s:{let e,t,s,a,i,c,d,x,h;o[19]!==y?(e=e=>(y[e]?.length??0)>0,o[19]=y,o[20]=e):e=o[20];let b=tr.filter(e);if(p){let e;o[21]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(td,{}),o[21]=e):e=o[21],n=e;break s}let f="all"===u;o[22]===Symbol.for("react.memo_cache_sentinel")?(t=()=>m("all"),o[22]=t):t=o[22],o[23]!==f?(s=(0,r.jsx)(ti,{label:"All",active:f,onClick:t}),o[23]=f,o[24]=s):s=o[24];let g="completed"===u;o[25]===Symbol.for("react.memo_cache_sentinel")?(a=()=>m("completed"),o[25]=a):a=o[25],o[26]!==g?(i=(0,r.jsx)(ti,{label:"Completed",active:g,onClick:a}),o[26]=g,o[27]=i):i=o[27];let j="in-progress"===u;o[28]===Symbol.for("react.memo_cache_sentinel")?(c=()=>m("in-progress"),o[28]=c):c=o[28],o[29]!==j?(d=(0,r.jsx)(ti,{label:"In Progress",active:j,onClick:c}),o[29]=j,o[30]=d):d=o[30],o[31]!==i||o[32]!==d||o[33]!==s?(x=(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-5",children:[s,i,d]}),o[31]=i,o[32]=d,o[33]=s,o[34]=x):x=o[34],o[35]!==y?(h=e=>{let t=y[e],s=t.filter(tx).length;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2 mt-5 first:mt-0",children:[(0,r.jsx)(tl,{tier:e}),(0,r.jsxs)("span",{className:"text-studio-micro text-studio-tertiary tabular-nums",children:[s,"/",t.length]})]}),(0,r.jsx)("div",{className:"rounded-xl bg-white/[0.02] p-3 divide-y divide-white/[0.03]",children:t.map((t,s)=>(0,r.jsx)(tc,{task:t,tier:e,index:s},t.id))})]},e)},o[35]=y,o[36]=h):h=o[36],l=(0,r.jsxs)("div",{children:[x,0===b.length&&(0,r.jsx)("p",{className:"text-studio-body text-studio-tertiary text-center py-8",children:"No achievements yet"}),b.map(h)]})}o[14]=u,o[15]=y,o[16]=p,o[17]=l,o[18]=n}else l=o[17],n=o[18];return n!==Symbol.for("react.early_return_sentinel")?n:l}function tx(e){return e.completed}function th(e,t){let s=ts(e),r=ts(t),a=tp,i=a(s),l=a(r);if(i!==l)return i-l;if("completed"===s)return t.goal-e.goal;if("in-progress"===s){let s=e.goal>0?e.currentProgress/e.goal:0;return(t.goal>0?t.currentProgress/t.goal:0)-s}return e.goal-t.goal}function tp(e){return"completed"===e?0:"in-progress"===e?1:2}function tb(e){return!e.completed&&e.currentProgress>0}function tf(e){return e.completed}function tg(e){return"REGULAR"===e.taskType}function ty(e){return"REGULAR"===e.taskType}function tj(e){let t,s,n,o,c,d=(0,a.c)(15),{taskId:u,reward:m,onClaimed:x}=e,[h,p]=(0,i.useState)(!1);d[0]!==x||d[1]!==u?(t=async()=>{p(!0),(await (0,K.VI)(u)).success&&x(u),p(!1)},d[0]=x,d[1]=u,d[2]=t):t=d[2];let b=t,f=h&&"opacity-60 pointer-events-none";d[3]!==f?(s=(0,l.cn)("shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-lg","text-studio-label font-semibold transition-all duration-200","bg-amber-500/20 border border-amber-400/30 text-amber-300","hover:bg-amber-500/30 hover:border-amber-400/40 hover:text-amber-200","active:scale-95",f),d[3]=f,d[4]=s):s=d[4],d[5]!==h?(n=h?(0,r.jsx)(k.A,{size:13,className:"animate-spin"}):(0,r.jsx)(eJ.A,{size:13}),d[5]=h,d[6]=n):n=d[6];let g=h?"Claiming...":`Claim ${m}G`;return d[7]!==g?(o=(0,r.jsx)("span",{children:g}),d[7]=g,d[8]=o):o=d[8],d[9]!==b||d[10]!==h||d[11]!==s||d[12]!==n||d[13]!==o?(c=(0,r.jsxs)("button",{onClick:b,disabled:h,className:s,children:[n,o]}),d[9]=b,d[10]=h,d[11]=s,d[12]=n,d[13]=o,d[14]=c):c=d[14],c}function tw(e){let t,s,i,l,n,o,c,d=(0,a.c)(20),{task:u,index:m,onClaimed:x}=e,h=tt[u.iconName]??eV.A,p=`${60*m}ms`;d[0]!==p?(t={animationDelay:p,animationFillMode:"both"},d[0]=p,d[1]=t):t=d[1],d[2]!==h?(s=(0,r.jsx)("div",{className:"shrink-0 w-9 h-9 rounded-lg bg-amber-500/10 border border-amber-400/15 flex items-center justify-center",children:(0,r.jsx)(h,{size:16,className:"text-amber-400"})}),d[2]=h,d[3]=s):s=d[3];let b=u.badgeName||u.title;d[4]!==b?(i=(0,r.jsx)("p",{className:"text-studio-body font-medium text-studio-primary truncate",children:b}),d[4]=b,d[5]=i):i=d[5];let f=u.description||u.title;return d[6]!==f?(l=(0,r.jsx)("p",{className:"text-studio-micro text-studio-tertiary truncate",children:f}),d[6]=f,d[7]=l):l=d[7],d[8]!==i||d[9]!==l?(n=(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[i,l]}),d[8]=i,d[9]=l,d[10]=n):n=d[10],d[11]!==x||d[12]!==u.id||d[13]!==u.reward?(o=(0,r.jsx)(tj,{taskId:u.id,reward:u.reward,onClaimed:x}),d[11]=x,d[12]=u.id,d[13]=u.reward,d[14]=o):o=d[14],d[15]!==t||d[16]!==s||d[17]!==n||d[18]!==o?(c=(0,r.jsxs)("div",{className:"flex items-center gap-3 px-3 py-3 animate-in fade-in slide-in-from-bottom-1",style:t,children:[s,n,o]}),d[15]=t,d[16]=s,d[17]=n,d[18]=o,d[19]=c):c=d[19],c}function tv(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4 animate-in fade-in zoom-in-95 duration-300",children:[(0,r.jsx)(S.A,{size:16,className:"text-emerald-400"}),(0,r.jsx)("span",{className:"text-studio-body font-medium text-emerald-400",children:"All rewards claimed!"})]}),t[0]=e):e=t[0],e}function tN(){let e,t,s,n,o,c,d,u,m,x,h,b=(0,a.c)(23),{isOwnProfile:f}=N(),g=V(f),y=(0,B.jE)();b[0]===Symbol.for("react.memo_cache_sentinel")?(e=new Set,b[0]=e):e=b[0];let[j,w]=(0,i.useState)(e),[v,k]=(0,i.useState)(!1),S=(0,i.useRef)(null);b[1]!==j||b[2]!==g.data?.dailyTasks||b[3]!==g.data?.tasks?(t=[...g.data?.tasks??[],...g.data?.dailyTasks??[]].filter(e=>!e.completed&&e.currentProgress>=e.goal&&!j.has(e.id)),b[1]=j,b[2]=g.data?.dailyTasks,b[3]=g.data?.tasks,b[4]=t):t=b[4];let C=t;b[5]!==C.length||b[6]!==y?(s=e=>{w(t=>{let s=new Set(t);return s.add(e),s}),y.invalidateQueries({queryKey:p.e.allTasks()}),1===C.length&&(k(!0),S.current=setTimeout(()=>k(!1),3e3))},b[5]=C.length,b[6]=y,b[7]=s):s=b[7];let _=s;return(b[8]===Symbol.for("react.memo_cache_sentinel")?(n=()=>()=>{S.current&&clearTimeout(S.current)},o=[],b[8]=n,b[9]=o):(n=b[8],o=b[9]),(0,i.useEffect)(n,o),f&&(0!==C.length||v))?(b[10]===Symbol.for("react.memo_cache_sentinel")?(c=(0,l.cn)("rounded-xl border overflow-hidden","bg-amber-500/[0.04] border-amber-400/15"),b[10]=c):c=b[10],b[11]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(eJ.A,{size:16,className:"text-amber-400"}),(0,r.jsx)("span",{className:"text-studio-body font-semibold text-amber-300",children:"Claim Your Rewards"})]}),b[11]=d):d=b[11],b[12]!==C.length?(u=C.length>0&&(0,r.jsxs)("span",{className:"text-studio-micro text-amber-400/70 tabular-nums",children:[C.length," ready"]}),b[12]=C.length,b[13]=u):u=b[13],b[14]!==u?(m=(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-amber-400/10",children:[d,u]}),b[14]=u,b[15]=m):m=b[15],b[16]!==C||b[17]!==_||b[18]!==v?(x=C.length>0?(0,r.jsx)("div",{className:"divide-y divide-amber-400/[0.06]",children:C.map((e,t)=>(0,r.jsx)(tw,{task:e,index:t,onClaimed:_},e.id))}):v&&(0,r.jsx)(tv,{}),b[16]=C,b[17]=_,b[18]=v,b[19]=x):x=b[19],b[20]!==m||b[21]!==x?(h=(0,r.jsxs)("div",{className:c,children:[m,x]}),b[20]=m,b[21]=x,b[22]=h):h=b[22],h):null}function tk(){let e,t,s,i,n,o,c,d,u,m,x,h,p,b,f,g,y,j,w,v,k=(0,a.c)(49),{creatorLevel:S}=N(),{level:C,title:_,totalXP:A,currentXP:T,nextLevelXP:I,progress:P}=S,E=P>.8,L=E&&"shadow-[0_0_16px_rgba(56,189,248,0.2)] animate-pulse";k[0]!==L?(e=(0,l.cn)("shrink-0 flex items-center justify-center w-14 h-14 roun
2ded-full bg-sky-500/15 border border-sky-400/20 transition-shadow",L),k[0]=L,k[1]=e):e=k[1],k[2]!==C?(t=(0,r.jsx)("span",{className:"text-xl font-bold text-sky-300",children:C}),k[2]=C,k[3]=t):t=k[3],k[4]!==e||k[5]!==t?(s=(0,r.jsx)("div",{className:e,children:t}),k[4]=e,k[5]=t,k[6]=s):s=k[6],k[7]!==C?(i=(0,r.jsxs)("span",{className:"text-studio-heading font-semibold text-studio-primary",children:["Level ",C]}),k[7]=C,k[8]=i):i=k[8],k[9]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)("span",{className:"text-studio-body text-studio-disabled",children:"\xb7"}),k[9]=n):n=k[9],k[10]!==_?(o=(0,r.jsx)("span",{className:"text-studio-body text-studio-tertiary",children:_}),k[10]=_,k[11]=o):o=k[11],k[12]!==A?(c=A.toLocaleString(),k[12]=A,k[13]=c):c=k[13],k[14]!==c?(d=(0,r.jsxs)("span",{className:"ml-auto text-studio-micro text-studio-disabled",children:["Total: ",c," XP"]}),k[14]=c,k[15]=d):d=k[15],k[16]!==i||k[17]!==o||k[18]!==d?(u=(0,r.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[i,n,o,d]}),k[16]=i,k[17]=o,k[18]=d,k[19]=u):u=k[19];let R=E&&"from-sky-400 to-emerald-400";k[20]!==R?(m=(0,l.cn)("h-full rounded-full bg-gradient-to-r from-sky-500 to-sky-400 transition-all duration-700 ease-out shadow-[0_0_8px_rgba(56,189,248,0.4)]",R),k[20]=R,k[21]=m):m=k[21];let U=`${Math.min(100*P,100)}%`;k[22]!==U?(x={width:U},k[22]=U,k[23]=x):x=k[23],k[24]!==m||k[25]!==x?(h=(0,r.jsx)("div",{className:"h-2.5 rounded-full bg-white/[0.06] overflow-hidden",children:(0,r.jsx)("div",{className:m,style:x})}),k[24]=m,k[25]=x,k[26]=h):h=k[26],k[27]!==T?(p=T.toLocaleString(),k[27]=T,k[28]=p):p=k[28],k[29]!==I?(b=I.toLocaleString(),k[29]=I,k[30]=b):b=k[30],k[31]!==p||k[32]!==b?(f=(0,r.jsxs)("span",{className:"text-studio-micro text-studio-tertiary",children:[p," /"," ",b," XP"]}),k[31]=p,k[32]=b,k[33]=f):f=k[33];let z=E?"text-sky-400 font-medium":"text-studio-tertiary";k[34]!==z?(g=(0,l.cn)("text-studio-micro",z),k[34]=z,k[35]=g):g=k[35];let M=E?"Almost there!":`â Level ${C+1}`;return k[36]!==g||k[37]!==M?(y=(0,r.jsx)("span",{className:g,children:M}),k[36]=g,k[37]=M,k[38]=y):y=k[38],k[39]!==f||k[40]!==y?(j=(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[f,y]}),k[39]=f,k[40]=y,k[41]=j):j=k[41],k[42]!==h||k[43]!==j||k[44]!==u?(w=(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[u,h,j]}),k[42]=h,k[43]=j,k[44]=u,k[45]=w):w=k[45],k[46]!==w||k[47]!==s?(v=(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[s,w]}),k[46]=w,k[47]=s,k[48]=v):v=k[48],v}function tS(e){let t,s,i=(0,a.c)(5),{completed:n,total:o}=e;return i[0]!==o?(t=Array.from({length:o}),i[0]=o,i[1]=t):t=i[1],i[2]!==n||i[3]!==t?(s=(0,r.jsx)("div",{className:"flex items-center gap-1",children:t.map((e,t)=>(0,r.jsx)("div",{className:(0,l.cn)("w-2 h-2 rounded-full transition-colors duration-300",t<n?"bg-emerald-400":"bg-white/[0.08]")},t))}),i[2]=n,i[3]=t,i[4]=s):s=i[4],s}function tC(e){let t,s,i,n=(0,a.c)(7),{current:o,goal:c,completed:d}=e,u=c>0?Math.min(o/c*100,100):0,m=d?"bg-emerald-400":"bg-amber-400";n[0]!==m?(t=(0,l.cn)("h-full rounded-full transition-all duration-500",m),n[0]=m,n[
21]=t):t=n[1];let x=`${u}%`;return n[2]!==x?(s={width:x},n[2]=x,n[3]=s):s=n[3],n[4]!==t||n[5]!==s?(i=(0,r.jsx)("div",{className:"flex-1 h-2 rounded-full bg-white/[0.06] overflow-hidden",children:(0,r.jsx)("div",{className:t,style:s})}),n[4]=t,n[5]=s,n[6]=i):i=n[6],i}function t_(e){let t,s,i,n,o,c,d,u,m,x,h,p,b,f,g,y,j=(0,a.c)(44),{task:w,index:v}=e,N=tt[w.iconName]??eV.A,k=w.completed||w.currentProgress>=w.goal,C=k&&"opacity-70";j[0]!==C?(t=(0,l.cn)("flex items-center gap-3 px-3 py-3 rounded-lg transition-colors","animate-in fade-in slide-in-from-left-1",C),j[0]=C,j[1]=t):t=j[1];let _=`${40*v}ms`;j[2]!==_?(s={animationDelay:_,animationFillMode:"both"},j[2]=_,j[3]=s):s=j[3];let A=k?"bg-emerald-500/15 border border-emerald-400/20":"bg-amber-500/10 border border-amber-400/15";j[4]!==A?(i=(0,l.cn)("shrink-0 w-8 h-8 rounded-full flex items-center justify-center",A),j[4]=A,j[5]=i):i=j[5],j[6]!==N||j[7]!==k?(n=k?(0,r.jsx)(S.A,{size:14,className:"text-emerald-400"}):(0,r.jsx)(N,{size:14,className:"text-amber-400"}),j[6]=N,j[7]=k,j[8]=n):n=j[8],j[9]!==i||j[10]!==n?(o=(0,r.jsx)("div",{className:i,children:n}),j[9]=i,j[10]=n,j[11]=o):o=j[11];let T=k?"text-studio-tertiary line-through":"text-studio-primary";j[12]!==T?(c=(0,l.cn)("text-studio-body font-medium truncate",T),j[12]=T,j[13]=c):c=j[13],j[14]!==c||j[15]!==w.title?(d=(0,r.jsx)("span",{className:c,children:w.title}),j[14]=c,j[15]=w.title,j[16]=d):d=j[16],j[17]!==w.currentProgress||j[18]!==w.goal?(u=(0,r.jsxs)("span",{className:"text-studio-micro text-studio-tertiary tabular-nums shrink-0",children:[w.currentProgress,"/",w.goal]}),j[17]=w.currentProgress,j[18]=w.goal,j[19]=u):u=j[19],j[20]!==d||j[21]!==u?(m=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[d,u]}),j[20]=d,j[21]=u,j[22]=m):m=j[22],j[23]!==k||j[24]!==w.currentProgress||j[25]!==w.goal?(x=(0,r.jsx)(tC,{current:w.currentProgress,goal:w.goal,completed:k}),j[23]=k,j[24]=w.currentProgress,j[25]=w.goal,j[26]=x):x=j[26],j[27]!==m||j[28]!==x?(h=(0,r.jsxs)("div",{className:"flex-1 min-w-0 space-y-1.5",children:[m,x]}),j[27]=m,j[28]=x,j[29]=h):h=j[29];let I=k?"bg-emerald-500/10 text-emerald-400/70":"bg-amber-500/10 text-amber-400";return j[30]!==I?(p=(0,l.cn)("shrink-0 flex items-center gap-1 px-2 py-1 rounded-md","text-studio-micro font-semibold tabular-nums",I),j[30]=I,j[31]=p):p=j[31],j[32]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsx)(eJ.A,{size:12,className:"shrink-0"}),j[32]=b):b=j[32],j[33]!==w.reward?(f=(0,r.jsxs)("span",{children:["+",w.reward]}),j[33]=w.reward,j[34]=f):f=j[34],j[35]!==p||j[36]!==f?(g=(0,r.jsxs)("div",{className:p,children:[b,f]}),j[35]=p,j[36]=f,j[37]=g):g=j[37],j[38]!==h||j[39]!==t||j[40]!==g||j[41]!==s||j[42]!==o?(y=(0,r.jsxs)("div",{className:t,style:s,children:[o,h,g]}),j[38]=h,j[39]=t,j[40]=g,j[41]=s,j[42]=o,j[43]=y):y=j[43],y}function tA(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"space-y-2",children:Array.from({length:3}).map(tT)}),t[0]=e):e=t[0],e}function tT(e,t){return(0,r.jsxs)("div",{className:"flex items-center gap-3 px-3 py-3 animate-pulse",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-full bg-white/[0.06] shrink-0"}),(0,r.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,r.jsx)("div",{className:"h-3.5 rounded bg-white/[0.06] w-3/4"}),(0,r.jsx)("div",{className:"h-2 rounded-full bg-white/[0.06]"})]}),(0,r.jsx)("div",{className:"w-14 h-6 rounded-md bg-white/[0.06] shrink-0"})]},t)}function tI(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4 mt-2 rounded-lg bg-emerald-500/[0.06] border border-emerald-400/10 animate-in fade-in zoom-in-95 duration-300",children:[(0,r.jsx)(e5.A,{size:15,className:"text-emerald-400"}),(0,r.jsx)("span",{className:"text-studio-body font-medium text-emerald-400",children:"All quests complete!"})]}),t[0]=e):e=t[0],e}function tP(){let e,t,s,l,n,o,c,d,u,m,x=(0,a.c)(24),{isOwnProfile:h}=N(),p=V(h),b=function(){let e,t,s=(0,a.c)(2),[r,l]=(0,i.useState)(null);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>{let e=function(){let e=new Date,t=new Date(e);t.setUTCHours(24,0,0,0);let s=t.getTime()-e.getTime(),r=Math.floor(s/36e5),a=Math.floor(s%36e5/6e4);l(`${r}h ${a}m`)};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},t=[],s[0]=e,s[1]=t):(e=s[0],t=s[1]),(0,i.useEffect)(e,t),r}();p.data?.dailyTasks,x[0]!==p.data?.dailyTasks?(e=[...p.data?.dailyTasks??[]].sort(tR),x[0]=p.data?.dailyTasks,x[1]=e):e=x[1];let f=e;x[2]!==f?(t=f.filter(tL),x[2]=f,x[3]=t):t=x[3];let g=t.length,y=f.length,j=y>0&&g===y;if(!h)return null;if(p.isLoading){let e;return x[4]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"flex items-center gap-3 mb-4",children:(0,r.jsx)("p",{className:"text-studio-body font-medium text-amber-400/90 uppercase tracking-wider",children:"Today's Quests"})}),(0,r.jsx)(tA,{})]}),x[4]=e):e=x[4],e}return f.length?(x[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("p",{className:"text-studio-body font-medium text-amber-400/90 uppercase tracking-wider",children:"Today's Quests"}),x[5]=s):s=x[5],x[6]!==g||x[7]!==y?(l=(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[s,(0,r.jsx)(tS,{completed:g,total:y}),(0,r.jsxs)("span",{className:"text-studio-micro text-studio-tertiary tabular-nums",children:[g,"/",y]})]}),x[6]=g,x[7]=y,x[8]=l):l=x[8],x[9]!==b?(n=null!==b&&(0,r.jsxs)("span",{className:"text-studio-micro text-studio-tertiary",children:["Resets in ",b]}),x[9]=b,x[10]=n):n=x[10],x[11]!==l||x[12]!==n?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[l,n]}),x[11]=l,x[12]=n,x[13]=o):o=x[13],x[14]!==f?(c=f.map(tE),x[14]=f,x[15]=c):c=x[15],x[16]!==c?(d=(0,r.jsx)("div",{className:"space-y-1",children:c}),x[16]=c,x[17]=d):d=x[17],x[18]!==j?(u=j&&(0,r.jsx)(tI,{}),x[18]=j,x[19]=u):u=x[19],x[20]!==o||x[21]!==d||x[22]!==u?(m=(0,r.jsxs)("div",{children:[o,d,u]}),x[20]=o,x[21]=d,x[22]=u,x[23]=m):m=x[23],m):null}function tE(e,t){return(0,r.jsx)(t_,{task:e,index:t},e.id)}function tL(e){return e.completed||e.currentProgress>=e.goal}function tR(e,t){return e.completed===t.completed?0:e.completed?1:-1}var tU=s(23262),tz=s(72775);let tM={"Images Generated":"text-sky-400","Total Likes":"text-rose-400","Competition Wins":"text-amber-400"},tD=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1});function tO(e){let t,s,i,n,o,c,d,u=(0,a.c)(19),{statKey:m,value:x,icon:h,index:p}=e,b=tt[h],f=tM[m],g=`${30*p}ms`;u[0]!==g?(t={animationDelay:g,animationFillMode:"both"},u[0]=g,u[1]=t):t=u[1],u[2]!==b||u[3]!==f?(s=b&&(0,r.jsx)(b,{size:16,className:(0,l.cn)("shrink-0",f??"text-studio-disabled")}),u[2]=b,u[3]=f,u[4]=s):s=u[4],u[5]!==m?(i=(0,r.jsx)("span",{className:"flex-1 text-studio-body text-studio-tertiary truncate",children:m}),u[5]=m,u[6]=i):i=u[6];let y=f??"text-studio-primary";return u[7]!==y?(n=(0,l.cn)("font-bold tabular-nums text-studio-heading",y),u[7]=y,u[8]=n):n=u[8],u[9]!==x?(o=tD.format(x),u[9]=x,u[10]=o):o=u[10],u[11]!==n||u[12]!==o?(c=(0,r.jsx)("span",{className:n,children:o}),u[11]=n,u[12]=o,u[13]=c):c=u[13],u[14]!==t||u[15]!==s||u[16]!==i||u[17]!==c?(d=(0,r.jsxs)("div",{className:"flex items-center gap-3 py-2 animate-in fade-in",style:t,children:[s,i,c]}),u[14]=t,u[15]=s,u[16]=i,u[17]=c,u[18]=d):d=u[18],d}function tF(){let e,t,s,l,n,o,c,d,u,x=(0,a.c)(27),{stats:h,statsLoading:p}=N(),[b,f]=(0,i.useState)(!1);if(x[0]!==b||x[1]!==h||x[2]!==p){o=Symbol.for("react.early_return_sentinel");e:{let a,i;x[9]!==h?(a=e=>{let{key:t}=e;return h&&(h[t]??0)>0},x[9]=h,x[10]=a):a=x[10],e=m.filter(a).sort(tq);let c=b?e:e.slice(0,6);if(t=e.length>6,p){let e;x[11]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"space-y-3","aria-busy":"true",children:Array.from({length:4}).map(tB)}),x[11]=e):e=x[11],o=e;break e}if(0===e.length){let e;x[12]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("p",{className:"text-center py-8 text-studio-tertiary text-studio-body",children:"No stats yet â start creating to build your profile!"}),x[12]=e):e=x[12],o=e;break e}x[13]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)("p",{className:"text-studio-body font-medium text-studio-tertiary uppercase tracking-wider mb-3",children:"Creator Stats"}),x[13]=n):n=x[13],s="grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-0 divide-y sm:divide-y-0 divide-white/[0.04]",x[14]!==h?(i=(e,t)=>{let{key:s,icon:a}=e;return(0,r.jsx)(tO,{statKey:s,value:h?.[s]??0,icon:a,index:t},s)},x[14]=h,x[15]=i):i=x[15],l=c.map(i)}x[0]=b,x[1]=h,x[2]=p,x[3]=e,x[4]=t,x[5]=s,x[6]=l,x[7]=n,x[8]=o}else e=x[3],t=x[4],s=x[5],l=x[6],n=x[7],o=x[8];return o!==Symbol.for("react.early_return_sentinel")?o:(x[16]!==s||x[17]!==l?(c=(0,r.jsx)("div",{className:s,children:l}),x[16]=s,x[17]=l,x[18]=c):c=x[18],x[19]!==e||x[20]!==b||x[21]!==t?(d=t&&(0,r.jsx)("button",{onClick:()=>f(t$),className:"mt-3 flex items-center gap-1.5 mx-auto text-studio-body text-studio-tertiary hover:text-studio-primary transition-colors","aria-expanded":b,children:b?(0,r.jsxs)(r.Fragment,{children:["Show less",(0,r.jsx)(tU.A,{size:15})]}):(0,r.jsxs)(r.Fragment,{children:["See all ",e.length," stats",(0,r.jsx)(tz.A,{size:15})]})}),x[19]=e,x[20]=b,x[21]=t,x[22]=d):d=x[22],x[23]!==n||x[24]!==c||x[25]!==d?(u=(0,r.jsxs)("div",{children:[n,c,d]}),x[23]=n,x[24]=c,x[25]=d,x[26]=u):u=x[26],u)}function t$(e){return!e}function tB(e,t){return(0,r.jsxs)("div",{className:"flex items-center gap-3 animate-pulse",children:[(0,r.jsx)("div",{className:"w-4 h-4 rounded bg-white/[0.06]"}),(0,r.jsx)("div",{className:"flex-1 h-3 rounded bg-white/[0.04]"}),(0,r.jsx)("div",{className:"w-10 h-4 rounded bg-white/[0.06]"})]},t)}function tq(e,t){return e.priority-t.priority}function tG(){let e,t,s=(0,a.c)(2);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsxs)("div",{className:"flex-1 min-w-0 space-y-8",children:[(0,r.jsx)(tk,{}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,r.jsx)(tm,{})]}),s[0]=e):e=s[0],s[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsxs)("div",{className:"flex flex-col lg:flex-row gap-8",children:[e,(0,r.jsxs)("div",{className:"lg:w-[340px] shrink-0 space-y-6 lg:sticky lg:top-28 lg:self-start",children:[(0,r.jsx)(tN,{}),(0,r.jsx)(tP,{}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,r.jsx)(tF,{})]})]}),s[1]=t):t=s[1],t}var tW=s(88976),tK=s(45749),tV=s(54378),tQ=s(11191),tX=s(6763),tY=s(36024),tJ=s(25564),tH=s(59061),tZ=s(19480),t0=s(75854),t1=s(8578),t2=s(68352);function t4(){let e,t,s,l,n,o,c=(0,a.c)(21),d=(0,Y.AT)(!0);c[0]===Symbol.for("react.memo_cache_sentinel")?(e=new Set,c[0]=e):e=c[0];let[u,m]=(0,i.useState)(e);if(d.data?.pages,c[1]!==d.data?.pages||c[2]!==u){let e;c[4]!==u?(e=e=>!u.has(e.userId),c[4]=u,c[5]=e):e=c[5],t=(d.data?.pages??[]).flatMap(t3).filter(e),c[1]=d.data?.pages,c[2]=u,c[3]=t}else t=c[3];let x=t;if(d.isPending){let e;return c[6]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsxs)("div",{className:"flex min-h-24 items-center gap-2 text-studio-body text-studio-tertiary",children:[(0,r.jsx)(k.A,{size:15,className:"animate-spin","aria-hidden":"true"}),"Loading blocked accountsâ¦"]}),c[6]=e):e=c[6],e}if(d.isError){let e,t,s,a;return c[7]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("p",{className:"text-studio-body text-red-300",children:"Blocked accounts could not be loaded."}),c[7]=e):e=c[7],c[8]!==d?(t=()=>d.refetch(),c[8]=d,c[9]=t):t=c[9],c[10]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(t1.A,{size:14,"aria-hidden":"true"}
2),c[10]=s):s=c[10],c[11]!==t?(a=(0,r.jsxs)("div",{role:"alert",className:"rounded-xl border border-red-400/15 bg-red-500/[0.06] p-4",children:[e,(0,r.jsxs)("button",{type:"button",onClick:t,className:"mt-3 inline-flex min-h-10 items-center gap-2 rounded-lg border border-red-400/20 bg-red-500/10 px-3 text-studio-label font-medium text-red-300 transition-colors hover:bg-red-500/20",children:[s,"Retry"]})]}),c[11]=t,c[12]=a):a=c[12],a}return c[13]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("p",{className:"mb-3 text-studio-micro leading-relaxed text-studio-tertiary",children:"Blocked accounts cannot follow you, and their posts are hidden from your signed-in public Gallery."}),c[13]=s):s=c[13],c[14]!==x?(l=0===x.length?(0,r.jsxs)("div",{className:"flex min-h-24 items-center gap-3 rounded-xl border border-white/[0.05] bg-white/[0.02] px-4 text-studio-body text-studio-tertiary",children:[(0,r.jsx)(t2.A,{size:17,className:"shrink-0 text-studio-disabled","aria-hidden":"true"}),"You have not blocked any accounts."]}):(0,r.jsx)("div",{className:"divide-y divide-white/[0.05]",children:x.map(e=>(0,r.jsxs)("div",{className:"flex min-h-16 items-center gap-3 py-3",children:[(0,r.jsxs)(z(),{href:`/profile/${encodeURIComponent(e.username)}`,prefetch:!1,className:"flex min-w-0 flex-1 items-center gap-3 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400/60",children:[(0,r.jsx)(O.B,{size:"sm",avatarUrl:e.avatarUrl,userPremiumLevel:e.subscriptionType,username:e.username}),(0,r.jsx)("span",{className:"min-w-0 truncate text-studio-body font-medium text-studio-primary",children:e.username})]}),(0,r.jsx)(M.hY,{targetUserId:e.userId,username:e.username,isBlocked:!0,onBlockStateChange:t=>{t||m(t=>{let s=new Set(t);return s.add(e.userId),s})},trigger:(0,r.jsx)("button",{type:"button","aria-label":`Unblock @${e.username}`,className:"inline-flex min-h-10 shrink-0 items-center rounded-lg border border-white/[0.08] bg-white/[0.03] px-3 text-studio-label font-medium text-studio-secondary transition-colors hover:bg-white/[0.06] hover:text-white",children:"Unblock"})})]},e.userId))}),c[14]=x,c[15]=l):l=c[15],c[16]!==d?(n=d.hasNextPage&&(0,r.jsxs)("button",{type:"button",onClick:()=>d.fetchNextPage(),disabled:d.isFetchingNextPage,className:"mt-3 inline-flex min-h-10 items-center gap-2 rounded-lg border border-white/[0.08] bg-white/[0.03] px-3 text-studio-label font-medium text-studio-secondary transition-colors hover:bg-white/[0.06] hover:text-white disabled:cursor-not-allowed disabled:opacity-50",children:[d.isFetchingNextPage&&(0,r.jsx)(k.A,{size:14,className:"animate-spin","aria-hidden":"true"}),"Load more"]}),c[16]=d,c[17]=n):n=c[17],c[18]!==l||c[19]!==n?(o=(0,r.jsxs)("div",{children:[s,l,n]}),c[18]=l,c[19]=n,c[20]=o):o=c[20],o}function t3(e){return e.content}let t5=/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[\^$*.[\]{}()?\-"!@#%&/,><':;|_~`+=]).{8,}/,t6=[12,24,48];function t8(e){let t,s=(0,a.c)(2),{label:i}=e;return s[0]!==i?(t=(0,r.jsx)("p",{className:"text-studio-body font-medium text-studio-tertiary uppercase tracking-wider mb-4",children:i}),s[0]=i,s[1]=t):t=s[1],t}function t7(e){let t,s=(0,a.c)(2),{children:i}=e;return s[0]!==i?(t=(0,r.jsx)("div",{className:"flex items-center justify-between py-3 min-h-[52px] gap-4",children:i}),s[0]=i,s[1]=t):t=s[1],t}function t9(e){let t,s,i,l=(0,a.c)(7),{label:n,description:o}=e;return l[0]!==n?(t=(0,r.jsx)("span",{className:"text-studio-body text-studio-primary font-medium",children:n}),l[0]=n,l[1]=t):t=l[1],l[2]!==o?(s=o&&(0,r.jsx)("span",{className:"text-studio-micro text-studio-tertiary",children:o}),l[2]=o,l[3]=s):s=l[3],l[4]!==t||l[5]!==s?(i=(0,r.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[t,s]}),l[4]=t,l[5]=s,l[6]=i):i=l[6],i}function se(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"h-px bg-white/[0.06] my-2"}),t[0]=e):e=t[0],e}let st="w-full bg-white/[0.04] border border-white/[0.06] rounded-lg px-3 py-2 text-studio-body text-studio-primary placeholder:text-studio-placeholder outline-none focus:border-white/[0.12] focus:bg-white/[0.06] transition-colors";function ss(){let{user:e,isOwnProfile:t}=N(),{state:a,dispatch:n}=(0,c.As)(),{entitled:o,promptUpgrade:d}=(0,tZ.m)("profile.autoPublic"),{entitled:u,promptUpgrade:m}
2=(0,tZ.m)("gen.autoArtPreset"),{preset:x,hasCustomModel:p,goldCostPerImage:b}=(0,tH.t)(),[f,g]=(0,i.useState)(!1),{toast:y}=(0,tJ.dj)(),[j,w]=(0,i.useState)(e?.username??""),[v,_]=(0,i.useState)("idle"),[A,T]=(0,i.useState)(e?.autoPublic??!1),[I,P]=(0,i.useState)(e?.marketingConsent??!1),[E,L]=(0,i.useState)(e?.defaultPageSize??24),[R,U]=(0,i.useState)(!1),[M,D]=(0,i.useState)(""),[O,F]=(0,i.useState)(""),[$,B]=(0,i.useState)(""),[q,G]=(0,i.useState)(!1),[W,K]=(0,i.useState)(!1),V=(0,i.useRef)(null);(0,i.useEffect)(()=>{e&&(w(e.username??""),T(e.autoPublic??!1),P(e.marketingConsent??!1),L(e.defaultPageSize??24))},[e]);let Q=(0,i.useCallback)(t=>{(w(t),_("idle"),V.current&&clearTimeout(V.current),t&&t!==e?.username)?(_("checking"),V.current=setTimeout(async()=>{_(await (0,h.checkUsernameAvailability)(t)?"available":"unavailable")},600)):_("idle")},[e?.username]),X=a.referralCode?(0,l.J0)("https://char-gen.com",a.referralCode):null,Y=(0,i.useCallback)(async()=>{if(X)try{await navigator.clipboard.writeText(X),K(!0),y({title:"Copied!",description:"Referral link copied to clipboard."}),setTimeout(()=>K(!1),2500)}catch{y({title:"Copy failed",variant:"destructive"})}},[X,y]),H=(j!==(e?.username??"")||A!==(e?.autoPublic??!1)||I!==(e?.marketingConsent??!1)||E!==(e?.defaultPageSize??24))&&!R&&"checking"!==v&&"unavailable"!==v,Z=(0,i.useCallback)(async()=>{let t;if(!H)return;if(j!==e?.username){if(!await (0,h.checkUsernameAvailability)(j)){_("unavailable"),y({title:"Username unavailable",description:"Please choose a different username.",variant:"destructive"});return}_("available")}U(!0);let s={};j!==e?.username&&(s.username=j),A!==e?.autoPublic&&(s.autoPublic=A),E!==e?.defaultPageSize&&(s.defaultPageSize=E);let r=I!==(e?.marketingConsent??!1);if(Object.keys(s).length>0&&({error:t}=await (0,h.updateUser)(s)),!t&&r){let{error:e}=await (0,h.updateMarketingConsent)(I);e&&y({title:"Marketing preference not saved",description:e,variant:"destructive"})}if(U(!1),t)return void y({title:"Save failed",description:t,variant:"destructive"});if(a.user){let e={...a.user};void 0!==s.username&&(e.username=s.username),void 0!==s.autoPublic&&(e.autoPublic=s.autoPublic??void 0),r&&(e.marketingConsent=I),void 0!==s.defaultPageSize&&(e.defaultPageSize=s.defaultPageSize),n({type:J.Sx.SET_USER,payload:{user:e}})}y({title:"Settings saved",description:"Your changes have been saved."})},[H,j,e,A,I,E,a,n,y]),ee=(0,i.useCallback)(()=>{o?T(e=>!e):d()},[o,d]),et=(0,i.useCallback)(async e=>{if(e.preventDefault(),!t5.test(O))return void y({title:"Weak password",description:"Password must be 8+ characters with uppercase, lowercase, number, and special character.",variant:"destructive"});if(O!==$)return void y({title:"Passwords don't match",description:"New password and confirm password must match.",variant:"destructive"});try{G(!0);let{AuthClient:e}=await Promise.all([s.e(80798),s.e(72)]).then(s.bind(s,80798));await e.updatePassword({oldPassword:M,newPassword:O}),D(""),F(""),B(""),y({title:"Password updated",description:"Your password has been changed."})}catch(e){y({title:"Update failed",description:e instanceof Error?e.message:"Failed to update password",variant:"destructive"})}finally{G(!1)}},[M,O,$,y]);if(!t)return null;let es=e?.subscriptionType!==void 0&&e.subscriptionType!==J.b.NONE,er=e?.email?`${t0.me}?prefilled_email=${encodeURIComponent(e.email)}`:t0.me;return(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-x-12 gap-y-0",children:[(0,r.jsxs)("div",{className:"space-y-0",children:[(0,r.jsxs)("section",{className:"pb-2",children:[(0,r.jsx)(t8,{label:"Account"}),X&&(0,r.jsxs)(t7,{children:[(0,r.jsx)(t9,{label:"Referral Link"}),(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"text-studio-micro text-studio-tertiary truncate max-w-[180px] sm:max-w-[260px]",children:X}),(0,r.jsxs)("button",{onClick:Y,"aria-label":"Copy referral link",className:"shrink-0 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-white/[0.04] border border-white/[0.06] text-studio-micro text-studio-tertiary hover:text-studio-primary hover:bg-white/[0.08] transition-colors",children:[W?(0,r.jsx)(S.A,{size:12,className:"text-sky-400"}):(0,r.jsx)(tW.A,{size:12}),(0,r.jsx)("span",{children:W?"Copied!":"Copy"})]})]})]}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(t9,{label:"Email"}),(0,r.jsx)("span",{className:"text-studio-body text-studio-primary shrink-0 max-w-[260px] truncate",children:e?.email??"â"})]}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,r.jsxs)("div",{className:"py-3 space-y-2",children:[(0,r.jsx)("label",{className:"text-studio-body text-studio-primary font-medium",children:"Username"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:"text",value:j,onChange:e=>Q(e.target.value),className:`${st} lg:max-w-sm`,placeholder:"your-username",spellCheck:!1,autoComplete:"off"}),"idle"!==v&&(0,r.jsxs)("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:["checking"===v&&(0,r.jsx)(k.A,{size:14,className:"animate-spin text-studio-tertiary"}),"available"===v&&(0,r.jsx)(S.A,{size:14,className:"text-emerald-400"}),"unavailable"===v&&(0,r.jsx)(C.A,{size:14,className:"text-red-400"})]})]}),"unavailable"===v&&(0,r.jsx)("p",{className:"text-studio-micro text-red-400",children:"Username is already taken"}),"available"===v&&(0,r.jsx)("p",{className:"text-studio-micro text-emerald-400",children:"Username is available"})]}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,r.jsxs)("div",{className:"py-3 space-y-2",children:[(0,r.jsx)("label",{className:"text-studio-body text-studio-primary font-medium",children:"Default Gallery Page Size"}),(0,r.jsx)("div",{className:"flex items-center gap-1.5",children:t6.map(e=>(0,r.jsx)("button",{onClick:()=>L(e),className:`px-3.5 py-1.5 rounded-lg text-studio-body font-medium border transition-colors ${E===e?"bg-sky-500/15 text-sky-300 border-sky-400/20":"text-studio-tertiary border-white/[0.06] bg-white/[0.02] hover:text-studio-primary hover:bg-white/[0.04]"}`,children:e},e))})]})]}),(0,r.jsx)(se,{}),(0,r.jsxs)("section",{className:"pt-4 pb-2",children:[(0,r.jsx)(t8,{label:"Preferences"}),(0,r.jsxs)(t7,{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-studio-body text-studio-primary font-medium",children:"Auto-publish images"}),!o&&(0,r.jsx)(tX.J,{featureId:"profile.autoPublic",size:"sm"})]}),(0,r.jsx)("span",{className:"text-studio-micro text-studio-tertiary",children:"New images are public by default"})]}),(0,r.jsx)(tY.d,{checked:A,onCheckedChange:ee,className:"shrink-0"})]}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(t9,{label:"Marketing emails",description:"Receive updates about new features"}),(0,r.jsx)(tY.d,{checked:I,onCheckedChange:e=>P(e),className:"shrink-0"})]}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"}),(0,r.jsxs)(t7,{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-studio-body text-studio-primary font-medium",children:"Auto-art preset"}),!u&&(0,r.jsx)(tX.J,{featureId:"gen.autoArtPreset",size:"sm"})]}),(0,r.jsx)("span",{className:"text-studio-micro text-studio-tertiary",children:[x.customStyle??x.style??"Default style",x.model?tH.R.some(e=>
2e.name===x.model&&e.hasQuality)?`${x.model} ${x.quality??"Medium"}`:x.model:"free model",p?`up to ${b} gold per image`:null].filter(Boolean).join(" \xb7 ")})]}),(0,r.jsx)("button",{type:"button",onClick:()=>u?g(!0):m(),className:"shrink-0 px-4 py-1.5 rounded-lg text-studio-body border border-white/[0.08] text-studio-primary hover:bg-white/[0.05] transition-colors",children:"Edit"})]}),(0,r.jsx)("div",{className:"pt-3 pb-1",children:(0,r.jsx)("button",{onClick:Z,disabled:!H,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-studio-body font-medium border transition-all bg-sky-500/15 text-sky-300 border-sky-400/20 hover:bg-sky-500/25 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-sky-500/15",children:R?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.A,{size:14,className:"animate-spin"}),"Savingâ¦"]}):"Save Changes"})})]}),(0,r.jsx)(se,{}),(0,r.jsxs)("section",{className:"pt-4 pb-6",children:[(0,r.jsx)(t8,{label:"Billing"}),(0,r.jsxs)(t7,{children:[(0,r.jsx)(t9,{label:"Gold Balance",description:"Your current generation credits"}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-studio-body text-amber-300 font-medium shrink-0",children:[(0,r.jsx)(eJ.A,{size:16,className:"text-amber-400"}),(0,r.jsx)("span",{children:(e?.gold??0).toLocaleString()})]})]}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"}),es&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"py-3",children:[(0,r.jsxs)("a",{href:er,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-studio-body font-medium border transition-all bg-sky-500/15 text-sky-300 border-sky-400/20 hover:bg-sky-500/25",children:["Manage Subscription",(0,r.jsx)(tK.A,{size:13})]}),(0,r.jsx)("p",{className:"mt-2 text-studio-micro text-studio-tertiary",children:"Gold you have earned or bought stays in your account. Cancelling your subscription never removes it."})]}),(0,r.jsx)("div",{className:"h-px bg-white/[0.04]"})]}),(0,r.jsx)("div",{className:"py-3",children:(0,r.jsxs)(z(),{href:"/transactions",className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-studio-body font-medium border transition-all bg-white/[0.03] text-studio-secondary border-white/[0.06] hover:text-studio-primary hover:bg-white/[0.06]",children:["View Transaction History",(0,r.jsx)(tK.A,{size:13})]})})]})]}),(0,r.jsxs)("div",{className:"space-y-0",children:[(0,r.jsxs)("section",{className:"pb-2",children:[(0,r.jsx)(t8,{label:"Security"}),(0,r.jsxs)("form",{onSubmit:et,className:"space-y-3",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-studio-body text-studio-tertiary",children:"Current Password"}),(0,r.jsx)("input",{type:"password",value:M,onChange:e=>D(e.target.value),className:`${st} lg:max-w-sm`,autoComplete:"current-password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-studio-body text-studio-tertiary",children:"New Password"}),(0,r.jsx)("input",{type:"password",value:O,onChange:e=>F(e.target.value),className:`${st} lg:max-w-sm`,autoComplete:"new-password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"}),(0,r.jsx)("p",{className:"text-studio-micro text-studio-disabled",children:"8+ characters, uppercase, lowercase, number, special character"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-studio-body text-studio-tertiary",children:"Confirm New Password"}),(0,r.jsx)("input",{type:"password",value:$,onChange:e=>B(e.target.value),className:`${st} lg:max-w-sm`,autoComplete:"new-password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢"})]}),(0,r.jsx)("div",{className:"pt-1",children:(0,r.jsx)("button",{type:"submit",disabled:q||!M||!O||!$,className:"flex items-center gap-2 px-5 py-2.5 rounded-lg text-studio-body font-medium border transition-all bg-sky-500/15 text-sky-300 border-sky-400/20 hover:bg-sky-500/25 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-sky-500/15",children:q?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.A,{size:14,className:"animate-spin"}),"Updatingâ¦"]}):"Update Password"})})]})]}),(0,r.jsx)(se,{}),(0,r.jsxs)("section",{className:"py-4",children:[(0,r.jsx)(t8,{label:"Blocked Accounts"}),(0,r.jsx)(t4,{})]}),(0,r.jsx)(se,{}),(0,r.jsxs)("section",{className:"pt-4 pb-2",children:[(0,r.jsx)(t8,{label:"Notifications"}),(0,r.jsx)(tQ.W,{})]})]}),u&&(0,r.jsx)(tV.U,{open:f,onOpenChange:g})]})}var sr=s(23452),sa=s(92538),si=s(24564),sl=s(10625),sn=s(72278);function so(e){let t,s=(0,a.c)(2),{label:i}=e;return s[0]!==i?(t=(0,r.jsx)("p",{className:"text-studio-body font-medium text-studio-tertiary uppercase tracking-wider mb-4",children:i}),s[0]=i,s[1]=t):t=s[1],t}function sc(e){let t,s=(0,a.c)(2),{children:i}=e;return s[0]!==i?(t=(0,r.jsx)("div",{className:"flex items-center justify-between py-3 min-h-[52px] gap-4",children:i}),s[0]=i,s[1]=t):t=s[1],t}function sd(e){let t,s,i,l=(0,a.c)(7),{label:n,description:o}=e;return l[0]!==n?(t=(0,r.jsx)("span",{className:"text-studio-body text-studio-primary font-medium",children:n}),l[0]=n,l[1]=t):t=l[1],l[2]!==o?(s=o&&(0,r.jsx)("span",{className:"text-studio-micro text-studio-tertiary",children:o}),l[2]=o,l[3]=s):s=l[3],l[4]!==t||l[5]!==s?(i=(0,r.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[t,s]}),l[4]=t,l[5]=s,l[6]=i):i=l[6],i}function su(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"h-px bg-white/[0.06] my-2"}),t[0]=e):e=t[0],e}let sm="w-full bg-white/[0.04] border border-white/[0.06] rounded-lg px-3 py-2 text-studio-body text-studio-primary placeholder:text-studio-placeholder outline-none focus:border-white/[0.12] focus:bg-white/[0.06] transition-colors";function sx(){let e,t,s,l,n,o,c,d,u,m,x,h,p,b,f,g,y,j,w,v,N,S,C,_,A,T,I,P,E,L,R,U,z,M=(0,a.c)(88),[D,O]=(0,i.useState)(sn.wN),F=D.dddice.enabled?"connected":"disconnected";M[0]!==D.dddice.roomSlug||M[1]!==F?(e={status:F,roomSlug:D.dddice.roomSlug},M[0]=D.dddice.roomSlug,M[1]=F,M[2]=e):e=M[2];let[$,B]=(0,i.useState)(e),[q,G]=(0,i.useState)(!1),{toast:W}=(0,tJ.dj)();M[3]!==D?(t=e=>{let t={...D,...e};O(t),(0,sn.pf)(t)},M[3]=D,M[4]=t):t=M[4];let K=t;M[5]!==D||M[6]!==W?(s=async()=>{B({status:"connecting"});try{let e=await si.b.createGuestUser(),t=await si.b.createRoom(e),s=await si.b.getUserTheme(e),r={...D,dddice:{enabled:!0,guestToken:e,roomSlug:t,diceTheme:s}};O(r),(0,sn.pf)(r),B({status:"connected",roomSlug:t}),W({title:"Connected! Room created."})}catch(t){let e=t instanceof Error?t.message:String(t);B({status:"error",error:e}),W({title:"Connection failed",description:e,variant:"destructive"})}},M[5]=D,M[6]=W,M[7]=s):s=M[7];let V=s;
2M[8]!==D||M[9]!==W?(l=async()=>{let{apiKey:e,roomSlug:t}=D.dddice;if(e&&t){B({status:"connecting"});try{let s=await si.b.getUserTheme(e),r={...D,dddice:{enabled:!0,apiKey:e,roomSlug:t,diceTheme:s}};O(r),(0,sn.pf)(r),B({status:"connected",roomSlug:t}),W({title:"Connected with API key!"})}catch(t){let e=t instanceof Error?t.message:String(t);B({status:"error",error:e}),W({title:"Connection failed",description:e,variant:"destructive"})}}},M[8]=D,M[9]=W,M[10]=l):l=M[10];let Q=l;M[11]!==D||M[12]!==W?(n=()=>{let e={...D,dddice:{enabled:!1}};O(e),(0,sn.pf)(e),B({status:"disconnected"}),W({title:"Disconnected from VTT"})},M[11]=D,M[12]=W,M[13]=n):n=M[13];let X=n;M[14]!==D.dddice.roomSlug||M[15]!==W?(o=()=>{if(!D.dddice.roomSlug)return;let e=`https://dddice.com/room/${D.dddice.roomSlug}`;navigator.clipboard.writeText(e),W({title:"Room link copied!"})},M[14]=D.dddice.roomSlug,M[15]=W,M[16]=o):o=M[16];let Y=o,J="connected"===$.status,H="connecting"===$.status;M[17]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)(so,{label:"VTT Dice Sync"}),M[17]=c):c=M[17],M[18]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsxs)("p",{className:"text-studio-micro text-studio-tertiary -mt-4 mb-4",children:["Send dice rolls from CharGen directly to Roll20, Foundry VTT, and other virtual tabletops via"," ",(0,r.jsx)("a",{href:"https://dddice.com",target:"_blank",rel:"noopener noreferrer",className:"text-sky-400 hover:text-sky-300 transition-colors",children:"dddice"}),"."]}),M[18]=d):d=M[18],M[19]!==$.error||M[20]!==$.status||M[21]!==Y||M[22]!==V||M[23]!==X||M[24]!==J||M[25]!==H||M[26]!==D.dddice.roomSlug?(u=J?(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 py-3 px-4 rounded-lg bg-emerald-500/10 border border-emerald-500/20",children:[(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),(0,r.jsx)("span",{className:"text-sm text-emerald-300 font-medium",children:"Connected"}),(0,r.jsxs)("span",{className:"text-sm text-studio-tertiary ml-1",children:["Room: ",D.dddice.roomSlug]}),(0,r.jsx)("button",{onClick:Y,className:"ml-auto text-studio-tertiary hover:text-studio-primary transition-colors",title:"Copy room link",children:(0,r.jsx)(tW.A,{size:14})})]}),(0,r.jsxs)("div",{className:"rounded-lg bg-white/[0.03] border border-white/[0.06] p-4 space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-studio-primary font-medium",children:"Next: Connect your VTT"}),(0,r.jsxs)("ol",{className:"text-sm text-studio-tertiary space-y-2 list-decimal list-inside",children:[(0,r.jsxs)("li",{children:["Install the"," ",(0,r.jsxs)("a",{href:"https://chromewebstore.google.com/detail/dddice/npmficphbhbhebhjfekjopgkpojjcfem",target:"_blank",rel:"noopener noreferrer",className:"text-sky-400 hover:text-sky-300 transition-colors inline-flex items-center gap-1",children:["dddice browser extension",(0,r.jsx)(tK.A,{size:12})]})]}),(0,r.jsx)("li",{children:"Open Roll20 or Foundry VTT in your browser"}),(0,r.jsxs)("li",{children:["Click the dddice extension icon and paste this room link:"," ",(0,r.jsxs)("button",{onClick:Y,className:"inline-flex items-center gap-1 text-sky-400 hover:text-sky-300 transition-colors",children:[(0,r.jsx)("code",{className:"bg-white/[0.06] px-1.5 py-0.5 rounded text-xs",children:D.dddice.roomSlug}),(0,r.jsx)(tW.A,{size:12})]})]}),(0,r.jsx)("li",{children:"Click any dice on a Monster or NPC page â it appears in your VTT"})]})]}),(0,r.jsxs)("button",{onClick:X,className:"flex items-center gap-2 text-sm text-studio-tertiary hover:text-red-400 transition-colors",children:[(0,r.jsx)(sa.A,{size:14}),"Disconnect"]})]}):(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("button",{onClick:V,disabled:H,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-lg bg-sky-500/15 text-sky-300 hover:bg-sky-500/25 border border-sky-500/20 transition-colors disabled:opacity-50 font-medium",children:H?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.A,{size:18,className:"animate-spin"}),"Connecting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sr.A,{size:18}),"Connect to Roll20 / Foundry VTT"]})}),"error"===$.status&&(0,r.jsx)("p",{className:"text-sm text-red-400",children:$.error}),(0,r.jsx)("p",{className:"text-studio-micro text-studio-tertiary",children:"One click creates a dice room. You'll then install the free dddice browser extension to bridge rolls into your VTT."})]}),M[19]=$.error,M[20]=$.status,M[21]=Y,M[22]=V,M[23]=X,M[24]=J,M[25]=H,M[26]=D.dddice.roomSlug,M[27]=u):u=M[27],M[28]!==q?(m=()=>G(!q),M[28]=q,M[29]=m):m=M[29];let Z=`transition-transform ${q?"rotate-180":""}`;M[30]!==Z?(x=(0,r.jsx)(tz.A,{size:14,className:Z}),M[30]=Z,M[31]=x):x=M[31],M[32]!==m||M[33]!==x?(h=(0,r.jsxs)("button",{onClick:m,className:"flex items-center gap-1.5 text-sm text-studio-tertiary hover:text-studio-primary transition-colors",children:[x,"Advanced: Use your own dddice account"]}),M[32]=m,M[33]=x,M[34]=h):h=M[34],M[35]!==Q||M[36]!==H||M[37]!==D.dddice||M[38]!==q||M[39]!==K?(p=q&&(0,r.jsxs)("div",{className:"space-y-3 pl-4 border-l border-white/[0.06]",children:[(0,r.jsx)("p",{className:"text-studio-micro text-studio-tertiary",children:"If you already have a dddice account, enter your API key and room slug to use your existing setup."}),(0,r.jsxs)(sc,{children:[(0,r.jsx)(sd,{label:"API Key",description:"From dddice.com â My Account â Developers"}),(0,r.jsx)("input",{type:"password",className:sm+" max-w-xs",placeholder:"Enter dddice API key",value:D.dddice.apiKey??"",onChange:e=>K({dddice:{...D.dddice,apiKey:e.target.value}})})]}),(0,r.jsxs)(sc,{children:[(0,r.jsx)(sd,{label:"Room Slug",description:"Your existing dddice room"}),(0,r.jsx)("input",{className:sm+" max-w-xs",placeholder:"e.g. thursday-game",value:D.dddice.roomSlug??"",onChange:e=>K({dddice:{...D.dddice,roomSlug:e.target.value}})})]}),(0,r.jsx)("button",{onClick:Q,disabled:!D.dddice.apiKey||!D.dddice.roomSlug||H,className:"text-sm text-sky-400 hover:text-sky-300 transition-colors disabled:opacity-50",children:H?"Connecting...":"Connect with API Key"})]}),M[35]=Q,M[36]=H,M[37]=D.dddice,M[38]=q,M[39]=K,M[40]=p):p=M[40],M[41]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsx)(su,{}),f=(0,r.jsx)(so,{label:"Discord Webhook"}),g=(0,r.jsx)("p",{className:"text-studio-micro text-studio-tertiary -mt-4 mb-4",children:"Post dice rolls to a Discord channel. Create a webhook in your Discord channel settings."}),M[41]=b,M[42]=f,M[43]=g):(b=M[41],f=M[42],g=M[43]),M[44]===Symbol.for("react.memo_cache_sentinel")?(y=(0,r.jsx)(sd,{label:"Webhook URL"}),M[44]=y):y=M[44];let ee=D.discord.webhookUrl??"";return M[45]!==D.discord||M[46]!==K?(j=e=>K({discord:{...D.discord,webhookUrl:e.target.value}}),M[45]=D.discord,M[46]=K,M[47]=j):j=M[47],M[48]!==ee||M[49]!==j?(w=(0,r.jsxs)(sc,{children:[y,(0,r.jsx)("input",{className:sm+" max-w-md",placeholder:"https://discord.com/api/webhooks/...",value:ee,onChange:j})]}),M[48]=ee,M[49]=j,M[50]=w):w=M[50],M[51]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(sd,{label:"Enable Discord"}),M[51]=v):v=M[51],M[52]!==D.discord.webhookUrl||M[53]!==W?(N=(0,r.jsx)("button",{className:"text-sm text-sky-400 hover:text-sky-300 transition-colors",onClick:async()=>
2{if(!D.discord.webhookUrl)return;let e=await (0,sl.Q)(D.discord.webhookUrl);W({title:e?"Test roll sent!":"Webhook failed â check the URL",variant:e?"default":"destructive"})},children:"Test"}),M[52]=D.discord.webhookUrl,M[53]=W,M[54]=N):N=M[54],M[55]!==D.discord||M[56]!==K?(S=e=>K({discord:{...D.discord,enabled:e}}),M[55]=D.discord,M[56]=K,M[57]=S):S=M[57],M[58]!==D.discord.enabled||M[59]!==S?(C=(0,r.jsx)(tY.d,{checked:D.discord.enabled,onCheckedChange:S}),M[58]=D.discord.enabled,M[59]=S,M[60]=C):C=M[60],M[61]!==N||M[62]!==C?(_=(0,r.jsxs)(sc,{children:[v,(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[N,C]})]}),M[61]=N,M[62]=C,M[63]=_):_=M[63],M[64]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(su,{}),T=(0,r.jsx)(so,{label:"Roll Preferences"}),M[64]=A,M[65]=T):(A=M[64],T=M[65]),M[66]===Symbol.for("react.memo_cache_sentinel")?(I=(0,r.jsx)(sd,{label:"Include entity name",description:"Show creature/NPC name with rolls in VTT"}),M[66]=I):I=M[66],M[67]!==D.preferences||M[68]!==K?(P=e=>K({preferences:{...D.preferences,includeEntityName:e}}),M[67]=D.preferences,M[68]=K,M[69]=P):P=M[69],M[70]!==D.preferences.includeEntityName||M[71]!==P?(E=(0,r.jsxs)(sc,{children:[I,(0,r.jsx)(tY.d,{checked:D.preferences.includeEntityName,onCheckedChange:P})]}),M[70]=D.preferences.includeEntityName,M[71]=P,M[72]=E):E=M[72],M[73]===Symbol.for("react.memo_cache_sentinel")?(L=(0,r.jsx)(sd,{label:"Include action description",description:"Show attack/ability description with rolls in VTT"}),M[73]=L):L=M[73],M[74]!==D.preferences||M[75]!==K?(R=e=>K({preferences:{...D.preferences,includeActionDescription:e}}),M[74]=D.preferences,M[75]=K,M[76]=R):R=M[76],M[77]!==D.preferences.includeActionDescription||M[78]!==R?(U=(0,r.jsxs)(sc,{children:[L,(0,r.jsx)(tY.d,{checked:D.preferences.includeActionDescription,onCheckedChange:R})]}),M[77]=D.preferences.includeActionDescription,M[78]=R,M[79]=U):U=M[79],M[80]!==h||M[81]!==p||M[82]!==w||M[83]!==_||M[84]!==E||M[85
2]!==U||M[86]!==u?(z=(0,r.jsxs)("div",{className:"space-y-6 max-w-2xl",children:[c,d,u,h,p,b,f,g,w,_,A,T,E,U]}),M[80]=h,M[81]=p,M[82]=w,M[83]=_,M[84]=E,M[85]=U,M[86]=u,M[87]=z):z=M[87],z}let sh=(0,l.cn)("flex items-center gap-2 px-4 py-2.5 rounded-lg shrink-0","text-studio-control font-medium transition-all","text-studio-tertiary hover:text-studio-primary hover:bg-white/[0.04]","data-[state=active]:bg-sky-500/15 data-[state=active]:text-sky-300","data-[state=active]:border data-[state=active]:border-sky-400/20","data-[state=active]:shadow-none"),sp="mt-0 focus-visible:outline-none data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:slide-in-from-bottom-2 data-[state=active]:duration-300",sb=function(){let{user:e,isOwnProfile:t,activeTab:s,setActiveTab:a}=N(),n=(0,i.useMemo)(()=>e?.userId?{userId:e.userId}:void 0,[e?.userId]);return(0,r.jsxs)(eW.tU,{value:s,onValueChange:e=>a(e),children:[(0,r.jsx)("div",{className:"overflow-x-auto scrollbar-hide border-t border-white/[0.06] px-2 bg-black/20",children:(0,r.jsxs)(eW.j7,{className:(0,l.cn)("flex items-center gap-1 w-fit shrink-0","bg-transparent h-auto p-0"),children:[(0,r.jsxs)(eW.Xi,{value:"showcases",className:sh,children:[(0,r.jsx)(eu.A,{size:16,className:"shrink-0"}),(0,r.jsx)("span",{children:"Showcases"})]}),(0,r.jsxs)(eW.Xi,{value:"gallery",className:sh,children:[(0,r.jsx)(em.A,{size:16,className:"shrink-0"}),(0,r.jsx)("span",{children:"Gallery"})]}),(0,r.jsxs)(eW.Xi,{value:"progress",className:sh,children:[(0,r.jsx)(ex.A,{size:16,className:"shrink-0"}),(0,r.jsx)("span",{children:"Progress"})]}),t&&(0,r.jsxs)(eW.Xi,{value:"settings",className:sh,children:[(0,r.jsx)(eh.A,{size:16,className:"shrink-0"}),(0,r.jsx)("span",{children:"Settings"})]}),t&&(0,r.jsxs)(eW.Xi,{value:"vtt",className:sh,children:[(0,r.jsx)(ep.A,{size:16,className:"shrink-0"}),(0,r.jsx)("span",{children:"VTT"})]})]})}),(0,r.jsxs)("div",{className:"p-4 sm:p-5 lg:p-6",children:[(0,r.jsx)(eW.av,{value:"showcases",className:sp,children:(0,r.jsx)(eG,{username:e?.username,isOwnProfile:t})}),(0,r.jsx)(eW.av,{value:"gallery",className:sp,children:(0,r.jsx)(eb.default,{userGallery:t,defaultFilters:n,syncToUrl:!1})}),(0,r.jsx)(eW.av,{value:"progress",className:sp,children:(0,r.jsx)(tG,{})}),t&&(0,r.jsx)(eW.av,{value:"settings",className:sp,children:(0,r.jsx)(ss,{})}),t&&(0,r.jsx)(eW.av,{value:"vtt",className:sp,children:(0,r.jsx)("div",{className:"p-6",children:(0,r.jsx)(sx,{})})})]})]})};var sf=s(40757),sg=s(64144);function sy(){let e,t,s=(0,a.c)(2);return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"w-8 h-8 rounded-full bg-white/[0.06] animate-pulse shrink-0"}),s[0]=e):e=s[0],s[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,(0,r.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,r.jsx)("div",{className:"h-3.5 w-32 bg-white/[0.06] rounded animate-pulse"}),(0,r.jsx)("div",{className:"h-2.5 w-20 bg-white/[0.04] rounded animate-pulse"})]})]}),s[1]=t):t=s[1],t}function sj(e){let t,s,i,l,n,o,c,d,u=(0,a.c)(29),{user:m,onClose:x,showActions:h,isBlocked:p,onBlockStateChange:b}=e,f=m.stats?.["Images Generated"]??m.stats?.images_generated,g=null;if(null!=f){let e;u[0]!==f?(e=f.toLocaleString(),u[0]=f,u[1]=e):e=u[1],g=`${e} images \xb7 ${m.streak} day streak`}else m.streak>0&&(g=`${m.streak} day streak`);u[2]!==m.username?(t=m.username.slice(0,2).toUpperCase(),u[2]=m.username,u[3]=t):t=u[3];let y=t,j=`/profile/${encodeURIComponent(m.username)}`;return u[4]!==y||u[5]!==m.avatarUrl||u[6]!==m.username?(s=(0,r.jsx)("div",{className:"relative h-8 w-8 shrink-0",children:m.avatarUrl?(0,r.jsx)(R.default,{src:m.avatarUrl,alt:m.username,fill:!0,className:"rounded-full object-cover",sizes:"32px"}):(0,r.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-white/[0.06]",children:(0,r.jsx)("span",{className:"select-none text-studio-body font-medium text-studio-tertiary",children:y})})}),u[4]=y,u[5]=m.avatarUrl,u[6]=m.username,u[7]=s):s=u[7],u[8]!==m.username?(i=(0,r.jsx)("p",{className:"truncate text-studio-body font-medium text-studio-primary",children:m.username}),u[8]=m.username,u[9]=i):i=u[9],u[10]!==g?(l=g&&(0,r.jsx)("p",{className:"mt-0.5 truncate text-studio-micro text-studio-tertiary",children:g}),u[10]=g,u[11]=l):l=u[11],u[12]!==i||u[13]!==l?(n=(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[i,l]}),u[12]=i,u[13]=l,u[14]=n):n=u[14],u[15]!==x||u[16]!==j||u[17]!==s||u[18]!==n?(o=(0,r.jsxs)(z(),{href:j,onClick:x,className:"flex min-w-0 flex-1 items-center gap-3",children:[s,n]}),u[15]=x,u[16]=j,u[17]=s,u[18]=n,u[19]=o):o=u[19],u[20]!==p||u[21]!==b||u[22]!==h||u[23]!==m.userId||u[24]!==m.username?(c=h&&(0,r.jsx)(M.IX,{targetUserId:m.userId,username:m.username,isBlocked:p,onBlockStateChange:b}),u[20]=p,u[21]=b,u[22]=h,u[23]=m.userId,u[24]=m.username,u[25]=c):c=u[25],u[26]!==o||u[27]!==c?(d=(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-lg px-4 py-3 transition-colors hover:bg-white/[0.04]",children:[o,c]}),u[26]=o,u[27]=c,u[28]=d):d=u[28],d}function sw(){var e,t;let s,n,o,d,u,m,b,f,g,y,j,w,v,k,S,C,_,A,T,I,P,E,L,R,U,z,M,D,O,F,$,B,q,G,W,K,V,Q,X,J,H,Z,ee=(0,a.c)(73),{state:et}=(0,c.As)(),{user:es,isOwnProfile:er,socialModal:ea,closeSocialModal:ei}=N(),[el,en]=(0,i.useState)(ea.tab),[eo,ec]=(0,i.useState)("");ee[0]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,ee[0]=s):s=ee[0];let[ed,eu]=(0,i.useState)(s);ee[1]!==ea.open||ee[2]!==ea.tab?(n=()=>{ea.open&&en(ea.tab)},o=[ea.tab,ea.open],ee[1]=ea.open,ee[2]=ea.tab,ee[3]=n,ee[4]=o):(n=ee[3],o=ee[4]),(0,i.useEffect)(n,o),ee[5]!==ea.open?(d=()=>{ea.open||(ec(""),eu(new Set))},u=[ea.open],ee[5]=ea.open,ee[6]=d,ee[7]=u):(d=ee[6],u=ee[7]),(0,i.useEffect)(d,u);let em=ea.open&&!!es?.userId,{data:ex,isLoading:eh}=(e=es?.userId,(K=(0,a.c)(8))[0]!==e?(q=p.e.followers(e??""),K[0]=e,K[1]=q):q=K[1],K[2]!==e?(G=async()=>{let t=await (0,h.getFollowersPage)(e,0,50);return"error"in t?{users:[],total:0}:{users:t.content,total:t.totalElements}},K[2]=e,K[3]=G):G=K[3],V=void 0!==em&&em&&!!e,K[4]!==q||K[5]!==G||K[6]!==V?(W={queryKey:q,queryFn:G,enabled:V,staleTime:3e4},K[4]=q,K[5]=G,K[6]=V,K[7]=W):W=K[7],(0,x.I)(W)),{data:ep,isLoading:eb}=(t=es?.userId,(H=(0,a.c)(8))[0]!==t?(Q=p.e.following(t??""),H[0]=t,H[1]=Q):Q=H[1],H[2]!==t?(X=async()=>{let e=await (0,h.getFollowingPage)(t,0,50);return"error"in e?{users:[],total:0}:{users:e.content,total:e.totalElements}},H[2]=t,H[3]=X):X=H[3],Z=void 0!==em&&em&&!!t,H[4]!==Q||H[5]!==X||H[6]!==Z?(J={queryKey:Q,queryFn:X,enabled:Z,staleTime:3e4},H[4]=Q,H[5]=X,H[6]=Z,H[7]=J):J=H[7],(0,x.I)(J)),ef="followers"===el?eh:eb;ee[8]!==el||ee[9]!==ex?.users||ee[10]!==ep?.users?(m="followers"===el?ex?.users??[]:ep?.users??[],ee[8]=el,ee[9]=ex?.users,ee[10]=ep?.users,ee[11]=m):m=ee[11];let eg=m;
2ee[12]!==eg?(b=eg.map(sN),ee[12]=eg,ee[13]=b):b=ee[13];let ey=b,ej=(0,Y.Zf)(ey,ea.open&&er&&et.isLoggedIn);ee[14]!==ej.data?(f=ej.data??new Set,ee[14]=ej.data,ee[15]=f):f=ee[15];let ew=f;if(ee[16]!==ed||ee[17]!==eo||ee[18]!==eg){let e=eo.toLowerCase();g=eg.filter(t=>!ed.has(t.userId)&&(!eo.trim()||t.username.toLowerCase().includes(e))),ee[16]=ed,ee[17]=eo,ee[18]=eg,ee[19]=g}else g=ee[19];let ev=g,eN=ex?.total??0,ek=ep?.total??0,eS="followers"===el?"No followers yet":"Not following anyone";eo.trim()&&(eS="No users match your search");let eC=ea.open;ee[20]!==ei?(y=e=>!e&&ei(),ee[20]=ei,ee[21]=y):y=ee[21],ee[22]===Symbol.for("react.memo_cache_sentinel")?(j=(0,l.cn)("max-w-md w-full p-0 gap-0","!bg-studio-surface-1 border border-white/[0.08]","rounded-xl shadow-[0_8px_40px_rgba(0,0,0,0.6)] backdrop-blur-2xl"),ee[22]=j):j=ee[22];let e_="followers"===el?"Followers":"Following";ee[23]!==e_?(w=(0,r.jsx)(sg.L3,{className:"text-studio-heading font-semibold text-studio-primary",children:e_}),ee[23]=e_,ee[24]=w):w=ee[24];let eA="followers"===el?"follow this profile":"this profile is following";ee[25]!==eA?(v=(0,r.jsxs)(sg.rr,{className:"sr-only",children:["Browse users who"," ",eA]}),ee[25]=eA,ee[26]=v):v=ee[26],ee[27]!==w||ee[28]!==v?(k=(0,r.jsxs)(sg.c7,{className:"px-5 pt-5 pb-4",children:[w,v]}),ee[27]=w,ee[28]=v,ee[29]=k):k=ee[29],ee[30]===Symbol.for("react.memo_cache_sentinel")?(S=(0,r.jsx)("div",{className:"h-px bg-white/[0.06]"}),ee[30]=S):S=ee[30],ee[31]===Symbol.for("react.memo_cache_sentinel")?(C=()=>en("followers"),ee[31]=C):C=ee[31];let eT="followers"===el?"bg-sky-500/15 text-sky-300 border-sky-400/20":"text-studio-tertiary hover:text-studio-primary border-transparent";ee[32]!==eT?(_=(0,l.cn)("px-4 py-1.5 rounded-lg text-studio-body font-medium transition-colors border",eT),ee[32]=eT,ee[33]=_):_=ee[33],ee[34]!==eN?(A=eN>0&&(0,r.jsx)("span",{className:"ml-1.5 text-studio-micro opacity-70",children:eN.toLocaleString()}),ee[34]=eN,ee[35]=A):A=ee[35],ee[36]!==_||ee[37]!==A?(T=(0,r.jsxs)("button",{onClick:C,className:_,children:["Followers",A]}),ee[36]=_,ee[37]=A,ee[38]=T):T=ee[38],ee[39]===Symbol.for("react.memo_cache_sentinel")?(I=()=>en("following"),ee[39]=I):I=ee[39];let eI="following"===el?"bg-sky-500/15 text-sky-300 border-sky-400/20":"text-studio-tertiary hover:text-studio-primary border-transparent";return ee[40]!==eI?(P=(0,l.cn)("px-4 py-1.5 rounded-lg text-studio-body font-medium transition-colors border",eI),ee[40]=eI,ee[41]=P):P=ee[41],ee[42]!==ek?(E=ek>0&&(0,r.jsx)("span",{className:"ml-1.5 text-studio-micro opacity-70",children:ek.toLocaleString()}),ee[42]=ek,ee[43]=E):E=ee[43],ee[44]!==P||ee[45]!==E?(L=(0,r.jsxs)("button",{onClick:I,className:P,children:["Following",E]}),ee[44]=P,ee[45]=E,ee[46]=L):L=ee[46],ee[47]!==T||ee[48]!==L?(R=(0,r.jsxs)("div",{className:"flex gap-2 px-5 pt-4",children:[T,L]}),ee[47]=T,ee[48]=L,ee[49]=R):R=ee[49],ee[50]===Symbol.for("react.memo_cache_sentinel")?(U=(0,r.jsx)(sf.A,{size:16,className:"absolute left-8 top-1/2 -translate-y-1/2 text-studio-tertiary pointer-events-none mt-0.5"}),ee[50]=U):U=ee[50],ee[51]===Symbol.for("react.memo_cache_sentinel")?(z=e=>ec(e.target.value),M=(0,l.cn)("w-full pl-8 pr-3 py-2 rounded-lg","bg-white/[0.04] border border-white/[0.06]","text-studio-body text-studio-primary","placeholder:text-studio-placeholder","outline-none focus:border-white/[0.1] transition-colors"),ee[51]=z,ee[52]=M):(z=ee[51],M=ee[52]),ee[53]!==eo?(D=(0,r.jsxs)("div",{className:"relative px-5 pt-3 pb-2",children:[U,(0,r.jsx)("input",{type:"text",placeholder:"Search by usernameâ¦",value:eo,onChange:z,className:M})]}),ee[53]=eo,ee[54]=D):D=ee[54],ee[55]!==ew||ee[56]!==ei||ee[57]!==eS||ee[58]!==ev||ee[59]!==ef||ee[60]!==er?(O=ef?(0,r.jsx)(r.Fragment,{children:Array.from({length:5}).map(sv)}):0===ev.length?(0,r.jsx)("div",{className:"flex items-center justify-center py-10",children:(0,r.jsx)("p",{className:"text-studio-body text-studio-tertiary",children:eS})}):ev.map(e=>(0,r.jsx)(sj,{user:e,onClose:ei,showActions:er,isBlocked:ew.has(e.userId),onBlockStateChange:t=>{t&&eu(t=>{let s=new Set(t);return s.add(e.userId),s})}}
2,e.userId)),ee[55]=ew,ee[56]=ei,ee[57]=eS,ee[58]=ev,ee[59]=ef,ee[60]=er,ee[61]=O):O=ee[61],ee[62]!==O?(F=(0,r.jsx)("div",{className:"max-h-[60vh] overflow-y-auto px-1 pb-3",children:O}),ee[62]=O,ee[63]=F):F=ee[63],ee[64]!==k||ee[65]!==R||ee[66]!==D||ee[67]!==F?($=(0,r.jsxs)(sg.Cf,{className:j,children:[k,S,R,D,F]}),ee[64]=k,ee[65]=R,ee[66]=D,ee[67]=F,ee[68]=$):$=ee[68],ee[69]!==ea.open||ee[70]!==y||ee[71]!==$?(B=(0,r.jsx)(sg.lG,{open:eC,onOpenChange:y,children:$}),ee[69]=ea.open,ee[70]=y,ee[71]=$,ee[72]=B):B=ee[72],B}function sv(e,t){return(0,r.jsx)(sy,{},t)}function sN(e){return e.userId}function sk(){let e,t,s,i,l,n=(0,a.c)(5);return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"w-20 h-20 rounded-full bg-white/[0.06]"}),n[0]=e):e=n[0],n[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsxs)("div",{className:"flex items-start gap-4",children:[e,(0,r.jsxs)("div",{className:"flex-1 space-y-2 pt-1",children:[(0,r.jsx)("div",{className:"h-7 w-40 bg-white/[0.06] rounded"}),(0,r.jsx)("div",{className:"h-4 w-28 bg-white/[0.04] rounded"})]})]}),n[1]=t):t=n[1],n[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsxs)("div",{className:"flex flex-col md:flex-row",children:[(0,r.jsxs)("div",{className:"flex-1 p-6 space-y-4",children:[t,(0,r.jsxs)("div",{className:"flex gap-4",children:[(0,r.jsx)("div",{className:"h-8 w-28 bg-white/[0.04] rounded-lg"}),(0,r.jsx)("div",{className:"h-8 w-28 bg-white/[0.04] rounded-lg"}),(0,r.jsx)("div",{className:"h-8 w-24 bg-white/[0.04] rounded-lg"})]}),(0,r.jsx)("div",{className:"h-4 w-64 bg-white/[0.04] rounded"})]}),(0,r.jsx)("div",{className:"md:w-[50%] aspect-[4/3] bg-white/[0.04]"})]}),n[2]=s):s=n[2],n[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsxs)("div",{className:"border-t border-white/[0.06] px-4 flex gap-2 py-2",children:[(0,r.jsx)("div",{className:"h-9 w-28 bg-white/[0.04] rounded-lg"}),(0,r.jsx)("div",{className:"h-9 w-24 bg-white/[0.04] rounded-lg"}),(0,r.jsx)("div",{className:"h-9 w-24 bg-white/[0.04] rounded-lg"})]}),n[3]=i):i=n[3],n[4]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)("div",{className:"max-w-[1400px] mx-auto px-4 sm:px-6 lg:px-8 py-8 animate-pulse",children:(0,r.jsxs)("div",{className:"rounded-2xl bg-studio-surface-2/40 border border-white/[0.08] overflow-hidden",children:[s,i,(0,r.jsx)("div",{className:"p-6",children:(0,r.jsx)("div",{className:"h-48 bg-white/[0.03] rounded-xl"})})]})}),n[4]=l):l=n[4],l}function sS(){let e,t=(0,a.c)(3),{user:s,isLoading:i}=N();if(i){let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(sk,{}),t[0]=e):e=t[0],e}if(!s){let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{className:"flex items-center justify-center py-24 text-studio-tertiary text-studio-body",children:"User not found"}),t[1]=e):e=t[1],e}return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsxs)(n,{duration:400,className:"max-w-[1400px] mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[(0,r.jsxs)("div",{className:"rounded-2xl bg-studio-surface-2/40 border border-white/[0.10] shadow-lg shadow-black/30 overflow-hidden",children:[(0,r.jsx)(ed,{}),(0,r.jsx)(sb,{})]}),(0,r.jsx)(sw,{})]}),t[2]=e):e=t[2],e}function sC(e){let t,s,i=(0,a.c)(3),{ssrUser:l}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(sS,{}),i[0]=t):t=i[0],i[1]!==l?(s=(0,r.jsx)(v,{ssrUser:l,children:t}),i[1]=l,i[2]=s):s=i[2],s}},17324:(e,t,s)=>{s.d(t,{VI:()=>o,aC:()=>l,m9:()=>n});var r=s(56371),a=s(27344),i=s(10236);let l=async()=>{try{let e=await (0,r.Lk)({name:"fetchAllTasks"},async()=>await (0,i.gN)("/api/tasks",!0));if(e.error)return(0,i.TA)(e.error),{error:e.error};return{tasks:e.data.tasks,dailyTasks:e.data.dailyTasks}}catch(e){return(0,a.Cp)(e),{error:"Failed to fetch tasks"}}},n=async e=>{try{let t=await (0,r.Lk)({name:"fetchCompletedTasks"},async()=>await (0,i.gN)(`/api/tasks/${e}/completed`,!1));if(t.error)return(0,i.TA)(t.error),{tasks:[],error:t.error};return{tasks:t.data}}catch(e){return(0,a.Cp)(e),{tasks:[],error:"Failed to fetch tasks"}}},o=async e=>{try{let t=await (0,r.Lk)({name:"claimTaskReward"},async()=>await (0,i.mQ)(`/api/tasks/${e}/claim`,!0,{taskId:e}));if(t.error)return(0,i.TA)(t.error),{error:t.error};return{success:!0}}catch(e){return(0,a.Cp)(e),{error:"Failed to claim reward"}}}},24564:(e,t,s)=>{s.d(t,{b:()=>a});
2let r="https://dddice.com/api/1.0";class a{constructor(e){this.token=null,this.roomSlug=null,this.diceTheme=null,this._state={status:"disconnected"},this.onStateChange=e}get state(){return this._state}setState(e){this._state=e,this.onStateChange?.(e)}static async createGuestUser(){let e=await fetch(`${r}/user`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error(`Guest creation failed: ${e.status}`);return(await e.json()).data}static async createRoom(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"CharGen Room",s=await fetch(`${r}/room`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({is_public:!0,name:t})});if(!s.ok)throw Error(`Room creation failed: ${s.status}`);return(await s.json()).data.slug}static async getUserTheme(e){let t=await fetch(`${r}/dice-box`,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok)return"dddice-bees";let s=await t.json();return s.data?.[0]?.id??"dddice-bees"}async connect(e,t,s){this.setState({status:"connecting"});try{this.token=e,this.roomSlug=t,this.diceTheme=s??await a.getUserTheme(e),this.setState({status:"connected",roomSlug:t})}catch(e){throw this.setState({status:"error",error:e instanceof Error?e.message:String(e)}),e}}async disconnect(){this.token=null,this.roomSlug=null,this.diceTheme=null,this.setState({status:"disconnected"})}async sendRoll(e){if(!this.token||!this.roomSlug||"connected"!==this._state.status)return;let t=[];e.context.entityName&&t.push(e.context.entityName);let s=e.context.actionName||e.context.abilityName||"";s&&t.push(s),"custom"!==e.context.rollType&&t.push(`(${e.context.rollType})`);let a=t.join(" â "),i=this.buildDice(e);try{await fetch(`${r}/roll`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`},body:JSON.stringify({dice:i,room:this.roomSlug,label:a})})}catch{}}buildDice(e){let t,s=this.diceTheme??"dddice-bees",r=[],a=/(\d*)d(\d+)/gi,i=0;for(;null!==(t=a.exec(e.notation));){let a=parseInt(t[1]||"1",10),l=t[2];for(let t=0;t<a;t++)r.push({type:`d${l}`,theme:s,value:e.rolls[i]??void 0}),i++}return 0===r.length&&r.push({type:"d20",theme:s,value:e.rolls[0]??void 0}),0!==e.modifier&&r.push({type:"mod",theme:s,value:e.modifier}),r}}},25564:(e,t,s)=>{s.d(t,{dj:()=>u});var r=s(12115);let a=0,i=new Map,l=e=>{if(i.has(e))return;let t=setTimeout(()=>{i.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);i.set(e,t)},n=[],o={toasts:[]};function c(e){o=((e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:s}=t;return s?l(s):e.toasts.forEach(e=>{l(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}})(o,e),n.forEach(e=>{e(o)})}function d(e){let{...t}=e,s=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),r=()=>c({type:"DISMISS_TOAST",toastId:s});return c({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:e=>{e||r()}}}),{id:s,dismiss:r,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:s}})}}function u(){let[e,t]=r.useState(o);return r.useEffect(()=>(n.push(t),()=>{let e=n.indexOf(t);e>-1&&n.splice(e,1)}),[e]),{...e,toast:d,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}},72278:(e,t,s)=>{s.d(t,{pf:()=>n,wN:()=>l});var r=s(78254);let a="chargen-vtt-settings";function i(){return{dddice:{enabled:!1},discord:{enabled:!1},preferences:{includeEntityName:!0,includeActionDescription:!0}}}function l(){try{let e=localStorage.getItem(a);return e?{...i(),...JSON.parse(e)}:i()}catch{return i()}}function n(e){(0,r.bl)(a,JSON.stringify(e))}},74454:(e,t,s)=>{s.d(t,{AX:()=>o,Ir:()=>l,bA:()=>c,fq:()=>m,he:()=>d,p6:()=>n,s2:()=>u});var r=s(56371),a=s(27344),i=s(10236);let l=async()=>{try{let e=await (0,r.Lk)({name:"getUnseenChangelogs"},async()=>(0,i.gN)("/api/user-changelog-views/unseen",!0));if(e.error)return(0,i.TA)(e.error),{error:e.error};return{unseenChangelogs:e.data}}catch(e){return(0,a.Cp)(e),{error:"Failed to get changelogs."}}},n=async e=>{let t=`/api/user-changelog-views/${e}/seen`;try{let{error:e}=await (0,r.Lk)({name:"markChangelogSeen"},()=>(0,i.mQ)(t,!0,{}));if(e)return(0,i.TA)(e),{error:"Failed to mark changelog as seen."};return{}}catch(e){if((0,a.Cp)(e),"User is not logged in."===e)return{error:e};return{error:"Failed to mark changelog as seen."}}},o=async()=>{try{let e=await (0,r.Lk)({name:"getUnreadNotifications"},async()=>(0,i.gN)("/api/notifications",!0));if(e.error)return(0,i.TA)(e.error),{error:e.error};return{notifications:e.data}}catch(e){return(0,a.Cp)(e),{error:"Failed to retrieve unread notifications."}}},c=async e=>{let t=`/api/notifications/${e}/read`;try{let e=await (0,r.Lk)({name:"markNotificationAsRead"},async()=>(0,i.mQ)(t,!0,{}));if(e.error)return{error:e.error};return{notification:e.data}}catch(e){return(0,a.Cp)(e),{error:"Failed to mark notification as read."}}},d=async()=>{try{let e=await (0,r.Lk)({name:"markAllNotificationsAsRead"},async()=>(0,i.mQ)("/api/notifications/read/all",!0,{}));if(e.error)return{error:e.error};return{notifications:e.data}}catch(e){return(0,a.Cp)(e),{error:"Failed to mark all notifications as read."}}},u=async()=>{try{let e=await (0,r.Lk)({name:"getNotificationPreferences"},async()=>(0,i.gN)("/api/notifications/preferences",!0));if(e.error)return(0,i.TA)(e.error),{error:e.error};return{preferences:e.data}}catch(e){return(0,a.Cp)(e),{error:"Failed to retrieve notification preferences."}}},m=async e=>{try{let t={disabledTypes:e},s=await (0,r.Lk)({name:"updateNotificationPreferences"},async()=>(0,i.ju)("/api/notifications/preferences",!0,t));if(s.error)return(0,i.TA)(s.error),{error:s.error};return{preferences:s.data}}catch(e){return(0,a.Cp)(e),{error:"Failed to update notification preferences."}}}},86564:(e,t,s)=>{s.d(t,{$9:()=>S,Au:()=>k,SQ:()=>N,Yl:()=>T,fw:()=>_,hy:()=>C,qn:()=>v,rv:()=>A});var r=s(13018),a=s(53561),i=s(54792),l=s(30855),n=s(25780),o=s(43245),c=s(83535),d=s(10487),u=s(47938),m=s(27916),x=s(69988),h=s(7478),p=s(93857),b=s(52014),f=s(21853),g=s(44882),y=s(46011),j=s(61848),w=s(22136);let v={all:["notifications"],unread:()=>[...v.all,"unread"],preferences:()=>[...v.all,"preferences"]},N={[w._n.COMMENT]:{icon:l.A,label:"Comments",description:"When someone comments on your images",group:"social",iconColor:"text-sky-400"},[w._n.REPLY]:{icon:n.A,label:"Replies",description:"When someone replies to your comments",group:"social",iconColor:"text-sky-400"},[w._n.FOLLOW]:{icon:o.A,label:"New Followers",description:"When someone follows you",group:"social",iconColor:"text-sky-400"},[w._n.LIKE]:{icon:c.A,label:"Likes",description:"When someone likes your images",group:"social",iconColor:"text-rose-400"},[w._n.FOLLOWER_IMAGE]:{icon:d.A,label:"Followed Users",description:"When people you follow post new images",group:"content"},[w._n.IMAGE]:{icon:u.A,label:"Images",description:"When your images are generated",group:"content"},[w._n.VIDEO]:{icon:m.A,label:"Videos",description:"When your videos are ready",group:"content"},[w._n.AUDIO]:{icon:x.A,label:"Audio",description:"When your audio is generated",group:"content"},[w._n.MODEL_3D]:{icon:h.A,label:"3D Models",description:"When your 3D models are ready",group:"content"},[w._n.REQUEST_EXPIRED]:{icon:p.A,label:"Expired Requests",description:"When your request expires and is refunded",group:"content",iconColor:"text-amber-400"},[w._n.REQUEST_FAILED]:{icon:b.A,label:"Failed Requests",description:"When your request fails and is refunded",group:"content",iconColor:"text-red-400"},[w._n.LORA_CREATED]:{icon:f.A,label:"LoRA Ready",description:"When your custom LoRA is ready to use",group:"loras",iconColor:"text-violet-400"},[w._n.LORA_LIKED]:{icon:g.A,label:"LoRA Likes",description:"When someone likes your LoRA",group:"loras",iconColor:"text-violet-400"},[w._n.LORA_USED]:{icon:g.A,label:"LoRA Usage",description:"When someone uses your LoRA",group:"loras",iconColor:"text-violet-400"}
2,[w._n.COMPETITION]:{icon:y.A,label:"Competitions",description:"Updates about competitions you entered",group:"rewards",iconColor:"text-amber-400"},[w._n.PRIZE]:{icon:y.A,label:"Prizes",description:"When you win prizes or rewards",group:"rewards",iconColor:"text-amber-400"},[w._n.TASK]:{icon:j.A,label:"Tasks",description:"Task completion and daily rewards",group:"rewards"},[w._n.DISCORD_LINK_BROKEN]:{icon:b.A,label:"Discord channel stopped working",description:"When CharGen can no longer post to a campaign's Discord channel",group:"content",iconColor:"text-amber-400"}},k={social:"Social",content:"Content",loras:"LoRAs",rewards:"Rewards"},S=[{key:"all",label:"All"},{key:"social",label:"Social"},{key:"content",label:"Content"},{key:"rewards",label:"Rewards"}];function C(e){let{relatedEntityId:t,type:s,relatedUsername:r}=e;return["COMMENT","IMAGE","REPLY","LIKE","VIDEO","AUDIO","MODEL_3D"].includes(s)?`/images/${t}`:"PRIZE"===s||"COMPETITION"===s?`/competitions/${t}`:"FOLLOW"===s?`/profile/${r}`:"FOLLOWER_IMAGE"===s?t?`/images/${t}`:r?`/profile/${r}`:"#":"TASK"===s?"/profile":"REQUEST_FAILED"===s||"REQUEST_EXPIRED"===s?"/generate":"LORA_CREATED"===s||"LORA_LIKED"===s||"LORA_USED"===s?`/loras/${t}`:"DISCORD_LINK_BROKEN"===s&&t?`/campaigns/${t}`:"#"}function _(e){let t=(0,r.H)(e),s=new Date,l=(0,a.O)(s,t);return l<60?`${Math.floor(l)}s ago`:l<3600?`${Math.floor(l/60)}m ago`:l<86400?`${Math.floor(l/3600)}h ago`:l<604800?`${Math.floor(l/86400)}d ago`:(0,i.GP)(t,"MMM dd, yyyy")}function A(e,t){return"all"===t?e:e.filter(e=>{let s=N[e.type];return s?.group===t})}function T(e){let t={social:[],content:[],loras:[],rewards:[]};return e.forEach(e=>{let s=N[e];
2s&&t[s.group].push({type:e,info:s})}),t}},98357:(e,t,s)=>{s.d(t,{Bl:()=>n,Yv:()=>r.A});var r=s(66123),a=s(22136);let i={[a.b.NONE]:"border border-slate-400",[a.b.BASIC]:"border-2 border-sky-700",[a.b.PLUS]:"border-2 border-red-600",[a.b.PRO]:"border-2 border-red-600 animate-subtlePulse",[a.b.ELITE]:"p-[3px] bg-gradient-to-r from-emerald-500 via-amber-600 to-sky-500 animate-subtlePulse",[a.b.ULTIMATE]:"p-[3px] bg-gradient-to-r from-[#0268A3] via-red-600 to-amber-500 animate-gradient animate-subtlePulse"},l={...i,[a.b.PRO]:"border-2 border-red-600 animate-subtlePulse",[a.b.ELITE]:"p-[3px] bg-gradient-to-r from-emerald-500 via-amber-600 to-sky-500 animate-subtlePulse",[a.b.ULTIMATE]:"p-[3px] bg-gradient-to-r from-[#0268A3] via-red-600 to-amber-500 animate-gradient animate-subtlePulse"};function n(e,t){return t?l[e]:i[e]}}}]);
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.