import{useRef as e,useEffect as r}from"react";import t from"lodash/debounce";import{useStore as n}from"zustand";import{ViewportStoreContext as o}from"../../stores/viewport-store/ViewportStoreContext.js";import{useContextOrThrow as s}from"../../stores/utils/useContextOrThrow.js";import{useTileCache as i}from"../useTileCache/useTileCache.js";import{DEBOUNCE_DELAY as c}from"./constants.js";import{useHandleBoundsChange as u}from"./useHandleBoundsChange.js";import{useCompanyIdResetEffect as a}from"./useCompanyIdResetEffect.js";import{useDrillingFilterResetEffect as l}from"./useDrillingFilterResetEffect.js";var f=function(){var f=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],d=s(o),m=n(d,(function(e){return e.bounds})),h=n(d,(function(e){return e.clearTiles})),p=i(),C=p.getCachedTile,g=p.setCachedTile,T=p.clearCache,j=e({pending:[],inProgress:new Set}),R=e((function(){})),v=u({enabled:f,store:d,queueRef:j,getCachedTile:C,setCachedTile:g});R.current=v;var b=e(t((function(e){R.current(e)}),c));r((function(){b.current(m)}),[m]),a({enabled:f,store:d,queueRef:j,clearCache:T,clearTiles:h,handleBoundsChangeRef:R}),l({enabled:f,store:d,queueRef:j,clearCache:T,clearTiles:h,handleBoundsChangeRef:R}),r((function(){var e=b.current,r=j.current;return function(){e.cancel(),r.pending=[]}}),[])};export{f as useViewportWells};
//# sourceMappingURL=useViewportWells.js.map
