"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("zustand"),r=require("./types.js"),i=require("./utils/createFilterCrudActions.js"),l=require("./utils/createFilterResetActions.js"),n=require("./utils/createTempFilterActions.js"),s=require("./utils/createSelectionActions.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=o(e);function c(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 a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){u.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.createFilterStore=function(e){var o,u,c,f=a(a({},r.BASE_DEFAULT_FILTERS),null!==(o=e.filters)&&void 0!==o?o:{}),d=a(a({},r.BASE_DEFAULT_FILTERS),null!==(u=null!==(c=e.defaultFilters)&&void 0!==c?c:e.filters)&&void 0!==u?u:{}),p=t.createStore()((function(t,r){var o,u=function(e,r){t((function(t){return a(a({},e),{},{lastFilterMutationSource:r,filterMutationSeq:t.filterMutationSeq+1})}))};return a(a(a(a({wells:null,companies:[],canViewCompanies:null!==(o=e.canViewCompanies)&&void 0!==o&&o,isAllWellsLoaded:!1,isLoadAllWells:!1,segment:"drilling",filters:f,defaultFilters:d,tempFilters:{},lastFilterMutationSource:"external_sync",filterMutationSeq:0},i.createFilterCrudActions({get:r,setWithMutation:u})),l.createFilterResetActions({get:r,setWithMutation:u,defaultFilters:d})),n.createTempFilterActions({set:t,get:r})),s.createSelectionActions({get:r,setWithMutation:u}))})),b=p.getState().isAllWellsLoaded;return p.subscribe((function(e){if(!b&&e.isAllWellsLoaded)return b=!0,void e.pruneAllCascades();b=e.isAllWellsLoaded})),p};
//# sourceMappingURL=createFilterStore.js.map
