PageSourceSearch

https://arcanes.be/assets/ProAnnonce-smLolmnY.js

js arcanes.be collected 2026-09-25 12:39:39 UTC 210,683 bytes, 184 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/heic2any-BgmgTiVd.js","assets/index-DrUUimuw.js","assets/index-CHXb3IAR.css"])))=>i.map(i=>d[i]);
2import{p as tn,r as c,s as ee,j as e,S as wt,X as Rt,H as Yi,i as bt,C as xt,l as Nr,u as mn,A as Gn,aR as We,a3 as Ji,$ as Ki,N as Xi,c7 as Hn,au as Zi,o as eo,al as Yn,c8 as to,k as no,am as ro,bZ as io,a as oo,bg as so,J as te,c as ao,c0 as lo,e as co,ac as po,aE as uo}from"./index-DrUUimuw.js";import{M as ho}from"./maximize-2-D7WzHWnW.js";import{I as go,P as fo}from"./ProHeader-CgTBsN4-.js";import{P as xo,o as mo}from"./SocialCarousel-CME2SvIg.js";import{M as bo}from"./MandateSignedModal-D_WDuV3U.js";import{C as en}from"./circle-check-VayDmf26.js";import{R as Wr}from"./rotate-ccw-D161T2jj.js";import{C as yo}from"./copy-DrC_A2m3.js";import{M as vo}from"./message-circle-BpsXla9d.js";import"./useQuery-DwWUaKo1.js";import"./useTranslation-DrxfdMzy.js";import"./index-BDYaNOtB.js";import"./send-q88PUeoO.js";import"./key-DP5dv30E.js";import"./refresh-cw-B9MHLCH7.js";/**
3 * @license lucide-react v0.462.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const wo=tn("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
8 * @license lucide-react v0.462.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const jo=tn("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/**
13 * @license lucide-react v0.462.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const ko=tn("Pencil",[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
18 * @license lucide-react v0.462.0 - ISC
19 *
20 * This source code is licensed under the ISC license.
21 * See the LICENSE file in the root directory of this source tree.
22 */const So=tn("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/**
23 * @license lucide-react v0.462.0 - ISC
24 *
25 * This source code is licensed under the ISC license.
26 * See the LICENSE file in the root directory of this source tree.
27 */const Co=tn("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]),Ur="https://api.arcanes.be",Fr=`${Ur}/functions/v1`,Q={teal:"#0F4C4C",tealLight:"#1E6B7E",gold:"#D4AF37",goldDark:"#B8962E",cream:"#F8F6F3",border:"#E6E1DA",muted:"#94A3B8",text:"#0F4C4C",ink:"#1A2E2E"};function Eo({open:u,onClose:a,bienId:x,apiKey:n,language:T,localPhotos:C=[],onEnsureBien:q,onPhotosChanged:L}){var ve,Ue,pe,Be,tt,qe;const i=(h,v,E)=>T==="nl"?v:T==="en"?E:h,[s,l]=c.useState(!1),[o,p]=c.useState(!1),[g,k]=c.useState([]),[R,F]=c.useState(x),[N,I]=c.useState(null),[_,Y]=c.useState(new Set),[D,ce]=c.useState(!1),[B,G]=c.useState(null),m=c.useRef(null),re=c.useCallback(async h=>{const{data:v,error:E}=await ee.from("bien_photos").select("id, position, active_variant_id").eq("bien_id",h).is("deleted_at",null).order("position",{ascending:!0});if(E){I(E.message);return}if(!v||v.length===0){k([]);return}const ge=v.map(xe=>xe.id),{data:Oe,error:je}
27=await ee.from("photo_variants").select("id, photo_id, kind, status, storage_bucket, storage_path, created_at").in("photo_id",ge).order("created_at",{ascending:!1});if(je){I(je.message);return}const Ee=(xe,J)=>J?xe?`${Ur}/storage/v1/object/public/${xe}/${J}`:J:null,Te=v.map(xe=>{const J=(Oe||[]).filter(Xe=>Xe.photo_id===xe.id),Ne=J.find(Xe=>Xe.kind==="original"),de=J.find(Xe=>Xe.kind==="corrected"),nt=de&&xe.active_variant_id===de.id?de:Ne;return{key:`mod-${xe.id}`,photoId:xe.id,position:xe.position,activeVariantId:xe.active_variant_id,displayUrl:nt?Ee(nt.storage_bucket,nt.storage_path):null,original:Ne?{id:Ne.id,kind:"original",status:Ne.status,url:Ee(Ne.storage_bucket,Ne.storage_path)}:void 0,corrected:de?{id:de.id,kind:"corrected",status:de.status,url:Ee(de.storage_bucket,de.storage_path)}:void 0}});k(Te)},[]),b=new Map;for(const h of g)b.set(h.position,h);C.forEach((h,v)=>{b.has(v)||b.set(v,{key:`loc-${h.id||v}`,photoId:null,position:v,displayUrl:h.url,activeVariantId:null})});const se=Array.from(b.values()).sort((h,v)=>h.position-v.position),U=h=>!h.corrected||h.corrected.status==="failed",ae=se.filter(U),z=g.some(h=>h.corrected&&(h.corrected.status==="pending"||h.corrected.status==="ingesting"));c.useEffect(()=>{u&&Y(new Set(ae.map(h=>h.position)))},[u,se.length,g.length]);const le=h=>{Y(v=>{const E=new Set(v);return E.has(h)?E.delete(h):E.add(h),E})},ne=()=>Y(new Set(ae.map(h=>h.position))),Me=()=>Y(new Set),ie=c.useCallback(h=>{m.current&&window.clearInterval(m.current),m.current=window.setInterval(()=>re(h),4e3)},[re]),ze=c.useCallback(()=>{m.current&&(window.clearInterval(m.current),m.current=null)},[]);c.useEffect(()=>{z||ze()},[z,ze]),c.useEffect(()=>{if(!u){ze(),ce(!1),G(null);return}return R&&re(R),()=>ze()},[u,R,re,ze]),c.useEffect(()=>{F(x)},[x]),c.useEffect(()=>{if(!B)return;const h=v=>{v.key==="Escape"&&G(null)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[B]);const me=async()=>{ce(!1),I(null);const h=Array.from(_);if(h.length===0)return;p(!0);let v=null;try{v=await q()}catch{I(i("La sauvegarde des photos a échoué.","Opslaan mislukt.","Saving photos failed.")),p(!1);return}if(p(!1),!v){I(i("Renseignez au moins l'adresse et le prix pour continuer.","Adres en prijs vereist.","Add an address and price to continue."));return}F(v),l(!0);try{const E=await fetch(`${Fr}/photo-enhance`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({bien_id:v,positions:h})});if(!E.ok){const ge=await E.text().catch(()=>"");throw new Error(`${E.status} ${ge.slice(0,140)}`)}await re(v),ie(v)}catch(E){I(i("Le lancement de la correction a échoué.","Correctie starten mislukt.","Couldn't start enhancement.")+" "+(E.message||""))}finally{l(!1)}},Re=async(h,v)=>{if(R){I(null);try{const E=await fetch(`${Fr}/photo-activate`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({bien_id:R,activations:[{photo_id:h,variant_id:v}]})});if(!E.ok){const ge=await E.text().catch(()=>"");throw new Error(`${E.status} ${ge.slice(0,140)}`)}await re(R)}catch(E){I(i("Le changement de version a échoué.","Wisselen mislukt.","Couldn't switch version.")+" "+(E.message||""))}}};if(!u)return null;const ke=()=>{const h=se.map(v=>v.displayUrl).filter(v=>!!v&&/^https?:\/\//.test(v));h.length>0&&(L==null||L(h)),a()},we=_.size,Fe=g.filter(h=>{var v;return((v=h.corrected)==null?void 0:v.status)==="ready"}).length,be=B?se.find(h=>h.key===B):null,he={position:"fixed",inset:0,background:"rgba(15,46,46,0.55)",backdropFilter:"blur(3px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:3e3,padding:"24px"},Ie={background:"white",borderRadius:"20px",width:"min(760px, 100%)",maxHeight:"88vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 24px 70px rgba(15,46,46,0.30)",position:"relative"},fe=(h,v=!1)=>({padding:"8px 14px 12px",fontSize:"13px",fontWeight:h?800:600,color:v?Q.muted:h?Q.teal:Q.tealLight,borderBottom:h?`2.5px solid ${Q.gold}`:"2.5px solid transparent",display:"flex",alignItems:"center",gap:"6px",cursor:v?"default":"pointer",opacity:v?.5:1,background:"none",border:"none",borderBottomStyle:"solid"}),Ge={cursor:"pointer",padding:"0 2px",fontSize:11.5,fontWeight:700,color:Q.tealLight,textDecoration:"underline"};return e.jsxs("div",{style:he,onClick:a,role:"dialog","aria-modal":"true",children:[e.jsxs("div",{style:Ie,onClick:h=>h.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 22px 16px",borderBottom:`1px solid ${Q.border}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"9px"},children:[e.jsx("div",{style:{width:30,height:30,borderRadius:8,background:"rgba(212,175,55,0.14)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(wt,{style:{width:16,height:16,color:Q.gold}})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"'DM Serif Display', serif",fontSize:"19px",color:Q.ink,lineHeight:1.1},children:i("Studio photo","Fotostudio","Photo studio")}
27),e.jsx("div",{style:{fontSize:"11px",color:Q.muted,marginTop:1},children:i("Chaque photo garde son original","Elke foto behoudt het origineel","Every photo keeps its original")})]})]}),e.jsx("button",{onClick:a,"aria-label":"Fermer",style:{background:"none",border:"none",cursor:"pointer",padding:6,borderRadius:6,color:Q.muted,display:"flex"},children:e.jsx(Rt,{style:{width:20,height:20}})})]}),e.jsxs("div",{style:{display:"flex",gap:"4px",padding:"12px 22px 0"},children:[e.jsx("div",{role:"tab","aria-selected":!0,style:fe(!0),children:i("Correction","Correctie","Enhancement")}),e.jsxs("div",{role:"tab","aria-disabled":!0,style:fe(!1,!0),title:i("Bientôt disponible","Binnenkort","Coming soon"),children:[e.jsx(Yi,{style:{width:13,height:13}}),i("Home staging","Home staging","Home staging"),e.jsx("span",{style:{fontSize:"9px",fontWeight:700,padding:"1px 6px",borderRadius:20,background:Q.cream,color:Q.muted},children:i("bientôt","binnenkort","soon")})]})]}),e.jsx("div",{style:{height:1,background:Q.border}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,padding:"14px 22px",background:Q.cream,borderBottom:`1px solid ${Q.border}`},children:[e.jsx("div",{style:{fontSize:"12.5px",color:Q.tealLight,lineHeight:1.45},children:ae.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("strong",{style:{color:Q.teal},children:[we," ",i(we>1?"photos sélectionnées":"photo sélectionnée",we>1?"foto's geselecteerd":"foto geselecteerd",we>1?"photos selected":"photo selected")]}),e.jsx("span",{style:{margin:"0 8px",color:Q.border},children:"·"}),e.jsx("span",{role:"button",tabIndex:0,style:Ge,onClick:ne,children:i("Tout","Alles","All")}),e.jsx("span",{style:{color:Q.border},children:" / "}),e.jsx("span",{role:"button",tabIndex:0,style:Ge,onClick:Me,children:i("Aucune","Geen","None")})]}):i("Toutes les photos sont corrigées.","Alle foto's zijn gecorrigeerd.","All photos are enhanced.")}),e.jsxs("button",{onClick:()=>ce(!0),disabled:s||o||z||we===0,style:{padding:"11px 18px",borderRadius:10,border:"none",whiteSpace:"nowrap",background:s||o||z||we===0?Q.muted:Q.gold,color:"white",fontWeight:700,fontSize:"13px",cursor:s||o||z||we===0?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:7,boxShadow:s||o||z||we===0?"none":"0 2px 8px rgba(212,175,55,0.35)",transition:"all .15s ease"},children:[s||o?e.jsx(bt,{style:{width:15,height:15,animation:"aeSpin 1s linear infinite"}}):e.jsx(wt,{style:{width:15,height:15}}),o?i("Sauvegarde…","Opslaan…","Saving…"):z?i("Correction en cours…","Bezig…","Enhancing…"):i("Corriger la sélection","Selectie corrigeren","Enhance selection")]})]}),e.jsxs("div",{style:{padding:"20px 22px 24px",overflowY:"auto",flex:1},children:[N&&e.jsx("div",{style:{padding:"11px 13px",borderRadius:9,background:"#FEF2F2",color:"#991B1B",fontSize:"12.5px",marginBottom:16,border:"1px solid #FECACA"},children:N}),se.length===0?e.jsxs("div",{style:{textAlign:"center",padding:"48px 24px"},children:[e.jsx("div",{style:{width:56,height:56,margin:"0 auto 16px",borderRadius:14,background:Q.cream,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(jo,{style:{width:26,height:26,color:Q.gold}})}),e.jsx("div",{style:{fontFamily:"'DM Serif Display', serif",fontSize:"17px",color:Q.ink,marginBottom:6},children:i("Ajoutez des photos pour commencer","Voeg foto's toe om te beginnen","Add photos to get started")}),e.jsx("div",{style:{fontSize:"13px",color:Q.muted,maxWidth:340,margin:"0 auto",lineHeight:1.5},children:i("Glissez vos photos dans la zone d'upload, puis revenez ici pour les corriger.","Sleep je foto's naar het uploadvak en kom hier terug.","Drop your photos in the upload area, then come back here to enhance them.")})]}):e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(210px, 1fr))",gap:16},children:se.map(h=>{var Ee,Te,xe,J,Ne;const v=(Ee=h.corrected)==null?void 0:Ee.status,E=h.corrected&&h.activeVariantId===h.corrected.id,ge=U(h),Oe=_.has(h.position),je=!!(h.photoId&&((Te=h.corrected)==null?void 0:Te.status)==="ready"&&((xe=h.original)!=null&&xe.url)&&((J=h.corrected)!=null&&J.url));return e.jsxs("div",{style:{borderRadius:12,overflow:"hidden",background:"white",border:`2px solid ${ge&&Oe?Q.gold:Q.border}`,transition:"border-color .15s ease"},children:[e.jsxs("div",{style:{position:"relative",aspectRatio:"4/3",background:Q.cream,cursor:ge||je?"pointer":"default"},onClick:()=>{je?G(h.key):ge&&le(h.position)},children:[h.displayUrl?e.jsx("img",{src:h.displayUrl,alt:"",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:Q.muted,fontSize:11},children:"—"}),ge&&e.jsx("div",{style:{position:"absolute",top:9,right:9,width:22,height:22,borderRadius:6,background:Oe?Q.gold:"rgba(255,255,255,0.9)",border:Oe?`2px solid ${Q.gold}
27`:"2px solid rgba(255,255,255,0.9)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 4px rgba(0,0,0,0.2)",transition:"all .12s ease"},children:Oe&&e.jsx(xt,{style:{width:14,height:14,color:"white",strokeWidth:3}})}),je&&e.jsxs("div",{style:{position:"absolute",bottom:9,right:9,padding:"5px 9px",borderRadius:7,background:"rgba(255,255,255,0.94)",color:Q.teal,fontSize:10.5,fontWeight:800,display:"flex",alignItems:"center",gap:4,boxShadow:"0 1px 5px rgba(0,0,0,0.18)"},children:[e.jsx(ho,{style:{width:11,height:11}}),i("Comparer","Vergelijk","Compare")]}),e.jsxs("div",{style:{position:"absolute",top:9,left:9,padding:"4px 9px",borderRadius:7,fontSize:10.5,fontWeight:800,letterSpacing:".2px",color:"white",display:"flex",alignItems:"center",gap:4,backdropFilter:"blur(4px)",background:v==="ready"?"rgba(15,76,76,0.92)":v==="failed"?"rgba(153,27,27,0.92)":v==="pending"||v==="ingesting"?"rgba(184,150,46,0.92)":"rgba(148,163,184,0.85)"},children:[v==="ready"&&e.jsx(xt,{style:{width:11,height:11}}),(v==="pending"||v==="ingesting")&&e.jsx(bt,{style:{width:11,height:11,animation:"aeSpin 1s linear infinite"}}),v==="ready"?i("Corrigée","Gecorrigeerd","Enhanced"):v==="failed"?i("Échec","Mislukt","Failed"):v==="pending"||v==="ingesting"?i("En cours","Bezig","Working"):i("Originale","Origineel","Original")]})]}),h.photoId&&((Ne=h.corrected)==null?void 0:Ne.status)==="ready"&&e.jsxs("div",{style:{display:"flex",padding:6,gap:6},children:[e.jsx("button",{onClick:()=>{var de;return Re(h.photoId,((de=h.original)==null?void 0:de.id)??null)},style:{flex:1,padding:"7px",borderRadius:7,border:"none",fontSize:11.5,fontWeight:700,cursor:"pointer",transition:"all .12s ease",background:E?Q.cream:Q.teal,color:E?Q.tealLight:"white"},children:i("Originale","Origineel","Original")}),e.jsx("button",{onClick:()=>Re(h.photoId,h.corrected.id),style:{flex:1,padding:"7px",borderRadius:7,border:"none",fontSize:11.5,fontWeight:700,cursor:"pointer",transition:"all .12s ease",background:E?Q.gold:Q.cream,color:E?"white":Q.goldDark},children:i("Corrigée","Gecorrigeerd","Enhanced")})]})]},h.key)})}),Fe>0&&e.jsxs("div",{style:{marginTop:18,padding:"11px 14px",borderRadius:9,background:"rgba(15,76,76,0.05)",fontSize:12,color:Q.teal,display:"flex",alignItems:"center",gap:8},children:[e.jsx(xt,{style:{width:14,height:14,color:Q.teal}}),i("Vos choix apparaissent dans l'annonce à la prochaine génération.","Je keuzes verschijnen in de advertentie bij de volgende generatie.","Your choices appear in the listing on the next generation.")]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:14,padding:"14px 22px",borderTop:`1px solid ${Q.border}`,background:"white"},children:[e.jsx("div",{style:{fontSize:11.5,color:Q.muted},children:z?i("Vous pouvez fermer : la correction continue en arrière-plan.","Je kunt sluiten: de correctie loopt door.","You can close: enhancement continues in the background."):i("Les versions choisies sont enregistrées.","De gekozen versies zijn opgeslagen.","Your chosen versions are saved.")}),e.jsxs("button",{onClick:ke,style:{padding:"10px 20px",borderRadius:10,border:"none",background:Q.teal,color:"white",fontWeight:700,fontSize:13,cursor:"pointer",display:"flex",alignItems:"center",gap:7,whiteSpace:"nowrap"},children:[e.jsx(xt,{style:{width:15,height:15}}),i("Terminé","Klaar","Done")]})]}),D&&e.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(255,255,255,0.94)",backdropFilter:"blur(2px)",display:"flex",alignItems:"center",justifyContent:"center",padding:28,zIndex:5},children:e.jsxs("div",{style:{maxWidth:380,textAlign:"center"},children:[e.jsx("div",{style:{width:48,height:48,margin:"0 auto 14px",borderRadius:12,background:"rgba(212,175,55,0.14)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Nr,{style:{width:24,height:24,color:Q.goldDark}})}),e.jsx("div",{style:{fontFamily:"'DM Serif Display', serif",fontSize:19,color:Q.ink,marginBottom:8},children:i(`Corriger ${we} photo${we>1?"s":""} ?`,`${we} foto${we>1?"'s":""} corrigeren?`,`Enhance ${we} photo${we>1?"s":""}?`)}),e.jsx("div",{style:{fontSize:13,color:Q.tealLight,lineHeight:1.55,marginBottom:20},children:i("Les originaux sont conservés : vous pourrez revenir en arr
27ière photo par photo. Le traitement prend quelques instants.","De originelen blijven bewaard: je kunt per foto terug. De verwerking duurt even.","Originals are kept: you can switch back photo by photo. Processing takes a moment.")}),e.jsxs("div",{style:{display:"flex",gap:10,justifyContent:"center"},children:[e.jsx("button",{onClick:()=>ce(!1),style:{padding:"10px 18px",borderRadius:9,border:`1px solid ${Q.border}`,background:"white",color:Q.tealLight,fontWeight:700,fontSize:13,cursor:"pointer"},children:i("Annuler","Annuleren","Cancel")}),e.jsxs("button",{onClick:me,style:{padding:"10px 20px",borderRadius:9,border:"none",background:Q.gold,color:"white",fontWeight:700,fontSize:13,cursor:"pointer",display:"flex",alignItems:"center",gap:7,boxShadow:"0 2px 8px rgba(212,175,55,0.35)"},children:[e.jsx(wt,{style:{width:14,height:14}}),i("Lancer la correction","Correctie starten","Start enhancement")]})]})]})})]}),be&&e.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(10,26,26,0.92)",zIndex:3100,display:"flex",flexDirection:"column",padding:"24px"},onClick:h=>{h.stopPropagation(),G(null)},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16,color:"white"},children:[e.jsx("div",{style:{fontFamily:"'DM Serif Display', serif",fontSize:18},children:i("Comparer avant / après","Vergelijk voor / na","Compare before / after")}),e.jsx("button",{onClick:h=>{h.stopPropagation(),G(null)},"aria-label":"Fermer",style:{background:"none",border:"none",cursor:"pointer",color:"rgba(255,255,255,0.75)",padding:6,display:"flex"},children:e.jsx(Rt,{style:{width:24,height:24}})})]}),e.jsxs("div",{style:{flex:1,display:"grid",gridTemplateColumns:"1fr 1fr",gap:18,minHeight:0},onClick:h=>h.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[e.jsx("div",{style:{flex:1,minHeight:0,borderRadius:12,overflow:"hidden",background:"rgba(255,255,255,0.06)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("img",{src:((ve=be.original)==null?void 0:ve.url)||"",alt:"",style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block"}})}),e.jsxs("button",{onClick:()=>{var h;Re(be.photoId,((h=be.original)==null?void 0:h.id)??null)},style:{marginTop:12,padding:"11px",borderRadius:10,border:"none",fontSize:13,fontWeight:800,cursor:"pointer",background:be.activeVariantId!==((Ue=be.corrected)==null?void 0:Ue.id)?Q.teal:"rgba(255,255,255,0.14)",color:"white",display:"flex",alignItems:"center",justifyContent:"center",gap:7},children:[be.activeVariantId!==((pe=be.corrected)==null?void 0:pe.id)&&e.jsx(xt,{style:{width:15,height:15}}),i("Garder l'originale","Origineel houden","Keep original")]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0},children:[e.jsx("div",{style:{flex:1,minHeight:0,borderRadius:12,overflow:"hidden",background:"rgba(255,255,255,0.06)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("img",{src:((Be=be.corrected)==null?void 0:Be.url)||"",alt:"",style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block"}})}),e.jsxs("button",{onClick:()=>{Re(be.photoId,be.corrected.id)},style:{marginTop:12,padding:"11px",borderRadius:10,border:"none",fontSize:13,fontWeight:800,cursor:"pointer",background:be.activeVariantId===((tt=be.corrected)==null?void 0:tt.id)?Q.gold:"rgba(255,255,255,0.14)",color:"white",display:"flex",alignItems:"center",justifyContent:"center",gap:7},children:[be.activeVariantId===((qe=be.corrected)==null?void 0:qe.id)&&e.jsx(xt,{style:{width:15,height:15}}),i("Utiliser la corrigée","Gecorrigeerde gebruiken","Use enhanced")]})]})]}),e.jsx("div",{style:{textAlign:"center",marginTop:14,fontSize:11.5,color:"rgba(255,255,255,0.55)"},children:i("Échap ou clic hors des images pour fermer","Esc of klik buiten om te sluiten","Esc or click outside to close")})]}),e.jsx("style",{children:"@keyframes aeSpin { to { transform: rotate(360deg); } }"})]})}const Se={teal:"#0F4C4C",gold:"#D4AF37",goldDark:"#B88A2E",text:"#0D1109",muted:"#7A7670",faint:"#B8B4AE",border:"#E8E4DE",soft:"#F0EDE8",success:"#16A34A",warn:"#D97706"};function _o(u,a){return u==="vendu"?4:u==="prospection"?0:a?2:1}function Ao({status:u,label:a,createdAt:x,mandateSignedAt:n,publishedAt:T,soldAt:C,readiness:q,busy:L=!1,onMandateSigned:i,onPublish:s,onMarkSold:l,onRelist:o}){const{language:p}=mn(),g=(z,le,ne)=>p==="nl"?le:p==="en"?ne:z,k=p==="nl"?"nl-BE":p==="en"?"en-GB":"fr-BE",[R,F]=c.useState(!1),N=z=>z?new Date(z).toLocaleDateString(k,{day:"numeric",month:"short"}):null,I=z=>N(z)?g(`depuis le ${N(z)}`,`sinds ${N(z)}`,`since ${N(z)}`):"—",_=z=>N(z)?g(`signé le ${N(z)}`,`getekend op ${N(z)}`,`signed ${N(z)}`):"—",Y=(z,le)=>!!z&&!!le&&Math.abs(new Date(z).getTime()-new Date(le).getTime())<24*60*60*1e3,D=_o(u,T),ce=[{key:"prospection",label:g("Prospection","Prospectie","Prospection"),sub:D===0?I(x):Y(x,n)?g("directement sous mandat","meteen onder mandaat","straight to mandate"):N(x)?`${N(x)} → ${N(n)||"…"}`:"—"},{key:"mandat",label:g("Mandat","Mandaat","Mandate"),sub:n?_(n):"—"},{key:"en_ligne",label:g("En ligne","Online","Live"),sub:T?D>=4&&C?`${N(T)} → ${N(C)}`:I(T):"—"},{key:"vendu",label:g("Vendu","Verkocht","Sold"),sub:C&&N(C)||"—"}],B=[];q.annonce||B.push(g("annonce","advertentie","listing")),q.photos<1&&B.push(g("photo","foto","photo")),q.prix||B.push(g("prix","prijs","price")),q.adresse||B.push(g("adresse","adres","address"));const G=B.length===0,m=4-B.length,re={display:"inline-flex",alignItems:"center",gap:6,padding:"9px 14px",borderRadius:10,fontSize:12,fontWeight:700,fontFamily:"'Outfit', sans-serif",curs
27or:"pointer",whiteSpace:"nowrap",border:`1px solid ${Se.border}`,background:"white",color:Se.teal},b={...re,border:"none",background:"linear-gradient(135deg, #D4AF37 0%, #B8962E 100%)",color:"white",boxShadow:"0 4px 14px rgba(212,175,55,0.25)"},se={...re,border:"1px solid rgba(212,175,55,0.5)",background:"rgba(212,175,55,0.06)",color:Se.goldDark},U={...re,background:Se.soft,color:Se.faint,cursor:"not-allowed",border:`1px solid ${Se.border}`,boxShadow:"none"};let ae=null;return D===0?ae=e.jsxs("button",{type:"button",style:L?U:b,disabled:L,onClick:()=>F(!0),children:[e.jsx(xt,{style:{width:13,height:13}}),g("Mandat signé","Mandaat ondertekend","Mandate signed")]}):D===1?ae=e.jsxs("button",{type:"button",style:L||!G?U:b,disabled:L||!G,onClick:s,title:G?void 0:g(`Manque : ${B.join(", ")}`,`Ontbreekt: ${B.join(", ")}`,`Missing: ${B.join(", ")}`),children:[L?e.jsx(bt,{style:{width:13,height:13,animation:"spin 1s linear infinite"}}):e.jsx(Gn,{style:{width:13,height:13}}),L?g("Publication…","Publiceren…","Publishing…"):g("Mettre en ligne","Online zetten","Go live")]}):D===2?ae=e.jsxs("button",{type:"button",style:L?U:se,disabled:L,onClick:l,children:[e.jsx(en,{style:{width:13,height:13}}),g("Marquer vendu","Als verkocht markeren","Mark as sold")]}):ae=e.jsxs("button",{type:"button",style:L?U:re,disabled:L,onClick:o,children:[e.jsx(Wr,{style:{width:13,height:13}}),g("Remettre en ligne","Terug online","Re-list")]}),e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
28        .pb-phase-stepper{display:flex;list-style:none;margin:0;padding:0;flex:1;min-width:0}
29        .pb-phase-stepper li{display:grid;grid-template-columns:24px 1fr;grid-template-rows:auto auto;column-gap:10px;align-items:center;flex:1;min-width:0;position:relative;padding-right:14px}
30        .pb-phase-stepper li+li::before{content:"";position:absolute;left:-14px;top:12px;width:14px;height:1px;background:${Se.border}}
31        .pb-phase-stepper .pb-node{grid-row:1/3;width:24px;height:24px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:800;border:1.5px solid ${Se.border};color:${Se.faint};background:#fff}
32        .pb-phase-stepper .pb-lab{font-size:12.5px;font-weight:700;color:${Se.faint};line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
33        .pb-phase-stepper .pb-sub{font-size:11px;color:${Se.faint};white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
34        .pb-phase-stepper li.done .pb-node{background:${Se.teal};border-color:${Se.teal};color:#fff}
35        .pb-phase-stepper li.done .pb-lab{color:${Se.teal}}.pb-phase-stepper li.done .pb-sub{color:${Se.muted}}
36        .pb-phase-stepper li.cur .pb-node{background:${Se.gold};border-color:${Se.gold};color:#fff;box-shadow:0 0 0 4px rgba(212,175,55,0.18)}
37        .pb-phase-stepper li.cur .pb-lab{color:${Se.text}}.pb-phase-stepper li.cur .pb-sub{color:${Se.goldDark};font-weight:600}
38        .pb-phase-ready{display:grid;grid-template-columns:1fr 1fr;gap:8px;list-style:none;margin:0 0 10px;padding:0}
39        .pb-phase-ready li{display:flex;align-items:center;gap:10px;padding:8px 12px;border-radius:10px;background:#FBFAF8;border:1px solid ${Se.soft};font-size:12.5px}
40        @media (max-width:760px){
41          .pb-phase-bar{flex-direction:column;align-items:stretch!important}
42          .pb-phase-stepper{flex-wrap:wrap;gap:10px 0}
43          .pb-phase-stepper li{flex:1 1 45%;padding-right:8px}
44          .pb-phase-stepper li+li::before{display:none}
45          .pb-phase-ready{grid-template-columns:1fr}
46        }
47      `}),e.jsxs("div",{className:"pb-phase-bar",style:{display:"flex",alignItems:"center",gap:16,padding:"12px 16px",background:"white",border:"1px solid rgba(15,76,76,0.10)",borderRadius:14,marginBottom:12,fontFamily:"'Outfit', sans-serif"},children:[e.jsx("ol",{className:"pb-phase-stepper",children:ce.map((z,le)=>{const ne=le<D?"done":le===D?"cur":"todo";return e.jsxs("li",{className:ne,children:[e.jsx("span",{className:"pb-node",children:ne==="done"?e.jsx(xt,{style:{width:11,height:11},strokeWidth:3}):le+1}),e.jsx("span",{className:"pb-lab",children:z.label}),e.jsx("span",{className:"pb-sub",children:z.sub})]},z.key)})}),e.jsx("div",{style:{flexShrink:0,display:"flex",gap:8},children:ae})]}),D===1&&e.jsxs("div",{style:{background:"white",border:`1px solid ${G?"rgba(212,175,55,0.55)":"rgba(217,119,6,0.45)"}`,borderRadius:14,padding:"14px 16px",marginBottom:12,fontFamily:"'Outfit', sans-serif"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6},children:[e.jsx("span",{style:{width:28,height:28,borderRadius:9,background:"rgba(15,76,76,0.07)",color:Se.teal,dis
47play:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Gn,{style:{width:15,height:15}})}),e.jsx("span",{style:{fontSize:15,fontWeight:800,color:Se.text},children:G?g("Prêt pour la mise en ligne","Klaar om online te gaan","Ready to go live"):g("Avant la mise en ligne","Voor de publicatie","Before going live")}),e.jsxs("span",{style:{marginLeft:"auto",padding:"3px 8px",borderRadius:6,fontSize:11,fontWeight:700,background:G?"rgba(22,163,74,0.10)":"rgba(217,119,6,0.10)",color:G?"#15803D":Se.warn},children:[m," / 4"]})]}),e.jsx("p",{style:{fontSize:12.5,color:Se.muted,margin:"0 0 12px",lineHeight:1.5},children:g("Rien n'est visible du public tant que vous ne mettez pas en ligne. Les conditions sont contrôlées en base au moment du geste.","Niets is zichtbaar voor het publiek tot u online gaat. De voorwaarden worden bij het gebaar in de database gecontroleerd.","Nothing is visible to the public until you go live. Conditions are enforced by the database at the moment of the action.")}),e.jsx("ul",{className:"pb-phase-ready",children:[{ok:q.annonce,label:g("Annonce générée","Advertentie gegenereerd","Listing generated"),hint:q.annonce?"":g("Générer l'annonce","Genereer de advertentie","Generate the listing")},{ok:q.photos>=1,label:g("Photos","Foto's","Photos"),hint:q.photos>=1?`${q.photos} ${q.photos>1?g("photos","foto's","photos"):g("photo","foto","photo")}`:g("Ajoutez au moins une photo (Modifier)","Voeg minstens één foto toe (Bewerken)","Add at least one photo (Edit)")},{ok:q.prix,label:g("Prix demandé","Vraagprijs","Asking price"),hint:q.prix?"":g("Renseignez le prix","Vul de prijs in","Enter the price")},{ok:q.adresse,label:g("Adresse et caractéristiques","Adres en kenmerken","Address and features"),hint:q.adresse?"":g("Complétez l'adresse","Vul het adres aan","Complete the address")}].map(z=>e.jsxs("li",{children:[e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:z.ok?Se.success:Se.warn,color:"white",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:z.ok?e.jsx(xt,{style:{width:11,height:11},strokeWidth:3}):e.jsx(Nr,{style:{width:12,height:12}})}),e.jsx("b",{style:{flex:1,color:Se.text,fontWeight:700},children:z.label}
47),e.jsx("span",{style:{fontSize:11.5,color:z.ok?Se.faint:Se.warn,fontWeight:z.ok?500:600},children:z.hint})]},z.label))}),e.jsx("div",{style:{fontSize:11.5,color:Se.faint},children:g("Le geste est dans la barre de phase : il publie la page acheteur, l'aperçu de partage et le matching.","Het gebaar zit in de fasebalk: het publiceert de koperspagina, de deelvoorvertoning en de matching.","The action lives in the phase bar: it publishes the buyer page, the share preview and the matching.")})]}),R&&e.jsx(bo,{label:a,onClose:()=>F(!1),onConfirm:i})]})}var zo=Object.defineProperty,xn=Object.getOwnPropertySymbols,qr=Object.prototype.hasOwnProperty,Hr=Object.prototype.propertyIsEnumerable,Br=(u,a,x)=>a in u?zo(u,a,{enumerable:!0,configurable:!0,writable:!0,value:x}):u[a]=x,Vn=(u,a)=>{for(var x in a||(a={}))qr.call(a,x)&&Br(u,x,a[x]);if(xn)for(var x of xn(a))Hr.call(a,x)&&Br(u,x,a[x]);return u},Qn=(u,a)=>{var x={};for(var n in u)qr.call(u,n)&&a.indexOf(n)<0&&(x[n]=u[n]);if(u!=null&&xn)for(var n of xn(u))a.indexOf(n)<0&&Hr.call(u,n)&&(x[n]=u[n]);return x};/**
48 * @license QR Code generator library (TypeScript)
49 * Copyright (c) Project Nayuki.
50 * SPDX-License-Identifier: MIT
51 */var $t;(u=>{const a=class ue{constructor(i,s,l,o){if(this.version=i,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],i<ue.MIN_VERSION||i>ue.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let k=0;k<this.size;k++)p.push(!1);for(let k=0;k<this.size;k++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const g=this.addEccAndInterleave(l);if(this.drawCodewords(g),o==-1){let k=1e9;for(let R=0;R<8;R++){this.applyMask(R),this.drawFormatBits(R);const F=this.getPenaltyScore();F<k&&(o=R,k=F),this.applyMask(R)}}T(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,s){const l=u.QrSegment.makeSegments(i);return ue.encodeSegments(l,s)}static encodeBinary(i,s){const l=u.QrSegment.makeBytes(i);return ue.encodeSegments([l],s)}static encodeSegments(i,s,l=1,o=40,p=-1,g=!0){if(!(ue.MIN_VERSION<=l&&l<=o&&o<=ue.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let k,R;for(k=l;;k++){const _=ue.getNumDataCodewords(k,s)*8,Y=q.getTotalBits(i,k);if(Y<=_){R=Y;break}if(k>=o)throw new RangeError("Data too long")}for(const _ of[ue.Ecc.MEDIUM,ue.Ecc.QUARTILE,ue.Ecc.HIGH])g&&R<=ue.getNumDataCodewords(k,_)*8&&(s=_);let F=[];for(const _ of i){x(_.mode.modeBits,4,F),x(_.numChars,_.mode.numCharCountBits(k),F);for(const Y of _.getData())F.push(Y)}T(F.length==R);const N=ue.getNumDataCodewords(k,s)*8;T(F.length<=N),x(0,Math.min(4,N-F.length),F),x(0,(8-F.length%8)%8,F),T(F.length%8==0);for(let _=236;F.length<N;_^=253)x(_,8,F);let I=[];for(;I.length*8<F.length;)I.push(0);return F.forEach((_,Y)=>I[Y>>>3]|=_<<7-(Y&7)),new ue(k,s,I,p)}getModule(i,s){return 0<=i&&i<this.size&&0<=s&&s<this.size&&this.modules[s][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),s=i.length;for(let l=0;l<s;l++)for(let o=0;o<s;o++)l==0&&o==0||l==0&&o==s-1||l==s-1&&o==0||this.drawAlignmentPattern(i[l],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const s=this.errorCorrectionLevel.formatBits<<3|i;let l=s;for(let p=0;p<10;p++)l=l<<1^(l>>>9)*1335;const o=(s<<10|l)^21522;T(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,n(o,p));this.setFunctionModule(8,7,n(o,6)),this.setFunctionModule(8,8,n(o,7)),this.setFunctionModule(7,8,n(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,n(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,n(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,n(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let l=0;l<12;l++)i=i<<1^(i>>>11)*7973;const s=this.version<<12|i;T(s>>>18==0);for(let l=0;l<18;l++){const o=n(s,l),p=this.size-11+l%3,g=Math.floor(l/3);this.setFunctionModule(p,g,o),this.setFunctionModule(g,p,o)}}drawFinderPattern(i,s){for(let l=-4;l<=4;l++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(l)),g=i+o,k=s+l;0<=g&&g<this.size&&0<=k&&k<this.size&&this.setFunctionModule(g,k,p!=2&&p!=4)}}drawAlignmentPattern(i,s){for(let l=-2;l<=2;l++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,s+l,Math.max(Math.abs(o),Math.abs(l))!=1)}setFunctionModule(i,s,l){this.modules[s][i]=l,this.isFunction[s][i]=!0}addEccAndInterleave(i){const s=this.version,l=this.errorCorrectionLevel;if(i.length!=ue.getNumDataCodewords(s,l))throw new RangeError("Invalid argument");const o=ue.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][s],p=ue.ECC_CODEWORDS_PER_BLOCK[l.ordinal][s],g=Math.floor(ue.getNumRawDataModules(s)/8),k=o-g%o,R=Math.floor(g/o);let F=[];const N=ue.reedSolomonComputeDivisor(p);for(let _=0,Y=0;_<o;_++){let D=i.slice(Y,Y+R-p+(_<k?0:1));Y+=D.length;const ce=ue.reedSolomonComputeRemainder(D,N);_<k&&D.push(0),F.push(D.concat(ce))}let I=[];for(let _=0;_<F[0].length;
51_++)F.forEach((Y,D)=>{(_!=R-p||D>=k)&&I.push(Y[_])});return T(I.length==g),I}drawCodewords(i){if(i.length!=Math.floor(ue.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const g=l-p,R=(l+1&2)==0?this.size-1-o:o;!this.isFunction[R][g]&&s<i.length*8&&(this.modules[R][g]=n(i[s>>>3],7-(s&7)),s++)}}T(s==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let l=0;l<this.size;l++){let o;switch(i){case 0:o=(l+s)%2==0;break;case 1:o=s%2==0;break;case 2:o=l%3==0;break;case 3:o=(l+s)%3==0;break;case 4:o=(Math.floor(l/3)+Math.floor(s/2))%2==0;break;case 5:o=l*s%2+l*s%3==0;break;case 6:o=(l*s%2+l*s%3)%2==0;break;case 7:o=((l+s)%2+l*s%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[s][l]&&o&&(this.modules[s][l]=!this.modules[s][l])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let g=!1,k=0,R=[0,0,0,0,0,0,0];for(let F=0;F<this.size;F++)this.modules[p][F]==g?(k++,k==5?i+=ue.PENALTY_N1:k>5&&i++):(this.finderPenaltyAddHistory(k,R),g||(i+=this.finderPenaltyCountPatterns(R)*ue.PENALTY_N3),g=this.modules[p][F],k=1);i+=this.finderPenaltyTerminateAndCount(g,k,R)*ue.PENALTY_N3}for(let p=0;p<this.size;p++){let g=!1,k=0,R=[0,0,0,0,0,0,0];for(let F=0;F<this.size;F++)this.modules[F][p]==g?(k++,k==5?i+=ue.PENALTY_N1:k>5&&i++):(this.finderPenaltyAddHistory(k,R),g||(i+=this.finderPenaltyCountPatterns(R)*ue.PENALTY_N3),g=this.modules[F][p],k=1);i+=this.finderPenaltyTerminateAndCount(g,k,R)*ue.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let g=0;g<this.size-1;g++){const k=this.modules[p][g];k==this.modules[p][g+1]&&k==this.modules[p+1][g]&&k==this.modules[p+1][g+1]&&(i+=ue.PENALTY_N2)}let s=0;for(const p of this.modules)s=p.reduce((g,k)=>g+(k?1:0),s);const l=this.size*this.size,o=Math.ceil(Math.abs(s*20-l*10)/l)-1;return T(0<=o&&o<=9),i+=o*ue.PENALTY_N4,T(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,s=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let l=[6];for(let o=this.size-7;l.length<i;o-=s)l.splice(1,0,o);return l}}static getNumRawDataModules(i){if(i<ue.MIN_VERSION||i>ue.MAX_VERSION)throw new RangeError("Version number out of range");let s=(16*i+128)*i+64;if(i>=2){const l=Math.floor(i/7)+2;s-=(25*l-10)*l-55,i>=7&&(s-=36)}return T(208<=s&&s<=29648),s}static getNumDataCodewords(i,s){return Math.floor(ue.getNumRawDataModules(i)/8)-ue.ECC_CODEWORDS_PER_BLOCK[s.ordinal][i]*ue.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let s=[];for(let o=0;o<i-1;o++)s.push(0);s.push(1);let l=1;for(let o=0;o<i;o++){for(let p=0;p<s.length;p++)s[p]=ue.reedSolomonMultiply(s[p],l),p+1<s.length&&(s[p]^=s[p+1]);l=ue.reedSolomonMultiply(l,2)}return s}static reedSolomonComputeRemainder(i,s){let l=s.map(o=>0);for(const o of i){const p=o^l.shift();l.push(0),s.forEach((g,k)=>l[k]^=ue.reedSolomonMultiply(g,p))}return l}static reedSolomonMultiply(i,s){if(i>>>8||s>>>8)throw new RangeError("Byte out of range");let l=0;for(let o=7;o>=0;o--)l=l<<1^(l>>>7)*285,l^=(s>>>o&1)*i;return T(l>>>8==0),l}finderPenaltyCountPatterns(i){const s=i[1];T(s<=this.size*3);const l=s>0&&i[2]==s&&i[3]==s*3&&i[4]==s&&i[5]==s;return(l&&i[0]>=s*4&&i[6]>=s?1:0)+(l&&i[6]>=s*4&&i[0]>=s?1:0)}finderPenaltyTerminateAndCount(i,s,l){return i&&(this.finderPenaltyAddHistory(s,l),s=0),s+=this.size,this.finderPenaltyAddHistory(s,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(i,s){s[0]==0&&(i+=this.size),s.pop(),s.unshift(i)}};a.MIN_VERSION=1,a.MAX_VERSION=40,a.PENALTY_N1=3,a.PENALTY_N2=3,a.PENALTY_N3=40,a.PENALTY_N4=10,a.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],a.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],u.QrCode=a;function x(L,i,s){if(i<0||i>31||L>>>i)throw new RangeError("Value out of range");for(let l=i-1;l>=0;l--)s.push(L>>>l&1)}function n(L,i){return(L>>>i&1)!=0}function T(L){if(!L)throw new Error("Assertion error")}const C=class Le{constructor(i,s,l){if(this.mode=i,this.numChars=s,this.bitData=l,s<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(i){let s=[];for(const l of i)x(l,8,s);return new Le(Le.Mode.BYTE,i.length,s)}static makeNumeric(i){if(!Le.isNumeric(i))throw new RangeError("String contains 
51non-numeric characters");let s=[];for(let l=0;l<i.length;){const o=Math.min(i.length-l,3);x(parseInt(i.substring(l,l+o),10),o*3+1,s),l+=o}return new Le(Le.Mode.NUMERIC,i.length,s)}static makeAlphanumeric(i){if(!Le.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let s=[],l;for(l=0;l+2<=i.length;l+=2){let o=Le.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l))*45;o+=Le.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l+1)),x(o,11,s)}return l<i.length&&x(Le.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l)),6,s),new Le(Le.Mode.ALPHANUMERIC,i.length,s)}static makeSegments(i){return i==""?[]:Le.isNumeric(i)?[Le.makeNumeric(i)]:Le.isAlphanumeric(i)?[Le.makeAlphanumeric(i)]:[Le.makeBytes(Le.toUtf8ByteArray(i))]}static makeEci(i){let s=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)x(i,8,s);else if(i<16384)x(2,2,s),x(i,14,s);else if(i<1e6)x(6,3,s),x(i,21,s);else throw new RangeError("ECI assignment value out of range");return new Le(Le.Mode.ECI,0,s)}static isNumeric(i){return Le.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Le.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,s){let l=0;for(const o of i){const p=o.mode.numCharCountBits(s);if(o.numChars>=1<<p)return 1/0;l+=4+p+o.bitData.length}return l}static toUtf8ByteArray(i){i=encodeURI(i);let s=[];for(let l=0;l<i.length;l++)i.charAt(l)!="%"?s.push(i.charCodeAt(l)):(s.push(parseInt(i.substring(l+1,l+3),16)),l+=2);return s}};C.NUMERIC_REGEX=/^[0-9]*$/,C.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,C.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let q=C;u.QrSegment=C})($t||($t={}));(u=>{(a=>{const x=class{constructor(T,C){this.ordinal=T,this.formatBits=C}};x.LOW=new x(0,1),x.MEDIUM=new x(1,0),x.QUARTILE=new x(2,3),x.HIGH=new x(3,2),a.Ecc=x})(u.QrCode||(u.QrCode={}))})($t||($t={}));(u=>{(a=>{const x=class{constructor(T,C){this.modeBits=T,this.numBitsCharCount=C}numCharCountBits(T){return this.numBitsCharCount[Math.floor((T+7)/17)]}};x.NUMERIC=new x(1,[10,12,14]),x.ALPHANUMERIC=new x(2,[9,11,13]),x.BYTE=new x(4,[8,16,16]),x.KANJI=new x(8,[8,10,12]),x.ECI=new x(7,[0,0,0]),a.Mode=x})(u.QrSegment||(u.QrSegment={}))})($t||($t={}));var Dt=$t;/**
52 * @license qrcode.react
53 * Copyright (c) Paul O'Shannessy
54 * SPDX-License-Identifier: ISC
55 */var Ro={L:Dt.QrCode.Ecc.LOW,M:Dt.QrCode.Ecc.MEDIUM,Q:Dt.QrCode.Ecc.QUARTILE,H:Dt.QrCode.Ecc.HIGH},Gr=128,Vr="L",Qr="#FFFFFF",Yr="#000000",Jr=!1,Kr=1,$o=4,Io=0,Po=.1;function Xr(u,a=0){const x=[];return u.forEach(function(n,T){let C=null;
55n.forEach(function(q,L){if(!q&&C!==null){x.push(`M${C+a} ${T+a}h${L-C}v1H${C+a}z`),C=null;return}if(L===n.length-1){if(!q)return;C===null?x.push(`M${L+a},${T+a} h1v1H${L+a}z`):x.push(`M${C+a},${T+a} h${L+1-C}v1H${C+a}z`);return}q&&C===null&&(C=L)})}),x.join("")}function Zr(u,a){return u.slice().map((x,n)=>n<a.y||n>=a.y+a.h?x:x.map((T,C)=>C<a.x||C>=a.x+a.w?T:!1))}function Fo(u,a,x,n){if(n==null)return null;const T=u.length+x*2,C=Math.floor(a*Po),q=T/a,L=(n.width||C)*q,i=(n.height||C)*q,s=n.x==null?u.length/2-L/2:n.x*q,l=n.y==null?u.length/2-i/2:n.y*q,o=n.opacity==null?1:n.opacity;let p=null;if(n.excavate){let k=Math.floor(s),R=Math.floor(l),F=Math.ceil(L+s-k),N=Math.ceil(i+l-R);p={x:k,y:R,w:F,h:N}}const g=n.crossOrigin;return{x:s,y:l,h:i,w:L,excavation:p,opacity:o,crossOrigin:g}}function Bo(u,a){return a!=null?Math.max(Math.floor(a),0):u?$o:Io}function ei({value:u,level:a,minVersion:x,includeMargin:n,marginSize:T,imageSettings:C,size:q,boostLevel:L}){let i=We.useMemo(()=>{const k=(Array.isArray(u)?u:[u]).reduce((R,F)=>(R.push(...Dt.QrSegment.makeSegments(F)),R),[]);return Dt.QrCode.encodeSegments(k,Ro[a],x,void 0,void 0,L)},[u,a,x,L]);const{cells:s,margin:l,numCells:o,calculatedImageSettings:p}=We.useMemo(()=>{let g=i.getModules();const k=Bo(n,T),R=g.length+k*2,F=Fo(g,q,k,C);return{cells:g,margin:k,numCells:R,calculatedImageSettings:F}},[i,q,C,n,T]);return{qrcode:i,margin:l,cells:s,numCells:o,calculatedImageSettings:p}}var Mo=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),To=We.forwardRef(function(a,x){const n=a,{value:T,size:C=Gr,level:q=Vr,bgColor:L=Qr,fgColor:i=Yr,includeMargin:s=Jr,minVersion:l=Kr,boostLevel:o,marginSize:p,imageSettings:g}=n,R=Qn(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:F}=R,N=Qn(R,["style"]),I=g==null?void 0:g.src,_=We.useRef(null),Y=We.useRef(null),D=We.useCallback(ae=>{_.current=ae,typeof x=="function"?x(ae):x&&(x.current=ae)},[x]),[ce,B]=We.useState(!1),{margin:G,cells:m,numCells:re,calculatedImageSettings:b}=ei({value:T,level:q,minVersion:l,boostLevel:o,includeMargin:s,marginSize:p,imageSettings:g,size:C});We.useEffect(()=>{if(_.current!=null){const ae=_.current,z=ae.getContext("2d");if(!z)return;let le=m;const ne=Y.current,Me=b!=null&&ne!==null&&ne.complete&&ne.naturalHeight!==0&&ne.naturalWidth!==0;Me&&b.excavation!=null&&(le=Zr(m,b.excavation));const ie=window.devicePixelRatio||1;ae.height=ae.width=C*ie;const ze=C/re*ie;z.scale(ze,ze),z.fillStyle=L,z.fillRect(0,0,re,re),z.fillStyle=i,Mo?z.fill(new Path2D(Xr(le,G))):m.forEach(function(me,Re){me.forEach(function(ke,we){ke&&z.fillRect(we+G,Re+G,1,1)})}),b&&(z.globalAlpha=b.opacity),Me&&z.drawImage(ne,b.x+G,b.y+G,b.w,b.h)}}),We.useEffect(()=>{B(!1)},[I]);const se=Vn({height:C,width:C},F);let U=null;return I!=null&&(U=We.createElement("img",{src:I,key:I,style:{display:"none"},onLoad:()=>{B(!0)},ref:Y,crossOrigin:b==null?void 0:b.crossOrigin})),We.createElement(We.Fragment,null,We.createElement("canvas",Vn({style:se,height:C,width:C,ref:D,role:"img"},N)),U)});To.displayName="QRCodeCanvas";var ti=We.forwardRef(function(a,x){const n=a,{value:T,size:C=Gr,level:q=Vr,bgColor:L=Qr,fgColor:i=Yr,includeMargin:s=Jr,minVersion:l=Kr,boostLevel:o,title:p,marginSize:g,imageSettings:k}=n,R=Qn(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:F,cells:N,numCells:I,calculatedImageSettings:_}=ei({value:T,level:q,minVersion:l,boostLevel:o,includeMargin:s,marginSize:g,imageSettings:k,size:C});let Y=N,D=null;k!=null&&_!=null&&(_.excavation!=null&&(Y=Zr(N,_.excavation)),D=We.createElement("image",{href:k.src,height:_.h,width:_.w,x:_.x+F,y:_.y+F,preserveAspectRatio:"none",opacity:_.opacity,crossOrigin:_.crossOrigin}));const ce=Xr(Y,F);return We.createElement("svg",Vn({height:C,width:C,viewBox:`0 0 ${I} ${I}`,ref:x,role:"img"},R),!!p&&We.createElement("title",null,p),We.createElement("path",{fill:L,d:`M0,0 h${I}v${I}H0z`,shapeRendering:"crispEdges"}),We.createElement("path",{fill:i,d:ce,shapeRendering:"crispEdges"}),D)});ti.displayName="QRCodeSVG";const Tt="#0F4C4C",Do="#25D366",Oo="#128C7E";function Lo({url:u,label:a,variant:x="compact",openLabel:n,showQr:T=!0,style:C,onCopied:q,title:L,recipientsCount:i=0,onRecipients:s}){const{language:l}=mn(),o=(b,se,U)=>l==="nl"?se:l==="en"?U:b,[p,g]=c.useState(!1),[k,R]=c.useState(!1),F=c.useRef(null),N=c.useRef(null);if(c.useEffect(()=>()=>{F.current&&window.clearTimeout(F.current)},[]),c.useEffect(()=>{if(!k)return;const b=se=>{se.key==="Escape"&&R(!1)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[k]),!u)return null;const I=async()=>{try{await navigator.clipboard.writeText(u),g(!0),q==null||q(),F.current&&window.clearTimeout(F.current),F.current=window.setTimeout(()=>g(!1),1600)}catch{}},_=()=>{const b=a?o(`Découvrez ce bien : ${a}
56${u}`,`Ontdek dit pand: ${a}
57${u}`,`Discover this property: ${a}
58${u}`):u;window.open(`https://wa.me/?text=${encodeURIComponent(b)}`,"_blank","noopener")},Y=()=>{var z;const b=(z=N.current)==null?void 0:z.querySelector("svg");if(!b)return;const se=1024,U=new XMLSerializer().serializeToString(b),ae=new Image;ae.onload=()=>{const le=document.createElement("canvas");le.width=se,le.height=se;const ne=le.getContext("2d");if(!ne)return;ne.fillStyle="#FFFFFF",ne.fillRect(0,0,se,se),ne.drawImage(ae,0,0,se,se);const Me=document.createElement("a");Me.href=le.toDataURL("image/png"),Me.download=`qr-${(a||"bien").replace(/[^a-z0-9]+/gi,"-").toLowerCase().slice(0,48)}.png`,Me.click()},ae.src=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(U)))}`},D=x==="full",ce={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:D?"9px 14px":"8px 10px",borderRadius:9,border:"1px solid #E8E4DE",background:"white",color:"#3D3A36",fontSize:D?12.5:11.5,fontWeight:700,fontFamily:"'Outfit', sans-serif",curs
58or:"pointer",whiteSpace:"nowrap",lineHeight:1.2},B={...ce,background:Tt,borderColor:Tt,color:"white"},G=D?14:13,m=T?"repeat(3, 1fr)":"repeat(2, 1fr)",re=L===!1?null:L??o("Partager","Delen","Share");return e.jsxs("div",{style:C,children:[re&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,fontWeight:700,letterSpacing:"1.4px",textTransform:"uppercase",color:Tt,marginBottom:8},children:[e.jsx(Ji,{style:{width:12,height:12,color:"#B88A2E"}}),re]}),e.jsxs("div",{style:{display:D?"flex":"grid",gridTemplateColumns:D?void 0:"1fr",flexWrap:D?"wrap":void 0,gap:8},children:[e.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",style:{...B,textDecoration:"none"},children:[e.jsx(Gn,{style:{width:G,height:G}}),n??o("Voir page acheteur","Bekijk koperspagina","View buyer page")]}),e.jsxs("div",{style:D?{display:"contents"}:{display:"grid",gridTemplateColumns:m,gap:8},children:[e.jsxs("button",{type:"button",onClick:I,title:u,"aria-label":o("Copier le lien","Link kopiëren","Copy link"),style:ce,children:[p?e.jsx(xt,{style:{width:G,height:G,color:"#15803d"}}):e.jsx(yo,{style:{width:G,height:G}}),p?o("Copié","Gekopieerd","Copied"):o("Copier","Kopiëren","Copy")]}),e.jsxs("button",{type:"button",onClick:_,"aria-label":o("Partager par WhatsApp","Delen via WhatsApp","Share via WhatsApp"),style:{...ce,borderColor:Do,color:Oo},children:[e.jsx(vo,{style:{width:G,height:G}}),D?"WhatsApp":"WA"]}),T&&e.jsxs("button",{type:"button",onClick:()=>R(b=>!b),"aria-expanded":k,"aria-label":o("Afficher le QR code","QR-code tonen","Show QR code"),style:{...ce,...k?{borderColor:Tt,color:Tt,background:"rgba(15,76,76,0.05)"}:null,padding:D?"9px 14px":"8px 10px"},children:[e.jsx(Co,{style:{width:G,height:G}}),D?"QR":null]})]})]}),i>0&&s&&e.jsxs("button",{type:"button",onClick:s,style:{marginTop:8,width:"100%",display:"inline-flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 10px",borderRadius:9,border:"1px dashed rgba(15,76,76,0.28)",background:"rgba(15,76,76,0.04)",color:Tt,fontSize:11.5,fontWeight:700,fontFamily:"'Outfit', sans-serif",cursor:"pointer",textAlign:"left"},children:[e.jsxs("span",{children:[i," ",i>1?o("acheteurs intéressés","geïnteresseerde kopers","interested buyers"):o("acheteur intéressé","geïnteresseerde koper","interested buyer")]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[o("Envoyer","Versturen","Send"),e.jsx(Ki,{style:{width:12,height:12}})]})]}),T&&k&&e.jsxs("div",{style:{marginTop:8,padding:"14px 12px 12px",borderRadius:12,background:"white",border:"1px solid #E8E4DE",display:"flex",flexDirection:"column",alignItems:"center",gap:10,position:"relative"},children:[e.jsx("button",{type:"button",onClick:()=>R(!1),"aria-label":o("Fermer","Sluiten","Close"),style:{position:"absolute",top:6,right:6,padding:4,borderRadius:6,border:"none",background:"transparent",color:"#B8B4AE",cursor:"pointer",lineHeight:0},children:e.jsx(Rt,{style:{width:14,height:14}})}),e.jsx("div",{ref:N,style:{padding:8,background:"white",borderRadius:8},children:e.jsx(ti,{value:u,size:148,level:"M",marginSize:0,bgColor:"#FFFFFF",fgColor:"#0D1109"})}),e.jsx("p",{style:{margin:0,fontSize:10.5,color:"#B8B4AE",textAlign:"center",lineHeight:1.45,maxWidth:220},children:o("À scanner depuis une vitrine, une affichette ou pendant une visite.","Te scannen vanaf een etalage, een affiche of tijdens een bezoek.","Scan from a window display, a flyer or during a viewing.")}),e.jsxs("button",{type:"button",onClick:Y,style:{...ce,padding:"7px 12px",fontSize:11},children:[e.jsx(Xi,{style:{width:12,height:12}}),o("Télécharger (PNG)","Downloaden (PNG)","Download (PNG)")]})]})]},"sharebar")}const K={teal:"#0F4C4C",tealSoft:"rgba(15,76,76,0.07)",gold:"#D4AF37",goldDark:"#B88A2E",text:"#0D1109",muted:"#7A7670",faint:"#B8B4AE",border:"#E8E4DE",soft:"#F0EDE8",cream:"#FBFAF8",success:"#16A34A",pink:"#DB2777",warn:"#D97706"},No={"A++":{bg:"#0B5D2A",fg:"#fff"},"A+":{bg:"#1B7F3B",fg:"#fff"},A:{bg:"#1B7F3B",fg:"#fff"},B:{bg:"#3FA34D",fg:"#fff"},C:{bg:"#B8C400",fg:"#1a1a1a"},D:{bg:"#F2C200",fg:"#1a1a1a"},E:{bg:"#F39200",fg:"#fff"},F:{bg:"#E2001A",fg:"#fff"}
58,G:{bg:"#B0000F",fg:"#fff"}},Mr="/storage/v1/object/public/",Wo="/storage/v1/render/image/public/",Uo=u=>{if(!u)return null;const[a,x]=u.split("?"),n=a.indexOf(Mr);return n===-1?u:`${a.slice(0,n)+Wo+a.slice(n+Mr.length)}?${x?`${x}&`:""}width=800&height=500&resize=cover&quality=75`},Zt=u=>new Intl.NumberFormat("fr-BE",{style:"currency",currency:"EUR",maximumFractionDigits:0}).format(u);function qo(u,a){return u==="prospection"?["photo","identity","facts","estimation","owner","metrics","rune","actions"]:u==="vendu"?["photo","identity","facts","estimation","metrics","rune","actions"]:a?["photo","identity","facts","estimation","metrics","alert","share","rune","actions"]:["photo","identity","facts","estimation","metrics","rune","actions"]}function Ho(u){const{label:a,address:x,coverUrl:n,photosCount:T,prix:C,status:q,publishedAt:L,soldAt:i,facts:s,estimation:l,owner:o,metrics:p=[],callbacks:g=0,hotLeads:k=0,publishedUrl:R,menuExtra:F=[],slots:N={},runePrompts:I,onEdit:_,onCallback:Y,onMarkSold:D,onRelist:ce,onRunePrompt:B}=u,{language:G}=mn(),m=(h,v,E)=>G==="nl"?v:G==="en"?E:h,re=G==="nl"?"nl-BE":G==="en"?"en-GB":"fr-BE",[b,se]=c.useState("transformed"),[U,ae]=c.useState(!1),z=c.useRef(null);c.useEffect(()=>{if(!U)return;const h=E=>{z.current&&!z.current.contains(E.target)&&ae(!1)},v=E=>{E.key==="Escape"&&ae(!1)};return document.addEventListener("mousedown",h),window.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",h),window.removeEventListener("keydown",v)}},[U]);const le=q==="vendu",ne=q==="prospection",Me=q==="active"||q==="sous_offre",ie=Me&&!!L,ze=u.sections??qo(q,L),me=Uo(n),Re=b==="transformed"?me:n,ke=!!n&&!!Re&&b!=="failed",we=()=>se(h=>h==="transformed"&&me!==n?"original":"failed"),Fe=le?{text:m("Vendu","Verkocht","Sold"),bg:K.goldDark,fg:"white",border:"none"}:ne?{text:m("Prospection","Prospectie","Prospection"),bg:"rgba(255,255,255,0.93)",fg:K.goldDark,border:"1px solid rgba(212,175,55,0.6)"}:q==="sous_offre"?{text:m("Sous offre","Onder bod","Under offer"),bg:K.teal,fg:"white",border:"none"}:ie?{text:m("En ligne","Online","Live"),bg:K.success,fg:"white",border:"none"}:{text:m("Non publiée","Niet gepubliceerd","Not published"),bg:"rgba(255,255,255,0.93)",fg:K.muted,border:`1px solid ${K.border}`},be=(s.peb||"").trim().toUpperCase(),he=No[be],Ie=[];s.surface&&Ie.push({key:"surface",text:`${s.surface} m²`}),s.chambres&&Ie.push({key:"chambres",text:`${s.chambres} ${m("ch.","slpk","bd")}`}),s.sdb&&Ie.push({key:"sdb",text:`${s.sdb} ${m("sdb","bdk","bath")}`}),s.etage&&Ie.push({key:"etage",text:`${m("ét.","verd.","fl.")} ${s.etage}`});const fe=c.useMemo(()=>{const h=Number((l==null?void 0:l.low)||0),v=Number((l==null?void 0:l.high)||0);if(!(h>0)||!(v>h))return null;const E=Number(C||0),ge=E>0?(E-h)/(v-h):null;return{low:h,high:v,pos:ge===null?null:Math.max(0,Math.min(1,ge)),above:ge!==null&&ge>1,below:ge!==null&&ge<0}},[l,C]),Ge=I??(ne?[{key:"prep",label:m("Préparer le rendez-vous vendeur","Verkopersafspraak voorbereiden","Prepare the seller meeting"),prompt:m(`Prépare-moi le rendez-vous vendeur pour ${a} (${x}) : arguments de prix, points de vigilance, questions à poser.`,`Bereid de verkopersafspraak voor ${a} (${x}) voor.`,`Prepare the seller meeting for ${a} (${x}).`)},{key:"relance",label:m("Programmer une relance","Een opvolging plannen","Schedule a follow-up"),prompt:m(`Rappelle-moi de relancer le propriétaire de ${a} dans deux semaines.`,`Herinner me eraan de eigenaar van ${a} over twee weken op te volgen.`,`Remind me to follow up with the owner of ${a} in two weeks.`)}]:ie?[{key:"wa",label:m("Message de partage","Deelbericht","Share message"),prompt:m(`Rédige un message WhatsApp court pour partager ${a} (${R}) à un acheteur.`,`Schrijf een kort WhatsApp-bericht om ${a} te delen (${R}).`,`Write a short WhatsApp message to share ${a} (${R}).`)},{key:"prio",label:m("Qui contacter en priorité ?","Wie eerst contacteren?","Who to contact first?"),prompt:m(`Sur ${a}, quels acheteurs dois-je contacter en priorité aujourd'hui, et pourquoi ?`,`Welke kopers voor ${a} moet ik vandaag eerst contacteren?`,`For ${a}, which buyers should I contact first today, and why?`)}]:le?[{key:"recycle",label:m("Recycler les contacts","Contacten hergebruiken","Recycle contacts"),prompt:m(`${a} est vendu : quels biens proposer à ses acheteurs intéressés ?`,`${a} is verkocht: welke panden kan ik zijn geïnteresseerde kopers aanbieden?`,`${a} is sold: which properties should I offer its interested buyers?`)}]:[{key:"ready",label:m("Vérifier le dossier","Dossier controleren","Check the file"),prompt:m(`Vérifie le dossier de ${a} avant mise en ligne : annonce, photos, prix, cohérence.`,`Controleer het dossier van ${a} vóór publicatie.`,`Check the file of ${a} before going live.`)}]),ve={bien_id:u.bienId,label:a,address:x,status:q,published_at:L,prix:C,url:R},Ue={background:"white",border:"1px solid rgba(15,76,76,0.10)",borderRadius:16,padding:16,fontFamily:"'Outfit', sans-serif",color:K.text},pe={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"9px 14px",borderRadius:10,border:`1px solid ${K.border}`,background:"white",color:K.teal,fontSize:12,fontWeight:700,fontFamily:"'Outfit', sans-serif",curs
58or:"pointer",whiteSpace:"nowrap"};({...pe,background:K.teal,border:`${K.teal}`});const Be={fontSize:9.5,fontWeight:700,letterSpacing:"1.6px",textTransform:"uppercase",color:K.goldDark,marginBottom:6},tt=[...ie||Me?[{key:"sold",label:m("Marquer vendu","Als verkocht markeren","Mark as sold"),onClick:D,disabled:!D}]:[],...le?[{key:"relist",label:m("Remettre en ligne","Terug online","Re-list"),onClick:ce,disabled:!ce}]:[],...F,{key:"options",label:m("Options du bien","Opties van het pand","Property options"),disabled:!0,hint:m("bientôt","binnenkort","soon")},{key:"duplicate",label:m("Dupliquer ce bien","Dit pand dupliceren","Duplicate"),disabled:!0,hint:m("bientôt","binnenkort","soon")}],qe=h=>{switch(h){case"photo":return e.jsxs("div",{style:{position:"relative",aspectRatio:"16 / 10",borderRadius:12,overflow:"hidden",background:"linear-gradient(160deg, rgba(15,76,76,0.10), rgba(15,76,76,0.04))",marginBottom:14},children:[ke?e.jsx("img",{src:Re,alt:"",loading:"lazy",decoding:"async",onError:we,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",display:"block",filter:le?"saturate(0.7)":void 0}}):e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"rgba(15,76,76,0.55)",fontSize:12,fontWeight:700},children:[e.jsx("span",{style:{width:44,height:44,borderRadius:"50%",background:"rgba(255,255,255,0.7)",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(to,{style:{width:20,height:20}})}),b==="failed"?m("Photo indisponible","Foto niet beschikbaar","Photo unavailable"):m("Ajouter des photos","Foto's toevoegen","Add photos")]}),e.jsx("div",{style:{position:"absolute",left:0,right:0,bottom:0,height:64,background:"linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.28) 100%)",pointerEvents:"none"}}),C!=null&&C>0&&e.jsx("span",{style:{position:"absolute",top:10,right:10,padding:"6px 10px",borderRadius:8,background:"linear-gradient(135deg, #D4AF37 0%, #B8962E 100%)",color:"white",fontWeight:800,fontSize:13,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},children:Zt(C)}),e.jsx("span",{style:{position:"absolute",left:10,bottom:10,padding:"5px 10px",borderRadius:7,fontSize:9.5,fontWeight:800,letterSpacing:"0.6px",textTransform:"uppercase",background:Fe.bg,color:Fe.fg,border:Fe.border,backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},children:Fe.text}),T>0&&T<3&&!le&&e.jsx("span",{style:{position:"absolute",right:10,bottom:10,padding:"3px 8px",borderRadius:6,background:"rgba(217,119,6,0.92)",color:"white",fontSize:10.5,fontWeight:700},children:T===1?m("1 photo","1 foto","1 photo"):m(`${T} photos`,`${T} foto's`,`${T} photos`)})]},"photo");case"identity":return e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("div",{style:Be,children:m("Dossier de vente","Verkoopdossier","Sale file")}),e.jsx("h2",{style:{fontSize:20,fontWeight:800,lineHeight:1.2,letterSpacing:"-0.3px",margin:"0 0 8px",color:K.text},children:a||m("Bien sans titre","Pand zonder titel","Untitled property")}),x&&e.jsxs("a",{href:`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(x)}`,target:"_blank",rel:"noopener noreferrer",title:m("Ouvrir dans Google Maps","Openen in Google Maps","Open in Google Maps"),style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:12,color:K.muted,textDecoration:"none"},children:[e.jsx(Yn,{style:{width:12,height:12}}),x]})]},"identity");case"facts":return Ie.length===0&&!be?null:e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:12},children:[Ie.map(E=>e.jsx("span",{style:{padding:"4px 9px",borderRadius:7,background:"#F7F5F2",border:"1px solid #EEEAE4",fontSize:11.5,fontWeight:700,color:"#3D3A36"},children:E.text},E.key)),be&&e.jsxs("span",{title:"PEB",style:{display:"inline-flex",alignItems:"center",padding:"4px 9px",borderRadius:7,fontSize:11,fontWeight:800,background:he?he.bg:K.border,color:he?he.fg:K.muted},children:["PEB ",be]})]},"facts");case"estimation":return!fe&&!(C&&C>0)?null:e.jsxs("div",{style:{background:K.cream,border:`1px solid ${K.soft}`,borderRadius:12,padding:"10px 12px",marginBottom:12},children:[e.jsx("div",{style:{...Be,color:K.muted,marginBottom:4},children:m("Estimation Arcanes","Arcanes-schatting","Arcanes estimate")}),fe?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{fontSize:15,fontWeight:800,color:K.teal,letterSpacing:"-0.2px",marginBottom:8},children:[Zt(fe.low)," – ",Zt(fe.high)]}),e.jsx("div",{style:{position:"relative",height:6,borderRadius:3,background:"rgba(15,76,76,0.12)",margin:"6px 4px 14px"},children:fe.pos!==null&&e.jsx("span",{title:m("Prix demandé","Vraagprijs","Asking price"),style:{position:"absolute",top:"50%",left:`${fe.pos*100}%`,transform:"translate(-50%, -50%)",width:14,height:14,borderRadius:"50%",background:fe.above?K.warn:fe.below?K.faint:K.gold,border:"2px s
58olid white",boxShadow:"0 1px 4px rgba(0,0,0,0.2)"}})}),e.jsxs("div",{style:{fontSize:12,color:K.muted,display:"flex",justifyContent:"space-between",gap:8},children:[e.jsxs("span",{children:[m("Prix demandé","Vraagprijs","Asking price")," ",e.jsx("b",{style:{color:K.text},children:C&&C>0?Zt(C):"—"})]}),fe.above&&e.jsx("span",{style:{color:K.warn,fontWeight:600},children:m("au-dessus de la fourchette","boven de vork","above range")}),fe.below&&e.jsx("span",{style:{color:K.muted,fontWeight:600},children:m("sous la fourchette","onder de vork","below range")})]})]}):e.jsxs("div",{style:{fontSize:12,color:K.muted},children:[m("Prix demandé","Vraagprijs","Asking price")," ",e.jsx("b",{style:{color:K.text},children:Zt(C)})]})]},"estimation");case"owner":return!o||!o.name&&!o.phone&&!o.email?null:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12.5,color:K.muted,marginBottom:12},children:[e.jsx(Hn,{style:{width:12,height:12}}),e.jsxs("span",{children:[o.name&&e.jsx("b",{style:{color:K.text},children:o.name}),o.phone&&e.jsxs("span",{children:[" · ",o.phone]}),!o.phone&&o.email&&e.jsxs("span",{children:[" · ",o.email]})]})]},"owner");case"metrics":if(Me&&!L)return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:K.muted,marginBottom:12},children:[e.jsx(eo,{style:{width:12,height:12}}),m("Rien n'est en ligne — pas encore de visiteurs.","Niets staat online — nog geen bezoekers.","Nothing is online yet — no visitors.")]},"metrics");if(p.length===0)return null;const v=E=>E==="eye"?no:E==="inbox"?go:E==="file"?ro:E==="phone"?Hn:null;return e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 14px",fontSize:12,marginBottom:12,fontVariantNumeric:"tabular-nums"},children:[p.map(E=>{const ge=v(E.icon),Oe=E.tone==="gold"?K.goldDark:E.tone==="muted"?K.faint:K.teal;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,color:K.muted},children:[ge&&e.jsx(ge,{style:{width:12,height:12,color:Oe}}),e.jsx("b",{style:{color:K.text,fontWeight:800},children:E.value})," ",E.label]},E.key)}),le&&i&&e.jsxs("span",{style:{color:K.goldDark,fontWeight:600},children:[m("Vendu le","Verkocht op","Sold on")," ",new Date(i).toLocaleDateString(re,{day:"numeric",month:"short"})]})]},"metrics");case"alert":return ie?g>0?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:10,border:"1px solid rgba(219,39,119,0.35)",background:"rgba(219,39,119,0.05)",marginBottom:12},children:[e.jsx("span",{style:{width:28,height:28,borderRadius:"50%",background:"rgba(219,39,119,0.12)",color:K.pink,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Hn,{style:{width:14,height:14}})}),e.jsxs("div",{style:{flex:1,fontSize:12},children:[e.jsxs("b",{style:{color:K.pink,display:"block"},children:[g," ",g>1?m("rappels demandés","terugbelverzoeken","callbacks requested"):m("rappel demandé","terugbelverzoek","callback requested")]}),e.jsx("span",{style:{color:K.muted},children:m("à honorer rapidement","snel op te volgen","to honour quickly")})]}),Y&&e.jsxs("button",{type:"button",onClick:Y,style:{...pe,background:"linear-gradient(135deg, #D4AF37 0%, #B8962E 100%)",border:"none",color:"white",padding:"7px 12px",fontSize:11},children:[m("Rappeler","Terugbellen","Call back")," →"]})]},"alert"):k>0?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:10,border:"1px solid rgba(212,175,55,0.45)",background:"rgba(212,175,55,0.06)",marginBottom:12},children:[e.jsx("span",{style:{width:28,height:28,borderRadius:"50%",background:"rgba(212,175,55,0.15)",color:K.goldDark,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Zi,{style:{width:14,height:14}})}),e.jsxs("div",{style:{flex:1,fontSize:12},children:[e.jsxs("b",{style:{color:K.goldDark,display:"block"},children:[k," ",k>1?m("acheteurs chauds","warme kopers","hot buyers"):m("acheteur chaud","warme koper","hot buyer")]}),e.jsx("span",{style:{color:K.muted},children:m("à contacter en priorité","eerst te contacteren","to contact first")})]}),Y&&e.jsxs("button",{type:"button",onClick:Y,style:{...pe,padding:"7px 12px",fontSize:11},children:[m("Voir","Bekijken","View")," →"]})]},"alert"):null:null;case"share":return!ie||!R?null:e.jsx(Lo,{url:R,label:a,variant:"compact",style:{marginBottom:12},recipientsCount:k,onRecipients:Y},"share");case"rune":return!B||Ge.length===0?null:e.jsxs("div",{style:{marginBottom:12,padding:"10px 12px",borderRadius:12,background:"linear-gradient(135deg, rgba(15,76,76,0.05), rgba(212,175,55,0.06))",border:"1px solid rgba(15,76,76,0.08)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,fontWeight:700,letterSpacing:"1.4px",textTransform:"uppercase",color:K.teal,marginBottom:8},children:[e.jsx(wt,{style:{width:12,height:12,color:K.goldDark}}),m("Demander à Rune","Vraag het aan Rune","Ask Rune")]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:Ge.map(E=>e.jsx("button",{type:"button",onClick:()=>B(E.prompt,{...ve,prompt_key:E.key}),style:{...pe,padding:"6px 10px",fontSize:11.5,borderRadius:8,background:"white"},children:E.label},E.key))})]},"rune");case"actions":return e.jsxs("div",{style:{display:"flex",gap:8,position:"relative"},children:[e.jsxs("button",{type:"button",onClick:_,style:pe,children:[e.jsx(ko,{style:{width:13,height:13}}),m("Modifier","Bewerken","Edit")]}),e.jsxs("div",{ref:z,style:{position:"relative"},children:[e.jsx("button",{type:"button","aria-haspopup":"menu","aria-expanded":U,"aria-label":m("Plus d'actions","Meer acties","More actions"),onClick:()=>ae(E=>!E),style:{...pe,padding:"9px 11px"},children:e.jsx(wo,{style:{width:14,height:14}})}),U&&e.jsx("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 6px)",left:0,minWidth:230,background:"white",border:`1px solid ${K.border}`,borderRadius:12,boxShadow:"0 10px 30px rgba(0,0,0,0.12)",padding:6,zIndex:30},children:tt.map(E=>
58e.jsxs("button",{role:"menuitem",type:"button",disabled:E.disabled,onClick:()=>{var ge;ae(!1),(ge=E.onClick)==null||ge.call(E)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,width:"100%",padding:"9px 10px",borderRadius:8,border:"none",background:"transparent",color:E.disabled?K.faint:E.danger?"#B91C1C":K.text,fontSize:12.5,fontWeight:600,fontFamily:"'Outfit', sans-serif",cursor:E.disabled?"not-allowed":"pointer",textAlign:"left"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[E.key==="sold"&&e.jsx(en,{style:{width:13,height:13}}),E.key==="relist"&&e.jsx(Wr,{style:{width:13,height:13}}),E.label]}),E.hint&&e.jsx("span",{style:{fontSize:10,color:K.faint,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.8px"},children:E.hint})]},E.key))})]})]},"actions");default:return null}};return e.jsx("aside",{style:Ue,"data-bien-rail":!0,"data-status":q,"data-published":!!L,children:ze.map(h=>e.jsxs("div",{style:{display:"contents"},children:[N[`before:${h}`],qe(h),N[`after:${h}`]]},h))})}const Go=ee.supabaseUrl||"https://mnocxtuirejggqyfoyys.supabase.co",Tr=`${Go}/functions/v1`,Ae=u=>Number(u)||0,Ye=u=>Math.round(Ae(u)).toLocaleString("fr-BE"),Dr=u=>Number(String(u??"").replace(/[^\d]/g,""))||0;function Vo({open:u,onClose:a,apiKey:x,codeIns:n,prix:T,estimation:C,fullAddress:q,ville:L,typeBien:i,coverUrl:s,specs:l,brand:o}){const p=(o==null?void 0:o.couleur_primaire)||"#0F4C4C",g=(o==null?void 0:o.couleur_secondaire)||"#D4AF37",[k,R]=c.useState(0),[F,N]=c.useState(null),[I,_]=c.useState(null),[Y,D]=c.useState(!1);c.useEffect(()=>{if(!u)return;if(R(Dr(T)||Ae(C==null?void 0:C.prix_total_estime)),!n){N({source:"B",reason:"no_code_ins"});return}let h=!1;return(async()=>{D(!0),N(null),_(null);try{const{data:{session:v}}=await ee.auth.getSession(),E={"Content-Type":"application/json","x-api-key":x,Authorization:`Bearer ${(v==null?void 0:v.access_token)??""}`},ge=Dr(T)||Ae(C==null?void 0:C.prix_total_estime),[Oe,je]=await Promise.all([fetch(`${Tr}/demand-snapshot`,{method:"POST",headers:E,body:JSON.stringify({code_ins:n,prix:ge})}),fetch(`${Tr}/commune?code_ins=${encodeURIComponent(n)}&view=full`,{headers:{"x-api-key":x}})]),Ee=Oe.ok?await Oe.json():{source:"B",reason:"fetch_error"},Te=je.ok?await je.json():null;if(h)return;N(Ee),_((Te==null?void 0:Te.data)??Te??null)}catch{h||N({source:"B",reason:"exception"})}finally{h||D(!1)}})(),()=>{h=!0}},[u]),c.useEffect(()=>{if(!u)return;const h=v=>{v.key==="Escape"&&a()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[u,a]);const ce=Ae(C==null?void 0:C.prix_total_estime),B=Ae(C==null?void 0:C.fourchette_basse_total),G=Ae(C==null?void 0:C.fourchette_haute_total),m=Ae(C==null?void 0:C.prix_m2_estime),re=ce>0,b=c.useMemo(()=>!re||!k?0:(k-ce)/ce*100,[k,ce,re]),se=c.useMemo(()=>{if(!re||!k)return"—";const h=Math.abs(b);return h<=5?"Aligné sur l'estimation":b>0?`Au-dessus de l'estimation (+${h.toFixed(0)} %)`:`En dessous de l'estimation (−${h.toFixed(0)} %)`},[b,re,k]),U=re?Math.floor(B*.85/1e3)*1e3:0,ae=re?Math.ceil(G*1.15/1e3)*1e3:0,z=c.useMemo(()=>!re||G<=B?50:Math.max(0,Math.min(100,(k-B)/(G-B)*100)),[k,B,G,re]),le=c.useMemo(()=>!re||G<=B?50:Math.max(0,Math.min(100,(ce-B)/(G-B)*100)),[ce,B,G,re]);if(!u)return null;const ne=F&&F.source==="A"?Math.round(F.period_days/30):0,Me=new Date().toLocaleDateString("fr-BE",{day:"numeric",month:"long",year:"numeric"}),ie=/appart|studio|loft|duplex/i.test(i||""),ze=(I==null?void 0:I.nom_commune)||L,me=Ae(ie?I==null?void 0:I.prix_appart_median:I==null?void 0:I.prix_maison_median),Re=Ae(ie?I==null?void 0:I.prix_appart_p25:I==null?void 0:I.prix_maison_p25),ke=Ae(ie?I==null?void 0:I.prix_appart_p75:I==null?void 0:I.prix_maison_p75),we=Ae(ie?I==null?void 0:I.rendement_brut_appart_pct:I==null?void 0:I.rendement_brut_maison_pct),Fe=Ae(ie?I==null?void 0:I.evol_prix_appart_5ans_pct:I==null?void 0:I.evol_prix_maison_10ans_pct),be=ie?"Évolution 5 ans":"Évolution 10 ans",he=ie?"appartements vendus":"maisons vendues",Ie=[];me>0&&Ie.push({label:"Prix médian",value:`${Ye(me)} €`}),Fe!==0&&Ie.push({label:be,value:`${Fe>0?"+":""}${Fe.toFixed(1)} %`,tone:Fe>0?"up":"down"}),we>0&&Ie.push({label:"Rendement brut",value:`${we.toFixed(1)} %`});const fe=Re>0&&ke>0&&me>0,Ge=!fe||!k?"":k<Re?`sous le P25 (${Ye(Re)} €)`:k<me?`entre le P25 (${Ye(Re)} €) et le médian (${Ye(me)} €)`:k<ke?`entre le médian (${Ye(me)} €) et le P75 (${Ye(ke)} €)`:`au-dessus du P75 (${Ye(ke)} €)`,ve=l||{},Ue=Ae(ve.surface)||Ae(C==null?void 0:C.surface_m2),pe=h=>h&&h.charAt(0).toUpperCase()+h.slice(1),Be=[];i&&Be.push(pe(i)),Ue>0&&Be.push(`${Ue} m²`),Ae(ve.chambres)>0&&Be.push(`${Ae(ve.chambres)} ch.`),Ae(ve.sdb)>0&&Be.push(`${Ae(ve.sdb)} sdb`),ve.peb&&Be.push(`PEB ${String(ve.peb).toUpperCase()}`),Ae(ve.surfaceTerrain)>0&&Be.push(`terrain ${Ae(ve.surfaceTerrain)} m²`),Ae(ve.anneeConstruction)>0&&Be.push(`${Ae(ve.anneeConstruction)}`);const tt={jardin:"Jardin",terrasse:"Terrasse",garage:"Garage",parking:"Parking",cave:"C
58ave",ascenseur:"Ascenseur",piscine:"Piscine"},qe=Object.keys(tt).filter(h=>{var v;return(v=ve.equips)==null?void 0:v[h]});return io.createPortal(e.jsxs("div",{onClick:a,className:"arc-print-root",style:{position:"fixed",inset:0,background:"rgba(15,23,42,0.55)",zIndex:1e3,display:"flex",alignItems:"flex-start",justifyContent:"center",padding:24,overflowY:"auto"},children:[e.jsx("style",{children:`
59        @keyframes arcspin { to { transform: rotate(360deg); } }
60        @media print {
61          /* La fiche est portée en enfant direct de <body> (createPortal).
62             On masque TOUT le reste de l'app → plus aucune hauteur parasite,
63             donc la fiche sort sur SON propre nombre de pages, sans blanc. */
64          body > *:not(.arc-print-root) { display: none !important; }
65          .arc-print-root { position: static !important; inset: auto !important; padding: 0 !important; margin: 0 !important; background: #fff !important; display: block !important; overflow: visible !important; }
66          .arc-fiche { box-shadow: none !important; border-radius: 0 !important; width: 100% !important; max-width: none !important; }
67          .arc-hide-print { display: none !important; }
68          @page { size: A4; margin: 14mm; }
69        }
70        .arc-slider { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; outline: none; }
71        .arc-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: ${p}; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer; }
72        .arc-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: ${p}; border: 2px solid #fff; cursor: pointer; }
73      `}),e.jsxs("div",{className:"arc-fiche",onClick:h=>h.stopPropagation(),style:{width:"210mm",maxWidth:"100%",background:"#fff",color:"#1a1a1a",boxShadow:"0 20px 60px rgba(0,0,0,.3)",borderRadius:4,overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},children:[e.jsxs("div",{className:"arc-hide-print",style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 16px",background:"#f8f6f3",borderBottom:"1px solid #e6e1da"},children:[e.jsx("span",{style:{fontSize:13,color:"#64748b"},children:"Fiche de prospection · aperçu"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("button",{onClick:()=>{const h=document.title;document.title=`Fiche de prospection — ${q||ze||""}`.trim();const v=()=>{document.title=h,window.removeEventListener("afterprint",v)};window.addEventListener("afterprint",v),window.print(),setTimeout(v,1e3)},style:{display:"flex",alignItems:"center",gap:6,background:p,color:"#fff",border:"none",borderRadius:6,padding:"8px 14px",fontSize:13,fontWeight:600,cursor:"pointer"},children:[e.jsx(So,{size:15})," Impression / PDF"]}),e.jsx("button",{onClick:a,"aria-label":"Fermer",style:{background:"transparent",border:"1px solid #cbd5e1",borderRadius:6,padding:"8px 10px",cursor:"pointer",color:"#475569"},children:e.jsx(Rt,{size:15})})]})]}),e.jsxs("div",{style:{padding:"14mm 18mm 12mm"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:10},children:[o!=null&&o.logo_url?e.jsx("img",{src:o.logo_url,alt:"",style:{height:42,objectFit:"contain"}}):e.jsx("div",{style:{fontSize:20,fontWeight:800,color:p,letterSpacing:"-.5px"},children:(o==null?void 0:o.nom_agence)||"Arcanes"}),e.jsxs("div",{style:{textAlign:"right"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:"1.5px",textTransform:"uppercase",color:g},children:"Fiche de prospection"}),e.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginTop:2},children:Me})]})]}),e.jsx("div",{style:{height:2,background:g,width:48,marginBottom:12}}),s&&e.jsx("img",{src:s,alt:"",style:{width:"100%",height:120,objectFit:"cover",borderRadius:8,marginBottom:12,display:"block"}}),e.jsxs("div",{style:{marginBottom:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"#64748b",fontSize:12,marginBottom:4},children:[e.jsx(Yn,{size:13})," ",ze||"—"]}),e.jsx("div",{style:{fontFamily:"Georgia, 'Times New Roman', serif",fontSize:22,fontWeight:700,color:"#0f172a",lineHeight:1.2},children:q||"Adresse du bien"}),Be.length>0&&e.jsx("div",{style:{fontSize:12.5,color:"#475569",marginTop:6},children:Be.join("  ·  ")}),qe.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:8},children:qe.map(h=>e.jsx("span",{style:{fontSize:10.5,fontWeight:600,color:p,background:`${p}10`,border:`1px solid ${p}22`,borderRadius:4,padding:"3px 8px"},children:tt[h]},h))})]}),e.jsx("div",{style:{border:"1px solid #e8e2d8",borderLeft:`5px solid ${p}`,borderRadius:6,padding:"18px 22px",marginBottom:14,background:"#fcfbf9",boxShadow:"0 1px 3px rgba(15,23,42,.04)"},children:Y?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"#94a3b8",fontSize:14},children:[e.jsx(bt,{size:18,className:"arc-hide-print",style:{animation:"arcspin 1s linear infinite"}})," ","Analyse de la demande…"]}):(F==null?void 0:F.source)==="A"?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:18},children:[e.jsx("div",{style:{fontFamily:"Georgia, serif",fontSize:56,fontWeight:700,color:p,lineHeight:1},children:Ye(F.tier1)}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:15.5,fontWeight:700,color:"#0f172a",lineHeight:1.3},children:"acquéreurs qualifiés recherchent un bien comparable dans votre secteur"}),e.jsxs("div",{style:{fontSize:11.5,color:"#64748b",marginTop:6,lineHeight:1.5},children:["Rayon ",F.radius_km," km autour de ",ze," · ",F.communes_included," communes · ",ne," derniers mois",e.jsx("br",{}),e.jsx("span",{style:{color:g,fontWeight:600},children:"Données réseau Arcanes"})]})]})]}):e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:"1px",textTransform:"uppercase",color:g,marginBottom:6},children:"Demande de marché"}),e.jsxs("div",{style:{fontSize:15,fontWeight:700,color:"#0f172a",lineHeight:1.3},children:["Profil acquéreur du secteur de ",ze]}),e.jsx("div",{style:{fontSize:11.5,color:"#64748b",marginTop:6},children:"Indicateurs de marché ci-dessous · Données Statbel"})]})}),Ie.length>0&&e.jsxs("div",{style:{marginBottom:18},children:[e.jsxs("div",{style:{fontSize:10,fontWeight:700,letterSpacing:"1px",textTransform:"uppercase",color:"#94a3b8",marginBottom:8},children:["Marché — ",ze]}),e.jsx("div",{style:{display:"flex",gap:28},children:Ie.map((h,v)=>e.jsxs("div",{style:{paddingRight:28,borderRight:v<Ie.length-1?"1px solid #eef0f3":"none"}
73,children:[e.jsx("div",{style:{fontSize:10,color:"#94a3b8",marginBottom:3},children:h.label}),e.jsx("div",{style:{fontSize:17,fontWeight:700,color:h.tone==="up"?"#15803d":h.tone==="down"?"#b91c1c":"#0f172a",lineHeight:1},children:h.value})]},v))})]}),re&&e.jsxs("div",{style:{marginBottom:14},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:"1px",textTransform:"uppercase",color:"#94a3b8",marginBottom:10},children:"Positionnement de prix"}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end",marginBottom:10},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:"#64748b",marginBottom:2},children:"Prix de présentation"}),e.jsxs("div",{style:{fontFamily:"Georgia, serif",fontSize:30,fontWeight:700,color:"#0f172a",lineHeight:1},children:[Ye(k)," €"]})]}),e.jsxs("div",{style:{textAlign:"right"},children:[e.jsx("div",{style:{fontSize:11,color:"#64748b",marginBottom:2},children:"Estimation Arcanes"}),e.jsxs("div",{style:{fontSize:16,fontWeight:700,color:p},children:[Ye(ce)," €"]}),m>0&&e.jsxs("div",{style:{fontSize:11,color:"#94a3b8"},children:[Ye(m)," €/m²"]})]})]}),e.jsxs("div",{style:{position:"relative",height:8,background:"#eef2f7",borderRadius:8,margin:"14px 0 6px"},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:8,background:`linear-gradient(90deg, ${g}33, ${p}33)`}}),e.jsx("div",{style:{position:"absolute",left:`${le}%`,top:-3,width:2,height:14,background:p,opacity:.5}}),e.jsx("div",{style:{position:"absolute",left:`calc(${z}% - 8px)`,top:-5,width:16,height:16,borderRadius:"50%",background:p,border:"2px solid #fff",boxShadow:"0 1px 4px rgba(0,0,0,.25)"}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10.5,color:"#94a3b8"},children:[e.jsxs("span",{children:[Ye(B)," €"]}),e.jsxs("span",{children:[Ye(G)," €"]})]}),e.jsx("div",{style:{marginTop:10,fontSize:13,fontWeight:600,color:Math.abs(b)<=5?p:"#475569"},children:se}),fe&&Ge&&e.jsxs("div",{style:{marginTop:10,paddingTop:10,borderTop:"1px dashed #e6e8ec",fontSize:12,color:"#334155",lineHeight:1.5},children:["À ",e.jsxs("strong",{style:{color:"#0f172a"},children:[Ye(k)," €"]}),", ce bien se situe"," ",e.jsx("strong",{style:{color:p},children:Ge})," des ",he," dans la commune.",e.jsxs("span",{style:{display:"block",color:"#94a3b8",fontSize:10.5,marginTop:3},children:["Distribution commune : P25 ",Ye(Re)," € · médian ",Ye(me)," € · P75 ",Ye(ke)," €"]})]}),e.jsxs("div",{className:"arc-hide-print",style:{marginTop:12},children:[e.jsx("input",{type:"range",className:"arc-slider",min:U,max:ae,step:5e3,value:Math.min(Math.max(k,U),ae),onChange:h=>R(Number(h.target.value)),style:{width:"100%",background:`linear-gradient(90deg, ${p}, ${g})`}}),e.jsx("div",{style:{fontSize:10.5,color:"#94a3b8",marginTop:4},children:"Curseur — ajustement du prix de présentation"})]})]}),e.jsxs("div",{style:{borderTop:"1px solid #ece7df",paddingTop:12,marginTop:16,display:"flex",justifyContent:"space-between",alignItems:"flex-end"},children:[e.jsxs("div",{style:{fontSize:11.5,color:"#475569",lineHeight:1.5},children:[(o==null?void 0:o.nom_complet)&&e.jsx("div",{style:{fontWeight:600,color:"#0f172a"},children:o.nom_complet}),(o==null?void 0:o.telephone)&&e.jsx("div",{children:o.telephone}),(o==null?void 0:o.nom_agence)&&e.jsx("div",{style:{color:"#94a3b8"},children:o.nom_agence})]}),e.jsx("div",{style:{fontSize:9.5,color:"#cbd5e1",textAlign:"right"},children:"Réseau Arcanes · Statbel"})]})]})]})]}),document.body)}const Ce={teal:"#0F4C4C",tealLight:"#1E6B7E",gold:"#D4AF37",goldDark:"#B8962E",cream:"#F8F6F3",border:"#E6E1DA",muted:"#94A3B8",text:"#0F4C4C",warn:"#C2453B"};function Or(u){return u.length===0?"":u.length===1?`M ${u[0].x} ${u[0].y}`:u.map((a,x)=>{if(x===0)return`M ${a.x.toFixed(1)} ${a.y.toFixed(1)}`;const n=u[x-1],T=(n.x+a.x)/2;return`Q ${T.toFixed(1)} ${n.y.toFixed(1)}, ${T.toFixed(1)} ${((n.y+a.y)/2).toFixed(1)} T ${a.x.toFixed(1)} ${a.y.toFixed(1)}`}).join(" ")}function Qo({points:u,prixCourant:a,prixConcurrent:x,medianBudget:n,fourchetteBasse:T,fourchetteHaute:C,lang:q,isMobile:L=!1}){const i=(v,E,ge)=>q==="nl"?E:q==="en"?ge:v,s=Array.isArray(u)?[...u].sort((v,E)=>v.prix-E.prix):[];if(s.length<2)return e.jsx("div",{style:{padding:"30px 0",textAlign:"center",color:Ce.muted,fontSize:13,fontFamily:"'Outfit', sans-serif"},children:i("Courbe indisponible (données insuffisantes).","Curve niet beschikbaar.","Curve unavailable.")});const l=L?360:760,o=300,p=L?34:44,g=L?12:18,k=L?26:30,R=L?42:40,F=l-p-g,N=o-k-R,I=k+N,_=L?11:9.5,Y=L?14:12,D=L?6.5:5.5,ce=L?3:5,B=s[0].prix,G=s[s.length-1].prix,m=Math.max(1,G-B),re=Math.max(1,...s.map(v=>v.r2)),b=v=>p+(v-B)/m*F,se=v=>I-v/re*N,U=v=>Math.max(p,Math.min(p+F,v)),ae=v=>Math.max(B,Math.min(G,v)),z=(v,E)=>{const ge=ae(v);if(ge<=s[0].prix)return s[0][E];if(ge>=s[s.length-1].prix)return s[s.length-1][E];for(let Oe=1;Oe<s.length;Oe++)if(ge<=s[Oe].prix){const je=s[Oe-1],Ee=s[Oe],Te=(ge-je.prix)/Math.max(1,Ee.prix-je.prix);return je[E]+Te*(Ee[E]-je[E])}return s[s.length-1][E]}
73,le=s.map(v=>({x:b(v.prix),y:se(v.r2)})),ne=s.map(v=>({x:b(v.prix),y:se(v.r3)})),Me=le[0].x,ie=le[le.length-1].x,ze=Or(le),me=`${ze} L ${ie.toFixed(1)} ${I} L ${Me.toFixed(1)} ${I} Z`,Re=Or(ne),ke=U(b(a)),we=Math.round(z(a,"r2")),Fe=se(z(a,"r2")),be=!!(x&&x>0),he=be?U(b(x)):null,Ie=be?Math.round(z(x,"r2")):null,fe=be?se(z(x,"r2")):null,Ge=be&&Ie!=null?Math.max(0,we-Ie):0,ve=n!=null&&n>0,Ue=ve?U(b(n)):null,pe=ve&&(n<B||n>G),Be=[];for(let v=0;v<=ce;v++)Be.push(B+m*v/ce);const tt=[0,Math.round(re/2),re],qe=We.useId().replace(/:/g,""),h=v=>`${Math.round(v/1e3)}k`;return e.jsxs("svg",{width:l,height:o,viewBox:`0 0 ${l} ${o}`,style:{width:"100%",height:"auto",overflow:"visible",fontFamily:"'Outfit', sans-serif"},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:`fill-${qe}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:Ce.tealLight,stopOpacity:.28}),e.jsx("stop",{offset:"100%",stopColor:Ce.tealLight,stopOpacity:.04})]}),be&&he!=null&&e.jsx("clipPath",{id:`gap-${qe}`,children:e.jsx("rect",{x:Math.min(ke,he),y:0,width:Math.abs(he-ke),height:o})})]}),tt.map((v,E)=>e.jsxs("g",{children:[e.jsx("line",{x1:p,y1:se(v),x2:p+F,y2:se(v),stroke:Ce.border,strokeWidth:1,opacity:E===0?1:.5}),e.jsx("text",{x:p-7,y:se(v)+3.5,textAnchor:"end",fontSize:_,fill:Ce.muted,children:v})]},E)),T>0&&C>0&&e.jsx("rect",{x:U(b(Math.min(T,C))),y:k,width:Math.abs(U(b(C))-U(b(T))),height:N,fill:Ce.teal,opacity:.05}),be&&he!=null&&he>ke&&e.jsx("path",{d:me,fill:Ce.warn,opacity:.13,clipPath:`url(#gap-${qe})`}),e.jsx("path",{d:me,fill:`url(#fill-${qe})`}),e.jsx("path",{d:ze,stroke:Ce.teal,strokeWidth:L?2.8:2.4,fill:"none",strokeLinecap:"round"}),e.jsx("path",{d:Re,stroke:Ce.goldDark,strokeWidth:L?1.6:1.4,fill:"none",strokeDasharray:"4 3",opacity:.75}),Ue!=null&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:Ue,y1:k+2,x2:Ue,y2:I,stroke:Ce.muted,strokeWidth:1,strokeDasharray:"2 4",opacity:.7}),e.jsx("text",{x:Ue,y:k-4,textAnchor:"middle",fontSize:_-.5,fill:Ce.muted,children:pe?i("m
73édiane ↗","mediaan ↗","median ↗"):i("médiane","mediaan","median")})]}),be&&he!=null&&fe!=null&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:he,y1:fe,x2:he,y2:I,stroke:Ce.warn,strokeWidth:2,strokeDasharray:"5 3"}),e.jsx("circle",{cx:he,cy:fe,r:D,fill:Ce.warn,stroke:Ce.cream,strokeWidth:2}),e.jsxs("text",{x:he,y:fe-10,textAnchor:"middle",fontSize:Y,fontWeight:800,fill:Ce.warn,children:[Ie," ",Ge>0?`(−${Ge})`:""]})]}),e.jsx("line",{x1:ke,y1:Fe,x2:ke,y2:I,stroke:Ce.goldDark,strokeWidth:2.5}),e.jsx("circle",{cx:ke,cy:Fe,r:D,fill:Ce.goldDark,stroke:Ce.cream,strokeWidth:2}),e.jsx("text",{x:ke,y:Fe-11,textAnchor:"middle",fontSize:Y,fontWeight:800,fill:Ce.goldDark,children:we}),Be.map((v,E)=>e.jsx("text",{x:U(b(v)),y:I+16,textAnchor:"middle",fontSize:_,fill:Ce.muted,children:h(v)},E)),L?e.jsxs("g",{transform:`translate(${p}, ${o-1})`,children:[e.jsx("line",{x1:0,y1:-14,x2:16,y2:-14,stroke:Ce.teal,strokeWidth:2.8}),e.jsx("text",{x:21,y:-11,fontSize:_,fill:Ce.muted,children:i("atteignent le prix","bereiken de prijs","reach the price")}),e.jsx("line",{x1:0,y1:-2,x2:16,y2:-2,stroke:Ce.goldDark,strokeWidth:1.6,strokeDasharray:"4 3"}),e.jsx("text",{x:21,y:1,fontSize:_,fill:Ce.muted,children:i("dont engagés","waarvan betrokken","engaged")})]}):e.jsxs("g",{transform:`translate(${p}, ${o-1})`,children:[e.jsx("line",{x1:0,y1:-4,x2:18,y2:-4,stroke:Ce.teal,strokeWidth:2.4}),e.jsx("text",{x:23,y:-1,fontSize:_,fill:Ce.muted,children:i("acheteurs atteignant le prix","kopers die de prijs bereiken","buyers reaching the price")}),e.jsx("line",{x1:200,y1:-4,x2:218,y2:-4,stroke:Ce.goldDark,strokeWidth:1.4,strokeDasharray:"4 3"}),e.jsx("text",{x:223,y:-1,fontSize:_,fill:Ce.muted,children:i("dont engagés","waarvan betrokken","engaged")})]})]})}const Yo=ee.supabaseUrl||"https://mnocxtuirejggqyfoyys.supabase.co",Lr=`${Yo}/functions/v1`,M={teal:"#0F4C4C",tealLight:"#1E6B7E",gold:"#D4AF37",goldDark:"#B8962E",cream:"#F8F6F3",border:"#E6E1DA",muted:"#94A3B8",text:"#0F4C4C",warn:"#C2453B"};function Jo(u=768){const[a,x]=c.useState(typeof window<"u"?window.innerWidth<u:!1);return c.useEffect(()=>{const n=()=>x(window.innerWidth<u);return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[u]),a}const Ko=["A","B","C","D","E","F"],Xo=[{v:"a renover",fr:"À rénover",nl:"Te renoveren",en:"To renovate"},{v:"a rafraichir",fr:"À rafraîchir",nl:"Op te frissen",en:"Needs refresh"},{v:"bon etat",fr:"Bon état",nl:"Goede staat",en:"Good condition"},{v:"excellent",fr:"Excellent",nl:"Uitstekend",en:"Excellent"},{v:"neuf",fr:"Neuf",nl:"Nieuw",en:"New"}],Zo=[{k:"jardin",fr:"Jardin",nl:"Tuin",en:"Garden"},{k:"garage",fr:"Garage",nl:"Garage",en:"Garage"},{k:"terrasse",fr:"Terrasse",nl:"Terras",en:"Terrace"},{k:"piscine",fr:"Piscine",nl:"Zwembad",en:"Pool"}];function es(u){const{open:a,onClose:x,apiKey:n,lang:T,codeIns:C,cp:q,typeBien:L,prixDemande:i,estimation:s,bienId:l}=u,o=(j,S,X)=>T==="nl"?S:T==="en"?X:j,p=Jo(),[g,k]=c.useState("ask"),[R,F]=c.useState(""),[N,I]=c.useState(!1),[_,Y]=c.useState(u.peb||""),[D,ce]=c.useState(u.etat||""),[B,G]=c.useState({...u.equips||{}}),[m,re]=c.useState(s||null),[b,se]=c.useState(null),[U,ae]=c.useState(i||(s==null?void 0:s.prix_total_estime)||0),[z,le]=c.useState(""),[ne,Me]=c.useState(!1),[ie,ze]=c.useState(!1),me=c.useRef(!0),[Re,ke]=c.useState(!1),[we,Fe]=c.useState(null),[be,he]=c.useState(""),[Ie,fe]=c.useState(!1),[Ge,ve]=c.useState(""),[Ue,pe]=c.useState("");c.useEffect(()=>{if(!a)return;const j=((s==null?void 0:s.fourchette_haute_total)||0)>0;k(j?"ask":"explore"),F(""),I(!1),Y(u.peb||""),ce(u.etat||""),G({...u.equips||{}}),re(s||null),ae(i||(s==null?void 0:s.prix_total_estime)||0),le(""),Fe(null),he(""),fe(!1),me.current=!0},[a]);const Be=async()=>{if(!n||!q)return null;Me(!0);try{const j={type_bien:L,code_postal:q};if(C&&(j.code_ins=C),u.surface&&(j.surface_m2=Number(u.surface)),_&&(j.peb=_),D&&(j.etat=D),B.terrasse&&(j.terrasse=!0),B.jardin&&(j.jardin=!0),B.garage&&(j.garage=!0),B.piscine&&(j.piscine=!0),u.surfaceTerrain&&(j.surface_terrain=Number(u.surfaceTerrain)),u.facades&&(j.facades=Number(u.facades)),u.anneeConstruction){const Z=parseInt(String(u.anneeConstruction),10);!isNaN(Z)&&Z>
73=1800&&Z<=new Date().getFullYear()+5&&(j.annee_construction=Z)}if(u.etage!==""&&L==="appartement"){const Z=String(u.etage).trim().toLowerCase();if(Z==="rdc"||Z==="rez"||Z==="0")j.etage=0;else{const oe=parseInt(Z,10);!isNaN(oe)&&oe>=0&&oe<=50&&(j.etage=oe)}}B.ascenseur&&(j.ascenseur=!0);const S=await fetch(`${Lr}/estimate-price`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify(j)});if(!S.ok)throw new Error(`estimate ${S.status}`);const X=await S.json();return re(X.data),X.data}catch(j){return console.error("[studio] estimate-price",j),null}finally{Me(!1)}},tt=async j=>{if(!n||!C||!(j>0)){se(null);return}ze(!0);try{const S=await fetch(`${Lr}/demand-curve`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({code_ins:C,prix:j,type_bien:L})});if(!S.ok)throw new Error(`curve ${S.status}`);const X=await S.json();if((X==null?void 0:X.source)==="A"&&Array.isArray(X.points)&&X.points.length){se(X);const Z=X.points[0].prix,oe=X.points[X.points.length-1].prix;ae(ye=>Math.min(oe,Math.max(Z,ye||j)))}else se({source:"B",reason:(X==null?void 0:X.reason)||"no_data"})}catch(S){console.error("[studio] demand-curve",S),se(null)}finally{ze(!1)}};c.useEffect(()=>{if(!a)return;const j=me.current?0:350;me.current=!1;const S=setTimeout(async()=>{const X=await Be(),Z=(X==null?void 0:X.prix_total_estime)>0?X.prix_total_estime:(m==null?void 0:m.prix_total_estime)||0;await tt(Z)},j);return()=>clearTimeout(S)},[a,_,D,JSON.stringify(B)]);const qe=j=>{var X;if(!((X=b==null?void 0:b.points)!=null&&X.length)||!(j>0))return null;let S=b.points[0];for(const Z of b.points)Math.abs(Z.prix-j)<Math.abs(S.prix-j)&&(S=Z);return S};c.useEffect(()=>{Fe(null),he(""),fe(!1)},[U,_,D,JSON.stringify(B)]);const h=async()=>{var j;ke(!0),he(""),Fe(null);try{const S={type_bien:L,code_postal:q,prix_decide:U,lang:T};if(u.surface&&(S.surface_m2=Number(u.surface)),_&&(S.peb=_),D&&(S.etat=D),B.terrasse&&(S.terrasse=!0),B.jardin&&(S.jardin=!0),B.garage&&(S.garage=!0),B.piscine&&(S.piscine=!0),u.surfaceTerrain&&(S.surface_terrain=Number(u.surfaceTerrain)),u.facades&&(S.facades=Number(u.facades)),u.etage!==""&&L==="appartement"){const Ve=String(u.etage).trim().toLowerCase();if(Ve==="rdc"||Ve==="rez"||Ve==="0")S.etage=0;else{const ot=parseInt(Ve,10);!isNaN(ot)&&ot>=0&&ot<=50&&(S.etage=ot)}}B.ascenseur&&(S.ascenseur=!0);const X=Number(String(Ge).replace(/\D/g,""))||0,Z=Number(String(Ue).replace(/\D/g,""))||0;X>0&&(S.prix_min=X),Z>0&&(S.prix_max=Z),l&&(S.bien_id=l);const{data:oe,error:ye}=await ee.functions.invoke("mint-seller-scenario",{body:S});if(ye){const Ve=((j=ye==null?void 0:ye.context)==null?void 0:j.error)||(oe==null?void 0:oe.error)||"";he(Ve==="estimation_indisponible"?o("Estimation indisponible pour ce bien (données de marché insuffisantes). Lien impossible.","Schatting niet beschikbaar voor dit pand. Link onmogelijk.","Estimate unavailable for this property. Link not possible."):o("Erreur lors de la génération. Réessayez.","Fout bij het genereren. Probeer opnieuw.","Generation error. Try again."));return}oe!=null&&oe.ok&&oe.url?Fe({url:oe.url,expires_at:oe.expires_at}):he((oe==null?void 0:oe.error)==="estimation_indisponible"?o("Estimation indisponible pour ce bien (données de marché insuffisantes). Lien impossible.","Schatting niet beschikbaar voor dit pand. Link onmogelijk.","Estimate unavailable for this property. Link not possible."):o("Erreur lors de la génération. Réessayez.","Fout bij het genereren. Probeer opnieuw.","Generation error. Try again."))}catch(S){console.error("[studio] mint",S),he(o("Connexion impossible. Réessayez.","Verbinding mislukt. Probeer opnieuw.","Connection failed. Try again."))}finally{ke(!1)}},v=async j=>{try{await navigator.clipboard.writeText(j),fe(!0),setTimeout(()=>fe(!1),2e3)}catch{}},E=async j=>{const S=navigator;if(S.share)try{await S.share({title:o("Estimation de votre bien","Schatting van uw pand","Your property estimate"),url:j})}catch{}else v(j)},ge=typeof navigator<"u"&&!!navigator.share,Oe=j=>{const S=(m==null?void 0:m.fourchette_basse_total)||0,X=(m==null?void 0:m.fourchette_haute_total)||0;let Z=Math.round(j*.95),oe=Math.round(j*1.05);X>j&&(oe=Math.min(oe,X)),S>0&&S<j&&(Z=Math.max(Z,S));const ye=(b==null?void 0:b.source)==="A"&&Array.isArray(b==null?void 0:b.points)?[...b.points].sort((W,ut)=>W.prix-ut.prix):[];if(ye.length<2||!(j>0))return{min:Z,max:oe};const Ve=W=>{const ut=Math.max(ye[0].prix,Math.min(ye[ye.length-1].prix,W));if(ut<=ye[0].prix)return ye[0].r2;if(ut>=ye[ye.length-1].prix)return ye[ye.length-1].r2;for(let De=1;De<ye.length;De++)if(ut<=ye[De].prix){const St=ye[De-1],Ze=ye[De],an=(ut-St.prix)/Math.max(1,Ze.prix-St.prix);return St.r2+an*(Ze.r2-St.r2)}return ye[ye.length-1].r2},ot=Ve(j),kt=500;let sn=oe,Ht=Z;if(ot>0){const W=ot*.85;for(let De=j;De<=oe;De+=kt)if(Ve(De)<=W){sn=De;break}const ut=ot*1.15;for(let De=j;De>=Z;De-=kt)if(Ve(De)>=ut){Ht=De;break}}return{min:Math.max(Z,Math.round(Ht/500)*500),max:Math.min(oe,Math.round(sn/500)*500)}};if(c.useEffect(()=>{if(!(U>0))return;const j=Oe(U);
73ve(String(j.min)),pe(String(j.max))},[U,b]),c.useEffect(()=>{const j=(m==null?void 0:m.prix_total_estime)||0;if(!(j>0))return;const S=(b==null?void 0:b.source)==="A"&&Array.isArray(b==null?void 0:b.points)&&b.points.length>0,X=S?b.points[0].prix:Math.round(j*.75),Z=S?b.points[b.points.length-1].prix:Math.round(j*1.3);ae(oe=>Math.min(Z,Math.max(X,oe||j)))},[m,b]),c.useEffect(()=>{if(!a)return;const j=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=j}},[a]),!a)return null;const je=(m==null?void 0:m.fourchette_basse_total)||0,Ee=(m==null?void 0:m.fourchette_haute_total)||0,Te=(m==null?void 0:m.prix_total_estime)||0,xe=Number(String(R).replace(/\D/g,""))||0,J=(b==null?void 0:b.source)==="A",Ne=J?b.points[0].prix:Math.round((Te||U||1)*.75),de=J?b.points[b.points.length-1].prix:Math.round((Te||U||1)*1.3),Ke=qe(U),nt=Number(String(z).replace(/\D/g,""))||0,Xe=nt>0?qe(nt):null,bn=J&&b.t1&&Ke?Math.round(Ke.r2/b.t1*100):0,Ot=Ke&&Xe?Ke.r2-Xe.r2:0,jt=j=>{if(!J||!Array.isArray(b==null?void 0:b.points)||b.points.length<2)return 0;const S=[...b.points].sort((Z,oe)=>Z.prix-oe.prix),X=Math.max(S[0].prix,Math.min(S[S.length-1].prix,j));if(X<=S[0].prix)return S[0].r2;if(X>=S[S.length-1].prix)return S[S.length-1].r2;for(let Z=1;Z<S.length;Z++)if(X<=S[Z].prix){const oe=S[Z-1],ye=S[Z],Ve=(X-oe.prix)/Math.max(1,ye.prix-oe.prix);return oe.r2+Ve*(ye.r2-oe.r2)}return S[S.length-1].r2},Lt=Number(String(Ge).replace(/\D/g,""))||Ne,Nt=Number(String(Ue).replace(/\D/g,""))||de,Wt=(m==null?void 0:m.fourchette_haute_total)||0;let rt;if(!J)rt={color:M.muted,title:o("Données insuffisantes","Onvoldoende gegevens","Insufficient data"),body:o("Peu d'acheteurs dans la zone : le take-home se limitera au positionnement, sans courbe de demande.","Weinig kopers in de zone: de take-home beperkt zich tot de positionering, zonder vraagcurve.","Few buyers in the area: the take-home will show positioning only, without a demand curve.")};else if(Wt>0&&U>Wt)rt={color:M.warn,title:o("Prix au-dessus du marché","Prijs boven de markt","Price above market"),body:o("À ce prix, le take-home montrerait une chute de demande et découragerait le vendeur. Revoyez le prix avant d'envoyer.","Bij deze prijs toont de take-home een vraagdaling en ontmoedigt de verkoper. Herzie de prijs.","At this price, the take-home would show falling demand and discourage the seller. Review the price first.")};else{const j=jt(U)||1;Math.abs(jt(Lt)-jt(Nt))/j>=.15?rt={color:"#16a34a",title:o("Take-home percutant","Overtuigende take-home","Compelling take-home"),body:o("À ce prix, faire varier le curseur montre un impact réel sur la demande — le vendeur verra la démonstration.","Bij deze prijs toont de schuifknop een reële impact op de vraag — de verkoper ziet het bewijs.","At this price, moving the slider shows real demand impact — the seller sees the demonstration.")}:rt={color:M.goldDark,title:o("Take-home peu démonstratif","Weinig aantonende take-home","Low-demonstration take-home"),body:o("La demande varie peu autour de ce prix : le take-home rassurera le vendeur, mais ne fera pas la démonstration.","De vraag varieert weinig rond deze prijs: de take-home stelt gerust, maar toont weinig aan.","Demand barely varies around this price: the take-home will reassure but won't demonstrate much.")}}const at=j=>{j&&j>0&&ae(Math.min(de,Math.max(Ne,j))),k("explore")},yt={background:"white",border:`1px solid ${M.border}`,borderRadius:14,padding:p?14:18},Ut=j=>({padding:"7px 13px",borderRadius:9,border:`1px solid ${j?M.teal:M.border}`,background:j?M.teal:"white",color:j?"white":M.text,fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"'Outfit', sans-serif",transition:"all 0.12s"}),it={fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:.8,color:M.muted,marginBottom:8},dt={padding:"13px 28px",borderRadius:10,border:"none",background:M.teal,color:"white",fontSize:15,fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif"},vt=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{style:it,children:o("PEB","EPC","EPC")}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:Ko.map(j=>e.jsx("button",{style:Ut(_.toUpperCase()===j),onClick:()=>Y(j),children:j},j))})]}),e.jsxs("div",{children:[e.jsx("div",{style:it,children:o("État","Staat","Condition")}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:Xo.map(j=>e.jsx("button",{style:Ut(D===j.v),onClick:()=>ce(j.v),children:o(j.fr,j.nl,j.en)},j.v))})]}),e.jsxs("div",{children:[e.jsx("div",{style:it,children:o("Atouts","Troeven","Features")}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:Zo.map(j=>e.jsx("button",{style:Ut(!!B[j.k]),onClick:()=>G(S=>({...S,[j.k]:!S[j.k]})),children:o(j.fr,j.nl,j.en)},j.k))})]}),e.jsx("div",{style:{fontSize:11,color:M.muted,lineHeight:1.5,borderTop:`1px solid ${M.border}`,paddingTop:12},children:o("Les leviers reflètent les caractéristiques réelles du bien. La fourchette s'ajuste sur les données, pas sur une cible.","De hefbomen weerspiegelen de echte kenmerken. De vork past zich aan o
73p de data, niet op een doel.","Levers reflect the property's real characteristics. The range adjusts on data, not on a target.")})]}),nn=e.jsxs("div",{style:yt,children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",flexWrap:"wrap",gap:10},children:[e.jsxs("div",{children:[e.jsx("div",{style:it,children:o("Fourchette data","Datavork","Data range")}),e.jsx("div",{style:{fontSize:p?20:22,fontWeight:800,color:M.teal},children:ne?"…":`${je.toLocaleString("fr-BE")} – ${Ee.toLocaleString("fr-BE")} €`}),Te>0&&e.jsxs("div",{style:{fontSize:12,color:M.muted,marginTop:2},children:[o("Estimation centrale","Centrale schatting","Central estimate")," : ",Te.toLocaleString("fr-BE")," ","€"]})]}),e.jsxs("div",{style:{textAlign:p?"left":"right"},children:[e.jsx("div",{style:it,children:o("Prix testé","Geteste prijs","Tested price")}),e.jsxs("div",{style:{fontSize:p?24:26,fontWeight:800,color:M.goldDark},children:[U.toLocaleString("fr-BE")," €"]})]})]}),e.jsx("input",{type:"range",min:Ne,max:de,step:1e3,value:Math.min(de,Math.max(Ne,U)),onChange:j=>ae(Number(j.target.value)),style:{width:"100%",marginTop:16,accentColor:M.goldDark,cursor:"pointer",height:p?24:void 0}}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10.5,color:M.muted,marginTop:2},children:[e.jsxs("span",{children:[Ne.toLocaleString("fr-BE")," €"]}),e.jsxs("span",{children:[de.toLocaleString("fr-BE")," €"]})]}),Te>0&&Math.abs(U-Te)>=1e3&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:10,padding:"8px 12px",background:"rgba(212,175,55,0.10)",border:"1px solid rgba(212,175,55,0.35)",borderRadius:8,flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:12,color:M.text,lineHeight:1.4},children:[o("Le prix testé diffère de l'estimation actuelle","De geteste prijs wijkt af van de huidige schatting","Tested price differs from the current estimate")," ","(",Te.toLocaleString("fr-BE")," €)"]}),e.jsx("button",{onClick:()=>ae(Te),style:{padding:"6px 12px",borderRadius:7,border:"none",background:M.goldDark,color:"white",fontSize:12,fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif",whiteSpace:"nowrap"},children:o("Recaler","Herstellen","Reset")})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:14,borderTop:`1px solid ${M.border}`,paddingTop:14,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:M.warn},children:o("Prix annoncé par un concurrent","Door concurrent aangekondigde prijs","Competitor's quoted price")}),e.jsx("input",{type:"text",inputMode:"numeric",value:z,onChange:j=>le(j.target.value),placeholder:o("ex. 445000","bv. 445000","e.g. 445000"),style:{width:130,padding:"8px 10px",borderRadius:8,border:`1px solid ${M.border}`,fontSize:13,fontFamily:"'Outfit', sans-serif",color:M.text}}),nt>0&&e.jsx("button",{onClick:()=>le(""),style:{fontSize:11,color:M.muted,background:"none",border:"none",cursor:"pointer"},children:o("effacer","wissen","clear")})]}),e.jsxs("div",{style:{marginTop:14,borderTop:`1px solid ${M.border}`,paddingTop:14},children:[we?e.jsxs("div",{children:[e.jsx("div",{style:it,children:o("Lien vendeur (valable 30 jours)","Verkoperslink (30 dagen geldig)","Seller link (valid 30 days)")}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("input",{readOnly:!0,value:we.url,onFocus:j=>j.currentTarget.select(),style:{flex:"1 1 200px",minWidth:0,padding:"10px 12px",borderRadius:8,border:`1px solid ${M.border}`,fontSize:12,fontFamily:"'Outfit', sans-serif",color:M.text,background:M.cream}}),e.jsx("button",{onClick:()=>v(we.url),style:{padding:"10px 16px",borderRadius:8,border:"none",background:Ie?M.tealLight:M.teal,color:"white",fontSize:13,fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif",whiteSpace:"nowrap"},children:Ie?o("Copié !","Gekopieerd!","Copied!"):o("Copier","Kopiëren","Copy")}),ge&&e.jsx("button",{onClick:()=>E(we.url),style:{padding:"10px 16px",borderRadius:8,border:`1px solid ${M.teal}`,background:"white",color:M.teal,fontSize:13,fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif",whiteSpace:"nowrap"},children:o("Partager","Delen","Share")})]}),e.jsx("button",{onClick:()=>{Fe(null),he("")},style:{marginTop:8,fontSize:11,color:M.muted,background:"none",border:"none",cursor:"pointer",textDecoration:"underline",fontFamily:"'Outfit', sans-serif"},children:o("Générer un nouveau lien","Nieuwe link genereren","Generate a new link")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("div",{style:{...it,marginBottom:8},children:o("Plage explorable par le vendeur","Prijsmarge voor de verkoper","Range the seller can explore")}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("input",{type:"text",inputMode:"numeric",value:Ge,onChange:j=>ve(j.target.value),placeholder:o("min","min","min"),style:{flex:1,minWidth:0,padding:"9px 10px",borderRadius:8,border:`1px solid ${M.border}`,fontSize:13,fontFamily:"'Outfit', sans-serif",color:M.text}}),e.jsx("span",{style:{color:M.muted},children:"–"}),e.jsx("input",{type:"text",inputMode:"numeric",value:Ue,onChange:j=>pe(j.target.value),placeholder:o("max","max","max"),style:{flex:1,minWidth:0,padding:"9px 10px",borderRadius:8,border:`1px solid ${M.border}`,fontSize:13,fontFamily:"'Outfit', sans-serif",color:M.text}}),e.jsx("span",{style:{color:M.muted,fontSize:13},children:"€"})]})]}),e.jsxs("div",{style:{marginBottom:12,padding:"10px 12px",borderRadius:10,background:`${rt.color}12`,border:`1px solid ${rt.color}40`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:9,height:9,borderRadius:5,background:rt.color,flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:rt.color},children:rt.title})]}),e.jsx("div",{style:{fontSize:11.5,color:M.text,marginTop:4,lineHeight:1.45},children:rt.body})]}),e.jsx("button",{onClick:h,disabled:Re,style:{...dt,width:"100%",background:M.goldDark,opacity:Re?.6:1,cursor:Re?"default":"pointer"},children:Re?o("Génération…","Genereren…","Generating…"):o("Générer le lien vendeur","Verkoperslink genereren","Generate seller link")})]}),be&&e.jsx("div",{style:{fontSize:12,color:M.warn,marginTop:8,lineHeight:1.4},children:be})]})]}),qt=e.jsxs("div",{style:yt,children:[e.jsx("div",{style:it,children:o("Demande dans la zone","Vraag in de zone","Demand in the area")}),ie&&e.jsx("div",{style:{padding:"30px 0",textAlign:"center",color:M.muted,fontSize:13},children:o("Calcul de la demande…","Vraag berekenen…","Computing demand…")}),!ie&&J&&Ke&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:p?16:28,flexWrap:"wrap",margin:"6px 0 12px",alignItems:"flex-end"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:p?30:36,fontWeight:800,color:M.teal,lineHeight:1},children:Ke.r2}),e.jsx("div",{style:{fontSize:11,color:M.muted,marginTop:4,maxWidth:160},children:o("acheteurs ont le budget pour ce type de bien à ce prix","kopers hebben het budget voor dit type pand tegen deze prijs","buyers have the budget for this property type at this price")})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:p?22:26,fontWeight:800,color:M.tealLight,lineHeight:1},children:[bn,"%"]}),e.jsx("div",{style:{fontSize:11,color:M.muted,marginTop:4,maxWidth:130},children:o("des acheteurs de la zone","van de kopers in de zone","of buyers in the area")})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:p?22:26,fontWeight:800,color:M.goldDark,lineHeight:1},children:Ke.r4}),e.jsx("div",{style:{fontSize:11,color:M.muted,marginTop:4,maxWidth:120},children:o("dont engagés (rappel / fort)","waarvan betrokken","engaged")})]}),b.median_budget>0&&e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:p?18:20,fontWeight:700,color:M.muted,lineHeight:1},children:[Math.round(b.median_budget/1e3),"k €"]}),e.jsx("div",{style:{fontSize:11,color:M.muted,marginTop:4,maxWidth:120},children:o("budget médian acheteurs","mediaan koperbudget","median buyer budget")})]})]}),Xe&&e.jsxs("div",{style:{background:"rgba(194,69,59,0.07)",border:"1px solid rgba(194,69,59,0.25)",borderRadius:10,padding:"10px 14px",marginBottom:12,fontSize:13,color:M.text,lineHeight:1.5},children:[o("Au prix concurrent","Tegen de concurrentprijs","At the competitor's price")," ",e.jsxs("strong",{children:[nt.toLocaleStr
73ing("fr-BE")," €"]})," :"," ",e.jsx("strong",{style:{color:M.warn},children:Xe.r2})," ",o("acheteurs","kopers","buyers"),Ot>0&&e.jsxs(e.Fragment,{children:[" — ",e.jsxs("strong",{style:{color:M.warn},children:[o("vous en perdez","u verliest er","you lose")," ",Ot]})," ",o("par rapport à votre prix.","t.o.v. uw prijs.","versus your price.")]})]}),e.jsx(Qo,{points:b.points,bins:b.bins,binLow:b.bin_low,binHigh:b.bin_high,binStep:b.bin_step,prixCourant:U,prixConcurrent:nt>0?nt:null,medianBudget:b.median_budget,fourchetteBasse:je,fourchetteHaute:Ee,lang:T,isMobile:p}),e.jsx("div",{style:{fontSize:11,color:M.muted,marginTop:10,lineHeight:1.5},children:o(`Acheteurs de votre zone (${b.communes_included} communes, ${b.radius_km} km) cherchant ce type de bien. « Reach » = budget de référence ≥ prix, pas une capacité d'achat garantie.`,`Kopers in uw zone (${b.communes_included} gemeenten, ${b.radius_km} km) voor dit type pand. "Reach" = referentiebudget ≥ prijs, geen gegarandeerde koopkracht.`,`Buyers in your area (${b.communes_included} communes, ${b.radius_km} km) seeking this property type. "Reach" = reference budget ≥ price, not a guaranteed purchasing power.`)})]}),!ie&&!J&&e.jsx("div",{style:{padding:"26px 0",textAlign:"center",color:M.muted,fontSize:13,lineHeight:1.5},children:o("Pas assez de données de demande dans cette zone pour afficher la courbe. La fourchette et les leviers restent disponibles.","Onvoldoende vraaggegevens in deze zone voor de curve. De vork en hefbomen blijven beschikbaar.","Not enough demand data in this area to show the curve. The range and levers remain available.")})]}),yn=e.jsx("div",{style:{...yt,display:"flex",flexDirection:"column",gap:18},children:vt()}),rn=e.jsxs("div",{style:yt,children:[e.jsxs("button",{onClick:()=>I(j=>!j),style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:0,fontFamily:"'Outfit', sans-serif"},children:[e.jsx("span",{style:{...it,marginBottom:0},children:o("Ajuster les caractéristiques","Kenmerken aanpassen","Adjust characteristics")}),e.jsx("span",{style:{color:M.muted,fontSize:12},children:N?"▲":"▼"})]}),N&&e.jsx("div",{style:{marginTop:16,display:"flex",flexDirection:"column",gap:18},children:vt()})]}),vn=()=>p?e.jsxs("div",{style:{maxWidth:560,margin:"0 auto",padding:"16px 14px 0",display:"flex",flexDirection:"column",gap:14},children:[nn,qt,rn]}):e.jsxs("div",{style:{maxWidth:1180,margin:"0 auto",padding:"22px 28px 0",display:"grid",gridTemplateColumns:"300px 1fr",gap:20,alignItems:"start"},children:[yn,e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[nn,qt]})]}),wn=()=>{const j=Math.min(je,xe||je)*.95,S=Math.max(Ee,xe||Ee)*1.05,X=Math.max(1,S-j),Z=kt=>Math.max(0,Math.min(100,(kt-j)/X*100)),oe=xe>Ee,ye=xe>0&&xe<je,Ve=xe>=je&&xe<=Ee,ot=oe?Math.round((xe/Ee-1)*100):ye?Math.round((1-xe/je)*100):0;return e.jsxs("div",{style:{maxWidth:720,margin:"0 auto",padding:p?"28px 16px":"40px 28px"},children:[e.jsxs("div",{style:{textAlign:"center",marginBottom:30},children:[e.jsx("div",{style:{fontSize:13,color:M.muted,marginBottom:6},children:o("Votre estimation","Uw schatting","Your estimate")}),e.jsxs("div",{style:{fontSize:p?30:38,fontWeight:800,color:M.goldDark},children:[xe.toLocaleString("fr-BE")," €"]})]}),e.jsxs("div",{style:{position:"relative",height:80,marginBottom:14},children:[e.jsx("div",{style:{position:"absolute",top:38,left:0,right:0,height:6,background:M.border,borderRadius:3}}),e.jsx("div",{style:{position:"absolute",top:35,left:`${Z(je)}%`,width:`${Z(Ee)-Z(je)}%`,height:12,background:M.teal,opacity:.85,borderRadius:6}}),e.jsxs("div",{style:{position:"absolute",top:56,left:`${Z(je)}%`,fontSize:11,color:M.teal,fontWeight:600,transform:"translateX(-4px)"},children:[Math.round(je/1e3),"k"]}),e.jsxs("div",{style:{position:"absolute",top:56,left:`${Z(Ee)}%`,fontSize:11,color:M.teal,fontWeight:600,transform:"translateX(-50%)"},children:[Math.round(Ee/1e3),"k"]}),e.jsx("div",{style:{position:"absolute",top:56,left:`${(Z(je)+Z(Ee))/2}
73%`,fontSize:10,color:M.muted,transform:"translateX(-50%)",whiteSpace:"nowrap"},children:o("Estimation Arcanes","Arcanes-schatting","Arcanes estimate")}),xe>0&&e.jsxs("div",{style:{position:"absolute",top:8,left:`${Z(xe)}%`,transform:"translateX(-50%)",textAlign:"center"},children:[e.jsx("div",{style:{width:2,height:34,background:M.goldDark,margin:"0 auto"}}),e.jsx("div",{style:{width:12,height:12,borderRadius:6,background:M.goldDark,border:`2px solid ${M.cream}`,margin:"-4px auto 0"}})]})]}),e.jsxs("div",{style:{textAlign:"center",padding:"16px 20px",borderRadius:12,background:oe?"rgba(194,69,59,0.07)":ye?"rgba(212,175,55,0.10)":"rgba(15,76,76,0.06)",border:`1px solid ${oe?"rgba(194,69,59,0.25)":ye?"rgba(212,175,55,0.3)":"rgba(15,76,76,0.2)"}`,fontSize:15,lineHeight:1.55,color:M.text,marginBottom:28},children:[oe&&e.jsxs(e.Fragment,{children:[o("Votre estimation est","Uw schatting ligt","Your estimate is")," ",e.jsxs("strong",{style:{color:M.warn},children:[ot,"% ",o("au-dessus","boven","above")]})," ",o("du haut de ce que les données soutiennent aujourd'hui. Explorons ce que ça implique côté acheteurs.","van wat de data vandaag ondersteunt. Laten we kijken wat dat betekent voor kopers.","of the top of what the data supports today. Let's explore what that means for buyers.")]}),Ve&&e.jsx(e.Fragment,{children:o("Votre estimation tombe dans la fourchette soutenue par les données. Bon repère — affinons ensemble.","Uw schatting valt binnen de door data ondersteunde vork. Goed uitgangspunt — laten we verfijnen.","Your estimate falls within the data-supported range. Good anchor — let's refine together.")}),ye&&e.jsxs(e.Fragment,{children:[o("Votre estimation est","Uw schatting ligt","Your estimate is")," ",e.jsxs("strong",{style:{color:M.goldDark},children:[ot,"% ",o("sous","onder","below")]})," ",o("ce que les données soutiennent — votre bien vaut peut-être plus que vous ne le pensiez.","wat de data ondersteunt — uw pand is mogelijk meer waard dan u dacht.","what the data supports — your property may be worth more than you thought.")]})]}),e.jsx("div",{style:{textAlign:"center"},children:e.jsx("button",{style:dt,onClick:()=>at(xe),children:o("Continuer vers l'analyse →","Verder naar analyse →","Continue to analysis →")})})]})},on=()=>e.jsxs("div",{style:{maxWidth:560,margin:"0 auto",padding:p?"40px 18px":"60px 28px",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:p?19:22,fontWeight:800,color:M.teal,marginBottom:12,lineHeight:1.35},children:o("Avant de vous montrer nos données : selon vous, quelle est la valeur de votre bien ?","Voordat we onze data tonen: wat is volgens u de waarde van uw pand?","Before we show our data: what do you think your property is worth?")}),e.jsx("div",{style:{fontSize:13,color:M.muted,marginBottom:30},children:o("Il n'y a pas de mauvaise réponse.","Er is geen fout antwoord.","There's no wrong answer.")}),e.jsxs("div",{style:{position:"relative",display:"inline-block",marginBottom:28},children:[e.jsx("input",{type:"text",inputMode:"numeric",autoFocus:!0,value:R,onChange:j=>F(j.target.value),onKeyDown:j=>{j.key==="Enter"&&xe>0&&k("reveal")},placeholder:o("ex. 420000","bv. 420000","e.g. 420000"),style:{width:p?220:280,padding:"16px 44px 16px 20px",borderRadius:12,border:`2px solid ${M.border}`,fontSize:p?22:24,fontWeight:700,textAlign:"center",color:M.text,fontFamily:"'Outfit', sans-serif",outline:"none"}}),e.jsx("span",{style:{position:"absolute",right:18,top:"50%",transform:"translateY(-50%)",fontSize:20,color:M.muted,fontWeight:600},children:"€"})]}),e.jsx("div",{children:e.jsx("button",{style:{...dt,opacity:xe>0?1:.4,cursor:xe>0?"pointer":"default"},disabled:xe<=0,onClick:()=>k("reveal"),children:o("Révéler les données","Toon de data","Reveal the data")})}),e.jsx("button",{onClick:()=>at(),style:{marginTop:18,fontSize:13,color:M.muted,background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:o("Passer cette étape","Sla deze stap over","Skip this step")})]});return e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:49,background:"#F7F5F2",fontFamily:"'Outfit', sans-serif",color:M.text,overflowY:"auto"},children:e.jsxs("main",{style:{minHeight:"100vh",background:"#F7F5F2",padding:"72px 0 56px"},children:[e.jsx("div",{style:{maxWidth:1180,margin:"0 auto",padding:p?"18px 16px 0":"24px 24px 0"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:12,marginBottom:6},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:10},children:[e.jsx("span",{style:{display:"block",width:32,height:2,background:"#D4AF37",borderRadius:2}}),e.jsx("span",{style:{fontSize:10,fontWeight:700,letterSpacing:"2.5px",textTransform:"uppercase",color:"#B88A2E"},children:o("Outil de négociation","Onderhandelingstool","Negotiation tool")})]}),e.jsxs("h1",{style:{fontSize:"clamp(28px, 4vw, 36px)",fontWeight:800,lineHeight:1.1,letterSpacing:"-1px",color:"#0D1109",margin:"0 0 6px"},children:[o("Studio ","Studio ","Studio "),e.jsx("span",{style:{color:"#0F4C4C"},children:o("Leviers.","Hefbomen.","Levers.")})]}),e.jsx("p",{style:{fontSize:14,color:"#B8B4AE",margin:0,lineHeight:1.55},children:g==="explore"?o("Simulez l'impact de chaque paramètre, en direct.","Simuleer live de impact van elke parameter.","Simulate the impact of each parameter, live."):o("Estimation à l'aveugle.","Blinde schatting.","Blind estimate.")})]}),e.jsx("button",{onClick:x,style:{padding:"8px 16px",borderRadius:10,border:"1px solid rgba(15,76,76,0.12)",background:"rgba(255,255,255,0.9)",color:"#0F4C4C",fontSize:13,fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif",flexShrink:0},children:o("Fermer","Sluiten","Close")})]})}),g==="ask"&&on(),g==="reveal"&&wn(),g==="explore"&&vn()]})})}const ts=ee.supabaseUrl||"https://mnocxtuirejggqyfoyys.supabase.co",lt=`${ts}/functions/v1`,ns="https://nominatim.openstreetmap.org";function rs(u,a,x){const n=u.match(/\b(\d{4})\b/);if(n&&a[n[1]])return a[n[1]];const T=u.toLowerCase();for(const[C,q]of Object.entries(x))if(!(C==="bruxelles"||C==="brussel")&&T.includes(C))return q;return T.includes("bruxelles")||T.includes("brussel")?x.bruxelles||"21004":""}const is=u=>{const a=u.replace(/\D/g,"");
73return a?Number(a).toLocaleString("fr-BE"):""},mt=u=>u.replace(/\D/g,""),y={teal:"#0F4C4C",tealLight:"#1E6B7E",gold:"#D4AF37",goldDark:"#B8962E",cream:"#F8F6F3",border:"#E6E1DA",muted:"#94A3B8",text:"#0F4C4C"},et={width:"100%",padding:"10px 12px",borderRadius:"8px",border:`1px solid ${y.border}`,background:"white",fontSize:"13px",fontFamily:"'Outfit', sans-serif",color:y.text,outline:"none"};function ks(){var Ir,Pr;const u=oo(),{bienId:a}=so(),{language:x}=mn(),n=(t,r,d)=>x==="nl"?r:x==="en"?d:t,[T,C]=c.useState(!1),[q,L]=c.useState(0),[i,s]=c.useState(""),l=c.useRef({}),o=c.useRef({}),p=c.useCallback(t=>rs(t,l.current,o.current),[]),[g,k]=c.useState(""),[R,F]=c.useState(""),[N,I]=c.useState(""),[_,Y]=c.useState(""),[D,ce]=c.useState("appartement"),[B,G]=c.useState(""),[m,re]=c.useState(""),[b,se]=c.useState(""),[U,ae]=c.useState(""),[z,le]=c.useState(""),[ne,Me]=c.useState(""),[ie,ze]=c.useState(""),[me,Re]=c.useState(""),[ke,we]=c.useState("fr"),[Fe,be]=c.useState("professionnel"),[he,Ie]=c.useState(""),[fe,Ge]=c.useState(""),[ve,Ue]=c.useState(""),[pe,Be]=c.useState({terrasse:!1,jardin:!1,garage:!1,cave:!1,parking:!1,ascenseur:!1,lumineux:!1,calme:!1,piscine:!1}),tt=t=>Be(r=>({...r,[t]:!r[t]})),[qe,h]=c.useState([]),[v,E]=c.useState(!1),[ge,Oe]=c.useState(!1),je=c.useRef(null),Ee=c.useRef(null),[Te,xe]=c.useState(!1),[J,Ne]=c.useState(null),[de,Ke]=c.useState([]),[nt,Xe]=c.useState(!1),[bn,Ot]=c.useState(!1),[jt,Lt]=c.useState(!1),[Nt,Wt]=c.useState(null),rt=c.useRef(null),[at,yt]=c.useState(!1),[Ut,it]=c.useState(""),[dt,vt]=c.useState(!1),[nn,qt]=c.useState(null),[yn,rn]=c.useState(null),[vn,wn]=c.useState(null),[on,j]=c.useState(null),[S,X]=c.useState(null),[Z,oe]=c.useState(null),[ye,Ve]=c.useState([]),[ot,kt]=c.useState([]),[sn,Ht]=c.useState([]),[W,ut]=c.useState(null),[De,St]=c.useState(""),[Ze,an]=c.useState(""),[st,Jn]=c.useState(""),[ht,Kn]=c.useState(""),[ni,Xn]=c.useState(!1),[Zn,er]=c.useState(!1),[ri,tr]=c.useState(!1);c.useState(!1);const[ii,nr]=c.useState("report"),[rr,ir]=c.useState("auto"),[or,jn]=c.useState({}),[oi,ln]=c.useState(!1),[kn,dn]=c.useState(null),[It,sr]=c.useState(!1),Sn=c.useRef(null),[si,ai]=c.useState(null),[li,Cn]=c.useState(""),[En,di]=c.useState(""),[_n,ar]=c.useState(""),[Pt,Ft]=c.useState(!1),[Ct,Gt]=c.useState(!1),[os,ci]=c.useState(null),[lr,dr]=c.useState(!1),[Vt,cr]=c.useState(!1),[Et,An]=c.useState(null),[He,zn]=c.useState(null),[cn,pn]=c.useState(""),[un,Rn]=c.useState(null),[pi,ui]=c.useState(null),[hi,pr]=c.useState(null),[ur,hr]=c.useState(null),[gi,gr]=c.useState(null),[fi,$n]=c.useState(null),[xi,In]=c.useState(null),[_t,mi]=c.useState(""),[bi,Qt]=c.useState(!1),[Bt,Pn]=c.useState(""),yi=async t=>{if(!a)return;const r=new Date(t+"T12:00:00").toISOString(),d=new Date().toISOString(),{error:f}=await ee.from("biens_publies").update({status:"vendu",sold_at:r,updated_at:d}).eq("id",a);f||(pn("vendu"),Rn(r))},vi=async t=>{if(!a)return n("Dossier non enregistré","Dossier niet opgeslagen","File not saved");const{error:r}=await ee.rpc("bien_mark_mandate_signed",{p_bien_id:a,p_signed_at:t});return r?(console.error("[ProAnnonce] bien_mark_mandate_signed",r),r.message||r.code||n("Erreur inconnue","Onbekende fout","Unknown error")):(pn("active"),pr(t),te.success(n("Mandat signé","Mandaat ondertekend","Mandate signed")),null)},fr=async()=>{if(!a)return;const t=new Date().toISOString(),{error:r}=await ee.from("biens_publies").update({status:"active",sold_at:null,updated_at:t}).eq("id",a);r||(pn("active"),Rn(null))},[Mt,Yt]=c.useState(!0),[hn,Fn]=c.useState([]),[Bn,wi]=c.useState(null),[gt,ji]=c.useState(null),[Jt,Mn]=c.useState({}),[ki,gn]=c.useState("fr"),[Tn,xr]=c.useState(null),[mr,Dn]=c.useState(null),Kt=c.useRef(null);c.useEffect(()=>{(async()=>{const{data:{user:t}}=await ee.auth.getUser();if(!t){u("/login");return}C(!0),wi(t.id);const{data:r}=await ee.rpc("get_pro_credits",{p_user_id:t.id});L(r||0);const{data:d}=await ee.from("agent_profiles").select("first_name, last_name, display_name, phone, style_prompt, agency_id").eq("user_id",t.id).maybeSingle();if(d!=null&&d.agency_id){const{data:w}=await ee.from("agencies").select("name, logo_url, primary_color, secondary_color").eq("id",d.agency_id).maybeSingle();ut({nom_agence:(w==null?void 0:w.name)||"",nom_complet:d.display_name||"",telephone:d.phone||"",logo_url:(w==null?void 0:w.logo_url)||"",couleur_primaire:(w==null?void 0:w.primary_color)||"#0F4C4C",couleur_secondaire:(w==null?void 0:w.secondary_color)||"#D4AF37",style_prompt:d.style_prompt||null,template_html:null})}const{data:f}=await ee.from("api_keys").select("key").eq("user_id",t.id).eq("is_active",!0).limit(1).maybeSingle();f!=null&&f.key?s(f.key):te.error("Aucune clé API associée à votre compte. Contactez le support.");try{const{data:w}=await ee.from("arcanes_mapping_cp_ins").select("code_postal, code_ins, nom_commune");if(w){const P={},$={};
73w.forEach(A=>{const H=String(A.code_ins||""),O=String(A.code_postal||"");O&&H&&(P[O]=H),A.nom_commune&&H&&($[String(A.nom_commune).toLowerCase()]=H)}),l.current=P,o.current=$}}catch{}})()},[]),c.useEffect(()=>{S&&a&&Yt(!1)},[S,a]),c.useEffect(()=>{a&&(async()=>{var f,w,P,$,A;const{data:t}=await ee.from("biens_publies").select("id, label, prix, payload, status, sold_at, updated_at, report_blocks_override, published_at, created_at, mandate_signed_at").eq("id",a).maybeSingle();if(!(t!=null&&t.payload))return;pn(t.status||"active"),Rn(t.sold_at||null),ui(t.created_at||null),pr(t.mandate_signed_at||null),hr(t.published_at||null),gr(t.updated_at||null),mi(t.label||""),jn(t.report_blocks_override||{});const r=t.payload,d=r.bien||{};if(d.rue&&k(d.rue),d.cp&&F(d.cp),d.ville&&I(d.ville),d.code_ins&&Y(d.code_ins),d.type_bien&&ce(d.type_bien),d.prix&&G(String(d.prix)),d.surface&&re(String(d.surface)),d.chambres&&se(String(d.chambres)),d.sdb&&ae(String(d.sdb)),d.peb&&le(d.peb),d.etage&&Me(String(d.etage)),d.etat&&ze(d.etat),d.description_libre&&Re(d.description_libre),d.equipements){const H=d.equipements.split(",").map(O=>O.trim().toLowerCase());Be(O=>{const V={...O};return Object.keys(V).forEach(Pe=>{V[Pe]=H.includes(Pe)}),V})}if(r.estimation&&Ne(r.estimation),r.annonce){const H={immoweb:r.annonce,social:((f=r.annonce)==null?void 0:f.social)||((w=r.annonce)!=null&&w.caption?{caption:r.annonce.caption}:null),enrichment:null};X(H),Mn(O=>({...O,fr:H})),gn("fr"),$n(((P=r.annonce)==null?void 0:P.source)||"ai"),In((($=r.annonce)==null?void 0:$.updated_at)||null)}if(((A=r.photo_urls)==null?void 0:A.length)>0&&Ke(r.photo_urls.map((H,O)=>({id:`existing-${O}`,file:new File([],`photo-${O}.jpg`),url:H}))),An(t.published_at?`https://arcanes.be/bien/${a}`:null),zn(a),d.cp&&!d.code_ins){const H=p(d.cp);H&&Y(H)}Yt(!1)})()},[a]),c.useEffect(()=>{if(!_){Ve([]),kt([]),Ht([]);return}(async()=>{const t=D==="appartement"?"prix_median_appartements":"prix_median_maisons",r=D==="appartement"?"prix_q25_appartements":"prix_q25_maisons",d=D==="appartement"?"prix_q75_appartements":"prix_q75_maisons",f=D==="appartement"?"nb_ventes_appartements":"nb_ventes_toutes_maisons",[w,P,$]=await Promise.all([ee.from("v_commune_historique_prix").select(`annee, ${t}, ${r}, ${d}, ${f}`).eq("code_ins",_).order("annee",{ascending:!0}).limit(15),ee.from("v_commune_historique_revenus").select("annee, revenu_median").eq("code_ins",_).order("annee",{ascending:!0}).limit(15),ee.from("v_commune_historique_menages").select("annee, nb_menages_prives").eq("code_ins",_).order("annee",{ascending:!0}).limit(15)]);Ve(((w==null?void 0:w.data)||[]).map(A=>({annee:Number(A.annee),prix:Number(A[t])||0,q25:Number(A[r])||0,q75:Number(A[d])||0,ventes:Number(A[f])||0})).filter(A=>A.annee>0&&A.prix>0)),kt(((P==null?void 0:P.data)||[]).map(A=>({annee:Number(A.annee),revenu:Number(A.revenu_median)||0})).filter(A=>A.annee>0&&A.revenu>0)),Ht((($==null?void 0:$.data)||[]).map(A=>({annee:Number(A.annee),menages:Number(A.nb_menages_prives)||0})).filter(A=>A.annee>0&&A.menages>0))})()},[_,D]),c.useEffect(()=>{a&&(async()=>{const{data:t}=await ee.from("biens_publies").select("view_count").eq("id",a).maybeSingle(),{data:r}=await ee.from("qualify_leads").select("id, intent_score, dossier_viewed_at, callback_requested_at, created_at").eq("bien_id",a),d=r||[],f=Date.now(),w=new Map;for(let P=13;P>=0;P--){const $=new Date(f-P*864e5);w.set($.toISOString().split("T")[0],0)}d.forEach(P=>{const $=new Date(P.created_at).toISOString().split("T")[0];w.has($)&&w.set($,(w.get($)||0)+1)}),ji({view_count:(t==null?void 0:t.view_count)||0,total_leads:d.length,hot_leads:d.filter(P=>(P.intent_score||0)>=6).length,dossier_views:d.filter(P=>P.dossier_viewed_at).length,callbacks:d.filter(P=>P.callback_requested_at).length,daily_leads:Array.from(w.entries()).map(([P,$])=>({day:P,count:$}))})})()},[a]);const On="arcanes:proannonce:draft:v1";c.useEffect(()=>{if(!a)try{const t=localStorage.getItem(On);if(!t)return;const r=JSON.parse(t);if(!r||typeof r!="object")return;!g&&r.rue&&k(r.rue),!R&&r.cp&&F(r.cp),!N&&r.ville&&I(r.ville),!_&&r.codeIns&&Y(r.codeIns),r.typeBien&&ce(r.typeBien),!B&&r.prix&&G(r.prix),!m&&r.surface&&re(r.surface),!b&&r.chambres&&se(r.chambres),!U&&r.sdb&&ae(r.sdb),!z&&r.peb&&le(r.peb),!ne&&r.etage&&Me(r.etage),!ie&&r.etat&&ze(r.etat),!me&&r.description&&Re(r.description),!he&&r.surfaceTerrain&&Ie(r.surfaceTerrain),!fe&&r.facades&&Ge(r.facades),!ve&&r.anneeConstruction&&Ue(r.anneeConstruction),r.equips&&Be(d=>({...d,...r.equips})),!De&&r.notesAgent&&St(r.notesAgent),!Ze&&r.ownerName&&an(r.ownerName),!st&&r.ownerEmail&&Jn(r.ownerEmail),!ht&&r.ownerPhone&&Kn(r.ownerPhone),r.savedAt&&Dn(new Date(r.savedAt)),(r.rue||r.prix)&&te.success(n("Brouillon restauré","Concept hersteld","Draft restored"),{duration:2500})}catch(t){console.warn("[draft] restore failed",t)}},[]),c.useEffect(()=>{if(!a)return Kt.current&&clearTimeout(Kt.current),Kt.current=setTimeout(()=>{if(!g&&!R&&!N&&!B&&!D&&de.length===0)return;const t={rue:g,cp:R,ville:N,codeIns:_,typeBien:D,prix:B,surface:m,chambres:b,sdb:U,peb:z,etage:ne,etat:ie,description:me,surfaceTerrain:he,facades:fe,anneeConstruction:ve,equips:pe,notesAgent:De,ownerName:Ze,ownerEmail:st,ownerPhone:ht,savedAt:new Date().toISOString()};try{localStorage.setItem(On,JSON.stringify(t)),Dn(new Date)}catch(r){console.warn("[draft] save failed",r)}},1500),()=>{Kt.current&&clearTimeout(Kt.current)}},[a,g,R,N,_,D,B,m,b,U,z,ne,ie,me,he,fe,ve,pe,De,Ze,st,ht]);const Si=()=>{try{localStorage.removeItem(On),Dn(null)}catch{}},[Ci,Ln]=c.useState(!1),[br,Ei]=c.useState([]),_i=async()=>
73{if(!a)return;const{data:t}=await ee.from("qualify_leads").select("id, nom, telephone, intent_score, status").eq("bien_id",a).gte("intent_score",6).not("status","in",'("contacté","archivé","auto-archived")').order("intent_score",{ascending:!1}),r=(t||[]).filter(d=>d.telephone);Ei(r),Ln(!0)},Ai=(t,r)=>{window.dispatchEvent(new CustomEvent("rune:open",{detail:{prefill:t,context:r}}))},zi=()=>{const t=document.getElementById("bien-leads-panel");if(!t){_i();return}t.scrollIntoView({behavior:"smooth",block:"start"}),t.classList.add("highlight-pulse"),setTimeout(()=>t.classList.remove("highlight-pulse"),1800)},Ri=t=>{if(!t.telephone||!Et)return;const r=t.telephone.replace(/[^0-9+]/g,""),d=t.nom.split(" ")[0]||"",f=_t||(g?`${g}, ${N}`:"ce bien"),w=encodeURIComponent(n(`Bonjour ${d}, suite à votre intérêt, voici la page complète de ${f} : ${Et}`,`Hallo ${d}, hier is de volledige pagina voor ${f}: ${Et}`,`Hi ${d}, here's the full page for ${f}: ${Et}`));window.open(`https://wa.me/${r}?text=${w}`,"_blank","noopener")};c.useEffect(()=>{const t=He||a;!t||!Bn||(async()=>{try{const r=Bn,{data:d,error:f}=await ee.storage.from("rune-reports").list(r,{limit:100,sortBy:{column:"created_at",order:"desc"}});if(f||!d||d.length===0){Fn([]);return}const w=d.filter($=>$.name.endsWith(".html")&&$.name.includes(t)),P=await Promise.all(w.slice(0,5).map(async $=>{const A=`${r}/${$.name}`,{data:H}=await ee.storage.from("rune-reports").createSignedUrl(A,86400);return{name:$.name,created_at:$.created_at||$.name.slice(0,19).replace(/T/," ").replace(/-/g,"/"),signedUrl:(H==null?void 0:H.signedUrl)||"",path:A}}));Fn(P.filter($=>$.signedUrl))}catch{Fn([])}})()},[He,a,Bn,Zn]),c.useEffect(()=>{const t=r=>{Ee.current&&!Ee.current.contains(r.target)&&E(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const $i=c.useCallback(async t=>{if(t.length<4){h([]);return}Oe(!0);try{const d=await(await fetch(`${ns}/search?q=${encodeURIComponent(t+", Belgique")}&format=json&limit=5&countrycodes=be&addressdetails=1`,{headers:{"User-Agent":"ArcanesBE/1.0"}})).json();h(d||[]),E(!0)}catch{h([])}finally{Oe(!1)}},[]),Ii=t=>{k(t);const r=[t,R,N].filter(Boolean).join(", ");je.current&&clearTimeout(je.current),je.current=setTimeout(()=>$i(r),400)},Pi=t=>{const r=t.address||{};r.road&&k([r.road,r.house_number].filter(Boolean).join(" ")),r.postcode&&F(r.postcode);const d=r.city||r.town||r.village||r.municipality||"";d&&I(d);const f=r.postcode?p(r.postcode):"";if(f)Y(f);else for(const w of[r.suburb,d,t.display_name].filter(Boolean)){const P=p(w);if(P){Y(P);break}}E(!1),h([])},ct=[g,R,N].filter(Boolean).join(", "),fn=R.length===4&&!!D&&!!m&&Number(m)>0,Fi=async()=>{if(!i){te.error(n("Clé API manquante","API-sleutel ontbreekt","API key missing"));return}if(!R){te.error(n("Code postal requis","Postcode vereist","Postal code required"));return}xe(!0),Ne(null);try{const t={type_bien:D,code_postal:R};if(_&&(t.code_ins=_),m&&(t.surface_m2=Number(m)),z&&(t.peb=z),ie&&(t.etat=ie),pe.terrasse&&(t.terrasse=!0),pe.jardin&&(t.jardin=!0),pe.garage&&(t.garage=!0),pe.piscine&&(t.piscine=!0),he&&(t.surface_terrain=Number(he)),fe&&(t.facades=Number(fe)),ve){const f=parseInt(String(ve),10);!isNaN(f)&&f>=1800&&f<=new Date().getFullYear()+5&&(t.annee_construction=f)}if(ne!==""&&D==="appartement"){const f=String(ne).trim().toLowerCase();if(f==="rdc"||f==="rez"||f==="0")t.etage=0;else{const w=parseInt(f,10);!isNaN(w)&&w>=0&&w<=50&&(t.etage=w)}}pe.ascenseur&&(t.ascenseur=!0);const r=await fetch(`${lt}/estimate-price`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify(t)});if(!r.ok)throw new Error(`${n("Erreur","Fout","Error")} ${r.status}`);const d=await r.json();Ne(d.data)}catch(t){te.error(t.message||n("Estimation échouée","Schatting mislukt","Estimation failed"))}finally{xe(!1)}},Nn=t=>{G(String(t)),te.success(`${n("Prix","Prijs","Price")}: ${t.toLocaleString("fr-BE")} €`)},yr=/\.(heic|heif)$/i,Bi=t=>t.type==="image/heic"||t.type==="image/heif"||yr.test(t.name),vr=1920,Mi=.85,Ti=5*1024*1024;async function Di(t){var O,V;const r=await createImageBitmap(t,{imageOrientation:"from-image"});let d=r.width,f=r.height;const w=Math.max(d,f);if(w>vr){const Pe=vr/w;d=Math.round(d*Pe),f=Math.round(f*Pe)}const P=document.createElement("canvas");P.width=d,P.height=f;const $=P.getContext("2d");if(!$)return(O=r.close)==null||O.call(r),t;$.fillStyle="#ffffff",$.fillRect(0,0,d,f),$.drawImage(r,0,0,d,f),(V=r.close)==null||V.call(r);const A=await new Promise(Pe=>P.toBlob($e=>Pe($e),"image/jpeg",Mi));if(!A)return t;const H=t.name.replace(/\.(heic|heif|png|webp|jpe?g)$/i,"")+".jpg";return new File([A],H,{type:"image/jpeg"})}const wr=async t=>{if(!t)return;const r=10-de.length;if(r<=0)return;const d=Array.from(t).slice(0,r),f=[];for(const w of d){let P=w;if(Bi(w))try{const{default:$}=await uo(async()=>{const{default:O}
73=await import("./heic2any-BgmgTiVd.js").then(V=>V.h);return{default:O}},__vite__mapDeps([0,1,2])),A=await $({blob:w,toType:"image/jpeg",quality:.85}),H=Array.isArray(A)?A[0]:A;P=new File([H],w.name.replace(yr,".jpg"),{type:"image/jpeg"})}catch($){console.error("[addPhotos] HEIC conversion failed",w.name,$),te.error(n(`Échec conversion HEIC : ${w.name}`,`HEIC-conversie mislukt: ${w.name}`,`HEIC conversion failed: ${w.name}`));continue}try{P=await Di(P)}catch($){console.error("[addPhotos] downscale failed",P.name,$)}if(P.size>Ti){const $=(P.size/1024/1024).toFixed(1);te.error(n(`Photo trop lourde (${$} Mo, max 5) : ${P.name}`,`Foto te zwaar (${$} MB, max 5): ${P.name}`,`Photo too large (${$} MB, max 5): ${P.name}`));continue}f.push({id:crypto.randomUUID(),file:P,url:URL.createObjectURL(P)})}f.length&&Ke(w=>[...w,...f])},jr=t=>Ke(r=>{const d=r.find(f=>f.id===t);return d&&URL.revokeObjectURL(d.url),r.filter(f=>f.id!==t)}),Oi=(t,r)=>Ke(d=>{const f=[...d],[w]=f.splice(t,1);return f.splice(r,0,w),f}),Wn=[n("Analyse du bien...","Analyse van het pand...","Analysing property..."),n("Enrichissement commune...","Verrijking gemeente...","Enriching municipality data..."),n("Rédaction IA en cours...","AI-redactie bezig...","AI writing in progress..."),n("Finalisation...","Afronden...","Finalising...")],kr=async(t=!1)=>{if(!g||!B){te.error(n("Adresse et prix requis","Adres en prijs vereist","Address and price required"));return}if(!i){te.error(n("Clé API manquante","API-sleutel ontbreekt","API key missing"));return}yt(!0),X(null),oe(null),it(Wn[0]);let r=0;const d=setInterval(()=>{r=Math.min(r+1,Wn.length-1),it(Wn[r])},2e3);try{const f={adresse:ct,type_bien:D,prix:Number(mt(B)),langue:ke,ton:Fe};
73t&&(f.regenerate=!0),_&&(f.code_ins=_),m&&(f.surface=Number(m)),b&&(f.chambres=Number(b)),U&&(f.sdb=Number(U)),z&&(f.peb=z),ne&&(f.etage=Number(ne)),ie&&(f.etat=ie),me&&(f.description_libre=me),Object.entries(pe).forEach(([O,V])=>{V&&(f[O]=!0)});const[w,P]=await Promise.all([fetch(`${lt}/generate-annonce`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify(f)}),_?fetch(`${lt}/commune?code_ins=${_}&view=full`,{headers:{"x-api-key":i}}):Promise.resolve(null)]);if(!w.ok){if(w.status===402){te.error(n("Crédits insuffisants. Rechargez votre compte.","Onvoldoende credits. Laad uw account op.","Insufficient credits. Top up your account."),{duration:5e3,action:{label:n("Recharger","Opladen","Top up"),onClick:()=>u("/pro/facturation")}}),yt(!1);return}throw new Error(`${n("Erreur","Fout","Error")} ${w.status}`)}const $=await w.json();X($.data),Mn(O=>({...O,[ke]:$.data})),gn(ke);let A=a||He,H=!1;if(!A)try{A=await Rr($.data),H=!!A}catch(O){console.error("[generate] création du dossier échouée",O),te.error(n("Annonce générée mais dossier non enregistré — réessayez la publication","Advertentie gegenereerd maar dossier niet opgeslagen","Listing generated but file not saved"))}if(A&&ke==="fr"&&!H)try{const O={...$.data.immoweb,social:$.data.social||null},V=await fetch(`${lt}/save-annonce`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify({bien_id:A,annonce:O,source:"ai"})});V.ok?($n("ai"),In(new Date().toISOString())):(console.error("[save-annonce] échec persistance",V.status),te.error(n("Annonce générée mais non enregistrée","Advertentie gegenereerd maar niet opgeslagen","Listing generated but not saved")))}catch(O){console.error("[save-annonce] erreur",O)}if(P!=null&&P.ok){const O=await P.json();oe(O.data)}te.success(n("Annonce générée !","Advertentie gegenereerd!","Listing generated!")),Si(),H&&A&&u(`/pro/annonce/${A}`,{replace:!0})}catch(f){te.error(f.message||n("Erreur","Fout","Error"))}finally{clearInterval(d),it(""),yt(!1)}},Li=async t=>{if(Jt[t]){gn(t),X(Jt[t]);return}if(!g||!B||!i){te.error(n("Génération initiale requise","Initiële generatie vereist","Initial generation required"));return}xr(t==="fr"?null:t);try{const r={adresse:ct,type_bien:D,prix:Number(mt(B)),langue:t,ton:Fe,regenerate:!0};_&&(r.code_ins=_),m&&(r.surface=Number(m)),b&&(r.chambres=Number(b)),U&&(r.sdb=Number(U)),z&&(r.peb=z),ne&&(r.etage=Number(ne)),ie&&(r.etat=ie),me&&(r.description_libre=me),Object.entries(pe).forEach(([w,P])=>{P&&(r[w]=!0)});const d=await fetch(`${lt}/generate-annonce`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify(r)});if(!d.ok)throw new Error(`${n("Erreur","Fout","Error")} ${d.status}`);const f=await d.json();Mn(w=>({...w,[t]:f.data})),gn(t),X(f.data),te.success(t==="nl"?"Vertaald naar Nederlands ✓":t==="en"?"Translated to English ✓":"Traduit ✓")}catch(r){te.error(r.message||n("Traduction échouée","Vertaling mislukt","Translation failed"))}finally{xr(null)}},Ni=async t=>{const d=new TextEncoder().encode(t+"arcanes-serve-2026"),f=await crypto.subtle.digest("SHA-256",d);return Array.from(new Uint8Array(f)).map(w=>w.toString(16).padStart(2,"0")).join("").slice(0,16)},Sr=async t=>{const r=await Ni(t),d=`/rapport?p=${encodeURIComponent(t)}&t=${r}`;window.open(d,"_blank")},Cr=async(t="report",r,d)=>{var P,$;if(!i){te.error(n("Clé API manquante","API-sleutel ontbreekt","API key missing"));return}const f=He||a;if(t==="report"&&!f){te.error(n("Publiez le bien avant de générer le rapport","Publiceer het pand voordat u het rapport genereert","Publish the property before generating the report"));return}if(await $r()){vt(!0);try{let A;if(t==="pitch"){let O=null;if(de.length>0){const _e=de[0];if(_e.url&&/^https?:\/\//.test(_e.url))O=_e.url;else if(_e.file&&_e.file.size>0){const ft=_e.file.name.split(".").pop()||"jpg",pt=`report-covers/${crypto.randomUUID()}.${ft}`,{error:Xt}=await ee.storage.from("public-assets").upload(pt,_e.file,{contentType:_e.file.type,upsert:!1});if(Xt)console.error("[report] cover upload failed:",Xt);else{const{data:qn}=ee.storage.from("public-assets").getPublicUrl(pt);O=(qn==null?void 0:qn.publicUrl)||null}}}const V=Object.entries(pe).filter(([,_e])=>_e).map(([_e])=>_e.charAt(0).toUpperCase()+_e.slice(1)).join(", "),Pe={bien:{adresse:ct,rue:g,cp:R,ville:N,type_bien:D,surface:m,chambres:b,sdb:U,peb:z,etage:ne,etat:ie,equipements:V,prix:mt(B)},estimation:J,cover_url:O,notes_agent:De,type:t,annonce:(S==null?void 0:S.immoweb)||{},bien_id:a||null,agence:{nom:(W==null?void 0:W.nom_agence)||"",agent:(W==null?void 0:W.nom_complet)||"",telephone:(W==null?void 0:W.telephone)||"",logo_url:(W==null?void 0:W.logo_url)||"",couleur_primaire:(W==null?void 0:W.couleur_primaire)||"#0F4C4C",couleur_secondaire:(W==null?void 0:W.couleur_secondaire)||"#D4AF37"}};Pe.debug=!1,r&&r!=="auto"&&(Pe.template_override=r);const{data:{session:$e}}=await ee.auth.getSession();if(!($e!=null&&$e.access_token)){te.error(n("Session expirée. Reconnectez-vous pour générer le rapport.","Sessie verlopen. Log opnieuw in om het rapport te genereren.","Session expired. Sign in again to generate the report.")),vt(!1);return}A=await fetch(`${lt}/generate-report`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i,Authorization:`Bearer ${$e.access_token}`},body:JSON.stringify(Pe)})}else{const O={bien_id:f,type:"report",lang:x,notes_agent:De,debug:!1};r&&(O.template_override=r),d&&(O.narrative=d),A=await fetch(`${lt}/generate-report-v2`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify(O)})}if(!A.ok){if(A.status===402){te.error(n("Crédits insuffisants pour le rapport.","Onvoldoende credits voor het rapport.","Insufficient credits for the report."),{duration:5e3,action:{label:n("Recharger","Opladen","Top up"),onClick:()=>u("/pro/facturation")}}),vt(!1);return}if(A.status===404&&t==="report"){te.error(n("Bien introuvable — republiez le bien puis réessayez","Pand niet gevonden — publiceer het opnieuw en probeer opnieuw","Property not found — republish it and try again")),vt(!1);return}throw new Error(`${n("Erreur","Fout","Error")} ${A.status}`)}const H=await A.json();if((P=H.data)!=null&&P.report_html){const O=H.data.report_html;if(t==="pitch"?(qt(O),Xn(!0)):(rn(O),er(!0)),t==="report"){const _e="reports/"+(He||a||crypto.randomUUID())+".html",ft=new Blob([O],{type:"text/html"});await ee.storage.from("public-assets").upload(_e,ft,{contentType:"text/html",upsert:!0});const{data:pt}=ee.storage.from("public-assets").getPublicUrl(_e);pt!=null&&pt.publicUrl&&wn(pt.publicUrl)}const V=(($=H.meta)==null?void 0:$.template_used)||null;V&&ci(V);const Pe=V?`${n("Rapport généré","Rapport gegenereerd","Report generated")} (template ${V})`:n("Rapport généré","Rapport gegenereerd","Report generated");if(te.success(Pe),t==="pitch"){const $e=window.open("","_blank");$e&&($e.document.write(O),$e.document.close())}else{const $e=He||a,{data:{user:_e}}=await ee.auth.getUser();
73if(_e&&$e){const ft=new Date().toISOString().replace(/[:.]/g,"-"),pt=`${_e.id}/${ft}-${$e}.html`,{error:Xt}=await ee.storage.from("rune-reports").upload(pt,new TextEncoder().encode(O),{contentType:"text/html; charset=utf-8",upsert:!0});Xt?(console.error("rune-reports upload failed:",Xt),te.error(n("Stockage rapport échoué","Opslag rapport mislukt","Report storage failed"))):(j(pt),await Sr(pt))}else te.error(n("Session ou bien manquant","Sessie of pand ontbreekt","Session or property missing"))}}else throw new Error(n("Rapport vide","Leeg rapport","Empty report"))}catch(A){const H=(A==null?void 0:A.message)||"";/\b400\b/.test(H)?te.error(n("Publiez d'abord le bien avant de générer le rapport.","Publiceer eerst het pand voordat u het rapport genereert.","Publish the property first before generating the report.")):te.error(H||n("Erreur rapport","Rapport fout","Report error"))}finally{vt(!1)}}},Wi=async t=>{if(t==="report"&&on){await Sr(on);return}const r=t==="pitch"?nn:yn;if(!r)return;const d=window.open("","_blank");d&&(d.document.write(r),d.document.close())},Ui=(t="report")=>{if(!He&&!a){te.error(n("Publiez d'abord le bien avant de générer le rapport.","Publiceer eerst het pand voordat u het rapport genereert.","Publish the property first before generating the report."));return}if(t==="pitch"){Cr(t);return}nr(t),ir("auto"),Er("auto")},Er=async t=>{var d,f,w,P;const r=He||a;if(!(!r||!i)){nr("report"),ir(t),ln(!0),Ft(!1),sr(!0),dn(null);try{const $={bien_id:r,type:"preview",lang:x,notes_agent:De};t&&t!=="auto"&&($.template_override=t);const A=await fetch(`${lt}/generate-report-v2`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify($)});if(!A.ok)throw new Error(String(A.status));const H=await A.json();if(!((d=H.data)!=null&&d.report_html))throw new Error("empty");dn(H.data.report_html),ai(((f=H.data)==null?void 0:f.narrative)||null),Cn(((w=H.meta)==null?void 0:w.intro_text)||""),di(((P=H.meta)==null?void 0:P.claude_intro)||"")}catch{te.error(n("Aperçu indisponible","Voorbeeld niet beschikbaar","Preview unavailable")),ln(!1)}finally{sr(!1)}}},qi=()=>{const t=Sn.current,r=t==null?void 0:t.contentDocument;if(!r||!r.body||r.querySelector(".arc-eye-btn"))return;const d=r.createElement("style");d.textContent=`
74      [data-toggle-id]{ position: relative !important; }
75      .arc-block-off{ opacity: 0.28; filter: grayscale(1); }
76      .arc-toggle-btn{ position:absolute; top:14px; right:14px; z-index:99999;
77        padding:8px 14px; border-radius:20px; border:none; cursor:pointer;
78        font:700 12px/1 'Outfit',system-ui,sans-serif; color:#fff;
79        background:#0F4C4C; box-shadow:0 2px 10px rgba(0,0,0,0.25); }
80      .arc-block-off .arc-toggle-btn{ background:#B8962E; }
81      .arc-off-badge{ position:absolute; top:14px; left:14px; z-index:99999;
82        display:none; padding:6px 12px; border-radius:20px;
83        background:#B8962E; color:#fff; font:700 12px/1 'Outfit',system-ui,sans-serif; }
84      .arc-block-off .arc-off-badge{ display:block; }
85    `,r.head.appendChild(d),r.querySelectorAll("[data-toggle-id]").forEach(w=>{const P=w.getAttribute("data-toggle-id");if(!P)return;const $=or[P]===!1;$&&w.classList.add("arc-block-off");const A=r.createElement("div");A.className="arc-off-badge",A.textContent=n("Masquée du rapport","Verborgen","Hidden from report"),w.appendChild(A);const H=r.createElement("button");H.className="arc-toggle-btn",H.type="button";const O=V=>V?n("Afficher","Tonen","Show"):n("Masquer","Verbergen","Hide");H.textContent=O($),H.addEventListener("click",V=>{V.preventDefault(),V.stopPropagation();const Pe=!w.classList.contains("arc-block-off");w.classList.toggle("arc-block-off",Pe),H.textContent=O(Pe),jn($e=>({...$e,[P]:!Pe}))}),w.appendChild(H)})},Hi=async()=>{if(dt)return;const t=He||a;if(t){const r={};for(const[d,f]of Object.entries(or))f===!1&&(r[d]=!1);try{await ee.from("biens_publies").update({report_blocks_override:r,updated_at:new Date().toISOString()}).eq("id",t),jn(r)}catch{}}ln(!1),dn(null),await Cr(ii,rr,si)},_r=t=>{var w;const r=(w=Sn.current)==null?void 0:w.contentDocument;if(!r)return!1;const d=r.querySelector("[data-intro]");if(!d)return!1;const f=P=>P.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return d.innerHTML=(t||"").split(`
86
87`).filter(Boolean).map(P=>`<p>${f(P.trim())}</p>`).join(""),!0},Ar=async t=>{const r=He||a;if(r){Gt(!0);try{await ee.from("biens_publies").update({report_intro_override:t,updated_at:new Date().toISOString()}).eq("id",r)}catch{te.error(n("Erreur lors de l'enregistrement","Fout bij opslaan","Save failed")),Gt(!1);return}if(t===null){if(En){_r(En),Cn(En),Gt(!1),Ft(!1);return}Gt(!1),Ft(!1),await Er(rr);return}_r(t),Cn(t),Gt(!1),Ft(!1)}},zr=async()=>{if(!i||!g||!B){te.error(n("Adresse et prix requis","Adres en prijs vereist","Address and price required"));return}dr(!0);try{const t=a||He;if(t){await Un(t);const{data:O,error:V}=await ee.rpc("bien_publish_page",{p_bien_id:t});if(V)throw new Error(V.message||n("Erreur publication","Publicatiefout","Publication error"));An(`https://arcanes.be/bien/${t}`),hr((O==null?void 0:O.published_at)||new Date().toISOString()),te.success(O!=null&&O.already?n("Page acheteur déjà en ligne","Koperspagina al online","Buyer page already online"):n("Page acheteur publiée !","Koperspagina gepubliceerd!","Buyer page published!"));return}let r=null;const d=de[0];if(d!=null&&d.file&&d.file.size>0){const O=d.file.name.split(".").pop()||"jpg",V=`report-covers/${crypto.randomUUID()}.${O}`,{error:Pe}=await ee.storage.from("public-assets").upload(V,d.file,{contentType:d.file.type,upsert:!0});if(Pe)console.error("[publish] cover upload failed",Pe);else{const{data:$e}=ee.storage.from("public-assets").getPublicUrl(V);$e!=null&&$e.publicUrl&&(r=$e.publicUrl)}}else d!=null&&d.url&&/^https?:\/\//.test(d.url)&&(r=d.url);const f=Object.entries(pe).filter(([,O])=>O).map(([O])=>O.charAt(0).toUpperCase()+O.slice(1)).join(", "),w={bien:{adresse:ct,rue:g,cp:R,ville:N,type_bien:D,surface:m,chambres:b,sdb:U,peb:z,etage:ne,etat:ie,equipements:f,prix:mt(B),description_libre:me,code_ins:_||void 0},estimation:J,cover_url:r,photo_urls:[],annonce:S!=null&&S.immoweb?{...S.immoweb,social:S.social||null}:null,owner:Ze||st||ht?{name:Ze,email:st,phone:ht}:null,agence:{nom:(W==null?void 0:W.nom_agence)||"",agent:(W==null?void 0:W.nom_complet)||"",telephone:(W==null?void 0:W.telephone)||"",logo_url:(W==null?void 0:W.logo_url)||"",couleur_primaire:(W==null?void 0:W.couleur_primaire)||"#0F4C4C",couleur_secondaire:(W==null?void 0:W.couleur_secondaire)||"#D4AF37"}},P=await fetch(`${lt}/publish-bien`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify(w)});if(!P.ok)throw new Error(`${n("Erreur","Fout","Error")} ${P.status}`);const $=await P.json(),A=$.data.id,H=[];for(let O=0;O<de.length;O++){const V=de[O];if((!V.file||V.file.size===0)&&V.url&&/^https?:\/\//.test(V.url)){H.push(V.url);continue}if(!V.file||V.file.size===0)continue;const Pe=V.file.name.split(".").pop()||"jpg",$e=`bien-photos/${A}/${O}.${Pe}`,{error:_e}=await ee.storage.from("public-assets").upload($e,V.file,{contentType:V.file.type,upsert:!0});if(_e){console.error("[publish] photo upload failed",O,_e);continue}const{data:ft}=ee.storage.from("public-assets").getPublicUrl($e);ft!=null&&ft.publicUrl&&H.push(ft.publicUrl)}if(H.length>0){const{error:O}=await ee.rpc("attach_bien_photos",{p_bien_id:A,p_urls:H});O&&console.error("[publish] attach failed",O)}An($.data.url),zn(A),te.success(n("Page acheteur publiée !","Koperspagina gepubliceerd!","Buyer page published!"))}catch(t){te.error(t.message||n("Erreur publication","Publicatiefout","Publication error"))}finally{dr(!1)}},Un=async t=>{const r=[];for(let d=0;d<de.length;d++){const f=de[d];if((!f.file||f.file.size===0)&&f.url&&/^https?:\/\//.test(f.url)){r.push(f.url);continue}if(!f.file||f.file.size===0)continue;const w=f.file.name.split(".").pop()||"jpg",P=`bien-photos/${t}/${d}.${w}`,{error:$}=await ee.storage.from("public-assets").upload(P,f.file,{contentType:f.file.type,upsert:!0});if(!$){const{data:A}=ee.storage.from("public-assets").getPublicUrl(P);A!=null&&A.publicUrl&&r.push(A.publicUrl)}}r.length>0&&await ee.rpc("attach_bien_photos",{p_bien_id:t,p_urls:r})},Rr=async t=>{var O;const r=a||He;if(r)return await Un(r),r;if(!i||!g||!B)return te.error(n("Adresse et prix requis pour corriger les photos","Adres en prijs vereist","Address and price required")),null;let d=null;const f=de[0];if(f!=null&&f.file&&f.file.size>0){const V=f.file.name.split(".").pop()||"jpg",Pe=`report-covers/${crypto.randomUUID()}.${V}`,{error:$e}=await ee.storage.from("public-assets").upload(Pe,f.file,{contentType:f.file.type,upsert:!0});if(!$e){const{data:_e}=ee.storage.from("public-assets").getPublicUrl(Pe);_e!=null&&_e.publicUrl&&(d=_e.publicUrl)}}else f!=null&&f.url&&/^https?:\/\//.test(f.url)&&(d=f.url);const w=Object.entries(pe).filter(([,V])=>V).map(([V])=>V.charAt(0).toUpperCase()+V.slice(1)).join(", "),P={bien:{adresse:ct,rue:g,cp:R,ville:N,type_bien:D,surface:m,chambres:b,sdb:U,peb:z,etage:ne,etat:ie,equipements:w,prix:mt(B),description_libre:me,code_ins:_||void 0},estimation:J,cover_url:d,photo_urls:[],annonce:(O=t??S)!=null&&O.immoweb?{...(t??S).immoweb,social:(t??S).social||null}:null,owner:Ze||st||ht?{name:Ze,email:st,phone:ht}:null,agence:{nom:(W==null?void 0:W.nom_agence)||"",agent:(W==null?void 0:W.nom_complet)||"",telephone:(W==null?void 0:W.telephone)||"",logo_url:(W==null?void 0:W.logo_url)||"",couleur_primaire:(W==null?void 0:W.couleur_primaire)||"#0F4C4C",couleur_secondaire:(W==null?void 0:W.couleur_secondaire)||"#D4AF37"},publish:!1},$=await fetch(`${lt}/publish-bien`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify(P)});if(!$.ok)throw new Error(`${n("Erreur","Fout","Error")} ${$.status}`);const H=(await $.json()).data.id;return await Un(H),zn(H),H},Gi=async t=>{const r=a||He;if(!r)return te.error(n("Publiez le bien avant d'enregistrer une annonce personnalisée","Publiceer het pand voordat u een aangepaste advertentie opslaat","Publish the property before saving a custom listing")),!1;if(!i||!(S!=null&&S.immoweb))return!1;try{const d={...S.immoweb,description:t,social:S.social||null};return(await fetch(`${lt}/save-annonce`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify({bien_id:r,annonce:d,source:"custom"})})).ok?(X(w=>({...w,immoweb:{...w.immoweb,description:t}})),$n("custom"),In(new Date().toISOString()),te.success(n("Annonce enregistrée","Advertentie opgeslagen","Listing saved")),!0):(te.error(n("Échec de l'enregistrement","Opslaan mislukt","Save failed")),!1)}catch(d){return te.error((d==null?void 0:d.message)||n("Erreur","Fout","Error")),!1}},$r=async()=>{const t=a||He;if(!t)return!1;cr(!0);try{const r=[];for(const $ of de)if($.file&&$.file.size>0){const A=$.file.name.split(".").pop()||"jpg",H=`bien-photos/${t}/${crypto.randomUUID()}.${A}`,{error:O}=await ee.storage.from("public-assets").upload(H,$.file,{contentType:$.file.type,upsert:!0});if(O)return console.error("[save] photo upload failed",O),te.error(n("Échec upload photo","Foto-upload mislukt","Photo upload failed")),!1;const{data:V}=ee.storage.from("public-assets").getPublicUrl(H);if(!(V!=null&&V.publicUrl))return te.error(n("Échec upload photo","Foto-upload mislukt","Photo upload failed")),!1;r.push(V.publicUrl)}else $.url&&/^https?:\/\//.test($.url)&&r.push($.url);const d=r[0]??null,f=Object.entries(pe).filter(([,$])=>$).map(([$])=>$.charAt(0).toUpperCase()+$.slice(1)).join(", "),w={adresse:ct,rue:g,cp:R,ville:N,type_bien:D,surface:m,chambres:b,sdb:U,peb:z,etage:ne,etat:ie,equipements:f,prix:mt(B),description_libre:me,code_ins:_||void 0}
87,P=await fetch(`${lt}/update-bien`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":i},body:JSON.stringify({bien_id:t,bien:w,photo_urls:r,cover_url:d})});if(!P.ok){let $=`${n("Erreur","Fout","Error")} ${P.status}`;try{const A=await P.json();(A!=null&&A.error||A!=null&&A.message)&&($=A.error||A.message)}catch{}return te.error($),!1}return te.success(n("Modifications enregistrées","Wijzigingen opgeslagen","Changes saved")),gr(new Date().toISOString()),Ke(r.map(($,A)=>({id:`saved-${A}`,file:new File([],`photo-${A}.jpg`),url:$}))),!0}catch(r){return te.error((r==null?void 0:r.message)||n("Erreur sauvegarde","Opslagfout","Save error")),!1}finally{cr(!1)}},Vi=()=>{var t;mo({bien:{adresse:g,cp:R,ville:N,type_bien:D,surface:m,chambres:b,sdb:U,peb:z,etat:ie,equips:pe,prix:mt(B)},photos:de.map(r=>r.url),publishedUrl:Et||void 0,priceHistory:ye,revenuHistory:ot,menagesHistory:sn,estimation:J,commune:Z,annonce:S!=null&&S.immoweb?{...S.immoweb,caption:(t=S.social)==null?void 0:t.caption}:void 0,agence:W?{nom:W.nom_agence,agent:W.nom_complet,telephone:W.telephone||void 0,logo_url:W.logo_url||void 0,couleur_primaire:W.couleur_primaire||"#0F4C4C",couleur_secondaire:W.couleur_secondaire||"#D4AF37"}:void 0})},Je=({children:t})=>e.jsx("label",{style:{fontSize:"9px",fontWeight:700,color:"rgba(15,76,76,0.4)",textTransform:"uppercase",letterSpacing:"1px",marginBottom:"4px",display:"block"},children:t}),At=({children:t})=>e.jsx("div",{style:{fontFamily:"'DM Serif Display', serif",fontSize:"16px",color:y.teal,marginBottom:"2px"},children:t}),zt={background:"white",borderRadius:"14px",border:`1px solid ${y.border}`,padding:"16px",display:"flex",flexDirection:"column",gap:"12px"},Qe=(()=>{const t=[{label:n("Adresse complète","Volledig adres","Full address"),weight:12,ok:!!(g&&R&&N)},{label:n("Type, surface, chambres","Type, opp., kamers","Type, area, rooms"),weight:14,ok:!!(D&&m&&b)},{label:n("PEB renseigné","EPC ingevuld","EPC set"),weight:8,ok:!!z,hint:n("Le PEB est obligatoire pour publier en BE","EPC is verplicht in BE","EPC required in BE")},{label:n("Prix demandé","Vraagprijs","Asking price"),weight:10,ok:!!B&&Number(B)>0},{label:n("Au moins 3 photos","Min. 3 foto's","At least 3 photos"),weight:18,ok:de.length>=3,hint:n("Une cover + 2 photos = base minimum","Een cover + 2 foto's = minimum","1 cover + 2 photos = minimum")},{label:n("Brief de rédaction","Redactiebriefing","Writing brief"),weight:8,ok:me.trim().length>=20,hint:n("Donnez quelques détails à l'IA pour une annonce personnalisée","Geef de AI wat details voor een persoonlijke advertentie","Give the AI some details for a personalized listing")},{label:n("Email propriétaire","Eigenaar e-mail","Owner email"),weight:12,ok:!!st&&/\S+@\S+/.test(st),hint:n("Requis pour la séquence email vendeur","Vereist voor verkopersreeks","Required for owner email sequence")},{label:n("Équipement(s) coché(s)","Voorzieningen aangevinkt","Amenities ticked"),weight:8,ok:Object.values(pe).some(Boolean)},{label:n("État du bien","Staat van het pand","Property condition"),weight:5,ok:!!ie},{label:n("Étage / façades","Verdieping / gevels","Floor / facades"),weight:5,ok:!!(ne||fe)}],r=t.reduce((f,w)=>f+(w.ok?w.weight:0),0),d=t.filter(f=>!f.ok);return{score:r,checks:t,missing:d}})(),Qi={terrasse:n("Terrasse","Terras","Terrace"),jardin:n("Jardin","Tuin","Garden"),garage:"Garage",cave:n("Cave","Kelder","Cellar"),parking:"Parking",ascenseur:n("Ascenseur","Lift","Elevator"),lumineux:n("Lumineux","Licht","Bright"),calme:n("Calme","Rustig","Quiet"),piscine:n("Piscine","Zwembad","Pool")};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{minHeight:"100vh",background:y.cream,fontFamily:"'Outfit', sans-serif"},children:[e.jsx(ao,{title:a?n("Modifier le bien | Pro | Arcanes","Pand bewerken | Pro | Arcanes","Edit property | Pro | Arcanes"):n("Nouveau bien | Pro | Arcanes","Nieuw pand | Pro | Arcanes","New property | Pro | Arcanes"),description:n("Préparez votre  dossier de vente.","Bereid uw verkoopdossier voor.","Prepare your sales file."),noIndex:!0}),e.jsx(fo,{}),e.jsx("style",{children:`
88        .pro-wrap { padding-top: var(--pro-header-h, 72px); position: relative; }
89        .pro-retour { position: relative; z-index: 20; padding: 12px 24px 16px; margin-bottom: 0; }
90        .pro-retour button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 8px; background: rgba(255,255,255,0.9); border: 1px solid rgba(15,76,76,0.08); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: rgba(15,76,76,0.45); font-size: 11px; font-weight: 600; cursor: pointer; font-family: 'Outfit', sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,0.04); transition: all 0.15s; }
91        .pro-retour button:hover { background: white; color: #0F4C4C; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
92
93        /* Session 6 : animation pulse pour stat highlight (leads chauds, callbacks) */
94        @keyframes pulseStat {
95          0%, 100% { opacity: 1; transform: scale(1); }
96          50% { opacity: 0.55; transform: scale(1.15); }
97        }
98
99        /* Mobile : condenser drastiquement le header pour gagner du scroll */
100        @media (max-width: 767px) {
101          .pa-grid { display: flex !important; flex-direction: column !important; }
102          .pa-results { order: -1 !important; }
103          .pa-form-toggle { display: flex !important; }
104          .pa-form-body.pa-collapsed { display: none !important; }
105
106          /* Refactor 5 : header mobile compact (mais bouton retour visible) */
107          .pa-hero-section { padding-top: 24px !important; padding-bottom: 4px !important; }
108          .pa-hero-ornament { display: none !important; }
109          .pa-hero-eyebrow { display: none !important; }
110          .pa-hero-subtitle { display: none !important; }
111          .pa-hero-title { font-size: 20px !important; line-height: 1.2 !important; margin-bottom: 4px !important; margin-top: 8px !important; }
112          .pa-hero-title br { display: none; }
113          .pa-hero-title span { display: inline; margin-left: 4px; }
114          /* Garder le bouton retour accessible sur mobile, sans surplomber le titre */
115          .pro-retour { padding: 6px 16px 8px !important; margin-bottom: 0 !important; position: relative !important; }
116          .pro-retour button { font-size: 11px; padding: 6px 10px; }
117
118          /* Session 6 — Header business mobile : 1 colonne (photo dessus, infos dessous) */
119          .pa-business-header {
120            grid-template-columns: 1fr !important;
121            gap: 12px !important;
122          }
123          .pa-business-photo {
124            aspect-ratio: 16/9 !important;
125            min-height: 160px !important;
126          }
127          .pa-stats-row {
128            gap: 10px !important;
129            padding: 8px 10px !important;
130          }
131        }
132
133        /* ═══ Refonte desktop : workspace 2 colonnes (rail bien sticky | zone de travail) ═══ */
134        @media (min-width: 980px) {
135          .pa-workspace {
136            display: grid;
137            grid-template-columns: 360px minmax(0, 1fr);
138            gap: 28px;
139            align-items: start;
140            max-width: 1240px;
141            margin: 0 auto;
142            padding: 24px 24px 0;
143          }
144          /* Rail gauche = résumé du bien, reste visible pendant le travail */
145          /* Rail gauche = carte résumé du bien, sticky. Padding uniforme => photo et blocs partagent la MÊME boîte (alignement garanti par construction) */
146          .pa-workspace .pa-hero-section {
147            /* Pas de sticky : la carte enrichie (specs + estimation) dépassait
148               la hauteur utile → décalage de 76px en haut et chevauchement du
149               footer en bas. En flux normal, elle s'aligne avec la colonne de
150               droite et ne déborde jamais.
151               margin: 0 neutralise le margin 80px que le CSS global (index.css)
152               applique à toute balise <section>. */
153            align-self: start;
154            margin: 0 !important;
155            padding: 16px !important;
156            overflow: visible !important;
157            background: #fff !important;
158            border: 1px solid rgba(15,76,76,0.10);
159            border-radius: 16px;
160          }
161          .pa-workspace .pa-hero-ornament { display: none !important; }
162          .pa-workspace .pa-hero-section > div { padding-left: 0 !important; padding-right: 0 !important; }
163          /* Header en blocs empilés pleine largeur (fin du hack grille 1fr/1.4fr forcée) */
164          .pa-workspace .pa-business-header {
165            display: block !important;
166            margin-bottom: 0 !important;
167          }
168          .pa-workspace .pa-business-header > div { width: 100% !important; max-width: none !important; }
169          .pa-workspace .pa-business-photo { margin-bottom: 14px !important; }
170          .pa-workspace .pa-business-img { object-fit: cover !important; }
171          .pa-workspace .pa-hero-title { font-size: 22px !important; line-height: 1.25 !important; }
172          .pa-workspace .pa-hero-title br { display: none !important; }
173          /* Zone de travail droite : occupe la largeur restante, plus de centrage 1100px */
174          .pa-workspace .pa-workarea {
175            max-width: none !important;
176            margin: 0 !important;
177            min-width: 0;
178            padding-left: 0 !important;
179            padding-right: 0 !important;
180          }
181        }
182
183        @keyframes spin { to { transform: rotate(360deg); } }
184      `}),e.jsx("div",{className:"pro-wrap",children:e.jsxs("div",{className:"pa-workspace",children:[e.jsxs("section",{className:"pa-hero-section",style:{background:y.cream,paddingTop:"20px",paddingBottom:"0",position:"relative",overflow:"hidden"},children:[e.jsx("div",{"aria-hidden":"true",className:"pa-hero-ornament",style:{position:"absolute",inset:0,backgroundImage:"radial-gradient(circle, rgba(15,76,76,0.05) 1px, transparent 1px)",backgroundSize:"42px 42px",pointerEvents:"none",maskImage:"radial-gradient(ellipse 60% 60% at 50% 0%, black 0%, transparent 100%)",WebkitMaskImage:"radial-gradient(ellipse 60% 60% at 50% 0%, black 0%, transparent 100%)"}}),e.jsxs("div",{style:{maxWidth:"1100px",margin:"0 auto",padding:"0 16px",position:"relative"},children:[!a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pa-hero-eyebrow",style:{display:"inline-flex",alignItems:"center",gap:"10px",marginBottom:"10px"},children:[e.jsx("span",{style:{display:"block",width:"32px",height:"2px",background:y.gold,borderRadius:"2px"}}),e.jsx("span",{style:{fontSize:"10px",fontWeight:700,letterSpacing:"2.5px",textTransform:"uppercase",color:"#B8962E"},children:n("Nouveau dossier de vente","Nieuw verkoopdossier","New sales file")}),e.jsx("span",{style:{display:"block",width:"32px",height:"2px",background:y.gold,borderRadius:"2px"}})]}),e.jsxs("h1",{className:"pa-hero-title",style:{fontFamily:"'Outfit', sans-serif",fontSize:"clamp(26px, 4vw, 32px)",fontWeight:800,lineHeight:1.1,letterSpacing:"-1px",color:"#0D1109",marginBottom:"8px"},children:[n("Préparez votre ","Bereid uw ","Prepare your "),e.jsx("br",{}),e.jsx("span",{style:{color:y.teal},children:n("dossier de vente.","verkoopdossier.","sales file.")})]}),e.jsx("p",{className:"pa-hero-subtitle",style:{fontSize:"14px",color:"#7A7670",lineHeight:1.6,maxWidth:"520px",marginBottom:"16
184px"},children:n("Remplissez les caractéristiques. Arcanes génère votre annonce, votre page acheteur, votre rapport prospection — en quelques secondes.","Vul de kenmerken in. Arcanes genereert uw advertentie, uw koperspagina en uw prospectierapport — in enkele seconden.","Fill in the characteristics. Arcanes generates your listing, buyer page and prospecting report — in seconds.")})]}),a&&e.jsx(Ho,{bienId:a,label:_t||ct,address:ct,coverUrl:((Ir=de[0])==null?void 0:Ir.url)||null,photosCount:de.length,prix:Number(mt(B))||null,status:cn,publishedAt:ur,soldAt:un,facts:{surface:m,chambres:b,sdb:U,etage:ne,peb:z},estimation:J?{low:J.fourchette_basse_total??null,high:J.fourchette_haute_total??null,point:J.prix_total_estime??null}:null,owner:Ze||ht||st?{name:Ze,phone:ht,email:st}:null,metrics:cn==="prospection"?hn.length>0?[{key:"reports",icon:"file",value:hn.length,label:hn.length>1?n("rapports générés","rapporten gegenereerd","reports generated"):n("rapport généré","rapport gegenereerd","report generated")}]:[]:gt?[{key:"views",icon:"eye",value:gt.view_count,label:n("vues","weergaven","views")},{key:"leads",icon:"inbox",tone:"gold",value:gt.total_leads,label:n("contacts","contacten","contacts")},{key:"dossiers",icon:"file",value:gt.dossier_views,label:n("dossiers consultés","dossiers bekeken","files viewed")}]:[],callbacks:(gt==null?void 0:gt.callbacks)||0,hotLeads:(gt==null?void 0:gt.hot_leads)||0,publishedUrl:Et,onEdit:()=>Yt(!0),onCallback:zi,onMarkSold:()=>{Pn(new Date().toISOString().split("T")[0]),Qt(!0)},onRelist:fr,onRunePrompt:Ai})]})]}),e.jsxs("main",{className:"pa-workarea",style:{maxWidth:"1100px",margin:"0 auto",padding:"0 16px 60px"},children:[a&&cn==="vendu"&&un&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",margin:"12px 0 16px",padding:"10px 16px",borderRadius:"10px",background:"rgba(212,175,55,0.06)",border:"1px solid rgba(212,175,55,0.18)"},children:[e.jsx(en,{style:{width:14,height:14,color:"#B88A2E",flexShrink:0}}),e.jsxs("span",{style:{fontSize:"12px",color:"#B88A2E",fontWeight:600},children:[n("Vendu le","Verkocht op","Sold on")," ",new Date(un).toLocaleDateString(x==="nl"?"nl-BE":x==="en"?"en-GB":"fr-BE",{day:"numeric",month:"long",year:"numeric"})]})]}),!1,e.jsxs("div",{className:"pa-grid",style:{display:"grid",gridTemplateColumns:S?"minmax(0, 1fr)":"minmax(0, 520px)",gap:0,alignItems:"start",justifyContent:S?void 0:"center"},children:[S&&Mt&&e.jsx("div",{onClick:()=>Yt(!1),style:{position:"fixed",top:"var(--pro-header-h, 72px)",left:0,right:0,bottom:0,background:"rgba(13,17,9,0.32)",backdropFilter:"blur(2px)",zIndex:1089}}),e.jsxs("div",{className:"pa-form",style:S?{position:"fixed",top:"var(--pro-header-h, 72px)",left:0,bottom:0,width:"min(460px, 92vw)",background:y.cream,zIndex:1090,boxShadow:Mt?"4px 0 32px rgba(13,17,9,0.18)":"none",borderRight:`1px solid ${y.border}`,overflowY:"auto",padding:"18px 18px 32px",transform:Mt?"translateX(0)":"translateX(-100%)",transition:"transform 0.32s cubic-bezier(0.4, 0, 0.2, 1)",minWidth:0}:{minWidth:0},children:[S&&Mt&&e.jsx("button",{className:"pa-form-toggle",onClick:()=>Yt(!1),style:{display:"block",width:"100%",padding:"12px 14px",borderRadius:"12px",border:`1px solid ${y.border}`,background:"white",cursor:"pointer",fontFamily:"'Outfit', sans-serif",textAlign:"left",marginBottom:"12px"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"12px",fontWeight:700,color:y.teal},children:g?`${g}, ${R} ${N}`:n("Modifier le bien","Pand bewerken","Edit property")}),e.jsxs("div",{style:{fontSize:"10px",color:y.muted,marginTop:"1px"},children:[D," · ",m,"m² · ",b,n("ch","slk","bed")," · ",B?`${Number(B).toLocaleString("fr-BE")} €`:""]})]}),e.jsx("span",{style:{fontSize:"16px",color:y.muted,fontWeight:700,lineHeight:1},"aria-label":n("Fermer","Sluiten","Close"),children:"✕"})]})}),e.jsxs("div",{className:`pa-form-body ${!Mt&&S?"pa-collapsed":""}`,style:{display:!Mt&&S?"none":"flex",flexDirection:"column",gap:"14px"},children:[!a&&mr&&e.jsxs("div",{style:{display:"inline-flex",alignSelf:"flex-start",alignItems:"center",gap:"6px",padding:"4px 10px",background:"rgba(16,185,129,0.08)",border:"1px solid rgba(16,185,129,0.2)",borderRadius:"999px",fontSize:"10px",color:"#059669",fontWeight:600,fontFamily:"'Outfit', sans-serif"},children:[e.jsx(en,{style:{width:11,height:11}}),n("Brouillon enregistré","Concept opgeslagen","Draft saved")," ·"," ",mr.toLocaleTimeString(x==="nl"?"nl-BE":x==="en"?"en-GB":"fr-BE",{hour:"2-digit",minute:"2-digit"})]}),e.jsxs("div",{style:{background:Qe.score>=90?"rgba(16,185,129,0.06)":Qe.score>=60?"rgba(212,175,55,0.06)":"white",borderRadius:"14px",border:`1px solid ${Qe.score>=90?"rgba(16,185,129,0.25)":Qe.score>=60?"rgba(212,175,55,0.25)":y.border}`,padding:"14px 16px",display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:700,letterSpacing:"1.2px",textTransform:"uppercase",color:y.muted,marginBottom:"2px"},children:n("Qualité du dossier","Dossierkwaliteit","File quality")}
184),e.jsx("div",{style:{fontSize:"14px",fontWeight:700,color:y.teal},children:Qe.score>=90?n("Prêt à publier","Klaar om te publiceren","Ready to publish"):Qe.score>=60?n("Bonne base — quelques manques","Goede basis — enkele ontbrekende elementen","Good base — a few items missing"):n("À compléter pour optimiser","Aanvullen om te optimaliseren","Complete to optimize")})]}),e.jsxs("div",{style:{fontSize:"26px",fontWeight:800,color:Qe.score>=90?"#10b981":Qe.score>=60?y.gold:y.muted,fontFamily:"'Outfit', sans-serif",lineHeight:1,fontVariantNumeric:"tabular-nums"},children:[Qe.score,e.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:y.muted,marginLeft:"2px"},children:"/ 100"})]})]}),e.jsx("div",{style:{height:"5px",background:"rgba(15,76,76,0.06)",borderRadius:"999px",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${Qe.score}%`,background:Qe.score>=90?"linear-gradient(90deg, #10b981 0%, #059669 100%)":Qe.score>=60?`linear-gradient(90deg, ${y.gold} 0%, ${y.goldDark} 100%)`:`linear-gradient(90deg, ${y.muted} 0%, #6b7280 100%)`,borderRadius:"999px",transition:"width 0.4s ease"}})}),Qe.missing.length>0&&Qe.missing.length<=6&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"5px"},children:[Qe.missing.slice(0,3).map((t,r)=>e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"6px",fontSize:"11px",color:"#7A7670",lineHeight:1.4},children:[e.jsxs("span",{style:{display:"inline-flex",flexShrink:0,width:"14px",height:"14px",alignItems:"center",justifyContent:"center",background:"rgba(212,175,55,0.12)",color:"#B88A2E",borderRadius:"4px",fontSize:"9px",fontWeight:800,marginTop:"1px"},children:["+",t.weight]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:y.teal,fontWeight:600},children:t.label}),t.hint&&e.jsxs("span",{style:{color:y.muted},children:[" — ",t.hint]})]})]},r)),Qe.missing.length>3&&e.jsxs("div",{style:{fontSize:"11px",color:y.muted,fontStyle:"italic"},children:["+ ",Qe.missing.length-3," ",n("autres améliorations possibles","andere verbeteringen mogelijk","other improvements possible")]})]})]}),e.jsxs("div",{style:zt,children:[e.jsx(At,{children:n("Adresse","Adres","Address")}),e.jsxs("div",{style:{position:"relative"},ref:Ee,children:[e.jsx(Je,{children:n("Rue et numéro","Straat en nummer","Street and number")}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("input",{value:g,onChange:t=>Ii(t.target.value),placeholder:"Rue Jenner 6",disabled:!!a,style:{...et,opacity:a?.6:1,cursor:a?"not-allowed":"text"}}),ge&&e.jsx(bt,{style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",width:12,height:12,color:y.gold,animation:"spin 1s linear infinite"}})]}),v&&qe.length>0&&e.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:50,marginTop:"4px",background:"white",borderRadius:"10px",border:`1px solid ${y.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",overflow:"hidden"},children:qe.map((t,r)=>e.jsxs("button",{onClick:()=>Pi(t),style:{width:"100%",padding:"8px 12px",background:"transparent",border:"none",borderBottom:r<qe.length-1?"1px solid #f0f0f0":"none",cursor:"pointer",textAlign:"left",fontSize:"12px",color:y.text,fontFamily:"'Outfit', sans-serif",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx(Yn,{style:{width:10,height:10,color:y.muted,flexShrink:0}}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.display_name})]},r))})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"90px 1fr",gap:"8px"},children:[e.jsxs("div",{children:[e.jsx(Je,{children:n("CP","Postcode","Zip")}),e.jsx("input",{value:R,onChange:t=>{F(t.target.value);const r=p(t.target.value+" "+N);r&&Y(r)},placeholder:"1050",maxLength:4,disabled:!!a,style:{...et,opacity:a?.6:1,cursor:a?"not-allowed":"text"}})]}),e.jsxs("div",{children:[e.jsx(Je,{children:n("Ville","Stad","City")}),e.jsx("input",{value:N,onChange:t=>{I(t.target.value);const r=p(R+" "+t.target.value);r&&Y(r)},placeholder:"Ixelles",disabled:!!a,style:{...et,opacity:a?.6:1,cursor:a?"not-allowed":"text"}})]})]}),a&&e.jsx("span",{style:{fontSize:"10px",color:y.muted},children:n("Adresse non modifiable","Adres niet wijzigbaar","Address not editable")}),_&&e.jsxs("span",{style:{fontSize:"10px",color:"#22c55e"},children:["✓ ",n("Commune détectée","Gemeente gedetecteerd","Municipality detected")]})]}),e.jsxs("div",{style:zt,children:[e.jsx(At,{children:n("Caractéristiques","Kenmerken","Features")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[e.jsxs("div",{children:[e.jsx(Je,{children:"Type"}),e.jsxs("select",{value:D,onChange:t=>ce(t.target.value),style:{...et,cursor:"pointer"},children:[e.jsx("option",{value:"appartement",children:n("Appartement","Appartement","Apartment")}),e.jsx("option",{value:"maison",children:n("Maison","Woning","House")}),e.jsx("option",{value:"immeuble",children:n("Immeuble","Gebouw","Building")}),e.jsx("option",{value:"terrain",children:n("Terrain","Grond","Land")})]})]}),e.jsxs("div",{children:[e.jsx(Je,{children:n("État","Staat","Condition")}),e.jsxs("select",{value:ie,onChange:t=>ze(t.target.value),style:{...et,cursor:"pointer"},children:[e.jsx("option",{value:"",children:"—"}),e.jsx("option",{value:"neuf",children:n("Neuf","Nieuw","New")}),e.jsx("option",{value:"excellent",children:n("Excellent","Uitstekend","Excellent")}),e.jsx("option",{value:"bon etat",children:n("Bon état","Goede staat","Good condition")}),e.jsx("option",{value:"a rafraichir",children:n("À rafraîchir","Op te frissen","Needs refreshing")}),e.jsx("option",{value:"a renover",children:n("À rénover","Te renoveren","To renovate")})]})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:"6px"},children:[{v:m,s:re,l:"m²",p:"85"},{v:b,s:se,l:n("Ch.","Slk.","Bed."),p:"2"},{v:U,s:ae,l:n("SDB","Badk.","Bath."),p:"1"},{v:ne,s:Me,l:n("Étage","Verd.","Floor"),p:"3"}].map(t=>e.jsxs("div",{children:[e.jsx(Je,{children:t.l}),e.jsx("input",{type:"number",value:t.v,onChange:r=>t.s(r.target.value),placeholder:t.p,style:et})]},t.l))}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"8px",marginTop:"4px"},children:[e.jsxs("div",{children:[e.jsx(Je,{children:n("Terrain m²","Grond m²","Land m²")}
184),e.jsx("input",{type:"number",value:he,onChange:t=>Ie(t.target.value),placeholder:"450",style:et})]}),e.jsxs("div",{children:[e.jsx(Je,{children:n("Façades","Gevels","Facades")}),e.jsxs("select",{value:fe,onChange:t=>Ge(t.target.value),style:{...et,cursor:"pointer"},children:[e.jsx("option",{value:"",children:"—"}),e.jsx("option",{value:"2",children:n("2 (mitoyenne)","2 (rijwoning)","2 (terraced)")}),e.jsx("option",{value:"3",children:n("3 façades","3 gevels","3 facades")}),e.jsx("option",{value:"4",children:n("4 façades (villa)","4 gevels (villa)","4 facades (villa)")})]})]}),e.jsxs("div",{children:[e.jsx(Je,{children:n("Année","Bouwjaar","Year")}),e.jsx("input",{type:"number",value:ve,onChange:t=>Ue(t.target.value),placeholder:"1985",min:1800,max:new Date().getFullYear()+5,style:et})]})]}),e.jsxs("div",{children:[e.jsx(Je,{children:"PEB / EPC"}),e.jsx("div",{style:{display:"flex",gap:"4px"},children:["A","B","C","D","E","F","G"].map(t=>e.jsx("button",{onClick:()=>le(z===t?"":t),style:{width:"32px",height:"30px",borderRadius:"6px",border:z===t?`2px solid ${y.teal}`:`1px solid ${y.border}`,background:z===t?"rgba(15,76,76,0.08)":"white",color:z===t?y.teal:y.muted,fontSize:"11px",fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif"},children:t},t))})]})]}),e.jsxs("div",{style:zt,children:[e.jsx(At,{children:n("Équipements","Voorzieningen","Amenities")}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Object.keys(pe).map(t=>e.jsx("button",{onClick:()=>tt(t),style:{padding:"6px 12px",borderRadius:"20px",fontSize:"11px",fontWeight:600,cursor:"pointer",border:"none",fontFamily:"'Outfit', sans-serif",background:pe[t]?y.gold:"#EFECE7",color:pe[t]?"white":"#8A8580",transition:"all 0.15s"},children:Qi[t]||t},t))})]}),e.jsxs("div",{style:zt,children:[e.jsx(At,{children:n("Prix","Prijs","Price")}),e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(Je,{children:n("Prix demandé","Vraagprijs","Asking price")}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("input",{value:is(B),onChange:t=>G(mt(t.target.value)),placeholder:"285 000",style:{...et,paddingRight:"28px"}}),e.jsx("span",{style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",fontSize:"12px",color:y.muted},children:"€"})]})]}),e.jsxs("button",{onClick:Fi,disabled:Te||!fn,style:{height:"38px",padding:"0 14px",borderRadius:"8px",border:"none",background:fn?y.gold:y.border,color:"white",fontSize:"11px",fontWeight:700,cursor:fn?"pointer":"not-allowed",display:"flex",alignItems:"center",gap:"4px",fontFamily:"'Outfit', sans-serif",opacity:fn?1:.5,whiteSpace:"nowrap"},children:[Te?e.jsx(bt,{style:{width:12,height:12,animation:"spin 1s linear infinite"}}):e.jsx(wt,{style:{width:12,height:12}})," ",n("Estimer","Schatten","Estimate")]})]}),J&&e.jsxs("div",{style:{padding:"12px 14px",borderRadius:"10px",background:"rgba(212,175,55,0.04)",border:"1px solid rgba(212,175,55,0.2)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1px"},children:[e.jsx("span",{style:{fontSize:"9px",fontWeight:800,color:y.gold,textTransform:"uppercase",letterSpacing:"0.5px"},children:n("Repère marché","Marktreferentie","Market reference")}),e.jsx("span",{style:{fontSize:"9px",color:y.muted,fontWeight:500},children:n("Médiane Statbel + coefficient commune. Indicatif.","Statbel mediaan + gemeentecoëfficiënt. Indicatief.","Statbel median + commune coefficient. Indicative.")})]}),e.jsx("button",{onClick:()=>Ne(null),style:{background:"none",border:"none",cursor:"pointer",padding:"2px"},children:e.jsx(Rt,{style:{width:10,height:10,color:y.muted}})})]}),e.jsxs("div",{style:{fontSize:"18px",fontWeight:800,color:y.teal},children:[J.prix_total_estime.toLocaleString("fr-BE")," €"," ",e.jsxs("span",{style:{fontSize:"10px",color:y.muted,fontWeight:500},children:["(",J.prix_m2_estime.toLocaleString("fr-BE")," €/m²)"]})]}),e.jsxs("div",{style:{fontSize:"10px",color:"#666",marginTop:"2px"},children:[n("Fourchette","Vork","Range")," :"," ",J.fourchette_basse_total.toLocaleStr
184ing("fr-BE")," € —"," ",J.fourchette_haute_total.toLocaleString("fr-BE")," €"]}),e.jsxs("details",{style:{marginTop:"8px"},children:[e.jsx("summary",{style:{fontSize:"10px",color:y.muted,fontWeight:600,cursor:"pointer",userSelect:"none",padding:"4px 0"},children:n("Détail du calcul","Berekeningsdetails","Calculation details")}),e.jsx("div",{style:{marginTop:"6px",padding:"8px 10px",background:"white",borderRadius:"6px",border:`1px solid ${y.border}`,fontSize:"10px",color:"#444",lineHeight:1.7,fontFamily:"'Outfit', sans-serif"},children:(()=>{const t=J.facteurs,r=w=>Number.isFinite(w)?w>=.995&&w<=1.005?"×1.00":`×${w.toFixed(2)}`:"×1.00",d=w=>Number.isFinite(w)&&w!==1,f=[{label:n("Base €/m² (Statbel)","Basis €/m² (Statbel)","Base €/m² (Statbel)"),value:`${t.prix_base.toLocaleString("fr-BE")} €`},{label:`${n("Coef.","Coëf.","Coef.")} ${t.source_localisation}`,value:r(t.coef_localisation)}];return d(t.facteur_surface)&&f.push({label:n("Surface","Oppervlakte","Surface"),value:r(t.facteur_surface)}),d(t.facteur_peb)&&f.push({label:"PEB",value:r(t.facteur_peb)}),d(t.facteur_etat)&&f.push({label:n("État","Staat","Condition"),value:r(t.facteur_etat)}),d(t.facteur_atouts)&&f.push({label:n("Atouts","Troeven","Features"),value:r(t.facteur_atouts)}),d(t.facteur_terrain)&&f.push({label:n("Terrain","Grond","Land"),value:r(t.facteur_terrain)}),d(t.facteur_facades)&&f.push({label:n("Façades","Gevels","Facades"),value:r(t.facteur_facades)}),d(t.facteur_etage)&&f.push({label:n("Étage","Verdieping","Floor"),value:r(t.facteur_etage)}),d(t.facteur_annee)&&f.push({label:n("Année","Bouwjaar","Year"),value:r(t.facteur_annee)}),e.jsxs(e.Fragment,{children:[f.map((w,P)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:"8px"},children:[e.jsx("span",{children:w.label}),e.jsx("span",{style:{fontWeight:600,color:y.teal,fontVariantNumeric:"tabular-nums"},children:w.value})]},P)),e.jsxs("div",{style:{borderTop:`1px solid ${y.border}`,marginTop:"6px",paddingTop:"6px",display:"flex",justifyContent:"space-between",fontWeight:700,color:y.teal},children:[e.jsxs("span",{children:["= ",n("Prix m² estimé","Geschatte prijs/m²","Estimated €/m²")]}),e.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[J.prix_m2_estime.toLocaleString("fr-BE")," €/m²"]})]}),J.surface_m2>0&&e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontWeight:700,color:y.teal},children:[e.jsxs("span",{children:["× ",J.surface_m2," m²"]}),e.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:["= ",J.prix_total_estime.toLocaleString("fr-BE")," €"]})]})]})})()})]}),e.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"8px"},children:[e.jsxs("button",{onClick:()=>Nn(J.prix_total_estime),style:{flex:1,padding:"7px",borderRadius:"6px",border:"none",background:y.gold,color:"white",fontSize:"10px",fontWeight:700,cursor:"pointer",fontFamily:"'Outfit'"},children:[n("Utiliser","Gebruiken","Use")," ",J.prix_total_estime.toLocaleString("fr-BE")," €"]}),e.jsx("button",{onClick:()=>Nn(J.fourchette_basse_total),style:{padding:"7px 8px",borderRadius:"6px",border:`1px solid ${y.border}`,background:"white",color:y.teal,fontSize:"10px",fontWeight:600,cursor:"pointer"},children:"Min"}),e.jsx("button",{onClick:()=>Nn(J.fourchette_haute_total),style:{padding:"7px 8px",borderRadius:"6px",border:`1px solid ${y.border}`,background:"white",color:y.teal,fontSize:"10px",fontWeight:600,cursor:"pointer"},children:"Max"})]})]}),e.jsx("button",{onClick:()=>Xe(!0),disabled:!(J&&J.prix_total_estime>0),style:{width:"100%",marginTop:"10px",padding:"8px 12px",borderRadius:"6px",border:"none",background:y.teal,color:"white",fontSize:"11px",fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif",opacity:J&&J.prix_total_estime>0?1:.45},children:"Ouvrir le Studio Leviers"})]}),e.jsxs("div",{style:zt,children:[e.jsx(At,{children:n("Rédaction","Redactie","Writing")}),e.jsxs("div",{children:[e.jsx(Je,{children:n("Notes pour l'IA","Notities voor de AI","Notes for AI")}),e.jsx("textarea",{value:me,onChange:t=>Re(t.target.value),placeholder:n("Parquet chêne massif, double vitrage récent...","Massief eiken parket, recent dubbel glas...","Solid oak parquet, recent double glazing..."),rows:2,style:{...et,resize:"vertical",lineHeight:1.5}})]}),e.jsxs("div",{children:[e.jsx(Je,{children:n("Langue","Taal","Language")}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"6px"},children:[{v:"fr",l:"FR"},{v:"nl",l:"NL"},{v:"en",l:"EN"}].map(t=>e.jsx("button",{onClick:()=>we(t.v),style:{padding:"8px",borderRadius:"8px",border:ke===t.v?`2px solid ${y.teal}`:`1px solid ${y.border}`,background:ke===t.v?"rgba(15,76,76,0.06)":"white",cursor:"pointer",fontSize:"11px",fontWeight:600,color:ke===t.v?y.teal:y.muted,fontFamily:"'Outfit', sans-serif"},children:t.l},t.v))})]})]}),e.jsxs("div",{style:zt,children:[e.jsx(At,{children:n("Propriétaire","Eigenaar","Owner")}),e.jsx("p",{style:{fontSize:"10px",color:y.muted,margin:"-4px 0 6px"},children:n("Facultatif — requis pour les séquences email","Optioneel — vereist voor e-mailreeksen","Optional — required for email sequences")}),e.jsxs("div",{children:[e.jsx(Je,{children:n("Nom","Naam","Name")}
184),e.jsx("input",{value:Ze,onChange:t=>an(t.target.value),placeholder:"Jean Dupont",style:et})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px"},children:[e.jsxs("div",{children:[e.jsx(Je,{children:"Email"}),e.jsx("input",{value:st,onChange:t=>Jn(t.target.value),placeholder:"[email protected]",type:"email",style:et})]}),e.jsxs("div",{children:[e.jsx(Je,{children:n("Téléphone","Telefoon","Phone")}),e.jsx("input",{value:ht,onChange:t=>Kn(t.target.value),placeholder:"+32 470 00 00 00",style:et})]})]})]}),e.jsxs("div",{style:zt,children:[e.jsx(At,{children:"Photos"}),de.length>0&&e.jsxs("button",{onClick:()=>Ot(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"8px 14px",marginBottom:"10px",borderRadius:"8px",border:`1px solid ${y.gold}`,background:"rgba(212,175,55,0.08)",color:y.goldDark,fontWeight:700,fontSize:"12px",cursor:"pointer"},children:[e.jsx(wt,{style:{width:14,height:14}}),n("Améliorer les photos","Foto's verbeteren","Enhance photos")]}),e.jsxs("div",{onDrop:t=>{t.preventDefault(),Lt(!1),wr(t.dataTransfer.files)},onDragOver:t=>{t.preventDefault(),Lt(!0)},onDragLeave:()=>Lt(!1),onClick:()=>{var t;return(t=rt.current)==null?void 0:t.click()},style:{padding:"20px 14px",borderRadius:"10px",border:`2px dashed ${jt?y.gold:y.border}`,background:jt?"rgba(212,175,55,0.06)":"#FAFAF8",cursor:"pointer",textAlign:"center"},children:[e.jsx("input",{ref:rt,type:"file",accept:"image/*",multiple:!0,onChange:t=>wr(t.target.files),style:{display:"none"}}),e.jsx(lo,{style:{width:22,height:22,color:jt?y.gold:y.muted,margin:"0 auto 4px"}}),e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:y.teal},children:n("Glissez vos photos","Sleep uw foto's","Drag your photos")}),e.jsx("div",{style:{fontSize:"9px",color:y.muted},children:"max 10 · JPG, PNG, WebP"})]}),de.length>0&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gridAutoRows:"1fr",gap:"6px"},children:de.map((t,r)=>e.jsxs("div",{draggable:!0,onDragStart:()=>Wt(r),onDragOver:d=>d.preventDefault(),onDrop:d=>{d.preventDefault(),d.stopPropagation(),Nt!==null&&Nt!==r&&Oi(Nt,r),Wt(null)},style:{position:"relative",borderRadius:"8px",overflow:"hidden",aspectRatio:r===0?"auto":"1",gridColumn:r===0?"span 2":"span 1",gridRow:r===0?"span 2":"span 1",border:r===0?`2px solid ${y.gold}`:`1px solid ${y.border}`,cursor:"grab"},children:[e.jsx("img",{src:t.url,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}),r===0&&e.jsxs("div",{style:{position:"absolute",top:"6px",left:"6px",padding:"2px 6px",borderRadius:"4px",background:y.gold,fontSize:"9px",fontWeight:800,color:"white",display:"flex",alignItems:"center",gap:"3px"},children:[e.jsx(co,{style:{width:8,height:8}})," Cover"]}),e.jsx("div",{role:"button",tabIndex:0,"aria-label":"Supprimer la photo",onClick:d=>{d.stopPropagation(),jr(t.id)},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.stopPropagation(),jr(t.id))},style:{position:"absolute",top:"6px",right:"6px",zIndex:3,width:"24px",height:"24px",borderRadius:"6px",background:"rgba(15,46,46,0.85)",border:"1px solid rgba(255,255,255,0.4)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",padding:0,lineHeight:0},children:e.jsx(Rt,{style:{width:14,height:14,color:"#FFFFFF",strokeWidth:3}})})]},t.id))})]}),(a||He)&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:$r,disabled:Vt,style:{width:"100%",height:"48px",borderRadius:"12px",border:"none",background:Vt?y.muted:`linear-gradient(135deg, ${y.gold}, ${y.goldDark})`,color:"white",fontSize:"14px",fontWeight:800,cursor:Vt?"wait":"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontFamily:"'Outfit', sans-serif",boxShadow:Vt?"none":"0 4px 16px rgba(212,175,55,0.3)"},children:Vt?n("Enregistrement…","Opslaan…","Saving…"):n("Enregistrer les modifications","Wijzigingen opslaan","Save changes")}),e.jsx("p",{style:{fontSize:"10px",color:y.muted,textAlign:"center",margin:"-6px 0 0"},children:n("Sans IA · gratuit","Zonder AI · gratis","No AI · free")})]}),e.jsx("button",{onClick:()=>kr(!!S||!!a),disabled:at,style:a||He?{width:"100%",height:"44px",marginTop:"8px",borderRadius:"12px",border:`1px solid ${y.teal}`,background:at?y.muted:"white",color:at?"white":y.teal,fontSize:"13px",fontWeight:700,cursor:at?"wait":"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontFamily:"'Outfit', sans-serif"}:{width:"100%",height:"48px",borderRadius:"12px",border:"none",background:at?y.muted:`linear-gradient(135deg, ${y.gold}, ${y.goldDark})`,color:"white",fontSize:"14px",fontWeight:800,cursor:at?"wait":"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontFamily:"'Outfit', sans-serif",boxShadow:at?"none":"0 4px 16px rgba(212,175,55,0.3)"},children:at?e.jsxs(e.Fragment,{children:[e.jsx(bt,{style:{width:16,height:16,animation:"spin 1s linear infinite"}})," ",Ut||n("Génération...","Genereren...","Generating...")]}):e.jsxs(e.Fragment,{children:[e.jsx(wt,{style:{width:16,height:16}})," ",S||a?n("Regénérer l'annonce","Advertentie hergenereren","Regenerate listing"):n("Générer l'annonce","Advertentie genereren","Generate listing")]})}),e.jsx("p",{style:{fontSize:"10px",color:y.muted,textAlign:"center",margin:"-6px 0 0"},children:a||He?n("Réécrit le texte par IA · 1 crédit","Herschrijft tekst met AI · 1 credit","AI rewrites text · 1 credit"):n("1 crédit · Inclut annonce, page acheteur et fiche de visite","1 credit · Inclusief advertentie, koperspagina en bezoekfiche","1 credit · Includes listing, buyer page and visit sheet")})]})]}),S&&e.jsxs("div",{className:"pa-results",style:{minWidth:0},children:[a&&e.jsx(Ao,{status:cn,label:_t||ct||n("Ce bien","Dit pand","This property"),createdAt:pi,mandateSignedAt:hi,publishedAt:ur,soldAt:un,readiness:{annonce:!!(S!=null&&S.immoweb),photos:de.length,prix:!!B,adresse:!!g&&!!R&&!!N},busy:lr,onMandateSigned:vi,onPublish:zr,onMarkSold:()=>{Pn(new Date().toISOString().split("T")[0]),Qt(!0)},onRelist:fr}),S&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"white",border:`1px solid ${y.border}`,borderRadius:"10px",marginBottom:"10px",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:y.muted,textTransform:"uppercase",letterSpacing:"0.5px"},children:n("Langue","Taal","Language")}),["fr","nl","en"].map(t=>{const r=!!Jt[t],d=ki===t,f=Tn===t,w={fr:"FR",nl:"NL",en:"EN"};return e.jsxs("button",{onClick:()=>Li(t),disabled:f||Tn!==null&&!r,style:{padding:"5px 12px",borderRadius:"8px",border:d?`1.5px solid ${y.teal}`:r?"1px solid rgba(15,76,76,0.2)":`1px dashed ${y.border}`,background:d?y.teal:r?"white":"transparent",color:d?"white":r?y.teal:y.muted,fontSize:"12px",fontWeight:700,cursor:f?"wait":"pointer",display:"inline-flex",alignItems:"center",gap:"5px",fontFamily:"'Outfit', sans-serif",opacity:Tn!==null&&!d&&!r&&!f?.5:1},title:r?n(`Voir l'annonce en ${w[t]}`,`Bekijk in ${w[t]}`,`View in ${w[t]}`):n(`Traduire en ${w[t]}`,`Vertalen naar ${w[t]}`,`Translate to ${w[t]}`),children:[f?e.jsx(bt,{style:{width:11,height:11,animation:"spin 1s linear infinite"}}):r?e.jsx(en,{style:{width:11,height:11}}):e.jsx(wt,{style:{width:11,height:11}}),w[t]]},t)}),e.jsx("span",{style:{marginLeft:"auto",fontSize:"10px",color:y.muted,fontStyle:"italic"},children:Object.keys(Jt).length===1?n("Cliquez pour traduire","Klik om te vertalen","Click to translate"):`${Object.keys(Jt).length}/3 ${n("langues","talen","languages")}`})]}),e.jsx(xo,{result:S,existingReports:hn,photos:de,prix:B,fullAddress:ct,ville:N,estimation:J,notesAgent:De,setNotesAgent:St,ownerEmail:st,ownerName:Ze,bienId:He||a||null,bienLabel:_t,bienUpdatedAt:gi,annonceSource:fi,annonceUpdatedAt:xi,reportUrl:vn,pitchReady:ni,reportReady:Zn,reportLoading:dt,publishLoading:lr,publishedUrl:Et,onOpenReport:Ui,onViewReport:Wi,onPublish:zr,onCarousel:Vi,onRegenerate:()=>{X(null),qt(null),rn(null),Xn(!1),er(!1),kr(!0)},loading:at,onOpenFiche:()=>tr(!0),onSaveAnnonceManual:Gi,onOpenStudio:()=>Xe(!0),studioOpen:nt}),e.jsx(Vo,{open:ri,onClose:()=>tr(!1),apiKey:i,codeIns:_,prix:B,estimation:J,fullAddress:ct,ville:N,typeBien:D,coverUrl:(Pr=de[0])==null?void 0:Pr.url,specs:{surface:m,chambres:b,sdb:U,peb:z,etat:ie,etage:ne,anneeConstruction:ve,surfaceTerrain:he,equips:pe},brand:W})]})]})]})]})}),e.jsx(po,{})]}),oi&&e.jsxs("div",{style:{position:"fixed",inset:0,background:"rgba(13,17,9,0.55)",backdropFilter:"blur(3px)",zIndex:1200,display:"flex",flexDirection:"column",fontFamily:"'Outfit', sans-serif"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"14px 20px",background:"white",borderBottom:`1px solid ${y.border}`,flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[e.jsx("span",{style:{fontSize:"15px",fontWeight:800,color:y.teal},children:n("Aperçu du rapport","Rapportvoorbeeld","Report preview")}),e.jsx("span",{style:{fontSize:"12px",color:y.muted},children:n("Masquez les pages à retirer, puis générez le rapport final.","Verberg de pagina's die u wilt verwijderen en genereer daarna het rapport.","Hide the pages to remove, then generate the final report.")})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[!Pt&&kn&&!It&&e.jsx("button",{type:"button",onClick:()=>{ar(li),Ft(!0)},style:{padding:"10px 18px",borderRadius:"10px",border:`1.5px solid ${y.teal}`,background:"white",color:y.teal,fontSize:"13px",fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif"},children:n("Modifier l'intro","Intro bewerken","Edit intro")}),e.jsx("button",{type:"button",onClick:()=>{ln(!1),dn(null)},style:{padding:"10px 18px",borderRadius:"10px",border:`1px solid ${y.border}`,background:"white",color:y.muted,fontSize:"13px",fontWeight:600,cursor:"pointer",fontFamily:"'Outfit', sans-serif"},children:n("Fermer","Sluiten","Close")}),e.jsx("button",{type:"button",onClick:Hi,disabled:dt||It||Pt,style:{padding:"10px 22px",borderRadius:"10px",border:"none",background:dt||It||Pt?y.muted:`linear-gradient(135deg, ${y.gold}, ${y.goldDark})`,color:"white",fontSize:"13px",fontWeight:800,cursor:dt||It?"wait":Pt?"not-allowed":"pointer",fontFamily:"'Outfit', sans-serif",boxShadow:dt||It||Pt?"none":"0 4px 12px rgba(212,175,55,0.3)"},children:dt?n("Génération…","Genereren…","Generating…"):n("Générer le rapport","Rapport genereren","Generate report")})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",background:"#F1F0ED",position:"relative"},children:[It||!kn?e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",color:y.muted},children:[e.jsx(bt,{size:28,style:{animation:"spin 1s linear infinite"}}),e.jsx("span",{style:{fontSize:"13px"},children:n("Génération du rapport en cours, patientez quelques instants…","Rapport wordt gegenereerd, even geduld…","Generating the report, please wait a moment…")})]}):e.jsx("iframe",{ref:Sn,srcDoc:kn,onLoad:qi,title:n("Aperçu du rapport","Rapportvoorbeeld","Report preview"),style:{width:"100%",height:"100%",border:"none",background:"white"}}),Pt&&e.jsx("div",{style:{position:"absolute",inset:0,background:"#F1F0ED",overflow:"auto",zIndex:5},children:e.jsxs("div",{style:{maxWidth:"820px",margin:"0 auto",padding:"28px 24px"},children:[e.jsx("h3",{style:{margin:"0 0 6px",fontSize:"17px",fontWeight:800,color:y.teal},children:n("Intro du rapport","Rapportintro","Report intro")}),e.jsx("p",{style:{margin:"0 0 16px",fontSize:"13px",color:y.muted,lineHeight:1.5},children:n("Ce texte remplace l'introduction du rapport, pour ce bien uniquement. Videz le champ pour revenir à l'intro générée par Arcanes.","Deze tekst vervangt de inleiding van het rapport, alleen voor dit pand. Maak het veld leeg om terug te keren naar de door Arcanes gegenereerde intro.","This text replaces the report introduction, for this property only. Clear the field to restore the Arcanes-generated intro.")}),e.jsx("textarea",{value:_n,onChange:t=>ar(t.target.value),rows:14,style:{width:"100%",padding:"14px 16px",borderRadius:"10px",border:`1px solid ${y.border}`,fontSize:"14px",lineHeight:1.6,fontFamily:"'Outfit', sans-serif",color:y.text,resize:"vertical",boxSizing:"border-box"}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginTop:"14px",flexWrap:"wrap"},children:[e.jsx("button",{type:"button",onClick:()=>Ar(_n.trim()?_n:null),disabled:Ct,style:{padding:"11px 22px",borderRadius:"10px",border:"none",background:Ct?y.muted:`linear-gradient(135deg, ${y.gold}, ${y.goldDark})`,color:"white",fontSize:"13px",fontWeight:800,cursor:Ct?"wait":"pointer",fontFamily:"'Outfit', sans-serif",boxShadow:Ct?"none":"0 4px 12px rgba(212,175,55,0.3)"},children:Ct?n("Enregistrement…","Opslaan…","Saving…"):n("Enregistrer et voir l'aperçu","Opslaan en voorbeeld tonen","S
184ave and preview")}),e.jsx("button",{type:"button",onClick:()=>Ft(!1),disabled:Ct,style:{padding:"11px 18px",borderRadius:"10px",border:`1px solid ${y.border}`,background:"white",color:y.muted,fontSize:"13px",fontWeight:600,cursor:"pointer",fontFamily:"'Outfit', sans-serif"},children:n("Annuler","Annuleren","Cancel")}),e.jsx("button",{type:"button",onClick:()=>Ar(null),disabled:Ct,style:{marginLeft:"auto",padding:"11px 16px",borderRadius:"10px",border:"none",background:"transparent",color:y.teal,fontSize:"12px",fontWeight:700,cursor:"pointer",fontFamily:"'Outfit', sans-serif",textDecoration:"underline"},children:n("Rétablir l'intro Arcanes","Arcanes-intro herstellen","Restore Arcanes intro")})]})]})})]})]}),Ci&&e.jsx("div",{onClick:()=>Ln(!1),style:{position:"fixed",inset:0,background:"rgba(13,17,9,0.4)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"20px",fontFamily:"'Outfit', sans-serif"},children:e.jsxs("div",{onClick:t=>t.stopPropagation(),style:{background:"white",borderRadius:"16px",padding:"20px 22px",maxWidth:"480px",width:"100%",maxHeight:"80vh",overflowY:"auto",boxShadow:"0 20px 60px rgba(0,0,0,0.18)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:700,letterSpacing:"1.5px",textTransform:"uppercase",color:"#DC2626",marginBottom:"2px"},children:n("Notification rapide","Snelle melding","Quick notification")}),e.jsx("h3",{style:{fontSize:"17px",fontWeight:800,color:y.teal,margin:0},children:n("Vos acheteurs chauds sur ce bien","Hete kopers voor dit pand","Hot buyers for this property")})]}),e.jsx("button",{onClick:()=>Ln(!1),style:{width:"30px",height:"30px",borderRadius:"8px",border:`1px solid ${y.border}`,background:"white",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Rt,{style:{width:14,height:14,color:y.muted}})})]}),e.jsx("p",{style:{fontSize:"12px",color:"#7A7670",lineHeight:1.5,margin:"0 0 14px"},children:n("Envoyez la page acheteur en 1 clic. Le message est pré-rédigé avec le prénom du contact et le lien direct.","Stuur de koperspagina in 1 klik. Bericht voorgevuld met voornaam en directe link.","Send the buyer page in 1 click. Message pre-filled with name and direct link.")}),br.length===0?e.jsx("div",{style:{padding:"20px",textAlign:"center",color:y.muted,fontSize:"13px"},children:n("Aucun acheteur chaud avec téléphone pour ce bien.","Geen hete kopers met telefoonnummer voor dit pand.","No hot buyers with phone for this property.")}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:br.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px",padding:"10px 12px",border:`1px solid ${y.border}`,borderRadius:"10px",background:"white"},children:[e.jsxs("div",{style:{minWidth:0,flex:1},children:[e.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:"#0D1109"},children:t.nom}),e.jsxs("div",{style:{fontSize:"11px",color:y.muted},children:[t.telephone," ·"," ",e.jsxs("span",{style:{color:t.intent_score>=10?"#DC2626":"#D4AF37",fontWeight:700},children:["Score ",t.intent_score]})]})]}),e.jsx("button",{onClick:()=>Ri(t),style:{padding:"8px 12px",borderRadius:"8px",border:"1px solid rgba(15,76,76,0.15)",background:"white",color:y.teal,fontSize:"12px",fontWeight:700,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"5px",fontFamily:"'Outfit', sans-serif"},children:"WhatsApp ↗"})]},t.id))})]})}),bi&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(13,17,9,0.4)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"20px"},onClick:()=>Qt(!1),children:e.jsxs("div",{onClick:t=>t.stopPropagation(),style:{background:"white",borderRadius:"16px",padding:"28px",maxWidth:"440px",width:"100%",boxShadow:"0 20px 60px rgba(0,0,0,0.15)",border:"1px solid #E8E4DE",fontFamily:"'Outfit', sans-serif"},children:[e.jsx("h2",{style:{fontSize:"20px",fontWeight:800,color:"#0D1109",marginBottom:"8px"},children:n("Confirmer la vente du bien","Bevestig de verkoop","Confirm sale")}),e.jsx("p",{style:{fontSize:"13px",color:"#7A7670",lineHeight:1.6,marginBottom:"20px"},children:n(`Vous allez marquer "${_t}" comme vendu. Le bien restera visible dans votre tableau de bord avec un badge VENDU.`,`U gaat "${_t}" markeren als verkocht. Het pand blijft zichtbaar met VERKOCHT-badge.`,`You're about to mark "${_t}" as sold. The property will remain visible with a SOLD badge.`)}),e.jsx("label",{style:{display:"block",fontSize:"11px",fontWeight:700,color:"#7A7670",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"6px"},children:n("Date de vente","Verkoopdatum","Sale date")}),e.jsx("input",{type:"date",value:Bt,onChange:t=>Pn(t.target.value),max:new Date().toISOString().split("T")[0],style:{width:"100%",padding:"10px 14px",borderRadius:"10px",border:"1px solid #E8E4DE",fontSize:"14px",fontFamily:"'Outfit', sans-serif",color:"#0D1109",marginBottom:"20px"}}),e.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>Qt(!1),style:{padding:"10px 20px",borderRadius:"10px",border:"1px solid #E8E4DE",background:"white",color:"#7A7670",fontSize:"13px",fontWeight:700,cursor:"pointer"},children:n("Annuler","Annuleren","Cancel")}),e.jsx("button",{onClick:()=>{Bt&&(yi(Bt),Qt(!1))},disabled:!Bt,style:{padding:"10px 20px",borderRadius:"10px",border:"none",background:Bt?"#D4AF37":"#E8E4DE",color:"white",fontSize:"13px",fontWeight:700,cursor:Bt?"pointer":"not-allowed"},children:n("Confirmer la vente","Bevestig verkoop","Confirm sale")})]})]})}),e.jsx(es,{open:nt,onClose:()=>Xe(!1),apiKey:i,lang:x,codeIns:_,cp:R,typeBien:D,prixDemande:Number(B)||(J==null?void 0:J.prix_total_estime)||0,estimation:J,bienId:a,surface:Number(m)||0,chambres:Number(b)||0,sdb:Number(U)||0,peb:z,etat:ie,etage:ne,surfaceTerrain:Number(he)||0,facades:Number(fe)||0,anneeConstruction:Number(ve)||0,equips:pe}),e.jsx(Eo,{open:bn,onClose:()=>Ot(!1),bienId:a||He,apiKey:i,language:x,localPhotos:de,onEnsureBien:Rr,onPhotosChanged:t=>{t&&t.length>0&&Ke(t.map((r,d)=>({id:`studio-${d}-${Date.now()}
184`,file:new File([],`photo-${d}.jpg`),url:r})))}})]})}export{ks 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.