1import{bC as Ze,r as c,s as y,j as e,bD as Je,a as et,u as tt,c as ve,i as ce,ac as je,f as We,Z as ue,a1 as nt,$ as q,a5 as it,T as rt,as as at,an as ot,X as st,M as Se,am as lt,k as dt,aK as pt,aq as ct}from"./index-lHrFFjsB.js";import{P as ke,u as ut,I as pe,r as xt}from"./ProHeader-CDDNLtBp.js";import{T as gt}from"./trending-down-DfckUW_h.js";import{P as le}from"./phone-call-UDt1XJAZ.js";import{M as G}from"./message-circle-TNU0lEwz.js";import"./useQuery-Cidv2zPr.js";import"./useTranslation-CYjJiPBB.js";import"./rotate-ccw-BtfZpo6N.js";import"./maximize-2-BzguN3GU.js";import"./index-Bo6DEgnL.js";import"./copy-GRgXQ0MO.js";import"./send-C2uAxpbU.js";import"./key--H62K1TE.js";const C={teal:"#0F4C4C",tealDark:"#0a3939",gold:"#D4AF37",goldDark:"#B8962E",cream:"#F8F6F3",border:"#E6E1DA",muted:"#94A3B8",text:"#0F4C4C",textMuted:"#7A7670",success:"#22c55e"};function ht({firstName:r="",lang:a="fr"}){const{loading:i,completed:s,nextActionStep:p,progressPct:l,items:x,refresh:w}=Ze(),[v,S]=c.useState(!1),[h,z]=c.useState(""),[D,d]=c.useState(!1),[k,_]=c.useState(null),[W,I]=c.useState(!0);if(c.useEffect(()=>{(async()=>{const{data:{user:m}}=await y.auth.getUser();if(!m)return;_(m.id);const J=`arcanes_onboarding_dismissed_${m.id}`;d(localStorage.getItem(J)==="1");const{data:E}=await y.from("api_keys").select("key").eq("user_id",m.id).eq("is_active",!0).limit(1).maybeSingle();E!=null&&E.key&&z(E.key);const{data:V}=await y.from("agent_profiles").select("role").eq("user_id",m.id).maybeSingle();I((V==null?void 0:V.role)==="owner")})()},[]),c.useEffect(()=>{const m=()=>{v||w()};return window.addEventListener("focus",m),()=>window.removeEventListener("focus",m)},[w,v]),i||s||D)return null;const F=()=>{if(!k)return;const m=`arcanes_onboarding_dismissed_${k}`;localStorage.setItem(m,"1"),d(!0)},H=()=>S(!0),Z=()=>{S(!1),w()},O=()=>{S(!1),w()},P=x.filter(m=>W||m.key!=="logo"),j=P.filter(m=>m.done).length,K=P.length>0?Math.round(j/P.length*100):0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{background:"white",border:`1px solid ${C.border}`,borderRadius:16,padding:24,marginBottom:24,fontFamily:"'Outfit', sans-serif",position:"relative"},children:[e.jsx("button",{onClick:F,"aria-label":"Masquer",title:"Masquer",style:{position:"absolute",top:16,right:16,background:"none",border:"none",color:C.muted,cursor:"pointer",fontSize:18,lineHeight:1,padding:4},children:"Ã"}),e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:10,marginBottom:8},children:[e.jsx("span",{style:{width:24,height:2,background:C.gold,borderRadius:1}}),e.jsx("span",{style:{fontSize:10,fontWeight:700,letterSpacing:"2px",color:C.goldDark,textTransform:"uppercase"},children:"Premiers pas"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:4},children:[e.jsx("h2",{style:{fontFamily:"'Outfit', sans-serif",fontSize:22,fontWeight:800,color:C.text,margin:0,letterSpacing:"-0.5px"},children:"Finalisez votre configuration"}),e.jsxs("div",{style:{fontSize:13,fontWeight:700,color:C.gold,fontVariantNumeric:"tabular-nums"},children:[K,"%"]})]}),e.jsxs("p",{style:{fontSize:13,color:C.textMuted,lineHeight:1.5,marginTop:4,marginBottom:16},children:[j," sur ",P.length," étapes complétées. Encore quelques minutes pour profiter pleinement d'Arcanes."]}),e.jsx("div",{style:{width:"100%",height:6,background:C.border,borderRadius:4,overflow:"hidden",marginBottom:20},children:e.jsx("div",{style:{width:`${K}%`,height:"100%",background:`linear-gradient(90deg, ${C.gold}, ${C.goldDark})`,transition:"width 0.4s ease"}})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:20},children:P.map(m=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 0",fontSize:14},children:[e.jsx(mt,{done:m.done}),e.jsx("span",{style:{color:m.done?C.muted:C.text,textDecoration:m.done?"line-through":"none",fontWeight:m.done?400:500},children:m.label})]},m.key))}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("button",{onClick:H,style:{padding:"12px 24px",borderRadius:10,border:"none",background:C.teal,color:"white",fontSize:14,fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif"},children:"Continuer la configuration"}),e.jsx("button",{onClick:F,style:{padding:"12px 16px",borderRadius:10,border:`1.5px solid ${C.border}`,background:"white",color:C.muted,fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"'Outfit', sans-serif"},children:"Plus tard"})]})]}),v&&h&&e.jsx(Je,{initialStep:p,firstName:r,lang:a,apiKey:h,onSkip:Z,onComplete:O})]})}function mt({done:r}){return r?e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:C.success,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:700,flexShrink:0},children:"â"}):e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",border:`2px solid ${C.border}`,background:"white",flexShrink:0}})}const t={teal:"#0F4C4C",tealDark:"#0A3838",tealLight:"#1A6363",gold:"#D4AF37",goldDark:"#B8962E",goldSoft:"#F4E5B5",green:"#059669",red:"#DC2626",redSoft:"#FEE2E2",amber:"#D97706",amberSoft:"#FEF3C7",cream:"#FDFAF5",paper:"#FFFFFF",border:"#E8E4DE",borderLight:"#F0EDE6",text:"#0D1109",textSoft:"#3A3631",muted:"#7A7670",mutedLight:"#B8B4AE",runePrimary:"#A855F7",runeSecondary:"#EC4899",runeAccent:"#F97316",runeDark:"#7C3AED",runeSoft:"rgba(168, 85, 247, 0.08)",runeBorder:"rgba(168, 85, 247, 0.20)",runeGradient:"linear-gradient(135deg, #A855F7 0%, #EC4899 60%, #F97316 100%)",runeGradientSoft:"linear-gradient(135deg, rgba(168,85,247,0.10) 0%, rgba(236,72,153,0.10) 100%)"},A=r=>r>=1e6?`${(r/1e6).toFixed(1)}Mâ¬`:r>=1e3?`${Math.round(r/1e3)}Kâ¬`:`${r}â¬`,ft=(r,a)=>{const i=(Date.now()-new Date(r).getTime())/36e5;if(i<1)return a==="en"?`${Math.round(i*60)}min ago`:a==="nl"?`${Math.round(i*60)}min`:`il y a ${Math.round(i*60)}min`;if(i<24)return a==="en"?`${Math.round(i)}h ago`:a==="nl"?`${Math.round(i)}u`:`il y a ${Math.round(i)}h`;const s=Math.floor(i/24);return s===1?a==="en"?"yesterday":a==="nl"?"gisteren":"hier":a==="en"?`${s}d ago`:a==="nl"?`${s}d`:`il y a ${s}j`},yt=(r,a)=>{const s=(Date.now()-new Date(r).getTime())/6e4;if(s<60)return`${Math.max(1,Math.round(s))}min`;const p=s/60;return p<24?`${Math.round(p)}h`:`${Math.floor(p/24)}j`},_e=({size:r=36})=>e.jsx("img",{src:xt,alt:"Rune",width:r,height:r,style:{width:`${r}px`,height:`${r}px`,objectFit:"contain",display:"block",filter:"drop-shadow(0 4px 12px rgba(168,85,247,0.25))"}}),bt=({activeBuyerLeads:r,weekDelta:a,leadsThisWeek:i,monthCurrent:s,monthGoal:p,vendeurs:l,vendeurNames:x,mandats:w,pipelineTotal:v,onClickLeads:S,onClickVendeurs:h,onClickMandats:z,lang:D})=>{const d=(_,W,I)=>D==="nl"?W:D==="en"?I:_,k=Math.min(100,Math.round(s/p*100));return e.jsxs("div",{style:{background:t.paper,border:`1.5px solid ${t.border}`,borderRadius:"16px",overflow:"hidden"},children:[e.jsxs("button",{onClick:S,className:"pipeline-hero",style:{width:"100%",padding:"20px 24px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",display:"flex",alignItems:"stretch",gap:"20px",position:"relative"},children:[e.jsxs("div",{style:{flex:"0 0 auto",display:"flex",flexDirection:"column",gap:"4px",minWidth:"150px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:"10px",fontWeight:800,color:t.muted,textTransform:"uppercase",letterSpacing:"1.2px"},children:d("Leads actifs","Actieve leads","Active leads")}),a!==null&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",padding:"2px 6px",background:a>=0?"rgba(5,150,105,0.10)":"rgba(217,119,6,0.10)",color:a>=0?t.green:t.amber,borderRadius:"999px",fontSize:"10px",fontWeight:800},children:[a>=0?e.jsx(rt,{style:{width:"10px",height:"10px"}}):e.jsx(gt,{style:{width:"10px",height:"10px"}}),i," ",d("nouv. cette sem.","nieuw deze week","new this week")]})]}),e.jsx("div",{style:{fontFamily:"'Outfit', sans-serif",fontSize:"56px",fontWeight:800,color:t.text,lineHeight:.95,letterSpacing:"-2.5px",fontVariantNumeric:"tabular-nums"},children:r}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"2px"},children:[e.jsx("span",{"aria-hidden":!0,style:{width:"6px",height:"6px",borderRadius:"50%",background:t.green,animation:"liveDotPulse 2s ease-out infinite",flexShrink:0}}),e.jsx("span",{style:{fontSize:"11px",color:t.mutedLight,fontWeight:500},children:d("acheteurs · synchro live","kopers · live","buyers · live sync")})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",gap:"8px",minWidth:0,paddingLeft:"20px",borderLeft:`1px solid ${t.borderLight}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"8px",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:"10px",fontWeight:800,color:t.muted,textTransform:"uppercase",letterSpacing:"1.2px",whiteSpace:"nowrap"}
1,children:d("Objectif mensuel","Maanddoel","Monthly goal")}),e.jsxs("span",{style:{fontSize:"10px",color:t.mutedLight,fontWeight:600,whiteSpace:"nowrap"},children:[k,"% ",d("atteint","behaald","reached")]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"6px",fontFamily:"'Outfit', sans-serif",fontVariantNumeric:"tabular-nums",lineHeight:1},children:[e.jsx("span",{style:{fontSize:"32px",fontWeight:800,color:t.text,letterSpacing:"-1px"},children:s}),e.jsxs("span",{style:{fontSize:"16px",fontWeight:600,color:t.mutedLight},children:["/ ",p]}),e.jsx("span",{style:{fontSize:"11px",color:t.muted,marginLeft:"auto",fontWeight:500},children:d("ce mois-ci","deze maand","this month")})]}),e.jsx("div",{style:{height:"6px",background:t.borderLight,borderRadius:"999px",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${k}%`,background:`linear-gradient(90deg, ${t.teal} 0%, ${t.tealLight} 100%)`,borderRadius:"999px",transition:"width 0.6s ease"}})})]})]}),e.jsxs("div",{className:"pipeline-substats-grid",style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",borderTop:`1px solid ${t.borderLight}`},children:[e.jsx(de,{label:d("Vendeurs en cours","Verkopers","Sellers"),value:String(l),subtitle:x.length>0?x.slice(0,2).join(" · "):d("Aucun mandat en cours","Geen","None pending"),accent:t.gold,onClick:h}),e.jsx(de,{label:d("Mandats actifs","Mandaten","Active mandates"),value:String(w),subtitle:d("à vendre","Te koop","For sale"),accent:t.green,onClick:z,isMiddle:!0}),e.jsx(de,{label:d("Pipeline total","Pipeline","Pipeline value"),value:A(v),subtitle:d("Valeur cumulée","Totaal","Cumulated value"),accent:t.teal})]})]})},de=({label:r,value:a,subtitle:i,accent:s,onClick:p,isMiddle:l})=>e.jsxs("button",{onClick:p,style:{padding:"14px 14px 12px",background:"transparent",border:"none",borderLeft:l?`1px solid ${t.borderLight}`:"none",borderRight:l?`1px solid ${t.borderLight}`:"none",cursor:p?"pointer":"default",textAlign:"left",display:"flex",flexDirection:"column",gap:"4px",transition:"background 0.15s ease",position:"relative",minHeight:"78px",minWidth:0,overflow:"hidden",justifyContent:"flex-start"},onMouseEnter:x=>{p&&(x.currentTarget.style.background="rgba(15,76,76,0.025)")},onMouseLeave:x=>{p&&(x.currentTarget.style.background="transparent")},children:[e.jsx("div",{style:{position:"absolute",top:0,left:l?"1px":"0",right:l?"1px":"0",height:"2.5px",background:s,opacity:.55}}),e.jsx("div",{className:"ministat-label",style:{fontSize:"10px",fontWeight:700,color:t.muted,textTransform:"uppercase",letterSpacing:"0.8px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r}),e.jsx("div",{style:{fontFamily:"'Outfit', sans-serif",fontSize:"22px",fontWeight:800,color:t.text,letterSpacing:"-0.6px",fontVariantNumeric:"tabular-nums",lineHeight:1.05,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a}),i&&e.jsx("div",{style:{fontSize:"11px",color:t.mutedLight,lineHeight:1.4,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i})]}),$e=({item:r,lang:a,navigate:i,isLast:s})=>{const p=(h,z,D)=>a==="nl"?z:a==="en"?D:h,x={hot_lead:{icon:ue,dot:t.amber,label:p("Lead chaud","Heet","Hot lead")},callback:{icon:le,dot:t.amber,label:p("Rappel demandé","Terugbellen","Callback")},followup_due:{icon:le,dot:t.amber,label:p("à relancer","Op te volgen","Follow up")},vendeur_reply:{icon:Se,dot:t.gold,label:p("Réponse vendeur","Verkoper","Seller reply")},new_lead:{icon:pe,dot:t.teal,label:p("Nouveau lead","Nieuw","New lead")},dossier_view:{icon:lt,dot:t.muted,label:p("A consulté son dossier","Bekeken","Viewed dossier")},email_opened:{icon:Se,dot:t.muted,label:p("Email ouvert","Geopend","Opened")},view_spike:{icon:dt,dot:t.muted,label:p("Activité","Activiteit","Activity")}}[r.type]??{icon:pe,dot:t.muted,label:p("à traiter","Te behandelen","To handle")},w=r.type==="hot_lead"||r.type==="callback"||r.type==="vendeur_reply"||r.type==="followup_due",v=r.secondary.replace(/\s·\sscore\s\d+/gi,""),S=()=>{r.navigateTo&&i(r.navigateTo)};return e.jsxs("div",{className:"feed-row",onClick:S,style:{display:"flex",alignItems:"flex-start",ga
1p:"12px",padding:"12px 14px",background:"transparent",borderBottom:s?"none":`1px solid ${t.borderLight}`,cursor:r.navigateTo?"pointer":"default",position:"relative"},onMouseEnter:h=>{h.currentTarget.style.background="rgba(15,76,76,0.035)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:x.dot,flexShrink:0,marginTop:"6px",boxShadow:w?`0 0 0 3px ${x.dot}22`:"none"}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"nowrap",marginBottom:"3px",overflow:"hidden"},children:[e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:t.text,letterSpacing:"-0.2px",flexShrink:0,whiteSpace:"nowrap"},children:r.primary}),e.jsx("span",{style:{color:t.mutedLight,fontSize:"12px",flexShrink:0},children:"·"}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:x.dot,flexShrink:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},children:x.label}),!w&&typeof r.intentScore=="number"&&r.intentScore>3&&e.jsx("span",{className:"dash-score-pill",style:{background:r.intentScore>=15?t.red:r.intentScore>=10?t.gold:t.muted,color:"white"},children:Number(r.intentScore)})]}),v&&e.jsx("div",{style:{fontSize:"12px",color:t.muted,lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flexShrink:0,marginTop:"2px"},children:[w&&r.telephone&&e.jsxs("div",{className:"feed-actions",style:{display:"flex",gap:"4px"},children:[e.jsx("a",{href:`tel:${r.telephone}`,onClick:h=>h.stopPropagation(),title:p("Appeler","Bel","Call"),className:"feed-action-btn feed-action-tel",children:e.jsx(le,{style:{width:"12px",height:"12px"}})}),e.jsx("a",{href:`https://wa.me/${r.telephone.replace(/\s+/g,"").replace(/^\+/,"")}`,target:"_blank",rel:"noopener noreferrer",onClick:h=>h.stopPropagation(),title:"WhatsApp",className:"feed-action-btn feed-action-wa",children:e.jsx(G,{style:{width:"12px",height:"12px"}})})]}),e.jsx("span",{style:{fontSize:"11px",color:t.mutedLight,fontWeight:500,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums",minWidth:"32px",textAlign:"right"},children:yt(r.timestamp)})]})]})},Ce=({label:r,count:a,accent:i,isFirst:s})=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"14px 14px 8px",borderTop:s?"none":`1px solid ${t.border}`,background:"rgba(15,76,76,0.015)"},children:[e.jsx("div",{style:{width:"6px",height:"6px",borderRadius:"50%",background:i}}),e.jsx("span",{style:{fontSize:"10px",fontWeight:800,color:t.muted,textTransform:"uppercase",letterSpacing:"1.2px"},children:r}),e.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:t.mutedLight,marginLeft:"auto"},children:a})]}),wt=({icon:r,title:a,summary:i,details:s,whatsappPrompt:p,navigationCta:l,primaryAction:x,lang:w})=>{const v=(z,D,d)=>w==="nl"?D:w==="en"?d:z,[S,h]=c.useState(!1);return e.jsxs("div",{style:{padding:"16px",background:t.paper,border:`1.5px solid ${t.border}`,borderRadius:"12px",display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px"},children:[e.jsx("div",{style:{width:"30px",height:"30px",borderRadius:"8px",background:t.runeSoft,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(r,{style:{width:"15px",height:"15px",color:t.runePrimary}})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:t.text,marginBottom:"4px"},children:a}),e.jsx("div",{style:{fontSize:"12px",color:t.muted,lineHeight:1.55},children:i})]})]}),s&&S&&e.jsx("div",{style:{paddingLeft:"40px",fontSize:"12px",color:t.muted,lineHeight:1.6},children:s}),e.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",marginTop:"2px",alignItems:"center"},children:[s&&e.jsx("button",{onClick:()=>h(z=>!z),style:{padding:"5px 8px",background:"transparent",border:"none",color:t.muted,fontSize:"11px",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"3px"},children:S?e.jsxs(e.Fragment,{children:[v("Réduire","Verberg","Hide")," ",e.jsx(pt,{style:{width:"12px",height:"12px"}})]}):e.jsxs(e.Fragment,{children:[v("Détail","Detail","Detail")," ",e.jsx(ct,{style:{width:"12px",height:"12px"}})]})}),l&&e.jsxs("button",{onClick:l.onClick,style:{padding:"5px 10px",background:"transparent",border:"none",color:t.teal,fontSize:"11px",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"3px"},children:[l.label," ",e.jsx(q,{style:{width:"11px",height:"11px"}})]}),e.jsxs("button",{onClick:()=>window.dispatchEvent(new CustomEvent("rune:open",{detail:{prefill:p}})),style:{marginLeft:"auto",padding:"6px 12px",background:x?t.runePrimary:"transparent",color:x?"white":t.runeDark,border:x?"none":`1.5px solid ${t.runePrimary}`,borderRadius:"7px",fontSize:"11px",fontWeight:700,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"5px",fontFamily:"'Outfit', sans-serif",boxShadow:x?"0 4px 12px rgba(168,85,247,0.25)":"none"},children:[e.jsx(G,{style:{width:"12px",height:"12px"}}),v("Discuter","Praat","Chat")]})]})]})},vt=({insights:r,communeOpp:a,lang:i,navigate:s,onClose:p})=>{var S,h,z,D;const l=(d,k,_)=>i==="nl"?k:i==="en"?_:d,x=r.find(d=>d.insight_key==="engagement_leads"),w=r.find(d=>d.insight_key==="pipeline_value"),v=[];
1if(x&&((h=(S=x.value)==null?void 0:S.hot_leads_no_contact)==null?void 0:h.length)>0){const d=x.value.hot_leads_no_contact,k=d.slice(0,3);v.push(e.jsxs("div",{style:{padding:"16px",background:t.paper,border:`1.5px solid ${t.runeBorder}`,borderRadius:"12px",display:"flex",flexDirection:"column",gap:"12px",boxShadow:"0 2px 8px rgba(168,85,247,0.06)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px"},children:[e.jsx("div",{style:{width:"30px",height:"30px",borderRadius:"8px",background:t.runeSoft,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(ue,{style:{width:"15px",height:"15px",color:t.runePrimary}})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:t.text,marginBottom:"2px"},children:l(`${d.length} leads chauds sans contact`,`${d.length} hete leads`,`${d.length} hot leads to call`)}),e.jsx("div",{style:{fontSize:"11px",color:t.muted},children:l("Tap pour ouvrir le profil","Tik om te openen","Tap to open profile")})]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:k.map((_,W)=>e.jsxs("button",{onClick:()=>s(`/pro/leads?id=${_.lead_id||_.id||""}`),style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 10px",background:"transparent",border:`1px solid ${t.borderLight}`,borderRadius:"8px",cursor:"pointer",textAlign:"left",transition:"all 0.12s ease"},onMouseEnter:I=>{I.currentTarget.style.background=t.runeSoft,I.currentTarget.style.borderColor=t.runeBorder},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.borderColor=t.borderLight},children:[e.jsx("span",{style:{width:"20px",height:"20px",borderRadius:"50%",background:t.runeGradient,color:"white",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontWeight:800,flexShrink:0},children:(_.name||"?").charAt(0).toUpperCase()}),e.jsx("span",{style:{flex:1,fontSize:"12px",fontWeight:600,color:t.text},children:_.name}),e.jsx("span",{className:"dash-score-pill",style:{background:_.intent_score>=15?t.red:t.gold,color:"white"},children:_.intent_score}),e.jsxs("span",{style:{fontSize:"10px",color:t.mutedLight,fontWeight:500},children:[_.days_since_signal,"j"]}),e.jsx(q,{style:{width:"12px",height:"12px",color:t.mutedLight,flexShrink:0}})]},W))}),e.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",paddingTop:"4px"},children:[e.jsxs("button",{onClick:()=>s("/pro/leads"),style:{padding:"6px 10px",background:"transparent",border:"none",color:t.teal,fontSize:"11px",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"3px"},children:[l("Tous les leads","Alle leads","All leads")," ",e.jsx(q,{style:{width:"11px",height:"11px"}})]}),e.jsxs("button",{onClick:()=>window.dispatchEvent(new CustomEvent("rune:open",{detail:{prefill:l(`Aide-moi à prioriser mes ${d.length} leads chauds sans contact aujourd'hui.`,`Help me prioritize my ${d.length} hot leads.`,`Help me prioritize my ${d.length} hot leads.`)}})),style:{marginLeft:"auto",padding:"6px 12px",background:t.runePrimary,color:"white",border:"none",borderRadius:"7px",fontSize:"11px",fontWeight:700,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"5px",fontFamily:"'Outfit', sans-serif",boxShadow:"0 4px 12px rgba(168,85,247,0.25)"},children:[e.jsx(G,{style:{width:"12px",height:"12px"}}),l("Discuter","Praat","Chat")]})]})]},"hot-leads"))}if(a&&a.demand>=3&&v.push(e.jsx(wt,{icon:at,title:l(`${a.commune} : opportunité mandat`,`${a.commune}: opportunity`,`${a.commune}: opportunity`),summary:l(`${a.demand} acheteurs ont simulé · budget médian ${A(a.budget_median)} · vous n'avez aucun bien dans cette commune.`,`${a.demand} buyers · median ${A(a.budget_median)} · no listings yet.`,`${a.demand} buyers · median ${A(a.budget_median)} · no listings yet.`),whatsappPrompt:l(`Aide-moi à préparer une stratégie de prospection mandat à ${a.commune}. Il y a ${a.demand} acheteurs avec un budget médian de ${A(a.budget_median)}.`,`Help me prepare a prospection strategy for ${a.commune}.`,`Help me prepare a prospection strategy for ${a.commune}.`),navigationCta:{label:l("Fiche commune","Gemeente","Commune"),onClick:()=>s(`/commune/${a.commune.toLowerCase()}`)},primaryAction:!1,lang:i},"commune-opp")),w&&((D=(z=w.value)==null?void 0:z.biens_with_no_leads)==null?void 0:D.length)>0){const d=w.value.biens_with_no_leads,k=d[0],_=d.slice(0,3);v.push(e.jsxs("div",{style:{padding:"16px",background:t.paper,border:`1.5px solid ${t.border}`,borderRadius:"12px",display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",ga
1p:"10px"},children:[e.jsx("div",{style:{width:"30px",height:"30px",borderRadius:"8px",background:"rgba(217,119,6,0.10)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(ot,{style:{width:"15px",height:"15px",color:t.amber}})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:t.text,marginBottom:"2px"},children:l(d.length===1?"1 bien sans aucun lead":`${d.length} biens sans lead`,`${d.length} pand zonder leads`,`${d.length} listing(s) without leads`)}),e.jsx("div",{style:{fontSize:"11px",color:t.muted},children:l("Considérer baisse de prix ou repositionnement","Overweeg prijsverlaging","Consider price reduction")})]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:_.map((W,I)=>e.jsxs("button",{onClick:()=>s(`/pro/annonce/${W.bien_id||W.id||""}`),style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 10px",background:"transparent",border:`1px solid ${t.borderLight}`,borderRadius:"8px",cursor:"pointer",textAlign:"left",transition:"all 0.12s ease",width:"100%"},onMouseEnter:F=>{F.currentTarget.style.background="rgba(217,119,6,0.05)",F.currentTarget.style.borderColor="rgba(217,119,6,0.25)"},onMouseLeave:F=>{F.currentTarget.style.background="transparent",F.currentTarget.style.borderColor=t.borderLight},children:[e.jsx("span",{style:{width:"20px",height:"20px",borderRadius:"5px",background:"rgba(217,119,6,0.10)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(We,{style:{width:"11px",height:"11px",color:t.amber}})}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"1px"},children:[e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:t.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:W.label}),e.jsxs("span",{style:{fontSize:"10px",color:t.mutedLight,fontWeight:500},children:[A(W.prix)," · ",W.commune]})]}),e.jsxs("span",{style:{fontSize:"10px",fontWeight:700,color:W.days_published>60?t.red:W.days_published>30?t.amber:t.muted,fontVariantNumeric:"tabular-nums",flexShrink:0},children:[W.days_published,"j"]}),e.jsx(q,{style:{width:"12px",height:"12px",color:t.mutedLight,flexShrink:0}})]},I))}),e.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",paddingTop:"4px"},children:[e.jsxs("button",{onClick:()=>s("/pro/biens"),style:{padding:"6px 10px",background:"transparent",border:"none",color:t.teal,fontSize:"11px",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"3px"},children:[l("Tous les biens","Alle panden","All listings")," ",e.jsx(q,{style:{width:"11px",height:"11px"}})]}),e.jsxs("button",{onClick:()=>window.dispatchEvent(new CustomEvent("rune:open",{detail:{prefill:l(`${k.label} (${A(k.prix)}, ${k.days_published}j en ligne) n'a aucun lead. Que me conseilles-tu ?`,`${k.label} has no leads. Advice?`,`${k.label} has no leads. Advice?`)}})),style:{marginLeft:"auto",padding:"6px 12px",background:"transparent",color:t.runeDark,border:`1.5px solid ${t.runePrimary}`,borderRadius:"7px",fontSize:"11px",fontWeight:700,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"5px",fontFamily:"'Outfit', sans-serif"},children:[e.jsx(G,{style:{width:"12px",height:"12px"}}),l("Discuter","Praat","Chat")]})]})]},"biens-no-leads"))}return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px",padding:"14px",borderRadius:"16px",background:"linear-gradient(180deg, rgba(168, 85, 247, 0.05) 0%, rgba(236, 72, 153, 0.025) 100%)",borderLeft:`3px solid ${t.runePrimary}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 4px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e.jsx(_e,{size:40}),e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"'Outfit', sans-serif",fontSize:"17px",fontWeight:800,color:t.text,lineHeight:1.2,letterSpacing:"-0.3px"},children:"Rune"}),e.jsx("div",{style:{fontSize:"10px",color:t.muted,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.6px"},children:l("Vos angles d'attaque","Strategieën","Your angles")})]})]}),p&&e.jsx("button",{onClick:p,style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:t.muted},children:e.jsx(st,{style:{width:"18px",height:"18px"}})})]}),v.length>0?v:e.jsxs("div",{style:{padding:"28px 18px",background:t.runeSoft,border:`1.5px dashed ${t.runeBorder}`,borderRadius:"12px",textAlign:"center"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"10px"},children:e.jsx(_e,{size:32})}),e.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:t.text,marginBottom:"6px"},children:l("Rune analyse votre activité","Rune analyseert","Rune is analyzing")}),e.jsx("div",{style:{fontSize:"12px",color:t.muted,lineHeight:1.5,marginBottom:"14px"},children:l("Plus de données = plus d'opportunités identifiées.","Meer data = meer kansen.","More data, more opportunities.")}),e.jsxs("button",{onClick:()=>window.dispatchEvent(new CustomEvent("rune:open",{detail:{prefill:l("Bonjour Rune, brief moi sur ma journée.","Hi Rune, brief me.","Hi Rune, brief me.")}})),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"9px 18px",background:t.runePrimary,color:"white",border:"none",borderRadius:"8px",fontSize:"12px",fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif",boxShadow:"0 4px 12px rgba(168,85,247,0.25)"},children:[e.jsx(G,{style:{width:"13px",height:"13px"}}),l("Demander à Rune","Vraag Rune","Ask Rune")]})]})]})},jt=({lang:r,navigate:a})=>{const i=(s,p,l)=>r==="nl"?p:r==="en"?l:s;return e.jsxs("div",{style:{maxWidth:"800px",margin:"0 auto",padding:"60px 20px",textAlign:"center"},children:[e.jsx("div",{style:{width:"80px",height:"80px",borderRadius:"20px",background:"linear-gradient(135deg, #D4AF37 0%, #B8962E 100%)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 24px"},children:e.jsx(We,{style:{width:"40px",height:"40px",color:"white"}})}),e.jsx("h1",{style:{fontSize:"32px",fontWeight:700,color:t.teal,marginBottom:"16
1px",fontFamily:"'Outfit', sans-serif"},children:i("Espace Agent Pro","Agent Pro Portaal","Agent Pro Portal")}),e.jsx("p",{style:{fontSize:"16px",color:"rgba(15,76,76,0.6)",maxWidth:"600px",margin:"0 auto 32px",lineHeight:1.6},children:i("Connectez-vous pour accéder à votre tableau de bord agent.","Log in om toegang te krijgen.","Sign in to access your dashboard.")}),e.jsx("button",{onClick:()=>a("/login"),style:{padding:"14px 32px",background:t.teal,color:"white",border:"none",borderRadius:"10px",fontSize:"15px",fontWeight:600,cursor:"pointer"},children:i("Se connecter","Inloggen","Sign in")})]})},St=({lang:r})=>{const a=(i,s,p)=>r==="nl"?s:r==="en"?p:i;return e.jsxs("div",{style:{maxWidth:"600px",margin:"0 auto",padding:"60px 20px",textAlign:"center"},children:[e.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"rgba(212,175,55,0.1)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 20px"},children:e.jsx(ce,{style:{width:"32px",height:"32px",color:t.gold,animation:"spin 1s linear infinite"}})}),e.jsx("h1",{style:{fontSize:"24px",fontWeight:700,color:t.teal,marginBottom:"12px",fontFamily:"'Outfit', sans-serif"},children:a("Compte en attente","Account in afwachting","Account pending")}),e.jsx("p",{style:{fontSize:"14px",color:"rgba(15,76,76,0.6)",lineHeight:1.6},children:a("Votre compte agent est en cours de vérification.","Uw account wordt geverifieerd.","Your account is being verified.")}),e.jsx("style",{children:"@keyframes spin{to{transform:rotate(360deg)}}"})]})},kt=({lang:r,navigate:a})=>{const i=(g,f,b)=>r==="nl"?f:r==="en"?b:g,{data:s,isLoading:p}=ut(),[l,x]=c.useState(!0),[w,v]=c.useState(0),[S,h]=c.useState(0),[z,D]=c.useState([]),[d,k]=c.useState(0),[_,W]=c.useState(0),[I,F]=c.useState(0),[H,Z]=c.useState(0),[O,P]=c.useState(0),[j,K]=c.useState([]),[m,J]=c.useState(0),[E,V]=c.useState(0),[xe]=c.useState(20),[Ie,Le]=c.useState(0),[ze,De]=c.useState([]),[Te,Ae]=c.useState(null);c.useEffect(()=>{s&&(async()=>{const{data:{user:f}}=await y.auth.getUser();if(!f||!s)return;const b=s.agency_id,{count:B}
1=await y.from("qualify_leads").select("*",{count:"exact",head:!0}).eq("agency_id",b).not("status","in",'("archivé","auto-archived")');v(B||0);const{count:ee}=await y.from("biens_publies").select("*",{count:"exact",head:!0}).eq("agent_id",f.id).eq("status","prospection");h(ee||0);const{data:te}=await y.from("biens_publies").select("owner_name").eq("agent_id",f.id).eq("status","prospection").not("owner_name","is",null).limit(3);D((te||[]).map(n=>{const o=(n.owner_name||"").trim(),u=o.split(/\s+/);return u.length>=2?`${u[0]} ${u[1][0]}.`:u[0]||o}).filter(Boolean));const{count:N}=await y.from("biens_publies").select("*",{count:"exact",head:!0}).eq("agent_id",f.id).eq("status","active");k(N||0);const{data:L}=await y.from("biens_publies").select("prix").eq("agent_id",f.id).eq("status","active");W((L||[]).reduce((n,o)=>n+(o.prix||0),0));const M=Date.now(),U=new Date(M-14*864e5).toISOString(),{data:Be}=await y.from("qualify_leads").select("created_at").eq("agency_id",b).gte("created_at",U),Y=new Map;for(let n=6;n>=0;n--){const u=new Date(M-n*864e5).toISOString().split("T")[0];Y.set(u,0)}let ge=0,he=0;(Be||[]).forEach(n=>{const u=new Date(n.created_at).toISOString().split("T")[0];Y.has(u)?(Y.set(u,(Y.get(u)||0)+1),ge++):he++}),Z(ge),P(he);const R=[],{data:qe}
1=await y.from("qualify_leads").select("id, nom, telephone, intent_score, simulation_data, callback_requested_at, created_at").eq("agency_id",b).gte("intent_score",6).not("status","in",'("contacté","archivé","auto-archived")').order("intent_score",{ascending:!1}).limit(3);(qe||[]).forEach(n=>{const o=n.simulation_data||{};R.push({id:`hot-${n.id}`,type:n.callback_requested_at?"callback":"hot_lead",timestamp:n.callback_requested_at||n.created_at,primary:n.nom,secondary:`${o.commune_name||"â"} · ${A(o.prix_achat||o.prix_bien||0)} · ${o.type_bien||"â"}`,meta:n.callback_requested_at?`${i("Rappel demandé","Terugbellen","Callback")} ${ft(n.callback_requested_at,r)}`:void 0,intentScore:n.intent_score,telephone:n.telephone,leadId:n.id,navigateTo:`/pro/leads?id=${n.id}`})});const Oe=new Date(M-7*864e5).toISOString(),{data:Ne}=await y.from("email_sequences").select("bien_id, target_name, replied_at, biens_publies!inner(label, agent_id, prix)").eq("target_type","owner").gte("replied_at",Oe).not("replied_at","is",null).order("replied_at",{ascending:!1}).limit(5);(Ne||[]).filter(n=>{var o;return((o=n.biens_publies)==null?void 0:o.agent_id)===f.id}).forEach(n=>{R.push({id:`reply-${n.bien_id}-${n.replied_at}`,type:"vendeur_reply",timestamp:n.replied_at,primary:n.target_name||i("Propriétaire","Eigenaar","Owner"),secondary:`${n.biens_publies.label} · ${A(n.biens_publies.prix)}`,meta:i("A répondu à votre relance","Antwoordde op uw mail","Replied to your email"),bienId:n.bien_id,navigateTo:"/pro/leads?tab=vendeurs"})});const me=new Date(M-864e5).toISOString(),{data:He}
1=await y.from("qualify_leads").select("id, nom, simulation_data, dossier_viewed_at, intent_score").eq("agency_id",b).gte("dossier_viewed_at",me).not("dossier_viewed_at","is",null).order("dossier_viewed_at",{ascending:!1}).limit(5);(He||[]).forEach(n=>{if(R.some(u=>u.leadId===n.id))return;const o=n.simulation_data||{};R.push({id:`view-${n.id}`,type:"dossier_view",timestamp:n.dossier_viewed_at,primary:n.nom,secondary:`${o.commune_name||"â"} · ${A(o.prix_achat||0)}`,meta:i("a consulté son dossier","bekeek dossier","viewed their dossier"),intentScore:n.intent_score,leadId:n.id,navigateTo:`/pro/leads?id=${n.id}`})});const{data:Ve}=await y.from("qualify_leads").select("id, nom, simulation_data, intent_score, created_at").eq("agency_id",b).eq("status","nouveau").gte("created_at",me).order("created_at",{ascending:!1}).limit(5);(Ve||[]).forEach(n=>{if(R.some(u=>u.leadId===n.id))return;const o=n.simulation_data||{};R.push({id:`new-${n.id}`,type:"new_lead",timestamp:n.created_at,primary:n.nom,secondary:`${o.commune_name||"â"} · ${A(o.prix_achat||0)}${n.intent_score?` · score ${n.intent_score}`:""}`,intentScore:n.intent_score>=4?n.intent_score:void 0,leadId:n.id,navigateTo:`/pro/leads?id=${n.id}`})});const{data:Ue}
1=await y.from("qualify_leads").select("id, nom, telephone, simulation_data, followup_at, followup_reason, origin, source").eq("agency_id",b).not("followup_at","is",null).lte("followup_at",new Date().toISOString()).is("deleted_at",null).not("status","in",'("archivé","auto-archived")').order("followup_at",{ascending:!0}).limit(5);(Ue||[]).forEach(n=>{if(R.some(T=>T.leadId===n.id))return;const o=n.simulation_data||{},u=o.commune_name||o.commune||null;R.push({id:`followup-${n.id}`,type:"followup_due",timestamp:n.followup_at,primary:n.nom,secondary:u?`${u} · ${A(o.prix_achat||o.prix_bien||0)}`:i("Contact vendeur","Verkoperscontact","Seller contact"),meta:n.followup_reason?`${i("à relancer","Op te volgen","Follow up")} â ${n.followup_reason}`:i("Relance prévue aujourd'hui","Opvolging vandaag","Follow-up due today"),telephone:n.telephone,leadId:n.id,navigateTo:`/pro/leads?id=${n.id}`})});const ne=R.filter(n=>n.type==="hot_lead"||n.type==="callback"||n.type==="vendeur_reply"||n.type==="followup_due"),fe=R.filter(n=>!["hot_lead","callback","vendeur_reply","followup_due"].includes(n.type));ne.sort((n,o)=>new Date(o.timestamp).getTime()-new Date(n.timestamp).getTime()),fe.sort((n,o)=>new Date(o.timestamp).getTime()-new Date(n.timestamp).getTime());const X=[],ye=ne.slice(0,3),ie=fe.slice(0,4);X.push(...ye.slice(0,2));const re=ye.slice(2),Ge=Math.max(re.length,ie.length);for(let n=0;n<Ge;n++)ie[n]&&X.push(ie[n]),re[n]&&X.push(re[n]);J(ne.length),K(X.slice(0,7)),V(s.credits_balance||0);const be=new Date(new Date().getFullYear(),new Date().getMonth(),1).toISOString(),{count:Ke}
1=await y.from("qualify_leads").select("*",{count:"exact",head:!0}).eq("agency_id",b).gte("created_at",be);F(Ke||0);const{data:ae}=await y.from("biens_publies").select("id").eq("agent_id",f.id);if(ae&&ae.length>0){const n=ae.map(T=>T.id),o=be.split("T")[0],{data:u}=await y.from("page_view_daily").select("count").in("bien_id",n).gte("view_date",o);Le((u||[]).reduce((T,se)=>T+(se.count||0),0))}const{data:Ye}=await y.from("rune_agent_insights").select("insight_key, mode, value, computed_at").eq("agent_id",f.id);De(Ye||[]);const{data:Xe}=await y.from("qualify_leads").select("simulation_data").eq("agency_id",b).gte("created_at",new Date(M-30*864e5).toISOString()),{data:Qe}=await y.from("biens_publies").select("commune_data").eq("agent_id",f.id),we=new Set;(Qe||[]).forEach(n=>{var u,T;const o=(T=(u=n.commune_data)==null?void 0:u.nom_commune)==null?void 0:T.toLowerCase();o&&we.add(o)});const oe=new Map;(Xe||[]).forEach(n=>{const o=n.simulation_data;if(!(o!=null&&o.commune_name))return;const u=o.commune_name.toLowerCase();if(we.has(u))return;const T=oe.get(u)||{name:o.commune_name,budgets:[]};o.prix_achat>0&&T.budgets.push(o.prix_achat),oe.set(u,T)});let Q=null;oe.forEach(n=>{if(n.budgets.length>=3){const o=[...n.budgets].sort((T,se)=>T-se),u=o[Math.floor(o.length/2)];(!Q||n.budgets.length>Q.demand)&&(Q={commune:n.name,demand:n.budgets.length,budget_median:u})}}),Ae(Q),x(!1)})()},[s]);const Fe=c.useMemo(()=>{const g=new Date().getHours();return g<12?i("Bonjour","Goedemorgen","Good morning"):g<18?i("Bon après-midi","Goedemiddag","Good afternoon"):i("Bonsoir","Goedenavond","Good evening")},[r]),Re=c.useMemo(()=>{const g=r==="en"?"en-GB":r==="nl"?"nl-BE":"fr-BE";return new Date().toLocaleDateString(g,{weekday:"long",day:"numeric",month:"long"}).toUpperCase()},[r]),$=c.useMemo(()=>m||j.filter(g=>["hot_lead","callback","vendeur_reply","followup_due"].includes(g.type)).length,[m,j]),Ee=c.useMemo(()=>{const g=new Date().getHours(),b=new Date().getDay()===5&&g>=17,B=j.filter(L=>L.type==="callback").length,ee=j.filter(L=>L.type==="hot_lead").length,te=j.filter(L=>L.type==="vendeur_reply").length,N=j.find(L=>L.type==="callback");if(b&&$>0)return i(`Le weekend approche. ${$} action${$>1?"s":""} avant de clôturer la semaine.`,`Het weekend nadert. ${$} acti${$>1?"es":"e"} voor het weekend.`,`Weekend approaching. ${$} action${$>1?"s":""} before wrapping up.`);if($>=3)return i(`${$} priorités vous attendent aujourd'hui.`,`${$} prioriteiten vandaag.`,`${$} priorities today.`);if(B===1&&ee===0&&te===0&&N)return i(`${N.primary} a demandé un rappel.`,`${N.primary} vroeg een terugbelafspraak.`,`${N.primary} requested a callback.`);if($===1){const L=j.find(M=>["hot_lead","callback","vendeur_reply","followup_due"].includes(M.type));if(L){const U={hot_lead:i("Lead chaud","Heet","Hot lead"),callback:i("Rappel demandé","Terugbellen","Callback"),vendeur_reply:i("Réponse vendeur","Verkoper antwoordde","Seller reply"),followup_due:i("à relancer","Op te volgen","Follow up")}[L.type]??i("à traiter","Te behandelen","To handle");return i(`${U} : ${L.primary}.`,`${U}: ${L.primary}.`,`${U}: ${L.primary}.`)}}return $===2?i("2 priorités vous attendent aujourd'hui.","2 prioriteiten vandaag.","2 priorities today."):j.length>0?i(`Journée tranquille. ${j.length} signaux passifs à surveiller.`,`Rustige dag. ${j.length} passieve signalen.`,`Quiet day. ${j.length} passive signals.`):i("Tout est sous contrôle.","Alles onder controle.","Everything under control.")},[j,$,r]),Me=c.useMemo(()=>O===0?null:Math.round((H-O)/O*100),[H,O]),Pe=c.useMemo(()=>{const g=I*1.4,f=Math.ceil(g/10)*10;return Math.max(40,f)},[I]);return p||l||!s?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"60px 0"},children:e.jsx(ce,{style:{width:"32px",height:"32px",animation:"spin 1s linear infinite",color:t.teal}})}):e.jsxs("div",{className:"dashboard-scope",style:{minHeight:"100vh",background:t.cream,backgroundImage:"radial-gradient(circle at 1px 1px, rgba(15,76,76,0.04) 1px, transparent 0)",backgroundSize:"32px 32px"},children:[e.jsx("style",{children:` 2 @keyframes spin { to { transform: rotate(360deg); } } 3 @keyframes fadeUp { 4 from { opacity: 0; transform: translateY(8px); } 5 to { opacity: 1; transform: translateY(0); } 6 } 7 8 /* âââ Indicateur momentum (live dot pulsant) âââ */ 9 @keyframes liveDotPulse { 10 0%, 100% { box-shadow: 0 0 0 0 rgba(5,150,105,0.5); } 11 70% { box-shadow: 0 0 0 6px rgba(5,150,105,0); } 12 } 13 14 /* âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 15 SCOPE-LOCKED OVERRIDES contre arcanes.css agressif 16 âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ */ 17 18 /* Score pills : forcer les styles malgré les !important d'arcanes.css */ 19 .dashboard-scope .dash-score-pill { 20 font-size: 10px !important; 21 font-weight: 800 !important; 22 font-family: 'Outfit', sans-serif !important; 23 padding: 2px 7px !important; 24 border-radius: 4px !important; 25 font-variant-numeric: tabular-nums !important; 26 margin-left: 2px !important; 27 flex-shrink: 0 !important; 28 min-width: 22px !important; 29 text-align: center !important; 30 line-height: 1.4 !important; 31 display: inline-block !important; 32 letter-spacing: 0 !important; 33 -webkit-text-fill-color: white !important; 34 color: white !important; 35 min-height: unset !important; 36 height: auto !important; 37 width: auto !important; 38 max-width: none !important; 39 } 40 41 /* Pipeline grid : permettre à la grid de se compresser sur écran étroit */ 42 .dashboard-scope .pipeline-substats-grid { 43 display: grid !important; 44 grid-template-columns: 1fr 1fr 1fr !important; 45 gap: 0 !important; 46 } 47 .dashboard-scope .pipeline-substats-grid > * { 48 min-width: 0 !important; 49 overflow: hidden !important; 50 } 51 52 /* Pipeline hero : stack vertical sur mobile, border-top au lieu de border-left */ 53 @media (max-width: 640px) { 54 .dashboard-scope .pipeline-hero { 55 flex-direction: column !important; 56 gap: 14px !important; 57 padding: 18px 18px 16px !important; 58 } 59 .dashboard-scope .pipeline-hero > div:last-child { 60 border-left: none !important; 61 border-top: 1px solid #F0EBE2 !important; 62 padding-left: 0 !important; 63 padding-top: 14px !important; 64 } 65 .dashboard-scope .ministat-label { 66 white-space: normal !important; 67 overflow: visible !important; 68 text-overflow: clip !important; 69 letter-spacing: 0.4px !important; 70 line-height: 1.2 !important; 71 } 72 } 73 74 .stagger-1 { animation: fadeUp 0.5s ease forwards 0.05s; opacity: 0; } 75 .stagger-2 { animation: fadeUp 0.5s ease forwards 0.12s; opacity: 0; } 76 .stagger-3 { animation: fadeUp 0.5s ease forwards 0.20s; opacity: 0; } 77 .stagger-4 { animation: fadeUp 0.5s ease forwards 0.28s; opacity: 0; } 78 79 /* âââ Boutons d'action feed (mini icons) âââ */ 80 .feed-action-btn { 81 width: 26px;
82 height: 26px; 83 border-radius: 6px; 84 display: inline-flex; 85 align-items: center; 86 justify-content: center; 87 text-decoration: none; 88 transition: transform 0.12s ease, background 0.12s ease; 89 } 90 .feed-action-btn:active { transform: scale(0.92); } 91 .feed-action-tel { 92 background: ${t.teal}; 93 color: white; 94 } 95 .feed-action-tel:hover { background: ${t.tealDark}; } 96 .feed-action-wa { 97 background: transparent; 98 border: 1.5px solid ${t.border}; 99 color: ${t.muted}; 100 } 101 .feed-action-wa:hover { background: ${t.borderLight}; } 102 103 /* Desktop : boutons cachés au repos, visibles au hover de la ligne */ 104 @media (min-width: 769px) { 105 .feed-actions { 106 opacity: 0; 107 transform: translateX(6px); 108 transition: opacity 0.15s ease, transform 0.15s ease; 109 pointer-events: none; 110 } 111 .feed-row:hover .feed-actions { 112 opacity: 1; 113 transform: translateX(0); 114 pointer-events: auto; 115 } 116 } 117 /* Mobile : boutons cachés (le tap sur la ligne ouvre la fiche, qui contient les actions) */ 118 @media (max-width: 768px) { 119 .feed-actions { display: none !important; } 120 } 121 122 /* âââ Active state sur les lignes du feed (feedback tactile) âââ */ 123 .feed-row { transition: background 0.12s ease, transform 0.05s ease; } 124 .feed-row:active { transform: scale(0.995); background: rgba(15,76,76,0.05) !important; } 125 126 /* âââ Header mobile : éviter chevauchement chip avec hamburger menu âââ */ 127 @media (max-width: 768px) { 128 .header-top-row { 129 flex-direction: column !important; 130 align-items: flex-start !important; 131 gap: 10px !important; 132 } 133 .header-urgent-chip { align-self: flex-start !important; } 134 } 135 136 /* âââ Footer compte mobile âââ */ 137 @media (max-width: 700px) { 138 .home-account-footer { 139 grid-template-columns: 1fr 1fr !important; 140 row-gap: 14px !important; 141 } 142 .home-account-footer > :nth-child(1) { 143 grid-column: 1 / -1; 144 border-bottom: 1px solid ${t.borderLight}; 145 padding-bottom: 12px; 146 } 147 .home-account-footer > :nth-child(2), 148 .home-account-footer > :nth-child(3) { 149 border-left: none !important; 150 padding-left: 0 !important; 151 } 152 .home-account-footer > :nth-child(4) { 153 grid-column: 1 / -1; 154 justify-self: stretch; 155 } 156 } 157 158 /* âââ Padding-bottom mobile pour ne pas que le FAB chevauche le contenu âââ */ 159 @media (max-width: 1023px) { 160 .home-content { padding-bottom: 110px !important; } 161 } 162 163 @media (min-width: 1024px) { 164 .home-grid { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; } 165 .home-rune-panel { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; } 166 .home-rune-panel::-webkit-scrollbar { width: 4px; } 167 .home-rune-panel::-webkit-scrollbar-thumb { background: rgba(15,76,76,0.15); border-radius: 4px; } 168 } 169 @media (max-width: 1023px) { 170 .home-rune-panel { display: none; } 171 } 172 `}),e.jsxs("div",{className:"home-content",style:{maxWidth:"1280px",margin:"0 auto",padding:"92px 20px 80px"},children:[e.jsxs("div",{className:"stagger-1",style:{marginBottom:"32px"},children:[e.jsxs("div",{className:"header-top-row",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"16px",flexWrap:"wrap",marginBottom:"14px",minHeight:"28px"},children:[e.jsxs("div",{style:{fontSize:"12px",fontWeight:800,color:t.goldDark,letterSpacing:"2.5px",fontFamily:"'Outfit', sans-serif",display:"inline-flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{display:"inline-block",width:"20px",height:"2px",background:t.gold,borderRadius:"2px"}}),Re]}),$>0&&e.jsxs("div",{className:"header-urgent-chip",role:"button",tabIndex:0,onClick:()=>{var g;return(g=document.getElementById("fil-activite"))==null?void 0:g.scrollIntoView({behavior:"smooth",block:"start"})},onKeyDown:g=>{var f;(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),(f=document.getElementById("fil-activite"))==null||f.scrollIntoView({behavior:"smooth",block:"start"}))},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 14px",background:t.text,color:"white",borderRadius:"999px",fontSize:"12px",fontWeight:700,letterSpacing:"0.3px",boxShadow:"0 4px 12px rgba(13,17,9,0.15)",cursor:"pointer"},children:[e.jsx(ue,{style:{width:"13px",height:"13px",color:t.gold,fill:t.gold}}),$," ",$>1?i("actions urgentes","urgente acties","urgent actions"):i("action urgente","urgente actie","urgent action")]})]}),e.jsxs("h1",{style:{fontFamily:"'Outfit', sans-serif",fontSize:"clamp(30px, 4.5vw, 42px)",fontWeight:800,color:t.text,lineHeight:1.05,letterSpacing:"-1.5px",marginBottom:"10px"},children:[Fe,","," ",e.jsx("span",{style:{fontStyle:"italic",fontWeight:400,color:t.tealLight},children:s.first_name}),"."]}),e.jsx("p",{style:{fontSize:"15px",color:t.muted,lineHeight:1.55,maxWidth:"680px"},children:Ee})]}),e.jsx(ht,{}),e.jsxs("div",{className:"home-grid",children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"28px",minWidth:0},children:[e.jsxs("div",{className:"stagger-2",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,color:t.muted,textTransform:"uppercase",letterSpacing:"1.2px"},children:i("Pipeline","Pipeline","Pipeline")}),e.jsxs("button",{onClick:()=>a("/pro/intelligence"),style:{background:"transparent",border:"none",color:t.teal,fontSize:"11px",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"3px"},children:[e.jsx(nt,{style:{width:"11px",height:"11px"}}),i("Vue analytique","Analyse","Analytics")]})]}),e.jsx(bt,{activeBuyerLeads:w,weekDelta:Me,leadsThisWeek:H,monthCurrent:I,monthGoal:Pe,vendeurs:S,vendeurNames:z,mandats:d,pipelineTotal:_,onClickLeads:()=>a("/pro/leads"),onClickVendeurs:()=>a("/pro/leads?tab=vendeurs"),onClickMandats:()=>a("/pro/biens"),lang:r})]}),e.jsxs("div",{className:"stagger-3",id:"fil-activite",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,color:t.muted,textTransform:"uppercase",letterSpacing:"1.2px"},children:i("Fil d'activité","Activiteit","Activity feed")}),j.length>0&&e.jsxs("button",{onClick:()=>a("/pro/leads"),style:{background:"transparent",border:"none",color:t.teal,fontSize:"11px",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"3px"},children:[i("Voir tout","Alles","View all")," ",e.jsx(q,{style:{width:"11px",height:"11px"}})]})]}),j.length>0?e.jsx("div",{style:{background:t.paper,border:`1.5px solid ${t.border}`,borderRadius:"14px",overflow:"hidden"},children:(()=>{const g=j.filter(b=>["hot_lead","callback","vendeur_reply","followup_due"].includes(b.type)),f=j.filter(b=>!["hot_lead","callback","vendeur_reply","followup_due"].includes(b.type));return e.jsxs(e.Fragment,{children:[g.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ce,{label:i("à traiter","Urgent","Urgent"),count:g.length,accent:t.red,isFirst:!0}),e.jsx("div",{style:{padding:"0"},children:g.map((b,B)=>e.jsx($e,{item:b,lang:r,navigate:a,isLast:B===g.length-1&&f.length===0},b.id))})]}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ce,{label:i("Activité récente","Activiteit","Recent activity"),count:f.length,accent:t.teal,isFirst:g.length===0}),e.jsx("div",{style:{padding:"0"},children:f.map((b,B)=>e.jsx($e,{item:b,lang:r,navigate:a,isLast:B===f.length-1},b.id))})]})]})})()}):e.jsxs("div",{style:{padding:"40px 24px",background:"rgba(15,76,76,0.025)",border:`1.5px dashed ${t.border}`,borderRadius:"14px",textAlign:"center"},children:[e.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"12px",background:"rgba(15,76,76,0.06)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 14px"},children:e.jsx(pe,{style:{width:"22px",height:"22px",color:t.teal}})}),e.jsx("div",{style:{fontSize:"15px",fontWeight:700,color:t.text,marginBottom:"6px"},children:i("Pas d'activité aujourd'hui","Geen activiteit","No activity")}),e.jsx("p",{style:{fontSize:"13px",color:t.muted,marginBottom:"16
172px",maxWidth:"360px",margin:"0 auto 16px"},children:i("Tout est sous contrôle. Profitez-en pour publier un nouveau bien ou prospecter une zone.","Alles onder controle.","Everything under control.")}),e.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"center",flexWrap:"wrap"},children:[e.jsxs("button",{onClick:()=>a("/pro/annonce"),style:{padding:"9px 16px",background:t.teal,color:"white",border:"none",borderRadius:"8px",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:[i("Nouveau bien","Nieuw pand","New listing")," â"]}),e.jsxs("button",{onClick:()=>a("/pro/intelligence"),style:{padding:"9px 16px",background:"transparent",border:`1.5px solid ${t.border}`,color:t.teal,borderRadius:"8px",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:[i("Voir l'intelligence","Analyse","Analytics")," â"]})]})]})]}),e.jsxs("div",{className:"stagger-4 home-account-footer",style:{padding:"16px 20px",background:t.paper,border:`1.5px solid ${t.border}`,borderRadius:"12px",display:"grid",gridTemplateColumns:"minmax(180px, 1fr) 1fr 1fr auto",gap:"20px",alignItems:"center"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",minWidth:0},children:[e.jsx(it,{style:{width:"16px",height:"16px",color:t.gold,flexShrink:0}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"5px",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"4px"},children:[e.jsx("span",{style:{fontFamily:"'Outfit', sans-serif",fontSize:"16px",fontWeight:800,color:t.text,fontVariantNumeric:"tabular-nums"},children:E}),e.jsxs("span",{style:{fontSize:"11px",color:t.mutedLight,fontWeight:500},children:["/ ",xe]}),e.jsx("span",{style:{fontSize:"10px",color:t.muted,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.6px",marginLeft:"4px"},children:i("crédits","credits","credits")})]}),e.jsx("div",{style:{height:"3px",width:"180px",maxWidth:"100%",background:t.borderLight,borderRadius:"999px",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Math.min(100,E/xe*100)}%`,background:E<5?t.red:t.teal,transition:"width 0.6s ease"}})})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"8px",borderLeft:`1px solid ${t.borderLight}`,paddingLeft:"20px"},children:[e.jsx("span",{style:{fontFamily:"'Outfit', sans-serif",fontSize:"20px",fontWeight:800,color:t.text,fontVariantNumeric:"tabular-nums",letterSpacing:"-0.4px"},children:I}),e.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:t.muted,textTransform:"uppercase",letterSpacing:"0.6px"},children:i("Leads / mois","Leads","Leads / month")})]}),e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"8px",borderLeft:`1px solid ${t.borderLight}`,paddingLeft:"20px"},children:[e.jsx("span",{style:{fontFamily:"'Outfit', sans-serif",fontSize:"20px",fontWeight:800,color:t.text,fontVariantNumeric:"tabular-nums",letterSpacing:"-0.4px"},children:Ie}),e.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:t.muted,textTransform:"uppercase",letterSpacing:"0.6px"},children:i("Vues / mois","Views","Views / month")})]}),e.jsxs("button",{onClick:()=>a("/pro/facturation"),style:{padding:"8px 14px",background:"transparent",border:`1.5px solid ${t.border}`,color:t.teal,borderRadius:"7px",fontSize:"12px",fontWeight:600,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"5px",whiteSpace:"nowrap"},children:[i("Facturation","Facturatie","Billing")," ",e.jsx(q,{style:{width:"12px",height:"12px"}})]})]})]}),e.jsx("div",{className:"home-rune-panel stagger-3",children:e.jsx(vt,{insights:ze,communeOpp:Te,lang:r,navigate:a})})]})]})]})},Mt=()=>{const r=et(),{language:a}=tt(),[i,s]=c.useState(!0),[p,l]=c.useState(!1),[x,w]=c.useState(null);return c.useEffect(()=>{(async()=>{const{data:{user:S}}=await y.auth.getUser();if(!S){l(!1),s(!1);return}l(!0);const{data:h}=await y.from("profiles").select("account_type").eq("id",S.id).maybeSingle();w((h==null?void 0:h.account_type)||null),s(!1)})()},[]),i?e.jsxs(e.Fragment,{children:[e.jsx(ve,{title:"Arcanes Pro",description:"Espace agent professionnel Arcanes"}),e.jsx(ke,{}),e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"60px 0",minHeight:"60vh"},children:e.jsx(ce,{style:{width:"32px",height:"32px",animation:"spin 1s linear infinite",color:t.teal}})}),e.jsx(je,{})]}
172):e.jsxs(e.Fragment,{children:[e.jsx(ve,{title:"Arcanes Pro",description:"Espace agent professionnel Arcanes"}),e.jsx(ke,{}),p?x==="agent_pending"?e.jsx(St,{lang:a}):e.jsx(kt,{lang:a,navigate:r}):e.jsx(jt,{lang:a,navigate:r}),e.jsx(je,{})]})};export{Mt 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.