import { T as TextField } from './index-d9d18e9c.js';
import { r as registerInterceptor, I as InterceptorConfig, a as InterceptorHandler } from './InterceptorHandler-6474bcf4.js';
import './data-model-bb5789f5.js';
import { V as ViewPlacement, A as AppConfig } from './app-config-cf28072f.js';
import { R as ReferenceField } from './FieldModelGenerator-755e3a85.js';
import { D as DateField, a as DateDataType } from './date-b270be76.js';
import { S as SingleChoiceField, a as SingleChoiceFieldOption } from './index-a95fa2f4.js';
import { M as MembershipConfig } from './membership-config-1607e716.js';
import { U as User } from './User-e14f1ece.js';
import { M as Membership } from './membership-9eff272b.js';
import { A as APIBase } from './kimlikApi-81acfec6.js';
import { D as DataTransferField } from './data-transfer-field-1ad95e08.js';
import { C as Comparison } from './filter-cbaa3d7d.js';
import { D as DataApiImpl } from './dataApi-95bebee9.js';
import { g as getSessionData, a as getCookieStorage } from './index-3a5c6fef.js';
import { I as ImagePosition } from './models-ccfd4f3c.js';
import { B as BooleanField } from './index-8fb87ec4.js';
import { V as ValidatorLength } from './ValidatorLength-f56a7c14.js';
import { F as FormViewConfig, M as ModifierTrimmer } from './form-view-config-46b99ec4.js';
import { A as AppViewType } from './view-config-2a7feb02.js';
import { I as InvalidationAction } from './actions-b9a0f808.js';
import { L as ListFetchState } from './list-fetch-state-8615484c.js';
import { a as AttachmentField } from './attachment-8831acff.js';
import { c as createMentornityApiInstance } from './instance-b3864e36.js';
import { n as notImplemented } from './utils-9344a2af.js';
import { s as spaces } from './spaces-8bb938bc.js';
import { D as DetailViewConfig } from './detail-view-config-b0d2086b.js';
import './index-c43f1f2e.js';
import { d as dataConfigs, V as ValidatorRegex, D as DvnDataAdapter, T as TableListViewConfig, R as RelationReferenceField } from './table-list-view-config-4385d962.js';
import { N as NestedField } from './nested-15d95467.js';

class KimlikApiMentornity {
  constructor(endpoint, headers) {
    this.api = new APIBase(endpoint, headers);
  }
  activateUser(_email, _firstName, _lastName, _password) {
    return Promise.reject(notImplemented('KimlikApiMentornity.activateUser'));
  }
  addAuthInterceptor(token) {
    console.log('addAuthInterceptor', token);
  }
  login(email, password) {
    return new Promise(async (resolve) => {
      const response = await this.api.post('login', { email, password });
      resolve({ userId: response.user._id, jwt: response.accessToken });
    });
  }
  logout() {
    return Promise.resolve({});
  }
  register(_email, _firstName, _lastName, _password) {
    return Promise.reject(notImplemented('KimlikApiMentornity.register'));
  }
  getSession() {
    return new Promise(async (resolve) => {
      const user = await this.api.get(`users/${getSessionData().uid}`);
      resolve({ user: User.decode(user) });
    });
  }
}

const mentornityApiEndpoint = 'https://api.mentornity.com';
// export const mentornityApiEndpoint = 'http://localhost:1707';
const dataApiEndpoint = 'https://data.api.mentornity.com/prod/mentornity/';
// export const dataApiEndpoint = 'http://localhost:1003/mentornity/';

const membershipConfigs = {
  // mentees table
  'system-admins': MembershipConfig.decode({
    _id: 'system-admins',
    _created: new Date(),
    _updated: new Date(),
    agreements: [],
    base: 'mentornity',
    fields: [
      {
        type: 'reference',
        id: 'user',
        otherCollection: 'users',
        isSingle: true,
        fields: [
          {
            type: 'text',
            id: 'firstName'
          },
          {
            type: 'text',
            id: 'lastName'
          },
        ]
      },
    ],
    name: 'system-admins',
    roleName: 'System Admin',
    space: spaces['mentornity'],
  }),
};

class ModifierRegexCharRemover extends InterceptorConfig {
  constructor(regex) {
    super('modifierNonAlphanumericCharRemover');
    this.regex = regex;
  }
}
ModifierRegexCharRemover.id = 'modifierNonAlphanumericCharRemover';
class ModifierRegexCharRemoverHandler extends InterceptorHandler {
  constructor(config) {
    super();
    this.config = config;
  }
  run(_context, _values, _field, value) {
    if (typeof value === 'string' || value instanceof String) {
      return {
        value: value.replace(new RegExp(this.config.regex, "gm"), ''),
      };
    }
    return { value };
  }
}
registerInterceptor(ModifierRegexCharRemover.id, (config) => new ModifierRegexCharRemoverHandler(config));

class ChangeOrganisationDomainFormHandler {
  constructor() {
    const { jwt, sessionId } = getCookieStorage().getAll();
    this.api = createMentornityApiInstance(mentornityApiEndpoint, {
      'Authorization': `Bearer ${jwt}`,
      'Client': 'd2ViLWFkbWlu',
      'Session-Token': sessionId,
    });
  }
  onSubmit(event) {
    const { values: { domain, organisationId } } = event.detail;
    return new Promise((resolve, reject) => {
      this.api.changeOrganisationDomain({ domain, organisationId }).then(() => {
        resolve({
          events: [
            new InvalidationAction(ID, ID$1),
            new InvalidationAction(ID, ID$f),
            new InvalidationAction(ID, ID$g),
          ],
          navigation: {
            type: 'navigation',
            direction: 'back'
          }
        });
      }).catch(error => {
        if (error.data && error.data.message === 'domain-already-exists') {
          reject(['Domain is already used by another program.']);
          return;
        }
        reject(['Unexpected error']);
      });
    });
  }
}

const ID = 'form-view-organisation-change-domain';
const viewConfig = FormViewConfig.decode({
  _id: ID,
  base: 'mentornity',
  title: 'Change Organisation Domain',
  space: spaces['mentornity'],
  table: dataConfigs['organisations'],
  type: AppViewType.FormView,
  handler: new ChangeOrganisationDomainFormHandler(),
  ui: {
    fields: [
      // this field is passed by the parameters. this is a data holder field to pass the data to form handler
      {
        field: new DataTransferField('organisationId'),
      },
      {
        field: new TextField('domain', 'New domain').addInterceptor('onBlur', new ModifierRegexCharRemover(' '))
          .addInterceptor('onSubmit', new ValidatorRegex('[a-z0-9\-]'))
          .addInterceptor('onSubmit', new ValidatorLength(2, 100))
          .addInterceptor('onSubmit', new ModifierTrimmer())
          .require(),
      },
    ],
  },
  params: {
    organisationId: {
      required: true,
    },
    domain: {
      required: true,
    },
  },
});

const ID$1 = 'detail-view-organisation';
const viewConfig$1 = DetailViewConfig.decode({
  _id: ID$1,
  base: 'mentornity',
  space: spaces['mentornity'],
  table: dataConfigs['organisations'],
  title: 'Organisation',
  ui: {
    cardConfig: {
      header: {
        actions: [{
            ui: {
              name: 'change-domain',
              buttonType: 'button',
              label: 'Change Domain',
              scale: 'medium',
              view: 'solid'
            },
            data: {
              type: 'navigation',
              viewId: ID,
              direction: 'forward',
              placement: ViewPlacement.Dialog,
              params: {
                conversionConfig: {
                  'item._id': 'organisationId',
                  'item.domain': 'domain',
                }
              }
            }
          }],
        cover: {
          fieldId: 'coverUrl',
          size: 256,
        },
        image: {
          fieldId: 'logoUrl',
          shape: 'rounded',
          size: 96,
          position: ImagePosition.Center,
        },
        title: {
          fieldId: 'title',
        },
      },
      body: {
        fields: [
          {
            fieldId: 'domain',
          },
          {
            fieldId: 'status',
          },
          {
            fieldId: 'model',
          },
          {
            fieldId: 'description',
            lines: 0,
          },
          {
            fieldId: 'createdAt',
          },
          {
            fieldId: 'webSiteUrl',
          },
          {
            fieldId: 'facebookUrl',
          },
          {
            fieldId: 'twitterUrl',
          },
          {
            fieldId: 'linkedInUrl',
          },
          {
            fieldId: '_id',
          },
        ]
      },
    }
  },
  type: AppViewType.DetailView,
  params: {
    itemId: {
      required: true,
    },
  },
});

const ID$2 = 'detail-view-form-response';
const viewConfig$2 = DetailViewConfig.decode({
  _id: ID$2,
  base: 'mentornity',
  space: spaces['mentornity'],
  table: dataConfigs['formResponses'],
  title: 'Form Response',
  ui: {
    cardConfig: {
      body: {
        fields: [
          {
            fieldId: 'createdAt',
          },
          {
            fieldDisplay: new TextField('data.phone', 'Phone'),
          },
          {
            fieldDisplay: new TextField('data.email', 'Email'),
          },
          {
            fieldDisplay: new TextField('data.fullName', 'Name'),
          },
          {
            fieldDisplay: new TextField('data.message', 'Message'),
            lines: 0,
          },
        ]
      },
    }
  },
  type: AppViewType.DetailView,
  params: {
    itemId: {
      required: true,
    },
  },
});

const ID$3 = 'detail-view-user-auth';
const viewConfig$3 = DetailViewConfig.decode({
  _id: ID$3,
  base: 'mentornity',
  space: spaces['mentornity'],
  table: dataConfigs['auth'],
  title: 'User Auth',
  ui: {
    cardConfig: {
      body: {
        fields: [
          {
            fieldId: 'createdAt',
          },
          {
            fieldId: 'google',
          },
          {
            fieldId: 'microsoft',
          },
          {
            fieldId: 'zoom',
          },
        ]
      },
    }
  },
  query: {
    filter: {
      comparison: Comparison.Eq,
      id: 'user._id',
      value: '$userId',
    },
  },
  type: AppViewType.DetailView,
  params: {
    userId: {
      required: true,
    },
  },
});

const ID$4 = 'detail-view-scheduled-job-send-email';
const viewConfig$4 = DetailViewConfig.decode({
  _id: ID$4,
  base: 'mentornity',
  space: spaces['mentornity'],
  table: dataConfigs['scheduledjobs'],
  title: 'Send Email Job',
  ui: {
    cardConfig: {
      body: {
        fields: [
          {
            fieldId: 'name',
          },
          {
            fieldId: 'createdAt',
          },
          {
            fieldId: 'status',
          },
          {
            fieldDisplay: new DateField('metadata.sent', 'Sent On').setDateFormat('DD MMM YYYY, HH:mm'),
          },
          {
            fieldDisplay: new DateField('metadata.delivered', 'Delivered On').setDateFormat('DD MMM YYYY, HH:mm'),
          },
          {
            fieldDisplay: new DateField('metadata.opened', 'Opened On').setDateFormat('DD MMM YYYY, HH:mm'),
          },
          {
            fieldDisplay: new DateField('metadata.clicked', 'Clicked On').setDateFormat('DD MMM YYYY, HH:mm'),
          },
          {
            fieldId: 'output',
          },
          {
            fieldId: 'parameters',
          },
        ]
      },
    }
  },
  type: AppViewType.DetailView,
  params: {
    itemId: {
      required: true,
    },
  },
});

class AddOrganisationAdminFormHandler {
  constructor() {
    const { jwt, sessionId } = getCookieStorage().getAll();
    this.api = createMentornityApiInstance(mentornityApiEndpoint, {
      'Authorization': `Bearer ${jwt}`,
      'Client': 'd2ViLWFkbWlu',
      'Session-Token': sessionId,
    });
  }
  onSubmit(event) {
    const { values: { organisationId, admin: email } } = event.detail;
    return new Promise((resolve, reject) => {
      this.api.importUser(organisationId, 'admins', {
        email,
        firstName: '',
        lastName: '',
        metadata: {},
      }).then(() => {
        resolve({
          events: [
            new InvalidationAction(ID$7, ID$e),
          ],
          navigation: {
            type: 'navigation',
            direction: 'back'
          }
        });
      }).catch(() => {
        reject(['Unexpected error']);
      });
    });
  }
}

function buildQuery(query, quickFilter) {
  let queryFilter = query ? query.filter : undefined;
  if (quickFilter) {
    if (query && query.filter) {
      queryFilter = {
        operator: 'and',
        filters: [query.filter, quickFilter]
      };
    }
    else {
      queryFilter = quickFilter;
    }
  }
  return queryFilter;
}
function generateQuickSearchFilters(quickSearch, filter) {
  if (!quickSearch || !filter) {
    return undefined;
  }
  return {
    operator: 'or',
    filters: quickSearch.fields.map(field => ({
      comparison: Comparison.Contain,
      id: field.fieldId,
      value: filter,
    }))
  };
}
class DvnDataProvider {
  constructor(dataApi, collection, query, initialData, quickSearch) {
    this.didQuickSearchChangeAfterLastFetch = false;
    this.list = ListFetchState.init();
    this.collection = collection;
    this.query = query;
    this.initialData = initialData;
    this.quickSearch = quickSearch;
    this.api = dataApi;
  }
  getInitialData() {
    return this.initialData;
  }
  getData() {
    const { api, collection, query, quickSearchText } = this;
    const self = this;
    return new Promise(((resolve, reject) => {
      if (self.list.data && !this.didQuickSearchChangeAfterLastFetch) {
        // return already fetched data
        resolve(self.list.data);
        return;
      }
      const queryFilter = buildQuery(query, generateQuickSearchFilters(this.quickSearch, quickSearchText));
      api.query(collection, {
        fields: query.fields,
        filter: queryFilter,
        limit: 50,
        skip: 0,
        sort: query.sort,
      }).then(response => {
        self.list = ListFetchState.init().afterFetch(response);
        this.didQuickSearchChangeAfterLastFetch = false;
        resolve(self.list.data);
      }, error => {
        self.list = ListFetchState.init().afterFetchError(error);
        reject(error);
      });
    }));
  }
  setInitialData(initialData) {
    this.initialData = initialData;
  }
  setQuickSearchText(text) {
    this.quickSearchText = text;
    this.didQuickSearchChangeAfterLastFetch = true;
  }
  getQuickSearchText() {
    return this.quickSearchText;
  }
  isQuickSearchEnabled() {
    return !!this.quickSearch;
  }
}

const userDataProvider = (dataApi) => new DvnDataProvider(dataApi, 'users', {
  fields: [
    new TextField('email', ''),
    new TextField('firstName', ''),
    new TextField('lastName', ''),
    new TextField('status', ''),
  ],
  filter: {
    filters: [
      {
        comparison: Comparison.Eq,
        id: 'status',
        value: 'active',
      },
      {
        comparison: Comparison.Ne,
        id: 'lastName',
        value: '   ',
      },
      {
        comparison: Comparison.Ne,
        id: 'lastName',
        value: '   ',
      },
    ],
    operator: 'and'
  },
  sort: [{ id: 'firstName', order: 1 }]
}, undefined, {
  fields: [
    { fieldId: 'email' },
    { fieldId: 'firstName' },
    { fieldId: 'lastName' },
  ]
});

const ID$5 = 'form-view-organisation-admin-add';
const config = (dataApi) => FormViewConfig.decode({
  _id: ID$5,
  base: 'mentornity',
  title: 'Add New Admin',
  space: spaces['mentornity'],
  table: dataConfigs['users'],
  type: AppViewType.FormView,
  handler: new AddOrganisationAdminFormHandler(),
  ui: {
    fields: [
      // this field is passed by the parameters. this is a data holder field to pass the data to form handler
      {
        field: new DataTransferField('organisationId'),
      },
      {
        field: new SingleChoiceField('admin', '', undefined, '', 'select').setDataProvider(userDataProvider(dataApi))
          .setDataAdapter(new DvnDataAdapter('firstName+lastName', 'email'))
          .require(),
      },
    ],
  },
  params: {
    organisationId: {
      required: true,
    },
  },
});

class RemoveOrganisationAdminFormHandler {
  constructor() {
    const { jwt, sessionId } = getCookieStorage().getAll();
    this.api = createMentornityApiInstance(mentornityApiEndpoint, {
      'Authorization': `Bearer ${jwt}`,
      'Client': 'd2ViLWFkbWlu',
      'Session-Token': sessionId,
    });
  }
  onSubmit(event) {
    const { values: { admin: userId, organisationDomain } } = event.detail;
    return new Promise((resolve, reject) => {
      this.api.removeOrganisationAdmin(userId, {
        _roles: [`admin@${organisationDomain}`]
      }).then(() => {
        resolve({
          events: [
            new InvalidationAction(ID$7, ID$e),
          ],
          navigation: {
            type: 'navigation',
            direction: 'back'
          }
        });
      }).catch(() => {
        reject(['Unexpected error']);
      });
    });
  }
}

const ID$6 = 'form-view-organisation-admin-remove';
const config$1 = (_dataApi) => FormViewConfig.decode({
  _id: ID$6,
  base: 'mentornity',
  title: 'Remove Admin',
  space: spaces['mentornity'],
  table: dataConfigs['users'],
  type: AppViewType.FormView,
  handler: new RemoveOrganisationAdminFormHandler(),
  ui: {
    fields: [
      // this field is passed by the parameters. this is a data holder field to pass the data to form handler
      {
        field: new DataTransferField('organisationDomain'),
      },
      {
        field: new SingleChoiceField('admin', '', undefined, '', 'select').setDataProvider(new DvnDataProvider(undefined, 'users', {})).setDataAdapter(new DvnDataAdapter('firstName+lastName', '_id'))
          .disable()
          .require(),
      },
    ],
  },
  params: {
    admin: {
      required: true,
    },
    organisationDomain: {
      required: true,
    },
  },
});

const zoneConfig = [
  {
    group: 'US (Common)',
    zones: [
      { value: 'America/Puerto_Rico', name: 'Puerto Rico (Atlantic)' },
      { value: 'America/New_York', name: 'New York (Eastern)' },
      { value: 'America/Chicago', name: 'Chicago (Central)' },
      { value: 'America/Denver', name: 'Denver (Mountain)' },
      { value: 'America/Phoenix', name: 'Phoenix (MST)' },
      { value: 'America/Los_Angeles', name: 'Los Angeles (Pacific)' },
      { value: 'America/Anchorage', name: 'Anchorage (Alaska)' },
      { value: 'Pacific/Honolulu', name: 'Honolulu (Hawaii)' },
    ],
  },
  {
    group: 'America',
    zones: [
      { value: 'America/Adak', name: 'Adak' },
      { value: 'America/Anchorage', name: 'Anchorage' },
      { value: 'America/Anguilla', name: 'Anguilla' },
      { value: 'America/Antigua', name: 'Antigua' },
      { value: 'America/Araguaina', name: 'Araguaina' },
      { value: 'America/Argentina/Buenos_Aires', name: 'Argentina - Buenos Aires' },
      { value: 'America/Argentina/Catamarca', name: 'Argentina - Catamarca' },
      { value: 'America/Argentina/ComodRivadavia', name: 'Argentina - ComodRivadavia' },
      { value: 'America/Argentina/Cordoba', name: 'Argentina - Cordoba' },
      { value: 'America/Argentina/Jujuy', name: 'Argentina - Jujuy' },
      { value: 'America/Argentina/La_Rioja', name: 'Argentina - La Rioja' },
      { value: 'America/Argentina/Mendoza', name: 'Argentina - Mendoza' },
      { value: 'America/Argentina/Rio_Gallegos', name: 'Argentina - Rio Gallegos' },
      { value: 'America/Argentina/Salta', name: 'Argentina - Salta' },
      { value: 'America/Argentina/San_Juan', name: 'Argentina - San Juan' },
      { value: 'America/Argentina/San_Luis', name: 'Argentina - San Luis' },
      { value: 'America/Argentina/Tucuman', name: 'Argentina - Tucuman' },
      { value: 'America/Argentina/Ushuaia', name: 'Argentina - Ushuaia' },
      { value: 'America/Aruba', name: 'Aruba' },
      { value: 'America/Asuncion', name: 'Asuncion' },
      { value: 'America/Atikokan', name: 'Atikokan' },
      { value: 'America/Atka', name: 'Atka' },
      { value: 'America/Bahia', name: 'Bahia' },
      { value: 'America/Barbados', name: 'Barbados' },
      { value: 'America/Belem', name: 'Belem' },
      { value: 'America/Belize', name: 'Belize' },
      { value: 'America/Blanc-Sablon', name: 'Blanc-Sablon' },
      { value: 'America/Boa_Vista', name: 'Boa Vista' },
      { value: 'America/Bogota', name: 'Bogota' },
      { value: 'America/Boise', name: 'Boise' },
      { value: 'America/Buenos_Aires', name: 'Buenos Aires' },
      { value: 'America/Cambridge_Bay', name: 'Cambridge Bay' },
      { value: 'America/Campo_Grande', name: 'Campo Grande' },
      { value: 'America/Cancun', name: 'Cancun' },
      { value: 'America/Caracas', name: 'Caracas' },
      { value: 'America/Catamarca', name: 'Catamarca' },
      { value: 'America/Cayenne', name: 'Cayenne' },
      { value: 'America/Cayman', name: 'Cayman' },
      { value: 'America/Chicago', name: 'Chicago' },
      { value: 'America/Chihuahua', name: 'Chihuahua' },
      { value: 'America/Coral_Harbour', name: 'Coral Harbour' },
      { value: 'America/Cordoba', name: 'Cordoba' },
      { value: 'America/Costa_Rica', name: 'Costa Rica' },
      { value: 'America/Cuiaba', name: 'Cuiaba' },
      { value: 'America/Curacao', name: 'Curacao' },
      { value: 'America/Danmarkshavn', name: 'Danmarkshavn' },
      { value: 'America/Dawson', name: 'Dawson' },
      { value: 'America/Dawson_Creek', name: 'Dawson Creek' },
      { value: 'America/Denver', name: 'Denver' },
      { value: 'America/Detroit', name: 'Detroit' },
      { value: 'America/Dominica', name: 'Dominica' },
      { value: 'America/Edmonton', name: 'Edmonton' },
      { value: 'America/Eirunepe', name: 'Eirunepe' },
      { value: 'America/El_Salvador', name: 'El Salvador' },
      { value: 'America/Ensenada', name: 'Ensenada' },
      { value: 'America/Fortaleza', name: 'Fortaleza' },
      { value: 'America/Fort_Wayne', name: 'Fort Wayne' },
      { value: 'America/Glace_Bay', name: 'Glace Bay' },
      { value: 'America/Godthab', name: 'Godthab' },
      { value: 'America/Goose_Bay', name: 'Goose Bay' },
      { value: 'America/Grand_Turk', name: 'Grand Turk' },
      { value: 'America/Grenada', name: 'Grenada' },
      { value: 'America/Guadeloupe', name: 'Guadeloupe' },
      { value: 'America/Guatemala', name: 'Guatemala' },
      { value: 'America/Guayaquil', name: 'Guayaquil' },
      { value: 'America/Guyana', name: 'Guyana' },
      { value: 'America/Halifax', name: 'Halifax' },
      { value: 'America/Havana', name: 'Havana' },
      { value: 'America/Hermosillo', name: 'Hermosillo' },
      { value: 'America/Indiana/Indianapolis', name: 'Indiana - Indianapolis' },
      { value: 'America/Indiana/Knox', name: 'Indiana - Knox' },
      { value: 'America/Indiana/Marengo', name: 'Indiana - Marengo' },
      { value: 'America/Indiana/Petersburg', name: 'Indiana - Petersburg' },
      { value: 'America/Indiana/Tell_City', name: 'Indiana - Tell City' },
      { value: 'America/Indiana/Vevay', name: 'Indiana - Vevay' },
      { value: 'America/Indiana/Vincennes', name: 'Indiana - Vincennes' },
      { value: 'America/Indiana/Winamac', name: 'Indiana - Winamac' },
      { value: 'America/Indianapolis', name: 'Indianapolis' },
      { value: 'America/Inuvik', name: 'Inuvik' },
      { value: 'America/Iqaluit', name: 'Iqaluit' },
      { value: 'America/Jamaica', name: 'Jamaica' },
      { value: 'America/Jujuy', name: 'Jujuy' },
      { value: 'America/Juneau', name: 'Juneau' },
      { value: 'America/Kentucky/Louisville', name: 'Kentucky - Louisville' },
      { value: 'America/Kentucky/Monticello', name: 'Kentucky - Monticello' },
      { value: 'America/Knox_IN', name: 'Knox IN' },
      { value: 'America/La_Paz', name: 'La Paz' },
      { value: 'America/Lima', name: 'Lima' },
      { value: 'America/Los_Angeles', name: 'Los Angeles' },
      { value: 'America/Louisville', name: 'Louisville' },
      { value: 'America/Maceio', name: 'Maceio' },
      { value: 'America/Managua', name: 'Managua' },
      { value: 'America/Manaus', name: 'Manaus' },
      { value: 'America/Marigot', name: 'Marigot' },
      { value: 'America/Martinique', name: 'Martinique' },
      { value: 'America/Matamoros', name: 'Matamoros' },
      { value: 'America/Mazatlan', name: 'Mazatlan' },
      { value: 'America/Mendoza', name: 'Mendoza' },
      { value: 'America/Menominee', name: 'Menominee' },
      { value: 'America/Merida', name: 'Merida' },
      { value: 'America/Mexico_City', name: 'Mexico City' },
      { value: 'America/Miquelon', name: 'Miquelon' },
      { value: 'America/Moncton', name: 'Moncton' },
      { value: 'America/Monterrey', name: 'Monterrey' },
      { value: 'America/Montevideo', name: 'Montevideo' },
      { value: 'America/Montreal', name: 'Montreal' },
      { value: 'America/Montserrat', name: 'Montserrat' },
      { value: 'America/Nassau', name: 'Nassau' },
      { value: 'America/New_York', name: 'New York' },
      { value: 'America/Nipigon', name: 'Nipigon' },
      { value: 'America/Nome', name: 'Nome' },
      { value: 'America/Noronha', name: 'Noronha' },
      { value: 'America/North_Dakota/Center', name: 'North Dakota - Center' },
      { value: 'America/North_Dakota/New_Salem', name: 'North Dakota - New Salem' },
      { value: 'America/Ojinaga', name: 'Ojinaga' },
      { value: 'America/Panama', name: 'Panama' },
      { value: 'America/Pangnirtung', name: 'Pangnirtung' },
      { value: 'America/Paramaribo', name: 'Paramaribo' },
      { value: 'America/Phoenix', name: 'Phoenix' },
      { value: 'America/Port-au-Prince', name: 'Port-au-Prince' },
      { value: 'America/Porto_Acre', name: 'Porto Acre' },
      { value: 'America/Port_of_Spain', name: 'Port of Spain' },
      { value: 'America/Porto_Velho', name: 'Porto Velho' },
      { value: 'America/Puerto_Rico', name: 'Puerto Rico' },
      { value: 'America/Rainy_River', name: 'Rainy River' },
      { value: 'America/Rankin_Inlet', name: 'Rankin Inlet' },
      { value: 'America/Recife', name: 'Recife' },
      { value: 'America/Regina', name: 'Regina' },
      { value: 'America/Resolute', name: 'Resolute' },
      { value: 'America/Rio_Branco', name: 'Rio Branco' },
      { value: 'America/Rosario', name: 'Rosario' },
      { value: 'America/Santa_Isabel', name: 'Santa Isabel' },
      { value: 'America/Santarem', name: 'Santarem' },
      { value: 'America/Santiago', name: 'Santiago' },
      { value: 'America/Santo_Domingo', name: 'Santo Domingo' },
      { value: 'America/Sao_Paulo', name: 'Sao Paulo' },
      { value: 'America/Scoresbysund', name: 'Scoresbysund' },
      { value: 'America/Shiprock', name: 'Shiprock' },
      { value: 'America/St_Barthelemy', name: 'St Barthelemy' },
      { value: 'America/St_Johns', name: 'St Johns' },
      { value: 'America/St_Kitts', name: 'St Kitts' },
      { value: 'America/St_Lucia', name: 'St Lucia' },
      { value: 'America/St_Thomas', name: 'St Thomas' },
      { value: 'America/St_Vincent', name: 'St Vincent' },
      { value: 'America/Swift_Current', name: 'Swift Current' },
      { value: 'America/Tegucigalpa', name: 'Tegucigalpa' },
      { value: 'America/Thule', name: 'Thule' },
      { value: 'America/Thunder_Bay', name: 'Thunder Bay' },
      { value: 'America/Tijuana', name: 'Tijuana' },
      { value: 'America/Toronto', name: 'Toronto' },
      { value: 'America/Tortola', name: 'Tortola' },
      { value: 'America/Vancouver', name: 'Vancouver' },
      { value: 'America/Virgin', name: 'Virgin' },
      { value: 'America/Whitehorse', name: 'Whitehorse' },
      { value: 'America/Winnipeg', name: 'Winnipeg' },
      { value: 'America/Yakutat', name: 'Yakutat' },
      { value: 'America/Yellowknife', name: 'Yellowknife' },
    ],
  },
  {
    group: 'Europe',
    zones: [
      { value: 'Europe/Amsterdam', name: 'Amsterdam' },
      { value: 'Europe/Andorra', name: 'Andorra' },
      { value: 'Europe/Athens', name: 'Athens' },
      { value: 'Europe/Belfast', name: 'Belfast' },
      { value: 'Europe/Belgrade', name: 'Belgrade' },
      { value: 'Europe/Berlin', name: 'Berlin' },
      { value: 'Europe/Bratislava', name: 'Bratislava' },
      { value: 'Europe/Brussels', name: 'Brussels' },
      { value: 'Europe/Bucharest', name: 'Bucharest' },
      { value: 'Europe/Budapest', name: 'Budapest' },
      { value: 'Europe/Chisinau', name: 'Chisinau' },
      { value: 'Europe/Copenhagen', name: 'Copenhagen' },
      { value: 'Europe/Dublin', name: 'Dublin' },
      { value: 'Europe/Gibraltar', name: 'Gibraltar' },
      { value: 'Europe/Guernsey', name: 'Guernsey' },
      { value: 'Europe/Helsinki', name: 'Helsinki' },
      { value: 'Europe/Isle_of_Man', name: 'Isle of Man' },
      { value: 'Europe/Istanbul', name: 'Istanbul' },
      { value: 'Europe/Jersey', name: 'Jersey' },
      { value: 'Europe/Kaliningrad', name: 'Kaliningrad' },
      { value: 'Europe/Kiev', name: 'Kiev' },
      { value: 'Europe/Lisbon', name: 'Lisbon' },
      { value: 'Europe/Ljubljana', name: 'Ljubljana' },
      { value: 'Europe/London', name: 'London' },
      { value: 'Europe/Luxembourg', name: 'Luxembourg' },
      { value: 'Europe/Madrid', name: 'Madrid' },
      { value: 'Europe/Malta', name: 'Malta' },
      { value: 'Europe/Mariehamn', name: 'Mariehamn' },
      { value: 'Europe/Minsk', name: 'Minsk' },
      { value: 'Europe/Monaco', name: 'Monaco' },
      { value: 'Europe/Moscow', name: 'Moscow' },
      { value: 'Europe/Nicosia', name: 'Nicosia' },
      { value: 'Europe/Oslo', name: 'Oslo' },
      { value: 'Europe/Paris', name: 'Paris' },
      { value: 'Europe/Podgorica', name: 'Podgorica' },
      { value: 'Europe/Prague', name: 'Prague' },
      { value: 'Europe/Riga', name: 'Riga' },
      { value: 'Europe/Rome', name: 'Rome' },
      { value: 'Europe/Samara', name: 'Samara' },
      { value: 'Europe/San_Marino', name: 'San Marino' },
      { value: 'Europe/Sarajevo', name: 'Sarajevo' },
      { value: 'Europe/Simferopol', name: 'Simferopol' },
      { value: 'Europe/Skopje', name: 'Skopje' },
      { value: 'Europe/Sofia', name: 'Sofia' },
      { value: 'Europe/Stockholm', name: 'Stockholm' },
      { value: 'Europe/Tallinn', name: 'Tallinn' },
      { value: 'Europe/Tirane', name: 'Tirane' },
      { value: 'Europe/Tiraspol', name: 'Tiraspol' },
      { value: 'Europe/Uzhgorod', name: 'Uzhgorod' },
      { value: 'Europe/Vaduz', name: 'Vaduz' },
      { value: 'Europe/Vatican', name: 'Vatican' },
      { value: 'Europe/Vienna', name: 'Vienna' },
      { value: 'Europe/Vilnius', name: 'Vilnius' },
      { value: 'Europe/Volgograd', name: 'Volgograd' },
      { value: 'Europe/Warsaw', name: 'Warsaw' },
      { value: 'Europe/Zagreb', name: 'Zagreb' },
      { value: 'Europe/Zaporozhye', name: 'Zaporozhye' },
      { value: 'Europe/Zurich', name: 'Zurich' },
    ],
  },
  {
    group: 'Asia',
    zones: [
      { value: 'Asia/Aden', name: 'Aden' },
      { value: 'Asia/Almaty', name: 'Almaty' },
      { value: 'Asia/Amman', name: 'Amman' },
      { value: 'Asia/Anadyr', name: 'Anadyr' },
      { value: 'Asia/Aqtau', name: 'Aqtau' },
      { value: 'Asia/Aqtobe', name: 'Aqtobe' },
      { value: 'Asia/Ashgabat', name: 'Ashgabat' },
      { value: 'Asia/Ashkhabad', name: 'Ashkhabad' },
      { value: 'Asia/Baghdad', name: 'Baghdad' },
      { value: 'Asia/Bahrain', name: 'Bahrain' },
      { value: 'Asia/Baku', name: 'Baku' },
      { value: 'Asia/Bangkok', name: 'Bangkok' },
      { value: 'Asia/Beirut', name: 'Beirut' },
      { value: 'Asia/Bishkek', name: 'Bishkek' },
      { value: 'Asia/Brunei', name: 'Brunei' },
      { value: 'Asia/Calcutta', name: 'Calcutta' },
      { value: 'Asia/Choibalsan', name: 'Choibalsan' },
      { value: 'Asia/Chongqing', name: 'Chongqing' },
      { value: 'Asia/Chungking', name: 'Chungking' },
      { value: 'Asia/Colombo', name: 'Colombo' },
      { value: 'Asia/Dacca', name: 'Dacca' },
      { value: 'Asia/Damascus', name: 'Damascus' },
      { value: 'Asia/Dhaka', name: 'Dhaka' },
      { value: 'Asia/Dili', name: 'Dili' },
      { value: 'Asia/Dubai', name: 'Dubai' },
      { value: 'Asia/Dushanbe', name: 'Dushanbe' },
      { value: 'Asia/Gaza', name: 'Gaza' },
      { value: 'Asia/Harbin', name: 'Harbin' },
      { value: 'Asia/Ho_Chi_Minh', name: 'Ho Chi Minh' },
      { value: 'Asia/Hong_Kong', name: 'Hong Kong' },
      { value: 'Asia/Hovd', name: 'Hovd' },
      { value: 'Asia/Irkutsk', name: 'Irkutsk' },
      { value: 'Asia/Istanbul', name: 'Istanbul' },
      { value: 'Asia/Jakarta', name: 'Jakarta' },
      { value: 'Asia/Jayapura', name: 'Jayapura' },
      { value: 'Asia/Jerusalem', name: 'Jerusalem' },
      { value: 'Asia/Kabul', name: 'Kabul' },
      { value: 'Asia/Kamchatka', name: 'Kamchatka' },
      { value: 'Asia/Karachi', name: 'Karachi' },
      { value: 'Asia/Kashgar', name: 'Kashgar' },
      { value: 'Asia/Kathmandu', name: 'Kathmandu' },
      { value: 'Asia/Katmandu', name: 'Katmandu' },
      { value: 'Asia/Kolkata', name: 'Kolkata' },
      { value: 'Asia/Krasnoyarsk', name: 'Krasnoyarsk' },
      { value: 'Asia/Kuala_Lumpur', name: 'Kuala Lumpur' },
      { value: 'Asia/Kuching', name: 'Kuching' },
      { value: 'Asia/Kuwait', name: 'Kuwait' },
      { value: 'Asia/Macao', name: 'Macao' },
      { value: 'Asia/Macau', name: 'Macau' },
      { value: 'Asia/Magadan', name: 'Magadan' },
      { value: 'Asia/Makassar', name: 'Makassar' },
      { value: 'Asia/Manila', name: 'Manila' },
      { value: 'Asia/Muscat', name: 'Muscat' },
      { value: 'Asia/Nicosia', name: 'Nicosia' },
      { value: 'Asia/Novokuznetsk', name: 'Novokuznetsk' },
      { value: 'Asia/Novosibirsk', name: 'Novosibirsk' },
      { value: 'Asia/Omsk', name: 'Omsk' },
      { value: 'Asia/Oral', name: 'Oral' },
      { value: 'Asia/Phnom_Penh', name: 'Phnom Penh' },
      { value: 'Asia/Pontianak', name: 'Pontianak' },
      { value: 'Asia/Pyongyang', name: 'Pyongyang' },
      { value: 'Asia/Qatar', name: 'Qatar' },
      { value: 'Asia/Qyzylorda', name: 'Qyzylorda' },
      { value: 'Asia/Rangoon', name: 'Rangoon' },
      { value: 'Asia/Riyadh', name: 'Riyadh' },
      { value: 'Asia/Saigon', name: 'Saigon' },
      { value: 'Asia/Sakhalin', name: 'Sakhalin' },
      { value: 'Asia/Samarkand', name: 'Samarkand' },
      { value: 'Asia/Seoul', name: 'Seoul' },
      { value: 'Asia/Shanghai', name: 'Shanghai' },
      { value: 'Asia/Singapore', name: 'Singapore' },
      { value: 'Asia/Taipei', name: 'Taipei' },
      { value: 'Asia/Tashkent', name: 'Tashkent' },
      { value: 'Asia/Tbilisi', name: 'Tbilisi' },
      { value: 'Asia/Tehran', name: 'Tehran' },
      { value: 'Asia/Tel_Aviv', name: 'Tel Aviv' },
      { value: 'Asia/Thimbu', name: 'Thimbu' },
      { value: 'Asia/Thimphu', name: 'Thimphu' },
      { value: 'Asia/Tokyo', name: 'Tokyo' },
      { value: 'Asia/Ujung_Pandang', name: 'Ujung Pandang' },
      { value: 'Asia/Ulaanbaatar', name: 'Ulaanbaatar' },
      { value: 'Asia/Ulan_Bator', name: 'Ulan Bator' },
      { value: 'Asia/Urumqi', name: 'Urumqi' },
      { value: 'Asia/Vientiane', name: 'Vientiane' },
      { value: 'Asia/Vladivostok', name: 'Vladivostok' },
      { value: 'Asia/Yakutsk', name: 'Yakutsk' },
      { value: 'Asia/Yekaterinburg', name: 'Yekaterinburg' },
      { value: 'Asia/Yerevan', name: 'Yerevan' },
    ],
  },
  {
    group: 'Africa',
    zones: [
      { value: 'Africa/Abidjan', name: 'Abidjan' },
      { value: 'Africa/Accra', name: 'Accra' },
      { value: 'Africa/Addis_Ababa', name: 'Addis Ababa' },
      { value: 'Africa/Algiers', name: 'Algiers' },
      { value: 'Africa/Asmara', name: 'Asmara' },
      { value: 'Africa/Asmera', name: 'Asmera' },
      { value: 'Africa/Bamako', name: 'Bamako' },
      { value: 'Africa/Bangui', name: 'Bangui' },
      { value: 'Africa/Banjul', name: 'Banjul' },
      { value: 'Africa/Bissau', name: 'Bissau' },
      { value: 'Africa/Blantyre', name: 'Blantyre' },
      { value: 'Africa/Brazzaville', name: 'Brazzaville' },
      { value: 'Africa/Bujumbura', name: 'Bujumbura' },
      { value: 'Africa/Cairo', name: 'Cairo' },
      { value: 'Africa/Casablanca', name: 'Casablanca' },
      { value: 'Africa/Ceuta', name: 'Ceuta' },
      { value: 'Africa/Conakry', name: 'Conakry' },
      { value: 'Africa/Dakar', name: 'Dakar' },
      { value: 'Africa/Dar_es_Salaam', name: 'Dar es Salaam' },
      { value: 'Africa/Djibouti', name: 'Djibouti' },
      { value: 'Africa/Douala', name: 'Douala' },
      { value: 'Africa/El_Aaiun', name: 'El Aaiun' },
      { value: 'Africa/Freetown', name: 'Freetown' },
      { value: 'Africa/Gaborone', name: 'Gaborone' },
      { value: 'Africa/Harare', name: 'Harare' },
      { value: 'Africa/Johannesburg', name: 'Johannesburg' },
      { value: 'Africa/Kampala', name: 'Kampala' },
      { value: 'Africa/Khartoum', name: 'Khartoum' },
      { value: 'Africa/Kigali', name: 'Kigali' },
      { value: 'Africa/Kinshasa', name: 'Kinshasa' },
      { value: 'Africa/Lagos', name: 'Lagos' },
      { value: 'Africa/Libreville', name: 'Libreville' },
      { value: 'Africa/Lome', name: 'Lome' },
      { value: 'Africa/Luanda', name: 'Luanda' },
      { value: 'Africa/Lubumbashi', name: 'Lubumbashi' },
      { value: 'Africa/Lusaka', name: 'Lusaka' },
      { value: 'Africa/Malabo', name: 'Malabo' },
      { value: 'Africa/Maputo', name: 'Maputo' },
      { value: 'Africa/Maseru', name: 'Maseru' },
      { value: 'Africa/Mbabane', name: 'Mbabane' },
      { value: 'Africa/Mogadishu', name: 'Mogadishu' },
      { value: 'Africa/Monrovia', name: 'Monrovia' },
      { value: 'Africa/Nairobi', name: 'Nairobi' },
      { value: 'Africa/Ndjamena', name: 'Ndjamena' },
      { value: 'Africa/Niamey', name: 'Niamey' },
      { value: 'Africa/Nouakchott', name: 'Nouakchott' },
      { value: 'Africa/Ouagadougou', name: 'Ouagadougou' },
      { value: 'Africa/Porto-Novo', name: 'Porto-Novo' },
      { value: 'Africa/Sao_Tome', name: 'Sao Tome' },
      { value: 'Africa/Timbuktu', name: 'Timbuktu' },
      { value: 'Africa/Tripoli', name: 'Tripoli' },
      { value: 'Africa/Tunis', name: 'Tunis' },
      { value: 'Africa/Windhoek', name: 'Windhoek' },
    ],
  },
  {
    group: 'Australia',
    zones: [
      { value: 'Australia/ACT', name: 'ACT' },
      { value: 'Australia/Adelaide', name: 'Adelaide' },
      { value: 'Australia/Brisbane', name: 'Brisbane' },
      { value: 'Australia/Broken_Hill', name: 'Broken Hill' },
      { value: 'Australia/Canberra', name: 'Canberra' },
      { value: 'Australia/Currie', name: 'Currie' },
      { value: 'Australia/Darwin', name: 'Darwin' },
      { value: 'Australia/Eucla', name: 'Eucla' },
      { value: 'Australia/Hobart', name: 'Hobart' },
      { value: 'Australia/LHI', name: 'LHI' },
      { value: 'Australia/Lindeman', name: 'Lindeman' },
      { value: 'Australia/Lord_Howe', name: 'Lord Howe' },
      { value: 'Australia/Melbourne', name: 'Melbourne' },
      { value: 'Australia/North', name: 'North' },
      { value: 'Australia/NSW', name: 'NSW' },
      { value: 'Australia/Perth', name: 'Perth' },
      { value: 'Australia/Queensland', name: 'Queensland' },
      { value: 'Australia/South', name: 'South' },
      { value: 'Australia/Sydney', name: 'Sydney' },
      { value: 'Australia/Tasmania', name: 'Tasmania' },
      { value: 'Australia/Victoria', name: 'Victoria' },
      { value: 'Australia/West', name: 'West' },
      { value: 'Australia/Yancowinna', name: 'Yancowinna' },
    ],
  },
  {
    group: 'Indian',
    zones: [
      { value: 'Indian/Antananarivo', name: 'Antananarivo' },
      { value: 'Indian/Chagos', name: 'Chagos' },
      { value: 'Indian/Christmas', name: 'Christmas' },
      { value: 'Indian/Cocos', name: 'Cocos' },
      { value: 'Indian/Comoro', name: 'Comoro' },
      { value: 'Indian/Kerguelen', name: 'Kerguelen' },
      { value: 'Indian/Mahe', name: 'Mahe' },
      { value: 'Indian/Maldives', name: 'Maldives' },
      { value: 'Indian/Mauritius', name: 'Mauritius' },
      { value: 'Indian/Mayotte', name: 'Mayotte' },
      { value: 'Indian/Reunion', name: 'Reunion' },
    ],
  },
  {
    group: 'Atlantic',
    zones: [
      { value: 'Atlantic/Azores', name: 'Azores' },
      { value: 'Atlantic/Bermuda', name: 'Bermuda' },
      { value: 'Atlantic/Canary', name: 'Canary' },
      { value: 'Atlantic/Cape_Verde', name: 'Cape Verde' },
      { value: 'Atlantic/Faeroe', name: 'Faeroe' },
      { value: 'Atlantic/Faroe', name: 'Faroe' },
      { value: 'Atlantic/Jan_Mayen', name: 'Jan Mayen' },
      { value: 'Atlantic/Madeira', name: 'Madeira' },
      { value: 'Atlantic/Reykjavik', name: 'Reykjavik' },
      { value: 'Atlantic/South_Georgia', name: 'South Georgia' },
      { value: 'Atlantic/Stanley', name: 'Stanley' },
      { value: 'Atlantic/St_Helena', name: 'St Helena' },
    ],
  },
  {
    group: 'Pacific',
    zones: [
      { value: 'Pacific/Apia', name: 'Apia' },
      { value: 'Pacific/Auckland', name: 'Auckland' },
      { value: 'Pacific/Chatham', name: 'Chatham' },
      { value: 'Pacific/Easter', name: 'Easter' },
      { value: 'Pacific/Efate', name: 'Efate' },
      { value: 'Pacific/Enderbury', name: 'Enderbury' },
      { value: 'Pacific/Fakaofo', name: 'Fakaofo' },
      { value: 'Pacific/Fiji', name: 'Fiji' },
      { value: 'Pacific/Funafuti', name: 'Funafuti' },
      { value: 'Pacific/Galapagos', name: 'Galapagos' },
      { value: 'Pacific/Gambier', name: 'Gambier' },
      { value: 'Pacific/Guadalcanal', name: 'Guadalcanal' },
      { value: 'Pacific/Guam', name: 'Guam' },
      { value: 'Pacific/Honolulu', name: 'Honolulu' },
      { value: 'Pacific/Johnston', name: 'Johnston' },
      { value: 'Pacific/Kiritimati', name: 'Kiritimati' },
      { value: 'Pacific/Kosrae', name: 'Kosrae' },
      { value: 'Pacific/Kwajalein', name: 'Kwajalein' },
      { value: 'Pacific/Majuro', name: 'Majuro' },
      { value: 'Pacific/Marquesas', name: 'Marquesas' },
      { value: 'Pacific/Midway', name: 'Midway' },
      { value: 'Pacific/Nauru', name: 'Nauru' },
      { value: 'Pacific/Niue', name: 'Niue' },
      { value: 'Pacific/Norfolk', name: 'Norfolk' },
      { value: 'Pacific/Noumea', name: 'Noumea' },
      { value: 'Pacific/Pago_Pago', name: 'Pago Pago' },
      { value: 'Pacific/Palau', name: 'Palau' },
      { value: 'Pacific/Pitcairn', name: 'Pitcairn' },
      { value: 'Pacific/Ponape', name: 'Ponape' },
      { value: 'Pacific/Port_Moresby', name: 'Port Moresby' },
      { value: 'Pacific/Rarotonga', name: 'Rarotonga' },
      { value: 'Pacific/Saipan', name: 'Saipan' },
      { value: 'Pacific/Samoa', name: 'Samoa' },
      { value: 'Pacific/Tahiti', name: 'Tahiti' },
      { value: 'Pacific/Tarawa', name: 'Tarawa' },
      { value: 'Pacific/Tongatapu', name: 'Tongatapu' },
      { value: 'Pacific/Truk', name: 'Truk' },
      { value: 'Pacific/Wake', name: 'Wake' },
      { value: 'Pacific/Wallis', name: 'Wallis' },
      { value: 'Pacific/Yap', name: 'Yap' },
    ],
  },
  {
    group: 'Antarctica',
    zones: [
      { value: 'Antarctica/Casey', name: 'Casey' },
      { value: 'Antarctica/Davis', name: 'Davis' },
      { value: 'Antarctica/DumontDUrville', name: 'DumontDUrville' },
      { value: 'Antarctica/Macquarie', name: 'Macquarie' },
      { value: 'Antarctica/Mawson', name: 'Mawson' },
      { value: 'Antarctica/McMurdo', name: 'McMurdo' },
      { value: 'Antarctica/Palmer', name: 'Palmer' },
      { value: 'Antarctica/Rothera', name: 'Rothera' },
      { value: 'Antarctica/South_Pole', name: 'South Pole' },
      { value: 'Antarctica/Syowa', name: 'Syowa' },
      { value: 'Antarctica/Vostok', name: 'Vostok' },
    ],
  },
  {
    group: 'Arctic',
    zones: [
      { value: 'Arctic/Longyearbyen', name: 'Longyearbyen' },
    ],
  },
];

class DvnDataProviderTimeZone extends DvnDataProvider {
  constructor() {
    super(undefined, undefined, undefined);
    this.options = [];
    this.filteredOptions = [];
    this.searchText = '';
    zoneConfig.forEach(group => {
      group.zones.forEach(zone => {
        this.options.push({
          label: `${zone.name} (${zone.value})`,
          value: zone.value,
        });
      });
    });
    this.filteredOptions = this.options;
  }
  getInitialData() {
    return this.options;
  }
  getData() {
    return Promise.resolve(this.filteredOptions);
  }
  setQuickSearchText(text) {
    this.searchText = text;
    if (text) {
      this.filteredOptions = this.options.filter(option => (option.label.toLocaleLowerCase().includes(text.toLocaleLowerCase())));
    }
    else {
      this.filteredOptions = this.options;
    }
  }
  getQuickSearchText() {
    return this.searchText;
  }
  isQuickSearchEnabled() {
    return true;
  }
}

class CreateOrganisationFormHandler {
  constructor() {
    const { jwt, sessionId } = getCookieStorage().getAll();
    this.api = createMentornityApiInstance(mentornityApiEndpoint, {
      'Authorization': `Bearer ${jwt}`,
      'Client': 'd2ViLWFkbWlu',
      'Session-Token': sessionId,
    });
  }
  onSubmit(event) {
    const { values: { admin, sourceOrganisationId, newOrganisationDomain, newOrganisationTitle, timeZone, } } = event.detail;
    return new Promise((resolve, reject) => {
      this.api.cloneOrganisation({
        sourceOrganisationId,
        newOrganisationDomain,
        newOrganisationTitle,
        adminIds: [admin],
        timeZone,
      }).then(() => {
        resolve({
          events: [
            new InvalidationAction(ID$7, ID$f),
            new InvalidationAction(ID$7, ID$g),
          ],
          navigation: {
            type: 'navigation',
            direction: 'back'
          }
        });
      }).catch(error => {
        if (error.data && error.data.message === 'domain-already-exists') {
          reject(['Domain is already used by another program.']);
          return;
        }
        reject(['Unexpected error']);
      });
    });
  }
}

const ID$7 = 'form-view-organisation-create';
const config$2 = (dataApi) => FormViewConfig.decode({
  _id: ID$7,
  base: 'mentornity',
  title: 'Create Organisation',
  space: spaces['mentornity'],
  table: dataConfigs['organisations'],
  type: AppViewType.FormView,
  handler: new CreateOrganisationFormHandler(),
  ui: {
    fields: [
      {
        field: new SingleChoiceField('sourceOrganisationId', 'Program to clone', undefined, 'Search for a template or another program to clone.', 'select').setDataProvider(new DvnDataProvider(dataApi, 'organisations', {
          fields: [
            new TextField('domain', 'Domain'),
            new TextField('title', 'Title'),
          ],
          sort: [{ id: 'title', order: 1 }]
        }, undefined, {
          fields: [
            { fieldId: 'domain' },
            { fieldId: 'title' },
          ]
        })).setDataAdapter(new DvnDataAdapter('title', '_id'))
          .require(),
      },
      {
        field: new SingleChoiceField('admin', 'Admin', undefined, 'Search and select admins.', 'select').setDataProvider(userDataProvider(dataApi))
          .setDataAdapter(new DvnDataAdapter('firstName+lastName', '_id'))
          .require(),
      },
      {
        field: new SingleChoiceField('timeZone', 'Time Zone', undefined, 'Time zone of the program. Original program\'s time zone is used if empty.', 'select').setDataProvider(new DvnDataProviderTimeZone())
          .setDataAdapter(new DvnDataAdapter('label', 'value')),
      },
      {
        field: new TextField('newOrganisationTitle', 'Program name', '', 'Shown to users in the UI, emails and notifications.').addInterceptor('onBlur', new ValidatorLength(2, 100))
          .addInterceptor('onSubmit', new ModifierTrimmer())
          .require(),
      },
      {
        field: new TextField('newOrganisationDomain', 'Program domain', '', 'Used in the url and visible in browser address bar.').addInterceptor('onBlur', new ModifierRegexCharRemover(' '))
          .addInterceptor('onBlur', new ValidatorRegex('[a-z0-9\-]'))
          .addInterceptor('onBlur', new ValidatorLength(2, 100))
          .addInterceptor('onSubmit', new ModifierTrimmer())
          .require(),
      },
    ],
  }
});

class EditOrganisationConfigFormHandler {
  constructor() {
    const { jwt, sessionId } = getCookieStorage().getAll();
    this.api = createMentornityApiInstance(mentornityApiEndpoint, {
      'Authorization': `Bearer ${jwt}`,
      'Client': 'd2ViLWFkbWlu',
      'Session-Token': sessionId,
    });
  }
  onSubmit(event) {
    const { values } = event.detail;
    const { item, membershipForm, pairOverviewAndDetail } = values;
    return new Promise((resolve, reject) => {
      this.api.update('configs', item._id, {
        webAppConfiguration: {
          membershipForm, pairOverviewAndDetail
        }
      }).then(() => {
        resolve({
          navigation: {
            type: 'navigation',
            direction: 'back'
          }
        });
      }).catch(() => {
        reject(['Unexpected error']);
      });
    });
  }
}

const ID$8 = 'form-view-organisation-config-edit';
const viewConfig$5 = FormViewConfig.decode({
  _id: ID$8,
  base: 'mentornity',
  title: 'Edit Configuration',
  space: spaces['mentornity'],
  table: dataConfigs['configs'],
  type: AppViewType.FormView,
  handler: new EditOrganisationConfigFormHandler(),
  ui: {
    fields: [
      // this field is passed by the parameters. this is a data holder field to pass the data to form handler
      {
        field: new DataTransferField('item'),
      },
      {
        field: new BooleanField('membershipForm', 'Membership Form', `Shows "My Info" item on the left menu which opens a form page for editing profile, metadata and mentorship in a single form.`),
      },
      {
        field: new BooleanField('pairOverviewAndDetail', 'Pair Overview and Detail', 'Shows new mentors/mentees and mentor selection page.'),
      },
    ],
  },
  query: {
    fields: [
      new DataTransferField('webAppConfiguration'),
    ],
    filter: {
      comparison: Comparison.Eq,
      id: 'organisation._id',
      value: '$itemId',
    },
  },
  conversionConfig: {
    'item.webAppConfiguration.membershipForm': 'membershipForm',
    'item.webAppConfiguration.pairOverviewAndDetail': 'pairOverviewAndDetail'
  },
  params: {
    itemId: {
      required: true,
    },
  },
});

const ID$9 = 'table-list-view-form-response-contact';
const formTableListViewUIConfig = TableListViewConfig.decode({
  main: {
    actions: [{
        ui: {
          name: 'expand',
          buttonType: 'icon-button',
          iconName: 'uil uil-expand-alt',
          view: 'flat'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.SideModal,
          viewId: ID$2,
          params: {
            conversionConfig: {
              'item._id': 'itemId',
            }
          }
        }
      }],
    fields: [
      {
        fieldId: 'createdAt',
        fieldDisplay: new DateField('createdAt', 'Date').setDateFormat('DD MMM HH:mm').setDataType(DateDataType.Unix),
      },
      {
        fieldId: 'data.phone',
        fieldDisplay: new NestedField('data.phone', new TextField('phone', 'Phone')),
      },
      {
        fieldId: 'data.email',
        fieldDisplay: new NestedField('data.email', new TextField('email', 'Email')),
      },
      {
        fieldId: 'data.fullName',
        fieldDisplay: new NestedField('data.fullName', new TextField('fullName', 'Name')),
      },
      {
        fieldId: 'data.message',
        fieldDisplay: new NestedField('data.message', new TextField('message', 'Message')),
      },
    ],
    columns: {
      createdAt: {
        width: 150,
      },
      'data.phone': {
        width: 200,
      },
      'data.email': {
        width: 200,
      },
      'data.fullName': {
        width: 200,
      },
      'data.message': {
        weight: 1,
      },
    },
  },
  quickSearch: {
    fields: [
      { field: new TextField('data.fullName', 'Name') },
      { field: new TextField('data.email', 'Email') },
      { field: new TextField('data.message', 'Message') },
    ]
  },
});
const viewConfig$6 = TableListViewConfig.decode({
  _id: ID$9,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Contact Forms',
  space: spaces['mentornity'],
  table: dataConfigs['formResponses'],
  query: {
    fields: [
      new DateField('createdAt', 'Created At'),
      new TextField('data', 'Data'),
      new TextField('type', 'type'),
    ],
    filter: {
      filters: [
        {
          comparison: Comparison.Eq,
          id: 'type',
          value: 'contact',
        },
      ],
      operator: 'or'
    },
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: formTableListViewUIConfig,
});

const ID$a = 'table-list-view-form-response-help';
const viewConfig$7 = TableListViewConfig.decode({
  _id: ID$a,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Help Forms',
  space: spaces['mentornity'],
  table: dataConfigs['formResponses'],
  query: {
    fields: [
      new DateField('createdAt', 'Created At'),
      new TextField('data', 'Data'),
      new TextField('type', 'type'),
    ],
    filter: {
      filters: [
        {
          comparison: Comparison.Eq,
          id: 'type',
          value: 'help',
        },
      ],
      operator: 'or'
    },
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: formTableListViewUIConfig,
});

const ID$b = 'table-list-view-scheduled-job-sync-events-google';
const config$3 = (dataApi) => TableListViewConfig.decode({
  _id: ID$b,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Sync Google Events Jobs',
  space: spaces['mentornity'],
  table: dataConfigs['scheduledjobs'],
  query: {
    fields: [
      new TextField('name', 'Name'),
      new TextField('status', 'Status'),
      new DateField('scheduledAt', 'Created At'),
      new DateField('createdAt', 'Created At'),
      new DataTransferField('parameters'),
      new DataTransferField('metadata'),
    ],
    filter: {
      filters: [
        {
          comparison: Comparison.Eq,
          id: 'name',
          value: 'CreateEventInGoogle',
        },
      ],
      operator: 'or'
    },
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: TableListViewConfig.decode({
    main: {
      actions: [{
          ui: {
            name: 'expand',
            buttonType: 'icon-button',
            iconName: 'uil uil-expand-alt',
            view: 'flat'
          },
          data: {
            type: 'navigation',
            direction: 'forward',
            placement: ViewPlacement.SideModal,
            viewId: ID$4,
            params: {
              conversionConfig: {
                'item._id': 'itemId',
              }
            }
          }
        }],
      fields: [
        {
          fieldId: 'createdAt',
          fieldDisplay: new DateField('createdAt', 'Date').setDateFormat('DD MMM YYYY').setDataType(DateDataType.Unix),
        },
        {
          fieldId: 'createdAt',
          fieldDisplay: new DateField('createdAt', 'Hour').setDateFormat('HH:mm').setDataType(DateDataType.Unix),
        },
        {
          fieldId: 'parameters.googleEvent.summary',
          fieldDisplay: new NestedField('parameters.googleEvent.summary', new TextField('summary', 'Summary')),
        },
        {
          fieldId: 'parameters.googleEvent.start.dateTime',
          fieldDisplay: new NestedField('parameters.googleEvent.start.dateTime', new DateField('meetingStart', 'Meeting Start').setDateFormat('DD MMM HH:mm')),
        },
        {
          fieldId: 'parameters.googleEvent.end.dateTime',
          fieldDisplay: new NestedField('parameters.googleEvent.end.dateTime', new DateField('meetingEnd', 'Meeting End').setDateFormat('DD MMM HH:mm')),
        },
        {
          fieldId: 'status',
        },
      ],
      columns: {
        createdAt: {
          width: 120,
        },
        'parameters.googleEvent.start.dateTime': {
          width: 150,
        },
        'parameters.googleEvent.end.dateTime': {
          width: 150,
        },
        status: {
          width: 100,
        },
      },
    },
    quickSearch: {
      fields: [
        {
          field: new SingleChoiceField('parameters.userId', 'Search user', undefined, 'Search and select admins.', 'select').setDataProvider(userDataProvider(dataApi))
            .setDataAdapter(new DvnDataAdapter('firstName+lastName', '_id')),
        },
        {
          field: new SingleChoiceField('status', 'Status', [
            new SingleChoiceFieldOption('Done', 'done'),
            new SingleChoiceFieldOption('Failed', 'failed'),
          ]),
        }
      ],
      ui: {
        'parameters.userId': {
          width: '256px',
        }
      },
      requireFilters: false,
    },
  }),
});

const ID$c = 'table-list-view-scheduled-job-sync-events-microsoft';
const config$4 = (dataApi) => TableListViewConfig.decode({
  _id: ID$c,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Sync Microsoft Events Jobs',
  space: spaces['mentornity'],
  table: dataConfigs['scheduledjobs'],
  query: {
    fields: [
      new TextField('_id', 'ID'),
      new TextField('name', 'Name'),
      new TextField('status', 'Status'),
      new DateField('scheduledAt', 'Created At'),
      new DateField('createdAt', 'Created At'),
      new DataTransferField('parameters'),
      new DataTransferField('metadata'),
    ],
    filter: {
      filters: [
        {
          comparison: Comparison.Eq,
          id: 'name',
          value: 'CreateEventInMicrosoft',
        },
      ],
      operator: 'or'
    },
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: TableListViewConfig.decode({
    main: {
      actions: [{
          ui: {
            name: 'expand',
            buttonType: 'icon-button',
            iconName: 'uil uil-expand-alt',
            view: 'flat'
          },
          data: {
            type: 'navigation',
            direction: 'forward',
            placement: ViewPlacement.SideModal,
            viewId: ID$4,
            params: {
              conversionConfig: {
                'item._id': 'itemId',
              }
            }
          }
        }],
      fields: [
        {
          fieldId: 'createdAt',
          fieldDisplay: new DateField('createdAt', 'Date').setDateFormat('DD MMM YYYY').setDataType(DateDataType.Unix),
        },
        {
          fieldId: 'createdAt',
          fieldDisplay: new DateField('createdAt', 'Hour').setDateFormat('HH:mm').setDataType(DateDataType.Unix),
        },
        {
          fieldId: 'parameters.microsoftEvent.subject',
          fieldDisplay: new NestedField('parameters.microsoftEvent.subject', new TextField('summary', 'Subject')),
        },
        {
          fieldId: 'parameters.microsoftEvent.start.dateTime',
          fieldDisplay: new NestedField('parameters.microsoftEvent.start.dateTime', new DateField('meetingStart', 'Meeting Start').setDateFormat('DD MMM HH:mm')),
        },
        {
          fieldId: 'parameters.microsoftEvent.end.dateTime',
          fieldDisplay: new NestedField('parameters.microsoftEvent.end.dateTime', new DateField('meetingEnd', 'Meeting End').setDateFormat('DD MMM HH:mm')),
        },
        {
          fieldId: 'status',
        },
      ],
      columns: {
        createdAt: {
          width: 120,
        },
        'parameters.microsoftEvent.start.dateTime': {
          width: 150,
        },
        'parameters.microsoftEvent.end.dateTime': {
          width: 150,
        },
        status: {
          width: 100,
        },
      },
    },
    quickSearch: {
      fields: [
        {
          field: new SingleChoiceField('parameters.userId', 'Search user', undefined, 'Search and select admins.', 'select').setDataProvider(userDataProvider(dataApi))
            .setDataAdapter(new DvnDataAdapter('firstName+lastName', '_id'))
        },
        {
          field: new SingleChoiceField('status', 'Status', [
            new SingleChoiceFieldOption('Done', 'done'),
            new SingleChoiceFieldOption('Failed', 'failed'),
          ]),
        }
      ],
      ui: {
        'parameters.userId': {
          width: '256px',
        }
      },
      requireFilters: false,
    },
  }),
});

const ID$d = 'table-list-view-scheduled-job-send-email';
const tableListViewUIConfigScheduledJobs = TableListViewConfig.decode({
  main: {
    actions: [{
        ui: {
          name: 'expand',
          buttonType: 'icon-button',
          iconName: 'uil uil-expand-alt',
          view: 'flat'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.SideModal,
          viewId: ID$4,
          params: {
            conversionConfig: {
              'item._id': 'itemId',
            }
          }
        }
      }],
    fields: [
      {
        fieldId: 'parameters.templateAndSubjectName',
        fieldDisplay: new NestedField('parameters.templateAndSubjectName', new TextField('templateAndSubjectName', 'Type')),
      },
      {
        fieldId: 'createdAt',
        fieldDisplay: new DateField('createdAt', 'Date').setDateFormat('DD MMM YYYY').setDataType(DateDataType.Unix),
      },
      {
        fieldId: 'createdAt',
        fieldDisplay: new DateField('createdAt', 'Hour').setDateFormat('HH:mm').setDataType(DateDataType.Unix),
      },
      {
        fieldId: 'parameters.senderName',
        fieldDisplay: new NestedField('parameters.senderName', new TextField('senderName', 'Sender')),
      },
      {
        fieldId: 'parameters.recipientEmail',
        fieldDisplay: new NestedField('parameters.recipientEmail', new TextField('recipientEmail', 'Recipient')),
      },
      {
        fieldId: 'metadata.sent',
        fieldDisplay: new NestedField('metadata.sent', new DateField('sentOn', 'Sent On').setDateFormat('DD MMM HH:mm')),
      },
      {
        fieldId: 'metadata.delivered',
        fieldDisplay: new NestedField('metadata.delivered', new DateField('deliveredOn', 'Delivered On').setDateFormat('DD MMM HH:mm')),
      },
      {
        fieldId: 'status',
      },
    ],
    columns: {
      createdAt: {
        width: 100,
      },
      status: {
        width: 100,
      },
    },
  },
  quickSearch: {
    fields: [
      { field: new TextField('parameters.recipientEmail', 'Recipient') },
      {
        field: new SingleChoiceField('parameters.templateAndSubjectName', 'Type', [
          new SingleChoiceFieldOption('Announcement', 'Announcement'),
          new SingleChoiceFieldOption('Accept Pair Request', 'AcceptSubscription'),
          new SingleChoiceFieldOption('Reject Pair Request', 'RejectSubscription'),
          new SingleChoiceFieldOption('New Pair', 'CreateSubscription'),
          new SingleChoiceFieldOption('New Availability', 'CreateAvailability'),
          new SingleChoiceFieldOption('Cancel Meeting', 'CancelEvent'),
          new SingleChoiceFieldOption('New Meeting', 'CreateEvent'),
          new SingleChoiceFieldOption('New Meeting for Goal', 'CreateEventForMeetingGoal'),
          new SingleChoiceFieldOption('Update Meeting', 'UpdateEvent'),
          new SingleChoiceFieldOption('Invitation', 'Invitation'),
          new SingleChoiceFieldOption('New Form Assignment', 'FormAssignment'),
          new SingleChoiceFieldOption('New Group Member', 'NewGroupMember'),
          new SingleChoiceFieldOption('New Message', 'NewMessage'),
          new SingleChoiceFieldOption('Reset Password Link', 'ResetPasswordLink'),
        ]),
      }
    ],
    ui: {
      'parameters.templateAndSubjectName': {
        width: '240px',
      }
    },
    requireFilters: true,
  },
});
const viewConfig$8 = TableListViewConfig.decode({
  _id: ID$d,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Send Email Jobs',
  space: spaces['mentornity'],
  table: dataConfigs['scheduledjobs'],
  query: {
    fields: [
      new TextField('name', 'Name'),
      new TextField('status', 'Status'),
      new DateField('scheduledAt', 'Created At'),
      new DateField('createdAt', 'Created At'),
      new DataTransferField('parameters'),
      new DataTransferField('metadata'),
    ],
    filter: {
      filters: [
        {
          comparison: Comparison.Eq,
          id: 'name',
          value: 'SendEmail',
        },
      ],
      operator: 'or'
    },
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: tableListViewUIConfigScheduledJobs,
});

const ID$e = 'table-list-view-organisation-admins';
const organisationTableListViewUIConfig = TableListViewConfig.decode({
  header: {
    actions: [{
        ui: {
          name: 'add-admin',
          buttonType: 'button',
          label: 'Add New'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.Dialog,
          viewId: ID$5,
          params: {
            conversionConfig: {
              'organisationId': 'organisationId',
              'organisationDomain': 'organisationDomain',
            }
          }
        }
      }],
  },
  leanedHorizontally: false,
  main: {
    actions: [
      {
        ui: {
          name: 'remove-admins',
          buttonType: 'icon-button',
          iconName: 'uil uil-trash-alt',
          tint: 'danger',
          view: 'flat'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.Dialog,
          viewId: ID$6,
          params: {
            conversionConfig: {
              'item': 'admin',
              'organisationDomain': 'organisationDomain',
            }
          }
        }
      },
    ],
    fields: [
      { fieldId: 'imageUrl' },
      { fieldId: 'firstName' },
      { fieldId: 'lastName' },
      { fieldId: 'email' },
    ],
    columns: {
      firstName: {
        width: 150,
      },
      imageUrl: {
        width: 50,
      },
      lastName: {
        width: 150,
      },
    },
  },
});
const viewConfig$9 = TableListViewConfig.decode({
  _id: ID$e,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Admins',
  space: spaces['mentornity'],
  table: dataConfigs['users'],
  query: {
    fields: [
      new DataTransferField('imageUrl'),
      new DataTransferField('firstName'),
      new DataTransferField('lastName'),
      new DataTransferField('email'),
    ],
    filter: {
      comparison: Comparison.Eq,
      id: '_roles',
      value: 'admin@+$organisationDomain',
    },
    sort: [{ id: 'firstName', order: 1 }]
  },
  ui: organisationTableListViewUIConfig,
  params: {
    organisationDomain: {
      required: true,
    },
    organisationId: {
      required: true,
    },
  },
});

const ID$f = 'table-list-view-organisation';
const organisationTableListViewUIConfig$1 = TableListViewConfig.decode({
  header: {
    actions: [{
        ui: {
          name: 'new-organisation',
          buttonType: 'button',
          label: 'Create New'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.Dialog,
          viewId: ID$7,
        }
      }],
  },
  main: {
    actions: [
      {
        ui: {
          name: 'expand',
          buttonType: 'icon-button',
          iconName: 'uil uil-expand-alt',
          view: 'flat'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.SideModal,
          viewId: ID$1,
          params: {
            conversionConfig: {
              'item._id': 'itemId',
            }
          }
        }
      },
      {
        ui: {
          name: 'manage-admins',
          buttonType: 'icon-button',
          iconName: 'uil uil-users-alt',
          view: 'flat'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.SideModal,
          viewId: ID$e,
          params: {
            conversionConfig: {
              'item._id': 'organisationId',
              'item.domain': 'organisationDomain',
            }
          }
        }
      },
      {
        ui: {
          name: 'expand',
          buttonType: 'icon-button',
          iconName: 'uil uil-transaction',
          view: 'flat'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.Dialog,
          viewId: ID$8,
          params: {
            conversionConfig: {
              'item._id': 'itemId',
            }
          }
        }
      },
    ],
    fields: [
      { fieldId: 'logoUrl' },
      { fieldId: 'status', isEditable: true },
      { fieldId: 'model', isEditable: true },
      { fieldId: 'title' },
      {
        fieldDisplay: new DateField('createdAt', 'Creation Date')
          .setDateFormat('DD MMM YYYY')
          .setDataType(DateDataType.Unix),
      },
      {
        fieldDisplay: new TextField('summary.metrics.mentorCount', 'Mentors'),
      },
      {
        fieldDisplay: new TextField('summary.metrics.menteeCount', 'Mentees'),
      },
    ],
    columns: {
      title: {
        weight: 1,
      },
      status: {
        width: 100,
      },
      model: {
        width: 200,
      },
      logoUrl: {
        width: 50,
      },
      createdAt: {
        width: 150,
      },
      'summary.metrics.mentorCount': {
        width: 100,
      },
      'summary.metrics.menteeCount': {
        width: 100,
      },
    },
  },
  quickSearch: {
    fields: [
      { fieldId: 'domain' },
      { fieldId: 'title' },
      { fieldId: 'status' },
      { fieldId: 'model' },
    ],
    ui: {
      model: {
        width: '200px'
      }
    }
  },
});
const viewConfig$a = TableListViewConfig.decode({
  _id: ID$f,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Organisations',
  space: spaces['mentornity'],
  table: dataConfigs['organisations'],
  query: {
    fields: [
      new DataTransferField('status'),
      new DataTransferField('model'),
      new DataTransferField('logoUrl'),
      new DataTransferField('domain'),
      new DataTransferField('title'),
      new DataTransferField('description'),
      new DataTransferField('createdAt'),
      {
        type: 'reverse-reference',
        id: 'summary',
        otherCollection: 'organisationSummaries',
        nameInOtherCollection: 'organisation',
        isSingle: true,
        fields: [{ id: 'metrics' }]
      }
    ],
    sort: [{ id: 'title', order: 1 }]
  },
  ui: organisationTableListViewUIConfig$1,
});

const ID$g = 'table-list-view-organisation-newest';
const viewConfig$b = TableListViewConfig.decode({
  _id: ID$g,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Newest Organisations',
  space: spaces['mentornity'],
  table: dataConfigs['organisations'],
  query: {
    fields: [
      new DataTransferField('status'),
      new DataTransferField('model'),
      new DataTransferField('logoUrl'),
      new DataTransferField('domain'),
      new DataTransferField('title'),
      new DataTransferField('description'),
      new DataTransferField('createdAt'),
      {
        type: 'reverse-reference',
        id: 'summary',
        otherCollection: 'organisationSummaries',
        nameInOtherCollection: 'organisation',
        isSingle: true,
        fields: [{ id: 'metrics' }]
      }
    ],
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: organisationTableListViewUIConfig$1,
});

const ID$h = 'table-list-view-scheduled-job-next-day-summary';
const tableListViewUIConfigScheduledJobsNextDaySummary = TableListViewConfig.decode({
  main: {
    fields: [
      {
        fieldId: 'createdAt',
        fieldDisplay: new DateField('createdAt', 'Creation Date').setDateFormat('DD MMM YYYY HH:mm').setDataType(DateDataType.Unix),
      },
      {
        fieldId: 'scheduledAt',
        fieldDisplay: new DateField('scheduledAt', 'Scheduled Date').setDateFormat('DD MMM YYYY HH:mm'),
      },
      {
        fieldId: 'status',
      },
    ],
    columns: {
      createdAt: {
        width: 250,
      },
      scheduledAt: {
        width: 250,
      },
      'status': {
        width: 200,
      },
    },
  },
});
const viewConfig$c = TableListViewConfig.decode({
  _id: ID$h,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Next Day Events Summary Jobs',
  space: spaces['mentornity'],
  table: dataConfigs['scheduledjobs'],
  query: {
    fields: [
      new TextField('name', 'Name'),
      new TextField('status', 'Status'),
      new DateField('scheduledAt', 'Created At'),
      new DateField('createdAt', 'Created At'),
    ],
    filter: {
      filters: [
        {
          comparison: Comparison.Eq,
          id: 'name',
          value: 'NotificationNextDayEventsSummary',
        },
      ],
      operator: 'or'
    },
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: tableListViewUIConfigScheduledJobsNextDaySummary,
});

const ID$i = 'table-list-view-scheduled-job-daily-summary';
const viewConfig$d = TableListViewConfig.decode({
  _id: ID$i,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Daily Events Summary Jobs',
  space: spaces['mentornity'],
  table: dataConfigs['scheduledjobs'],
  query: {
    fields: [
      new TextField('name', 'Name'),
      new TextField('status', 'Status'),
      new DateField('scheduledAt', 'Created At'),
      new DateField('createdAt', 'Created At'),
    ],
    filter: {
      filters: [
        {
          comparison: Comparison.Eq,
          id: 'name',
          value: 'NotificationDailyEventSummary',
        },
      ],
      operator: 'or'
    },
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: tableListViewUIConfigScheduledJobsNextDaySummary,
});

const ID$j = 'table-list-view-session';
const config$5 = (dataApi) => TableListViewConfig.decode({
  _id: ID$j,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'User Sessions',
  space: spaces['mentornity'],
  table: dataConfigs['sessions'],
  query: {
    fields: [
      new DataTransferField('client'),
      new DataTransferField('createdAt'),
      new DataTransferField('updatedAt'),
      new DataTransferField('failureReason'),
      new DataTransferField('status'),
      new ReferenceField('user', 'User', 'firstName', 'imageUrl', 'users', [
        new AttachmentField('imageUrl', ''),
        new TextField('email', 'Email'),
        new TextField('firstName', 'First Name'),
        new TextField('lastName', 'Last Name'),
      ], true),
    ],
    sort: [{ id: 'updatedAt', order: -1 }]
  },
  ui: TableListViewConfig.decode({
    header: {
      actions: [],
    },
    main: {
      actions: [],
      fields: [
        {
          fieldId: 'user.imageUrl',
          fieldDisplay: new NestedField('user.imageUrl', new AttachmentField('imageUrl', '').setShape('circle'))
        },
        {
          fieldId: 'user.firstName',
          fieldDisplay: new NestedField('user.firstName', new TextField('firstName', 'First Name'))
        },
        {
          fieldId: 'user.lastName',
          fieldDisplay: new NestedField('user.lastName', new TextField('lastName', 'Last Name'))
        },
        {
          fieldId: 'user.email',
          fieldDisplay: new NestedField('user.email', new TextField('email', 'Email'))
        },
        { fieldId: 'createdAt' },
        { fieldId: 'updatedAt' },
        { fieldId: 'client' },
        { fieldId: 'status' },
        { fieldId: 'failureReason' },
      ],
      columns: {
        'user.imageUrl': {
          width: 50,
        },
        'user.firstName': {
          width: 120,
        },
        'user.lastName': {
          width: 120,
        },
        'user.email': {
          width: 240,
        },
        createdAt: {
          width: 150,
        },
        updatedAt: {
          width: 150,
        },
        status: {
          width: 150,
        },
        client: {
          width: 120,
        },
      },
    },
    quickSearch: {
      fields: [
        {
          field: new SingleChoiceField('user._id', 'Search user', undefined, '', 'select').setDataProvider(userDataProvider(dataApi))
            .setDataAdapter(new DvnDataAdapter('firstName+lastName', '_id')),
        },
        {
          field: new SingleChoiceField('status', 'Status', [
            new SingleChoiceFieldOption('Successful', 'successful'),
            new SingleChoiceFieldOption('Failed', 'failed'),
            new SingleChoiceFieldOption('Logged Out', 'loggedOut'),
          ]),
        }
      ],
      ui: {
        'user._id': {
          width: '240px',
        },
        status: {
          width: '150px',
        },
      },
    },
  }),
});

const ID$k = 'table-list-view-user';
const listViewUIConfig = TableListViewConfig.decode({
  header: {
    actions: [],
  },
  main: {
    actions: [
      {
        ui: {
          name: 'expand',
          buttonType: 'icon-button',
          iconName: 'uil uil-key-skeleton',
          view: 'flat'
        },
        data: {
          type: 'navigation',
          direction: 'forward',
          placement: ViewPlacement.SideModal,
          viewId: ID$3,
          params: {
            conversionConfig: {
              'item._id': 'userId',
            }
          }
        }
      },
    ],
    fields: [
      { fieldId: 'imageUrl' },
      { fieldId: 'firstName' },
      { fieldId: 'lastName' },
      { fieldId: 'email' },
      { fieldId: 'status' },
      { fieldId: 'createdAt' },
      {
        fieldId: 'lastSession.updatedAt',
        fieldDisplay: new NestedField('lastSession.updatedAt', new DateField('updatedAt', 'Last Session')
          .setDataType(DateDataType.Unix)
          .setDateFormat('DD MMM YYYY HH:mm')),
      },
      { fieldId: 'memberships' },
    ],
    columns: {
      createdAt: {
        width: 120,
      },
      email: {
        width: 240,
      },
      firstName: {
        width: 150,
      },
      imageUrl: {
        width: 50,
      },
      lastName: {
        width: 150,
      },
      'lastSession.updatedAt': {
        width: 150,
      },
      status: {
        width: 100,
      },
      memberships: {
        weight: 1,
      },
    },
  },
  quickSearch: {
    fields: [
      { fieldId: 'email' },
      { fieldId: 'firstName' },
      { fieldId: 'lastName' },
      { fieldId: 'status' },
    ]
  },
});
const viewConfig$e = TableListViewConfig.decode({
  _id: ID$k,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Users',
  space: spaces['mentornity'],
  table: dataConfigs['users'],
  query: {
    fields: [
      new DateField('createdAt', 'Created At').setDataType(DateDataType.Unix).setDateFormat('DD MMM YYYY'),
      new AttachmentField('imageUrl', ''),
      new TextField('email', 'Email'),
      new TextField('firstName', 'First Name'),
      new TextField('lastName', 'Last Name'),
      new TextField('status', 'Status'),
      new RelationReferenceField('memberships', 'Programs', 'title', 'logoUrl', 'memberships', 'user', 'organisations', 'organisation', [
        new TextField('status', '')
      ], [
        new TextField('logoUrl', ''),
        new TextField('title', ''),
      ]),
      {
        type: 'reverse-reference',
        id: 'lastSession',
        otherCollection: 'sessions',
        nameInOtherCollection: 'user',
        isSingle: true,
        fields: [{ id: 'updatedAt' }, { id: 'createdAt' }],
        limit: 1,
        sort: {
          order: -1,
          id: 'updatedAt'
        }
      }
    ],
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: listViewUIConfig,
});

const ID$l = 'table-list-view-white-label';
const viewConfig$f = TableListViewConfig.decode({
  _id: ID$l,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'White Labels',
  space: spaces['mentornity'],
  table: dataConfigs['whiteLabels'],
  query: {
    fields: [
      new DataTransferField('title'),
      new DataTransferField('domain'),
      new DataTransferField('createdAt'),
    ],
    sort: [{ id: 'title', order: 1 }]
  },
  ui: TableListViewConfig.decode({
    main: {
      fields: [
        { fieldId: 'title' },
        { fieldId: 'domain' },
        {
          fieldId: 'createdAt',
          fieldDisplay: new DateField('createdAt', 'Date').setDateFormat('DD MMM YYYY').setDataType(DateDataType.Unix),
        },
      ],
      columns: {
        domain: {
          weight: 1,
        },
        title: {
          weight: 1,
        },
        createdAt: {
          width: 150,
        },
      },
    },
  }),
});

const dataApi = new DataApiImpl(dataApiEndpoint, { Authorization: `Bearer ${getSessionData().token}` });
const appConfigs = {
  // app for system admins
  'app-configs-system-admin': AppConfig.decode({
    _id: 'app-configs-system-admin',
    _created: new Date(),
    _updated: new Date(),
    mainNavigation: {
      items: [
        {
          ui: {
            icon: 'uil-building',
            title: 'Newest',
            parent: 'Organisations',
          },
          viewId: ID$g,
        },
        {
          ui: {
            icon: 'uil-building',
            title: 'All',
            parent: 'Organisations',
          },
          viewId: ID$f,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Send Email'
          },
          viewId: ID$d,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Sync Google'
          },
          viewId: ID$b,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Sync Microsoft'
          },
          viewId: ID$c,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Next Day Summary'
          },
          viewId: ID$h,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Daily Summary'
          },
          viewId: ID$i,
        },
        {
          ui: {
            icon: 'uil-signin',
            title: 'Sessions'
          },
          viewId: ID$j,
        },
        {
          ui: {
            icon: 'uil-file-alt',
            title: 'Help',
            parent: 'Support Forms',
          },
          viewId: ID$a,
        },
        {
          ui: {
            icon: 'uil-file-alt',
            title: 'Contact',
            parent: 'Support Forms',
          },
          viewId: ID$9,
        },
        {
          ui: {
            icon: 'uil-user',
            title: 'Users'
          },
          viewId: ID$k,
        },
        {
          ui: {
            icon: 'uil-university',
            title: 'White Labels'
          },
          viewId: ID$l,
        },
      ],
      aligned: 'left',
      centered: false,
    },
    membership: membershipConfigs['system-admins'],
    space: spaces['mentornity'],
    views: [
      viewConfig$2,
      viewConfig$1,
      viewConfig$3,
      viewConfig$4,
      viewConfig,
      viewConfig$5,
      config$2(dataApi),
      config(dataApi),
      config$1(),
      viewConfig$6,
      viewConfig$7,
      viewConfig$a,
      viewConfig$9,
      viewConfig$b,
      viewConfig$d,
      viewConfig$c,
      viewConfig$8,
      config$3(dataApi),
      config$4(dataApi),
      config$5(dataApi),
      viewConfig$e,
      viewConfig$f,
    ],
  }),
};

class UyeApiMentornity {
  constructor(endpoint, headers) {
    this.headers = headers;
    this.endpoint = endpoint;
  }
  getAppConfigOfMembership(_id) {
    return Promise.resolve(appConfigs['app-configs-system-admin']);
  }
  addAuthInterceptor(token) {
    console.log('addAuthInterceptor', token);
  }
  consentAgreement(_id) {
    return Promise.reject(notImplemented('UyeApiMentornity.consentAgreement'));
  }
  getAgreement(_id) {
    return Promise.reject(notImplemented('UyeApiMentornity.getAgreement'));
  }
  activateMembership(_membershipConfigId, _membershipId) {
    return Promise.reject(notImplemented('UyeApiMentornity.activateMembership'));
  }
  getMembership(_membershipConfigId, _membershipId) {
    return Promise.reject(notImplemented('UyeApiMentornity.getMembership'));
  }
  getMembershipsOfUser(userId) {
    return Promise.resolve({
      results: [
        Membership.decode({
          _id: `system-admin-membership-for-${userId}`,
          _created: new Date(),
          _updated: new Date(),
          config: membershipConfigs['system-admins'].toObject(),
          consents: [],
          status: 'active',
          user: User.decode({ _id: userId }),
        })
      ]
    });
  }
  // getMembershipConfig(_id: string): Promise<MembershipConfig> {
  //   return Promise.reject(notImplemented('UyeApiMentornity.getMembershipConfig'));
  // }
  getMembershipConfigWithName(_name) {
    return Promise.reject(notImplemented('UyeApiMentornity.getMembershipConfigWithName'));
  }
  updateMembership(_membershipConfigId, _membershipId, _data) {
    return Promise.reject(notImplemented('UyeApiMentornity.updateMembership'));
  }
}

export { KimlikApiMentornity as K, UyeApiMentornity as U, dataApiEndpoint as d, mentornityApiEndpoint as m };
