PageSourceSearch

https://www.speakduo.com/assets/index-CTzl7T2w.js

js speakduo.com collected 2026-09-24 12:00:45 UTC 15,059 bytes, 1 lines download raw bytes

1import{t as O,r as o,j as e,L as M,bN as me,bf as pe,bO as fe,bP as B,U as L,e as G,F as xe,I as N,y as C,B as I,b1 as he,Q as ge,aa as be,q as ye}from"./main-43ZfK9y9.js";import{d as V,r as _e,s as je}from"./auth-Dy_kzvyv.js";import{g as ve}from"./avatar-w9CnSINR.js";import{U as Ne}from"./user-CTASey1j.js";import{L as w}from"./label-BbCdpCMr.js";import{a as we}from"./modules-O2--22Bz.js";import{O as Se,G as Ee,I as q,a as Pe}from"./constants-CmlwAtsS.js";import{s as H,a as Ce,b as Ie,c as Q,d as Re,e as ke,f as Oe,g as Le,h as Ae}from"./settings_profile_title-DhQHWkgG.js";import{w as Te,a as $e,b as Ue,c as ze,d as Fe,e as Me,s as Be,f as Ge,g as Ve,h as qe}from"./welcome_occupation_title-BeVomPOQ.js";import{w as He}from"./welcome_goals_title-wYucyL8C.js";import{c as Qe,a as We,b as Ke,d as De}from"./call_profile_interests-Cezi1wjs.js";import{B as Ye,T as Ze,P as Xe}from"./target-BxHm5miq.js";import"./event-defaults-8VsIrJLc.js";import"./welcome_referral_tiktok-B3tkq_-g.js";const Je=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],et=O("align-left",Je);const tt=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],st=O("camera",tt);const rt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],W=O("pen",rt);function at({image:t,onUploaded:s}){const[a,i]=o.useState(!1),n=o.useRef(null),c=ve(t),l=async d=>{const u=d.target.files?.[0];if(u){d.target.value="",i(!0);try{const x=me(),g=new FormData;g.append("file",u,u.name);const b=await fetch(`${pe()}/api/v1/extensions/storage/upload/pengguin-prod-imgs`,{method:"POST",headers:{Authorization:`Bearer ${x}`},body:g});if(!b.ok)throw new Error("Upload failed");const p=await b.json();p.url&&s(p.url)}catch(x){console.error("Avatar upload failed:",x)}finally{i(!1)}}};return e.jsxs("div",{className:"relative w-fit",children:[e.jsxs("button",{type:"button",onClick:()=>n.current?.click(),disabled:a,className:"group relative h-[80px] w-[80px] overflow-hidden rounded-full bg-muted transition-opacity hover:opacity-80",children:[c?e.jsx("img",{src:c,alt:"Avatar",className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center",children:e.jsx(Ne,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 transition-opacity group-hover:opacity-100",children:a?e.jsx(M,{className:"h-5 w-5 animate-spin text-white"}):e.jsx(st,{className:"h-5 w-5 text-white"})})]}),e.jsx("div",{className:"absolute bottom-0 right-0 pointer-events-none rounded-full bg-primary p-1 text-primary-foreground shadow-sm ring-2 ring-background",children:e.jsx(W,{className:"size-3"})}),e.jsx("input",{ref:n,type:"file",accept:"image/png, image/jpeg",className:"hidden",onChange:l})]})}var nt=Object.defineProperty,A=(t,s)=>nt(t,"name",{value:s,configurable:!0});function R(t,s){if(typeof t=="function")return t(s);t!=null&&(t.current=s)}A(R,"setRef");function K(...t){return s=>{let a=!1;const i=t.map(n=>{const c=R(n,s);return!a&&typeof c=="function"&&(a=!0),c});if(a)return()=>{for(let n=0;n<i.length;n++){const c=i[n];typeof c=="function"?c():R(t[n],null)}}}}A(K,"composeRefs");function D(...t){return o.useCallback(K(...t),t)}A(D,"useComposedRefs");var it=Object.defineProperty,f=(t,s)=>it(t,"name",{value:s,configurable:!0});function Y(t){const s=o.forwardRef((a,i)=>{let{children:n,...c}=a,l=null,d=!1;const u=[];k(n)&&typeof v=="function"&&(n=v(n._payload)),o.Children.forEach(n,p=>{if(ee(p)){d=!0;const y=p;let h="child"in y.props?y.props.child:y.props.children;k(h)&&typeof v=="function"&&(h=v(h._payload)),l=lt(y,h),u.push(l?.props?.children)}else u.push(p)}),l?l=o.cloneElement(l,void 0,u):!d&&o.Children.count(n)===1&&o.isValidElement(n)&&(l=n);const x=l?J(l):void 0,g=D(i,x);if(!l){if(n||n===0)throw new Error(d?ut(t):dt(t));return n}const b=X(c,l.props??{});return l.type!==o.Fragment&&(b.ref=i?g:x),o.cloneElement(l,b)});return s.displayName=`${t}.Slot`,s}f(Y,"createSlot");var Z=Symbol.for("radix.slottable");
1function ot(t){const s=f(a=>"child"in a?a.children(a.child):a.children,"Slottable");return s.displayName=`${t}.Slottable`,s.__radixId=Z,s}f(ot,"createSlottable");var lt=f((t,s)=>{if("child"in t.props){const a=t.props.child;return o.isValidElement(a)?o.cloneElement(a,void 0,t.props.children(a.props.children)):null}return o.isValidElement(s)?s:null},"getSlottableElementFromSlottable");function X(t,s){const a={...s};for(const i in s){const n=t[i],c=s[i];/^on[A-Z]/.test(i)?n&&c?a[i]=(...d)=>{const u=c(...d);return n(...d),u}:n&&(a[i]=n):i==="style"?a[i]={...n,...c}:i==="className"&&(a[i]=[n,c].filter(Boolean).join(" "))}return{...t,...a}}f(X,"mergeProps");function J(t){let s=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,a=s&&"isReactWarning"in s&&s.isReactWarning;return a?t.ref:(s=Object.getOwnPropertyDescriptor(t,"ref")?.get,a=s&&"isReactWarning"in s&&s.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}f(J,"getElementRef");function ee(t){return o.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Z}f(ee,"isSlottable");var ct=Symbol.for("react.lazy");function k(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===ct&&"_payload"in t&&te(t._payload)}f(k,"isLazyComponent");function te(t){return typeof t=="object"&&t!==null&&"then"in t}f(te,"isPromiseLike");var dt=f(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),ut=f(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),v=fe[" use ".trim().toString()],mt=Object.defineProperty,pt=(t,s)=>mt(t,"name",{value:s,configurable:!0}),ft=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xt=ft.reduce((t,s)=>{const a=Y(`Primitive.${s}`),i=o.forwardRef((n,c)=>{const{asChild:l,...d}=n,u=l?a:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(u,{...d,ref:c})});return i.displayName=`Primitive.${s}`,{...t,[s]:i}},{});function ht(t,s){t&&B.flushSync(()=>t.dispatchEvent(s))}pt(ht,"dispatchDiscreteCustomEvent");var gt=globalThis?.document?o.useLayoutEffect:()=>{},bt=Object.defineProperty,yt=(t,s)=>bt(t,"name",{value:s,configurable:!0}),_t=o.forwardRef(yt(function(s,a){const{container:i,...n}=s,[c,l]=o.useState(!1);gt(()=>l(!0),[]);const d=i||c&&globalThis?.document?.body;return d?B.createPortal(e.jsx(xt.div,{...n,ref:a}),d):null},"Portal"));const jt=new Set(q.map(t=>t.value));function vt({goalsData:t,onComplete:s}){const{user:a}=L(),i=G(),n=xe(),c=a?.id??0,[l,d]=o.useState(null),[u,x]=o.useState(a?.display_name??""),[g,b]=o.useState(t?.goal??[]),[p,y]=o.useState(t?.occupation?.status??null),[h,T]=o.useState(t?.occupation?.description??""),[j,$]=o.useState(t?.interests??[]),[S,U]=o.useState(""),[z,se]=o.useState(t?.about_me??""),{mutateAsync:re,isPending:ae}=V(),{mutateAsync:ne,isPending:ie}=we(),E=ae||ie,oe=async r=>{r&&r.preventDefault();const m=u.trim();if(m.length<2){d(Be());return}if(m.length>20){d(Ge());return}d(null);const _=S.trim(),ue=_&&!j.includes(_)?[...j,_]:j,P={};p&&(P.status=p,h.trim()&&(P.description=h.trim()));try{await Promise.all([re({data:{display_name:m}}),ne({data:{id:Pe,data:{goal:g,occupation:P,interests:ue,about_me:z.trim()}}})]),await i.invalidate(),await n.invalidateQueries({queryKey:_e(c)}),be.success(Ve()),s()}catch{d(qe())}};function le(r){b(m=>m.includes(r)?m.filter(_=>_!==r):[...m,r])}function ce(r){p===r?(y(null),T("")):y(r)}function F(r){$(m=>m.includes(r)?m.filter(_=>_!==r):[...m,r])}function de(){const r=S.trim();r&&!j.includes(r)&&$(m=>[...m,r]),U("")}return e.jsxs("form",{id:"profile-form",onSubmit:oe,className:"space-y-6",children:[e.jsxs("div",{className:"gap-4 grid sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"display_name",children:H()}),e.jsx(N,{id:"display_name",value:u,onChange:r=>x(r.target.value),placeholder:Ce(),maxLength:20}),e.jsx("p",{className:"text-muted-foreground text-xs",children:Ie({count:u.trim().length})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"email",children:Q()}),e.jsx(N,{id:"email",value:a?.email??"",disabled:!0,className:"bg-muted"})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 font-medium text-sm",children:Te()}),e.jsx("textarea",{value:z,onChange:r=>se(r.target.value),placeholder:$e(),rows:4,maxLength:600,className:"bg-muted/40 px-4 py-3 border border-border focus:border-primary rounded-xl outline-none w-full text-sm leading-relaxed resize-none"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 font-medium text-sm",children:Ue()}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Se.map(r=>e.jsx("button",{type:"button",onClick:()=>ce(r.value),className:C("px-4 py-2 border rounded-full text-sm transition-colors",p===r.value?"border-primary bg-primary text-primary-foreground":"border-border hover:border-primary/50"),children:r.label()},r.value))}),p&&e.jsx("input",{value:h,onChange:r=>T(r.target.value),placeholder:ze(),maxLength:120,className:"bg-muted/40 mt-2.5 px-4 border border-border focus:border-primary rounded-xl outline-none w-full h-11 text-sm"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 font-medium text-sm",children:He()}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Ee.map(r=>e.jsx("button",{type:"button",onClick:()=>le(r.value),className:C("px-4 py-2 border rounded-full text-sm transition-colors",g.includes(r.value)?"border-primary bg-primary text-primary-foreground":"border-border hover:border-primary/50"),children:r.label()},r.value))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 font-medium text-sm",children:Fe()}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[q.map(r=>e.jsx("button",{type:"button",onClick:()=>F(r.value),className:C("px-4 py-2 border rounded-full text-sm transition-colors",j.includes(r.value)?"border-primary bg-primary text-primary-foreground":"border-border hover:border-primary/50"),children:r.label()},r.value)),j.filter(r=>!jt.has(r)).map(r=>e.jsxs("button",{type:"button",onClick:()=>F(r),className:"inline-flex items-center gap-1 bg-primary px-4 py-2 border border-primary rounded-full text-primary-foreground text-sm",children:[r,e.jsx("span",{"aria-hidden":!0,
1children:"×"})]},r))]}),e.jsx("input",{value:S,onChange:r=>U(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),de())},placeholder:Me(),maxLength:40,className:"bg-muted/40 mt-2.5 px-4 border border-border focus:border-primary rounded-xl outline-none w-full h-11 text-sm"})]}),l&&e.jsx("p",{className:"text-red-500 text-sm",children:l}),e.jsx(_t,{children:e.jsx("div",{className:"bottom-6 slide-in-from-bottom-4 left-1/2 z-[100] fixed -translate-x-1/2 animate-in duration-300 fade-in",children:e.jsxs("div",{className:"flex items-center gap-2 bg-card shadow-xl px-4 py-2.5 border border-border rounded-full",children:[e.jsxs(I,{type:"button",variant:"ghost",size:"sm",className:"rounded-full",onClick:s,disabled:E,children:[e.jsx(he,{className:"mr-2 w-4 h-4"}),Re()]}),e.jsxs(I,{type:"submit",form:"profile-form",size:"sm",className:"rounded-full",disabled:E,children:[E?e.jsx(M,{className:"mr-2 w-4 h-4 animate-spin"}):e.jsx(ge,{className:"mr-2 w-4 h-4"}),ke()]})]})})})]})}function Nt({goalsData:t,isLoading:s}){const{user:a}=L();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"gap-4 grid sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"display_name_readonly",children:H()}),e.jsx(N,{id:"display_name_readonly",value:a?.display_name||"—",disabled:!0,className:"bg-muted"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"email_readonly",children:Q()}),e.jsx(N,{id:"email_readonly",value:a?.email??"",disabled:!0,className:"bg-muted"})]})]}),s&&!t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-muted rounded w-2/3 h-4 animate-pulse"}),e.jsx("div",{className:"bg-muted rounded w-1/2 h-4 animate-pulse"})]}):e.jsx(e.Fragment,{children:!t?.about_me&&!t?.occupation?.description&&(t?.goal?.length??0)===0&&(t?.interests?.length??0)===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:Qe()}):e.jsxs(e.Fragment,{children:[t?.about_me&&e.jsxs("section",{children:[e.jsxs("h3",{className:"flex items-center gap-1.5 mb-1.5 font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:[e.jsx(et,{className:"size-3.5","aria-hidden":!0}),We()]}),e.jsx("p",{className:"text-foreground/90 text-sm leading-snug whitespace-pre-wrap",children:t.about_me})]}),t?.occupation?.description&&e.jsxs("section",{children:[e.jsxs("h3",{className:"flex items-center gap-1.5 mb-1.5 font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:[e.jsx(Ye,{className:"size-3.5","aria-hidden":!0}),Oe()]}),e.jsx("p",{className:"text-foreground/90 text-sm leading-snug whitespace-pre-wrap",children:t.occupation.description})]}),(t?.goal?.length??0)>0&&e.jsxs("section",{children:[e.jsxs("h3",{className:"flex items-center gap-1.5 mb-2 font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:[e.jsx(Ze,{className:"size-3.5","aria-hidden":!0}),Ke()]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t?.goal?.map(i=>e.jsx("span",{className:"bg-primary/10 px-2.5 py-1 border border-primary/40 rounded-md font-medium text-primary text-xs",children:i},i))})]}),(t?.interests?.length??0)>0&&e.jsxs("section",{children:[e.jsxs("h3",{className:"flex items-center gap-1.5 mb-2 font-semibold text-muted-foreground text-xs uppercase tracking-wider",children:[e.jsx(Xe,{className:"size-3.5","aria-hidden":!0}),De()]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t?.interests?.map(i=>
1e.jsx("span",{className:"bg-foreground/5 px-2.5 py-1 border border-border rounded-md font-medium text-foreground/80 text-xs",children:i},i))})]})]})})]})}function zt(){const{user:t}=L(),s=G(),[a,i]=o.useState(!1),n=t?.id??0,c=je(n,{query:{enabled:!!n,staleTime:60*1e3}}),l=ye(c.data),{mutateAsync:d}=V(),u=x=>{d({data:{image:x}}).then(()=>{s.invalidate()})};return e.jsxs("div",{className:"bg-card p-6 border border-border rounded-xl",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h2",{className:"font-semibold text-lg",children:Le()}),!a&&e.jsxs(I,{variant:"outline",size:"sm",onClick:()=>i(!0),children:[e.jsx(W,{className:"mr-2 w-4 h-4"}),Ae()]})]}),e.jsx("div",{className:"mt-1 bg-border h-px"}),e.jsx("div",{className:"flex justify-center mt-6",children:e.jsx(at,{image:t?.image??"",onUploaded:u})}),e.jsx("div",{className:"space-y-6 mt-6",children:a?e.jsx(vt,{goalsData:l,onComplete:()=>i(!1)}):e.jsx(Nt,{goalsData:l,isLoading:c.isLoading})})]})}export{zt as component};

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.