import{r as registerInstance,h,H as Host}from"./index-b7735e0d.js";import{i as injectNotifier}from"./index-94b34cb1.js";import{D as DataApiImpl}from"./dataApi-82558134.js";import{L as Logger,S as SozlukApi}from"./index-1e9f4c53.js";import{A as AppConfig}from"./app-config-5d14e7bf.js";import{M as Membership}from"./membership-e92743d1.js";import{g as getRouteParams}from"./route-8be91bee.js";import{g as getSessionData,i as isUserLoggedIn}from"./index-c7307038.js";import{C as CookieStorage}from"./cookie-1686830b.js";import{T as Tunnel}from"./context-ced8e86d.js";import{K as KimlikApiMentornity,U as UyeApiMentornity}from"./uye-e958de1c.js";import{d as dataApiEndpoint,m as mentornityApiEndpoint}from"./env-52322014.js";import"./state-tunnel-04c0b67a.js";import"./apiBase-d573f009.js";import"./data-transfer-field-918730a3.js";import"./BaseField-461b6d0c.js";import"./filter-cbaa3d7d.js";import"./data-model-f7ccf826.js";import"./table-config-0c06fb1f.js";import"./FieldModelGenerator-020f4a04.js";import"./reference-field-0e7cd534.js";import"./index-7b119e61.js";import"./index-403101cb.js";import"./date-ce777316.js";import"./index-1d3efe49.js";import"./index-eb14fd2d.js";import"./index-80ec23ef.js";import"./index-4c39b6a6.js";import"./string-3065a411.js";import"./User-1ef5a482.js";import"./index-d3bd30bd.js";import"./_commonjsHelpers-27f122dd.js";import"./kimlikApi-0d7e6ce7.js";import"./utils-00b62373.js";import"./spaces-9bcb3731.js";import"./ValidatorRegex-20b5a564.js";import"./InterceptorHandler-6474bcf4.js";import"./detail-view-config-59c98d8d.js";import"./view-config-dfb61752.js";import"./index-774783ee.js";import"./attachment-32decf79.js";import"./models-22fcdeab.js";import"./ModifierTrimmer-2f77f917.js";import"./ValidatorLength-f56a7c14.js";import"./form-view-config-16052dc8.js";import"./actions-b9a0f808.js";import"./instance-7b02ef1d.js";import"./nested-395a4cd4.js";import"./index-a1075948.js";import"./list-fetch-state-d8c2f8ef.js";import"./ValidatorEmail-df7a1b77.js";import"./table-list-view-config-99e5c0fd.js";import"./DvnDataAdapter-536a3258.js";import"./time-zones-cf1e6113.js";var MentornityConsoleAppContextInjector=function(){function i(i){registerInstance(this,i)}i.prototype.componentWillLoad=function(){var i={"Session-Token":"NTdiMzY3NjBlNjNiY2UxZWViMDAwMDA0"};if(getSessionData().token){i["Authorization"]="Bearer ".concat(getSessionData().token)}this.storage=new CookieStorage;this.logger=new Logger("MentornityConsoleAppContextInjector").setLevel("debug");this.logger.infoGroup("componentWillLoad");this.apiData=new DataApiImpl(dataApiEndpoint,{Authorization:i["Authorization"]});this.apiKimlik=new KimlikApiMentornity(mentornityApiEndpoint,i);this.apiUye=new UyeApiMentornity(mentornityApiEndpoint,i);this.apiSozluk=new SozlukApi};i.prototype.componentDidLoad=function(){var i=this;if(!isUserLoggedIn()){return}var e=getRouteParams(location.pathname).membershipId;var t=function(e){return i.apiUye.getAppConfigOfMembership(e).then((function(e){i.appConfig=AppConfig.decode(e)}))};this.apiKimlik.getSession().then((function(o){i.user=o.user;i.apiUye.getMembershipsOfUser(o.user._id).then((function(o){var r=o.results;i.memberships=r;if(!r||r.length===0){return}if(e){i.membership=r.find((function(i){return i._id===e}));t(i.membership.config._id);return}i.membership=Membership.decode(r[0]);t(r[0].config._id)}))}))};i.prototype.invalidateAppContext=function(){this.logger.debug("invalidateAppContext")};i.prototype.render=function(){var i=this;return h(Host,null,h(Tunnel.Provider,{state:{apiAtama:this.apiAtama,apiData:this.apiData,apiKimlik:this.apiKimlik,apiUye:this.apiUye,apiSozluk:this.apiSozluk,logger:this.logger,storage:this.storage,appContextInvalidator:function(){return i.invalidateAppContext()},appConfig:this.appConfig,membership:this.membership,memberships:this.memberships,notifier:this.notifier,user:this.user,theme:this.theme}},h("slot",null)))};return i}();injectNotifier(MentornityConsoleAppContextInjector);export{MentornityConsoleAppContextInjector as mentornity_console_app_context_injector};