import e from"@babel/runtime/helpers/defineProperty";import{jsx as r}from"react/jsx-runtime";import{useRef as t,useEffect as i}from"react";import{useSyncProps as n}from"../utils/useSyncProps.js";import{getDefaultRadiusMiles as o}from"./utils/getDefaultRadiusMiles.js";import{createFilterStore as l}from"./createFilterStore.js";import{FilterStoreContext as s}from"./FilterStoreContext.js";import{normalizeFilters as c}from"./utils/normalizeFilters.js";function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function a(r){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?u(Object(i),!0).forEach((function(t){e(r,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):u(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}var p=function(e){var u=e.children,p=e.filters,d=e.canViewCompanies,f=t(null);if(!f.current){var m,v,j,O,b=o(),y=c(p),g=a(a({},y),{},{selectionMode:null!==(m=null==y?void 0:y.selectionMode)&&void 0!==m?m:"radius",radius:null!==(v=null==y?void 0:y.radius)&&void 0!==v?v:b,drillingWells:null===(j=null==y?void 0:y.drillingWells)||void 0===j||j,interventionWells:null===(O=null==y?void 0:y.interventionWells)||void 0===O||O}),P={selectionMode:"radius",radius:b,drillingWells:!0,interventionWells:!0};f.current=l({filters:g,defaultFilters:P,canViewCompanies:d})}var w=f.current;return n(w,{canViewCompanies:d},[{key:"canViewCompanies"}]),i((function(){var e=c(p);void 0!==e&&w.getState().setFilters(e,"external_sync")}),[w,p]),r(s.Provider,{value:w,children:u})};p.displayName="FilterStoreProvider";export{p as FilterStoreProvider};
//# sourceMappingURL=FilterStoreProvider.js.map
