Source: utils/Constants.js

/**
 * @module utils/Constants.js
 * @name Constants
 * @copyright 2023 3Liz
 * @license MPL-2.0
 */

/**
 * @constant
 * Adjust OL2 to OL7 DPI value.
 */
// We use 25.40005080010160020 for inch to meter conversion as it is more precise
// const ADJUSTED_DPI = 96 * 25.4 / 25.40005080010160020;
export const ADJUSTED_DPI = 95.999808;

/**
 * @constant
 * Regex to check if a path is a media path
 */
export const MEDIA_REGEX = /^(\/)?(?:\.\.\/)?media\//;

/**
 * @constant
 * Regex to check if a path is an URL wich starts with /, http://, https:// or data:
 */
export const URL_REGEX = /^\/|(?:https?:\/\/)|(?:data:)/

/**
 * @constant
 * Constants object to be exposed to the global scop
 */
export const Constants = Object.freeze({
    ADJUSTED_DPI: ADJUSTED_DPI,
    MEDIA_REGEX: MEDIA_REGEX,
    URL_REGEX: URL_REGEX,
});