import{r as t,h as p,H as i}from"./p-1ea36ff3.js";import{i as s}from"./p-ba8c5151.js";import{D as o}from"./p-63cff91e.js";import{L as r,S as e}from"./p-16bf9265.js";import{A as m}from"./p-a2aae1b0.js";import{M as a}from"./p-70e54631.js";import{g as j}from"./p-51389225.js";import{g as n,i as f}from"./p-ad9adb4c.js";import{C as d}from"./p-7957afd8.js";import{T as h}from"./p-fde6bda9.js";import{d as c,K as b,m as l,U as u}from"./p-7eee8de0.js";import"./p-83f217d4.js";import"./p-7e860896.js";import"./p-944da115.js";import"./p-eebad85b.js";import"./p-d343a062.js";import"./p-d50d0ec8.js";import"./p-fac8edcc.js";import"./p-48f43f2a.js";import"./p-28c66a78.js";import"./p-6eb29778.js";import"./p-681f800a.js";import"./p-3b35e507.js";import"./p-240d1ae7.js";import"./p-35267d98.js";import"./p-d27cb594.js";import"./p-56d4255d.js";import"./p-e929429b.js";import"./p-814af281.js";import"./p-0e2e5615.js";import"./p-50b95dd8.js";import"./p-151f608b.js";import"./p-cd1b0e39.js";import"./p-234c1f97.js";import"./p-35c7f358.js";import"./p-32f47ea6.js";import"./p-5b0214f9.js";import"./p-5b69721c.js";import"./p-b1fbf520.js";import"./p-ad6da9fe.js";import"./p-6cf8ecf7.js";import"./p-d49099be.js";import"./p-f97ba04a.js";import"./p-19ae7a5c.js";import"./p-5eec4552.js";import"./p-453d48c4.js";let A=class{constructor(p){t(this,p)}componentWillLoad(){const t={"Session-Token":"NTdiMzY3NjBlNjNiY2UxZWViMDAwMDA0"};n().token&&(t.Authorization=`Bearer ${n().token}`),this.storage=new d,this.logger=new r("MentornityConsoleAppContextInjector").setLevel("debug"),this.logger.infoGroup("componentWillLoad"),this.apiData=new o(c,{Authorization:t.Authorization}),this.apiKimlik=new b(l,t),this.apiUye=new u(l,t),this.apiSozluk=new e}componentDidLoad(){if(!f())return;const{membershipId:t}=j(location.pathname),p=t=>this.apiUye.getAppConfigOfMembership(t).then((t=>{this.appConfig=m.decode(t)}));this.apiKimlik.getSession().then((i=>{this.user=i.user,this.apiUye.getMembershipsOfUser(i.user._id).then((i=>{const s=i.results;if(this.memberships=s,s&&0!==s.length){if(t)return this.membership=s.find((p=>p._id===t)),void p(this.membership.config._id);this.membership=a.decode(s[0]),p(s[0].config._id)}}))}))}invalidateAppContext(){this.logger.debug("invalidateAppContext")}render(){return p(i,null,p(h.Provider,{state:{apiAtama:this.apiAtama,apiData:this.apiData,apiKimlik:this.apiKimlik,apiUye:this.apiUye,apiSozluk:this.apiSozluk,logger:this.logger,storage:this.storage,appContextInvalidator:()=>this.invalidateAppContext(),appConfig:this.appConfig,membership:this.membership,memberships:this.memberships,notifier:this.notifier,user:this.user,theme:this.theme}},p("slot",null)))}};s(A);export{A as mentornity_console_app_context_injector}