import { r as routeParser } from './index-fd2b14ae.js';
import { C as CookieStorage } from './cookie-d9098150.js';

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

const appRoute = '/:domain(/:page)(/:id)';
function getRouteParams(pathname) {
  // console.log(pathname, new Route(appRoute).match(pathname));
  return new routeParser(appRoute).match(pathname);
}

function getSessionDetails() {
  const { domain } = getRouteParams(location.pathname);
  const jwt = new CookieStorage().get('mt_at');
  const context = {
    organisationDomain: domain,
    organisationId: new CookieStorage().get('mt_oid'),
    userId: new CookieStorage().get('mt_uid'),
    role: new CookieStorage().get('mt_role'),
  };
  const headers = {
    Client: 'd2ViLWNsaWVu',
  };
  if (jwt) {
    headers['Authorization'] = `Bearer ${jwt}`;
  }
  else {
    headers['Session-Token'] = `NTdiMzY3NjBlNjNiY2UxZWViMDAwMDA0`;
  }
  return { context, headers };
}

export { getRouteParams as a, getSessionDetails as g, mentornityApiEndpoint as m };
