"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),r=require("lodash");require("../../../../../clients/jsonApi/index.js");var n=require("../../../api/user-settings/saveUserSettings.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(e),i=s(t),u=["isMapHidden","isFilterExpanded","isWellNameExpand","mapStyle"];exports.subscribeToSettingsSave=function(e,t){var s=r.debounce(function(){var e=a.default(i.default.mark((function e(s){var a;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=r.pick(s,u),!(Object.keys(a).length>0)){e.next=10;break}return e.prev=2,e.next=5,n.saveUserSettings(t,a);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),console.error("Failed to save user settings:",e.t0);case 10:case"end":return e.stop()}}),e,null,[[2,7]])})));return function(t){return e.apply(this,arguments)}}(),500);e.subscribe((function(e,t){"loaded"!==e.loadState||r.isEqual(e.settings,t.settings)||s(e.settings)}))};
//# sourceMappingURL=subscribeToSettingsSave.js.map
