import e from"@babel/runtime/helpers/defineProperty";import t from"lodash/isEqual";import{omitKey as r}from"../../utils/omitKey.js";import{getCascadeMaps as i}from"./cascade-hierarchies.js";import{pruneDownstreamFilters as n}from"./pruneDownstreamFilters.js";function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function o(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?s(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var a=function(s){var a=s.get,c=s.setWithMutation;return{setFilter:function(s,l){var f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"system",u=a().filters;if(void 0!==l){if(!t(u[s],l)&&(c({filters:o(o({},u),{},e({},s,l))},f),"companyId"!==s||!a().isLoadAllWells)){var p=i(a().segment),m=p.downstream;m.has(s)&&n(s,{get:a,setWithMutation:c})}}else{if(!(s in u))return;c({filters:r(u,s)},f)}},setFilters:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"system",i=a().filters,n=null!=e?e:{},s="external_sync"===r?o(o({},a().defaultFilters),n):n;t(i,s)||(c({filters:s},r),a().pruneAllCascades())},pruneAllCascades:function(){var e=i(a().segment),t=e.hierarchies,r=e.downstream;t.forEach((function(e){var t=e.chain[0];r.has(t)&&n(t,{get:a,setWithMutation:c})}))},hasActiveFilters:function(){var e=a().filters;return Object.keys(e).length>0}}};export{a as createFilterCrudActions};
//# sourceMappingURL=createFilterCrudActions.js.map
