import{r as p,h as t,H as i}from"./p-a0569a5f.js";import{i as s}from"./p-c2d7479c.js";import{D as o}from"./p-69daa26b.js";import{L as r,S as m}from"./p-16bf9265.js";import{A as e}from"./p-2e3cec45.js";import{M as a}from"./p-da9525c7.js";import{g as j}from"./p-51389225.js";import{g as d,i as n}from"./p-4ebc5d09.js";import{C as f}from"./p-1bea6126.js";import{T as c}from"./p-7a6b6586.js";import{K as h,U as b}from"./p-2c9906f1.js";import{d as l,m as u}from"./p-04642aa0.js";import"./p-83f217d4.js";import"./p-e476a838.js";import"./p-944da115.js";import"./p-eebad85b.js";import"./p-d343a062.js";import"./p-7737f905.js";import"./p-9224a4e9.js";import"./p-8fd375f7.js";import"./p-8e1b37ed.js";import"./p-429e49d9.js";import"./p-b7a1e5c3.js";import"./p-3b35e507.js";import"./p-c67a5881.js";import"./p-cc3f853d.js";import"./p-40e6d149.js";import"./p-cd9003fd.js";import"./p-d27cb594.js";import"./p-a4d551dd.js";import"./p-e929429b.js";import"./p-814af281.js";import"./p-31309282.js";import"./p-d022b776.js";import"./p-14ed39a4.js";import"./p-632c9b14.js";import"./p-35c7f358.js";import"./p-7eece8e9.js";import"./p-b897fb97.js";import"./p-0bd6e3b1.js";import"./p-234c1f97.js";import"./p-5b69721c.js";import"./p-0b1ac773.js";import"./p-ad6da9fe.js";import"./p-4a8ff3c9.js";import"./p-6cf8ecf7.js";import"./p-2cf91d8b.js";import"./p-f97ba04a.js";import"./p-f5b03cfd.js";import"./p-e7b87b96.js";import"./p-56463912.js";import"./p-7e12f55d.js";import"./p-d93d87fd.js";import"./p-453d48c4.js";let A=class{constructor(t){p(this,t)}componentWillLoad(){const p={"Session-Token":"NTdiMzY3NjBlNjNiY2UxZWViMDAwMDA0"};d().token&&(p.Authorization=`Bearer ${d().token}`),this.storage=new f,this.logger=new r("MentornityConsoleAppContextInjector").setLevel("debug"),this.logger.infoGroup("componentWillLoad"),this.apiData=new o(l,{Authorization:p.Authorization}),this.apiKimlik=new h(u,p),this.apiUye=new b(u,p),this.apiSozluk=new m}componentDidLoad(){if(!n())return;const{membershipId:p}=j(location.pathname),t=p=>this.apiUye.getAppConfigOfMembership(p).then((p=>{this.appConfig=e.decode(p)}));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(p)return this.membership=s.find((t=>t._id===p)),void t(this.membership.config._id);this.membership=a.decode(s[0]),t(s[0].config._id)}}))}))}invalidateAppContext(){this.logger.debug("invalidateAppContext")}render(){return t(i,null,t(c.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}},t("slot",null)))}};s(A);export{A as mentornity_console_app_context_injector}