"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),r=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),s=require("@babel/runtime/regenerator"),n=require("react");require("lodash"),require("@babel/runtime/helpers/defineProperty"),require("uuid"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../../../clients/jsonApi/index.js"),require("../../../../clients/subscriptions/constants.js"),require("../../../../clients/subscriptions.v1.js"),require("../../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../../clients/api/apiCore.js"),require("../../../../clients/constants.js"),require("../../../../clients/sso/auth0.js"),require("../../../../clients/sso/oauth2.js"),require("../../../../clients/api/rateLimiter.js");var i=require("../../api/companies/fetchCompanyGoals.js"),a=require("../../constants.js");require("../../api/shared/dataFormatter.js"),require("../../../../utils/index.js");var u=require("../../../../constants/goals.js");require("../../../../constants/segment.js"),require("../../../../constants/alerts.js"),require("../../../../constants/apps.js"),require("../../../../constants/drillstring.js"),require("../../../../constants/completion.js"),require("../../../../constants/appPackages.js"),require("../../../../constants/notifications.js"),require("../../../../constants/feed.js"),require("../../../../constants/bha.js"),require("../../../../constants/corvaCompanyId.js"),require("../../../GradientManager/configuration/constants.js");var o=require("../../../../utils/goals.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=c(e),p=c(r),q=c(t),f=c(s),j=new Set(a.METRICS_LIST.map((function(e){return e.key}))),d=function(e){return e.filter((function(e){return j.has(e)}))};exports.useCompanyMetricKey=function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"hole_depth_change",s=n.useState([]),a=q.default(s,2),c=a[0],j=a[1];return n.useEffect((function(){function s(){return(s=p.default(f.default.mark((function r(){var t,s;return f.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,i.fetchCompanyGoals(e);case 2:t=r.sent,s=o.getCompanyGoalSetting(t,u.BENCHMARK_METRIC_GOAL),j(s?d([s]):[]);case 5:case"end":return r.stop()}}),r)})))).apply(this,arguments)}null!==t?r?j(d(r)):e&&function(){s.apply(this,arguments)}():j([])}),[e,r,t]),t&&!c.includes(t)&&j((function(e){return[t].concat(l.default(e)).slice(0,3)})),[c,j]};
//# sourceMappingURL=useCompanyMetricKey.js.map
