1import{a as mn}from"./chunk-BG6WV3KW.js";import{a as pn}from"./chunk-SZWYEPQG.js";import"./chunk-BB2QMEZA.js";import{a as cn}from"./chunk-7NIJOPZR.js";import"./chunk-WC2KRKOK.js";import"./chunk-ZPWAFK5W.js";import{a as je}from"./chunk-T36LH7G6.js";import{d as ln,i as sn}from"./chunk-XCZL6A3K.js";import"./chunk-OX5MHQ2O.js";import{a as dn}from"./chunk-LN3AAEXA.js";import"./chunk-ISMWR2HP.js";import{c as an}from"./chunk-2IIH3EEI.js";import{a as Vt}from"./chunk-4HPR7LQM.js";import{a as nn,b as on}from"./chunk-VMXKUAWR.js";import{a as Fe,b as ce,c as Me,d as Be,e as Ae,f as Oe,g as en,i as tn,j as Le}from"./chunk-MXGNCFRQ.js";import{a as Mt}from"./chunk-R3G4ZQOM.js";import{K as Kt,L as Ht,P as zt,Q as Jt,R as Ut,ca as oe,ga as Qt,ia as et,ja as Xt,la as Zt,m as $t}from"./chunk-GR7UVCTI.js";import{A as Bt,C as At,D as Ot,E as Lt,F as jt,G as Nt,H as Gt,I as Y,J as We,L as Qe,M as qt,N as Yt,O as Wt,R as Xe,S as Ze,r as Dt,s as Ft,z as De}from"./chunk-QMLTAY6B.js";import"./chunk-SCNXV6NK.js";import"./chunk-4DZ3SULJ.js";import"./chunk-IVNRVRIL.js";import"./chunk-LDS7DT3J.js";import"./chunk-3ZFXNTQ3.js";import"./chunk-A34E4I4C.js";import{a as rn}from"./chunk-UUJVRX65.js";import"./chunk-5T4S6PXQ.js";import"./chunk-VAOZPW7J.js";import"./chunk-Z7476GR7.js";import"./chunk-V6YZQMFN.js";import{a as vt,b as bt}from"./chunk-Y3AZC3HR.js";import{a as Ct}from"./chunk-NOT75SZ7.js";import"./chunk-CLSS6BWO.js";import"./chunk-VPMJHFQY.js";import"./chunk-LLBB3WF6.js";import"./chunk-NKFRWZ4U.js";import{d as yt}from"./chunk-OHYYJJTI.js";import{a as Pt}from"./chunk-SDKVQGOK.js";import{b as It}from"./chunk-4SAM5PWY.js";import{i as Rt}from"./chunk-NVVIWNP4.js";import{a as Tt}from"./chunk-BM4ZWDFR.js";import"./chunk-2ROSWDJI.js";import{a as Ie}from"./chunk-PYX3ALJS.js";import"./chunk-CR66LWIL.js";import"./chunk-EUG24UY6.js";import{a as Ve}from"./chunk-Q5ENNLIN.js";import"./chunk-3XQQVIVE.js";import"./chunk-C5MVMQHI.js";import{a as wt}from"./chunk-3WQ3ER3Y.js";import"./chunk-J5QVRNVG.js";import{b as kt,e as Ee,j as Te,s as St,v as Re,x as Et}from"./chunk-SFIP4PYL.js";import{a as ke}from"./chunk-BQXBZNSG.js";import{c as xt}from"./chunk-ARPSV4CN.js";import"./chunk-HWSKWFK6.js";import"./chunk-CFMEKB3S.js";import{a as ht}from"./chunk-EJ6MUWLF.js";import"./chunk-JO6NCRH5.js";import"./chunk-OLQMAZXA.js";import"./chunk-BUPZIJN6.js";import{a as Pe}from"./chunk-LOQ7C2L2.js";import"./chunk-HELN4YUO.js";import"./chunk-TDEDFCDK.js";import"./chunk-F2X3VGZZ.js";import{a as L}from"./chunk-LB3X5EEC.js";import{m as Se}from"./chunk-VS5ACRJZ.js";import{$ as ne,da as ie}from"./chunk-CDDZ63PW.js";import{f as be,h as ye,i as we}from"./chunk-DPW4HH75.js";import"./chunk-2GFUZ2HS.js";import{a as gt,q as ft,t as ve}from"./chunk-T5KFAHAS.js";import{$b as s,Ac as q,D as ue,Da as A,Db as v,Dc as mt,Ea as R,Ec as ut,Fa as ge,Fc as _t,Ga as y,Jc as he,K as st,Kc as xe,Nb as M,Ob as g,Pb as se,Qa as H,Qb as de,Rb as fe,Sb as I,Uc as Z,Vb as f,Wb as O,Wc as ee,Yb as D,Zb as F,Zc as K,_b as a,ac as h,ba as dt,bb as ct,dc as Ye,ec as x,f as le,gb as d,ha as T,jc as u,kc as l,ob as G,od as C,pa as p,pb as pt,pd as te,qa as m,qd as Ce,uc as z,vc as X,wa as _e,wc as J,xb as V,xc as _,yc as E,zc as P}from"./chunk-NZECY5HQ.js";import{a as b,b as w,k as $}from"./chunk-J4XOFOAH.js";var Sn=()=>["/templates","reports"],En=()=>[0,1,2,3,4],Tn=()=>({standalone:!0});function Rn(i,t){if(i&1){let e=x();a(0,"div",8),h(1,"i",11),a(2,"div")(3,"div",12),_(4,"De rapporten konden niet worden geladen."),s(),a(5,"div",13),_(6,"Controleer je verbinding en probeer het opnieuw."),s()(),a(7,"p-button",14),u("onClick",function(){p(e);let o=l();return m(o.load())}),s()()}i&2&&(d(7),g("outlined",!0))}function Pn(i,t){i&1&&h(0,"p-skeleton",15)}function In(i,t){i&1&&(a(0,"div",9),D(1,Pn,1,0,"p-skeleton",15,O),s()),i&2&&(d(),F(xe(0,En)))}function Vn(i,t){if(i&1){let e=x();a(0,"p-button",21),u("onClick",function(){p(e);let o=l(3);return m(o.applyStatusFilter(null))}),s()}i&2&&g("text",!0)}function Dn(i,t){if(i&1){let e=x();a(0,"div",16)(1,"p-select",19),u("ngModelChange",function(o){let r;p(e);let c=l(2);return m(c.applyStatusFilter((r=o)!==null&&r!==void 0?r:null))}),s(),v(2,Vn,1,1,"p-button",20),s()}if(i&2){let e=l(2);d(),g("options",e.statusOptions)("showClear",!0)("ngModel",e.statusFilter())("ngModelOptions",xe(5,Tn)),d(),f(e.statusFilter()!==null?2:-1)}}function Fn(i,t){i&1&&(a(0,"tr")(1,"th")(2,"div",22),h(3,"i",23),_(4," Rapport "),s()(),a(5,"th",24)(6,"div",22),h(7,"i",25),_(8," Sjabloon "),s()(),a(9,"th",26)(10,"div",22),h(11,"i",27),_(12," Status "),s()(),a(13,"th",28)(14,"div",22),h(15,"i",29),_(16," Aangemaakt "),s()(),h(17,"th",30),s())}function Mn(i,t){if(i&1){let e=x();a(0,"tr",31),u("click",function(){let o=p(e).$implicit,r=l(2);return m(r.open(o))}),a(1,"td")(2,"div",32),_(3),s(),a(4,"div",33),h(5,"i",34),a(6,"span",35),_(7),s()()(),a(8,"td"),_(9),a(10,"span",36),_(11),s()(),a(12,"td")(13,"span",37),h(14,"p-tag",38),s()(),a(15,"td"),_(16),Z(17,"date"),Z(18,"date"),s(),a(19,"td")(20,"p-button",39),u("onClick",function(o){let r=p(e).$implicit;return l(2).confirmDelete(r,o),m(o.stopPropagation())}),s()()()}if(i&2){let e,n=t.$implicit,o=l(2);d(3),E(n.displayTitle||n.title),d(2),I(o.sourceIcon(n)),g("pTooltip",o.sourceLabel(n)),d(2),E((e=n.sourceName)!==null&&e!==void 0?e:o.sourceLabel(n)),d(2),P(" ",n.templateName," "),d(2),P("\xB7 v",n.templateVersion,""),d(3),g("icon",n.status===o.ReportStatus.Generating?"pi pi-spinner pi-spin":void 0)("value",o.statusLabel(n))("severity",o.statusSeverity(n))("rounded",!0),d(2),q(" ",ee(17,17,n.createdAt,"d MMMM")," \xB7 ",ee(18,20,n.createdAt,"HH:mm")," "),d(4),g("text",!0)("rounded",!0)("loading",o.deletingId()===n.id)("disabled",o.deletingId()!==null&&o.deletingId()!==n.id
1)}}function Bn(i,t){if(i&1&&h(0,"app-empty-state",41),i&2){let e=l(3);g("button",e.clearFilterButton)}}function An(i,t){if(i&1&&h(0,"app-empty-state",42),i&2){let e=l(3);g("button",e.createButton)}}function On(i,t){if(i&1&&(a(0,"tr")(1,"td",40),v(2,Bn,1,1,"app-empty-state",41)(3,An,1,1,"app-empty-state",42),s()()),i&2){let e=l(2);d(2),f(e.statusFilter()!==null?2:3)}}function Ln(i,t){if(i&1){let e=x();v(0,Dn,3,6,"div",16),a(1,"p-card",17)(2,"p-table",18),u("onLazyLoad",function(o){p(e);let r=l();return m(r.onLazyLoad(o))}),v(3,Fn,18,0,"ng-template",null,0,K)(5,Mn,21,23,"ng-template",null,1,K)(7,On,4,1,"ng-template",null,2,K),s()()}if(i&2){let e=l();f(e.reports().length>0||e.statusFilter()!==null?0:-1),d(2),g("value",e.reports())("lazy",!0)("paginator",e.total()>e.pageSize)("rows",e.pageSize)("totalRecords",e.total())("first",e.first())}}var jn=[0,1,2,3].map(i=>({value:i,label:ce[i]})),Nn=1e4,$n=90,Ne=class i{reportsService=T(Le);messageService=T(ie);confirmationService=T(ne);router=T(ye);route=T(be);destroyRef=T(_e);ReportStatus=Fe;statusOptions=jn;pageSize=15;page=y(null);loading=y(!0);loadFailed=y(!1);createDialogVisible=y(!1);deletingId=y(null);refreshing=y(!1);statusFilter=y(null);reports=C(()=>this.page()?.items??[]);total=C(()=>this.page()?.total??0);first=C(()=>(this.currentPage()-1)*this.pageSize);currentPage=y(1);hasGenerating=C(()=>this.reports().some(t=>t.status===0));pollSubscription=null;pollTicks=0;requestedPage=null;constructor(){this.load(),te(()=>{this.hasGenerating()?this.startGeneratingPoll():this.stopGeneratingPoll()}),this.destroyRef.onDestroy(()=>this.stopGeneratingPoll())}load(){this.loading.set(!0),this.loadFailed.set(!1),this.requestedPage=this.currentPage(),this.fetch().subscribe({next:t=>{this.page.set(t),this.loading.set(!1)},error:()=>{this.loading.set(!1),this.loadFailed.set(!0),this.toastError("De rapporten konden niet worden geladen.")}})}refresh(){this.refreshing()||(this.refreshing.set(!0),this.fetch().subscribe({next:t=>{this.refreshing.set(!1),this.deletingId()===null&&this.page.set(t)},error:()=>{this.refreshing.set(!1)}}))}fetch(){return this.reportsService.getPage(this.currentPage(),this.pageSize,{status:this.statusFilter()})}onLazyLoad(t){let e=t.rows??this.pageSize,n=Math.floor((t.first??0)/e)+1;n!==this.requestedPage&&(this.currentPage.set(n),this.load())}applyStatusFilter(t){this.statusFilter.set(t),this.currentPage.set(1),this.load()}startGeneratingPoll(){this.pollSubscription||(this.pollTicks=0,this.pollSubscription=ue(Nn).pipe(L(this.destroyRef)).subscribe(()=>{if(++this.pollTicks>$n){this.stopGeneratingPoll();return}this.refresh()}))}stopGeneratingPoll(){this.pollSubscription?.unsubscribe(),this.pollSubscription=null}open(t){this.router.navigate([t.id],{relativeTo:this.route})}clearFilterButton={label:"Filter wissen",icon:"pi pi-filter-slash",severity:"secondary",onClick:()=>this.applyStatusFilter(null)};createButton={label:"Nieuw rapport",icon:"pi pi-plus",onClick:()=>this.openCreateDialog()};statusLabel(t){return ce[t.status]}statusSeverity(t){return Me[t.status]}sourceLabel(t){return Be[t.sourceKind]}sourceIcon(t){return Ae[t.sourceKind]}sourceLink(t){return t.sourceKind===0&&t.dataContainerId?["/containers",t.dataContainerId]:t.sourceKind===1&&t.meetingId?["/meetings",t.meetingId]:null}failureText(t){return Oe(t.failureMessage)}openCreateDialog(){this.createDialogVisible.set(!0)}onCreated(t){this.router.navigate([t.id],{relativeTo:this.route})}confirmDelete(t,e){this.confirmationService.confirm({target:e.currentTarget,header:"Rapport verwijderen",message:`"${t.title}" wordt verwijderd. Dit kan niet ongedaan worden gemaakt.`,icon:"pi pi-exclamation-triangle text-sm text-muted-color",closable:!1,closeOnEscape:!0,acceptButtonProps:{label:"Verwijderen",severity:"danger"},rejectButtonProps:{label:"Annuleren",severity:"secondary"},accept:()=>this.deleteReport(t)})}deleteReport(t){this.deletingId.set(t.id),this.reportsService.delete(t.id).subscribe({next:()=>{this.deletingId.set(null),this.page.update(e=>e===null?e:w(b({},e),{items:e.items.filter(n=>n.id!==t.id),total:Math.max(0,e.total-1)})),this.refresh(),this.messageService.add({severity:"success",summary:"Verwijderd",detail
1:`"${t.title}" is verwijderd.`,life:3e3,styleClass:"p-no-icon"})},error:()=>{this.deletingId.set(null),this.toastError(`"${t.title}" kon niet worden verwijderd.`)}})}toastError(t){this.messageService.add({severity:"error",summary:"Fout",detail:t,life:4e3,styleClass:"p-no-icon"})}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=V({type:i,selectors:[["app-reports-overview"]],features:[he([ie,ne])],decls:11,vars:5,consts:[["header",""],["body",""],["emptymessage",""],[1,"flex","w-full","max-w-[1200px]","flex-col","justify-center"],["title","Rapporten","subtitle","De documenten die je kantoor heeft gegenereerd.",3,"showSubtitle"],[1,"flex","flex-row","gap-4","flex-wrap"],["label","Sjablonen beheren","severity","secondary","icon","pi pi-cog",3,"routerLink"],["label","Nieuw rapport","icon","pi pi-plus",3,"onClick"],[1,"flex","flex-col","items-center","gap-4","rounded-xl","border","border-surface-200","py-16","text-center","dark:border-surface-700"],[1,"flex","flex-col","gap-2.5"],[3,"visibleChange","created","visible"],[1,"pi","pi-exclamation-triangle","text-2xl!","text-muted-color"],[1,"text-color","font-medium"],[1,"text-muted-color","mt-1","text-sm"],["label","Opnieuw proberen","icon","pi pi-refresh","severity","secondary",3,"onClick","outlined"],["height","4.75rem","borderRadius","12px"],[1,"mb-5","flex","flex-wrap","items-center","gap-3"],["styleClass","secondary"],["dataKey","id","styleClass","p-datatable-last-row-border-b-none",3,"onLazyLoad","value","lazy","paginator","rows","totalRecords","first"],["styleClass","w-56","appendTo","body","optionLabel","label","optionValue","value","placeholder","Alle statussen",3,"ngModelChange","options","showClear","ngModel","ngModelOptions"],["label","Filter wissen","size","small","severity","secondary",3,"text"],["label","Filter wissen","size","small","severity","secondary",3,"onClick","text"],[1,"flex","items-center","gap-2"],[1,"pi","pi-file-edit","text-slate-400"],[1,"w-64"],[1,"pi","pi-clone","text-slate-400"],[1,"w-36"],[1,"pi","pi-info-circle","text-slate-400"],[1,"w-40"],[1,"pi","pi-clock","text-slate-400"],[1,"w-14"],[1,"hover:bg-surface-50!","dark:hover:bg-surface-800!","cursor-pointer",3,"click"],[1,"text-color"],[1,"text-muted-color","mt-0.5","flex","items-center","gap-1.5","text-xs"],["tooltipPosition","right",1,"text-[0.7rem]!",3,"pTooltip"],[1,"truncate"],[1,"text-xs"],[1,"inline-flex","items-center","gap-2"],["styleClass","p-tag-small",3,"icon","value","severity","rounded"],["icon","pi pi-trash","size","small","severity","danger","ariaLabel","Rapport verwijderen","pTooltip","Rapport verwijderen","tooltipPosition","left",3,"onClick","text","rounded","loading","disabled"],["colspan","5",1,"border-b-0!"],["title","Geen rapporten gevonden.","description","Geen enkel rapport heeft deze status.",3,"button"],["title","Nog geen rapporten.","description","Klik op de knop hieronder om je eerste rapport te genereren",3,"button"]],template:function(e,n){e&1&&(a(0,"div",3),h(1,"p-toast")(2,"p-confirmDialog"),a(3,"app-page-title",4)(4,"div",5),h(5,"p-button",6),a(6,"p-button",7),u("onClick",function(){return n.openCreateDialog()}),s()()(),v(7,Rn,8,1,"div",8)(8,In,3,1,"div",9)(9,Ln,9,7),s(),a(10,"app-create-report-dialog",10),_t("visibleChange",function(r){return ut(n.createDialogVisible,r)||(n.createDialogVisible=r),r}),u("created",function(r){return n.onCreated(r)}),s()),e&2&&(d(3),g("showSubtitle",!0),d(2),g("routerLink",xe(4,Sn)),d(2),f(n.loadFailed()?7:n.loading()?8:9),d(3),mt("visible",n.createDialogVisible))},dependencies:[Re,Ee,Te,ve,we,Se,Rt,Pe,sn,ln,Ie,Ve,ke,je,Tt,dn,pn,wt],encapsulation:2,changeDetection:0})};var Kn=["host"],j=class i{value=R("");disabled=R(!1);label=R("Tekst bewerken");focusPoint=R(null);valueChange=A();host=G.required("host");constructor(){te(()=>{let t=this.value(),e=this.host().nativeElement;e.textContent!==t&&(e.textContent=t)}),H(()=>this.placeCaret())}onInput(){this.valueChange.emit(this.host().nativeElement.textContent??"")}onEnter(t){t.preventDefault(),this.host().nativeElement.blur()}placeCaret(){let t=this.host().nativeElement;t.focus({preventScroll:!0});let e=this.focusPoint(),n=window.getSelection();if(n===null)return;let o=document.createRange(),r=e!==null&&"caretPositionFromPoint"in document?document.caretPositionFromPoint(e.x,e.y):null;r!==null&&t.contains(r.offsetNode)?o.setStart(r.offsetNode,r.offset):(o.selectNodeContents(t),o.collapse(!1)),o.collapse(!0),n.removeAllRanges(),n.addRange(o)}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=V({type:i,selectors:[["app-inline-text-editor"]],viewQuery:function(e,n){e&1&&z(n.host,Kn,5),e&2&&X()},inputs:{value:[1,"value"],disabled:[1,"disabled"],label:[1,"label"],focusPoint:[1,"focusPoint"]},outputs:{valueChange:"valueChange"},decls:2,vars:2,consts:[["host",""],["role","textbox",1,"block","cursor-text","outline-none",3,"input","keydown.enter"]],template:function(e,n){if(e&1){let o=x();a(0,"span",1,0),u("input",function(){return p(o),m(n.onInput())})("keydown.enter",function(c){return p(o),m(n.onEnter(c))}),s()}e&2&&M("contenteditable",n.disabled()?null:"plaintext-only")("aria-label",n.label())},encapsulation:2,changeDetection:0})};function Hn(i,t){i&1&&(a(0,"span",7),_(1," Label\u2026 "),s())}function zn(i,t){i&1&&(a(0,"span",7),_(1," Waarde\u2026 "),s())}function Jn(i,t){i&1&&(a(0,"span",7),_(1," eenheid "),s())}function Un(i,t){if(i&1){let e=x();a(0,"div",2)(1,"div",5)(2,"app-inline-text-editor",6),u("valueChange",function(o){let r=p(e).$index,c=l();return m(c.setLabel(r,o))}),s(),v(3,Hn,2,0,"span",7),s(),a(4,"div",8)(5,"div",9)(6,"app-inline-text-editor",10),u("valueChange",function(o){let r=p(e).$index,c=l();return m(c.setValue(r,o))}),s(),v(7,zn,2,0,"span",7),s(),a(8,"div",11)(9,"app-inline-text-editor",12),u("valueChange",function(o){let r=p(e).$index,c=l();return m(c.setUnit(r,o))}),s(),v(10,Jn,2,0,"span",7),s()(),a(11,"div",13)(12,"button",14),u("mousedown",function(o){return p(e),m(o.preventDefault())})("click",function(){let o=p(e).$index,r=l();return m(r.moveCard(o,-1))}),h(13,"i",15),s(),a(14,"button",16),u("mousedown",function(o){return p(e),m(o.preventDefault())})("click",function(){let o=p(e).$index,r=l();return m(r.moveCard(o,1))}),h(15,"i",17),s(),a(16,"button",18),u("mousedown",function(o){return p(e),m(o.preventDefault())})("click",function(){let o=p(e).$index,r=l();return m(r.removeCard(o))}),h(17,"i",19),s()()()}if(i&2){let e=t.$implicit,n=t.$index,o=t.$count,r=l();d(2),g("value",e.label)("disabled",r.disabled())("focusPoint",n===0?r.focusPoint():null),d(),f(e.label===""?3:-1),d(3),g("value",e.value)("disabled",r.disabled()),d(),f(e.value===""?7:-1),d(2),g("value",e.unit)("disabled",r.disabled()),d(),f(e.unit===""?10:-1),d(2),g("disabled",r.disabled()||n===0),d(2),g("disabled",r.disabled()||n===o-1),d(2),g("title",r.canRemove()?"Kaart verwijderen":"Er moet \xE9\xE9n kaart overblijven")("disabled",!r.canRemove())}}var Gn=1,qn=10,Yn={label:"",value:"",unit:null,tone:"neutral",factKey:null};function Wn(i){try{let t=JSON.parse(i);return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function tt(i){return typeof i=="string"?i:""}function Qn(i){return Array.isArray(i)?i.filter(t=>t!==null&&typeof t=="object"&&!Array.isArray(t)):[]}var $e=class i{content=R.required();disabled=R(!1);focusPoint=R(null);contentChange=A();host=T(ge);draft=Ce(()=>Wn(this.content()));rawCards=C(()=>Qn(this.draft().cards));cards=C(()=>this.rawCards().map(t=>({label:tt(t.label),value:tt(t.value),unit:tt(t.unit)})));columns=C(()=>`repeat(${Math.min(Math.max(this.cards().length,1),4)}, minmax(0, 1fr))`);canAdd=C(()=>!this.disabled()&&this.rawCards().length<qn);canRemove=C(()=>!this.disabled()&&this.rawCards().length>Gn);addButtonClass=C(()=>{let t="mt-2 inline-flex cursor-pointer items-center gap-1.5 text-[0.85em] hover:underline disabled:pointer-events-none disabled:no-underline disabled:opacity-25";return this.cards().length===0?`${t} opacity-60`:`${t} opacity-0 transition-opacity focus-visible:opacity-70 group-hover/cards:opacity-60`});constructor(){H({read:()=>this.focusClickedField()})}setLabel(t,e){this.patchCard(t,{label:e})}setValue(t,e){this.patchCard(t,{value:e})}setUnit(t,e){this.patchCard(t,{unit:e.trim()===""?null:e})}addCard(){this.canAdd()&&this.writeCards([...this.rawCards(),b({},Yn)])}removeCard(t){this.canRemove()&&this.writeCards(this.rawCards().filter((e,n
1)=>n!==t))}moveCard(t,e){let n=[...this.rawCards()],o=t+e;if(this.disabled()||o<0||o>=n.length)return;let[r]=n.splice(t,1);n.splice(o,0,r),this.writeCards(n)}patchCard(t,e){this.writeCards(this.rawCards().map((n,o)=>o===t?b(b({},n),e):n))}writeCards(t){let e=w(b({},this.draft()),{cards:t});this.draft.set(e),this.contentChange.emit(JSON.stringify(e))}focusClickedField(){let t=this.host.nativeElement,e=this.focusPoint(),o=(e===null?null:document.elementFromPoint(e.x,e.y))?.closest('[role="textbox"]')??null,r=o!==null&&t.contains(o)?o:t.querySelector('[role="textbox"]');if(r===null)return;r.focus({preventScroll:!0});let c=window.getSelection();if(c===null)return;let k=e!==null&&"caretPositionFromPoint"in document?document.caretPositionFromPoint(e.x,e.y):null,S=document.createRange();k!==null&&r.contains(k.offsetNode)?(S.setStart(k.offsetNode,k.offset),S.collapse(!0)):(S.selectNodeContents(r),S.collapse(!1)),c.removeAllRanges(),c.addRange(S)}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=V({type:i,selectors:[["app-highlight-cards-editor"]],inputs:{content:[1,"content"],disabled:[1,"disabled"],focusPoint:[1,"focusPoint"]},outputs:{contentChange:"contentChange"},decls:7,vars:6,consts:[[1,"group/cards"],[1,"grid","gap-3"],[1,"group/card","relative","min-w-0"],["type","button",3,"mousedown","click","title","disabled"],[1,"pi","pi-plus","text-[9px]!"],[1,"relative","[&_[role=textbox]]:min-h-[1.2em]"],["label","Label bewerken",3,"valueChange","value","disabled","focusPoint"],["aria-hidden","true",1,"pointer-events-none","absolute","inset-0","whitespace-nowrap","opacity-40"],[1,"mt-1","flex","flex-wrap","items-baseline","gap-x-1.5"],[1,"relative","min-w-0","[&_[role=textbox]]:min-h-[1.2em]","[&_[role=textbox]]:min-w-[8ch]"],["label","Waarde bewerken",3,"valueChange","value","disabled"],[1,"relative","[&_[role=textbox]]:min-h-[1.2em]","[&_[role=textbox]]:min-w-[8ch]"],["label","Eenheid bewerken",3,"valueChange","value","disabled"],[1,"absolute","-top-1","right-0","flex","items-center","gap-1.5","opacity-0","transition-opacity","focus-within:opacity-100","group-hover/card:opacity-100"],["type","button","title","Naar voren","aria-label","Kaart naar voren verplaatsen",1,"cursor-pointer","opacity-45","hover:opacity-90","disabled:pointer-events-none","disabled:opacity-15",3,"mousedown","click","disabled"],[1,"pi","pi-chevron-left","text-[10px]!"],["type","button","title","Naar achteren","aria-label","Kaart naar achteren verplaatsen",1,"cursor-pointer","opacity-45","hover:opacity-90","disabled:pointer-events-none","disabled:opacity-15",3,"mousedown","click","disabled"],[1,"pi","pi-chevron-right","text-[10px]!"],["type","button","aria-label","Kaart verwijderen",1,"cursor-pointer","opacity-45","hover:opacity-90","disabled:pointer-events-none","disabled:opacity-15",3,"mousedown","click","title","disabled"],[1,"pi","pi-times","text-[10px]!"]],template:function(e,n){e&1&&(a(0,"div",0)(1,"div",1),D(2,Un,18,14,"div",2,O),s(),a(4,"button",3),u("mousedown",function(r){return r.preventDefault()})("click",function(){return n.addCard()}),h(5,"i",4),_(6,"Kaart toevoegen "),s()()),e&2&&(d(),se("grid-template-columns",n.columns()),d(),F(n.cards()),d(2),I(n.addButtonClass()),g("title",n.canAdd()?"Kaart toevoegen":"Meer dan tien kaarten passen niet in dit blok")("disabled",!n.canAdd()))},dependencies:[j],encapsulation:2,changeDetection:0})};var Xn=["root"],Zn=["line"];function ei(i,t){if(i&1){let e=x();a(0,"app-inline-text-editor",15),u("valueChange",function(o){p(e);let r=l().$index,c=l(2);return m(c.setText(r,o))}),s()}if(i&2){let e=l().$implicit,n=l(2);g("value",e)("disabled",n.disabled())("focusPoint",n.activePoint())}}function ti(i,t){if(i&1){let e=x();a(0,"span",16),u("mousedown",function(o){p(e);let r=l().$index,c=l(2);return m(c.activate(r,o))}),_(1),s()}if(i&2){let e=l().$implicit;d(),E(e)}}function ni(i,t){if(i&1){let e=x();a(0,"button",17),u("mousedown",function(o){p(e);let r=l(3);return m(r.hold(o))})("click",function(){p(e);let o=l().$index,r=l(2);return m(r.movePoint(o,-1))}),h(1,"i",18),s()}if(i&2){let e=l(3);g("disabled",e.disabled())}}function ii(i,t){if(i&1){let e=x();a(0,"button",19),u("mousedown",function(o){p(e);let r=l(3);return m(r.hold(o))})("click",function(){p(e);let o=l().$index,r=l(2);return m(r.movePoint(o,1))}),h(1,"i",20),s()}if(i&2){let e=l(3);g("disabled",e.disabled())}}function oi(i,t){if(i&1){let e=x();a(0,"li",null,1)(2,"div",7),v(3,ei,1,3,"app-inline-text-editor",8)(4,ti,2,1,"span",9),a(5,"span",10),v(6,ni,2,1,"button",11)(7,ii,2,1,"button",12),a(8,"button",13),u("mousedown",function(o){p(e);let r=l(2);return m(r.hold(o))})("click",function(){let o=p(e).$index,r=l(2);return m(r.removePoint(o))}),h(9,"i",14),s()()()()}if(i&2){let e=t.$index,n=t.$index,o=t.$count,r=l(2);d(3),f(r.activeIndex()===e?3:4),d(2),I(r.activeIndex()===e?"flex opacity-100":"flex group-hover/point:opacity-100 group-focus-within/point:opacity-100"),d(),f(n!==0?6:-1),d(),f(n!==o-1?7:-1),d(),g("disabled",r.disabled())}}
1function ri(i,t){if(i&1&&(a(0,"ul",3),D(1,oi,10,6,"li",null,O),s()),i&2){let e=l();d(),F(e.rows())}}function nt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ai(i){if(typeof i=="string")return i;let t=nt(i)?i.text:null;return typeof t=="string"?t:""}var Ke=class i{content=R.required();disabled=R(!1);focusPoint=R(null);contentChange=A();root=G.required("root");lines=pt("line");activeIndex=y(null);activePoint=y(null);parsed=C(()=>{try{let t=JSON.parse(this.content());return nt(t)?t:{}}catch{return{}}});items=C(()=>{let t=this.parsed().items;return Array.isArray(t)?t:[]});rows=C(()=>this.items().map(ai));constructor(){H(()=>this.openClickedPoint())}openClickedPoint(){let t=this.focusPoint();if(this.rows().length===0){this.keepFocus();return}let e=t===null?-1:this.lines().findIndex(n=>{let o=n.nativeElement.getBoundingClientRect();return t.y>=o.top&&t.y<=o.bottom});this.activePoint.set(t),this.activeIndex.set(e===-1?0:e)}activate(t,e){this.disabled()||(e.preventDefault(),this.keepFocus(),this.activePoint.set({x:e.clientX,y:e.clientY}),this.activeIndex.set(t))}setText(t,e){this.emit(this.items().map((n,o)=>o!==t?n:typeof n=="string"?{text:e,tone:"neutral",factKey:null}:w(b({},nt(n)?n:{}),{text:e})))}addPoint(){this.keepFocus();let t=[...this.items(),{text:"",tone:"neutral",factKey:null}];this.activePoint.set(null),this.activeIndex.set(t.length-1),this.emit(t)}removePoint(t){this.keepFocus();let e=this.items().filter((n,o)=>o!==t);this.activePoint.set(null),this.activeIndex.set(e.length===0?null:Math.min(t,e.length-1)),this.emit(e)}movePoint(t,e){let n=[...this.items()],o=t+e;o<0||o>=n.length||(this.keepFocus(),[n[t],n[o]]=[n[o],n[t]],this.activePoint.set(null),this.activeIndex.set(o),this.emit(n))}hold(t){t.preventDefault()}onFocusOut(t){let e=t.relatedTarget;e instanceof Node&&this.root().nativeElement.contains(e)&&t.stopPropagation()}keepFocus(){this.root().nativeElement.focus({preventScroll:!0})}emit(t){this.contentChange.emit(JSON.stringify(w(b({},this.parsed()),{items:t})))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=V({type:i,selectors:[["app-key-points-editor"]],viewQuery:function(e,n){e&1&&(z(n.root,Xn,5),z(n.lines,Zn,5)),e&2&&X(2)},inputs:{content:[1,"content"],disabled:[1,"disabled"],focusPoint:[1,"focusPoint"]},outputs:{contentChange:"contentChange"},decls:7,vars:4,consts:[["root",""],["line",""],["tabindex","-1",1,"group/list","outline-none",3,"focusout"],[1,"m-0","list-disc","space-y-1","pl-5"],["type","button",1,"mt-1","inline-flex","cursor-pointer","items-center","gap-1.5","transition-opacity","hover:underline",3,"mousedown","click","disabled"],[1,"pi","pi-plus","text-[0.65em]!"],[1,"text-[0.85em]"],[1,"group/point","relative","flex","items-start","gap-2","pr-14"],["label","Punt bewerken",1,"min-w-0","flex-1",3,"value","disabled","focusPoint"],[1,"min-h-[1em]","min-w-0","flex-1","cursor-text"],[1,"absolute","top-0","right-0","items-center","gap-1","opacity-0","transition-opacity"],["type","button","title","Omhoog","aria-label","Punt omhoog",1,"cursor-pointer","p-0.5","leading-none","opacity-50","transition-opacity","hover:opacity-100",3,"disabled"],["type","button","title","Omlaag","aria-label","Punt omlaag",1,"cursor-pointer","p-0.5","leading-none","opacity-50","transition-opacity","hover:opacity-100",3,"disabled"],["type","button","title","Verwijderen","aria-label","Punt verwijderen",1,"cursor-pointer","p-0.5","leading-none","opacity-50","transition-opacity","hover:opacity-100",3,"mousedown","click","disabled"],[1,"pi","pi-times","text-[0.7em]!"],["label","Punt bewerken",1,"min-w-0","flex-1",3,"valueChange","value","disabled","focusPoint"],[1,"min-h-[1em]","min-w-0","flex-1","cursor-text",3,"mousedown"],["type","button","title","Omhoog","aria-label","Punt omhoog",1,"cursor-pointer","p-0.5","leading-none","opacity-50","transition-opacity","hover:opacity-100",3,"mousedown","click","disabled"],[1,"pi","pi-chevron-up","text-[0.7em]!"],["type","button","title","Omlaag","aria-label","Punt omlaag",1,"cursor-pointer","p-0.5","leading-none","opacity-50","transition-opacity","hover:opacity-100",3,"mousedown","click","disabled"],[1,"pi","pi-chevron-down","text-[0.7em]!"]],template:function(e,n){if(e&1){let o=x();a(0,"div",2,0),u("focusout",function(c){return p(o),m(n.onFocusOut(c))}),v(2,ri,3,0,"ul",3),a(3,"button",4),u("mousedown",function(c){return p(o),m(n.hold(c))})("click",function(){return p(o),m(n.addPoint())}),h(4,"i",5),a(5,"span",6),_(6,"Punt toevoegen"),s()()()}e&2&&(d(2),f(n.rows().length>0?2:-1),d(),I(n.rows().length===0?"opacity-60":"opacity-0 group-hover/list:opacity-60 group-focus-within/list:opacity-60"),g("disabled",n.disabled()))},dependencies:[j],encapsulation:2,changeDetection:0})};function li(i,t){i&1&&(a(0,"span",3),_(1," Het advies in \xE9\xE9n zin\u2026 "),s())}function si(i,t){if(i&1){let e=x();a(0,"app-inline-text-editor",11),u("valueChange",function(o){p(e);let r=l();return m(r.setRationale(o))}),s()}if(i&2){let e=l();g("value",e.rationale())("disabled",e.disabled())("focusPoint",e.pointOf("rationale"))}}function di(i,t){if(i&1){let e=x();a(0,"span",12),u("mousedown",function(o){p(e);let r=l();return m(r.open("rationale",o))})("focus",function(){p(e);let o=l();return m(o.open("rationale",null))}),_(1),s()}if(i&2){let e=l();M("tabindex",e.disabled()?null:0)("aria-label",e.rationale()===""?"Toelichting toevoegen":null),d(),E(e.rationale())}}function ci(i,t){i&1&&(a(0,"span",3),_(1," Waarom, in gewone taal\u2026 "),s())}function pi(i,t){if(i&1){let e=x();a(0,"app-inline-text-editor",13),u("valueChange",function(o){p(e);let r=l();return m(r.setAction(o))}),s()}if(i&2){let e=l();g("value",e.action())("disabled",e.disabled())("focusPoint",e.pointOf("action"))}}function mi(i,t){if(i&1){let e=x();a(0,"span",12),u("mousedown",function(o){p(e);let r=l();return m(r.open("action",o))})("focus",function(){p(e);let o=l();return m(o.open("action",null))}),_(1),s()}if(i&2){let e=l();M("tabindex",e.disabled()?null:0)("aria-label",e.action()===""?"Vervolgstap toevoegen":null),d(),E(e.action())}}function ui(i,t){i&1&&(a(0,"span",3),_(1," Concrete vervolgstap\u2026 "),s())}var _i=[{value:1,label:"Hoog"},{value:2,label:"Midden"},{value:3,label:"Laag"}];function gi(i){try{let t=JSON.parse(i);return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function it(i){return typeof i=="string"?i:""}function fi(i){let t=typeof i=="number"?i:typeof i=="string"?Number(i):Number.NaN;return Number.isInteger(t)&&t>=1&&t<=3?t:null}var He=class i{content=R.required();disabled=R(!1);focusPoint=R(null);contentChange=A();priorityOptions=_i;draft=Ce(()=>gi(this.content()));openedFields=y(new Map);title=C(()=>it(this.draft().title));rationale=C(()=>it(this.draft().rationale));action=C(()=>it(this.draft().action));priority=C(()=>fi(this.draft().priority));isOpen(t){return this.openedFields().has(t)}pointOf(t){return this.openedFields().get(t)??null}open(t,e){if(this.disabled()||this.openedFields().has(t))return;let n=e===null?null:{x:e.clientX,y:e.clientY};this.openedFields.set(new Map(this.openedFields()).set(t,n))}setTitle(t){this.patch("title",t)}setRationale(t){this.patch("rationale",t)}setAction(t){this.patch("action",t.trim()===""?null:t)}setPriority(t){t!==this.priority()&&this.patch("priority",t)}patch(t,e){let n=w(b({},this.draft()),{[t]:e});this.draft.set(n),this.contentChange.emit(JSON.stringify(n))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=V({type:i,selectors:[["app-recommendation-editor"]],inputs:{content:[1,"content"],disabled:[1,"disabled"],focusPoint:[1,"focusPoint"]},outputs:{contentChange:"contentChange"},decls:14,vars:8,consts:[[1,"group/rec"],[1,"relative","min-h-[1.2em]","font-bold"],["label","Aanbeveling bewerken",3,"valueChange","value","disabled","focusPoint"],["aria-hidden","true",1,"pointer-events-none","absolute","
1inset-0","opacity-40"],[1,"relative","mt-1","min-h-[1.2em]"],["label","Toelichting bewerken",3,"value","disabled","focusPoint"],["role","button",1,"block","min-h-[1.2em]","cursor-text","outline-none"],[1,"mt-2.5","flex","items-baseline","gap-2","text-[0.9em]","opacity-70"],[1,"pi","pi-arrow-right","text-[10px]"],[1,"relative","min-h-[1.2em]","flex-1"],["label","Vervolgstap bewerken",3,"value","disabled","focusPoint"],["label","Toelichting bewerken",3,"valueChange","value","disabled","focusPoint"],["role","button",1,"block","min-h-[1.2em]","cursor-text","outline-none",3,"mousedown","focus"],["label","Vervolgstap bewerken",3,"valueChange","value","disabled","focusPoint"]],template:function(e,n){e&1&&(a(0,"div",0)(1,"div",1)(2,"app-inline-text-editor",2),u("valueChange",function(r){return n.setTitle(r)}),s(),v(3,li,2,0,"span",3),s(),a(4,"div",4),v(5,si,1,3,"app-inline-text-editor",5)(6,di,2,3,"span",6)(7,ci,2,0,"span",3),s(),a(8,"div",7),h(9,"i",8),a(10,"div",9),v(11,pi,1,3,"app-inline-text-editor",10)(12,mi,2,3,"span",6)(13,ui,2,0,"span",3),s()()()),e&2&&(d(2),g("value",n.title())("disabled",n.disabled())("focusPoint",n.focusPoint()),d(),f(n.title()===""?3:-1),d(2),f(n.isOpen("rationale")?5:6),d(2),f(n.rationale()===""?7:-1),d(4),f(n.isOpen("action")?11:12),d(2),f(n.action()===""?13:-1))},dependencies:[j],encapsulation:2,changeDetection:0})};function hi(i,t){if(i&1){let e=x();a(0,"app-inline-text-editor",15),u("valueChange",function(o){p(e);let r=l();return m(r.setCaption(o))}),s()}if(i&2){let e=l();g("value",e.caption())("disabled",e.disabled())("focusPoint",e.caret())}}function xi(i,t){i&1&&(a(0,"span",17),_(1,"Bijschrift"),s())}function Ci(i,t){if(i&1&&_(0),i&2){let e=l(2);P(" ",e.caption()," ")}}function vi(i,t){if(i&1){let e=x();a(0,"span",16),u("mousedown",function(o){p(e);let r=l();return m(r.editCaption(o))})("focus",function(){p(e);let o=l();return m(o.editCaption())}),v(1,xi,2,0,"span",17)(2,Ci,1,1),s()}if(i&2){let e=l();I(e.spotClass),d(),f(e.caption().length===0?1:2)}}function bi(i,t){if(i&1){let e=x();a(0,"app-inline-text-editor",24),u("valueChange",function(o){p(e);let r=l().$index,c=l();return m(c.setHeader(r,o))}),s()}if(i&2){let e=l().$implicit,n=l();g("value",e.header)("disabled",n.disabled())("focusPoint",n.caret())}}function yi(i,t){if(i&1){let e=x();a(0,"span",16),u("mousedown",function(o){p(e);let r=l().$index,c=l();return m(c.editHeader(r,o))})("focus",function(){p(e);let o=l().$index,r=l();return m(r.editHeader(o))}),_(1),s()}if(i&2){let e=l().$implicit,n=l();I(n.spotClass),d(),E(e.header)}}function wi(i,t){if(i&1){let e=x();a(0,"th",18),v(1,bi,1,3,"app-inline-text-editor",19)(2,yi,2,3,"span",3),a(3,"span",20)(4,"button",21),u("click",function(){let o=p(e).$index,r=l();return m(r.cycleAlign(o))}),h(5,"i",22),s(),a(6,"button",21),u("click",function(){let o=p(e).$index,r=l();return m(r.removeColumn(o))}),h(7,"i",23),s()()()}if(i&2){let e=t.$implicit,n=t.$index,o=l();se("text-align",e.align),M("data-spot","header:"+n),d(),f(o.editingHeader(n)?1:2),d(3),g("disabled",o.disabled())("title",o.alignTitle(e.align)),M("aria-label",o.alignTitle(e.align)),d(),I(o.alignIcon(e.align)),d(),g("disabled",o.disabled()||!o.canRemoveColumn())("title",o.removeColumnTitle()),M("aria-label",o.removeColumnTitle())}}function ki(i,t){if(i&1){let e=x();a(0,"app-inline-text-editor",29),u("valueChange",function(o){p(e);let r=l().$index,c=l().$index,k=l();return m(k.setCell(c,r,o))}),s()}if(i&2){let e=l().$implicit,n=l(2);g("value",e)("disabled",n.disabled())("focusPoint",n.caret())}}function Si(i,t){if(i&1){let e=x();a(0,"span",16),u("mousedown",function(o){p(e);let r=l().$index,c=l().$index,k=l();return m(k.editCell(c,r,o))})("focus",function(){p(e);let o=l().$index,r=l().$index,c=l();return m(c.editCell(r,o))}),_(1),s()}if(i&2){let e=l().$implicit,n=l(2);I(n.spotClass),d(),E(e)}}function Ei(i,t){if(i&1&&(a(0,"td",27),v(1,ki,1,3,"app-inline-text-editor",28)(2,Si,2,3,"span",3),s()),i&2){let e=t.$index,n=l().$index,o=l();se("border-top",o.cellBorder)("text-align",o.cellAlign(e)),M("data-spot","cell:"+n+":"+e),d(),f(o.editingCell(n,e)?1:2)}}function Ti(i,t){if(i&1){let e=x();a(0,"tr",10),D(1,Ei,3,6,"td",25,O),a(3,"td",7)(4,"button",26),u("click",function(){let o=p(e).$index,r=l();return m(r.removeRow(o))}),h(5,"i",23),s()()()}if(i&2){let e=t.$implicit,n=l();d(),F(e),d(3),g("disabled",n.disabled())}}function Ri(i,t){if(i&1){let e=x();a(0,"app-inline-text-editor",30),u("valueChange",function(o){p(e);let r=l();return m(r.setFootnote(o))}),s()}if(i&2){let e=l();g("value",e.footnote())("disabled",e.disabled())("focusPoint",e.caret())}}function Pi(i,t){i&1&&(a(0,"span",17),_(1,"Bronvermelding"),s())}function Ii(i,t){if(i&1&&_(0),i&2){let e=l(2);P(" ",e.footnote()," ")}}function Vi(i,t){if(i&1){let e=x();a(0,"span",16),u("mousedown",function(o){p(e);let r=l();return m(r.editFootnote(o))})("focus",function(){p(e);let o=l();return m(o.editFootnote())}),v(1,Pi,2,0,"span",17)(2,Ii,1,1),s()}if(i&2){let e=l();I(e.spotClass),d(),f(e.footnote().length===0?1:2)}}var un=2,_n=6,ot=["left","center","right"],Di={left:"links",center:"gecentreerd",right:"rechts"},Fi={left:"pi-align-left",center:"pi-align-center",right:"pi-align-right"},Je=class i{content=R.required();disabled=R(!1);focusPoint=R(null);contentChange=A();model=y(at({}));lastEmitted=null;host=T(ge);picked=y({spot:null,point:null});columns=C(()=>re(this.model()).map(t=>({header:N(t.header)??"",align:lt(t.align)})));rows=C(()=>pe(this.model()).map(t=>rt(t).map(e=>N(e.text)??"")));caption=C(()=>
1N(this.model().caption)??"");footnote=C(()=>N(this.model().footnote)??"");canAddColumn=C(()=>this.columns().length<_n);canRemoveColumn=C(()=>this.columns().length>un);cellBorder="1px solid color-mix(in srgb, currentColor 12%, transparent)";spotClass="block min-h-[1.25em] cursor-text outline-none";spot=C(()=>this.picked().spot);caret=C(()=>this.picked().point);constructor(){te(()=>{let t=this.content();t!==this.lastEmitted&&this.model.set(Mi(t))}),H(()=>this.openAtClick())}editingCaption(){return this.spot()?.kind==="caption"}editingFootnote(){return this.spot()?.kind==="footnote"}editingHeader(t){let e=this.spot();return e!==null&&e.kind==="header"&&e.column===t}editingCell(t,e){let n=this.spot();return n!==null&&n.kind==="cell"&&n.row===t&&n.column===e}editCaption(t){this.select({kind:"caption"},ze(t))}editFootnote(t){this.select({kind:"footnote"},ze(t))}editHeader(t,e){this.select({kind:"header",column:t},ze(e))}editCell(t,e,n){this.select({kind:"cell",row:t,column:e},ze(n))}setCaption(t){this.patch(e=>w(b({},e),{caption:gn(t)}))}setFootnote(t){this.patch(e=>w(b({},e),{footnote:gn(t)}))}setHeader(t,e){this.patch(n=>w(b({},n),{columns:re(n).map((o,r)=>r===t?w(b({},o),{header:e}):o)}))}setCell(t,e,n){this.patch(o=>w(b({},o),{rows:pe(o).map((r,c)=>c!==t?r:w(b({},r),{cells:rt(r).map((k,S)=>S===e?w(b({},k),{text:n}):k)}))}))}cycleAlign(t){this.patch(e=>w(b({},e),{columns:re(e).map((n,o)=>o!==t?n:w(b({},n),{align:ot[(ot.indexOf(lt(n.align))+1)%ot.length]}))}))}addRow(){let t=this.rows().length;this.patch(e=>w(b({},e),{rows:[...pe(e),{cells:[]}]})),this.select({kind:"cell",row:t,column:0},null)}removeRow(t){this.patch(e=>w(b({},e),{rows:pe(e).filter((n,o)=>o!==t)})),this.picked.set({spot:null,point:null})}addColumn(){if(!this.canAddColumn()||this.disabled())return;let t=this.columns().length;this.patch(e=>w(b({},e),{columns:[...re(e),{key:fn(Bi(e)),header:"",align:"left"}]})),this.select({kind:"header",column:t},null)}removeColumn(t){!this.canRemoveColumn()||this.disabled()||(this.patch(e=>w(b({},e),{columns:re(e).filter((n,o)=>o!==t),rows:pe(e).map(n=>w(b({},n),{cells:rt(n).filter((o,r)=>r!==t)}))})),this.picked.set({spot:null,point:null}))}cellAlign(t){return this.columns()[t]?.align??"left"}alignIcon(t){return Fi[t]}alignTitle(t){return`Uitlijning: ${Di[t]} \u2014 klik om te wijzigen`}addColumnTitle(){return this.canAddColumn()?"Kolom toevoegen":`Een tabel kan maximaal ${_n} kolommen hebben`}removeColumnTitle(){return this.canRemoveColumn()?"Kolom verwijderen":`Een tabel heeft minimaal ${un} kolommen nodig`}openAtClick(){let t=this.focusPoint();this.picked.set({spot:this.spotAt(t)??this.firstSpot(),point:t})}spotAt(t){if(t===null)return null;let e=document.elementFromPoint(t.x,t.y);if(e===null||!this.host.nativeElement.contains(e))return null;let n=e.closest("[data-spot]");return n===null?null:Ai(n.getAttribute("data-spot")??"")}firstSpot(){return this.columns().length===0?{kind:"caption"}:this.rows().length>0?{kind:"cell",row:0,column:0}:{kind:"header",column:0}}select(t,e){let n=this.picked().spot;n!==null&&Oi(n,t)||this.picked.set({spot:t,point:e})}patch(t){if(this.disabled())return;let e=at(t(this.model())),n=JSON.stringify(e);this.model.set(e),this.lastEmitted=n,this.contentChange.emit(n)}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=V({type:i,selectors:[["app-table-editor"]],inputs:{content:[1,"content"],disabled:[1,"disabled"],focusPoint:[1,"focusPoint"]},outputs:{contentChange:"contentChange"},decls:24,vars:6,consts:[[1,"group/table"],["data-spot","caption",1,"mb-2","font-medium"],["label","Bijschrift bewerken",3,"value","disabled","focusPoint"],["tabindex","0",3,"class"],[1,"overflow-x-auto"],[1,"w-full","border-collapse","text-left"],[1,"group/column","relative","px-3.5","py-2.5","font-semibold",3,"text-align"],[1,"w-8","p-0","text-center","align-middle"],["type","button",1,"cursor-pointer","p-0.5","leading-none","opacity-0","transition-opacity","group-hover/table:opacity-60","hover:opacity-100","focus-visible:opacity-100","disabled:cursor-not-allowed","disabled:opacity-30",3,"click","disabled","title"],[1,"pi","pi-plus","text-[0.7rem]"],[1,"group/row"],[1,"mt-1.5"],["type","button",1,"inline-flex","cursor-pointer","items-center","gap-2","opacity-0","transition-opacity","group-hover/table:opacity-60","hover:opacity-100","focus-visible:opacity-100","disabled:cursor-not-allowed","disabled:opacity-30",3,"click","disabled"],["data-spot","footnote",1,"mt-2","opacity-60"],["label","Voetnoot bewerken",3,"value","disabled","focusPoint"],["label","Bijschrift bewerken",3,"valueChange","value","disabled","focusPoint"],["tabindex","0",3,"mousedown","focus"],[1,"opacity-40"],[1,"group/column","relative","px-3.5","py-2.5","font-semibold"],["label","Kolomkop bewerken",3,"value","disabled","focusPoint"],[1,"absolute","top-0","right-0.5","flex","items-center","gap-0.5","opacity-0","transition-opacity","group-hover/column:opacity-60","focus-within:opacity-100"],["type","button",1,"curs
1or-pointer","p-0.5","leading-none","hover:opacity-100","disabled:cursor-not-allowed","disabled:opacity-30",3,"click","disabled","title"],[1,"pi","text-[0.7rem]"],[1,"pi","pi-times","text-[0.7rem]"],["label","Kolomkop bewerken",3,"valueChange","value","disabled","focusPoint"],[1,"px-3.5","py-2.5","align-top",3,"border-top","text-align"],["type","button","title","Rij verwijderen","aria-label","Rij verwijderen",1,"cursor-pointer","p-0.5","leading-none","opacity-0","transition-opacity","group-hover/row:opacity-60","hover:opacity-100","focus-visible:opacity-100","disabled:cursor-not-allowed","disabled:opacity-30",3,"click","disabled"],[1,"px-3.5","py-2.5","align-top"],["label","Cel bewerken",3,"value","disabled","focusPoint"],["label","Cel bewerken",3,"valueChange","value","disabled","focusPoint"],["label","Voetnoot bewerken",3,"valueChange","value","disabled","focusPoint"]],template:function(e,n){e&1&&(a(0,"div",0)(1,"div",1),v(2,hi,1,3,"app-inline-text-editor",2)(3,vi,3,3,"span",3),s(),a(4,"div",4)(5,"table",5)(6,"thead")(7,"tr"),D(8,wi,8,12,"th",6,O),a(10,"th",7)(11,"button",8),u("click",function(){return n.addColumn()}),h(12,"i",9),s()()()(),a(13,"tbody"),D(14,Ti,6,1,"tr",10,O),s()()(),a(16,"div",11)(17,"button",12),u("click",function(){return n.addRow()}),h(18,"i",9),a(19,"span"),_(20,"Rij toevoegen"),s()()(),a(21,"div",13),v(22,Ri,1,3,"app-inline-text-editor",14)(23,Vi,3,3,"span",3),s()()),e&2&&(d(2),f(n.editingCaption()?2:3),d(6),F(n.columns()),d(3),g("disabled",n.disabled()||!n.canAddColumn())("title",n.addColumnTitle()),M("aria-label",n.addColumnTitle()),d(3),F(n.rows()),d(3),g("disabled",n.disabled()),d(5),f(n.editingFootnote()?22:23))},dependencies:[j],encapsulation:2,changeDetection:0})};function Mi(i){let t=null;try{t=JSON.parse(i)}catch{t=null}return at(Q(t))}function at(i){let t=new Set,e=ae(i.columns).map(Q).map(o=>{let r=N(o.key)??"",c=r.length>0&&!t.has(r)?r:fn(t);return t.add(c),w(b({},o),{key:c,header:N(o.header)??"",align:lt(o.align)})}),n=ae(i.rows).map(Q).map(o=>{let r=ae(o.cells);return w(b({},o),{cells:Array.from({length:Math.max(e.length,r.length)},(c,k)=>{let S=r[k],B=Q(S);return w(b({},B),{text:typeof S=="string"?S:N(B.text)??"",factKey:N(B.factKey)})})})});return w(b({},i),{columns:e,rows:n,caption:N(i.caption),footnote:N(i.footnote)})}function re(i){return ae(i.columns).map(Q)}function pe(i){return ae(i.rows).map(Q)}function rt(i){return ae(i.cells).map(Q)}function Bi(i){return new Set(re(i).map(t=>N(t.key)??""))}function fn(i){let t=i.size+1;for(;i.has(`col_${t}`);)t++;return`col_${t}`}function lt(i){return i==="right"||i==="center"?i:"left"}function Ai(i){let[t,e,n]=i.split(":");return t==="caption"?{kind:"caption"}:t==="footnote"?{kind:"footnote"}:t==="header"&&Number.isInteger(Number(e))?{kind:"header",column:Number(e)}:t==="cell"&&Number.isInteger(Number(e))&&Number.isInteger(Number(n))?{kind:"cell",row:Number(e),column:Number(n)}:null}function Oi(i,t){return i.kind!==t.kind?!1:i.kind==="header"&&t.kind==="header"?i.column===t.column:i.kind==="cell"&&t.kind==="cell"?i.row===t.row&&i.column===t.column:!0}function ze(i){return i===void 0?null:{x:i.clientX,y:i.clientY}}function gn(i){return i.trim().length===0?null:i}function N(i){return typeof i=="string"?i:null}function ae(i){return Array.isArray(i)?i:[]}function Q(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{}}var hn=(i,t)=>t.id,xn=(i,t)=>t.key;function Li(i,t){if(i&1){let e=x();a(0,"div",1)(1,"button",13),u("mousedown",function(o){p(e);let r=l();return m(r.keepFocus(o))})("click",function(){p(e);let o=l();return m(o.toggleCollapsed())}),h(2,"i",4),s()()}}function ji(i,t){if(i&1){let e=x();a(0,"button",16),u("mousedown",function(o){p(e);let r=l(2);return m(r.keepFocus(o))})("click",function(){let o=p(e).$implicit,r=l(2);return m(r.selectTab(o.id))}),_(1),s()}if(i&2){let e=t.$implicit,n=l(2);de("border-b-2",n.activeTab()===e.id)("border-primary",n.activeTab()===e.id),M("aria-selected",n.activeTab()===e.id),d(),P(" ",e.label," ")}}function Ni(i,t){if(i&1){let e=x();a(0,"aside",2)(1,"div",7),D(2,ji,2,6,"button",8,hn),a(4,"button",14),u("mousedown",function(o){p(e);let r=l();return m(r.keepFocus(o))})("click",function(){p(e);let o=l();return m(o.toggleCollapsed())}),h(5,"i",15),s()(),a(6,"div",11),Ye(7,12),s()()}if(i&2){let e=l(),n=J(16);d(2),F(e.tabs),d(5),g("ngTemplateOutlet",n)}}function $i(i,t){if(i&1){let e=x();a(0,"button",16),u("mousedown",function(o){p(e);let r=l();return m(r.keepFocus(o))})("click",function(){let o=p(e).$implicit,r=l();return m(r.selectTab(o.id))}),_(1),s()}if(i&2){let e=t.$implicit,n=l();de("border-b-2",n.activeTab()===e.id)("border-primary",n.activeTab()===e.id),M("aria-selected",n.activeTab()===e.id),d(),P(" ",e.label," ")}}function Ki(i,t){i&1&&(a(0,"p",22),_(1,"Dit blok verwijst niet naar een bron."),s())}function Hi(i,t){if(i&1&&(a(0,"span",26),_(1),s()),i&2){let e=l().$implicit;d(),E(e.value)}}function zi(i,t){i&1&&h(0,"i",27)}function Ji(i,t){i&1&&(a(0,"span",28),_(1," niet teruggevonden "),s())}function Ui(i,t){i&1&&(a(0,"span",29),_(1,"berekend uit andere feiten"),s())}function Gi(i,t){if(i&1&&(a(0,"span",29),_(1),s()),i&2){let e=l().$implicit;d(),E(e.place)}}function qi(i,t){if(i&1&&(a(0,"span",31),_(1),s()),i&2){let e=l().$implicit;d(),P(" \u201C",e.snippet,"\u201D ")}}function Yi(i,t){if(i&1&&(a(0,"div",30),v(1,Gi,2,1,"span",29)(2,qi,2,1,"span",31),s()),i&2){let e=t.$implicit;d(),f(e.place?1:-1),d(),f(e.snippet?2:-1)}}function Wi(i,t){if(i&1&&D(0,Yi,3,2,"div",30,O),i&2){let e=l().$implicit;F(e.evidence)}}function Qi(i,t){if(i&1&&(a(0,"div",23)(1,"div",24)(2,"span",25),_(3),s(),v(4,Hi,2,1,"span",26)(5,zi,1,0,"i",27)(6,Ji,2,0,"span",28),s(),v(7,Ui,2,0,"span",29)(8,Wi,2,0),s()),i&2){let e=t.$implicit;d(3),E(e.statement),d(),f(e.value?4:-1),d(),f(e.verified?5:6),d(2),f(e.evidence.length===0?7:8)}}function Xi(i,t){if(i&1&&(a(0,"div",17),D(1,Qi,9,4,"div",23,xn),s()),i&2){let e=l(3);d(),F(e.selectedFacts())}}function Zi(i,t){if(i&1){let e=x();a(0,"div",17)(1,"div",18)(2,"button",19),u("mousedown",function(o){p(e);let r=l(2);return m(r.keepFocus(o))})("click",function(){p(e);let o=l(2);return m(o.deselected.emit())}),h(3,"i",20),a(4,"span"),_(5,"Alle bronnen"),s()(),a(6,"span",21),_(7),s()(),v(8,Ki,2,0,"p",22)(9,Xi,3,0,"div",17),s()}if(i&2){let e=l(2);d(7),P(" ",t.blockLabel," "),d(),f(e.selectedFacts().length===0?8:9)}}function eo(i,t){i&1&&(a(0,"div",32),h(1,"i",33),a(2,"p",34),_(3,"Geen bronnen vastgelegd"),s(),a(4,"p",35),_(5," Bronnen verschijnen hier bij rapporten die met bronregistratie zijn gegenereerd. "),s()())}function to(i,t){if(i&1&&(a(0,"div",38)(1,"span",40),h(2,"i",41),s(),a(3,"div",42)(4,"div",43),_(5),s(),a(6,"div",29),_(7),s()()()),i&2){let e=t.$implicit,n=l(4);d(2),I(e.icon),d(3),E(e.label),d(2),q(" ",e.typeLabel," \xB7 onderbouwt ",n.factCountLabel(e.factCount)," ")}}function no(i,t){if(i&1&&(a(0,"p",39),_(1),s()),i&2){let e=l(4);d(),P(" ",e.factCountLabel(e.derivedFactCount())," berekend uit andere feiten. ")}}function io(i,t){if(i&1&&(a(0,"div",17)(1,"p",36),_(2," Klik op een blok in het document om de bronnen van dat blok te zien. "),s(),a(3,"div",37),D(4,to,8,5,"div",38,xn),s(),v(6,no,2,1,"p",39),s()),i&2){let e=l(3);d(4),F(e.documentSources()),d(2),f(e.derivedFactCount()>0?6:-1)}}function oo(i,t){if(i&1&&v(0,eo,6,0,"div",32)(1,io,7,1,"div",17),i&2){let e=l(2);f(e.documentSources().length===0&&e.derivedFactCount()===0?0:1)}}function ro(i,t){if(i&1&&v(0,Zi,10,2,"div",17)(1,oo,2,1),i&2){let e,n=l();f((e=n.selection())?0:1,e)}}var ao={document:{label:"Document",icon:"pi pi-file"},meeting:{label:"Gesprek",icon:"pi pi-comments"},note:{label:"Notitie",icon:"pi pi-pencil"}},Ue=class i{facts=R.required();selection=R(null);deselected=A();tabs=[{id:"bronnen",label:"Bronnen"}];activeTab=y("bronnen");collapsed=y(!1);mobileOpen=y(!1);selectTab(t){this.activeTab.set(t)}toggleCollapsed(){this.collapsed.update(t=>!t)}setMobileOpen(t){this.mobileOpen.set(t)}keepFocus(t){t.preventDefault()}selectedFacts=C(()=>(this.selection()?.facts??[]).map(t=>this.toDrawnFact(t)));documentSources=C(()=>{let t=new Map;for(let e of this.facts()){let n=new Set;for(let o of e.evidence){let r=this.sourceKey(o);if(!r)continue;let c=t.get(r);if(!c){let k=ao[o.sourceType]??{label:"Bron",icon:"pi pi-database"};c={key:r,label:o.label.trim()||k.label,typeLabel:k.label,icon:k.icon,factCount:0},t.set(r,c)}n.has(r)||(n.add(r),c.factCount+=1)}}return[...t.values()]});derivedFactCount=C(()=>this.facts().filter(t=>t.evidence.length===0).length);factCountLabel(t){return t===1?"1 feit":`${t} feiten`}toDrawnFact(t){return{key:t.key,statement:t.statement,value:t.value,verified:t.isVerified,evidence:t.evidence.map(e=>({place:Xt(e),snippet:e.snippet.trim()||null})).filter(e=>e.place.length>0||e.snippet!==null)}}sourceKey(t){let e=t.sourceId||t.label.trim();return e?`${t.sourceType}|${e}`:null}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=V({type:i,selectors:[["app-report-sources-panel"]],hostAttrs:[1,"block","shrink-0"],inputs:{facts:[1,"facts"],selection:[1,"selection"]},outputs:{deselected:"deselected"},decls:17,vars:9,consts:[["sourcesContent",""],[1,"sticky","top-6","hidden","lg:block"],["aria-label","Bronnen van dit rapport",1,"border-surface-200","dark:border-surface-700","dark:bg-surface-900","bg-surface-0","sticky","top-6","hidden","max-h-[calc(100vh-3rem)]","w-80","flex-col","overflow-hidden","rounded-xl","border","shadow-sm","lg:flex"],["type","button","aria-label","Bronnen tonen",1,"bg-primary","text-primary-contrast","fixed","right-5","bottom-5","z-[1040]","flex","items-center","gap-2","rounded-full","px-4","py-2.5","text-sm","font-medium","shadow-lg","lg:hidden",3,"mousedown","click"],[1,"pi","pi-database","text-sm"],["aria-hidden","true",1,"fixed","inset-0","z-[1050]","bg-black/40","transition-opacity","duration-200","motion-reduce:transition-none","lg:hidden",3,"mousedown","click"],["aria-label","Bronnen van dit rapport",1,"dark:bg-surface-900","bg-surface-0","fixed","inset-y-0","right-0","z-[1051]","flex","w-[min(20rem,85vw)]","flex-col","shadow-2xl","transition-transform","duration-200","motion-reduce:transition-none","lg:hidden"],["role","tablist",1,"border-surface-200","dark:border-surface-700","flex","items-center","gap-1","border-b","px-2","pt-2"],["type","button","role","tab",1,"text-color","rounded-t-lg","px-3","py-2","text-sm","font-medium",3,"border-b-2","border-primary"],["type","button","aria-label","Bronnenpaneel sluiten",1,"text-muted-color","hover:text-color","ml-auto","flex","h-8","w-8","items-center","justify-center","rounded-lg","transition-colors",3,"mousedown","click"],[1,"pi","pi-times","text-sm"],[1,"min-h-0","flex-1","overflow-y-auto","px-4","py-4"],[3,"ngTemplateOutlet"],["type","button","aria-label","Bronnenpaneel tonen",1,"border-surface-200","dark:border-surface-700","dark:bg-surface-900","bg-surface-0","text-muted-color","hover:text-color","flex","h-10","w-10","items-center","justify-center","rounded-xl","border","shadow-sm","transition-colors",3,"mousedown","click"],["type","button","aria-label","Bronnenpaneel inklappen",1,"text-muted-color","hover:text-color","ml-auto","flex","h-8","w-8","items-center","justify-center","rounded-lg","transition-colors",3,"mousedown","click"],[1,"pi","pi-angle-double-right","text-sm"],["type","button","role","tab",1,"text-color","rounded-t-lg","px-3","py-2","text-sm","font-medium",3,"mousedown","click"],[1,"flex","flex-col","gap-4"],[1,"flex","flex-wrap","items-center","gap-2"],["type","button",1,"text-muted-color","hover:text-color","inline-flex","items-center","gap-1.5","text-xs","transition-colors",3,"mousedown","click"],[1,"pi","pi-arrow-left","text-[0.65rem]"],[1,"bg-surface-100","text-color","dark:bg-surface-800","ml-auto","rounded-full","px-2.5","py-0.5","text-xs","font-medium"],[1,"text-muted-color","m-0","text-sm"],[1,"border-surface-200","dark:border-surface-700","flex","flex-col","gap-1.5","border-b","pb-4","last:border-b-0","last:pb-0"],[1,"flex","flex-wrap","items-baseline","gap-x-2","gap-y-1"],[1,"text-color","text-sm","font-medium"],[1,"text-primary","text-sm",2,"font-variant-numeric","tabular-nums"],["role","img","aria-label","Teruggevonden in de bron",1,"pi","pi-check-circle","text-xs","text-green-600","dark:text-green-400"],[1,"rounded-full","bg-amber-50","px-1.5","py-0.5","text-[10px]","uppercase","tracking-wide","text-amber-900","dark:bg-amber-950","dark:text-amber-200"],[1,"text-muted-color","text-xs"],[1,"flex","flex-col","gap-1"],[1,"border-surface-300","text-muted-color","dark:border-surface-600","border-l","pl-2","text-xs","italic"],[1,"flex","flex-col","items-center","gap-2","py-8","text-center"],[1,"pi","pi-database","text-muted-color","text-xl"],[1,"text-color","m-0","text-sm","font-medium"],[1,"text-muted-color","m-0","max-w-[14rem]","text-xs","leading-relaxed"],[1,"text-muted-color","m-0","text-xs","leading-relaxed"],[1,"flex","flex-col","gap-3"],[1,"flex","items-start","gap-3"],[1,"text-muted-color","m-0","text-xs"],[1,"bg-surface-100","text-muted-color","dark:bg-surface-800","flex","h-8","w-8","shrink-0","items-center","justify-center","rounded-lg"],[1,"text-xs"],[1,"min-w-0"],[1,"text-color","truncate","text-sm","font-medium"]],template:function(e,n){if(e&1){let o=x();v(0,Li,3,0,"div",1)(1,Ni,8,1,"aside",2),a(2,"button",3),u("mousedown",function(c){return p(o),m(n.keepFocus(c))})("click",function(){return p(o),m(n.setMobileOpen(!0))}),h(3,"i",4),a(4,"span"),_(5,"Bronnen"),s()(),a(6,"div",5),u("mousedown",function(c){return p(o),m(n.keepFocus(c))})("click",function(){return p(o),m(n.setMobileOpen(!1))}),s(),a(7,"aside",6)(8,"div",7),D(9,$i,2,6,"button",8,hn),a(11,"button",9),u("mousedown",function(c){return p(o),m(n.keepFocus(c))})("click",function(){return p(o),m(n.setMobileOpen(!1))}),h(12,"i",10),s()(),a(13,"div",11),Ye(14,12),s()(),v(15,ro,2,1,"ng-template",null,0,K)}if(e&2){let o=J(16);f(n.collapsed()?0:1),d(6),de("opacity-0",!n.mobileOpen())("pointer-events-none",!n.mobileOpen()),d(),de("translate-x-full",!n.mobileOpen()),M("aria-hidden",!n.mobileOpen()),d(2),F(n.tabs),d(5),g("ngTemplateOutlet",o)}},dependencies:[ft],encapsulation:2,changeDetection:0})};var Ge=class i{signalR=T(bt);hubUrl=`${ht.hubs}realtime`;connected=!1;lifecycleSubscribed=!1;joinedReports=new Set;
1rejoinedSubject=new le;connectionLostSubject=new le;rejoined$=this.rejoinedSubject.asObservable();connectionLost$=this.connectionLostSubject.asObservable();connect(){return $(this,null,function*(){if(!this.connected)try{yield this.signalR.connect(this.hubUrl,new vt),this.connected=!0,this.subscribeLifecycleOnce()}catch(t){throw console.error("Failed to connect to report hub",t),this.connected=!1,t}})}joinReport(t){return $(this,null,function*(){if(!t)return null;yield this.connect(),this.joinedReports.add(t);try{return(yield this.signalR.invokeOrThrow(this.hubUrl,"JoinReport",t))??null}catch(e){throw this.joinedReports.delete(t),console.error("Failed to join report room",t,e),e}})}leaveReport(t){return $(this,null,function*(){if(!(!t||!this.joinedReports.has(t))){this.joinedReports.delete(t);try{yield this.signalR.invoke(this.hubUrl,"LeaveReport",t)}catch(e){console.error("Failed to leave report room",t,e)}}})}onGenerationProgress(){return this.signalR.on(this.hubUrl,"ReportGenerationProgress")}onSectionCompleted(){return this.signalR.on(this.hubUrl,"ReportSectionCompleted")}onCompleted(){return this.signalR.on(this.hubUrl,"ReportCompleted")}onFailed(){return this.signalR.on(this.hubUrl,"ReportFailed")}subscribeLifecycleOnce(){this.lifecycleSubscribed||(this.lifecycleSubscribed=!0,this.signalR.onReconnected(this.hubUrl).subscribe(()=>{this.connected=!0,this.rejoinReports()}),this.signalR.onClosed(this.hubUrl).subscribe(()=>{this.connected=!1,this.connectionLostSubject.next()}))}rejoinReports(){return $(this,null,function*(){for(let t of[...this.joinedReports])try{yield this.signalR.invokeOrThrow(this.hubUrl,"JoinReport",t),this.rejoinedSubject.next(t)}catch(e){console.error("Failed to rejoin report room",t,e)}})}static \u0275fac=function(e){return new(e||i)};static \u0275prov=dt({token:i,factory:i.\u0275fac,providedIn:"root"})};var lo=["reportTitleInput"],so=["attachmentReplaceFile"];function co(i,t){i&1&&(a(0,"div",11),h(1,"p-skeleton",13)(2,"p-skeleton",14)(3,"p-skeleton",15),s())}function po(i,t){if(i&1){let e=x();a(0,"div",12),h(1,"i",16),a(2,"div")(3,"div",17),_(4,"Dit rapport kon niet worden geladen."),s(),a(5,"div",18),_(6,"Het is mogelijk verwijderd, of je verbinding hapert."),s()(),a(7,"div",19)(8,"p-button",20),u("onClick",function(){p(e);let o=l();return m(o.load())}),s(),h(9,"p-button",21),s()()}i&2&&(d(8),g("outlined",!0),d(),g("text",!0))}function mo(i,t){if(i&1){let e=x();a(0,"input",36,2),u("ngModelChange",function(o){p(e);let r=l(3);return m(r.titleDraft.set(o))})("keydown.enter",function(){p(e);let o=l(3);return m(o.saveTitle())})("keydown.escape",function(){p(e);let o=l(3);return m(o.cancelTitleEdit())}),s(),a(2,"p-button",37),u("onClick",function(){p(e);let o=l(3);return m(o.saveTitle())}),s(),a(3,"p-button",38),u("onClick",function(){p(e);let o=l(3);return m(o.cancelTitleEdit())}),s()}if(i&2){let e=l(3);g("ngModel",e.titleDraft())("disabled",e.titleSaving()),d(2),g("text",!0)("rounded",!0)("loading",e.titleSaving()),d(),g("text",!0)("rounded",!0)("disabled",e.titleSaving())}}function uo(i,t){if(i&1){let e=x();a(0,"h1",39),_(1),s(),a(2,"p-button",40),u("onClick",function(){p(e);let o=l(3);return m(o.startTitleEdit())}),s()}if(i&2){let e=l(3);d(),E(e.shownTitle()),d(),g("text",!0)("rounded",!0)}}function _o(i,t){if(i&1&&h(0,"p-tag",41)(1,"p-tag",42),i&2){let e=l(),n=l(2);g("value",n.statusLabel())("severity",n.statusSeverity())("rounded",!0),d(),g("value","v"+e.templateVersion)("rounded",!0)}}function go(i,t){if(i&1&&(a(0,"a",28),h(1,"i",43),_(2),s()),i&2){let e=l(3);g("routerLink",t),d(),I(e.sourceIcon()),d(),P("",e.sourceLabel()," ")}}function fo(i,t){if(i&1&&(a(0,"span",26),h(1,"i",43),_(2),s()),i&2){let e=l(3);d(),I(e.sourceIcon()),d(),P("",e.sourceLabel()," ")}}function ho(i,t){i&1&&(a(0,"span",26),h(1,"i",44),_(2),s()),i&2&&(d(2),P("",t," "))}function xo(i,t){if(i&1&&(_(0),Z(1,"date")),i&2){let e=l();P(" gereed ",ee(1,1,e.generatedAt,"dd-MM-yyyy HH:mm")," ")}}function Co(i,t){if(i&1&&(_(0),Z(1,"date")),i&2){let e=l();P(" aangemaakt ",ee(1,1,e.createdAt,"dd-MM-yyyy HH:mm")," ")}}function vo(i,t){i&1&&(a(0,"span",26),h(1,"i",45),_(2,"Bijwerken\u2026 "),s())}function bo(i,t){if(i&1){let e=x();a(0,"div",32)(1,"p-button",46),u("onClick",function(){p(e);let o=l(3);return m(o.showAdvisorChrome.set(!o.showAdvisorChrome()))}),s()()}if(i&2){let e=l(3);d(),g("text",!0)("label",e.showAdvisorChrome()?"Bekijk zoals de klant":"Toon controlelaag")("icon",e.showAdvisorChrome()?"pi pi-eye":"pi pi-list-check")}}function yo(i,t){if(i&1){let e=x();a(0,"p-button",47),u("onClick",function(){p(e);let o=l(3);return m(o.retry())}),s()}if(i&2){let e=l(3);g("loading",e.retrying())}}function wo(i,t){if(i&1&&h(0,"img",51),i&2){let e=l().$implicit;g("src",e.image,ct)}}function ko(i,t){if(i&1&&h(0,"span",54),i&2){let e=l().$implicit;I(e.icon)}}function So(i,t){if(i&1&&(a(0,"a",50),v(1,wo,1,1,"img",51)(2,ko,1,2,"span",52),a(3,"span",53),_(4),s()()),i&2){let e=t.$implicit;d(),f(e.image?1:2),d(3),E(e.label)}}function Eo(i,t){if(i&1){let e=x();a(0,"p-button",48),u("onClick",function(o){p(e);let r=J(2),c=l(3);return m(c.openExportMenu(o,r))}),s(),a(1,"p-menu",49,3),v(3,So,5,2,"ng-template",null,4,K),s()}if(i&2){let e,n=l(3);g("disabled",!!n.attachmentsBlockedText())("outlined",!0)("loading",n.exporting())("pTooltip",n.citationsNotPrintable()?n.exportBlockedText:(e=n.attachmentsBlockedText())!==null&&e!==void 0?e:void 0),d(),g("model",n.exportMenuItems())("popup",!0)}}function To(i,t){if(i&1){let e=x();a(0,"div",55),h(1,"i",63),a(2,"span"),_(3,"De live weergave is niet beschikbaar. Dit scherm werkt zichzelf met vertraging bij; het rapport gaat gewoon door."),s(),a(4,"p-button",64),u("onClick",function(){p(e);let o=l(4);return m(o.refreshNow())}),s()()}i&2&&(d(4),g("text",!0))}function Ro(i,t){if(i&1&&(a(0,"span",60),_(1),s()),i&2){let e=t;d(),q(" ",e.done," van ",e.total," secties ")}}function Po(i,t){if(i&1&&(v(0,To,5,1,"div",55),a(1,"div",56)(2,"span",57),h(3,"p-progressSpinner",58),a(4,"span",59),_(5),s()(),v(6,Ro,2,2,"span",60),a(7,"span",61),_(8,"Je kunt dit scherm sluiten: het rapport gaat door."),s()(),h(9,"app-report-document-renderer",62)),i&2){let e,n=l(3);f(n.liveFeedDegraded()?0:-1),d(5),E(n.currentStepText()),d(),f((e=n.sectionProgress())?6:-1,e),d(3),g("document",n.renderDocument())("fields",n.fields())("showAdvisorChrome",!0)}}function Io(i,t){if(i&1){let e=x();a(0,"div",35)(1,"div",65),h(2,"i",66),s(),a(3,"div")(4,"div",17),_(5,"Het genereren is mislukt"),s(),a(6,"p",67),_(7),s()(),a(8,"p-button",68),u("onClick",function(){p(e);let o=l(3);return m(o.retry())}),s()()}if(i&2){let e=l(3);d(7),E(e.failureText()),d(),g("severity","secondary")("loading",e.retrying())}}function Vo(i,t){i&1&&(a(0,"div",69),h(1,"i",76),_(2," Het thema van dit rapport bestaat niet meer; het wordt getoond in de standaardopmaak. "),s())}function Do(i,t){if(i&1){let e=x();a(0,"div",55),h(1,"i",76),a(2,"span"),_(3,"De opmaak van dit rapport kon niet worden geladen; het wordt tijdelijk in een afwijkende opmaak getoond."),s(),a(4,"p-button",77),u("onClick",function(){p(e);let o=l(4);return m(o.retryThemes())}),s()()}i&2&&(d(4),g("text",!0))}function Fo(i,t){if(i&1&&(a(0,"div",70),h(1,"i",78),a(2,"span"),_(3),s()()),i&2){let e=l(4);d(3),E(e.exportBlockedText)}}function Mo(i,t){i&1&&(a(0,"div",70),h(1,"i",79),a(2,"span"),_(3),s()()),i&2&&(d(3),E(t))}function Bo(i,t){i&1&&(a(0,"div",71),h(1,"i",80),a(2,"span"),_(3,"Klik in de tekst om te bewerken. Je wijziging wordt vastgelegd als je het blok verlaat."),s()())}function Ao(i,t){if(i&1){let e=x();a(0,"app-report-sources-panel",81),u("deselected",function(){p(e);let o=l(4);return m(o.clearSourceSelection())}),s()}if(i&2){let e=l(4);g("facts",e.citedFacts())("selection",e.sourcesSelection())}}function Oo(i,t){if(i&1){let e=x();v(0,Vo,3,0,"div",69)(1,Do,5,1,"div",55)(2,Fo,4,1,"div",70)(3,Mo,4,1,"div",70)(4,Bo,4,0,"div",71),a(5,"div",72)(6,"div",73)(7,"app-report-document-renderer",74),u("blockActivated",function(o){p(e);let r=l(3);return m(r.activateBlock(o))}),s()(),v(8,Ao,1,2,"app-report-sources-panel",75),s()}if(i&2){let e,n=l(3),o=J(13);f(n.usingFallbackTheme()?0:n.themesUnavailable()?1:-1),d(2),f(n.citationsNotPrintable()?2:-1),d(),f((e=n.attachmentsBlockedText())?3:-1,e),d(),f(n.editableBlockIds().size>0?4:-1),d(3),g("document",n.renderDocument())("fields",n.fields())("showAdvisorChrome",n.showAdvisorChrome())("editableBlockIds",n.editableBlockIds())("actionableBlockIds",n.actionableBlockIds())("editingBlockId",n.editingBlockId())("blockEditor",o),d(),f(n.showAdvisorChrome()?8:-1)}}function Lo(i,t){if(i&1){let e=x();a(0,"div",22)(1,"div",23)(2,"div",24),v(3,mo,4,8)(4,uo,3,3)(5,_o,2,5),s(),a(6,"div",25)(7,"span",26),h(8,"i",27),_(9),s(),v(10,go,3,4,"a",28)(11,fo,3,3,"span",26)(12,ho,3,1,"span",26),a(13,"span",26),h(14,"i",29),v(15,xo,2,4)(16,Co,2,4),s(),v(17,vo,3,0,"span",26),s()(),a(18,"div",30),h(19,"app-feedback-button",31),v(20,bo,2,3,"div",32)(21,yo,1,1,"p-button",33)(22,Eo,5,6),a(23,"p-button",34),u("onClick",function(o){p(e);let r=l(2);return m(r.confirmDelete(o))}),s()()(),v(24,Po,10,6)(25,Io,9,3,"div",35)(26,Oo,9,12)}if(i&2){let e,n,o,r=t,c=l(2);d(3),f(c.titleEditing()?3:4),d(2),f(c.titleEditing()?-1:5),d(4),P("",r.templateName," "),d(),f((e=c.sourceLink())?10:11,e),d(2),f((n=c.themeName())?12:-1,n),d(3),f(r.generatedAt?15:16),d(2),f(c.refreshing()?17:-1),d(2),g("subjectId",c.feedbackSubjectId()),d(),f(c.hasAdvisorNotes()?20:-1),d(),f(r.status===c.ReportStatus.Failed?21:-1),d(),f(c.canExport()?22:-1),d(),g("text",!0)("rounded",!0)("loading",c.deleting()),d(),f((o=r.status)===c.ReportStatus.Generating?24:o===c.ReportStatus.Failed?25:26)}}function jo(i,t){if(i&1&&v(0,Lo,27,15),i&2){let e,n=l();f((e=n.report())?0:-1,e)}}function No(i,t){if(i&1){let e=x();a(0,"div",83),u("focusout",function(o){p(e);let r=l().$implicit,c=l();return m(c.onEditorFocusOut(r,o))}),a(1,"app-key-points-editor",84),u("contentChange",function(o){p(e);let r=l().$implicit,c=l();return m(c.onBlockContentChange(r,o))}),s()()}if(i&2){let e=l().$implicit,n=l();d(),g("content",n.blockContent(e))("disabled",n.savingBlocks().has(e))("focusPoint",n.caretPoint())}}function $o(i,t){if(i&1){let e=x();a(0,"div",83),u("focusout",function(o){p(e);let r=l().$implicit,c=l();return m(c.onEditorFocusOut(r,o))}),a(1,"app-table-editor",84),u("contentChange",function(o){p(e);let r=l().$implicit,c=l();return m(c.onBlockContentChange(r,o))}),s()()}if(i&2){let e=l().$implicit,n=l();d(),g("content",n.blockContent(e))("disabled",n.savingBlocks().has(e))("focusPoint",n.caretPoint())}}function Ko(i,t){if(i&1){let e=x();a(0,"div",83),u("focusout",function(o){p(e);let r=l().$implicit,c=l();return m(c.onEditorFocusOut(r,o))}),a(1,"app-highlight-cards-editor",84),u("contentChange",function(o){p(e);let r=l().$implicit,c=l();return m(c.onBlockContentChange(r,o))}),s()()}if(i&2){let e=l().$implicit,n=l();d(),g("content",n.blockContent(e))("disabled",n.savingBlocks().has(e))("focusPoint",n.caretPoint())}}function Ho(i,t){if(i&1){let e=x();a(0,"div",83),u("focusout",function(o){p(e);let r=l().$implicit,c=l();return m(c.onEditorFocusOut(r,o))}),a(1,"app-recommendation-editor",84),u("contentChange",function(o){p(e);let r=l().$implicit,c=l();return m(c.onBlockContentChange(r,o))}),s()()}if(i&2){let e=l().$implicit,n=l();d(),g("content",n.blockContent(e))("disabled",n.savingBlocks().has(e))("focusPoint",n.caretPoint())}}function zo(i,t){if(i&1){let e=x();a(0,"div",87)(1,"span",88),_(2,"Stijl"),s(),a(3,"p-selectbutton",89),u("ngModelChange",function(o){p(e);let r=l(2).$implicit,c=l();return m(c.setHeadingStyle(r,o))}),s()()}if(i&2){let e=l(2).$implicit,n=l();d(3),g("size","small")("allowEmpty",!1)("options",n.headingStyleOptions)("disabled",n.headingStyleSaving()!==null)("ngModel",n.headingStyle(e))}}function Jo(i,t){if(i&1){let e=x();a(0,"div",85),u("focusout",function(o){p(e);let r=l().$implicit,c=l();return m(c.onEditorFocusOut(r,o))}),a(1,"app-inline-text-editor",86),u("valueChange",function(o){p(e);let r=l().$implicit,c=l();return m(c.onBlockTextChange(r,o))}),s(),v(2,zo,4,5,"div",87),s()}if(i&2){let e=l().$implicit,n=l();d(),g("value",n.blockText(e))("disabled",n.savingBlocks().has(e))("focusPoint",n.caretPoint()),d(),f(n.headingBandUiEnabled?2:-1)}}function Uo(i,t){if(i&1){let e=x();a(0,"div",85),u("focusout",function(o){p(e);let r=l().$implicit,c=l();return m(c.onEditorFocusOut(r,o))}),a(1,"app-markdown-editor",90),u("valueChange",function(o){p(e);let r=l().$implicit,c=l();return m(c.onBlockTextChange(r,o))}),s()()}if(i&2){let e=l().$implicit,n=l();d(),g("focusPoint",n.caretPoint())("value",n.blockText(e))("disabled",n.savingBlocks().has(e))}}function Go(i,t){if(i&1&&v(0,No,2,3,"div",82)(1,$o,2,3,"div",82)(2,Ko,2,3,"div",82)(3,Ho,2,3,"div",82)(4,Jo,3,4,"div")(5,Uo,2,3,"div"),i&2){let e,n=t.blockTypeKey;f((e=n)==="keyPoints"?0:e==="table"?1:e==="highlightCards"?2:e==="recommendation"?3:e==="heading"?4:5)}}function qo(i,t){if(i&1){let e=x();a(0,"div",98)(1,"label",100),_(2,"Hoogte (mm)"),s(),a(3,"p-inputnumber",101),u("ngModelChange",function(o){p(e);let r=l(3);return m(r.patchLogoHeightMm(o))}),s()()}if(i&2){let e=l(2),n=l();d(3),g("fluid",!0)("min",n.pageLimits.logoHeightMinMm)("max",n.pageLimits.logoHeightMaxMm)("useGrouping",!1)("placeholder","16")("ngModel",e.logo.heightMm)}}function Yo(i,t){if(i&1){let e=x();a(0,"div")(1,"h4",96),_(2,"Logo"),s(),a(3,"p",97),_(4," Het logo komt uit het rapport: hier bepaal je hoe groot en waar het staat. "),s()(),a(5,"div",98)(6,"span",88),_(7,"Formaat"),s(),a(8,"p-selectbutton",99),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchLogoConfig({size:o}))}),s()(),v(9,qo,4,6,"div",98),a(10,"div",98)(11,"span",88),_(12,"Uitlijning"),s(),a(13,"p-selectbutton",99),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchLogoConfig({align:o}))}),s()()}if(i&2){let e=l(),n=l();d(8),g("size","small")("allowEmpty",!1)("options",n.logoSizeOptions)("ngModel",e.logo.size),d(),f(e.logo.size==="custom"?9:-1),d(4),g("size","small")("allowEmpty",!1)("options",n.logoAlignOptions)("ngModel",e.logo.align)}}function Wo(i,t){i&1&&(a(0,"p",104),_(1," Dit rapport is goedgekeurd; de titel van het document staat vast. "),s())}function Qo(i,t){if(i&1){let e=x();a(0,"div")(1,"h4",96),_(2,"Rapporttitel"),s(),a(3,"p",97),_(4," De titel van het document, met wat eromheen staat. "),s()(),a(5,"div",98)(6,"label",102),_(7,"Titel"),s(),a(8,"input",103),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchDocumentTitle(o))}),s(),v(9,Wo,2,0,"p",104),s(),a(10,"div",98)(11,"label",105),_(12,"Bovenschrift"),s(),a(13,"input",106),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchTitleConfig({eyebrow:r.textOrNull(o)}))}),s()(),a(14,"div",98)(15,"label",107),_(16,"Ondertitel"),s(),a(17,"input",108),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchTitleConfig({subtitle:r.textOrNull(o)}))}),s()()}if(i&2){let e,n,o=l(),r=l();d(8),g("maxlength",r.documentTitleMaxLength)("readonly",!r.documentTitleEditable())("ngModel",o.documentTitle),d(),f(r.documentTitleEditable()?-1:9),d(4),g("maxlength",r.pageLimits.eyebrow)("ngModel",(e=o.title.eyebrow)!==null&&e!==void 0?e:""),d(4),g("maxlength",r.pageLimits.subtitle)("ngModel",(n=o.title.subtitle)!==null&&n!==void 0?n:"")}}function Xo(i,t){if(i&1){let e=x();a(0,"div")(1,"h4",96),_(2,"Rapportgegevens"),s(),a(3,"p",97),_(4," Welke regels op de pagina komen. Een regel zonder gegevens wordt niet getekend. "),s()(),a(5,"div",109)(6,"div",110)(7,"p-checkbox",111),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchInfoToggle("showClients",o))}),s(),a(8,"label",112),_(9,"Toon klantnaam"),s()(),a(10,"div",110)(11,"p-checkbox",113),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchInfoToggle("showSource",o))}),s(),a(12,"label",114),_(13,"Toon bron"),s()(),a(14,"div",110)(15,"p-checkbox",115),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchInfoToggle("showDate",o))}),s(),a(16,"label",116),_(17,"Toon datum"),s()(),a(18,"div",110)(19,"p-checkbox",117),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchInfoToggle("showAdvisor",o))}),s(),a(20,"label",118),_(21,"Toon adviseur"),s()(),a(22,"div",110)(23,"p-checkbox",119),u("ngModelChange",function(o){p(e);let r=l(2);return m(r.patchInfoToggle("showFirm",o))}),s(),a(24,"label",120),_(25,"Toon kantoorgegevens"),s()()()}if(i&2){let e=l();d(7),g("bin
1ary",!0)("ngModel",e.info.showClients),d(4),g("binary",!0)("ngModel",e.info.showSource),d(4),g("binary",!0)("ngModel",e.info.showDate),d(4),g("binary",!0)("ngModel",e.info.showAdvisor),d(4),g("binary",!0)("ngModel",e.info.showFirm)}}function Zo(i,t){if(i&1){let e=x();a(0,"div",91),u("click",function(){p(e);let o=l();return m(o.closeConfigEditor())}),s(),a(1,"div",92),u("click",function(o){return p(e),m(o.stopPropagation())}),v(2,Yo,14,9)(3,Qo,18,8)(4,Xo,26,10),a(5,"div",93)(6,"p-button",94),u("onClick",function(){p(e);let o=l();return m(o.closeConfigEditor())}),s(),a(7,"p-button",95),u("onClick",function(){p(e);let o=l();return m(o.saveConfigEditor())}),s()()()}if(i&2){let e=t,n=l();d(),fe(n.configPanelStyle()),d(),f(e.blockTypeKey==="logo"?2:e.blockTypeKey==="reportTitle"?3:4),d(4),g("text",!0)("disabled",n.configSaving()),d(),g("loading",n.configSaving())}}function er(i,t){i&1&&(a(0,"div",121),h(1,"app-document-image",127),s()),i&2&&(d(),g("documentId",t))}function tr(i,t){i&1&&(a(0,"p",123),_(1),s()),i&2&&(d(),E(t))}function nr(i,t){if(i&1){let e=x();a(0,"div",91),u("click",function(){p(e);let o=l();return m(o.closeImageEditor())}),s(),a(1,"div",92),u("click",function(o){return p(e),m(o.stopPropagation())}),a(2,"div")(3,"h4",96),_(4,"Afbeelding"),s(),a(5,"p",97),_(6," Wissel de afbeelding of pas het onderschrift aan. PNG, JPG of WebP, maximaal 5 MB. "),s()(),v(7,er,2,1,"div",121),a(8,"input",8,5),u("change",function(o){p(e);let r=l();return m(r.onImageFilePicked(o))}),s(),a(10,"div")(11,"p-button",122),u("onClick",function(){p(e);let o=J(9);return m(o.click())}),s()(),v(12,tr,2,1,"p",123),a(13,"div",98)(14,"label",124),_(15,"Onderschrift"),s(),a(16,"input",125),u("ngModelChange",function(o){p(e);let r=l();return m(r.patchImageCaption(o))}),s()(),a(17,"div",93)(18,"p-button",94),u("onClick",function(){p(e);let o=l();return m(o.closeImageEditor())}),s(),a(19,"p-button",126),u("onClick",function(){p(e);let o=l();return m(o.saveImageEditor())}),s()()()}if(i&2){let e,n,o=t,r=l();d(),fe(r.imagePanelStyle()),d(6),f((e=o.documentId)?7:-1,e),d(),g("accept",r.imageAccept),d(3),g("loading",r.imageUploading()),d(),f((n=r.imageEditorError())?12:-1,n),d(4),g("maxlength",r.imageLimits.caption)("ngModel",o.caption),d(2),g("text",!0)("disabled",r.imageSaving()),d(),g("loading",r.imageSaving())("disabled",!o.documentId||r.imageUploading())}}function ir(i,t){i&1&&h(0,"p-tag",129),i&2&&g("rounded",!0)}function or(i,t){if(i&1&&(a(0,"div",135),_(1),s()),i&2){let e=t;d(),q("",e," pagina",e===1?"":"'s","")}}function rr(i,t){if(i&1&&(a(0,"div",130),h(1,"i",133),a(2,"div",73)(3,"div",134),_(4),s(),v(5,or,2,2,"div",135),s()()),i&2){let e,n=l();d(4),E(n.fileName||"Document"),d(),f((e=n.pageCount)?5:-1,e)}}function ar(i,t){i&1&&(a(0,"p",123),_(1),s()),i&2&&(d(),E(t))}function lr(i,t){if(i&1){let e=x();a(0,"div",91),u("click",function(){p(e);let o=l();return m(o.closeAttachmentEditor())}),s(),a(1,"div",92),u("click",function(o){return p(e),m(o.stopPropagation())}),a(2,"div")(3,"h4",128),_(4),v(5,ir,1,1,"p-tag",129),s(),a(6,"p",97),_(7," Voeg een PDF-bestand toe (maximaal 15 MB). In de export vervangen de pagina's van de bijlage deze pagina. "),s()(),v(8,rr,6,2,"div",130),a(9,"input",8,6),u("change",function(o){p(e);let r=l();return m(r.onAttachmentFilePicked(o))}),s(),a(11,"div")(12,"p-button",131),u("onClick",function(){p(e);let o=J(10);return m(o.click())}),s()(),v(13,ar,2,1,"p",123),a(14,"div",93)(15,"p-button",132),u("onClick",function(){p(e);let o=l();return m(o.closeAttachmentEditor())}),s()()()}if(i&2){let e,n=t,o=l();d(),fe(o.attachmentPanelStyle()),d(3),P(" Bijlage \u2014 ",n.label||"Bijlage"," "),d(),f(n.required?5:-1),d(3),f(n.documentId?8:-1),d(),g("accept",o.attachmentAccept),d(3),g("label",n.documentId?"Vervangen":"PDF kiezen")("loading",o.attachmentUploading()),d(),f((e=o.attachmentEditorError())?13:-1,e),d(2),g("text",!0)("disabled",o.attachmentUploading())}}var sr=700,dr=12,cr="write_section";function yn(i){return i==="heading"?"text":"markdown"}function Cn(i){try{let t=JSON.parse(i.contentJson),e=yn(i.blockTypeKey),n=t?.[e];return typeof n=="string"?n:""}catch{return""}}function pr(i,t){let e;try{let n=JSON.parse(i.contentJson);e=typeof n=="object"&&n!==null?b({},n):{}}catch{e={}}return e[yn(i.blockTypeKey)]=t,JSON.stringify(e)}var vn=[1e3,4e3],mr=6e3,bn='Dit rapport toont bronvermeldingen in de PDF (volgens de sjabloon-instelling). Die zijn er nog niet, dus een export zou zonder bronvermeldingen naar de klant gaan. Pas de bronweergave van het sjabloon aan naar "alleen in de app" of wacht tot bronvermeldingen op papier beschikbaar zijn.',ur="create:integration-documents",_r=150,gr=2e4,qe=class i{reportsService=T(Le);hub=T(Ge);themesService=T(Mt);integrationsService=T(yt);authService=T(xt);messageService=T(ie);confirmationService=T(ne);route=T(be);router=T(ye);destroyRef=T(_e);doc=T(gt);ReportStatus=Fe;report=y(null);loading=y(!0);loadFailed=y(!1);deleting=y(!1);retrying=y(!1);exporting=y(!1);refreshing=y(!1);feed=y([]);startedSections=y(new Set);showAdvisorChrome=y(!0);liveFeedDegraded=y(!1);lastSequence=0;reportId=null;handlersRegistered=!1;destroyed=!1;refreshRequests$=new le;joiningId=null;pollSubscription=null;pollTicks=0;silenceTimer=null;feedSilent=!1;fetchSeq=0;firstRead=null;constructor(){this.themesService.ensureCache(),this.refreshRequests$.pipe(st(sr),L()).subscribe(()=>this.refresh()),this.route.paramMap.pipe(L()).subscribe(t=>{let e=t.get("id");e&&e!==this.reportId&&this.open(e)}),this.hub.rejoined$.pipe(L()).subscribe(t=>{t===this.reportId&&(this.feedSilent=!1,this.liveFeedDegraded.set(!1),this.stopFallbackPolling(),this.refresh(),this.armSilenceWatchdog(t))}),this.hub.connectionLost$.pipe(L()).subscribe(()=>{let t=this.reportId,e=this.report()?.status;this.clearSilenceWatchdog(),t&&(e===void 0||e===0)&&(this.liveFeedDegraded.set(!0),this.startFallbackPolling(t))}),this.destroyRef.onDestroy(()=>{this.destroyed=!0,this.stopFallbackPolling(),this.clearSilenceWatchdog(),this.reportId&&this.hub.leaveReport(this.reportId)})}themesLoaded=this.themesService.cacheLoaded;themesFailed=this.themesService.cacheFailed;pinnedTheme=C(()=>{let t=this.report();return t?this.themesService.cachedThemes().find(e=>e.id===t.themeId)??null:null});fallbackTheme=C(()=>{let t=this.themesService.cachedThemes();return t.find(e=>e.isDefault)??t[0]??null});usingFallbackTheme=C(()=>this.report()!==null&&this.themesLoaded()&&!this.themesFailed()&&this.pinnedTheme()===null);themesUnavailable=C(()=>this.report()!==null&&this.themesFailed()&&this.pinnedTheme()===null);fields=C(()=>{let t=this.pinnedTheme()??this.fallbackTheme();return t?Ft(t):Dt()});themeName=C(()=>this.themesUnavailable()?null:this.pinnedTheme()?.name??this.fallbackTheme()?.name??"Standaardopmaak");renderDocument=C(()=>{let t=this.report();return t?nn(t,this.startedSections()):null});selectedBlockId=y(null);factsByKey=C(()=>{let t=new Map;for(let e of this.renderDocument()?.facts??[])t.set(e.key,e);return t});citedFacts=C(()=>{let t=this.report();if(!t)return[];let e=this.factsByKey(),n=new Set,o=[],r=[...t.sections].sort((c,k)=>c.order-k.order);for(let c of r){if(c.isOmitted)continue;let k=[...c.blocks].sort((S,B)=>S.order-B.order);for(let S of k)if(!S.isOmitted)for(let B of et(S.contentJson)){if
1(n.has(B))continue;n.add(B);let me=e.get(B);me&&o.push(me)}}return o});sourcesSelection=C(()=>{let t=this.selectedBlockId();if(!t)return null;let e=this.blockById(t);if(!e||e.isOmitted)return null;let n=this.factsByKey();return{blockId:t,blockLabel:$t(e.blockTypeKey),facts:et(e.contentJson).map(o=>n.get(o)).filter(o=>o!==void 0)}});clearSourceSelection(){this.selectedBlockId.set(null)}static STRUCTURED_BLOCK_TYPES=["keyPoints","table","highlightCards","recommendation"];static EDITABLE_BLOCK_TYPES=["paragraph","callout","quote","staticText","heading",...i.STRUCTURED_BLOCK_TYPES];static CONFIG_BLOCK_TYPES=["reportTitle","reportInfo","logo"];static IMAGE_BLOCK_TYPE="image";static ATTACHMENT_BLOCK_TYPE=Gt;editableBlockIds=C(()=>{let t=this.report();return!t||t.status!==1||!this.showAdvisorChrome()?new Set:new Set(t.sections.flatMap(e=>e.blocks).filter(e=>i.EDITABLE_BLOCK_TYPES.includes(e.blockTypeKey)||i.CONFIG_BLOCK_TYPES.includes(e.blockTypeKey)||e.blockTypeKey===i.IMAGE_BLOCK_TYPE).map(e=>e.id))});actionableBlockIds=C(()=>{let t=this.report();return!t||t.status!==1||!this.showAdvisorChrome()?new Set:new Set(t.sections.flatMap(e=>e.blocks).filter(e=>e.blockTypeKey===i.ATTACHMENT_BLOCK_TYPE).map(e=>e.id))});drafts=y(new Map);savingBlocks=y(new Set);editingBlockId=y(null);caretPoint=y(null);currentStepText=C(()=>this.feed().at(-1)?.text??this.feedPlaceholder());hasAdvisorNotes=C(()=>{let t=this.renderDocument();return t?t.sections.some(e=>e.isOmitted||e.blocks.some(n=>n.isOmitted||n.isConditional)||qt(e)&&!Yt(e)):!1});sectionProgress=C(()=>{let t=this.renderDocument();if(!t)return null;let e=t.sections.filter(r=>r.pageStyleKey===null),n=e.length,o=e.filter(r=>!r.isPending).length;return n>0?{done:o,total:n}
1:null});statusLabel=C(()=>{let t=this.report();return t?ce[t.status]:""});statusSeverity=C(()=>{let t=this.report();return t?Me[t.status]:"secondary"});feedbackSubjectId=C(()=>{let t=this.report();return t&&t.status!==0?t.id:null});sourceLabel=C(()=>{let t=this.report();return t?Be[t.sourceKind]:""});sourceIcon=C(()=>{let t=this.report();return t?Ae[t.sourceKind]:"pi pi-folder"});sourceLink=C(()=>{let t=this.report();return t?t.sourceKind===0&&t.dataContainerId?["/containers",t.dataContainerId]:t.sourceKind===1&&t.meetingId?["/meetings",t.meetingId]:null:null});failureText=C(()=>Oe(this.report()?.failureMessage??null));shownTitle=C(()=>{let t=this.report();return t?t.displayTitle?.trim()||t.title:""});titleEditing=y(!1);titleSaving=y(!1);titleDraft=y("");titleInput=G("reportTitleInput");startTitleEdit(){this.report()&&(this.titleDraft.set(this.shownTitle()),this.titleEditing.set(!0),setTimeout(()=>this.titleInput()?.nativeElement.select()))}cancelTitleEdit(){this.titleSaving()||this.titleEditing.set(!1)}saveTitle(){let t=this.report();if(!t||this.titleSaving()||!this.titleEditing())return;let e=this.titleDraft().trim(),n=e.length===0?null:e,o=t.displayTitle?.trim()||null;if(n===o){this.titleEditing.set(!1);return}this.titleSaving.set(!0),this.reportsService.rename(t.id,n).subscribe({next:r=>{this.titleSaving.set(!1),this.titleEditing.set(!1),this.report.update(c=>c===null?c:w(b({},c),{displayTitle:r.displayTitle??null}))},error:()=>{this.titleSaving.set(!1),this.toastError("De titel kon niet worden opgeslagen. Probeer het opnieuw.")}})}feedPlaceholder=C(()=>this.liveFeedDegraded()?"Het rapport wordt geschreven\u2026":"Het rapport staat in de wachtrij\u2026");open(t){return $(this,null,function*(){let e=this.reportId;this.reportId=t,this.report.set(null),this.feed.set([]),this.startedSections.set(new Set),this.selectedBlockId.set(null),this.lastSequence=0,this.liveFeedDegraded.set(!1),this.feedSilent=!1,this.stopFallbackPolling(),this.clearSilenceWatchdog(),e&&e!==t&&this.hub.leaveReport(e),this.load(t),yield this.connectFeed(t)})}connectFeed(t){return $(this,null,function*(){for(let e=0;;e++){if(this.destroyed||this.reportId!==t||(yield this.tryJoin(t)))return;if(e>=vn.length)break;yield fr(vn[e])}this.destroyed||this.reportId!==t||this.handlersRegistered&&!this.liveFeedDegraded()||(this.liveFeedDegraded.set(!0),this.startFallbackPolling(t))})}tryJoin(t){return $(this,null,function*(){if(this.joiningId===t)return!1;this.joiningId=t;let e=null;try{e=yield this.hub.joinReport(t)}catch{return!1}finally{this.joiningId===t&&(this.joiningId=null)}if(this.destroyed||this.reportId!==t)return!1;this.feedSilent||(this.stopFallbackPolling(),this.liveFeedDegraded.set(!1)),this.registerHandlers();let n=e?.reportId===t?e.status:void 0;return n!==void 0&&n!==0?(this.clearSilenceWatchdog(),yield this.firstRead,this.reportId===t&&this.report()?.status!==n&&this.refresh(),!0):(this.armSilenceWatchdog(t),yield this.firstRead,this.reportId===t&&this.report()?.status===0&&this.refresh(),!0)})}armSilenceWatchdog(t){this.clearSilenceWatchdog(),!(this.destroyed||this.reportId!==t||this.feedSilent)&&(this.silenceTimer=setTimeout(()=>{if(this.silenceTimer=null,this.destroyed||this.reportId!==t)return;let e=this.report()?.status;e!==void 0&&e!==0||(this.feedSilent=!0,this.liveFeedDegraded.set(!0),this.startFallbackPolling(t))},gr))}clearSilenceWatchdog(){this.silenceTimer!==null&&(clearTimeout(this.silenceTimer),this.silenceTimer=null)}noteFeedActivity(){let t=this.reportId;t&&(this.feedSilent&&(this.feedSilent=!1,this.liveFeedDegraded.set(!1),this.stopFallbackPolling()),this.armSilenceWatchdog(t))}startFallbackPolling(t){this.pollSubscription||this.destroyed||(this.pollTicks=0,this.pollSubscription=ue(mr).pipe(L(this.destroyRef)).subscribe(()=>{if(this.reportId!==t||++this.pollTicks>_r){this.stopFallbackPolling();return}let e=this.report()?.status;if(e!==void 0&&e!==0){this.stopFallbackPolling();return}this.refresh(),this.tryJoin(t)}))}stopFallbackPolling(){this.pollSubscription?.unsubscribe(),this.pollSubscription=null}load(t=this.reportId){t&&(this.firstRead=this.read(t,!1))}read(t,e){let n=++this.fetchSeq;return e?this.refreshing.set(!0):(this.loading.set(!0),this.loadFailed.set(!1)),new Promise(o=>{this.reportsService.getById(t).subscribe({next:r=>{this.refreshing.set(!1),this.reportId===t&&n===this.fetchSeq&&(this.report.set(r),this.loading.set(!1),this.loadFailed.set(!1)),o()},error:()=>{this.refreshing.set(!1),this.reportId===t&&n===this.fetchSeq&&!(e&&this.report()!==null)&&(this.loading.set(!1),this.loadFailed.set(!0)),o()}})})}humanTarget(t){return t&&this.report()?.sections?.find(n=>n.key===t)?.name?.trim()||null}refresh(){this.reportId&&this.read(this.reportId,!0)}refreshNow(){this.refresh()}retryThemes(){this.themesService.retryFailedCache()}registerHandlers(){this.handlersRegistered||(this.handlersRegistered=!0,this.hub.onGenerationProgress().pipe(L(this.destroyRef)).subscribe(t=>{t.reportId===this.reportId&&(this.noteFeedActivity(),!(t.sequence<=this.lastSequence)&&(this.lastSequence=t.sequence,t.phase===cr&&t.target&&this.startedSections.update(e=>new Set(e).add(t.target)),this.appendStep(t.sequence,tn(t.phase,this.humanTarget(t.target)))))}),this.hub.onSectionCompleted().pipe(L(this.destroyRef)).subscribe(t=>{t.reportId===this.reportId&&(this.noteFeedActivity(),this.refreshRequests$.next())}),this.hub.onCompleted().pipe(L(this.destroyRef)).subscribe(t=>{t.reportId===this.reportId&&(this.noteFeedActivity(),this.refresh())}),this.hub.onFailed().pipe(L(this.destroyRef)).subscribe(t=>{t.reportId===this.reportId&&(this.noteFeedActivity(),this.refresh())}))}appendStep(t,e){this.feed.update(n=>n.at(-1)?.text===e?n:[...n,{sequence:t,text:e}].slice(-dr))}activateBlock(t){if(this.selectedBlockId.set(t.blockId),!this.editableBlockIds().has(t.blockId)&&!this.actionableBlockIds().has(t.blockId))return;let e=this.editingBlockId();if(e===t.blockId)return;e!==null&&this.flushBlock(e);let n=this.blockById(t.blockId);if(n&&i.CONFIG_BLOCK_TYPES.includes(n.blockTypeKey)){this.closeImageEditor(),this.openConfigEditor(n,t);return}if(n&&n.blockTypeKey===i.IMAGE_BLOCK_TYPE){this.closeConfigEditor(),this.closeAttachmentEditor(),this.openImageEditor(n,t);return}
1if(n&&n.blockTypeKey===i.ATTACHMENT_BLOCK_TYPE){if(this.closeConfigEditor(),this.closeImageEditor(),t.intent==="replaceAttachment"){this.beginAttachmentReplace(n);return}if(t.intent==="removeAttachment"){this.confirmAttachmentRemoval(n);return}this.openAttachmentEditor(n,t);return}this.closeConfigEditor(),this.closeImageEditor(),this.closeAttachmentEditor(),this.caretPoint.set({x:t.x,y:t.y}),this.editingBlockId.set(t.blockId)}configEditor=y(null);configSaving=y(!1);pageLimits=De;logoSizeOptions=Kt;logoAlignOptions=Ht;openConfigEditor(t,e){this.editingBlockId.set(null),this.caretPoint.set(null),this.configEditor.set({blockId:t.id,blockTypeKey:t.blockTypeKey,x:e.x,y:e.y,title:Bt(t.configJson),info:Lt(t.configJson),logo:At(t.configJson),documentTitle:this.effectiveDocumentTitle(),appearance:Xe(t.configJson)})}closeConfigEditor(){this.configEditor.set(null)}patchTitleConfig(t){this.configEditor.update(e=>e&&w(b({},e),{title:b(b({},e.title),t)}))}patchDocumentTitle(t){this.configEditor.update(e=>e&&w(b({},e),{documentTitle:t}))}documentTitleMaxLength=200;documentTitleEditable=C(()=>this.report()?.status===1);effectiveDocumentTitle(){let t=this.report();return t&&(t.title.trim()||t.reportInfo?.title?.trim())||""}patchDocumentTitleLocally(t){this.report.update(e=>e===null?e:w(b({},e),{title:t}))}patchInfoToggle(t,e){this.configEditor.update(n=>n&&w(b({},n),{info:w(b({},n.info),{[t]:e})}))}patchLogoConfig(t){this.configEditor.update(e=>e&&w(b({},e),{logo:b(b({},e.logo),t)}))}patchLogoHeightMm(t){let e=t===null?null:Math.min(De.logoHeightMaxMm,Math.max(De.logoHeightMinMm,Math.round(t)));this.patchLogoConfig({heightMm:e})}textOrNull(t){return t.trim().length===0?null:t}saveConfigEditor(){let t=this.report(),e=this.configEditor();if(!t||!e||this.configSaving())return;let n=e.blockTypeKey==="reportTitle"?jt(e.title):e.blockTypeKey==="logo"?Ot(e.logo):Nt(e.info),o=Ze(n,e.appearance)??"{}",r=e.blockTypeKey==="reportTitle"?e.documentTitle.trim():"",c=r.length>0&&this.documentTitleEditable()&&r!==this.effectiveDocumentTitle(),k=this.blockById(e.blockId)?.configJson??"{}",S=t.title;this.patchBlockConfig(e.blockId,o),c&&this.patchDocumentTitleLocally(r),this.configSaving.set(!0);let B=()=>{this.reportsService.editBlockConfig(t.id,e.blockId,o).subscribe({next:()=>{this.configSaving.set(!1),this.closeConfigEditor()},error:()=>{this.configSaving.set(!1),this.patchBlockConfig(e.blockId,k),this.toastError("De instellingen konden niet worden opgeslagen.")}})};if(!c){B();return}this.reportsService.renameDocumentTitle(t.id,r).subscribe({next:me=>{this.patchDocumentTitleLocally(me.title),B()},error:()=>{this.patchDocumentTitleLocally(S),this.toastError("De titel kon niet worden opgeslagen. Probeer het opnieuw."),B()}})}configPanelStyle(){let t=this.configEditor(),e=this.doc.defaultView;if(!t||!e)return{};let n=320,o=Math.max(12,Math.min(t.x-n/2,e.innerWidth-n-12)),r=Math.max(12,Math.min(t.y+10,e.innerHe
1ight-340));return{position:"fixed",left:`${o}px`,top:`${r}px`,width:`${n}px`,"z-index":"1100"}}imageEditor=y(null);imageSaving=y(!1);imageUploading=y(!1);imageEditorError=y(null);imageLimits=oe;imageAccept=oe.allowedContentTypes.join(",");openImageEditor(t,e){this.editingBlockId.set(null),this.caretPoint.set(null);let n=Qt(t.contentJson);this.imageEditorError.set(null),this.imageEditor.set({blockId:t.id,x:e.x,y:e.y,documentId:n.documentId,caption:n.caption??""})}closeImageEditor(){this.imageEditor.set(null),this.imageEditorError.set(null)}patchImageCaption(t){this.imageEditor.update(e=>e&&w(b({},e),{caption:t}))}onImageFilePicked(t){let e=t.target,n=e.files?.[0]??null;e.value="";let o=this.report();if(!(!n||!o||this.imageUploading()||!this.imageEditor())){if(!oe.allowedContentTypes.includes(n.type)){this.imageEditorError.set("Alleen PNG, JPG of WebP wordt ondersteund.");return}if(n.size>oe.maxUploadBytes){this.imageEditorError.set("De afbeelding is te groot. Maximaal 5 MB.");return}this.imageEditorError.set(null),this.imageUploading.set(!0),this.reportsService.uploadImage(o.id,n).subscribe({next:r=>{if(this.imageUploading.set(!1),!r?.id){this.imageEditorError.set("De afbeelding kon niet worden ge\xFCpload. Probeer het opnieuw.");return}this.imageEditor.update(c=>c&&w(b({},c),{documentId:r.id}))},error:()=>{this.imageUploading.set(!1),this.imageEditorError.set("De afbeelding kon niet worden ge\xFCpload. Probeer het opnieuw.")}})}}saveImageEditor(){let t=this.report(),e=this.imageEditor();if(!t||!e||this.imageSaving()||this.imageUploading())return;let n=this.blockById(e.blockId);if(!n||!e.documentId)return;let o;try{let S=JSON.parse(n.contentJson);o=typeof S=="object"&&S!==null?b({},S):{}}catch{o={}}o.documentId=e.documentId;let r=e.caption.trim().slice(0,oe.caption);r?o.caption=r:delete o.caption;let c=JSON.stringify(o),k=n.contentJson;this.patchBlockContent(e.blockId,c),this.imageSaving.set(!0),this.reportsService.editBlock(t.id,e.blockId,c).subscribe({next:S=>{this.imageSaving.set(!1),this.patchBlockContent(e.blockId,S.contentJson),this.closeImageEditor()},error:()=>{this.imageSaving.set(!1),this.patchBlockContent(e.blockId,k),this.toastError("De afbeelding kon niet worden opgeslagen.")}})}imagePanelStyle(){let t=this.imageEditor(),e=this.doc.defaultView;if(!t||!e)return{};let n=320,o=Math.max(12,Math.min(t.x-n/2,e.innerWidth-n-12)),r=Math.max(12,Math.min(t.y+10,e.innerHe
1ight-420));return{position:"fixed",left:`${o}px`,top:`${r}px`,width:`${n}px`,"z-index":"1100"}}attachmentEditor=y(null);attachmentUploading=y(!1);attachmentEditorError=y(null);attachmentLimits=Y;attachmentAccept=Y.allowedContentTypes.join(",");openAttachmentEditor(t,e){this.editingBlockId.set(null),this.caretPoint.set(null);let n=We(t.configJson),o=Qe(t.contentJson);this.attachmentEditorError.set(null),this.attachmentEditor.set({blockId:t.id,x:e.x,y:e.y,label:n.label,required:n.required,documentId:o.documentId,fileName:o.fileName,pageCount:o.pageCount})}closeAttachmentEditor(){this.attachmentEditor.set(null),this.attachmentEditorError.set(null)}onAttachmentFilePicked(t){let e=t.target,n=e.files?.[0]??null;e.value="";let o=this.report(),r=this.attachmentEditor();if(!(!n||!o||!r||this.attachmentUploading())){if(!Y.allowedContentTypes.includes(n.type)){this.attachmentEditorError.set("Alleen een PDF-bestand wordt ondersteund.");return}if(n.size>Y.maxUploadBytes){this.attachmentEditorError.set("Het bestand is te groot. Maximaal 15 MB.");return}this.attachmentEditorError.set(null),this.attachmentUploading.set(!0),this.reportsService.uploadAttachment(o.id,r.blockId,n).subscribe({next:c=>{this.attachmentUploading.set(!1),this.patchBlockContent(c.blockId,c.contentJson);let k=Qe(c.contentJson);this.attachmentEditor.update(S=>S&&w(b({},S),{documentId:k.documentId,fileName:k.fileName,pageCount:k.pageCount}))},error:c=>{this.attachmentUploading.set(!1),this.attachmentEditorError.set(c.status===400||c.status===422?"Dit PDF-bestand kan niet worden gebruikt: het is mogelijk beveiligd of beschadigd.":"De bijlage kon niet worden ge\xFCpload. Probeer het opnieuw.")}})}}attachmentPanelStyle(){let t=this.attachmentEditor(),e=this.doc.defaultView;if(!t||!e)return{};let n=320,o=Math.max(12,Math.min(t.x-n/2,e.innerWidth-n-12)),r=Math.max(12,Math.min(t.y+10,e.innerHe
1ight-360));return{position:"fixed",left:`${o}px`,top:`${r}px`,width:`${n}px`,"z-index":"1100"}}attachmentReplaceInput=G("attachmentReplaceFile");attachmentReplaceBlockId=y(null);beginAttachmentReplace(t){this.attachmentUploading()||(this.closeAttachmentEditor(),this.attachmentReplaceBlockId.set(t.id),this.attachmentReplaceInput()?.nativeElement.click())}onAttachmentReplacePicked(t){let e=t.target,n=e.files?.[0]??null;e.value="";let o=this.report(),r=this.attachmentReplaceBlockId();if(this.attachmentReplaceBlockId.set(null),!(!n||!o||!r||this.attachmentUploading())){if(!Y.allowedContentTypes.includes(n.type)){this.toastError("Alleen een PDF-bestand wordt ondersteund.");return}if(n.size>Y.maxUploadBytes){this.toastError("Het bestand is te groot. Maximaal 15 MB.");return}this.attachmentUploading.set(!0),this.reportsService.uploadAttachment(o.id,r,n).subscribe({next:c=>{this.attachmentUploading.set(!1),this.patchBlockContent(c.blockId,c.contentJson)},error:c=>{this.attachmentUploading.set(!1),this.toastError(c.status===400||c.status===422?"Dit PDF-bestand kan niet worden gebruikt: het is mogelijk beveiligd of beschadigd.":"De bijlage kon niet worden ge\xFCpload. Probeer het opnieuw.")}})}}attachmentRemoving=y(!1);confirmAttachmentRemoval(t){if(this.attachmentRemoving())return;let e=We(t.configJson).label.trim()||"Bijlage";this.confirmationService.confirm({header:"Bijlage verwijderen",message:`"${e}" wordt uit het rapport verwijderd. Je kunt daarna opnieuw een PDF toevoegen.`,icon:"pi pi-exclamation-triangle text-sm text-muted-color",closable:!1,closeOnEscape:!0,acceptButtonProps:{label:"Verwijderen",severity:"danger",size:"small"},rejectButtonProps:{label:"Annuleren",severity:"secondary",size:"small"},accept:()=>this.removeAttachment(t.id)})}removeAttachment(t){let e=this.report();!e||this.attachmentRemoving()||(this.attachmentRemoving.set(!0),this.closeAttachmentEditor(),this.reportsService.removeAttachment(e.id,t).subscribe({next:n=>{this.attachmentRemoving.set(!1),this.patchBlockContent(n.blockId,n.contentJson)},error:()=>{this.attachmentRemoving.set(!1),this.toastError("De bijlage kon niet worden verwijderd. Probeer het opnieuw.")}}))}headingStyleOptions=zt;headingBandUiEnabled=Ut;headingStyleSaving=y(null);headingStyle(t){return Jt(this.parsedConfig(t))}setHeadingStyle(t,e){let n=this.report();if(!n||this.headingStyleSaving()!==null)return;let o=this.parsedConfig(t);e==="band"?o.style="band":delete o.style;let r=JSON.stringify(o),c=Ze(r,Xe(r))??"{}",k=this.blockById(t)?.configJson??"{}";this.patchBlockConfig(t,c),this.headingStyleSaving.set(t),this.reportsService.editBlockConfig(n.id,t,c).subscribe({next:()=>this.headingStyleSaving.set(null),error:()=>{this.headingStyleSaving.set(null),this.patchBlockConfig(t,k),this.toastError("De stijl van de kop kon niet worden opgeslagen.")}})}parsedConfig(t){try{let e=JSON.parse(this.blockById(t)?.configJson??"");return e!==null&&typeof e=="object"&&!Array.isArray(e)?b({},e):{}}catch{return{}}}patchBlockConfig(t,e){this.report.update(n=>n===null?n:w(b({},n),{sections:n.sections.map(o=>w(b({},o),{blocks:o.blocks.map(r=>r.id===t?w(b({},r),{configJson:e}):r)}))}))}blockText(t){let e=this.drafts().get(t);if(e!==void 0)return e;let n=this.blockById(t);return n?Cn(n):""}blockContent(t){let e=this.drafts().get(t);return e!==void 0?e:this.blockById(t)?.contentJson??"{}"}onBlockContentChange(t,e){this.drafts.update(n=>new Map(n).set(t,e))}onBlockTextChange(t,e){this.drafts.update(n=>new Map(n).set(t,e))}onEditorFocusOut(t,e){let n=e.currentTarget;if(n===null){this.flushBlock(t);return}setTimeout(()=>{this.destroyed||this.editingBlockId()!==t||n.contains(document.activeElement)||this.flushBlock(t)})}flushBlock(t){let e=this.report(),n=this.blockById(t),o=this.drafts().get(t);if(this.editingBlockId()===t&&(this.editingBlockId.set(null),this.caretPoint.set(null)),!e||!n||o===void 0||this.savingBlocks().has(t))return;let r=i.STRUCTURED_BLOCK_TYPES.includes(n.blockTypeKey),c=n.contentJson,k=r?o:pr(n,o);if(k===c||!r&&o===Cn(n)){this.clearDraft(t);return}this.patchBlockContent(t,k),this.savingBlocks.update(S=>new Set(S).add(t)),this.reportsService.editBlock(e.id,t,k).subscribe({next:S=>{this.releaseBlock(t),this.clearDraft(t),this.patchBlockContent(t,S.contentJson)},error:()=>{this.releaseBlock(t),this.patchBlockContent(t,c),this.editingBlockId.set(t),this.toastError("De wijziging kon niet worden opgeslagen. Je tekst staat nog in het blok.")}})}patchBlockContent(t,e){this.report.update(n=>n===null?n:w(b({},n),{sections:n.sections.map(o=>w(b({},o),{blocks:o.blocks.map(r=>r.id===t?w(b({},r),{contentJson:e,isOmitted:!1,omissionReason:null}):r)}))}
1))}blockById(t){return this.report()?.sections.flatMap(e=>e.blocks).find(e=>e.id===t)}clearDraft(t){this.drafts.update(e=>{let n=new Map(e);return n.delete(t),n})}releaseBlock(t){this.savingBlocks.update(e=>{let n=new Set(e);return n.delete(t),n})}canExport=C(()=>{let t=this.report()?.status;return t===1||t===2});citationsNotPrintable=C(()=>{let t=this.report();return t!==null&&t.citationDisplay!==0});exportBlockedText=bn;missingRequiredAttachments=C(()=>{let t=this.renderDocument();return t?Wt(t.sections):[]});attachmentsBlockedText=C(()=>{let t=this.missingRequiredAttachments();return t.length===0?null:t.length===1?`De verplichte bijlage "${t[0]}" ontbreekt nog. Voeg het PDF-bestand toe voordat je het rapport goedkeurt of exporteert.`:`De verplichte bijlagen ${t.map(e=>`"${e}"`).join(", ")} ontbreken nog. Voeg de PDF-bestanden toe voordat je het rapport goedkeurt of exporteert.`});exportIntegrations=C(()=>this.authService.authorized([ur])?this.integrationsService.integrations().filter(t=>t.active&&t.definition?.implements?.includes("ICreateDocument")):[]);exportMenuItems=C(()=>{let t=[{label:"Exporteren naar PDF",icon:"pi pi-file-pdf",command:()=>this.exportPdf()}],e=this.exportIntegrations();e.length>0&&t.push({separator:!0});for(let n of e)t.push({label:`Exporteren naar ${n.definition.name}`,image:n.definition.image,command:()=>this.exportToIntegration(n)});return t});openExportMenu(t,e){this.refuseExport()||e.toggle(t)}refuseExport(){let t=this.citationsNotPrintable()?bn:this.attachmentsBlockedText();return t?(this.messageService.add({severity:"warn",summary:"Exporteren is niet mogelijk",detail:t,life:1e4,styleClass:"p-no-icon"}),!0):!1}exportPdf(){let t=this.report();!t||this.exporting()||this.refuseExport()||(this.exporting.set(!0),this.reportsService.exportPdf(t.id).subscribe({next:e=>{this.exporting.set(!1);let n=e.body;if(!n||n.size===0){this.toastError("Het rapport kon niet worden ge\xEBxporteerd.");return}this.saveFile(n,hr(e,t.title))},error:e=>{this.exporting.set(!1),this.toastError(e.status===409?"Dit rapport kan nog niet worden ge\xEBxporteerd; het is nog niet klaar.":"Het exporteren is mislukt. Probeer het opnieuw.")}}))}exportToIntegration(t){let e=this.report();if(!e||this.exporting()||this.refuseExport())return;let n=t.definition.name;this.exporting.set(!0),this.reportsService.exportToIntegration(e.id,t.id).subscribe({next:()=>{this.exporting.set(!1),this.messageService.add({severity:"success",summary:`Opgeslagen in ${n}`,detail:`Het rapport staat als PDF bij de klant in ${n}.`,life:5e3,styleClass:"p-no-icon"})},error:o=>{this.exporting.set(!1),this.toastError(en(o,n),8e3)}})}saveFile(t,e){let n=URL.createObjectURL(t),o=this.doc.createElement("a");o.href=n,o.download=e,o.rel="noopener",this.doc.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}retry(){let t=this.report();!t||this.retrying()||(this.retrying.set(!0),this.reportsService.retry(t.id).subscribe({next:()=>{this.retrying.set(!1),this.feed.set([]),this.startedSections.set(new Set),this.lastSequence=0,this.refresh(),this.reportId&&(!this.handlersRegistered||this.liveFeedDegraded())&&this.connectFeed(this.reportId)},error:()=>{this.retrying.set(!1),this.toastError("Het rapport kon niet opnieuw worden gestart.")}}))}confirmDelete(t){let e=this.report();e&&this.confirmationService.confirm({target:t.currentTarget,header:"Rapport verwijderen",message:`"${e.title}" wordt verwijderd. Dit kan niet ongedaan worden gemaakt.`,icon:"pi pi-exclamation-triangle text-sm text-muted-color",closable:!1,closeOnEscape:!0,acceptButtonProps:{label:"Verwijderen",severity:"danger"},rejectButtonProps:{label:"Annuleren",severity:"secondary"},accept:()=>this.deleteReport()})}deleteReport(){let t=this.report();t&&(this.deleting.set(!0),this.reportsService.delete(t.id).subscribe({next:()=>{this.deleting.set(!1),this.router.navigate(["/reports"])},error:()=>{this.deleting.set(!1),this.toastError("Het rapport kon niet worden verwijderd.")}}))}toastError(t,e=4e3){this.messageService.add({severity:"error",summary:"Fout",detail:t,life:e,styleClass:"p-no-icon"})}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=V({type:i,selectors:[["app-report-detail"]],viewQuery:function(e,n){e&1&&(z(n.titleInput,lo,5),z(n.attachmentReplaceInput,so,5)),e&2&&X(2)},features:[he([ie,ne])],decls:17,vars:5,consts:[["attachmentReplaceFile",""],["blockEditor",""],["reportTitleInput",""],["exportMenu",""],["item",""],["reportImageFile",""],["reportAttachmentFile",""],[1,"flex","w-full","max-w-[1200px]","flex-col","justify-center"],["type","file",1,"hidden",3,"change","accept"],["routerLink","/reports",1,"text-muted-color","hover:text-color","mb-4","inline-flex","w-fit","items-center","gap-2","text-sm","transition-colors"],[1,"pi","pi-arrow-left","text-xs"],[1,"flex","flex-col","gap-4"],[1,"flex","flex-col","items-center","gap-4","rounded-xl","border","border-surface-200","py-16","text-center","dar
1k:border-surface-700"],["height","2rem","width","24rem","borderRadius","8px"],["height","1rem","width","32rem","borderRadius","8px"],["height","24rem","borderRadius","12px"],[1,"pi","pi-exclamation-triangle","text-2xl!","text-muted-color"],[1,"text-color","font-medium"],[1,"text-muted-color","mt-1","text-sm"],[1,"flex","flex-wrap","justify-center","gap-3"],["label","Opnieuw proberen","icon","pi pi-refresh","severity","secondary",3,"onClick","outlined"],["label","Naar alle rapporten","severity","secondary","routerLink","/reports",3,"text"],[1,"mb-6","flex","flex-col","gap-4","lg:flex-row","lg:items-start","lg:justify-between"],[1,"flex-1"],[1,"flex","flex-wrap","items-center","gap-3"],[1,"text-muted-color","mt-3","flex","flex-wrap","items-center","gap-x-4","gap-y-1","text-sm"],[1,"inline-flex","items-center","gap-1.5"],[1,"pi","pi-clone","text-xs"],[1,"hover:text-color","inline-flex","items-center","gap-1.5","transition-colors",3,"routerLink"],[1,"pi","pi-clock","text-xs"],[1,"flex","shrink-0","items-center","gap-2"],["subject","report",3,"subjectId"],[1,"flex","items-center","justify-end"],["label","Opnieuw proberen","icon","pi pi-refresh","size","small",3,"loading"],["icon","pi pi-trash","size","small","severity","danger","ariaLabel","Rapport verwijderen","pTooltip","Rapport verwijderen","tooltipPosition","bottom",3,"onClick","text","rounded","loading"],[1,"flex","flex-col","items-center","gap-5","rounded-xl","border","border-surface-200","px-6","py-14","text-center","dark:border-surface-700"],["pInputText","","type","text","maxlength","200",1,"text-color","w-full","max-w-md","text-2xl!","font-semibold",3,"ngModelChange","keydown.enter","keydown.escape","ngModel","disabled"],["icon","pi pi-check","size","small","severity","primary","ariaLabel","Titel opslaan",3,"onClick","text","rounded","loading"],["icon","pi pi-times","size","small","severity","secondary","ariaLabel","Annuleren",1,"opacity-50",3,"onClick","text","rounded","disabled"],[1,"text-color","m-0","text-2xl","font-semibold"],["icon","pi pi-pencil","size","small","severity","secondary","ariaLabel","Titel wijzigen","pTooltip","Titel wijzigen","tooltipPosition","bottom",3,"onClick","text","rounded"],["styleClass","p-tag-small",3,"value","severity","rounded"],["styleClass","p-tag-small","severity","secondary","pTooltip","De sjabloonversie waarmee dit rapport is gemaakt","tooltipPosition","bottom",3,"value","rounded"],[1,"text-xs"],[1,"pi","pi-palette","text-xs"],[1,"pi","pi-spin","pi-spinner","text-xs"],["size","small","severity","secondary",3,"onClick","text","label","icon"],["label","Opnieuw proberen","icon","pi pi-refresh","size","small",3,"onClick","loading"],["label","Exporteren","icon","pi pi-chevron-down","iconPos","right","size","small","severity","secondary","tooltipPosition","bottom",3,"onClick","disabled","outlined","loading","pTooltip"],["appendTo","body",3,"model","popup"],[1,"p-menu-item-link"],["alt","",1,"h-4","w-4","object-contain",3,"src"],[1,"p-menu-item-icon",3,"class"],[1,"p-menu-item-label"],[1,"p-menu-item-icon"],[1,"text-muted-color","mb-3","flex","flex-wrap","items-center","gap-2","text-xs"],[1,"mb-5","flex","flex-wrap","items-center","gap-x-4","gap-y-2","rounded-xl","border","border-surface-200","px-4","py-3","dark:border-surface-700"],[1,"flex","items-center","gap-2.5"],["styleClass","h-4! w-4!","strokeWidth","4","ariaLabel","Bezig met genereren",1,"h-5!","w-4!"],[1,"text-color","text-sm","font-medium"],[1,"text-muted-color","text-sm"],[1,"text-muted-color","ml-auto","text-xs"],["emptyTitle","Het rapport wordt opgezet","emptyHint","De eerste secties verschijnen hier zodra ze geschreven zijn.",3,"document","fields","showAdvisorChrome"],[1,"pi","pi-exclamation-circle","text-[0.7rem]"],["label","Nu bijwerken","size","small","severity","secondary",3,"onClick","text"],[1,"flex","h-12","w-12","items-center","justify-center","rounded-full","bg-red-50","dark:bg-red-950"],[1,"pi","pi-times-circle","text-lg","text-red-500"],[1,"text-muted-color","m-0","mt-2","max-w-lg","text-sm"],["label","Opnieuw proberen","icon","pi pi-refresh","size","small",3,"onClick","severity","loading"],[1,"text-muted-color","mb-3","flex","items-center","gap-2","text-xs"],[1,"mb-3","flex","items-start","gap-2","rounded-lg","border","border-amber-200","bg-amber-50","px-3","py-2","text-xs","text-amber-900","dark:border-amber-900","dark:bg-amber-950","dark:text-amber-200"],[1,"text-muted-color","flex","items-center","gap-2","text-xs"],[1,"pt-12","pb-8","lg:flex","lg:gap-6"],[1,"min-w-0","flex-1"],["emptyTitle","Dit rapport is leeg","emptyHint","Er zijn geen secties geschreven. Verwijder het rapport en genereer het opnieuw.",3,"blockActivated","document","fields","showAdvisorChrome","editableBlockIds","actionableBlockIds","editingBlockId","blockEditor"],[3,"facts","selection"],[1,"pi","pi-info-circle","text-[0.7rem]"],["label","Opnieuw laden","size","small","severity","secondary",3,"onClick","text"],[1,"pi","pi-exclamation-triangle","mt-0.5","text-[0.7rem]"],[1,"pi","pi-paperclip","mt-0.5","text-[0.7rem]!"],[1,"pi","pi-pencil","text-[0.7rem]!"],[3,"de
1selected","facts","selection"],["tabindex","-1"],["tabindex","-1",3,"focusout"],[3,"contentChange","content","disabled","focusPoint"],[3,"focusout"],["label","Kop bewerken",3,"valueChange","value","disabled","focusPoint"],[1,"mt-2","flex","items-center","gap-2"],[1,"text-muted-color","text-xs","font-medium"],["optionLabel","label","optionValue","value",3,"ngModelChange","size","allowEmpty","options","disabled","ngModel"],["variant","inline","placeholder","Schrijf hier\u2026",3,"valueChange","focusPoint","value","disabled"],[1,"fixed","inset-0","z-[1050]",3,"click"],[1,"dark:bg-surface-900","bg-surface-0","border-surface-200","dark:border-surface-700","flex","flex-col","gap-4","rounded-xl","border","p-4","shadow-2xl",3,"click"],[1,"flex","items-center","justify-end","gap-2"],["label","Annuleren","severity","secondary","size","small",3,"onClick","text","disabled"],["label","Opslaan","size","small",3,"onClick","loading"],[1,"text-color","m-0","text-sm","font-semibold"],[1,"text-muted-color","m-0","mt-0.5","text-xs"],[1,"flex","flex-col","gap-1.5"],["optionLabel","label","optionValue","value",3,"ngModelChange","size","allowEmpty","options","ngModel"],["for","config-logo-height",1,"text-muted-color","text-xs","font-medium"],["inputId","config-logo-height","size","small","suffix"," mm",3,"ngModelChange","fluid","min","max","useGrouping","placeholder","ngModel"],["for","config-document-title",1,"text-muted-color","text-xs","font-medium"],["pInputText","","id","config-document-title","placeholder","Bijvoorbeeld: Hypotheekadvies familie Jansen",1,"w-full",3,"ngModelChange","maxlength","readonly","ngModel"],[1,"text-muted-color","m-0","text-xs"],["for","config-eyebrow",1,"text-muted-color","text-xs","font-medium"],["pInputText","","id","config-eyebrow","placeholder","Bijvoorbeeld: Hypotheekadvies",1,"w-full",3,"ngModelChange","maxlength","ngModel"],["for","config-subtitle",1,"text-muted-color","text-xs","font-medium"],["pInputText","","id","config-subtitle","placeholder","Bijvoorbeeld: Een overzicht van uw situatie en ons advies.",1,"w-full",3,"ngModelChange","maxlength","ngModel"],[1,"flex","flex-col","gap-2.5"],[1,"flex","items-center","gap-2"],["inputId","config-clients",3,"ngModelChange","binary","ngModel"],["for","config-clients",1,"text-color","text-sm"],["inputId","config-source",3,"ngModelChange","binary","ngModel"],["for","config-source",1,"text-color","text-sm"],["inputId","config-date",3,"ngModelChange","binary","ngModel"],["for","config-date",1,"text-color","text-sm"],["inputId","config-advisor",3,"ngModelChange","binary","ngModel"],["for","config-advisor",1,"text-color","text-sm"],["inputId","config-firm",3,"ngModelChange","binary","ngModel"],["for","config-firm",1,"text-color","text-sm"],[1,"border-surface-200","dark:border-surface-700","overflow-hidden","rounded-lg","border"],["label","Vervangen","icon","pi pi-upload","severity","secondary","size","small",3,"onClick","loading"],[1,"m-0","text-xs","text-red-600","dark:text-red-400"],["for","image-caption",1,"text-muted-color","text-xs","font-medium"],["pInputText","","id","image-caption","placeholder","Bijvoorbeeld: Ons kantoor in Utrecht",1,"w-full",3,"ngModelChange","maxlength","ngModel"],["label","Opslaan","size","small",3,"onClick","loading","disabled"],[3,"documentId"],[1,"text-color","m-0","flex","items-center","gap-2","text-sm","font-semibold"],["value","Verplicht","severity","warn","styleClass","p-tag-xsmall",3,"rounded"],[1,"border-surface-200","dark:border-surface-700","flex","items-center","gap-2.5","rounded-lg","border","px-3","py-2"],["icon","pi pi-upload","severity","secondary","size","small",3,"onClick","label","loading"],["label","Sluiten","severity","secondary","size","small",3,"onClick","text","disabled"],[1,"pi","pi-file-pdf","text-color"],[1,"text-color","truncate","text-sm"],[1,"text-muted-color","text-xs"]],template:function(e,n){if(e&1){let o=x();a(0,"div",7),h(1,"p-toast")(2,"p-confirmDialog"),a(3,"input",8,0),u("change",function(c){return p(o),m(n.onAttachmentReplacePicked(c))}),s(),a(5,"a",9),h(6,"i",10),a(7,"span"),_(8,"Alle rapporten"),s()(),v(9,co,4,0,"div",11)(10,po,10,2,"div",12)(11,jo,1,1),s(),v(12,Go,6,1,"ng-template",null,1,K)(14,Zo,8,6)(15,nr,20,12)(16,lr,16,11)}if(e&2){let o,r,c;d(3),g("accept",n.attachmentAccept),d(6),f(n.loading()?9:n.loadFailed()||!n.report()?10:11),d(5),f((o=n.configEditor())?14:-1,o),d(),f((r=n.imageEditor())?15:-1,r),d(),f((c=n.attachmentEditor())?16:-1,c)}},dependencies:[ve,we,Re,kt,Ee,St,Te,Se,It,an,Et,Ct,Pe,Ie,Ve,ke,je,Vt,Pt,mn,j,Ke,Je,$e,He,Zt,Ue,rn,cn],encapsulation:2,changeDetection:0})};function fr(i){return new Promise(t=>setTimeout(t,i))}function hr(i,t){let e=i.headers.get("Content-Disposition"),n=e?xr(e):null;if(n)return n;let o=t.replace(/[\\/:*?"<>|\x00-\x1f]/g," ").replace(/\s+/g," ").trim();return`${o.length>0?o:"Rapport"}.pdf`}function xr(i){let t=/filename\*=UTF-8''([^;]+)/i.exec(i);if(t)try{return decodeURIComponent(t[1].trim())}catch{}let e=/filename="([^"]+)"|filename=([^;]+)/i.exec(i),n=e?e[1]??e[2]:null;return n?n.trim():null}var Xl=[{path:"",component:Ne},{path:"print/:id",component:on},{path:":id",component:qe}];export{Xl 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.