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