1import{aC as V,b as P,u as D,c9 as W,c as N,ca as C,cb as X,r as U,cc as F,cd as E,j as e,T as d,a2 as $,t as S,A as b,B as T,aW as Y,ce as I,cf as A,cg as L,a1 as q,Y as _,ch as H,aH as K,aI as G,aJ as J,ci as z,cj as Q}from"./index-BnBEKW9z.js";import{A as Z}from"./arrow-right-Dvrp_R5X.js";import{P as O}from"./phone-CwXLFWyy.js";/** 2 * @license lucide-react v0.577.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const ee=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],M=V("git-merge",ee),se=10,B=s=>!!(s.name||s.email||s.phone);function w({icon:s,value:r,onChange:i,placeholder:t,onKeyDown:a}){return e.jsxs("div",{className:"relative",children:[e.jsx(s,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{type:"text",value:r,onChange:i,onKeyDown:a,placeholder:t,autoComplete:"off",className:b("flex h-11 w-full rounded-xl border border-border/40 bg-muted/30 py-2 pl-10 pr-3 text-sm text-foreground shadow-sm transition-colors","placeholder:font-light placeholder:text-muted-foreground/50","hover:ring-2 hover:ring-primary/20","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary")})]})}function te({icon:s,iconColorClass:r,iconBgClass:i,title:t,subtitle:a,badgeLabel:l,badgeClass:x}){return e.jsxs("div",{className:"flex items-start justify-between border-b border-border/20 bg-slate-50 p-6",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:b("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",i),children:e.jsx(s,{className:b("h-5 w-5",r)})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(d,{variant:"h4",className:"block font-semibold",children:t}),e.jsx(d,{variant:"p2",className:"mt-1.5 block text-sm text-muted-foreground",children:a})]})]}),e.jsx("span",{className:b("shrink-0 rounded-full px-3 py-1 text-xs font-medium",x),children:l})]})}function re({user:s,onClear:r}){var a,l;const i=s.initials||((((a=s.firstName)==null?void 0:a[0])??"")+(((l=s.lastName)==null?void 0:l[0])??"")).toUpperCase()||"?",t=s.fullName||`${s.firstName??""} ${s.lastName??""}`.trim()||"â";return e.jsxs("div",{className:"rounded-2xl border border-border/40 bg-card p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs(K,{className:"h-12 w-12",children:[s.avatarUrl?e.jsx(G,{src:s.avatarUrl,alt:t}):null,e.jsx(J,{className:"bg-primary/10 font-semibold text-primary",children:i})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(d,{variant:"h4",className:"block font-semibold",children:t}),e.jsxs(d,{variant:"p2",className:"block text-sm text-muted-foreground",children:["ID: ",s.id]})]}),e.jsx("button",{type:"button",onClick:r,className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Clear selection",children:e.jsx(L,{className:"h-4 w-4"})})]}),(s.email||s.mobileNumber)&&e.jsxs("div",{className:"mt-4 space-y-2 border-t border-border/20 pt-4",children:[s.email&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx(_,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-sm",children:s.email})]}),s.mobileNumber&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-muted/40 px-3 py-2",children:[e.jsx(O,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:s.mobileNumber})]})]})]})}function ae({t:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed border-border/40 p-8 text-center",children:[e.jsx(H,{className:"h-8 w-8 text-muted-foreground/60"}),e.jsx(d,{variant:"p",className:"font-medium",children:s("settings.mergeTool.noSelection")}),e.jsx(d,{variant:"p2",className:"text-sm text-muted-foreground",children:s("settings.mergeTool.searchHint")})]})}function le({user:s,onSelect:r}){var a,l;const i=s.initials||((((a=s.firstName)==null?void 0:a[0])??"")+(((l=s.lastName)==null?void 0:l[0])??"")).toUpperCase()||"?",t=s.fullName||`${s.firstName??""} ${s.lastName??""}`.trim()||"â";return e.jsxs("button",{type:"button",onClick:()=>r(s),className:"flex w-full items-center gap-3 rounded-xl border border-border/40 bg-card p-3 text-left shadow-sm transition-colors hover:border-primary/40 hover:bg-accent",children:[e.jsxs(K,{className:"h-9 w-9",children:[s.avatarUrl?e.jsx(G,{src:s.avatarUrl,alt:t}):null,e.jsx(J,{className:"bg-primary/10 text-sm font-semibold text-primary",children:i})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:t}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:s.email||"â"})]})]})}function R({side:s,roleFilter:r,otherSideSelectedId:i}){const{t}=P(),a=D(),{filters:l,results:x,loading:o,hasSearched:c,selected:p}=N(C(s)),m=s==="old",h=n=>j=>{a(Q({side:s,field:n,value:j.target.value}))},f=()=>{B(l)&&a(F({side:s,filters:l,roleFilter:r,excludeId:i,limit:se}))},u=n=>{n.key==="Enter"&&(n.preventDefault(),f())},v=n=>{a(E({side:s,user:n}))},y=()=>{a(z(s))},g=i?x.filter(n=>n.id!==i):x;return e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/40 bg-card shadow-sm",children:[e.jsx(te,{icon:m?L:$,iconBgClass:m?"bg-destructive/10":"bg-primary/10",iconColorClass:m?"text-destructive":"text-primary",title:t(m?"settings.mergeTool.oldUser.title":"settings.mergeTool.newUser.title"),subtitle:t(m?"settings.mergeTool.oldUser.subtitle":"settings.mergeTool.newUser.subtitle"),badgeLabel:t(m?"settings.mergeTool.oldUser.badge":"settings.mergeTool.newUser.badge"),badgeClass:m?"bg-destructive text-destructive-foreground":"bg-primary text-primary-foreground"}),e.jsx("div",{className:"p-6",children:p?e.jsx(re,{user:p,onClear:y}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:t("settings.mergeTool.filters.name")}
6),e.jsx(w,{icon:q,value:l.name,onChange:h("name"),onKeyDown:u,placeholder:t("settings.mergeTool.filters.namePlaceholder")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:t("settings.mergeTool.filters.email")}),e.jsx(w,{icon:_,value:l.email,onChange:h("email"),onKeyDown:u,placeholder:t("settings.mergeTool.filters.emailPlaceholder")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:t("settings.mergeTool.filters.phone")}),e.jsx(w,{icon:O,value:l.phone,onChange:h("phone"),onKeyDown:u,placeholder:t("settings.mergeTool.filters.phonePlaceholder")})]}),e.jsxs(T,{variant:"primary",className:"w-full",onClick:f,disabled:!B(l)||o,loading:o,children:[e.jsx(H,{className:"mr-2 h-4 w-4"}),t("settings.mergeTool.search")]})]}),e.jsxs("div",{className:"mt-4",children:[!c&&e.jsx(ae,{t}),c&&o&&e.jsx("div",{className:"rounded-xl border border-border/40 p-4 text-center",children:e.jsx(d,{variant:"p2",className:"text-sm text-muted-foreground",children:t("settings.mergeTool.searching")})}),c&&!o&&g.length===0&&e.jsx("div",{className:"rounded-xl border border-border/40 p-4 text-center",children:e.jsx(d,{variant:"p2",className:"text-sm text-muted-foreground",children:t("settings.mergeTool.noResults")})}),c&&!o&&g.length>0&&e.jsx("div",{className:"space-y-2",children:g.map(n=>e.jsx(le,{user:n,onSelect:v},n.id))})]})]})})]})}function ce(){const{t:s}=P(),r=D(),[i,t]=W(),a=N(C("old")),l=N(C("new")),{mergeLoading:x}=N(X),o=a.selected,c=l.selected,p=U.useRef(!1);U.useEffect(()=>{if(p.current)return;const g=i.get("newUserId");g&&(p.current=!0,r(F({side:"new",filters:{},userId:Number(g),limit:1})).then(n=>{var k;const j=(k=n==null?void 0:n.payload)==null?void 0:k.data;Array.isArray(j)&&j.length===1&&r(E({side:"new",user:j[0]}))}))},[r,i]);const m=o&&c&&o.id===c.id,h=o&&c&&!m,f=m?"sameUser":h?"ready":"needBothSelected",u={needBothSelected:{icon:S,iconClass:"text-amber-600",iconBgClass:"bg-amber-100"},sameUser:{icon:S,iconClass:"text-destructive",iconBgClass:"bg-destructive/10"},ready:{icon:$,iconClass:"text-emerald-600",iconBgClass:"bg-emerald-100"}}[f],v=async()=>{if(!h)return;const g=await r(I({oldUserId:o.id,newUserId:c.id}));I.fulfilled.match(g)&&(r(A()),t({},{replace:!0}))},y=()=>{r(A())};return e.jsx("div",{className:"min-h-screen bg-muted/30 px-4 pb-12 pt-8 md:px-8",children:e.jsxs("div",{className:"mx-auto max-w-7xl",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-primary/10",children:e.jsx(M,{className:"h-5 w-5 text-primary"})}),e.jsx(d,{variant:"h1",className:"font-bold",children:s("settings.mergeTool.title")})]}),e.jsx(d,{variant:"p2",className:"ml-13 text-muted-foreground",children:s("settings.mergeTool.description")})]}),e.jsxs("div",{className:"grid items-start gap-6 lg:grid-cols-[1fr_auto_1fr]",children:[e.jsx(R,{side:"old",otherSideSelectedId:c==null?void 0:c.id}),e.jsx("div",{className:"hidden items-center justify-center pt-32 lg:flex",children:e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full border-2 border-dashed border-primary bg-card",children:e.jsx(Z,{className:"h-5 w-5 text-primary"})})}),e.jsx(R,{side:"new",roleFilter:"ALUMNI",otherSideSelectedId:o==null?void 0:o.id})]}),e.jsx("div",{className:"mt-6 rounded-2xl border border-border/40 bg-card p-5 shadow-sm",children:e.jsxs("div",{className:"flex flex-col items-start gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:b("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",u.iconBgClass),children:e.jsx(u.icon,{className:b("h-5 w-5",u.iconClass)})}),e.jsxs("div",{children:[e.jsx(d,{variant:"h4",className:"block font-semibold",children:s(`settings.mergeTool.status.${f}.title`)}),e.jsx(d,{variant:"p2",className:"block text-sm text-muted-foreground",children:s(`settings.mergeTool.status.${f}.description`)})]})]}),e.jsxs("div",{className:"flex gap-3 self-end sm:self-auto",children:[e.jsx(T,{variant:"outline",onClick:y,children:s("settings.mergeTool.actions.cancel")}),e.jsx(Y,{title:s("settings.mergeTool.confirm.title"),description:s("settings.mergeTool.confirm.description"),okText:s("settings.mergeTool.confirm.ok"),cancelText:s("settings.mergeTool.confirm.cancel"),onConfirm:v,disabled:!h||x,children:e.jsxs(T,{variant:"primary",disabled:!h||x,loading:x,children:[e.jsx(M,{className:"mr-2 h-4 w-4"}),s("settings.mergeTool.actions.merge")]})})]})]})})]})})}export{ce as default};
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.