import r from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/regenerator";import{useState as o,useEffect as n,useMemo as a}from"react";import i from"lodash/debounce";import u from"lodash/groupBy";import s from"lodash/every";import{fetchAllAssets as c}from"../utils/apiCalls.js";var p=i((function(r){r()}),500);function l(i,l,m,f){var v=o([]),b=e(v,2),d=b[0],h=b[1],y=o(!1),w=e(y,2),C=w[0],x=w[1];n((function(){function e(){return(e=r(t.mark((function r(){var e;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,c(l,m,f);case 3:e=r.sent,h(e),x(!1),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(0),console.error(r.t0);case 11:case"end":return r.stop()}}),r,null,[[0,8]])})))).apply(this,arguments)}x(!0),p((function(){return e.apply(this,arguments)}))}),[l,m,f]);var L=a((function(){var r=d.filter((function(r){var e;return(!l||r.type===l)&&(function(r,e){var t=e.split(" ");return s(t,(function(e){return r.toLowerCase().includes(e||"")}))}(r.name,(i||"").toLowerCase())||(null===(e=r.apiNumber)||void 0===e?void 0:e.toLowerCase().includes((i||"").toLowerCase())))}));return Object.entries(u(r,"type"))}),[i,d,l]);return[C,L]}export{l as useAssetsData};
//# sourceMappingURL=useAssetsData.js.map
