1import{aV as O,j as e,b as _,aW as B,r as a,ex as b,z as L,eV as D,cf as G,dz as X,be as Y,U as Z,k as q,bv as J,dA as K,eX as Q,L as ee,dx as se}from"./index-BawMCgu8.js";import"./locale-en-B8Z5F_o1.js";import"./locale-zh-CN-CFdD1mPv.js";import"./locale-fr-j4CMJpfE.js";import"./locale-de-DuE2gagy.js";import"./locale-it-C6yb6RzN.js";import"./locale-ja-VjZBy5eF.js";import"./locale-ko-Cl0W-Az5.js";import"./locale-es-DwboUZze.js";import"./locale-zh-Hant-uT5aTnfX.js";import"./locale-ru-DEr1xfTZ.js";import"./locale-id-Buh3Uolz.js";import"./locale-pt-BR-CqD5J4_0.js";const P=18;function te({userId:l}){var A;const{t:r,i18n:j}=_(),N=B(),[n,w]=a.useState(null),[g,R]=a.useState(!0),[E,F]=a.useState(!1),[c,x]=a.useState(null),[$,k]=a.useState(!1),[p,y]=a.useState([]),[M,C]=a.useState(!0),[z,S]=a.useState(!1),[I,U]=a.useState(!0),T=a.useRef(1),m=a.useRef(!1);a.useEffect(()=>{if(!l)return;let s=!1;return b.getAuthorProfile(l).then(t=>{s||w(t)}).catch(()=>{}).finally(()=>{s||R(!1)}),()=>{s=!0}},[l]);const f=a.useCallback(async s=>{if(!(m.current||!l)){m.current=!0,s===1?C(!0):S(!0);try{const t=await b.list({userId:l,page:s,pageSize:P}),d=Array.isArray(t==null?void 0:t.items)?t.items:[];y(H=>s===1?d:[...H,...d]),T.current=s,U(s*P<((t==null?void 0:t.total)??0))}catch{U(!1)}finally{m.current=!1,C(!1),S(!1)}}},[l]);a.useEffect(()=>{f(1)},[f]);const u=a.useRef(null),W=a.useCallback(s=>{u.current&&(u.current.disconnect(),u.current=null),s&&(u.current=new IntersectionObserver(t=>{var d;(d=t[0])!=null&&d.isIntersecting&&!m.current&&f(T.current+1)}),u.current.observe(s))},[f]),V=a.useCallback(async()=>{if(c){k(!0);try{await b.unpublish(c.id),y(s=>s.filter(t=>t.id!==c.id)),w(s=>s&&{...s,stats:{...s.stats,workCount:Math.max(0,s.stats.workCount-1)}}),L.success(r("tv.unpublishSuccess","Work taken down")),x(null)}catch{L.error(r("tv.unpublishFailed","Failed to take down"))}finally{k(!1)}}},[c,r]),i=n==null?void 0:n.user,o=n==null?void 0:n.stats,h=((A=i==null?void 0:i.name)==null?void 0:A.trim())||`${r("tv.userpage.anonymous","Creator")} ${l.slice(0,6)}`,v=(n==null?void 0:n.featuredCoverUrl)??null;return e.jsxs("div",{className:"min-h-screen bg-background text-foreground pb-16",children:[e.jsx(D,{title:(i==null?void 0:i.name)||r("tv.userpage.title","Creator profile"),description:r("tv.userpage.title","Creator profile"),path:`/app/design/tv/user/${l}`}),e.jsxs("div",{className:"relative h-60 sm:h-72 w-full overflow-hidden",children:[v&&!E&&e.jsx("img",{src:v,alt:"","aria-hidden":!0,crossOrigin:G(v)?"anonymous":void 0,onError:()=>F(!0),className:"absolute inset-0 w-full h-full object-cover blur-2xl scale-110 opacity-40"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-800/30 via-fuchsia-700/10 to-transparent"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background via-background/40 to-transparent"})]}),e.jsxs("div",{className:"max-w-7xl mx-auto px-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end gap-4 -mt-16 sm:-mt-20 relative z-10",children:[e.jsx("div",{className:`w-28 h-28 sm:w-32 sm:h-32 rounded-full ring-4 ring-background overflow-hidden bg-muted flex items-center justify-center shrink-0 ${g?"animate-pulse":""}`,children:g?null:i!=null&&i.avatarUrl?e.jsx(X,{url:i.avatarUrl,alt:h,className:"w-full h-full object-cover"}):e.jsx("span",{className:"text-3xl font-semibold text-muted-foreground",children:h.charAt(0).toUpperCase()})}),e.jsx("div",{className:"flex-1 min-w-0 pb-1",children:g?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-8 w-40 sm:w-52 rounded-lg bg-muted animate-pulse"}),e.jsx("div",{className:"h-4 w-60 rounded bg-muted animate-pulse"})]}):e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold tracking-tight truncate",children:h}),e.jsxs("div",{className:"flex items-center gap-6 mt-3 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Y,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"font-semibold",children:(o==null?void 0:o.workCount)??0}),e.jsx("span",{className:"text-muted-foreground",children:r("tv.userpage.works","Works")})]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Z,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"font-semibold",children:(o==null?void 0:o.likeTotal)??0}),e.jsx("span",{className:"text-muted-foreground",children:r("tv.userpage.likes","Likes")})]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(q,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"font-semibold",children:(o==null?void 0:o.usedTotal)??0}),e.jsx("span",{className:"text-muted-foreground",children:r("tv.userpage.used","Used")})]})]})]})}),(n==null?void 0:n.isSelf)&&e.jsxs("button",{onClick:()=>N(`/${j.language}/app/profile`),className:"shrink-0 inline-flex items-center gap-1.5 px-4 py-2 rounded-full bg-muted hover:bg-muted/70 text-sm font-medium transition-colors self-start sm:self-end",children:[e.jsx(J,{className:"w-3.5 h-3.5"}),r("tv.userpage.editProfile","Edit profile")]})]}),e.jsx("div",{className:"mt-10",children:M?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5",children:Array.from({length:6}).map((s,t)=>e.jsx("div",{className:"aspect-[16/9] rounded-2xl bg-muted animate-pulse"},t))}):p.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[e.jsx(K,{className:"w-12 h-12 text-muted-foreground
1/40 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r("tv.userpage.empty","No published works yet")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5",children:p.map(s=>e.jsx(Q,{work:s,owned:!!(n!=null&&n.isSelf),onUnpublish:t=>x(t),onClick:t=>N(`/${j.language}/app/design/tv/${t.id}`,{state:{work:t,feedItems:p.slice(0,12)}})},s.id))}),I&&e.jsx("div",{ref:W,className:"flex justify-center py-8",children:z&&e.jsx(ee,{className:"w-6 h-6 animate-spin text-muted-foreground"})})]})})]}),e.jsx(se,{open:!!c,onConfirm:V,onCancel:()=>x(null),title:r("tv.unpublishTitle","Take down this work?"),message:r("tv.unpublishConfirm","After taking down, this work will no longer appear on Uni TV or your profile. You can re-publish it from the canvas later."),confirmLabel:r("tv.unpublish","Take down"),variant:"danger",loading:$})]})}function pe(){const{userId:l=""}=O();return e.jsx(te,{userId:l},l)}export{pe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.