import e from"@babel/runtime/helpers/defineProperty";import{doesWellPassFilters as r}from"../../../utils/doesWellPassFilters.js";import{buildUpstreamFilters as t}from"./buildUpstreamFilters.js";import{getCascadeMaps as n}from"./cascade-hierarchies.js";import{extractUniqueWellValues as i}from"./extractUniqueWellValues.js";function o(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}var s=function(s,l){var f=l.get,a=l.setWithMutation,c=f();if(c.isAllWellsLoaded&&c.wells){var u=n(c.segment).downstream.get(s);if(u&&0!==u.length){var p=c.filters,m=!1,b=function(r){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){e(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}))}return r}({},p);u.forEach((function(e){var n=p[e];if(Array.isArray(n)&&0!==n.length){var o=function(e,n){var o=n.wells,s=n.filters,l=n.segment;if(!o)return new Set;var f=t(e,s,l),a=f?o.filter((function(e){return r(e,f,{segment:l})})):o,c=i(a,e);return c.add("Null"),c}(e,c),s=n.filter((function(e){return o.has(e)}));s.length!==n.length&&(m=!0,s.length>0?b[e]=s:delete b[e])}})),m&&a({filters:b},"system")}}};export{s as pruneDownstreamFilters};
//# sourceMappingURL=pruneDownstreamFilters.js.map
