import t from"@babel/runtime/helpers/toConsumableArray";import"lodash";import{DEFAULT_ASSET_TYPE as s,ACTIVE_STATUS as e}from"../constants.js";import"../../../constants/goals.js";import"../../../constants/segment.js";import"../../../constants/alerts.js";import"../../../constants/apps.js";import"../../../constants/drillstring.js";import"../../../constants/completion.js";import"../../../constants/appPackages.js";import"../../../constants/notifications.js";import"../../../constants/feed.js";import"../../../constants/bha.js";import{ASSET_TYPES as n}from"../../../constants/assetTypes.js";import"../../../utils/env.js";import"../../GradientManager/configuration/constants.js";var a=function(s){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{sort:"name",order:"asc",fields:["".concat(s,".name"),"".concat(s,".status")].concat(t(e))}},r=function(t){var a=t.asset,r=t.group,i=void 0===r?null:r,o=t.activeWellId,l=void 0===o?null:o,c=t.isRequiredAssetId,p=t.isPrimaryAsset,u=t.isDrillingPlatformApp;if(!a)return null;var d,m,v={id:+a.assetId||+a.id,type:a.type,name:a.name};(c&&(v.id=+a.id,v.assetId=+a.assetId),i&&(v.group=i),a.type===n.rig.type)&&(v.activeWellId=Number(null===(d=a.activeWell)||void 0===d?void 0:d.id)||null,u&&(v.activeWellId=Number(null===(m=a.activeWell)||void 0===m?void 0:m.assetId)||null));return a.type!==n.well.type&&a.type!==s||(v.status=Number(a.id)===l?e:null),a.type===n.pad.type&&(v.parentFracFleetId=a.parentFracFleetId,v.status=a.active&&a.current?e:null,p&&!a.parentFracFleetId&&(v.status=null)),v},i=function(t){return t.status===e?-1:1},o=function(s,e,a){var r=s===n.rig.type?[].concat(t(e),["rig.active_well"]):e;return a?[].concat(t(r),["rig.active_child"]):r};export{r as formatAsset,o as getPrimaryAssetFields,a as getRequestOptions,i as sortAsset};
