import{createStore as e}from"zustand";import t from"lodash/isEqual";var n=function(){return e()((function(e,n){return{bounds:null,zoom:8.5,tiles:new Map,wells:new Map,setBounds:function(s,l){var o=n();t(o.bounds,s)&&o.zoom===l||e({bounds:s,zoom:l})},setTileStatus:function(t,s,l){var o,i=new Map(n().tiles),a=i.get(t);i.set(t,{status:s,wellIds:null!==(o=null==a?void 0:a.wellIds)&&void 0!==o?o:[],timestamp:Date.now(),error:l}),e({tiles:i})},addWellsToTile:function(t,s){var l=n(),o=l.tiles,i=l.wells,a=new Map(o),r=i,u=[];s.forEach((function(e){u.push(e.id),i.has(e.id)||(r===i&&(r=new Map(i)),r.set(e.id,e))}));var d=a.get(t);a.set(t,{status:"loaded",wellIds:u,timestamp:Date.now(),error:null==d?void 0:d.error}),e({tiles:a,wells:r})},clearTiles:function(){e({tiles:new Map,wells:new Map})},getTileStatus:function(e){var t;return null===(t=n().tiles.get(e))||void 0===t?void 0:t.status},isAnyTileLoading:function(){var e=n().tiles;return Array.from(e.values()).some((function(e){return"loading"===e.status}))}}}))};export{n as createViewportStore};
//# sourceMappingURL=createViewportStore.js.map
