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-f0AvJ4HL.js";import{n as g}from"./toast-DhmGqCiv.js";import{n as _}from"./upload-CsRIgK58.js";import{t as v}from"./InputLabel-BoVF0UUW.js";var y={class:`mt-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700`},b={class:`h-28 w-full bg-gradient-to-r from-indigo-500 to-violet-500`},x=[`src`],S={key:0,class:`ml-2 text-sm text-gray-500`},C={class:`mt-2 flex items-center gap-4`},w=[`src`],T={key:1,class:`grid h-16 w-16 place-items-center rounded-full bg-indigo-500 font-bold text-white`},E={key:2,class:`text-sm text-gray-500`},D={class:`mt-1 text-xs text-gray-500`},O={class:`text-sm text-gray-500 dark:text-gray-400`},k={key:0},A={key:1},j=n({__name:`ProfileDetailsForm`,setup(n){let d=l().props.auth?.user??{},j=p({bio:d.bio??``,avatar:d.avatar_path??``,cover:d.cover_path??``}),M=h(null);async function N(e,t){let n=t.target.files?.[0];if(n){M.value=e;try{let{url:t}=await _(n);j[e]=t}catch{}finally{M.value=null}}}function P(){j.post(route(`profile.details`),{preserveScroll:!0,onSuccess:()=>g(`Profile saved`)})}let F=null;return e(()=>[j.bio,j.avatar,j.cover],()=>{F&&clearTimeout(F),F=setTimeout(P,800)}),(e,n)=>(i(),t(`section`,null,[n[3]||=u(`header`,null,[u(`h2`,{class:`text-lg font-medium text-gray-900 dark:text-gray-100`},`Profile`),u(`p`,{class:`mt-1 text-sm text-gray-600 dark:text-gray-400`},`Your cover image, avatar and bio shown on your public profile.`)],-1),u(`form`,{class:`mt-6 space-y-6`,onSubmit:f(P,[`prevent`])},[u(`div`,null,[r(v,{value:`Cover image`}),u(`div`,y,[u(`div`,b,[c(j).cover?(i(),t(`img`,{key:0,src:c(j).cover,alt:``,class:`h-28 w-full object-cover`},null,8,x)):o(``,!0)])]),u(`input`,{type:`file`,accept:`image/*`,class:`mt-2 text-sm text-gray-600 dark:text-gray-400`,onChange:n[0]||=e=>N(`cover`,e)},null,32),M.value===`cover`?(i(),t(`span`,S,`Uploading…`)):o(``,!0)]),u(`div`,null,[r(v,{value:`Avatar`}),u(`div`,C,[c(j).avatar?(i(),t(`img`,{key:0,src:c(j).avatar,alt:``,class:`h-16 w-16 rounded-full object-cover`},null,8,w)):(i(),t(`span`,T,a((c(d).name??`?`)[0]),1)),u(`input`,{type:`file`,accept:`image/*`,class:`text-sm text-gray-600 dark:text-gray-400`,onChange:n[1]||=e=>N(`avatar`,e)},null,32),M.value===`avatar`?(i(),t(`span`,E,`Uploading…`)):o(``,!0)])]),u(`div`,null,[r(v,{for:`bio`,value:`Bio`}),s(u(`textarea`,{id:`bio`,"onUpdate:modelValue":n[2]||=e=>c(j).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:`Tell the community about yourself…`},null,512),[[m,c(j).bio]]),u(`p`,D,a(c(j).bio.length)+`/500`,1)]),u(`p`,O,[c(j).processing||M.value?(i(),t(`span`,k,`Saving…`)):(i(),t(`span`,A,`Changes save automatically.`))])],32)]))}}),M=d({default:()=>N}),N=j;export{M as n,N as t};