import t from"@babel/runtime/helpers/defineProperty";import{createStore as e}from"zustand";import{isEqual as r}from"lodash";import{loadUserSettings as n}from"./utils/loadUserSettings.js";import{subscribeToSettingsSave as o}from"./utils/subscribeToSettingsSave.js";function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?a(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var u=function(a){var u=a.userId,s=e()((function(e,o){return{settings:{},manuallyChanged:{},loadState:"idle",error:null,setSetting:function(n,a){var u=o().settings;if(!r(u[n],a)){var s=o().manuallyChanged;e({settings:i(i({},u),{},t({},n,a)),manuallyChanged:s[n]?s:i(i({},s),{},t({},n,!0))})}},loadSettings:function(){return n(s,u)},isLoading:function(){return"loading"===o().loadState},isLoaded:function(){return"loaded"===o().loadState},hasManuallyChanged:function(t){return!0===o().manuallyChanged[t]}}}));return u&&o(s,u),s};export{u as createUserSettingsStore};
//# sourceMappingURL=createUserSettingsStore.js.map
