import{n,o as y,q as u}from"./chunk-WBFVEEB2.js";import{a as b}from"./chunk-3E2QKUY7.js";import{ja as I,l,na as S,s as p}from"./chunk-PWOPM3YG.js";import{g as d}from"./chunk-NZN5XTIE.js";var f=(()=>{let e=class e{constructor(o){this.payload=o}};e.type="[Selection] ListObjectsInUpload";let r=e;return r})(),j=(()=>{let e=class e{constructor(){}};e.type="[Selection] Next";let r=e;return r})(),m=(()=>{let e=class e{constructor(){}};e.type="[Selection] Previous";let r=e;return r})(),v=(()=>{let e=class e{constructor(){}};e.type="[Selection] Clear";let r=e;return r})();var g={objects:[],selectedIndex:0},c,s=(c=class{static objects(e){return e.objects}static currentIndex(e){return e.selectedIndex}static selectedObject(e){return e.objects[e.selectedIndex]}constructor(e){this.apiService=e}listObjectsInUpload(e,t){return d(this,null,function*(){let o=yield p(this.apiService.listKlicNetworkObjects(t.payload.uploadId,t.payload)),a=o;if((t.payload.includeVeiligGraven===!0||t.payload.includeRisicoInventarisatie===!0)&&(a=[...(yield p(this.apiService.listVeiligGravenItemsForMap(t.payload.uploadId,t.payload))).filter(O=>O.type==="risk"?t.payload.includeRisicoInventarisatie:t.payload.includeVeiligGraven),...o]),t.payload.includeOtherActiveUploadsInProject===!0){let i=yield p(this.apiService.listOtherActiveUploadsInProject(t.payload.uploadId,t.payload));a=[...a,...i]}let x=a.sort((i,h)=>i.bestandLocatie!==null&&i.bestandLocatie!==void 0?-1:1);e.setState({objects:x,selectedIndex:0})})}nextSelection(e){return d(this,null,function*(){let t=e.getState().selectedIndex,o=e.getState().objects;e.patchState({selectedIndex:Math.min(o.length-1,t+1)})})}previousSelection(e){return d(this,null,function*(){let t=e.getState().selectedIndex;e.patchState({selectedIndex:Math.max(0,t-1)})})}clearSelection(e){e.setState({objects:[],selectedIndex:0})}},c.\u0275fac=function(t){return new(t||c)(S(b))},c.\u0275prov=I({token:c,factory:c.\u0275fac}),c);l([n(f)],s.prototype,"listObjectsInUpload",null);l([n(j)],s.prototype,"nextSelection",null);l([n(m)],s.prototype,"previousSelection",null);l([n(v)],s.prototype,"clearSelection",null);l([u([s])],s,"objects",null);l([u([s])],s,"currentIndex",null);l([u([s])],s,"selectedObject",null);s=l([y({name:"selection",defaults:g})],s);export{f as a,j as b,m as c,v as d,s as e};
//# sourceMappingURL=chunk-NYJ7IQPS.js.map