import { r as registerInstance, h } from './index-ecdfb761.js';
import { b as generateMentornitySessionContext } from './session-2a491341.js';
import { T as TakvimMeetingListViewConfig } from './takvim-meeting-list-view-config-aea8652b.js';
import { g as generateCalendarConfig } from './mentorinty-bridge-api-5ca2d652.js';
import './membership-b6639471.js';
import './data-model-88af49fc.js';
import './table-config-d73a72ab.js';
import './FieldModelGenerator-378c8613.js';
import './reference-field-a5b414d1.js';
import './BaseField-0b01dc2c.js';
import './index-61dcd269.js';
import './FieldGenerator-3ae403b2.js';
import './date-1bc489bd.js';
import './index-4e451db4.js';
import './index-23baeeef.js';
import './index-09efdc01.js';
import './index-150b6a59.js';
import './string-3065a411.js';
import './User-72c4643a.js';
import './UserSettings-7e4170a7.js';
import './cookie-5d9f5819.js';
import './kimlik-api-fddeac81.js';
import './apiBase-6015f41f.js';
import './data-transfer-field-2f305919.js';
import './filter-cbaa3d7d.js';
import './_commonjsHelpers-27f122dd.js';
import './index-d3bd30bd.js';
import './index-3bf9b308.js';
import './sozluk-entries-1e8f5234.js';
import './i18n-09a07b97.js';
import './i18n-0e757ca5.js';
import './calendar-470c802a.js';
import './index-a3ca021c.js';
import './moment-65eca6b3.js';
import './view-config-1ed8c59f.js';
import './index-e66e8eca.js';
import './attachment-961dd228.js';
import './CalendarConfig-412d1b0f.js';

const mentornityMyMeetingsWrapperCss = "mentornity-my-meetings-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;overflow:hidden}";

const MentornityMyMeetingsWrapper = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  componentWillLoad() {
    // fetch the context async to unblock the component render
    generateMentornitySessionContext(this.contextParams, { fetchConfig: true })
      .then((mentornitySessionContext) => {
      this.mentornitySessionContext = mentornitySessionContext;
      this.view = TakvimMeetingListViewConfig.decode({
        _id: 'my-meetings-page-meeting-list-view',
        i18nEntryId: 'my-meetings-page-meeting-list-view',
        table: generateCalendarConfig(this.mentornitySessionContext.organisationConfig),
      });
    })
      .catch(error => {
      console.log(error);
      this.error = error;
    });
  }
  onAction(event) {
    const action = event.detail;
    switch (action.name) {
      case 'open-meeting-detail-from-meeting-list':
        window.dispatchEvent(new CustomEvent('dvn.mentornity-my-meetings-wrapper.open-meeting-detail', {
          detail: {
            meetingId: action.params.meetingId,
          }
        }));
        break;
    }
  }
  render() {
    const { error, mentornitySessionContext, view } = this;
    if (!!error) {
      return (h("dvn-card", { leanedSides: true, tint: "danger" }, "Failed to get data."));
    }
    if (!mentornitySessionContext) {
      return (h("div", { class: "d-flex flex-grow-1 justify-content-center pt-3" }, h("dvn-progress", { indefinite: true })));
    }
    const { apiSozluk, mentornityBridgeApi, user, userSettings } = mentornitySessionContext;
    return (h("dvn-app-view-takvim-meeting-list-view-table", { apiSozluk: apiSozluk, apiTakvim: mentornityBridgeApi, userSettings: userSettings, view: view, params: {
        guest1Id: user._id
      }, scrollToFitHeight: true }));
  }
};
MentornityMyMeetingsWrapper.style = mentornityMyMeetingsWrapperCss;

export { MentornityMyMeetingsWrapper as mentornity_my_meetings_wrapper };
