PageSourceSearch

https://app.epc-expert-pro.be/assets/DossierOverviewPage-BM3z0BOj.js

js epc-expert-pro.be collected 2026-10-02 01:18:01 UTC 50,533 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PerceelKaart-aRiF2bC7.js","assets/react-Cx2L18Fh.js","assets/leaflet-DrAowmX6.js","assets/leaflet-CIGW-MKW.css"])))=>i.map(i=>d[i]);
2import{r as p,j as e,w as B,z as tt}from"./react-Cx2L18Fh.js";import{L as Le,M as $e,af as V,ag as st,l as nt,ah as rt,ai as at,aj as Re,ak as fe,al as ot,am as ae,an as it,ao as lt,ap as dt,K as ct,A as xe,G as ut}from"./AppShell-Prs3NYUi.js";import{P as mt}from"./PageSkeleton-vLBUxNkq.js";import{B as ge}from"./badge-COsRI6Bm.js";import{B as C,m as pt,aa as ft,Y as Ae,K as xt,c0 as he,c1 as gt,a1 as H,c2 as ht,c3 as bt,o as X,c4 as kt,g as Q,h as vt,c5 as jt,ai as wt}from"./bootstrap-CIyzQir5.js";import{s as Me,aJ as yt,ae as Nt,K as be,w as St,X as Pe,A as _t,G as oe,n as Et,b as Ie,m as Tt,r as Ke,b2 as Ct,ai as ke,u as ve,k as Dt,b3 as Ot}from"./icons-BaLUK3zn.js";import{P as zt}from"./PhotoComplianceChecker-C6Er7eqo.js";import{a as je,A as Lt,t as $t,b as Rt,f as we}from"./AppointmentDialog-P1JZ6_4z.js";import{a as At}from"./useAppointments-DeCAyxNd.js";import{u as R}from"./i18n-OxCMnHdS.js";import{S as J,A as ye,E as Y,J as Mt}from"./joyride-DdqNgroC.js";import{F as Pt}from"./FieldToolbox-jpKNABnH.js";import{ba as It,bb as Ve,bc as Be,bd as Ne,aY as Kt,be as Vt,bf as q,bg as Bt,bh as Ft,bi as Gt,i as Wt,a as Ut,X as Zt,bj as Ht,bk as qt,bl as Qt,bm as Yt,bn as Xt,bo as Jt,bp as es,D as ts,bq as ss}from"./DossierWorkspace-Ch0QX--G.js";import{L as ns}from"./LaserMeasurement-B-BiIlCN.js";import"./geometry-CwMX337e.js";import{a as Se}from"./dossier-Dy8CN5N8.js";import{_ as rs}from"./preload-helper-Y7oeyQPX.js";import{u as as}from"./useIsolatieIngevoerd-CteyiEuu.js";import"./radix-CeuLCn0j.js";import"./forms-DjKlVCCn.js";import"./index-CCYSazvs.js";import"./charts-8q6USlL8.js";import"./supabase-DEwkL4E1.js";import"./en-US-BJqPz4zF.js";import"./constructFrom-DgtNKa7R.js";import"./klantvoorbereidingRepository-B0lAPCQS.js";import"./KlantDelenOnderdelen-CGgVcwAc.js";import"./useKlantstatusPerDossier-BrHOYQ5i.js";import"./select-CH0bO1kn.js";import"./alert-dialog-1UMIt55X.js";import"./useAlleenEigenaarTooltip-BB0uf6Va.js";import"./voorwaardenLinks-vl7Th2A2.js";import"./laatstBezocht-BjJ9mPKk.js";import"./rijWachtrij-BJB9VISy.js";import"./formatGetal-yGKYlG8Q.js";import"./eenheden-CNUTFG9s.js";import"./plansRepository-B1lBTXM1.js";import"./parseGetal-B3Y1lnna.js";import"./statusStyles-mMfIKtiH.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"1.2.0+1799dae"};var s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="06e51926-699c-4edf-aafc-ff4b740a0e0f",t._sentryDebugIdIdentifier="sentry-dbid-06e51926-699c-4edf-aafc-ff4b740a0e0f")}catch{}})();function os({hasRemoteUpdate:t,onAcknowledge:s,onReload:r}){const a=p.useCallback(()=>{s(),r?r():typeof window<"u"&&window.location.reload()},[s,r]);return t?e.jsxs("div",{role:"alert",className:"bg-warning-subtle border-b-2 border-warning-border px-4 py-3 flex items-start gap-3",children:[e.jsx(Me,{className:"h-5 w-5 text-warning-strong shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-warning-strong",children:"Dit dossier werd op een ander apparaat gewijzigd"}),e.jsx("p",{className:"text-xs text-warning-strong mt-0.5",children:"Herlaad om de nieuwe versie te zien. Nog niet opgeslagen wijzigingen op dit apparaat gaan verloren."})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx(C,{size:"sm",variant:"outline",onClick:s,children:"Sluiten"}),e.jsxs(C,{size:"sm",onClick:a,children:[e.jsx(yt,{className:"h-3.5 w-3.5 mr-1.5"}),"Herladen"]})]})]}):null}function is({dossierId:t}){const{t:s,i18n:r}=R(),[a,n]=p.useState(!1),i=B(),{data:c=[],refetch:l}=pt({queryKey:["dossier-appointments",t],queryFn:()=>At.findByDossierId(t)}),o=Date.now(),d=c.find(b=>new Date(b.start_at).getTime()>=o),f=d?null:[...c].reverse().find(b=>new Date(b.start_at).getTime()<o),u=d??f;if(!u)return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-2 rounded-lg bg-muted/40 p-5 text-center",children:[e.jsx("span",{className:"grid size-10 place-items-center rounded-xl bg-muted text-muted-foreground",children:e.jsx(Nt,{className:"size-5","aria-hidden":!0})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("agenda.dossierWidget.geenAfspraak")}),e.jsxs(C,{onClick:()=>n(!0),size:"sm",variant:"outline",className:"gap-2",children:[e.jsx(be,{className:"size-4","aria-hidden":!0}),s("agenda.dossierWidget.planOpmeting")]})]}),e.jsx(je,{open:a,onOpenChange:b=>{n(b),b||l()},prefilledDossierId:t,onSuccess:()=>l()})]});const m=new Date(u.start_at),x=Lt[$t(u.status)],S=m.getTime()>=o;return e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"button",tabIndex:0,onKeyDown:b=>{b.target===b.currentTarget&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),i(`/agenda?date=${we(m,"yyyy-MM-dd")}`))},onClick:()=>i(`/agenda?date=${we(m,"yyyy-MM-dd")}`),className:"w-full text-left border rounded-lg p-3 hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"inline-block w-1 h-10 rounded-full",style:{backgroundColor:x.color},"aria-hidden":"true"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(St,{className:"h-4 w-4 text-muted-foreground"}),Rt(u.start_at,r.language),!S&&e.jsx("span",{className:"text-xs text-muted-foreground",children:s("agenda.voorbij")})]}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[s(x.labelKey),c.length>1&&` · ${s("agenda.samenvattingAfspraken",{count:c.length})}`]})]}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),n(!0)},className:"gap-1",children:[e.jsx(be,{className:"h-3 w-3"}),s("agenda.extra")]})]})}),e.jsx(je,{open:a,onOpenChange:b=>{n(b),b||l()},prefilledDossierId:t,onSuccess:()=>l()})]})}const L=[{stepNumber:1,target:'[data-tour="dossier-phases"]',targetSelectors:['[data-tour="dossier-phases"]'],titleKey:"tour.stappen.checklist.titel",title:"Wat nog moet",contentKey:"tour.stappen.checklist.inhoud",content:"Hier staat je checklist. De blauwe knop **Verder** brengt je meteen naar de eerstvolgende open sectie.",placement:"left",skipBeacon:!0},{stepNumber:2,target:'[data-tour="dossier-plattegrond"]',targetSelectors:['[data-tour="dossier-plattegrond"][data-variant="strip"]','[data-tour="dossier-plattegrond"][data-variant="rail"]','[data-tour="dossier-sectiekiezer"]'],titleKey:"tour.stappen.plattegrond.titel",title:"Plattegrond eerst",contentKey:"tour.stappen.plattegrond.inhoud",content:"Muren en ruimtes vullen automatisch gevels, dak en vloer. Per element kies je daarna nog materiaal en de aangrenzing.",placement:"right",skipBeacon:!0},{stepNumber:3,target:'[data-tour="dossier-installaties"]',targetSelectors:['[data-tour="dossier-installaties"][data-variant="strip"]','[data-tour="dossier-installaties"][data-variant="rail"]','[data-tour="dossier-sectiekiezer"]'],titleKey:"tour.stappen.installaties.titel",title:"Installaties",contentKey:"tour.stappen.installaties.inhoud",content:"Vul verwarming, sanitair warm water en koeling in, of vink **'geen aanwezig'** aan.",placement:"right",skipBeacon:!0},{stepNumber:4,target:'[data-tour="dossier-export"]',targetSelectors:['[data-tour="dossier-export"][data-variant="strip"]','[data-tour="dossier-export"][data-variant="rail"]','[data-tour="dossier-sectiekiezer"]'],titleKey:"tour.stappen.export.titel",title:"Foto voor VEKA en export",contentKey:"tour.stappen.export.inhoud",content:"Markeer één foto als **'Foto voor VEKA'**, los daarna de rode blokkades bij Export op en voeg in bij EP.",placement:"right",skipBeacon:!0}],ls=".react-joyride__floater",_e="[data-bottom-tabs]";function ds(t){return typeof t!="string"?t:t.split(/(\*\*[^*]+\*\*)/g).map((r,a)=>r.startsWith("**")&&r.endsWith("**")?e.jsx("strong",{className:"font-semibold text-foreground",children:r.slice(2,-2)},a):r)}function cs(t){const{backProps:s,primaryProps:r,skipProps:a,step:n,index:i,isLastStep:c,tooltipProps:l}=t,{zichtbareTotaalStappen:o,zichtbareStapNummer:d,isEersteZichtbareStap:f,resterendeMinuten:u,n
2avigatieKlaar:m}=n.tourUi,{t:x}=R(),S=Le($e,{directMeten:!0}),b=p.useRef(null),w=p.useRef(null),O=Math.round(d/o*100),k=n.placement==="center",[g,v]=p.useState(null);p.useEffect(()=>{m&&b.current?.focus({preventScroll:!0})},[i,m]),p.useLayoutEffect(()=>{if(S){v(null);return}const E=w.current?.closest(ls);if(!E)return;const N=()=>{const z=E.getBoundingClientRect(),j=w.current?.getBoundingClientRect().height??0,P=document.querySelector(_e),A=P?P.getBoundingClientRect().top:window.innerHeight;v({left:-z.left,top:A-j-z.top})};N();const M=new ResizeObserver(N);M.observe(E);const T=document.querySelector(_e);return T&&M.observe(T),window.addEventListener("resize",N),window.addEventListener("orientationchange",N),document.addEventListener("scroll",N,{capture:!0,passive:!0}),()=>{M.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),document.removeEventListener("scroll",N,!0)}},[S,i,m]);const y=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[n.title&&e.jsx("h2",{id:"tour-tooltip-title",className:"text-lg font-bold text-primary leading-tight",children:n.title}),e.jsx("button",{...a,className:"text-muted-foreground hover:text-foreground transition-colors -mt-1 -mr-1 p-1 rounded","aria-label":x("tour.sluiten"),title:x("tour.sluiten"),children:e.jsx(Pe,{className:"size-4","aria-hidden":!0})})]}),e.jsx("div",{className:"text-sm text-foreground/90 leading-relaxed mb-4 whitespace-pre-line",children:ds(n.content)}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mb-1",children:[e.jsx("span",{className:"font-medium",children:x("tour.stap",{stap:d,totaal:o})}),e.jsx("span",{children:x("tour.resterend",{minuten:u})})]}),e.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out motion-reduce:transition-none",style:{width:`${O}%`},"aria-hidden":!0})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(C,{...a,variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground",children:x("tour.knop.stoppen")}),e.jsxs("div",{className:"flex items-center gap-2",children:[!f&&e.jsxs(C,{...s,disabled:!m,variant:"outline",size:"sm",children:[e.jsx(_t,{className:"size-4 mr-1","aria-hidden":!0}),x("tour.knop.vorige")]}),e.jsxs(C,{...r,disabled:!m,ref:b,size:"sm",className:"font-semibold",children:[x(c?"tour.knop.klaar":"tour.knop.volgende"),!c&&e.jsx(oe,{className:"size-4 ml-1","aria-hidden":!0})]})]})]})]}),D={position:"absolute",left:g?.left??0,top:g?.top??0,right:"auto",bottom:"auto",width:"100vw",maxHeight:"50dvh",overflowY:"auto",borderRadius:"12px 12px 0 0",paddingBottom:"env(safe-area-inset-bottom, 0px)",visibility:g&&m?"visible":"hidden"},h=k?{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{};return e.jsx("div",{...l,ref:w,style:{...S?h:D,zIndex:10050},className:["bg-card text-card-foreground shadow-2xl border border-border",S?"rounded-xl p-5 max-w-[380px] min-w-[320px]":"rounded-t-xl p-5 w-full",k&&S?"text-center":""].join(" "),role:"dialog","aria-labelledby":"tour-tooltip-title",children:y})}function se(t){for(let s=Math.max(t,0);s<L.length;s++){const r=L[s]?.targetSelectors;if(r&&V(r))return s}return-1}function us(t){for(let s=Math.min(t,L.length-1);s>=0;s--){const r=L[s]?.targetSelectors;if(r&&V(r))return s}return-1}function ms(){return L.map((t,s)=>s).filter(t=>V(L[t].targetSelectors)!==null)}function ps(t){const s=ms(),r=s.indexOf(t)+1;return{stepNumber:r>0?r:1,totalSteps:Math.max(1,s.length),isFirstStep:s.length===0||s[0]===t}}function fs(t){const{action:s,index:r,status:a,type:n}=t;if(a===J.FINISHED||a===J.SKIPPED)return{soort:"afronden",skipped:a===J.SKIPPED};if(s===ye.CLOSE)return{soort:"afronden",skipped:!0};if(n===Y.STEP_AFTER){if(s===ye.PREV){const c=us(r-1);return{soort:"ga-naar",stepIndex:c===-1?0:c}
2}const i=se(r+1);return i===-1?{soort:"afronden",skipped:!1}:{soort:"ga-naar",stepIndex:i}}if(n===Y.TARGET_NOT_FOUND){const i=se(r+1);return i===-1?{soort:"afronden",skipped:!1}:{soort:"ga-naar",stepIndex:i}}return{soort:"negeren"}}function xs(t,s){return t.top===s.top&&t.left===s.left&&t.width===s.width&&t.height===s.height}function Ee(t){return new Promise(s=>t(r=>s(r)))}async function gs(t,s={}){const{timeoutMs:r=1e3,raf:a=requestAnimationFrame,now:n=Date.now}=s,i=n()+r;await Ee(a);let c=t();for(;n()<i;){await Ee(a);const l=t();if(xs(c,l))return;c=l}}const hs=10,bs="rgba(15, 23, 42, 0.45)";function ks(){const{t}=R(),{user:s}=ft(),{data:r}=Ae(),a=xt(),[n,i]=p.useState(!1),[c,l]=p.useState(0),[o,d]=p.useState(!1),[f,u]=p.useState(!1),m=Le($e,{directMeten:!0});p.useEffect(()=>{he(n)},[n]),p.useEffect(()=>()=>he(!1),[]);const x=p.useCallback(async g=>{if(s)try{const v={dossier_tour_completed:!0};g&&(v.tour_skipped_at=new Date().toISOString()),await gt.update(s.id,v)}catch(v){H.warn("tour.voortgang_opslaan_mislukt",v,{tour:"dossier"})}},[s]),S=p.useCallback(g=>{i(!1),d(!0),x(g).then(()=>{s&&a.invalidateQueries({queryKey:["profile",s.id]})})},[x,a,s]),b=p.useCallback(async g=>{const v=L[g],y=v?V(v.targetSelectors):null;y&&(y.scrollIntoView({behavior:"auto",inline:"center",block:m?"center":"start"}),await gs(()=>y.getBoundingClientRect())),l(g)},[m]),w=p.useCallback(()=>{if(n)return;let g=0;const v=25,y=setInterval(()=>{g++;const D=se(0);D!==-1?(clearInterval(y),u(!1),b(D).then(()=>i(!0))):g>=v&&(clearInterval(y),H.warn("tour.dossier_geen_zichtbaar_doel",{attempts:g}))},200);return()=>clearInterval(y)},[n,b]);p.useEffect(()=>o||!r||!s||r.dossier_tour_completed?void 0:w(),[r,s,w,o]),p.useEffect(()=>{const g=()=>{d(!1),w()};return window.addEventListener("epc:tour:start-dossier",g),()=>window.removeEventListener("epc:tour:start-dossier",g)},[w]),p.useEffect(()=>{ht()&&(d(!1),w())},[]);const O=p.useCallback(g=>{g.type===Y.TOOLTIP&&u(!0),g.type===Y.TARGET_NOT_FOUND&&H.warn("tour.dossier_stap_overgeslagen",{stepIndex:g.index});const v=fs(g);if(v.soort==="afronden"){S(v.skipped);return}v.soort==="ga-naar"&&(u(!1),b(v.stepIndex))},[S,b]),k=L.map((g,v)=>{const y=ps(v),D=Math.max(1,Math.ceil((y.totalSteps-y.stepNumber+1)*hs/60));return{...g,title:t(g.titleKey,{defaultValue:g.title}),content:t(g.contentKey,{defaultValue:g.content}),target:V(g.targetSelectors)??g.target,tourUi:{zichtbareTotaalStappen:y.totalSteps,zichtbareStapNummer:y.stepNumber,isEersteZichtbareStap:y.isFirstStep,resterendeMinuten:D,navigatieKlaar:f}}});return e.jsx(Mt,{steps:k,stepIndex:c,run:n,continuous:!0,onEvent:O,floatingOptions:{hideArrow:!m},tooltipComponent:cs,options:{primaryColor:"hsl(215 80% 35%)",overlayColor:bs,zIndex:1e4,arrowColor:"hsl(var(--card))",spotlightRadius:10,showProgress:!1,buttons:["back","primary","skip","close"],overlayClickAction:!1,dismissKeyAction:"close",blockTargetInteraction:!1,skipBeacon:!0,skipScroll:!0},styles:{tooltip:{padding:0}},locale:{back:t("tour.knop.vorige"),close:t("tour.knop.stoppen"),last:t("tour.knop.klaar"),next:t("tour.knop.volgende"),skip:t("tour.knop.stoppen")}})}const Fe=2e3;function vs(t,s){const[r,a]=p.useState("connecting"),n=p.useRef(0),i=p.useRef(s);p.useEffect(()=>{i.current=s},[s]);const c=p.useCallback(()=>{n.current=Date.now()},[]);return p.useEffect(()=>{if(!t){a("disconnected");return}return a("connecting"),bt.subscribeToTree(t,o=>{Date.now()-n.current<Fe||i.current?.(o)},o=>a(o))},[t]),{state:r,bumpLocalSave:c}}function js(t){const[s,r]=p.useState(!1),a=p.useRef(null),n=p.useRef(0),i=p.useCallback(()=>{n.current=Date.now()},[]),c=p.useCallback(()=>{r(!1)},[]);return p.useEffect(()=>{if(!t)return;let l=!1;(async()=>{const{data:d}=await X.from("dossiers").select("updated_at").eq("id",t).maybeSingle();if(l)return;const f=d?.updated_at??null;a.current=f})();const o=X.channel(`dossier-conflict-${t}`).on("postgres_changes",{event:"UPDATE",schema:"public",table:"dossiers",filter:`id=eq.${t}`},d=>{const f=d.new;if(!f?.updated_at)return;if(Date.now()-n.current<Fe){a.current=f.updated_at;return}a.current&&f.updated_at>a.current&&(H.warn("dossier_remote_conflict_detected",{dossier_id:t,previous_watermark:a.current,new_updated_at:f.updated_at}),r(!0)),a.current=f.updated_at}).subscribe();return()=>{l=!0,X.removeChannel(o)}},[t]),{hasRemoteUpdate:s,acknowledge:c,bumpLocalSave:i}}function ws(t,s){if(!s)return{kind:"choose-model"};const r=st(s);return t==="ipad"?r.includes("ipad")?{kind:"keyboard",model:s}:{kind:"not-possible",model:s,reason:"ipad-onbekend"}:t==="geen-ble"?{kind:"not-possible",model:s,reason:"geen-ble-browser"}:r.includes("laptop-android")?{kind:"ble",model:s}:{kind:"not-possible",model:s,reason:"geen-ble-route"}}function ys({model:t,onDone:s,onSkip:r}){const a=nt(),[n]=p.useState(()=>Date.now()),i=!!(a.lastMeasurement&&a.lastMeasurement.timestamp>n);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"inline-block rounded-full bg-primary/10 px-3 py-1 text-sm font-semibold text-primary",children:"Bluetooth koppelen"}),e.jsxs("h2",{className:"text-lg font-bold text-foreground",children:[t.brand," ",t.model]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Nog niet op eigen hardware getest. De koppeling volgt het Bluetooth-protocol van dit merk."}),a.connected?i?e.jsxs("div",{className:"space-y-2 rounded-xl border-2 border-primary bg-primary/10 p-4 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Ie,{className:"h-6 w-6 text-primary"}),e.jsx("span",{className:"text-lg font-bold text-primary",children:"Het werkt!"})]}),e.jsx("button",{onClick:s,className:"mt-2 w-full rounded-xl bg-primary px-4 py-3 text-base font-semibold text-white",children:"Klaar, begin met meten!"})]}):e.jsxs("div",{className:"space-y-2 rounded-xl border border-dashed p-4 text-center",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Druk op de meetknop van je laser"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Verbonden met ",a.deviceName,", wachten op een meting…"]})]}):e.jsxs("button",{onClick:()=>{a.connect()},disabled:a.busy,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-primary px-4 py-3 text-base font-semibold text-white",children:[e.jsx(Et,{className:"h-5 w-5"})," Koppelen"]}),!i&&e.jsx("button",{onClick:r,className:"w-full py-2 text-sm font-medium text-muted-foreground underline",children:"Overslaan, ik typ de waarden zelf"})]})}function Ns({model:t,onDone:s,onSkip:r}){const[a,n]=p.useState(null),[i,c]=p.useState(!1),l=i&&a!==null;return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"inline-block rounded-full bg-primary/10 px-3 py-1 text-sm font-semibold text-primary",children:"Toetsenbordmodus"}),e.jsxs("h2",{className:"text-lg font-bold text-foreground",children:[t.brand," ",t.model," op je iPad"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Status: volgens Leica's eigen documentatie, nog niet door ons op hardware getest."}),e.jsxs("ol",{className:"list-inside list-decimal space-y-1 text-sm text-foreground",children:[e.jsx("li",{children:"Zet toetsenbordmodus aan via het Bluetooth-menu op het toestel (spreadsheet/keyboard-modus)."}),e.jsx("li",{children:"Stel Enter in als scheidingsteken en de komma als decimaalteken."}),e.jsx("li",{children:"Koppel het toestel via Instellingen → Bluetooth op je iPad."})]}),e.jsx("div",{onKeyDown:o=>o.key==="Enter"&&c(!0),children:e.jsx(ns,{value:a,onChange:n,label:"Testmeting",autoFocus:!0})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Tip: het schermtoetsenbord van de iPad verdwijnt zolang een toetsenbord-toestel gekoppeld is. Je krijgt het terug via de toetsenbordknop in de snelkoppelingsbalk."}),l?e.jsxs("div",{className:"space-y-2 rounded-xl border-2 border-primary bg-primary/10 p-4 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Ie,{className:"h-6 w-6 text-primary"}),e.jsx("span",{className:"text-lg font-bold text-primary",children:"Het werkt!"})]}),e.jsx("button",{onClick:s,className:"mt-2 w-full rounded-xl bg-primary px-4 py-3 text-base font-semibold text-white",children:"Klaar, begin met meten!"})]}):e.jsx("button",{onClick:r,className:"w-full py-2 text-sm font-medium text-muted-foreground underline",children:"Overslaan, ik typ de waarden zelf"})]})}const Ss={"ipad-onbekend":"Deze laser werkt nog niet op iPad: hij heeft geen toetsenbordmodus en Web Bluetooth bestaat niet op iPad, in geen enkele browser. Gebruik hem op een laptop of Android-toestel, of typ de waarden zelf in.","geen-ble-browser":"Deze browser ondersteunt geen Bluetooth-koppeling. Gebruik Chrome of Edge, of typ de waarden zelf in.","geen-ble-route":"Voor dit model is er geen bevestigde Bluetooth-koppeling, enkel toetsenbordmodus op iPad. Typ de waarden zelf in, of kies hierboven een ander model."};function _s({model:t,reason:s,onFinish:r}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h2",{className:"text-lg font-bold text-foreground",children:[t.brand," ",t.model]}),e.jsx("p",{className:"text-foreground",children:Ss[s]}),e.jsx("button",{onClick:r,className:"w-full rounded-xl border-2 border-border py-3 px-4 text-base font-semibold text-foreground",children:"Begrepen"})]})}function Es(t){return t.routes.some(s=>s.teststatus==="getest")?"getest":t.routes.some(s=>s.teststatus==="volgens fabrikant")?"volgens fabrikant":"niet getest"}function Ts(t){return t==="niet getest"?"nog niet getest":t}function Cs({onNext:t,onSkip:s}){return e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-info-subtle",children:e.jsx(Tt,{className:"h-10 w-10 text-primary"})}),e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Laser koppelen?"}),e.jsxs("p",{className:"text-base leading-relaxed text-muted-foreground",children:["Koppel je laser en je hoeft ",e.jsx("strong",{children:"nooit meer handmatig afmetingen in te tikken"}),"."]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Werkt met Bosch en Leica DISTO via Bluetooth. Op iPad enkel met een Leica DISTO in toetsenbordmodus (D810 touch, X3, X4 of S910)."}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:s,className:"flex-1 rounded-xl border-2 border-border px-4 py-3 text-base font-semibold text-muted-foreground",children:"Overslaan"}),e.jsxs("button",{onClick:t,className:"flex flex-1 items-center justify-center gap-2 rounded-xl bg-primary px-4 py-3 text-base font-semibold text-white",children:["Koppelen ",e.jsx(Ke,{className:"h-5 w-5"})]})]})]})}function Ds({brands:t,selectedModel:s,onSelect:r,onSkip:a}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"inline-block rounded-full bg-primary/10 px-3 py-1 text-sm font-semibold text-primary",children:"Stap 1 van 2"}),e.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Welke laser heb je?"}),e.jsx("div",{className:"max-h-[400px] space-y-3 overflow-y-auto",children:t.map(n=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:n}),Re.filter(i=>i.brand===n).map(i=>e.jsxs("button",{onClick:()=>r(i),className:`mb-1 min-h-[48px] w-full rounded-lg border-2 px-4 py-3 text-left transition-all ${s?.id===i.id?"border-primary bg-primary/10":"border-border hover:border-border"}`,children:[e.jsxs("span",{className:"font-medium text-foreground",children:[i.brand," ",i.model]}),i.id!=="other"&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",Ts(Es(i)),")"]})]},i.id))]},n))}),e.jsx("button",{onClick:a,className:"w-full py-2 text-sm font-medium text-muted-foreground",children:"Overslaan"})]})}function Os({onComplete:t,onSkip:s}){const[r,a]=p.useState(0),[n,i]=p.useState(rt()),[c]=p.useState(()=>at()),l=m=>{i(m),ot(m),a(2)},o=()=>{fe(!0),s()},d=()=>{fe(),t()},f=[...new Set(Re.map(m=>m.brand))],u=n?ws(c,n):null;return e.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/50 p-4 pb-[calc(1rem+env(safe-area-inset-bottom,0px))] sm:items-center",children:e.jsxs("div",{className:"relative w-full max-w-md rounded-2xl bg-card p-6 text-card-foreground shadow-2xl",children:[e.jsx("button",{onClick:o,"aria-label":"Sluiten",className:"absolute right-4 top-4 flex h-8 w-8 items-center justify-center rounded-full bg-muted",children:e.jsx(Pe,{className:"h-4 w-4 text-muted-foreground"})}
2),r===0&&e.jsx(Cs,{onNext:()=>a(1),onSkip:o}),r===1&&e.jsx(Ds,{brands:f,selectedModel:n,onSelect:l,onSkip:o}),r===2&&u?.kind==="ble"&&e.jsx(ys,{model:u.model,onDone:d,onSkip:o}),r===2&&u?.kind==="keyboard"&&e.jsx(Ns,{model:u.model,onDone:d,onSkip:o}),r===2&&u?.kind==="not-possible"&&e.jsx(_s,{model:u.model,reason:u.reason,onFinish:o})]})})}function zs(t,s,r=!0){return t||!r?!1:s?s.dossier_tour_completed===!0:!0}function Ls(t,s,r,a){const n=q(s,t.key),i=t.key in a?a[t.key]:null,c=Bt(n,i);return{key:t.key,label:t.label,path:t.path,iconName:t.icon_name,status:c.status,aantal:t.key in r?r[t.key]:null,open:i}}function Z(t,s,r,a,n,i){const c=r.map(l=>Ls(l,a,n,i));return{key:t,label:s,items:c,klaar:c.filter(l=>l.status==="afgerond").length}}function $s(t,s,r={},a={}){const n=ae(t).filter(u=>It(u,s));if(kt("volgordeV2")){const u=new Map;for(const m of n)u.set(m.phase,[...u.get(m.phase)??[],m]);return[...u.entries()].map(([m,x])=>Z(`fase-${m}`,x[0].phase_label,x,s,r,a))}const i=Ve(t),c=new Set,l=[];for(const u of i){const m=Be(u.key,t);m.forEach(x=>c.add(x.key)),m.length>0&&l.push(Z(u.key,u.label,m,s,r,a))}const o=n.filter(u=>!c.has(u.key)),d=o.filter(u=>u.phase<=1),f=o.filter(u=>u.phase>1);return d.length>0&&l.unshift(Z("voorbereiding","Voorbereiding",d,s,r,a)),f.length>0&&l.push(Z("afronding","Afronding",f,s,r,a)),l}function Rs(t,s,r,a){const n={...r};for(const l of t)for(const o of l.items)o.status==="ingevuld_met_open_punten"&&(n[o.key]="bezig");const i=l=>{for(const o of t){const d=o.items.find(f=>f.key===l);if(d)return{item:d,groep:o}}return null};if(a){const l=Ve(s),o=l.findIndex(d=>d.key===a);for(let d=o;d!==-1&&d<l.length;d++){const f=Ne(Be(l[d].key,s),n);if(f){const u=i(f.key);if(u)return u}}}const c=Ne(ae(s),n);return c?i(c.key):null}const As=["gevels","dak","vloer","ruimtes"];function Ms(t){const s=new Set,r=[];for(const a of t)for(const n of a.items){if(s.has(n.key))continue;s.add(n.key);const i=n.aantal??0;As.includes(n.key)&&n.status!=="afgerond"&&i===0&&r.push(n)}return r}function Ps(t){const s=new Set;let r=0;for(const a of t)for(const n of a.items)s.has(n.key)||n.status==="afgerond"||(s.add(n.key),r+=n.open??0);return r}function Is(t){const s=new Set;for(const r of t)for(const a of r.items)a.status!=="afgerond"&&!Vt.has(a.key)&&s.add(a.key);return s.size}const Ks={N:"Noord",NO:"Noordoost",O:"Oost",ZO:"Zuidoost",Z:"Zuid",ZW:"Zuidwest",W:"West",NW:"Noordwest"};function Ge(t){return t?Ks[t]??t:"Zonder oriëntatie"}function ie(t){return t==null||Number.isNaN(t)?"oppervlakte onbekend":`${t.toLocaleString("nl-BE",{minimumFractionDigits:1,maximumFractionDigits:1})} m²`}function le(t){return t==="afgerond"?"bevestigd":"ingevuld"}function Te(t,s){return t.source==="geodata"?"schatting":s}function Vs(t,s,r,a,n){const i=`${a}/gevels`,c=new Map,l=le(r);for(const o of t){const d=o.orientation??"",f=c.get(d)??[];f.push({id:o.id,label:o.veka_naam||Bs(o.veka_category)||`Gevel ${f.length+1}`,detail:ie(Kt(o)),herkomst:n?n(o,l):l,verwacht:!1,path:i}),c.set(d,f)}for(const o of it(s))!o.visible||c.has(o.orientation)||c.set(o.orientation,[{id:`verwacht-${o.orientation}`,label:o.label,detail:"nog niet ingevoerd",herkomst:"schatting",verwacht:!0,path:i}]);return We(c).map(([o,d])=>({key:o||"geen",label:Ge(o),tegels:d}))}function Bs(t){if(!t)return null;const s=t.toLowerCase().replace(/vlak$/,"");return s.charAt(0).toUpperCase()+s.slice(1)}const Ce=["N","NO","O","ZO","Z","ZW","W","NW",""];function We(t){return[...t.entries()].sort(([s],[r])=>{const a=Ce.indexOf(s),n=Ce.indexOf(r);return(a===-1?99:a)-(n===-1?99:n)})}function Fs(t,s,r,a){const n=`${r}/dak`,i=new Map,c=le(s);for(const l of t){const o=l.orientation??"",d=i.get(o)??[],f=l.helling_exact_deg!=null?`${l.helling_exact_deg}°`:l.helling?`${l.helling}°`:null;d.push({id:l.id,label:l.veka_naam||(l.roof_type?`Dak ${l.roof_type}`:`Dakvlak ${d.length+1}`),detail:[ie(l.area_m2),f].filter(Boolean).join(" · "),herkomst:a?a(l,c):c,verwacht:!1,path:n}),i.set(o,d)}return We(i).map(([l,o])=>({key:l||"geen",label:Ge(l),tegels:o}))}const De={kelder:"Kelder",gelijkvloers:"Gelijkvloers",verdieping_1:"Eerste verdieping",verdieping_2:"Tweede verdieping",verdieping_3:"Derde verdieping",zolder:"Zolder"};function Gs(t,s,r){const a=`${r}/ruimtes`,n=le(s),i=new Map;for(const l of t){const o=l.floor_level??"gelijkvloers",d=i.get(o)??[];d.push({id:l.id,label:l.name||`Ruimte ${d.length+1}`,detail:ie(l.floor_area_m2),herkomst:n,verwacht:!1,path:a}),i.set(o,d)}const c=Object.keys(De);return[...i.entries()].sort(([l],[o])=>c.indexOf(l)-c.indexOf(o)).map(([l,o])=>({key:l,label:De[l]??l,tegels:o}))}function Ws(t){const s={schatting:0,ingevuld:0,bevestigd:0};for(const r of t)for(const a of r.tegels)s[a.herkomst]+=1;return s}const Us=p.lazy(()=>rs(()=>import("./PerceelKaart-aRiF2bC7.js"),__vite__mapDeps([0,1,2,3]))),Zs={schatting:"border-dashed border-herkomst-schatting bg-herkomst-schatting-subtle",ingevuld:"border-herkomst-ingevuld/60 bg-herkomst-ingevuld-subtle",bevestigd:"border-herkomst-bevestigd/60 bg-herkomst-bevestigd-subtle"},Oe={schatting:"bg-herkomst-schatting",ingevuld:"bg-herkomst-ingevuld",bevestigd:"bg-herkomst-bevestigd"};function ze({tegel:t,onOpen:s,rustig:r=!1}){return r?e.jsxs("button",{type:"button",onClick:()=>s(t),className:`flex min-w-[128px] items-start gap-2 rounded-md border bg-card px-3 py-2 text-left transition-colors hover:bg-muted focus-visible:outline-hidden focu
2s-visible:ring-2 focus-visible:ring-ring ${t.herkomst==="schatting"?"border-dashed border-herkomst-schatting":"border-border"}`,"data-herkomst":t.herkomst,children:[e.jsx("span",{className:`mt-1.5 size-2 shrink-0 rounded-full ${Oe[t.herkomst]}`,"aria-hidden":!0}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-sm font-medium",children:t.label}),e.jsx("span",{className:"block truncate text-xs text-muted-foreground tabular-nums",children:t.detail})]})]}):e.jsxs("button",{type:"button",onClick:()=>s(t),className:`flex min-w-[140px] flex-col gap-1.5 rounded-lg border p-3 text-left transition-shadow hover:shadow-md focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring ${Zs[t.herkomst]}`,"data-herkomst":t.herkomst,children:[e.jsx("span",{className:`h-1.5 w-10 rounded-full ${Oe[t.herkomst]}`,"aria-hidden":!0}),e.jsx("span",{className:"truncate text-sm font-semibold",children:t.label}),e.jsx("span",{className:"truncate text-xs text-muted-foreground tabular-nums",children:t.detail})]})}function ee({groepen:t,leeg:s,onOpen:r,rustig:a=!1}){return t.length===0?e.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:s}):a?e.jsx("div",{className:"@container p-4",children:e.jsx("div",{className:"flex flex-col divide-y divide-border",children:t.map(n=>e.jsxs("section",{"aria-label":n.label,className:"flex flex-col gap-2 py-3 first:pt-0 last:pb-0 @xl:flex-row @xl:items-start @xl:gap-4",children:[e.jsxs("h3",{className:"text-sm font-medium @xl:w-28 @xl:shrink-0 @xl:pt-2",children:[n.label," ",e.jsxs("span",{className:"font-normal text-muted-foreground tabular-nums",children:["(",n.tegels.length,")"]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n.tegels.map(i=>e.jsx(ze,{tegel:i,onOpen:r,rustig:!0},i.id))})]},n.key))})}):e.jsx("div",{className:"flex flex-col gap-4 p-4",children:t.map(n=>e.jsxs("section",{"aria-label":n.label,children:[e.jsxs("h3",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:[n.label," ",e.jsxs("span",{className:"tabular-nums normal-case tracking-normal",children:["(",n.tegels.length,")"]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n.tegels.map(i=>e.jsx(ze,{tegel:i,onOpen:r},i.id))})]},n.key))})}const ne=320,re=220;function Hs(t){const s=t.flat(),r=s.map(m=>m.x),a=s.map(m=>m.y),n=Math.min(...r),i=Math.min(...a),c=Math.max(...r)-n||1,l=Math.max(...a)-i||1,o=16,d=Math.min((ne-2*o)/c,(re-2*o)/l),f=(ne-c*d)/2,u=(re-l*d)/2;return m=>`${((m.x-n)*d+f).toFixed(1)},${((m.y-i)*d+u).toFixed(1)}`}function qs({verdieping:t,onOpen:s}){const r=Hs([t.omtrek,...t.ruimtes.map(a=>a.polygon)]);return e.jsxs("button",{type:"button",onClick:s,className:"rounded-lg border border-border bg-card p-2 text-left hover:shadow-md focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsxs("svg",{viewBox:`0 0 ${ne} ${re}`,className:"w-full",role:"img","aria-label":t.label,children:[e.jsx("polygon",{points:t.omtrek.map(r).join(" "),className:"fill-herkomst-ingevuld-subtle stroke-herkomst-ingevuld",strokeWidth:"2"}),t.ruimtes.map(a=>{const n=a.polygon.map(r),[i,c]=n.length?n.map(l=>l.split(",").map(Number)).reduce(([l,o],[d,f])=>[l+d/n.length,o+f/n.length],[0,0]):[0,0];return e.jsxs("g",{children:[e.jsx("polygon",{points:n.join(" "),className:"fill-card/70 stroke-border",strokeWidth:"1"}),e.jsx("text",{x:i,y:c,textAnchor:"middle",className:"fill-foreground text-[10px] font-medium",children:a.label})]},a.id)})]}),e.jsx("p",{className:"px-1 pt-1 text-xs font-medium text-muted-foreground",children:t.label})]})}function Qs({gevels:t,daken:s,ruimtes:r,verdiepingen:a,gps:n,dossierPath:i,startZicht:c="gevels",extraZichten:l=[]}){const{t:o}=R(),d=Q("werkruimteV2"),f=B(),[u,m]=p.useState(c),x=k=>f(k.path),S=Ws([...t,...s,...r]),b=["perceel","gevels","daken","plattegrond","3d",...l.map(k=>k.key)],w=l.find(k=>k.key===u),O=a.filter(k=>k.omtrek.length>=3);return e.jsxs("section",{className:"intrede flex min-h-0 flex-col gap-3","aria-label":o("werkruimte.gebouwbeeld"),"data-tour":"gebou
2wbeeld",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("div",{className:"inline-flex rounded-full border border-border bg-card p-0.5",role:"tablist","aria-label":o("werkruimte.gebouwbeeld"),children:b.map(k=>e.jsx("button",{role:"tab",type:"button","aria-selected":u===k,onClick:()=>m(k),className:`rounded-full px-3 py-1.5 text-[13px] font-medium transition-colors ${u===k?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:l.find(g=>g.key===k)?.label??o(`werkruimte.zicht.${k}`)},k))}),e.jsxs("div",{className:`ml-auto flex gap-3 text-xs text-muted-foreground ${d?"max-md:hidden":""}`,children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("i",{className:"size-2.5 rounded-sm bg-herkomst-schatting"}),o("werkruimte.legende.schatting")]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("i",{className:"size-2.5 rounded-sm bg-herkomst-ingevuld"}),o("werkruimte.legende.ingevuld")]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("i",{className:"size-2.5 rounded-sm bg-herkomst-bevestigd"}),o("werkruimte.legende.bevestigd")]})]})]}),e.jsxs("div",{className:"relative min-h-[320px] flex-1 overflow-auto rounded-lg border border-border bg-card","data-zicht":u,children:[u==="gevels"&&e.jsx(ee,{groepen:t,leeg:o("werkruimte.nogNiet"),onOpen:x,rustig:d}),u==="daken"&&e.jsx(ee,{groepen:s,leeg:o("werkruimte.nogNiet"),onOpen:x,rustig:d}),u==="plattegrond"&&(O.length>0?e.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2",children:O.map(k=>e.jsx(qs,{verdieping:k,onOpen:()=>f(`${i}/plattegrond`)},k.key))}):e.jsx(ee,{groepen:r,leeg:o("werkruimte.nogNiet"),onOpen:x,rustig:d})),u==="perceel"&&(n?e.jsx("div",{className:"h-[320px]",children:e.jsx(p.Suspense,{fallback:e.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:o("werkruimte.perceel.laden")}),children:e.jsx(Us,{lat:n.lat,lng:n.lng})})}):e.jsx("div",{className:"grid min-h-[320px] place-items-center p-6 text-center",children:e.jsxs("div",{children:[e.jsx("div",{className:"mx-auto mb-3 grid size-16 place-items-center rounded-2xl bg-muted text-muted-foreground",children:e.jsx(Ct,{className:"size-7","aria-hidden":!0})}),e.jsx("p",{className:"text-sm font-medium",children:o("werkruimte.perceel.geenCoordinaten")}),e.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:o("werkruimte.perceel.geenCoordinatenHulp")})]})})),w&&w.render(),u==="3d"&&e.jsx("div",{className:"grid h-full min-h-[320px] place-items-center p-6 text-center",children:e.jsxs("div",{children:[e.jsx("div",{className:"mx-auto mb-3 grid size-16 place-items-center rounded-2xl bg-muted text-muted-foreground",children:e.jsx(ke,{className:"size-7","aria-hidden":!0})}),e.jsx("p",{className:"font-semibold",children:o("werkruimte.drie.titel")}),e.jsx("p",{className:"mb-3 text-sm text-muted-foreground",children:o("werkruimte.drie.uitleg")}),e.jsxs(C,{onClick:()=>f(`${i}/3d-model`),children:[e.jsx(ke,{className:"size-4","aria-hidden":!0}),o("werkruimte.drie.openen")]})]})})]}),e.jsxs("p",{className:"flex flex-wrap justify-between gap-2 text-[13px] text-muted-foreground",children:[e.jsx("span",{className:"tabular-nums",children:o("werkruimte.telling",S)}),e.jsx("span",{children:o("werkruimte.tikOmTeOpenen")})]})]})}const $=56,te=5;function Ue({pct:t}){const s=($-te)/2,r=2*Math.PI*s;return e.jsxs("div",{className:"relative size-14 shrink-0",role:"img","aria-label":`${t}%`,children:[e.jsxs("svg",{viewBox:`0 0 ${$} ${$}`,className:"size-full -rotate-90",children:[e.jsx("circle",{cx:$/2,cy:$/2,r:s,fill:"none",className:"stroke-muted",strokeWidth:te}),e.jsx("circle",{cx:$/2,cy:$/2,r:s,fill:"none",className:"stroke-primary transition-[stroke-dasharray] duration-300",strokeWidth:te,strokeLinecap:"round",strokeDasharray:`${r*t/100} ${r}`})]}),e.jsxs("span",{className:"absolute inset-0 grid place-items-center text-[13px] font-semibold tabular-nums",children:[t,"%"]})]})}function Ys({status:t}){const s=t==="afgerond"||t==="ingevuld_met_open_punten"?100:t==="bezig"||t==="later_aanvullen"?50:0,r=t==="afgerond"?"stroke-success":t==="niet_begonnen"?"stroke-herkomst-schatting":"stroke-warning",a=9,n=2*Math.PI*a;return e.jsxs("svg",{viewBox:"0 0 22 22",className:"size-[22px] shrink-0 -rotate-90","aria-hidden":!0,
2children:[e.jsx("circle",{cx:"11",cy:"11",r:a,fill:"none",className:"stroke-muted",strokeWidth:"3"}),s>0&&e.jsx("circle",{cx:"11",cy:"11",r:a,fill:"none",className:r,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:`${n*s/100} ${n}`})]})}function Xs({groepen:t,volgende:s,voortgangPct:r,openSecties:a,openVelden:n=null,dossierPath:i,blokkers:c=[],showSections:l=!0,compactOpGsm:o=!1}){const{t:d}=R(),f=B(),u=Q("werkruimteV2");return e.jsxs(e.Fragment,{children:[o&&e.jsx(Js,{volgende:s,voortgangPct:r,openSecties:a,dossierPath:i}),e.jsxs("aside",{className:`intrede flex flex-col bg-card pb-4 ${o?"max-md:hidden":""}`,"aria-label":d("werkruimte.watNogMoet"),"data-tour":"dossier-phases",children:[e.jsxs("div",{className:"flex items-center gap-3.5 border-b border-border px-5 py-4",children:[e.jsx(Ue,{pct:r}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-[15px] font-semibold",children:d("werkruimte.watNogMoet")}),e.jsxs("p",{className:"text-[13px] text-muted-foreground",children:[d("werkruimte.sectiesOpen",{count:a}),n!=null&&n>0?` · ${d("werkruimte.veldenOpen",{count:n})}`:""]})]})]}),s?e.jsxs("button",{type:"button",onClick:()=>f(`${i}/${s.item.path}`),className:"mx-5 mt-4 flex items-center gap-3 rounded-lg bg-primary px-3.5 py-3 text-left text-primary-foreground transition-[filter] hover:brightness-110 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:u?"block text-xs opacity-85":"block text-[11px] uppercase tracking-wider opacity-80",children:d("werkruimte.verder")}),e.jsx("span",{className:"block truncate text-[15px] font-semibold",children:d(`sectie.${s.item.key}`,{defaultValue:s.item.label})}),e.jsxs("span",{className:"block truncate text-xs opacity-85",children:[d(`werkruimte.locatie.${s.groep.key}`,{defaultValue:s.groep.label}),s.item.open!=null&&s.item.open>0?` · ${d("werkruimte.veldenOpen",{count:s.item.open})}`:""]})]}),e.jsx(oe,{className:"size-5 shrink-0","aria-hidden":!0})]}):e.jsx("p",{className:"mx-5 mt-4 rounded-lg bg-success-subtle px-3.5 py-3 text-sm font-medium text-success-strong",children:d("werkruimte.allesKlaar")}),c.length>0&&e.jsxs("div",{className:"mx-5 mt-2 flex items-start gap-2 rounded-lg bg-warning-subtle px-3 py-2.5 text-[13px] text-warning-strong","data-testid":"blokkers",children:[e.jsx(Me,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("b",{className:"font-semibold",children:d("werkruimte.blokkers.titel")})," ",d("werkruimte.blokkers.nogLeeg",{secties:c.map(m=>d(`sectie.${m.key}`,{defaultValue:m.label})).join(", ")})]})]}),l&&e.jsx("div",{className:"flex flex-col gap-1 px-3 pb-4 pt-2",children:t.map(m=>e.jsxs("section",{className:"pt-2","aria-label":d(`werkruimte.locatie.${m.key}`,{defaultValue:m.label}),children:[e.jsxs("h3",{className:u?"flex items-center justify-between px-2 pb-1 text-sm font-semibold":"flex items-center justify-between px-2 pb-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:[e.jsx("span",{children:d(`werkruimte.locatie.${m.key}`,{defaultValue:m.label})}),e.jsxs("span",{className:u?"font-normal tabular-nums text-muted-foreground":"tabular-nums normal-case tracking-normal",children:[m.klaar,"/",m.items.length]})]}),e.jsx("ul",{className:"flex flex-col",children:m.items.map(x=>{const S=lt(x.iconName),b=d(`sectie.${x.key}`,{defaultValue:x.label}),w=x.status==="afgerond";return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>f(`${i}/${x.path}`),className:"flex h-10 w-full items-center gap-2.5 rounded-md px-2 text-left text-sm transition-colors hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(Ys,{status:x.status}),e.jsx(S,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),e.jsx("span",{className:`min-w-0 flex-1 truncate ${w?"text-muted-foreground":""}`,children:b}),e.jsx("span",{className:`shrink-0 text-xs tabular-nums ${!w&&(x.aantal===0||(x.open??0)>0)?"font-medium text-warning-strong":"text-muted-foreground"}`,children:w?d("werkruimte.klaar"):x.aantal===0?d("werkruimte.leeg"):x.open!=null&&x.open>0?d("werkruimte.veldenOpen",{count:x.open}):x.aantal!=null&&x.aantal>0?d("werkruimte.elementen",{count:x.aantal}):""}),e.jsx(Ke,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})},`${m.key}-${x.key}`)})})]},m.key))})]})]})}function Js({volgende:t,voortgangPct:s,openSecties:r,dossierPath:a}){const{t:n}=R(),i=B();if(!t)return e.jsx("p",{"data-testid":"verder-kaart","data-tour":"dossier-phases",className:"mt-3 border-y border-success-border bg-success-subtle px-4 py-3 text-sm font-medium text-success-strong md:hidden",children:n("werkruimte.allesKlaar")});const c=n(`sectie.${t.item.key}`,{defaultValue:t.item.label});return e.jsxs("button",{type:"button",onClick:()=>i(`${a}/${t.item.path}`),className:"mt-3 flex w-full items-center gap-3 border-y border-border bg-card px-4 py-3 text-left focus-visible:outline-hidden focu
2s-visible:ring-2 focus-visible:ring-ring md:hidden","data-testid":"verder-kaart","data-tour":"dossier-phases",children:[e.jsx(Ue,{pct:s}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-base font-semibold",children:n("werkruimte.verderNaar",{sectie:c})}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:n("werkruimte.sectiesOpen",{count:r})})]}),e.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-full bg-primary text-primary-foreground",children:e.jsx(oe,{className:"size-5","aria-hidden":!0})})]})}const en={kelder:"Kelder",gelijkvloers:"Gelijkvloers",verdieping_1:"Eerste verdieping",verdieping_2:"Tweede verdieping",verdieping_3:"Derde verdieping",zolder:"Zolder"};function tn(t){return Array.isArray(t)?t.filter(s=>typeof s=="object"&&s!==null&&typeof s.x=="number"&&typeof s.y=="number"):[]}function sn(t){return Array.isArray(t)?t.filter(s=>typeof s=="object"&&s!==null&&Array.isArray(s.polygon)):[]}function Fn(){const{t}=R(),s=Q("werkruimteV2"),r=Q("volgordeV2"),a=Ft();p.useEffect(()=>{if(s)return Gt()},[s]);const{id:n}=tt(),i=B(),c=vt(n),l=jt(n),o=Wt(n),d=Ut(n),f=Zt(n),{hasRemoteUpdate:u,acknowledge:m,bumpLocalSave:x}=js(n),{data:S,isFetched:b,isError:w,fetchStatus:O}=Ae(),k=b||w||O==="paused",[g,v]=p.useState(!1);p.useEffect(()=>{v(zs(dt(),S,k))},[S,k]);const{mutate:y}=wt(),{bumpLocalSave:D}=vs(n,()=>{c.refetch(),l.refetch(),o.refetch(),d.refetch()}),h=c.data??null,E=`/dossier/${n}`,N=p.useMemo(()=>({...ct(),...h?.features??{}}),[h?.features]),M=p.useMemo(()=>h?.section_status??{},[h?.section_status]),T=Ht(n,M),z=o.data,j=l.data,P=as(n),{openPerSectie:A,geladen:de}=qt(n,h,N),_=p.useMemo(()=>{const G=z?.walls??[],W=z?.roofs??[],pe=z?.rooms??[],He={gevels:G.length,dak:W.length,ruimtes:pe.length,vloer:j?.counts.floors??0,verwarming:j?.counts.heating??0,sww:j?.counts.sww??0,ventilatie:j?.counts.ventilation??0,hernieuwbaar:j?.counts.pv??0,fotos:j?.counts.photos??0},I=$s(N,T,He,A),qe=r?null:(n?Qt(n):null)??Yt(N,T),Qe=Rs(I,N,T,qe),Ye=ae(N),Xe=j?Xt
2({hasClientName:!!h?.client_name,features:N,rooms:j.rooms.count,walls:j.counts.walls,roofs:j.counts.roofs,floors:j.counts.floors,heating:j.counts.heating,sww:j.counts.sww,ventilation:j.counts.ventilation,pv:j.counts.pv,airtightness:j.counts.airtightness,photos:j.counts.photos}):{},Je=Jt(T,es(Ye,T),Xe,A),et=(z?.floors??[]).map(K=>({key:K.id,label:en[K.floor_level??"gelijkvloers"]??K.floor_level??"Verdieping",omtrek:tn(K.polygon_points),ruimtes:sn(K.room_polygons).map(U=>({id:U.room_id,label:U.custom_label??U.room_type??"",polygon:U.polygon}))}));return{groepen:I,volgende:Qe,pct:Je,open:Is(I),openVelden:Ps(I),blokkers:Ms(I),gevels:Vs(G,N,q(T,"gevels"),E,Te),daken:Fs(W,q(T,"dak"),E,Te),ruimtes:Gs(pe,q(T,"ruimtes"),E),verdiepingen:et}},[z,j,N,T,h,E,n,A,r]),ce=j!==void 0&&de,ue=h?.completion_percentage;if(p.useEffect(()=>{!n||!h||!ce||_.pct!==ue&&(D(),x(),y({id:n,patch:{completion_percentage:_.pct}}))},[n,h,ce,_.pct,ue,y,D,x]),!h||!n)return e.jsx(xe,{children:e.jsx("div",{className:"mx-auto max-w-5xl px-4 py-6 md:px-6",children:e.jsx(mt,{variant:"detail"})})});const F=h,Ze=F.latitude!=null&&F.longitude!=null?{lat:F.latitude,lng:F.longitude}:null,me=N.construction_year;return e.jsxs(xe,{children:[e.jsx(os,{hasRemoteUpdate:u,onAcknowledge:m}),g&&e.jsx(Os,{onComplete:()=>v(!1),onSkip:()=>v(!1)}),e.jsx(ts,{dossierId:n,sectionKey:"overzicht",title:t("werkruimte.rail.overzicht"),header:!1,inspector:!1,openPerSectie:A,openPuntenGeladen:de,mobielTitel:`${h.address_street??""} ${h.address_number??""}`.trim(),mobielMenu:e.jsxs(ut,{onSelect:()=>i(`${E}/algemeen`),children:[e.jsx(ve,{className:"size-4","aria-hidden":!0}),t("werkruimte.mobiel.klant")]}),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("header",{className:`flex flex-wrap items-start gap-x-6 gap-y-3 border-b border-border bg-card md:px-6 ${s?"px-4 py-3 md:py-4":"px-5 py-4"}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:`typo-h1 md:truncate ${s?"max-md:sr-only":"truncate"}`,children:[h.address_street," ",h.address_number,", ",h.address_postal_code," ",h.address_city]}),e.jsxs("p",{className:`mt-0.5 flex flex-wrap gap-x-4 gap-y-1 text-muted-foreground ${s?"text-sm":"text-[13px]"}`,children:[s&&e.jsxs("span",{className:"md:hidden",children:[h.address_postal_code," ",h.address_city]}),e.jsx("span",{children:h.client_name}),e.jsxs("span",{children:[t(`dossier.gebouwtype.${h.building_type}`,{defaultValue:h.building_type}),me?e.jsxs(e.Fragment,{children:[" · ",e.jsx("b",{className:"font-medium text-foreground",children:me})]}):null]})]}),s&&e.jsx("div",{className:"mt-1.5 md:hidden",children:e.jsx(ge,{className:Se[h.status],children:t(`dossier.status.${h.status}`)})})]}),e.jsxs("div",{className:`ml-auto flex items-center gap-2 ${s?"max-md:hidden":""}`,children:[e.jsx(ge,{className:Se[h.status],children:t(`dossier.status.${h.status}`)}),e.jsxs(C,{variant:"outline",size:"sm",className:s?"max-md:hidden":void 0,onClick:()=>i(`${E}/algemeen`),children:[e.jsx(ve,{className:"size-4","aria-hidden":!0}),t("werkruimte.klant")]}),s&&a&&e.jsxs(C,{variant:"outline",size:"sm",onClick:ss,"data-testid":"overzicht-gereedschap",children:[e.jsx(Dt,{className:"size-4","aria-hidden":!0}),t("werkruimte.kop.gereedschap")]})]})]}),e.jsx("div",{className:s?"@container":"flex min-w-0 flex-col",children:e.jsxs("div",{className:s?"grid min-w-0 @5xl:grid-cols-[minmax(0,1fr)_22rem]":"contents",children:[e.jsx("div",{className:s?"@5xl:col-start-2 @5xl:row-start-1 @5xl:border-l @5xl:border-border":"contents",children:e.jsx(Xs,{groepen:_.groepen,volgende:_.volgende,voortgangPct:_.pct,openSecties:_.open,openVelden:_.openVelden,dossierPath:E,blokkers:_.blokkers,showSections:!1,compactOpGsm:s})}),e.jsxs("div",{className:`flex min-w-0 flex-col gap-4 p-4 md:p-6 ${s?"@5xl:col-start-1 @5xl:row-start-1":""}`,children:[e.jsx(Qs,{gevels:_.gevels,daken:_.daken,ruimtes:_.ruimtes,verdiepingen:_.verdiepingen,gps:Ze,dossierPath:E,startZicht:_.gevels.some(G=>G.tegels.some(W=>!W.verwacht))?"gevels":"perceel"}),e.jsxs("div",{className:s?"grid items-start gap-4 md:grid-cols-2":"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[e.jsxs("h2",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[e.jsx(Ot,{className:`size-4 text-muted-foreground ${s?"max-md:hidden":""}`,"aria-hidden":!0}),t("werkruimte.afspraak")]}),e.jsx(is,{dossierId:h.id})]}),f.data&&P!==void 0&&e.jsx(zt,{dossierId:h.id,photos:f.data,isolatie:P,features:h.features})]})]})]})})]})}),e.jsx(Pt,{}),e.jsx(ks,{})]})}
2export{Fn 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.