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,EAAYC,GAEvB,OADWW,EAAQZ,GAAcS,EAAWE,GAChCX,EAAYU,EAAaT,EAAU,GACjD,C,kBClDA,IAAIY,EAAYjB,EAAQ,OAqBxBE,EAAOC,QALP,SAAcO,GACZ,IAAIhB,EAAkB,MAATgB,EAAgB,EAAIA,EAAMhB,OACvC,OAAOA,EAASuB,EAAUP,EAAO,EAAGhB,GAAU,EAChD,C","sources":["webpack://cms-web/./app/frontend/src/blocks/masonry_gallery/masonry_gallery.analytics.js","webpack://cms-web/./app/frontend/src/blocks/masonry_gallery/masonry_gallery.js","webpack://cms-web/./node_modules/lodash/_baseMap.js","webpack://cms-web/./node_modules/lodash/_baseSlice.js","webpack://cms-web/./node_modules/lodash/first.js","webpack://cms-web/./node_modules/lodash/head.js","webpack://cms-web/./node_modules/lodash/map.js","webpack://cms-web/./node_modules/lodash/tail.js"],"sourcesContent":["import { sendUtagEvent } from '../../core/analytics/utag_events'\n\nexport function initializeUtagEvents() {\n document.querySelectorAll('.js-masonry-gallery .utag-info-photos').forEach(element => {\n const isFhiPage = document.querySelector('html').dataset.fhiTest !== undefined\n const fhiPageType = document.querySelector('html').dataset.fhiTest\n\n element.addEventListener('click', () => {\n const data = {\n event_name: 'hotel_multimedia',\n event_cat: 'hotel information',\n event_act: 'see photos and videos',\n event_lbl: 'body',\n event_purpose: 'inspiration',\n event_structure: 'body',\n }\n\n if (!isFhiPage) {\n sendUtagEvent({ data: { ...data } })\n } else {\n sendUtagEvent({ data: { ...data, page_variation: fhiPageType } })\n }\n })\n })\n}\n","import _filter from 'lodash/filter'\nimport _first from 'lodash/first'\nimport _map from 'lodash/map'\nimport _tail from 'lodash/tail'\n\nimport { initializeUtagEvents } from './masonry_gallery.analytics'\n\nexport function init() {\n const $block = $('.js-masonry-gallery')\n\n initializeUtagEvents()\n\n const MAX_VISIBLE_ITEMS = IB.currentDevice === 'mobile' ? 1 : 3\n const MODE_CLASSES = 'full double triple quadruple'\n const FULL_MODE_CLASS = 'full'\n\n const CURRENT_DEVICE = IB.currentDevice === 'tablet' || IB.currentDevice === 'desktop' ? 'desktop' : 'mobile'\n\n // Ejemplo de controlPresence. Determina qué tipo de contenido mostrar en qué dispositivo\n // {\n // \"mobile\": {\"images\":true, \"videos\":true, \"virtual_tours\":false, \"webcam\":false},\n // \"desktop\": {\"images\":true, \"videos\":false, \"virtual_tours\":false, \"webcam\":true}\n // }\n const controlPresence = $block.data().presenceControl\n const $masonryWrapper = $block.find('.masonry-wrapper')\n const $newLeftBlock = $('')\n const $newRightBlock = $('')\n const masonryModes = {\n 1: 'double',\n 2: 'triple',\n 3: 'quadruple',\n }\n // Determinamos cuales son los elementos visibles\n let visibleItems = _filter($block.find('.block'), function (item) {\n return controlPresence[CURRENT_DEVICE][$(item).data().contentType]\n })\n const show_tours = $block.data('show-tours')\n\n if (!show_tours) {\n visibleItems = visibleItems.filter(item => {\n const tag = item.querySelector(\"[data-gallery-tag-id='tours']\")\n return !tag\n })\n }\n\n // Construimos el nuevo masonry solo con los elementos visibles\n $newLeftBlock.append(fixMasonryImageRatio(_first(visibleItems)))\n const rightElements = _map(_tail(visibleItems), function (item, index) {\n index <= MAX_VISIBLE_ITEMS ? $(item).removeClass('hidden') : $(item).addClass('hidden')\n return item\n })\n if (rightElements.length == 1) fixMasonryImageRatio(rightElements)\n $newRightBlock.append(rightElements)\n // Sustituimos el masonry viejo por el nuevo\n $masonryWrapper.removeClass(MODE_CLASSES).addClass(masonryModes[rightElements.length] || FULL_MODE_CLASS)\n $masonryWrapper.html('').append($newLeftBlock).append($newRightBlock)\n}\n\nfunction fixMasonryImageRatio(element) {\n const $el = $(element)\n const $source = $el.find('source')\n if ($source.length && $source.data('srcset') !== undefined) {\n $source.data('srcset', $source.data().srcset.replace('2:1', '1:1'))\n }\n return element\n}\n","var baseEach = require('./_baseEach'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n","/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nmodule.exports = baseSlice;\n","module.exports = require('./head');\n","/**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\nfunction head(array) {\n return (array && array.length) ? array[0] : undefined;\n}\n\nmodule.exports = head;\n","var arrayMap = require('./_arrayMap'),\n baseIteratee = require('./_baseIteratee'),\n baseMap = require('./_baseMap'),\n isArray = require('./isArray');\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, baseIteratee(iteratee, 3));\n}\n\nmodule.exports = map;\n","var baseSlice = require('./_baseSlice');\n\n/**\n * Gets all but the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.tail([1, 2, 3]);\n * // => [2, 3]\n */\nfunction tail(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 1, length) : [];\n}\n\nmodule.exports = tail;\n"],"names":["initializeUtagEvents","document","querySelectorAll","forEach","element","isFhiPage","undefined","querySelector","dataset","fhiTest","fhiPageType","addEventListener","data","event_name","event_cat","event_act","event_lbl","event_purpose","event_structure","sendUtagEvent","page_variation","init","$block","$","MAX_VISIBLE_ITEMS","IB","currentDevice","CURRENT_DEVICE","controlPresence","presenceControl","$masonryWrapper","find","$newLeftBlock","$newRightBlock","visibleItems","_filter","item","contentType","filter","append","fixMasonryImageRatio","_first","rightElements","_map","_tail","index","removeClass","addClass","length","html","$source","srcset","replace","baseEach","require","isArrayLike","module","exports","collection","iteratee","result","Array","value","key","array","start","end","arrayMap","baseIteratee","baseMap","isArray","baseSlice"],"sourceRoot":""}