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