import{B as e,C as t,D as n,E as r,F as i,Q as a,S as o,U as s,Y as c,a as l,b as u,et as d,g as f,i as p,p as m,q as h}from"./app-CpRUhcKv.js";import{t as g}from"./i18n-CP5tNMAD.js";import{n as _}from"./toast-BFCSnbFC.js";import{t as v}from"./UploadButton-Cy1rdVWW.js";import{n as y}from"./upload-CsRIgK58.js";import{t as b}from"./InputLabel-BFAJPFoM.js";var x={class:`text-lg font-medium text-gray-900 dark:text-gray-100`},S={class:`mt-1 text-sm text-gray-600 dark:text-gray-400`},C={class:`mt-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700`},w={class:`h-28 w-full bg-gradient-to-r from-indigo-500 to-violet-500`},T=[`src`],E={class:`mt-2 flex items-center gap-4`},D=[`src`],O={key:1,class:`grid h-16 w-16 place-items-center rounded-full bg-indigo-500 font-bold text-white`},k=[`placeholder`],A={class:`mt-1 text-xs text-gray-500`},j={class:`text-sm text-gray-500 dark:text-gray-400`},M={key:0},N={key:1},P=n({__name:`ProfileDetailsForm`,setup(n){let d=l().props.auth?.user??{},P=p({bio:d.bio??``,avatar:d.avatar_path??``,cover:d.cover_path??``}),F=h(null);async function I(e,t){F.value=e;try{let{url:n}=await y(t);P[e]=n}catch{}finally{F.value=null}}function L(){P.post(route(`profile.details`),{preserveScroll:!0,onSuccess:()=>_(g(`Profile saved`))})}let R=null;return e(()=>[P.bio,P.avatar,P.cover],()=>{R&&clearTimeout(R),R=setTimeout(L,800)}),(e,n)=>(i(),t(`section`,null,[u(`header`,null,[u(`h2`,x,a(c(g)(`Profile`)),1),u(`p`,S,a(c(g)(`Your cover image, avatar and bio shown on your public profile.`)),1)]),u(`form`,{class:`mt-6 space-y-6`,onSubmit:f(L,[`prevent`])},[u(`div`,null,[r(b,{value:c(g)(`Cover image`)},null,8,[`value`]),u(`div`,C,[u(`div`,w,[c(P).cover?(i(),t(`img`,{key:0,src:c(P).cover,alt:``,class:`h-28 w-full object-cover`},null,8,T)):o(``,!0)])]),r(v,{class:`mt-2`,uploading:F.value===`cover`,label:c(g)(`Choose cover`),accept:`image/*`,onFile:n[0]||=e=>I(`cover`,e)},null,8,[`uploading`,`label`])]),u(`div`,null,[r(b,{value:c(g)(`Avatar`)},null,8,[`value`]),u(`div`,E,[c(P).avatar?(i(),t(`img`,{key:0,src:c(P).avatar,alt:``,class:`h-16 w-16 rounded-full object-cover`},null,8,D)):(i(),t(`span`,O,a((c(d).name??`?`)[0]),1)),r(v,{uploading:F.value===`avatar`,label:c(g)(`Choose avatar`),accept:`image/*`,onFile:n[1]||=e=>I(`avatar`,e)},null,8,[`uploading`,`label`])])]),u(`div`,null,[r(b,{for:`bio`,value:c(g)(`Bio`)},null,8,[`value`]),s(u(`textarea`,{id:`bio`,"onUpdate:modelValue":n[2]||=e=>c(P).bio=e,rows:`3`,maxlength:`500`,class:`mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300`,placeholder:c(g)(`Tell the community about yourself…`)},null,8,k),[[m,c(P).bio]]),u(`p`,A,a(c(P).bio.length)+`/500`,1)]),u(`p`,j,[c(P).processing||F.value?(i(),t(`span`,M,a(c(g)(`Saving…`)),1)):(i(),t(`span`,N,a(c(g)(`Changes save automatically.`)),1))])],32)]))}}),F=d({default:()=>I}),I=P;export{F as n,I as t};