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