"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("./createViewStore.js"),t=require("./ViewStoreContext.js"),s=require("./utils/useEffectiveViewSettings.js"),n=require("./utils/useViewStoreSettingsSync.js"),u=require("./utils/useViewTypeLayoutSync.js");require("../../viewport/ViewportProvider.js");var d=require("../../viewport/useViewType.js"),a=require("../utils/useSyncProps.js"),l=function(l){var o=l.children,p=l.isFilterExpanded,c=l.isMapHidden,f=l.userSettings,v=l.hasManuallyChanged,S=l.onSettingChange,y=i.useRef(null),w=d.useViewType(),M=w.viewType,x=w.isMobile,V=i.useRef(x);V.current=x;var g=s.useEffectiveViewSettings({isMapHidden:c,isFilterExpanded:p,isMobile:x,userSettings:f,hasManuallyChanged:v}),E=g.effectiveIsMapHidden,j=g.effectiveIsFilterExpanded,q=g.getEffectiveIsMapHidden;return y.current||(y.current=r.createViewStore({isFilterExpanded:j,isMapHidden:E,isWellNameExpand:null==f?void 0:f.isWellNameExpand,mapStyle:null==f?void 0:f.mapStyle})),n.useViewStoreSettingsSync({storeRef:y,isMobileRef:V,onSettingChange:S}),u.useViewTypeLayoutSync({storeRef:y,viewType:M,isMobile:x,effectiveIsMapHidden:E,effectiveIsFilterExpanded:j,getEffectiveIsMapHidden:q}),a.useSyncProps(y.current,{isFilterExpanded:p,isMapHidden:c},[{key:"isFilterExpanded",transform:function(e){if(null==v||!v("isFilterExpanded"))return e}},{key:"isMapHidden",transform:function(e){return!!x||(null!=v&&v("isMapHidden")?void 0:e)}}]),e.jsx(t.ViewStoreContext.Provider,{value:y.current,children:o})};l.displayName="ViewStoreProvider",exports.ViewStoreProvider=l;
//# sourceMappingURL=ViewStoreProvider.js.map
