"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("../cache-utils/idle-callback.js"),a=require("./constants.js"),i=require("./validateEnvelope.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e);exports.useTileCacheHydration=function(e,n){t.useEffect((function(){var t=n.current,u=r.scheduleIdleWork((function(){t.delete(u);try{var r=sessionStorage.getItem(a.STORAGE_KEY);if(!r)return;var n=JSON.parse(r),c=i.validateEnvelope(n);c&&Object.entries(c.state).forEach((function(t){var r=s.default(t,2),a=r[0],i=r[1];e.current.set(a,{wellIds:i,timestamp:c.timestamp})}))}catch(e){sessionStorage.removeItem(a.STORAGE_KEY)}}),{timeout:2e3});return t.add(u),function(){r.cancelIdleWork(u),t.delete(u)}}),[e,n])};
//# sourceMappingURL=useTileCacheHydration.js.map
