import{r as t,h as i,H as s}from"./p-c1e62c18.js";import"./p-eb6e2a8b.js";import"./p-35c7f358.js";import"./p-83f217d4.js";import{T as p}from"./p-bd63d08d.js";import"./p-3c3b4f3f.js";import{A as o}from"./p-04ac75cf.js";import"./p-d66fb38c.js";import"./p-22a0eb5c.js";import"./p-552063c3.js";import"./p-a9eda644.js";import"./p-7c81e200.js";import"./p-0f7a11a0.js";import"./p-e8956308.js";import"./p-b64f8873.js";import{M as r}from"./p-b328bbbb.js";import"./p-25c0eb4f.js";import"./p-551d2360.js";import{g as e}from"./p-11b404e1.js";import{i as m}from"./p-e08d4e88.js";import"./p-6279360b.js";import"./p-a8682d9e.js";import"./p-d343a062.js";import{D as a}from"./p-2ec6c0c7.js";import{C as j}from"./p-3df73e7b.js";import{g as n,i as f}from"./p-b326828b.js";import"./p-2cabbe53.js";import"./p-6f59f79b.js";import"./p-ad6da9fe.js";import"./p-f944fe09.js";import"./p-8d093bbd.js";import"./p-6cf8ecf7.js";import"./p-6f02ee7c.js";import"./p-67db8424.js";import"./p-06571436.js";import{L as c}from"./p-11173ec8.js";import{d as h,K as d,m as b,U as l}from"./p-8eff4e95.js";import"./p-edad6c3d.js";import"./p-4514bb45.js";import"./p-15022e50.js";import"./p-92f74b0b.js";import"./p-0fb5fd0d.js";const u=class{constructor(i){t(this,i)}componentWillLoad(){const t={"Session-Token":"NTdiMzY3NjBlNjNiY2UxZWViMDAwMDA0"};n().token&&(t.Authorization="Bearer "+n().token),this.storage=new j,this.logger=new c("MentornityConsoleAppContextInjector").setLevel("debug"),this.logger.infoGroup("componentWillLoad"),this.apiData=new a(h,{Authorization:t.Authorization}),this.apiKimlik=new d(b,t),this.apiUye=new l(b,t)}componentDidLoad(){if(!f())return;const{membershipId:t}=e(location.pathname),i=t=>this.apiUye.getAppConfigOfMembership(t).then((t=>{this.appConfig=o.decode(t)}));this.apiKimlik.getSession().then((s=>{this.user=s.user,this.apiUye.getMembershipsOfUser(s.user._id).then((s=>{const p=s.results;if(this.memberships=p,p&&0!==p.length){if(t)return this.membership=p.find((i=>i._id===t)),void i(this.membership.config._id);this.membership=r.decode(p[0]),i(p[0].config._id)}}))}))}invalidateAppContext(){this.logger.debug("invalidateAppContext")}render(){return i(s,null,i(p.Provider,{state:{apiAtama:this.apiAtama,apiData:this.apiData,apiKimlik:this.apiKimlik,apiUye:this.apiUye,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}},i("slot",null)))}};m(u);export{u as mentornity_console_app_context_injector}