'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-1141a245.js');
const takvimAvailabilitySettingsViewConfig = require('./takvim-availability-settings-view-config-331316b7.js');
const session = require('./session-f588baa3.js');
require('./pair-config-589dabd2.js');
require('./table-config-969d3038.js');
require('./FieldModelGenerator-d61f01d4.js');
require('./reference-field-1239b0c3.js');
require('./BaseField-381327a9.js');
require('./index-2eea69a0.js');
require('./FieldGenerator-279a646b.js');
require('./date-a24d7714.js');
require('./index-0783d14f.js');
require('./index-9d3d3d15.js');
require('./index-9fd84b93.js');
require('./index-61f9621a.js');
require('./data-model-01c368bc.js');
require('./view-config-52c16db0.js');
require('./membership-e87e02ed.js');
require('./string-de672b69.js');
require('./User-dbfbd45e.js');
require('./UserSettings-2a2399b1.js');
require('./cookie-e64bc800.js');
require('./kimlik-api-663f4884.js');
require('./apiBase-6c66ff1b.js');
require('./data-transfer-field-e8417d5f.js');
require('./filter-d5040f65.js');
require('./_commonjsHelpers-206db00d.js');
require('./index-33e96540.js');
require('./mentorinty-bridge-api-b1eaa56d.js');
require('./index-b7855ed6.js');
require('./attachment-a0cdf203.js');
require('./CalendarConfig-998f742e.js');
require('./index-a2e99c85.js');
require('./sozluk-entries-3b9686e7.js');
require('./i18n-0bcf144d.js');
require('./i18n-77d45414.js');
require('./calendar-e4b7baeb.js');
require('./index-b776fc14.js');
require('./moment-7a3433f2.js');

const MentornityAvailabilitySettingsWrapper = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
  }
  componentWillLoad() {
    const { contextParams, extraProps } = this;
    const contextParamsToUse = Object.assign({}, contextParams);
    if (extraProps === null || extraProps === void 0 ? void 0 : extraProps.userIdToManageAvailabilitiesOf) {
      contextParamsToUse.userId = extraProps.userIdToManageAvailabilitiesOf;
    }
    // fetch the context async to unblock the component render
    session.generateMentornitySessionContext(contextParamsToUse, { fetchMentorship: true })
      .then((mentornitySessionContext) => {
      this.mentornitySessionContext = mentornitySessionContext;
      this.view = takvimAvailabilitySettingsViewConfig.TakvimAvailabilitySettingsViewConfig.decode({
        i18nEntryId: 'availability-settings-view',
      });
    })
      .catch(error => this.error = error);
  }
  render() {
    const { error, mentornitySessionContext, view } = this;
    if (!!error) {
      return (index.h("dvn-card", { leanedSides: true, tint: "danger" }, "Failed to get data."));
    }
    if (!mentornitySessionContext) {
      return (index.h("div", { class: "d-flex justify-content-center pt-3" }, index.h("dvn-progress", { indefinite: true })));
    }
    const { apiSozluk, mentornityBridgeApi, user, userSettings } = mentornitySessionContext;
    return (index.h(index.Host, { class: "d-flex flex-column flex-grow-1", style: { overflow: 'hidden', width: '100%' } }, index.h("dvn-app-view-takvim-availability-settings-view", { apiSozluk: apiSozluk, apiTakvim: mentornityBridgeApi, view: view, user: user, userSettings: userSettings })));
  }
};

exports.mentornity_availability_settings_wrapper = MentornityAvailabilitySettingsWrapper;
