'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.originalImage = exports.originalJpegImage = exports.mediumImage = exports.smallImage = exports.thumbnailImage = exports.derivativeImage = exports.getDerivativePath = exports.getImageViewerPath = exports.DERIVATIVE_ORIGINAL = exports.DERIVATIVE_ORIGINAL_JPEG = exports.DERIVATIVE_MEDIUM = exports.DERIVATIVE_SMALL = exports.DERIVATIVE_THUMBNAIL = exports.VIEWER_WINDOW_NAME = undefined;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _BlobImage = require('../components/media/BlobImage');

var _BlobImage2 = _interopRequireDefault(_BlobImage);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const VIEWER_WINDOW_NAME = exports.VIEWER_WINDOW_NAME = 'viewer';

const DERIVATIVE_THUMBNAIL = exports.DERIVATIVE_THUMBNAIL = 'Thumbnail';
const DERIVATIVE_SMALL = exports.DERIVATIVE_SMALL = 'Small';
const DERIVATIVE_MEDIUM = exports.DERIVATIVE_MEDIUM = 'Medium';
const DERIVATIVE_ORIGINAL_JPEG = exports.DERIVATIVE_ORIGINAL_JPEG = 'OriginalJpeg';
const DERIVATIVE_ORIGINAL = exports.DERIVATIVE_ORIGINAL = '';

const getImageViewerPath = exports.getImageViewerPath = (config, imagePath) => {
  const basename = config.basename;


  return `${basename || ''}/view/${imagePath}`;
};

const getDerivativePath = exports.getDerivativePath = (csid, derivative) => {
  const derivativePath = derivative ? `/derivatives/${derivative}` : '';

  return `blobs/${csid}${derivativePath}/content`;
};

const derivativeImage = exports.derivativeImage = (blobCsid, derivative) => blobCsid ? _react2.default.createElement(_BlobImage2.default, { csid: blobCsid, derivative: derivative }) : null;

const thumbnailImage = exports.thumbnailImage = blobCsid => derivativeImage(blobCsid, DERIVATIVE_THUMBNAIL);

const smallImage = exports.smallImage = blobCsid => derivativeImage(blobCsid, DERIVATIVE_SMALL);

const mediumImage = exports.mediumImage = blobCsid => derivativeImage(blobCsid, DERIVATIVE_MEDIUM);

const originalJpegImage = exports.originalJpegImage = blobCsid => derivativeImage(blobCsid, DERIVATIVE_ORIGINAL_JPEG);

const originalImage = exports.originalImage = blobCsid => derivativeImage(blobCsid, DERIVATIVE_ORIGINAL);