"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isFedRamp = isFedRamp;
var FEDRAMP_MODERATE = 'fedramp-moderate';

// Ignored via go/ees005
/* eslint-disable require-unicode-regexp */
var FEDRAMP_HOSTNAME_REGEX = /atlassian-us-gov-mod\.(com|net)|atlassian-us-gov\.(com|net)|atlassian-fex\.(com|net)|atlassian-stg-fedm\.(com|net)/;
/* eslint-enable require-unicode-regexp */

// To determine whether an instance is a FedRAMP instance
// Copied from platform/packages/uip/atl-context/src/services/is-fedramp/index.tsx
// We cannot import the same-named function from @atlassian/atl-context due to editor-common being a public package (and atl-context being private)
// Ignored via go/ees007
// eslint-disable-next-line @atlaskit/editor/enforce-todo-comment-format
// TODO: Seek alternatives
function isFedRamp() {
  var _global$location;
  // Ignored via go/ees005
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  var global = globalThis;
  // MICROS_PERIMETER is already used by few products, so we need to keep it for backward compatibility
  var env = global.MICROS_PERIMETER || global.UNSAFE_ATL_CONTEXT_BOUNDARY;
  if (env) {
    return env === FEDRAMP_MODERATE;
  }
  var matches = (_global$location = global.location) === null || _global$location === void 0 || (_global$location = _global$location.hostname) === null || _global$location === void 0 ? void 0 : _global$location.match(FEDRAMP_HOSTNAME_REGEX);
  return matches ? matches.length > 0 : false;
}