import e from"@babel/runtime/helpers/slicedToArray";import{getTimestampByPeriod as r}from"./getTimestampByPeriod.js";import{isAssetVisibleToUser as i}from"./isAssetVisibleToUser.js";import{isDrillingOnlyWell as n}from"./isDrillingOnlyWell.js";var t=/\sST0/,l=["status","companyId","rigName","programName","basin","county","area","formation","stringDesign","interventionAsset","padName"],s={excludeKeys:["rigName"]},a=function(i,s,a){var u,o;if(!s)return!0;var m=null==a?void 0:a.excludeKeys;if(!l.every((function(e){if(null!=m&&m.includes(e))return!0;var r=s[e];if(Array.isArray(r)&&r.length>0){var n=i[e],t=r.map(String);return null==n||"Null"===n?t.includes("Null"):Array.isArray(n)?n.some((function(e){return t.includes(String(e))})):t.includes(String(n))}return!0})))return!1;if("intervention"===(null==a?void 0:a.segment)){var v=s.status;if(Array.isArray(v)&&v.map(String).includes("active")&&"active"===i.status&&"intervention"!==i.wellState)return!1}if(s.sideTracks&&t.test(null!==(u=i.name)&&void 0!==u?u:""))return!1;if("intervention"!==(null==a?void 0:a.segment)&&s.drillingWells&&!n(i))return!1;if(s.activeInterventionWells&&(null===(o=i.interventionAsset)||void 0===o||!o.length))return!1;var d=s.period,f=s.timeRangeFrom,c=s.timeRangeTo,g=r(d,f,c),y=e(g,2),p=y[0],A=y[1];if(null!==p&&null!==A&&Number.isFinite(p)&&Number.isFinite(A)){var N=i.lastActive;if(void 0===N||!(N>=p&&N<=A))return!1}return!0},u=function(e,r,n,t){return i(e,n)&&a(e,r,t)};export{s as EXCLUDE_RIG_NAME_FILTER,l as WELL_PROPERTY_FILTER_KEYS,a as doesWellPassFilters,u as doesWellPassVisibilityAndFilters};
//# sourceMappingURL=doesWellPassFilters.js.map
