import _defineProperty from "@babel/runtime/helpers/defineProperty";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
import { fg } from '@atlaskit/platform-feature-flags';
var packageName = "@atlaskit/media-viewer";
var packageVersion = "0.0.0-development";
var ufoExperience;
var getExperience = function getExperience() {
  if (!ufoExperience) {
    var inlineExperience = {
      platform: {
        component: 'media-viewer'
      },
      type: ExperienceTypes.Experience,
      performanceType: ExperiencePerformanceTypes.InlineResult,
      featureFlags: getFeatureFlagKeysAllProducts()
    };
    ufoExperience = new UFOExperience('media-file', inlineExperience);
  }
  return ufoExperience;
};
export var startMediaFileUfoExperience = function startMediaFileUfoExperience() {
  getExperience().start();
};
export var succeedMediaFileUfoExperience = function succeedMediaFileUfoExperience(properties) {
  getExperience().success({
    metadata: _objectSpread(_objectSpread({}, properties), {}, {
      packageName: packageName,
      packageVersion: packageVersion,
      mediaEnvironment: getMediaEnvironment(),
      mediaRegion: getMediaRegion(),
      isMediaDocumentViewerEnabled: fg('media_document_viewer')
    })
  });
};
export var failMediaFileUfoExperience = function failMediaFileUfoExperience(properties) {
  var refinedMetadata = _objectSpread(_objectSpread({}, properties), {}, {
    packageName: packageName,
    packageVersion: packageVersion,
    mediaEnvironment: getMediaEnvironment(),
    mediaRegion: getMediaRegion(),
    isMediaDocumentViewerEnabled: fg('media_document_viewer')
  });
  getExperience().failure({
    metadata: refinedMetadata
  });
};