import{n as e}from"./chunk-QTnfLwEv.js";import{$ as t,C as n,D as r,I as i,J as a,O as o,V as s,W as c,X as l,_ as u,a as d,m as f,o as p,w as m,x as h}from"./app-BLEFEvA0.js";import{t as g}from"./i18n-CPZru8MB.js";import{n as _}from"./toast-Cyp6rP9f.js";import{t as v}from"./UploadButton-CYEzKkZN.js";import{n as y}from"./upload-CsRIgK58.js";import{t as b}from"./InputLabel-DMC-RPml.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=o({__name:`ProfileDetailsForm`,setup(e){let o=p().props.auth?.user??{},P=d({bio:o.bio??``,avatar:o.avatar_path??``,cover:o.cover_path??``}),F=a(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 s(()=>[P.bio,P.avatar,P.cover],()=>{R&&clearTimeout(R),R=setTimeout(L,800)}),(e,a)=>(i(),m(`section`,null,[h(`header`,null,[h(`h2`,x,t(l(g)(`Profile`)),1),h(`p`,S,t(l(g)(`Your cover image, avatar and bio shown on your public profile.`)),1)]),h(`form`,{class:`mt-6 space-y-6`,onSubmit:u(L,[`prevent`])},[h(`div`,null,[r(b,{value:l(g)(`Cover image`)},null,8,[`value`]),h(`div`,C,[h(`div`,w,[l(P).cover?(i(),m(`img`,{key:0,src:l(P).cover,alt:``,class:`h-28 w-full object-cover`},null,8,T)):n(``,!0)])]),r(v,{class:`mt-2`,uploading:F.value===`cover`,label:l(g)(`Choose cover`),accept:`image/*`,onFile:a[0]||=e=>I(`cover`,e)},null,8,[`uploading`,`label`])]),h(`div`,null,[r(b,{value:l(g)(`Avatar`)},null,8,[`value`]),h(`div`,E,[l(P).avatar?(i(),m(`img`,{key:0,src:l(P).avatar,alt:``,class:`h-16 w-16 rounded-full object-cover`},null,8,D)):(i(),m(`span`,O,t((l(o).name??`?`)[0]),1)),r(v,{uploading:F.value===`avatar`,label:l(g)(`Choose avatar`),accept:`image/*`,onFile:a[1]||=e=>I(`avatar`,e)},null,8,[`uploading`,`label`])])]),h(`div`,null,[r(b,{for:`bio`,value:l(g)(`Bio`)},null,8,[`value`]),c(h(`textarea`,{id:`bio`,"onUpdate:modelValue":a[2]||=e=>l(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:l(g)(`Tell the community about yourself…`)},null,8,k),[[f,l(P).bio]]),h(`p`,A,t(l(P).bio.length)+`/500`,1)]),h(`p`,j,[l(P).processing||F.value?(i(),m(`span`,M,t(l(g)(`Saving…`)),1)):(i(),m(`span`,N,t(l(g)(`Changes save automatically.`)),1))])],32)]))}}),F=e({default:()=>I}),I=P;export{F as n,I as t};