"use strict";(self.webpackChunkrichie_education=self.webpackChunkrichie_education||[]).push([[39117],{39117:function(e,n,r){r.r(n),r(32390),r(18183),r(19985),r(10853),r(35054);var u=r(89526),t=r(70488),i=r(5615),o=r(95418),c=r(47080),s=r(15462),a=r(67557);function f(e,n,r,u,t,i,o){try{var c=e[i](o),s=c.value}catch(e){return void r(e)}c.done?n(s):Promise.resolve(s).then(u,t)}function l(e){return function(){var n=this,r=arguments;return new Promise((function(u,t){var i=e.apply(n,r);function o(e){f(i,u,t,o,c,"next",e)}function c(e){f(i,u,t,o,c,"throw",e)}o(void 0)}))}}n.default=function(e){var n=e.children,r=(0,i.useQuery)("user",t.$.me,{refetchOnWindowFocus:!0,staleTime:o.o9.staleTimes.session}).data,f=(0,c.Z)(r),d=(0,i.useQueryClient)(),v=(0,u.useCallback)((function(){d.clear(),t.$.login()}),[d]),p=(0,u.useCallback)((function(){d.clear(),t.$.register()}),[d]),y=(0,u.useCallback)((function(){d.removeQueries({predicate:function(e){return e.options.queryKey.includes("user")&&"user"!==e.options.queryKey}}),d.setQueryData("user",null)}),[d]),h=(0,u.useCallback)(l(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.$.logout();case 2:y();case 3:case"end":return e.stop()}}),e)}))),[y]),m=(0,u.useMemo)((function(){return{user:r,destroy:h,invalidate:y,login:v,register:p}}),[r,h,v,p]);return(0,u.useEffect)((function(){f!==r&&d.removeQueries({predicate:function(e){return e.options.queryKey.includes("user")&&"user"!==e.options.queryKey}})}),[r]),(0,a.jsx)(s.z.Provider,{value:m,children:n})}},47080:function(e,n,r){var u=r(89526);n.Z=function(e){var n=(0,u.useRef)(e);return(0,u.useEffect)((function(){n.current=e}),[e]),n.current}}}]);
//# sourceMappingURL=39117.4f4eb49d3dc5af92a293.index.js.map