1import{r as w,j as e}from"./jsx-runtime-D2HyDbKh.js";import{z as s}from"./index-BeXw7Xwl.js";import{E as j}from"./forms-inrUErvo.js";import{S as R}from"./spacer-ByPtYu5l.js";import{B as v}from"./button-CnI1Ammv.js";import{I as b}from"./icon-D_PyQ84w.js";import{S as y}from"./status-button-CdtYXw8v.js";import{u as B,c as z}from"./misc-Dz6eLmGR.js";import{b as E,a as A,F as C}from"./components-CFzwRFiJ.js";import{c as D}from"./index-DC7kzAHw.js";import{u as T,p as L,g as U,a as Z}from"./parse-BVNr1jGi.js";import{g as k}from"./constraint-DpRVnSey.js";import"./index-CK3XEjrp.js";import"./Combination-Be7XyZla.js";import"./index-C_yorjjK.js";const q=1024*1024*3,M=s.object({intent:s.literal("delete")}),G=s.object({intent:s.literal("submit"),photoFile:s.instanceof(File).refine(t=>t.size>0,"Image is required").refine(t=>t.size<=q,"Image size must be less than 3MB")}),S=s.discriminatedUnion("intent",[M,G]);function ae(){var m,c,d,u;const t=E(),a=A(),I=D(),[i,r]=T({id:"profile-photo",constraint:k(S),lastResult:a==null?void 0:a.result,onValidate({formData:n}){return L(n,{schema:S})},shouldRevalidate:"onBlur"}),N=B()?(m=I.formData)==null?void 0:m.get("intent"):null,F=r.intent.value,[o,l]=w.useState(null);return e.jsx("div",{className:"container flex min-h-full flex-col justify-center pb-32 pt-20",children:e.jsxs("div",{className:"mx-auto w-full max-w-lg",children:[e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h1",{className:"text-h1",children:"Add a profile pic"}),e.jsx("p",{className:"text-body-md text-muted-foreground",children:"This will make GetFranki the best supplier list out there."})]}),e.jsx(R,{size:"xs"}),e.jsx("div",{children:e.jsxs(C,{method:"POST",encType:"multipart/form-data",className:"flex flex-col items-center justify-center gap-10",onReset:()=>l(null),...U(i),children:[e.jsx("img",{src:o??(t.user?z((c=t.user.image)==null?void 0:c.id):""),className:"h-52 w-52 rounded-full object-cover",alt:((d=t.user)==null?void 0:d.name)??((u=t.user)==null?void 0:u.username)}),e.jsx(j,{errors:r.photoFile.errors,id:r.photoFile.id}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("input",{...Z(r.photoFile,{type:"file"}),accept:"image/*",className:"peer sr-only",required:!0,tabIndex:o?-1:0,onChange:n=>{var h;const p=(h=n.currentTarget.files)==null?void 0:h[0];if(p){const f=new FileReader;f.onload=P=>{var x,g;l(((g=(x=P.target)==null?void 0:x.result)==null?void 0:g.toString())??null)},f.readAsDataURL(p)}}}),e.jsx(v,{asChild:!0,className:"cursor-pointer peer-valid:hidden peer-focus-within:ring-2 peer-focus-visible:ring-2",children:e.jsx("label",{htmlFor:r.photoFile.id,children:e.jsx(b,{name:"pencil-1",children:"Change"})})}),e.jsx(y,{name:"intent",value:"submit",type:"submit",className:"peer-invalid:hidden",status:N==="submit"?"pending":F==="submit"?i.status??"idle":"idle",children:"Save Photo"}),e.jsx(v,{variant:"destructive",className:"peer-invalid:hidden",...i.reset.getButtonProps(),children:e.jsx(b,{name:"trash",children:"Reset"})})]}),e.jsx(j,{errors:i.errors})]})})]})})}export{ae as default}; 2//# sourceMappingURL=suppliers._username.photo-dRicGFko.js.map
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.