/**
* cloudinary-main.js
* Cloudinary's JavaScript library - Version 2.9.0
* Copyright Cloudinary
* see https://github.com/cloudinary/cloudinary_js
*
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["cloudinary"] = factory();
else
root["cloudinary"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/namespace/cloudinary-jquery.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./src/namespace/cloudinary-jquery.js":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "ClientHintsMetaTag", function() { return /* reexport */ clienthintsmetatag; });
__webpack_require__.d(__webpack_exports__, "Cloudinary", function() { return /* reexport */ cloudinary; });
__webpack_require__.d(__webpack_exports__, "CloudinaryJQuery", function() { return /* reexport */ cloudinaryjquery; });
__webpack_require__.d(__webpack_exports__, "Condition", function() { return /* reexport */ condition; });
__webpack_require__.d(__webpack_exports__, "Configuration", function() { return /* reexport */ src_configuration; });
__webpack_require__.d(__webpack_exports__, "crc32", function() { return /* reexport */ src_crc32; });
__webpack_require__.d(__webpack_exports__, "FetchLayer", function() { return /* reexport */ fetchlayer; });
__webpack_require__.d(__webpack_exports__, "HtmlTag", function() { return /* reexport */ htmltag; });
__webpack_require__.d(__webpack_exports__, "ImageTag", function() { return /* reexport */ imagetag; });
__webpack_require__.d(__webpack_exports__, "Layer", function() { return /* reexport */ layer_layer; });
__webpack_require__.d(__webpack_exports__, "PictureTag", function() { return /* reexport */ picturetag; });
__webpack_require__.d(__webpack_exports__, "SubtitlesLayer", function() { return /* reexport */ subtitleslayer; });
__webpack_require__.d(__webpack_exports__, "TextLayer", function() { return /* reexport */ textlayer; });
__webpack_require__.d(__webpack_exports__, "Transformation", function() { return /* reexport */ src_transformation; });
__webpack_require__.d(__webpack_exports__, "utf8_encode", function() { return /* reexport */ src_utf8_encode; });
__webpack_require__.d(__webpack_exports__, "Util", function() { return /* reexport */ jquery_namespaceObject; });
__webpack_require__.d(__webpack_exports__, "VideoTag", function() { return /* reexport */ videotag; });
// NAMESPACE OBJECT: ./src/util/jquery.js
var jquery_namespaceObject = {};
__webpack_require__.r(jquery_namespaceObject);
__webpack_require__.d(jquery_namespaceObject, "omit", function() { return omit; });
__webpack_require__.d(jquery_namespaceObject, "allStrings", function() { return baseutil_allStrings; });
__webpack_require__.d(jquery_namespaceObject, "without", function() { return without; });
__webpack_require__.d(jquery_namespaceObject, "isNumberLike", function() { return isNumberLike; });
__webpack_require__.d(jquery_namespaceObject, "smartEscape", function() { return smartEscape; });
__webpack_require__.d(jquery_namespaceObject, "defaults", function() { return defaults; });
__webpack_require__.d(jquery_namespaceObject, "objectProto", function() { return objectProto; });
__webpack_require__.d(jquery_namespaceObject, "objToString", function() { return objToString; });
__webpack_require__.d(jquery_namespaceObject, "isObject", function() { return isObject; });
__webpack_require__.d(jquery_namespaceObject, "funcTag", function() { return funcTag; });
__webpack_require__.d(jquery_namespaceObject, "isFunction", function() { return isFunction; });
__webpack_require__.d(jquery_namespaceObject, "reWords", function() { return reWords; });
__webpack_require__.d(jquery_namespaceObject, "camelCase", function() { return camelCase; });
__webpack_require__.d(jquery_namespaceObject, "snakeCase", function() { return snakeCase; });
__webpack_require__.d(jquery_namespaceObject, "convertKeys", function() { return convertKeys; });
__webpack_require__.d(jquery_namespaceObject, "withCamelCaseKeys", function() { return withCamelCaseKeys; });
__webpack_require__.d(jquery_namespaceObject, "withSnakeCaseKeys", function() { return withSnakeCaseKeys; });
__webpack_require__.d(jquery_namespaceObject, "base64Encode", function() { return base64Encode; });
__webpack_require__.d(jquery_namespaceObject, "base64EncodeURL", function() { return base64EncodeURL; });
__webpack_require__.d(jquery_namespaceObject, "extractUrlParams", function() { return extractUrlParams; });
__webpack_require__.d(jquery_namespaceObject, "patchFetchFormat", function() { return patchFetchFormat; });
__webpack_require__.d(jquery_namespaceObject, "optionConsume", function() { return optionConsume; });
__webpack_require__.d(jquery_namespaceObject, "isEmpty", function() { return isEmpty; });
__webpack_require__.d(jquery_namespaceObject, "getData", function() { return getData; });
__webpack_require__.d(jquery_namespaceObject, "setData", function() { return setData; });
__webpack_require__.d(jquery_namespaceObject, "getAttribute", function() { return getAttribute; });
__webpack_require__.d(jquery_namespaceObject, "setAttribute", function() { return setAttribute; });
__webpack_require__.d(jquery_namespaceObject, "removeAttribute", function() { return removeAttribute; });
__webpack_require__.d(jquery_namespaceObject, "setAttributes", function() { return setAttributes; });
__webpack_require__.d(jquery_namespaceObject, "hasClass", function() { return hasClass; });
__webpack_require__.d(jquery_namespaceObject, "addClass", function() { return addClass; });
__webpack_require__.d(jquery_namespaceObject, "width", function() { return jquery_width; });
__webpack_require__.d(jquery_namespaceObject, "isString", function() { return isString; });
__webpack_require__.d(jquery_namespaceObject, "merge", function() { return jquery_merge; });
__webpack_require__.d(jquery_namespaceObject, "compact", function() { return compact; });
__webpack_require__.d(jquery_namespaceObject, "cloneDeep", function() { return cloneDeep; });
__webpack_require__.d(jquery_namespaceObject, "contains", function() { return contains; });
__webpack_require__.d(jquery_namespaceObject, "difference", function() { return difference; });
__webpack_require__.d(jquery_namespaceObject, "functions", function() { return functions; });
__webpack_require__.d(jquery_namespaceObject, "identity", function() { return identity; });
__webpack_require__.d(jquery_namespaceObject, "isArray", function() { return isArray; });
__webpack_require__.d(jquery_namespaceObject, "assign", function() { return jquery_assign; });
__webpack_require__.d(jquery_namespaceObject, "isPlainObject", function() { return isPlainObject; });
__webpack_require__.d(jquery_namespaceObject, "trim", function() { return trim; });
// NAMESPACE OBJECT: ./src/constants.js
var constants_namespaceObject = {};
__webpack_require__.r(constants_namespaceObject);
__webpack_require__.d(constants_namespaceObject, "VERSION", function() { return VERSION; });
__webpack_require__.d(constants_namespaceObject, "CF_SHARED_CDN", function() { return CF_SHARED_CDN; });
__webpack_require__.d(constants_namespaceObject, "OLD_AKAMAI_SHARED_CDN", function() { return OLD_AKAMAI_SHARED_CDN; });
__webpack_require__.d(constants_namespaceObject, "AKAMAI_SHARED_CDN", function() { return AKAMAI_SHARED_CDN; });
__webpack_require__.d(constants_namespaceObject, "SHARED_CDN", function() { return SHARED_CDN; });
__webpack_require__.d(constants_namespaceObject, "DEFAULT_POSTER_OPTIONS", function() { return DEFAULT_POSTER_OPTIONS; });
__webpack_require__.d(constants_namespaceObject, "DEFAULT_VIDEO_SOURCE_TYPES", function() { return DEFAULT_VIDEO_SOURCE_TYPES; });
__webpack_require__.d(constants_namespaceObject, "SEO_TYPES", function() { return SEO_TYPES; });
__webpack_require__.d(constants_namespaceObject, "DEFAULT_IMAGE_PARAMS", function() { return DEFAULT_IMAGE_PARAMS; });
__webpack_require__.d(constants_namespaceObject, "DEFAULT_VIDEO_PARAMS", function() { return DEFAULT_VIDEO_PARAMS; });
__webpack_require__.d(constants_namespaceObject, "DEFAULT_VIDEO_SOURCES", function() { return DEFAULT_VIDEO_SOURCES; });
// CONCATENATED MODULE: ./src/utf8_encode.js
/**
* UTF8 encoder
* @private
*/
var utf8_encode;
/* harmony default export */ var src_utf8_encode = (utf8_encode = function utf8_encode(argString) {
var c1, enc, end, n, start, string, stringl, utftext; // http://kevin.vanzonneveld.net
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: sowberry
// + tweaked by: Jack
// + bugfixed by: Onno Marsman
// + improved by: Yves Sucaet
// + bugfixed by: Onno Marsman
// + bugfixed by: Ulrich
// + bugfixed by: Rafal Kukawski
// + improved by: kirilloid
// * example 1: utf8_encode('Kevin van Zonneveld');
// * returns 1: 'Kevin van Zonneveld'
if (argString === null || typeof argString === 'undefined') {
return '';
}
string = argString + ''; // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
utftext = '';
start = void 0;
end = void 0;
stringl = 0;
start = end = 0;
stringl = string.length;
n = 0;
while (n < stringl) {
c1 = string.charCodeAt(n);
enc = null;
if (c1 < 128) {
end++;
} else if (c1 > 127 && c1 < 2048) {
enc = String.fromCharCode(c1 >> 6 | 192, c1 & 63 | 128);
} else {
enc = String.fromCharCode(c1 >> 12 | 224, c1 >> 6 & 63 | 128, c1 & 63 | 128);
}
if (enc !== null) {
if (end > start) {
utftext += string.slice(start, end);
}
utftext += enc;
start = end = n + 1;
}
n++;
}
if (end > start) {
utftext += string.slice(start, stringl);
}
return utftext;
});
// CONCATENATED MODULE: ./src/crc32.js
/**
* CRC32 calculator
* Depends on 'utf8_encode'
* @private
* @param {string} str - The string to calculate the CRC32 for.
* @return {number}
*/
function crc32(str) {
var crc, i, iTop, table, x, y; // http://kevin.vanzonneveld.net
// + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + improved by: T0bsn
// + improved by: http://stackoverflow.com/questions/2647935/javascript-crc32-function-and-php-crc32-not-matching
// - depends on: utf8_encode
// * example 1: crc32('Kevin van Zonneveld');
// * returns 1: 1249991249
str = src_utf8_encode(str);
table = '00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D';
crc = 0;
x = 0;
y = 0;
crc = crc ^ -1;
i = 0;
iTop = str.length;
while (i < iTop) {
y = (crc ^ str.charCodeAt(i)) & 0xFF;
x = '0x' + table.substr(y * 9, 8);
crc = crc >>> 8 ^ x;
i++;
}
crc = crc ^ -1; //convert to unsigned 32-bit int if needed
if (crc < 0) {
crc += 4294967296;
}
return crc;
}
/* harmony default export */ var src_crc32 = (crc32);
// CONCATENATED MODULE: ./src/util/baseutil.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/*
* Includes common utility methods and shims
*/
function omit(obj, keys) {
obj = obj || {};
var srcKeys = Object.keys(obj).filter(function (key) {
return !contains(keys, key);
});
var filtered = {};
srcKeys.forEach(function (key) {
return filtered[key] = obj[key];
});
return filtered;
}
/**
* Return true if all items in list are strings
* @function Util.allString
* @param {Array} list - an array of items
*/
var baseutil_allStrings = function allStrings(list) {
return list.length && list.every(isString);
};
/**
* Creates a new array without the given item.
* @function Util.without
* @param {Array} array - original array
* @param {*} item - the item to exclude from the new array
* @return {Array} a new array made of the original array's items except for `item`
*/
var without = function without(array, item) {
return array.filter(function (v) {
return v !== item;
});
};
/**
* Return true is value is a number or a string representation of a number.
* @function Util.isNumberLike
* @param {*} value
* @returns {boolean} true if value is a number
* @example
* Util.isNumber(0) // true
* Util.isNumber("1.3") // true
* Util.isNumber("") // false
* Util.isNumber(undefined) // false
*/
var isNumberLike = function isNumberLike(value) {
return value != null && !isNaN(parseFloat(value));
};
/**
* Escape all characters matching unsafe in the given string
* @function Util.smartEscape
* @param {string} string - source string to escape
* @param {RegExp} unsafe - characters that must be escaped
* @return {string} escaped string
*/
var smartEscape = function smartEscape(string) {
var unsafe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : /([^a-zA-Z0-9_.\-\/:]+)/g;
return string.replace(unsafe, function (match) {
return match.split("").map(function (c) {
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
}).join("");
});
};
/**
* Assign values from sources if they are not defined in the destination.
* Once a value is set it does not change
* @function Util.defaults
* @param {Object} destination - the object to assign defaults to
* @param {...Object} source - the source object(s) to assign defaults from
* @return {Object} destination after it was modified
*/
var defaults = function defaults(destination) {
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
sources[_key - 1] = arguments[_key];
}
return sources.reduce(function (dest, source) {
var key, value;
for (key in source) {
value = source[key];
if (dest[key] === void 0) {
dest[key] = value;
}
}
return dest;
}, destination);
};
/*********** lodash functions */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
#isObject({});
* // => true
*
#isObject([1, 2, 3]);
* // => true
*
#isObject(1);
* // => false
*/
var isObject = function isObject(value) {
var type; // Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
type = _typeof(value);
return !!value && (type === 'object' || type === 'function');
};
var funcTag = '[object Function]';
/**
* Checks if `value` is classified as a `Function` object.
* @function Util.isFunction
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* function Foo(){};
* isFunction(Foo);
* // => true
*
* isFunction(/abc/);
* // => false
*/
var isFunction = function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 which returns 'object' for typed array constructors.
return isObject(value) && objToString.call(value) === funcTag;
};
/*********** lodash functions */
/** Used to match words to create compound words. */
var reWords = function () {
var lower, upper;
upper = '[A-Z]';
lower = '[a-z]+';
return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
}();
/**
* Convert string to camelCase
* @function Util.camelCase
* @param {string} source - the string to convert
* @return {string} in camelCase format
*/
var camelCase = function camelCase(source) {
var words = source.match(reWords);
words = words.map(function (word) {
return word.charAt(0).toLocaleUpperCase() + word.slice(1).toLocaleLowerCase();
});
words[0] = words[0].toLocaleLowerCase();
return words.join('');
};
/**
* Convert string to snake_case
* @function Util.snakeCase
* @param {string} source - the string to convert
* @return {string} in snake_case format
*/
var snakeCase = function snakeCase(source) {
var words = source.match(reWords);
words = words.map(function (word) {
return word.toLocaleLowerCase();
});
return words.join('_');
};
/**
* Creates a new object from source, with the keys transformed using the converter.
* @param {object} source
* @param {function|null} converter
* @returns {object}
*/
var convertKeys = function convertKeys(source, converter) {
var result, value;
result = {};
for (var key in source) {
value = source[key];
if (converter) {
key = converter(key);
}
if (!isEmpty(key)) {
result[key] = value;
}
}
return result;
};
/**
* Create a copy of the source object with all keys in camelCase
* @function Util.withCamelCaseKeys
* @param {Object} value - the object to copy
* @return {Object} a new object
*/
var withCamelCaseKeys = function withCamelCaseKeys(source) {
return convertKeys(source, camelCase);
};
/**
* Create a copy of the source object with all keys in snake_case
* @function Util.withSnakeCaseKeys
* @param {Object} value - the object to copy
* @return {Object} a new object
*/
var withSnakeCaseKeys = function withSnakeCaseKeys(source) {
return convertKeys(source, snakeCase);
}; // Browser
// Node.js
var base64Encode = typeof btoa !== 'undefined' && isFunction(btoa) ? btoa : typeof Buffer !== 'undefined' && isFunction(Buffer) ? function (input) {
if (!(input instanceof Buffer)) {
input = new Buffer.from(String(input), 'binary');
}
return input.toString('base64');
} : function (input) {
throw new Error("No base64 encoding function found");
};
/**
* Returns the Base64-decoded version of url.
* This method delegates to `btoa` if present. Otherwise it tries `Buffer`.
* @function Util.base64EncodeURL
* @param {string} url - the url to encode. the value is URIdecoded and then re-encoded before converting to base64 representation
* @return {string} the base64 representation of the URL
*/
var base64EncodeURL = function base64EncodeURL(url) {
try {
url = decodeURI(url);
} finally {
url = encodeURI(url);
}
return base64Encode(url);
};
/**
* A list of keys used by the url() function.
* @private
*/
var URL_KEYS = ['api_secret', 'auth_token', 'cdn_subdomain', 'cloud_name', 'cname', 'format', 'private_cdn', 'resource_type', 'secure', 'secure_cdn_subdomain', 'secure_distribution', 'shorten', 'sign_url', 'signature', 'ssl_detected', 'type', 'url_suffix', 'use_root_path', 'version'];
/**
* Create a new object with only URL parameters
* @param {object} options The source object
* @return {Object} An object containing only URL parameters
*/
function extractUrlParams(options) {
return URL_KEYS.reduce(function (obj, key) {
if (options[key] != null) {
obj[key] = options[key];
}
return obj;
}, {});
}
/**
* Handle the format parameter for fetch urls
* @private
* @param options url and transformation options. This argument may be changed by the function!
*/
function patchFetchFormat(options) {
if (options == null) {
options = {};
}
if (options.type === "fetch") {
if (options.fetch_format == null) {
options.fetch_format = optionConsume(options, "format");
}
}
}
/**
* Deletes `option_name` from `options` and return the value if present.
* If `options` doesn't contain `option_name` the default value is returned.
* @param {Object} options a collection
* @param {String} option_name the name (key) of the desired value
* @param {*} [default_value] the value to return is option_name is missing
*/
function optionConsume(options, option_name, default_value) {
var result = options[option_name];
delete options[option_name];
if (result != null) {
return result;
} else {
return default_value;
}
}
/**
* Returns true if value is empty:
*
Possible values:
* - `image`
* - `video`
* - `raw`
* @param {signature} [options.signature='s--12345678--'] - The signature component of a
* signed delivery URL of the format: /s--SIGNATURE--/.
* For details on signatures, see
* Signatures.
* @return {string} The media asset URL.
* @see
* Available image transformations
* @see
* Available video transformations
*/
function url_url(publicId) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
if (!publicId) {
return publicId;
}
options = prepareOptions(options, config);
publicId = preparePublicId(publicId, options);
var error = validate(options);
if (error) {
throw error;
}
return urlString(publicId, options);
}
;
// CONCATENATED MODULE: ./src/util/generateBreakpoints.js
function generateBreakpoints_slicedToArray(arr, i) { return generateBreakpoints_arrayWithHoles(arr) || generateBreakpoints_iterableToArrayLimit(arr, i) || generateBreakpoints_unsupportedIterableToArray(arr, i) || generateBreakpoints_nonIterableRest(); }
function generateBreakpoints_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function generateBreakpoints_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return generateBreakpoints_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return generateBreakpoints_arrayLikeToArray(o, minLen); }
function generateBreakpoints_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function generateBreakpoints_iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function generateBreakpoints_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**
* Helper function. Gets or populates srcset breakpoints using provided parameters
* Either the breakpoints or min_width, max_width, max_images must be provided.
*
* @private
* @param {srcset} srcset Options with either `breakpoints` or `min_width`, `max_width`, and `max_images`
*
* @return {number[]} Array of breakpoints
*
*/
function generateBreakpoints(srcset) {
var breakpoints = srcset.breakpoints || [];
if (breakpoints.length) {
return breakpoints;
}
var _map = [srcset.min_width, srcset.max_width, srcset.max_images].map(Number),
_map2 = generateBreakpoints_slicedToArray(_map, 3),
min_width = _map2[0],
max_width = _map2[1],
max_images = _map2[2];
if ([min_width, max_width, max_images].some(isNaN)) {
throw 'Either (min_width, max_width, max_images) ' + 'or breakpoints must be provided to the image srcset attribute';
}
if (min_width > max_width) {
throw 'min_width must be less than max_width';
}
if (max_images <= 0) {
throw 'max_images must be a positive integer';
} else if (max_images === 1) {
min_width = max_width;
}
var stepSize = Math.ceil((max_width - min_width) / Math.max(max_images - 1, 1));
for (var current = min_width; current < max_width; current += stepSize) {
breakpoints.push(current);
}
breakpoints.push(max_width);
return breakpoints;
}
// CONCATENATED MODULE: ./src/util/srcsetUtils.js
var srcsetUtils_isEmpty = isEmpty;
/**
* Options used to generate the srcset attribute.
* @typedef {object} srcset
* @property {(number[]|string[])} [breakpoints] An array of breakpoints.
* @property {number} [min_width] Minimal width of the srcset images.
* @property {number} [max_width] Maximal width of the srcset images.
* @property {number} [max_images] Number of srcset images to generate.
* @property {object|string} [transformation] The transformation to use in the srcset urls.
* @property {boolean} [sizes] Whether to calculate and add the sizes attribute.
*/
/**
* Helper function. Generates a single srcset item url
*
* @private
* @param {string} public_id Public ID of the resource.
* @param {number} width Width in pixels of the srcset item.
* @param {object|string} transformation
* @param {object} options Additional options.
*
* @return {string} Resulting URL of the item
*/
function scaledUrl(public_id, width, transformation) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var configParams = extractUrlParams(options);
transformation = transformation || options;
configParams.raw_transformation = new src_transformation([jquery_merge({}, transformation), {
crop: 'scale',
width: width
}]).toString();
return url_url(public_id, configParams);
}
/**
* If cache is enabled, get the breakpoints from the cache. If the values were not found in the cache,
* or cache is not enabled, generate the values.
* @param {srcset} srcset The srcset configuration parameters
* @param {string} public_id
* @param {object} options
* @return {*|Array}
*/
function getOrGenerateBreakpoints(public_id) {
var srcset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return generateBreakpoints(srcset);
}
/**
* Helper function. Generates srcset attribute value of the HTML img tag
* @private
*
* @param {string} public_id Public ID of the resource
* @param {number[]} breakpoints An array of breakpoints (in pixels)
* @param {object} transformation The transformation
* @param {object} options Includes html tag options, transformation options
* @return {string} Resulting srcset attribute value
*/
function generateSrcsetAttribute(public_id, breakpoints, transformation, options) {
options = cloneDeep(options);
patchFetchFormat(options);
return breakpoints.map(function (width) {
return "".concat(scaledUrl(public_id, width, transformation, options), " ").concat(width, "w");
}).join(', ');
}
/**
* Helper function. Generates sizes attribute value of the HTML img tag
* @private
* @param {number[]} breakpoints An array of breakpoints.
* @return {string} Resulting sizes attribute value
*/
function generateSizesAttribute(breakpoints) {
if (breakpoints == null) {
return '';
}
return breakpoints.map(function (width) {
return "(max-width: ".concat(width, "px) ").concat(width, "px");
}).join(', ');
}
/**
* Helper function. Generates srcset and sizes attributes of the image tag
*
* Generated attributes are added to attributes argument
*
* @private
* @param {string} publicId The public ID of the resource
* @param {object} attributes Existing HTML attributes.
* @param {srcset} srcsetData
* @param {object} options Additional options.
*
* @return array The responsive attributes
*/
function generateImageResponsiveAttributes(publicId) {
var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var srcsetData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
// Create both srcset and sizes here to avoid fetching breakpoints twice
var responsiveAttributes = {};
if (srcsetUtils_isEmpty(srcsetData)) {
return responsiveAttributes;
}
var generateSizes = !attributes.sizes && srcsetData.sizes === true;
var generateSrcset = !attributes.srcset;
if (generateSrcset || generateSizes) {
var breakpoints = getOrGenerateBreakpoints(publicId, srcsetData, options);
if (generateSrcset) {
var transformation = srcsetData.transformation;
var srcsetAttr = generateSrcsetAttribute(publicId, breakpoints, transformation, options);
if (!srcsetUtils_isEmpty(srcsetAttr)) {
responsiveAttributes.srcset = srcsetAttr;
}
}
if (generateSizes) {
var sizesAttr = generateSizesAttribute(breakpoints);
if (!srcsetUtils_isEmpty(sizesAttr)) {
responsiveAttributes.sizes = sizesAttr;
}
}
}
return responsiveAttributes;
}
/**
* Generate a media query
*
* @private
* @param {object} options configuration options
* @param {number|string} options.min_width
* @param {number|string} options.max_width
* @return {string} a media query string
*/
function generateMediaAttr(options) {
var mediaQuery = [];
if (options != null) {
if (options.min_width != null) {
mediaQuery.push("(min-width: ".concat(options.min_width, "px)"));
}
if (options.max_width != null) {
mediaQuery.push("(max-width: ".concat(options.max_width, "px)"));
}
}
return mediaQuery.join(' and ');
}
var srcsetUrl = scaledUrl;
// CONCATENATED MODULE: ./src/tags/imagetag.js
function imagetag_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { imagetag_typeof = function _typeof(obj) { return typeof obj; }; } else { imagetag_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return imagetag_typeof(obj); }
function imagetag_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function imagetag_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function imagetag_createClass(Constructor, protoProps, staticProps) { if (protoProps) imagetag_defineProperties(Constructor.prototype, protoProps); if (staticProps) imagetag_defineProperties(Constructor, staticProps); return Constructor; }
function imagetag_get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { imagetag_get = Reflect.get; } else { imagetag_get = function _get(target, property, receiver) { var base = imagetag_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return imagetag_get(target, property, receiver || target); }
function imagetag_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = imagetag_getPrototypeOf(object); if (object === null) break; } return object; }
function imagetag_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) imagetag_setPrototypeOf(subClass, superClass); }
function imagetag_setPrototypeOf(o, p) { imagetag_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return imagetag_setPrototypeOf(o, p); }
function imagetag_createSuper(Derived) { var hasNativeReflectConstruct = imagetag_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = imagetag_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = imagetag_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return imagetag_possibleConstructorReturn(this, result); }; }
function imagetag_possibleConstructorReturn(self, call) { if (call && (imagetag_typeof(call) === "object" || typeof call === "function")) { return call; } return imagetag_assertThisInitialized(self); }
function imagetag_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function imagetag_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function imagetag_getPrototypeOf(o) { imagetag_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return imagetag_getPrototypeOf(o); }
/**
* Image Tag
* Depends on 'tags/htmltag', 'cloudinary'
*/
/**
* Creates an HTML (DOM) Image tag using Cloudinary as the source.
* @constructor ImageTag
* @extends HtmlTag
* @param {string} [publicId]
* @param {Object} [options]
*/
var imagetag_ImageTag = /*#__PURE__*/function (_HtmlTag) {
imagetag_inherits(ImageTag, _HtmlTag);
var _super = imagetag_createSuper(ImageTag);
function ImageTag(publicId) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
imagetag_classCallCheck(this, ImageTag);
return _super.call(this, "img", publicId, options);
}
/** @override */
imagetag_createClass(ImageTag, [{
key: "closeTag",
value: function closeTag() {
return "";
}
/** @override */
}, {
key: "attributes",
value: function attributes() {
var attr, options, srcAttribute;
attr = imagetag_get(imagetag_getPrototypeOf(ImageTag.prototype), "attributes", this).call(this) || {};
options = this.getOptions();
var srcsetParam = this.getOption('srcset');
var attributes = this.getOption('attributes') || {};
var responsiveAttributes = {};
if (isString(srcsetParam)) {
responsiveAttributes.srcset = srcsetParam;
} else {
responsiveAttributes = generateImageResponsiveAttributes(this.publicId, attributes, srcsetParam, options);
}
if (!isEmpty(responsiveAttributes)) {
delete options.width;
delete options.height;
}
jquery_merge(attr, responsiveAttributes);
srcAttribute = options.responsive && !options.client_hints ? 'data-src' : 'src';
if (attr[srcAttribute] == null) {
attr[srcAttribute] = url_url(this.publicId, this.getOptions());
}
return attr;
}
}]);
return ImageTag;
}(htmltag);
;
/* harmony default export */ var imagetag = (imagetag_ImageTag);
// CONCATENATED MODULE: ./src/tags/sourcetag.js
function sourcetag_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { sourcetag_typeof = function _typeof(obj) { return typeof obj; }; } else { sourcetag_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return sourcetag_typeof(obj); }
function sourcetag_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function sourcetag_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function sourcetag_createClass(Constructor, protoProps, staticProps) { if (protoProps) sourcetag_defineProperties(Constructor.prototype, protoProps); if (staticProps) sourcetag_defineProperties(Constructor, staticProps); return Constructor; }
function sourcetag_get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { sourcetag_get = Reflect.get; } else { sourcetag_get = function _get(target, property, receiver) { var base = sourcetag_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return sourcetag_get(target, property, receiver || target); }
function sourcetag_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = sourcetag_getPrototypeOf(object); if (object === null) break; } return object; }
function sourcetag_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) sourcetag_setPrototypeOf(subClass, superClass); }
function sourcetag_setPrototypeOf(o, p) { sourcetag_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return sourcetag_setPrototypeOf(o, p); }
function sourcetag_createSuper(Derived) { var hasNativeReflectConstruct = sourcetag_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = sourcetag_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = sourcetag_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return sourcetag_possibleConstructorReturn(this, result); }; }
function sourcetag_possibleConstructorReturn(self, call) { if (call && (sourcetag_typeof(call) === "object" || typeof call === "function")) { return call; } return sourcetag_assertThisInitialized(self); }
function sourcetag_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function sourcetag_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function sourcetag_getPrototypeOf(o) { sourcetag_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return sourcetag_getPrototypeOf(o); }
/**
* Image Tag
* Depends on 'tags/htmltag', 'cloudinary'
*/
/**
* Creates an HTML (DOM) Image tag using Cloudinary as the source.
* @constructor SourceTag
* @extends HtmlTag
* @param {string} [publicId]
* @param {Object} [options]
*/
var sourcetag_SourceTag = /*#__PURE__*/function (_HtmlTag) {
sourcetag_inherits(SourceTag, _HtmlTag);
var _super = sourcetag_createSuper(SourceTag);
function SourceTag(publicId) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
sourcetag_classCallCheck(this, SourceTag);
return _super.call(this, "source", publicId, options);
}
/** @override */
sourcetag_createClass(SourceTag, [{
key: "closeTag",
value: function closeTag() {
return "";
}
/** @override */
}, {
key: "attributes",
value: function attributes() {
var srcsetParam = this.getOption('srcset');
var attr = sourcetag_get(sourcetag_getPrototypeOf(SourceTag.prototype), "attributes", this).call(this) || {};
var options = this.getOptions();
jquery_merge(attr, generateImageResponsiveAttributes(this.publicId, attr, srcsetParam, options));
if (!attr.srcset) {
attr.srcset = url_url(this.publicId, options);
}
if (!attr.media && options.media) {
attr.media = generateMediaAttr(options.media);
}
return attr;
}
}]);
return SourceTag;
}(htmltag);
;
/* harmony default export */ var sourcetag = (sourcetag_SourceTag);
// CONCATENATED MODULE: ./src/tags/picturetag.js
function picturetag_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { picturetag_typeof = function _typeof(obj) { return typeof obj; }; } else { picturetag_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return picturetag_typeof(obj); }
function picturetag_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function picturetag_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function picturetag_createClass(Constructor, protoProps, staticProps) { if (protoProps) picturetag_defineProperties(Constructor.prototype, protoProps); if (staticProps) picturetag_defineProperties(Constructor, staticProps); return Constructor; }
function picturetag_get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { picturetag_get = Reflect.get; } else { picturetag_get = function _get(target, property, receiver) { var base = picturetag_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return picturetag_get(target, property, receiver || target); }
function picturetag_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = picturetag_getPrototypeOf(object); if (object === null) break; } return object; }
function picturetag_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) picturetag_setPrototypeOf(subClass, superClass); }
function picturetag_setPrototypeOf(o, p) { picturetag_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return picturetag_setPrototypeOf(o, p); }
function picturetag_createSuper(Derived) { var hasNativeReflectConstruct = picturetag_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = picturetag_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = picturetag_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return picturetag_possibleConstructorReturn(this, result); }; }
function picturetag_possibleConstructorReturn(self, call) { if (call && (picturetag_typeof(call) === "object" || typeof call === "function")) { return call; } return picturetag_assertThisInitialized(self); }
function picturetag_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function picturetag_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function picturetag_getPrototypeOf(o) { picturetag_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return picturetag_getPrototypeOf(o); }
var picturetag_PictureTag = /*#__PURE__*/function (_HtmlTag) {
picturetag_inherits(PictureTag, _HtmlTag);
var _super = picturetag_createSuper(PictureTag);
function PictureTag(publicId) {
var _this;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var sources = arguments.length > 2 ? arguments[2] : undefined;
picturetag_classCallCheck(this, PictureTag);
_this = _super.call(this, 'picture', publicId, options);
_this.widthList = sources;
return _this;
}
/** @override */
picturetag_createClass(PictureTag, [{
key: "content",
value: function content() {
var _this2 = this;
return this.widthList.map(function (_ref) {
var min_width = _ref.min_width,
max_width = _ref.max_width,
transformation = _ref.transformation;
var options = _this2.getOptions();
var sourceTransformation = new src_transformation(options);
sourceTransformation.chain().fromOptions(typeof transformation === 'string' ? {
raw_transformation: transformation
} : transformation);
options = extractUrlParams(options);
options.media = {
min_width: min_width,
max_width: max_width
};
options.transformation = sourceTransformation;
return new sourcetag(_this2.publicId, options).toHtml();
}).join('') + new imagetag(this.publicId, this.getOptions()).toHtml();
}
/** @override */
}, {
key: "attributes",
value: function attributes() {
var attr = picturetag_get(picturetag_getPrototypeOf(PictureTag.prototype), "attributes", this).call(this);
delete attr.width;
delete attr.height;
return attr;
}
/** @override */
}, {
key: "closeTag",
value: function closeTag() {
return "" + this.name + ">";
}
}]);
return PictureTag;
}(htmltag);
;
/* harmony default export */ var picturetag = (picturetag_PictureTag);
// CONCATENATED MODULE: ./src/tags/videotag.js
function videotag_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { videotag_typeof = function _typeof(obj) { return typeof obj; }; } else { videotag_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return videotag_typeof(obj); }
function videotag_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function videotag_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function videotag_createClass(Constructor, protoProps, staticProps) { if (protoProps) videotag_defineProperties(Constructor.prototype, protoProps); if (staticProps) videotag_defineProperties(Constructor, staticProps); return Constructor; }
function videotag_get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { videotag_get = Reflect.get; } else { videotag_get = function _get(target, property, receiver) { var base = videotag_superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return videotag_get(target, property, receiver || target); }
function videotag_superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = videotag_getPrototypeOf(object); if (object === null) break; } return object; }
function videotag_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) videotag_setPrototypeOf(subClass, superClass); }
function videotag_setPrototypeOf(o, p) { videotag_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return videotag_setPrototypeOf(o, p); }
function videotag_createSuper(Derived) { var hasNativeReflectConstruct = videotag_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = videotag_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = videotag_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return videotag_possibleConstructorReturn(this, result); }; }
function videotag_possibleConstructorReturn(self, call) { if (call && (videotag_typeof(call) === "object" || typeof call === "function")) { return call; } return videotag_assertThisInitialized(self); }
function videotag_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function videotag_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function videotag_getPrototypeOf(o) { videotag_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return videotag_getPrototypeOf(o); }
/**
* Video Tag
* Depends on 'tags/htmltag', 'util', 'cloudinary'
*/
var VIDEO_TAG_PARAMS = ['source_types', 'source_transformation', 'fallback_content', 'poster', 'sources'];
var videotag_DEFAULT_VIDEO_SOURCE_TYPES = ['webm', 'mp4', 'ogv'];
var videotag_DEFAULT_POSTER_OPTIONS = {
format: 'jpg',
resource_type: 'video'
};
/**
* Creates an HTML (DOM) Video tag using Cloudinary as the source.
* @constructor VideoTag
* @extends HtmlTag
* @param {string} [publicId]
* @param {Object} [options]
*/
var videotag_VideoTag = /*#__PURE__*/function (_HtmlTag) {
videotag_inherits(VideoTag, _HtmlTag);
var _super = videotag_createSuper(VideoTag);
function VideoTag(publicId) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
videotag_classCallCheck(this, VideoTag);
options = defaults({}, options, DEFAULT_VIDEO_PARAMS);
return _super.call(this, "video", publicId.replace(/\.(mp4|ogv|webm)$/, ''), options);
}
/**
* Set the transformation to apply on each source
* @function VideoTag#setSourceTransformation
* @param {Object} an object with pairs of source type and source transformation
* @returns {VideoTag} Returns this instance for chaining purposes.
*/
videotag_createClass(VideoTag, [{
key: "setSourceTransformation",
value: function setSourceTransformation(value) {
this.transformation().sourceTransformation(value);
return this;
}
/**
* Set the source types to include in the video tag
* @function VideoTag#setSourceTypes
* @param {Array