"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),n=require("@tanstack/react-query"),a=require("moment"),u=require("react"),i=require("../constants.js"),c=require("../../../clients/index.js"),s=require("./mapPad.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=o(e),l=o(r),p=o(t),f=o(a);function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function y(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach((function(r){d.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}exports.useActivePads=function(e){var r,t=e.companyId,a=u.useMemo((function(){return i.getQueryKey("padsActive",t)}),[t]),o=n.useQuery({queryKey:a,queryFn:(r=l.default(p.default.mark((function e(r){var n,a;return p.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.signal,e.next=3,c.corvaAPI.get(i.PADS_URL,y(y({},i.baseQuery),{},{company:Number(t),current:!0}),{signal:n});case 3:return a=e.sent,e.abrupt("return",a);case 5:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)}),initialData:{data:[],included:[]},select:function(e){var r=i.removeViewerAndPDAssets(e.data);return i.deserializePads(r,e.included).map((function(e){return s.mapPad(e)}))},refetchInterval:f.default.duration(10,"minutes").asMilliseconds(),enabled:!!t});return{activePads:o.data,isActivePadsLoading:o.isFetching}};
//# sourceMappingURL=useActivePads.js.map
