import r from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/regenerator";import{useRef as n,useEffect as a,useState as u}from"react";import{isEmpty as o}from"lodash";import{fetchBicWellSections as i,fetchWells as s}from"../utils/apiCalls.js";function c(r){var t=n();return a((function(){t.current=r})),t.current}function l(o,i){var c=n(!0),l=u(null),p=t(l,2),f=p[0],m=p[1];return a((function(){function t(){return(t=r(e.mark((function r(){var t;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,s(o);case 2:t=r.sent,m(t);case 4:case"end":return r.stop()}}),r)})))).apply(this,arguments)}i&&c.current&&(m(null),function(){t.apply(this,arguments)}(),c.current=!1)}),[o,i]),f}var p=function(n,s){var c=u([]),l=t(c,2),p=l[0],f=l[1];return a((function(){var a,u=(a=r(e.mark((function r(){var a,u,s,c,l;return e.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,!n){r.next=7;break}return r.next=4,Promise.all([i(n)]);case 4:r.t0=r.sent,r.next=8;break;case 7:r.t0=[];case 8:u=r.t0,s=t(u,1),a=s[0],c=!o(a)&&JSON.parse(a[0].data.filters)||void 0,l=!o(a)&&a[0].data.result&&JSON.parse(a[0].data.result)||void 0,f({filters:c,result:l}),r.next=19;break;case 16:r.prev=16,r.t1=r.catch(0),f(null);case 19:case"end":return r.stop()}}),r,null,[[0,16]])}))),function(){return a.apply(this,arguments)});s&&u()}),[n,s]),p};export{p as useFetchBicWellsData,c as usePrevious,l as useWells};
//# sourceMappingURL=index.js.map
