1"use strict";(globalThis.webpackChunkaem_maven_archetype||=[]).push([[33505,36310,39568,43497,62035],{36310(e,t,r){r.r(t);var i=r(43497),s=r(62035),a=r(33505),o=r(39568),n=r(57314);let l={searchService:null,filterService:null,lastSearchesService:null,renderService:null,uiService:null,props:{cssSelector:".c-fastbooking-lite",dynamicClass:".c-fastbooking-lite.dynamicLoading",wrapper:".fb-lite-wrapper-JS",viewports:{desktop:1024},modifiers:{mainFbLiteOpen:"mod--fastbookingLite-open",fullMode:"mod--full-mode",liteMode:"mod--lite-mode",open:"mod--open",show:"mod--show",hide:"mod--hide",active:"mod--active",selectLite:"mod--select-lite",destinationInput:"mod--destination",destination:"mod--destinationModal",assistant:"mod--assistantsModal",structuralNode:"is-structural-node",assistantSelect:"mod--assistantsSelect",eventTypeSelect:"mod--eventTypesSelect",activeFastbookingLite:"mod--activeFastbookingLite",levels:{first:"mod--firstLevel",second:"mod--secondLevel",third:"mod--thirdLevel",fourth:"mod--fourthLevel"},blocks:{firstBlock:"mod--firstBlock",secondBlock:"mod--secondBlock"},filter:"mod--filter",highlight:{lightBlue:"mod--background-light-blue",grey:"mod--background-grey"},textStyle:{light:"mod--light"}},btns:{goBack:".fb-lite-back-JS",closeSearch:".fb-lite-closeSearch-JS",submit:".fb-lite-submit-JS"},form:{group:".fb-lite-groupForm-JS",inputDestination:".fb-lite-destinations-JS",selects:".fb-lite-select-JS",selectsValue:".fb-lite-selectsValue-JS"},accordions:{header:".fb-lite-modalHeader-JS",label:".fb-lite-modalContentItem-JS",title:".fb-lite-modalContentTitle-JS",text:".fb-lite-modalText-JS"},modals:{modals:".fb-lite-modal-JS",options:".fb-lite-modalOptions-JS",destinations:{default:".fb-lite-modalDefault-JS",empty:".fb-lite-modalEmpty-JS",emptyResult:".fb-lite-modalEmptyDest-JS",headerText:".fb-lite-modalHeaderText-JS"},blocks:".fb-lite-modalBlocks-JS"},icons:{accordionArrow:` 2 <div class="svg-icon accordion-arrow"> 3 <span class="cmp-icon" data-cmp-src="/content/dam/barcelo/commons/icons/ui/arrow_blue.svg"> 4 <img loading="lazy" width="49" height="49" alt="" class="c-icon" src="/content/dam/barcelo/commons/icons/ui/arrow_blue.svg"> 5 </span> 6 </div> 7 `},searchData:{},fuse:null,sourceTree:[],searchIndex:null,filteredTree:[],visibleDestinationIds:[],visibleHotelIds:[],lastSearchResult:null,loadingSearchDataPromise:null,selectedDestinationId:null,selectedMeetingPath:null,meetingDetailsByPath:{},meetingDetailsRequestsByPath:{},staticMeetingOptions:null,lastSearches:{storageKey:"barcelo_fastbooking_lite_last_searches",ttlMs:2592e6,maxItems:3,items:[],panel:".fb-lite-recentSearchesPanel-JS",list:".fb-lite-recentSearchesList-JS",showDestinationsBtn:".fb-lite-showDestinations-JS",destinationTree:".fb-lite-destinationTree-JS",firstBlockHeaderText:".fb-lite-modalHeaderText-JS",forceDestinationsDataAttr:"fbLiteShowAllDestinations"}},getSearchService:function(){return this.searchService||(this.searchService=(0,i.default)(this)),this.searchService},getFilterService:function(){return this.filterService||(this.filterService=(0,s.default)(this)),this.filterService},getRenderService:function(){return this.renderService||(this.renderService=(0,o.default)(this)),this.renderService},getLastSearchesService:function(){return this.lastSearchesService||(this.lastSearchesService=(0,a.default)(this)),this.lastSearchesService},getUiService:function(){return this.uiService||(this.uiService=(0,n.default)(this)),this.uiService},initializeServices:function(){this.getSearchService(),this.getFilterService(),this.getRenderService(),this.getLastSearchesService(),this.getUiService()},loadStylesheet:function(){bcl.u.loadStyleSheet("/etc.clientlibs/barcelo/clientlibs/clientlib-fastbookingLite.css",this.props.dynamicClass)},getFastbookingItems:function(){return Array.from(document.querySelectorAll(this.props.cssSelector))},setupBreadcrumb:function(){let e=document.querySelector("nav.cmp-breadcrumb");e&&e.classList.add("mod--fastbookingLite")},initFastbookingItem:function(e){this.changeDestinationStructureOnMobile(e),this.manageFastbookingFields(e),this.manageDestinationPopover(e),this.submitInfo(e),this.setAccessibilityByKeyboardOnLitemode(e,window.innerWidth<this.props.viewports.desktop)}
7,onWindowResize:function(e){e.forEach(e=>{this.changeDestinationStructureOnMobile(e),this.setPopoversPosition(e),this.setAccessibilityByKeyboardOnLitemode(e,window.innerWidth<this.props.viewports.desktop);let t=e.querySelector(this.props.form.inputDestination);this.updateRecentSearchesView(e,t?.value||""),window.innerWidth>=this.props.viewports.desktop&&e.classList.remove(this.props.modifiers.open)})},registerResizeHandler:function(e){window.addEventListener("resize",()=>{this.onWindowResize(e)})},init:function(){this.initializeServices(),this.loadStylesheet();let e=this.getFastbookingItems();e.length&&(this.setupBreadcrumb(),e.forEach(e=>this.initFastbookingItem(e)),this.registerResizeHandler(e))},setAccessibilityByKeyboardOnLitemode:function(e,t){return this.getUiService().setAccessibilityByKeyboardOnLitemode(e,t)},manageFastbookingFields:function(e){return this.getUiService().manageFastbookingFields(e)},manageDestinationPopover:function(e){return this.getUiService().manageDestinationPopover(e)},printMatchingOccurences:function(e,t,r=!1){return this.getUiService().printMatchingOccurrences(e,t,r)},toggleActiveElem:function(e){return this.getUiService().toggleActiveElem(e)},setIconsOnMobile:function(e,t=!1){return this.getUiService().setIconsOnMobile(e,t)},filterDestinationInput:function(e,t){return this.getFilterService().filterDestinationInput(e,t)},changeDestinationStructureOnMobile:function(e,t=null,r=!1){return this.getUiService().changeDestinationStructureOnMobile(e,t,r)},setPopoversPosition:function(e,t=null){return this.getUiService().setPopoversPosition(e,t)},getHotelNodeId:function(e,t,r){return this.getRenderService().getHotelNodeId(e,t,r)},getRootListFromBlock:function(e){return this.getRenderService().getRootListFromBlock(e)},getLevelClassByDepth:function(e){return this.getRenderService().getLevelClassByDepth(e)},countHotelsInSubtree:function(e){return this.getRenderService().countHotelsInSubtree(e)},createArrowIconElement:function(e){return this.getRenderService().createArrowIconElement(e)},renderDestinationTreeNode:function(e,t,r){return this.getRenderService().renderDestinationTreeNode(e,t,r)},createAllHotelsListItem:function(e,t){return this.getRenderService().createAllHotelsListItem(e,t)},flattenHotelsForRender:function(e){return this.getRenderService().flattenHotelsForRender(e)},createHotelListItem:function(e,t=""){return this.getRenderService().createHotelListItem(e,t)},renderHotelsListFromTree:function(e,t){return this.getRenderService().renderHotelsListFromTree(e,t)},renderTreeFromSearchData:function(e){return this.getRenderService().renderTreeFromSearchData(e)},getStoredSearches:function(){return this.getLastSearchesService().getStoredSearches()},saveCurrentSearch:function(e){return this.getLastSearchesService().saveCurrentSearch(e)},renderRecentSearches:function(e){return this.getLastSearchesService().renderRecentSearches(e)},applyRecentSearch:function(e,t){return this.getLastSearchesService().applyRecentSearch(e,t)},updateRecentSearchesView:function(e,t=""){return this.getLastSearchesService().updateRecentSearchesView(e,t)},showAllDestinationsFromRecent:function(e){return this.getLastSearchesService().showAllDestinationsFromRecent(e)},resetRecentSearchesMode:function(e){return this.getLastSearchesService().resetRecentSearchesMode(e)},ensureSearchDataLoaded:function(e){return this.getSearchService().ensureSearchDataLoaded(e)},flattenSearchData:function(e){return this.getSearchService().flattenSearchData(e)},buildSearchIndex:function(e){return this.getSearchService().buildSearchIndex(e)},computeVisibleIds:function(e){return this.getSearchService().computeVisibleIds(e)},buildScoreIndex:function(e,t){return this.getSearchService().buildScoreIndex(e,t)},sortByScore:function(e,t){return this.getSearchService().sortByScore(e,t)},buildFilteredTree:function(e,t,r){return this.getSearchService().buildFilteredTree(e,t,r)},stripSearchMetadata:function(e){return this.getSearchService().stripSearchMetadata(e)},escapeHtml:function(e){return this.getSearchService().escapeHtml(e)}
7,highlightTextByMatches:function(e,t,r){return this.getSearchService().highlightTextByMatches(e,t,r)},applyHotelsVisibility:function(e,t=null){return this.getFilterService().applyHotelsVisibility(e,t)},resetDestinationTreeState:function(e){return this.getFilterService().resetDestinationTreeState(e)},getAncestorDestinationIds:function(e){return this.getFilterService().getAncestorDestinationIds(e)},showSelectedDestinationTree:function(e,t){return this.getFilterService().showSelectedDestinationTree(e,t)},expandPathToDestinationNode:function(e){return this.getFilterService().expandPathToDestinationNode(e)},clearDestinationSearch:function(e,t){return this.getFilterService().clearDestinationSearch(e,t)},applySearchResultToDomByIds:function(e,t,r){return this.getFilterService().applySearchResultToDomByIds(e,t,r)},initFuseSearch:function(){return this.getSearchService().initFuseSearch()},doSearch:function(e){return this.getSearchService().doSearch(e)},fetchSearchData:async function(e){return this.getSearchService().fetchSearchData(e)},fetchMeetingDetails:async function(e,t,r=[]){return this.getSearchService().fetchMeetingDetails(e,t,r)},submitInfo:function(e){return this.getUiService().submitInfo(e)}};r.d(t,["default",0,l])},43497(e,t,r){r.r(t);var i=r(85953);let s=e=>String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim(),a=e=>String(e||"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),o=(e=[])=>e.length?[...e].sort((e,t)=>e[0]-t[0]).reduce((e,t)=>{if(!e.length)return[t];let r=e.at(-1);return t[0]<=r[1]+1?r[1]=Math.max(r[1],t[1]):e.push(t),e},[]):[],n=e=>{let t={normalizeForSearch:s,escapeHtml:a,buildFuseKeysWithNormalizedVariants(e=[]){let t=[],r=new Set;return e.forEach(e=>{let i="object"==typeof e&&null!==e,s=i?e.name:e;if(!(!s||r.has(s))&&(t.push(e),r.add(s),!s.endsWith("Normalized"))){let a=`${s}Normalized`;r.has(a)||(t.push(i?{...e,name:a}:a),r.add(a))}}),t},getSearchTokens(e){let t=s(e);return t?[...new Set(t.split(/\s+/).filter(e=>e.length>=3&&e!==t))]:[]},collectMatchIndices(e,t){let r=t?.key;if(!r)return;let i=e.get(r)||[];e.set(r,i.concat(t.indices||[]))},toMergedMatchEntry:(e,t=[])=>({key:e,indices:o(t.filter(e=>e?.length===2))}),mergeMatches(e=[],r=[]){let i=[...e,...r];if(!i.length)return[];let s=new Map;return i.forEach(e=>{t.collectMatchIndices(s,e)}),Array.from(s.entries()).map(([e,r])=>t.toMergedMatchEntry(e,r))},mergeSearchResults(e=[],r=[]){let i=[],s=new Map;return e.forEach((e,t)=>{e?.item?._id&&(i.push({...e,_sortIndex:t,_isPrimary:!0}),s.set(e.item._id,i.length-1))}),r.forEach((r,a)=>{let o=r?.item?._id;if(!o)return;let n=r?._tokenOrder??0,l=(r?.score??1/0)+.35+.15*n,c=s.get(o);if(void 0===c){i.push({...r,score:l,_sortIndex:e.length+a,_isPrimary:!1}),s.set(o,i.length-1);return}let d=i[c];d.matches=t.mergeMatches(d.matches,r.matches),!d._isPrimary&&l<d.score&&(d.score=l,d._sortIndex=Math.min(d._sortIndex,e.length+a))}),i.sort((e,t)=>{if(e._isPrimary!==t._isPrimary)return e._isPrimary?-1:1;let r=e.score??1/0,i=t.score??1/0;return r!==i?r-i:e._sortIndex-t._sortIndex})},ensureSearchDataLoaded:r=>e.props.sourceTree?.length?Promise.resolve(e.props.searchData):(e.props.loadingSearchDataPromise||(e.props.loadingSearchDataPromise=t.fetchSearchData(r).finally(()=>{e.props.loadingSearchDataPromise=null}
7)),e.props.loadingSearchDataPromise),normalizeMeetingDetails(e={}){let t=e=>{if(!Array.isArray(e))return[];let t=new Set;return e.forEach(e=>{let r=String(e||"").trim();r&&t.add(r)}),Array.from(t).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:"base"}))};return{eventTypes:t(e?.eventTypes),capacities:t(e?.capacities)}},normalizeMeetingEventTypesHint(e){let t=Array.isArray(e)?e:String(e||"").split(","),r=new Set;return t.forEach(e=>{let t=String(e||"").trim();t&&r.add(t)}),Array.from(r).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:"base"}))},mergeMeetingDetailsWithHint(e,r=[]){let i=t.normalizeMeetingDetails(e),s=t.normalizeMeetingEventTypesHint(r);return s.length?{...i,eventTypes:s}:i},buildMeetingDetailsUrl(e,r,i=[]){let s=new URLSearchParams({meetingPath:r}),a=t.normalizeMeetingEventTypesHint(i);return a.length&&s.set("eventTypes",a.join(",")),`${e}?${s.toString()}`},resolveLoaderContainer:e=>e?e.querySelector(".fb-lite-modal-JS.mod--destinationModal")||e:null,canToggleBhgLoader:()=>"u">typeof bcl&&bcl.u&&"function"==typeof bcl.u.addBhgLoading&&"function"==typeof bcl.u.removeBhgLoading,setBhgLoaderState(e,r){if(e&&t.canToggleBhgLoader()){if(r)return void bcl.u.addBhgLoading(e);bcl.u.removeBhgLoading(e)}},createTimedAjaxRequestPromise:({requestUrl:e,timeoutMs:t=1e4,timeoutErrorMessage:r="Timeout: La petición tardó demasiado o falló silenciosamente.",emptyResponseErrorMessage:i="Empty response",onEmptyResponse:s,transformPayload:a})=>new Promise((o,n)=>{let l=setTimeout(()=>{n(Error(r))},t);bcl.ajax.getRequest(null,e,e=>{clearTimeout(l);try{let t=e?.status;if(Number.isFinite(t)&&(t<200||t>=400))return n(Error(`HTTP error: ${t}`));let r=e?.response??e?.responseText;if(!r){if("function"==typeof s)return o(s());return n(Error(i))}let l="string"==typeof r?JSON.parse(r):r;o("function"==typeof a?a(l):l)}catch(e){n(e)}},null,!1,(e,t)=>{clearTimeout(l),n(Error(`HTTP error: ${t?.status||"unknown"}`))})}),getCachedMeetingDetails:(r,i)=>e.props.meetingDetailsByPath?.[r]?t.mergeMeetingDetailsWithHint(e.props.meetingDetailsByPath[r],i):null,getInFlightMeetingDetails:(r,i)=>e.props.meetingDetailsRequestsByPath?.[r]?e.props.meetingDetailsRequestsByPath[r].then(s=>{let a=t.mergeMeetingDetailsWithHint(s,i);return i.length&&(e.props.meetingDetailsByPath[r]=a),a}):null,createMeetingDetailsRequestPromise:e=>t.createTimedAjaxRequestPromise({requestUrl:e,timeoutMs:1e4,timeoutErrorMessage:"Timeout: room-details no respondió a tiempo.",onEmptyResponse:()=>t.normalizeMeetingDetails(),transformPayload:e=>t.normalizeMeetingDetails(e)}),async fetchMeetingDetails(r,i,s=[]){let a=String(i||"").trim(),o=t.normalizeMeetingEventTypesHint(s),n=r?.dataset?.meetingdetail;if(!n||!a)return null;let l=t.getCachedMeetingDetails(a,o);if(l)return l;let c=t.getInFlightMeetingDetails(a,o);if(c)return c;let d=t.buildMeetingDetailsUrl(n,a,o),h=t.resolveLoaderContainer(r);t.setBhgLoaderState(h,!0);let u=t.createMeetingDetailsRequestPromise(d);e.props.meetingDetailsRequestsByPath[a]=u;try{let r=await u,i=t.mergeMeetingDetailsWithHint(r,o);return e.props.meetingDetailsByPath[a]=i,i}catch(e){return console.error("Error fetching meeting details:",e),null}finally{delete e.props.meetingDetailsRequestsByPath[a],t.setBhgLoaderState(h,!1)}},flattenSearchData(t=[]){let r=[],i=(t,a="",o=[])=>{if(!t?.id)return;r.push({id:t.id,i18nTitle:t.i18nTitle,i18nTitleNormalized:s(t.i18nTitle),path:t.path,pathNormalized:s(t.path),levelType:t.levelType,parentId:a,ancestors:o,_id:t.id,_kind:"destination"});let n=[...o,t.id];(t.hotels||[]).forEach((i,a)=>{r.push({...i,hotelNameNormalized:s(i?.hotelName),pathNormalized:s(i?.path),parentId:t.id,ancestors:n,_id:e.getHotelNodeId(i,t.id,a),_kind:"hotel",levelType:"Hotel"})}),(t.subDestinations||[]).forEach(e=>i(e,t.id,n))};return t.forEach(e=>i(e)),r},buildSearchIndex(t=[]){let r={hotelIdsByParent:{},subtreeDestinationIdsByParent:{},subtreeHotelIdsByParent:{},parentByDestinationId:{}},i=(t,s=null)=>{if(!t?.id)return{allDestinationIds:[],allHotelIds:[]};s&&(r.parentByDestinationId[t.id]=s);let a=(t.hotels||[]).map((r,i)=>e.getHotelNodeId(r,t.id,i));r.hotelIdsByParent[t.id]=a;let o=[t.id],n=[...a];
7return(t.subDestinations||[]).forEach(e=>{let{allDestinationIds:r,allHotelIds:s}=i(e,t.id);o.push(...r),n.push(...s)}),r.subtreeDestinationIdsByParent[t.id]=o.filter(e=>e!==t.id),r.subtreeHotelIdsByParent[t.id]=n,{allDestinationIds:o,allHotelIds:n}};return t.forEach(e=>i(e)),r},computeVisibleIds(t=[]){let r=new Set,i=new Set,s=new Set,{searchIndex:a}=e.props;return t.forEach(({item:e})=>{e&&("hotel"===e._kind?(i.add(e._id),e.parentId&&(s.add(e.parentId),r.add(e.parentId))):(r.add(e._id),a?.subtreeDestinationIdsByParent?.[e._id]?.forEach(e=>r.add(e)),a?.subtreeHotelIdsByParent?.[e._id]?.forEach(e=>i.add(e))),e.ancestors?.forEach(e=>e&&r.add(e)))}),s.forEach(e=>{a?.hotelIdsByParent?.[e]?.forEach(e=>i.add(e))}),{visibleDestinationIds:r,visibleHotelIds:i}},buildScoreIndex(e,t){let r=Array.isArray(e)?e:[],i={},s={};return r.forEach(({item:e,score:t})=>{let r=t??1/0,a="hotel"===e._kind?s:i;e._id in a&&!(r<a[e._id])||(a[e._id]=r)}),{destinationScores:i,hotelScores:s,hasSearchTerm:!!t}},sortByScore:(e,t)=>e.map((e,r)=>({item:e,index:r,score:t(e)??1/0})).sort((e,t)=>e.score===t.score?e.index-t.index:e.score-t.score).map(({item:e})=>e),buildFilteredHotelsForNode:(t,r,i,s)=>(t.hotels||[]).map((a,o)=>{let n=e.getHotelNodeId(a,t.id,o);return r&&!i.visibleHotelIds.has(n)?null:{...a,_searchScore:s[n]??null}}).filter(Boolean),shouldSkipDestinationNode:({nodeId:e,hasSearchTerm:t,visibleState:r,subDestinations:i,hotels:s})=>t&&!r.visibleDestinationIds.has(e)&&!i.length&&!s.length,getBestScoreInCollection:(e,t)=>e.reduce((e,r)=>Math.min(e,r[t]??1/0),1/0),resolveDestinationNodeScore({nodeId:e,destinationScores:r,subDestinations:i,hotels:s}){let a=t.getBestScoreInCollection(i,"_resolvedScore"),o=t.getBestScoreInCollection(s,"_searchScore"),n=[r[e],a,o].filter(Number.isFinite);return n.length?Math.min(...n):null}
7,cloneDestinationForFilteredTree({node:e,hasSearchTerm:r,visibleState:i,hotelScores:s,destinationScores:a}){if(!e?.id)return null;let o=(e.subDestinations||[]).map(e=>t.cloneDestinationForFilteredTree({node:e,hasSearchTerm:r,visibleState:i,hotelScores:s,destinationScores:a})).filter(Boolean),n=t.buildFilteredHotelsForNode(e,r,i,s);return t.shouldSkipDestinationNode({nodeId:e.id,hasSearchTerm:r,visibleState:i,subDestinations:o,hotels:n})?null:{...e,subDestinations:t.sortByScore(o,e=>e._resolvedScore),hotels:t.sortByScore(n,e=>e._searchScore),_resolvedScore:t.resolveDestinationNodeScore({nodeId:e.id,destinationScores:a,subDestinations:o,hotels:n})}},buildFilteredTree(e,r,i){let s=Array.isArray(e)?e:[],{hasSearchTerm:a,hotelScores:o,destinationScores:n}=i;return t.sortByScore(s.map(e=>t.cloneDestinationForFilteredTree({node:e,hasSearchTerm:a,visibleState:r,hotelScores:o,destinationScores:n})).filter(Boolean),e=>e._resolvedScore).map(t.stripSearchMetadata)},stripSearchMetadata(e){if(!e)return null;let{...r}=e;return r.hotels=(r.hotels||[]).map(({...e})=>e),r.subDestinations=(r.subDestinations||[]).map(t.stripSearchMetadata),r},highlightTextByMatches(e,t,r){let i=String(e||""),s=Array.isArray(t)?t:[];if(!s.length)return a(i);let n=r?new Set([r,`${r}Normalized`]):null,l=o(s.filter(e=>!n||n.has(e.key)).flatMap(e=>e.indices||[]));if(!l.length)return a(i);let c=0,d="";return l.forEach(([e,t])=>{if(t<c)return;let r=Math.max(e,c);r>c&&(d+=a(i.slice(c,r))),d+=`<strong>${a(i.slice(r,t+1))}</strong>`,c=t+1}),c<i.length&&(d+=a(i.slice(c))),d},initFuseSearch(){let{data:r,metadata:s}=e.props.searchData||{};if(!r||!s?.searchConfig?.keys)return;e.props.sourceTree=r,e.props.searchIndex=t.buildSearchIndex(r);let a={threshold:s.searchConfig.threshold??.3,keys:t.buildFuseKeysWithNormalizedVariants(s.searchConfig.keys),includeScore:!0,includeMatches:!0};e.props.fuse=new i.a(t.flattenSearchData(r),a)},getEmptySearchResult:e=>({results:[],tree:e,visibleDestinationIds:[],visibleHotelIds:[]}),buildTokenSearchResults:(e,r)=>t.getSearchTokens(r).flatMap((t,r)=>e.search(t).map(e=>({...e,_tokenOrder:r}))),buildFuseSearchResults(e,r){let i=e.search(r),s=t.buildTokenSearchResults(e,r);return t.mergeSearchResults(i,s)},mapSearchResultWithHighlight(e){let r="hotel"===e.item._kind,i=r?e.item.hotelName:e.item.i18nTitle;return{...e,item:{...e.item,highlightedLabel:t.highlightTextByMatches(i,e.matches,r?"hotelName":"i18nTitle")}}},buildSearchResponse({fuseResults:e,sourceTree:r,rawQuery:i}){let s=t.computeVisibleIds(e),a=t.buildScoreIndex(e,i);return{results:e.map(e=>t.mapSearchResultWithHighlight(e)),tree:t.buildFilteredTree(r,s,a),visibleDestinationIds:[...s.visibleDestinationIds],visibleHotelIds:[...s.visibleHotelIds]}},canUseClientStorage(){try{return void 0!==globalThis.localStorage}catch{return!1}},getSearchDataCacheKey(){let e=document.documentElement.lang||"global";return`fb-lite:search-data:v1:store:${e.toLowerCase()}`},isSearchDataPayloadValid:e=>!!(e&&"object"==typeof e&&Array.isArray(e.data)),readSearchDataFromClientCache(){if(!t.canUseClientStorage())return null;let e=t.getSearchDataCacheKey();try{let r=globalThis.localStorage.getItem(e);if(!r)return null;let i=JSON.parse(r),s=Number(i?.cachedAt||0),a=i?.payload;if(!Number.isFinite(s)||Date.now()-s>18e5||!t.isSearchDataPayloadValid(a))return globalThis.localStorage.removeItem(e),null;return a}catch{try{globalThis.localStorage.removeItem(e)}catch{}return null}},writeSearchDataToClientCache(e){if(!t.canUseClientStorage()||!t.isSearchDataPayloadValid(e))return;let r=t.getSearchDataCacheKey();try{let t={cachedAt:Date.now(),payload:e};globalThis.localStorage.setItem(r,JSON.stringify(t))}catch{}},hydrateSearchStateFromPayload(t){let r=Array.isArray(t.data)?t.data:[];Object.assign(e.props,{searchData:t,sourceTree:r,filteredTree:r,selectedDestinationId:null})},initializeSearchUiFromState(r){t.initFuseSearch(),e.renderTreeFromSearchData(r),e.manageDestinationPopover(r)},doSearch(r){let i=r?.trim(),{fuse:a,sourceTree:o}=e.props;if(!a||!i)return t.getEmptySearchResult(o);let n=s(i);if(!n)return t.getEmptySearchResult(o);let l=t.buildFuseSearchResults(a,n);return t.buildSearchResponse({fuseResults:l,sourceTree:o,rawQuery:i})},async fetchSearchData(r){let i=r?.dataset?.path;if(!i)return null;let s=t.readSearchDataFromClientCache();if(s)return t.hydrateSearchStateFromPayload(s),t.initializeSearchUiFromState(r),e.props.searchData;let a=t.resolveLoaderContainer(r);t.setBhgLoaderState(a,!0);try{let s=await t.createTimedAjaxRequestPromise({requestUrl:i,timeoutMs:1e4,timeoutErrorMessage:"Timeout: La petición tardó demasiado o falló silenciosamente.",emptyResponseErrorMessage:"Empty search data response"});if(!s||"object"!=typeof s)throw Error("Search data payload is not an object");return t.hydrateSearchStateFromPayload(s),t.writeSearchDataToClientCache(s),t.initializeSearchUiFromState(r),e.props.searchData}catch(e){return console.error("Error fetching search data:",e),null}finally{t.setBhgLoaderState(a,!1)}}};return t};r.dn(n),r.d(t,["default",0,n])},62035(e,t,r){r.r(t);let i=e=>{let t={buildHotelScoreById(e){let t=new Map;
7return(e?.results||[]).forEach(({item:e,score:r})=>{if(e?._kind==="hotel"&&e._id){let i=Number.isFinite(r)?r:1/0;i<(t.get(e._id)??1/0)&&t.set(e._id,i)}}),t},getGroupBestScore:(e,t)=>e.reduce((e,r)=>Math.min(e,t.get(r)??1/0),1/0),extractHotelGroups(e){let t=[],r=[],i=Array.from(e.children),s=0;for(;s<i.length;){let e=i[s],a=e.dataset.hotelId;if(!a){t.push(e),s+=1;continue}if(e.classList.contains("mod--resortParent")){let t=[e],a=[],o=s+1;for(;o<i.length&&i[o].classList.contains("mod--resortChild");)t.push(i[o]),i[o].dataset.hotelId&&a.push(i[o].dataset.hotelId),o+=1;r.push({nodes:t,hotelIds:a,originalIndex:r.length}),s=o;continue}r.push({nodes:[e],hotelIds:[a],originalIndex:r.length}),s+=1}return{fixedNodes:t,groups:r}},reorderHotelsBySearchScore(r,i){if(!r)return;let s=r.querySelector(e.props.modals.destinations.default),a=e.getRootListFromBlock(s?.querySelector(`.${e.props.modifiers.blocks.secondBlock}`));if(!a)return;let{fixedNodes:o,groups:n}=t.extractHotelGroups(a);if(n.length<=1)return;let l=t.buildHotelScoreById(i);[...o,...[...n].sort((e,r)=>{let i=t.getGroupBestScore(e.hotelIds,l),s=t.getGroupBestScore(r.hotelIds,l);return i!==s?i-s:e.originalIndex-r.originalIndex}).flatMap(e=>e.nodes)].forEach(e=>{a.appendChild(e)})},isFilterMatch:(e,t)=>e.length<3||t.includes(e),isShortQuery:e=>""!==e&&e.length<3,setDefaultModalVisibility(t,r){t&&t.classList.add(e.props.modifiers.show),r&&r.classList.remove(e.props.modifiers.show)},setDefaultHeaders(e,t){e&&2===t.length&&(t[0].textContent=e.dataset.recommendedDestinations,t[1].textContent=e.dataset.recommendedHotels)},setFilteredHeaders(e,t){e&&2===t.length&&(t[0].textContent=e.dataset.destinations,t[1].textContent=e.dataset.hotels)},showAllResultState({accordion:r,destinationInputLowercase:i,defaultModal:s,modalHeaders:a,filteringByDest:o}){t.setDefaultHeaders(s,a),e.setIconsOnMobile(s),o?r.querySelector(`.${e.props.modifiers.highlight.grey}`)?.classList.remove(e.props.modifiers.highlight.grey):r.classList.remove(e.props.modifiers.highlight.lightBlue),e.printMatchingOccurences(r,i)},showFilteredState({accordion:r,destinationInputLowercase:i,defaultModal:s,modalHeaders:a,filteringByDest:o}){t.setFilteredHeaders(s,a),e.setIconsOnMobile(s,!0),o&&e.toggleActiveElem(r),e.printMatchingOccurences(r,i,!0)},showAccordionResult({accordion:t,parent:r,filteringByDest:i}){if(i){r&&r.classList.remove(e.props.modifiers.hide);return}t.classList.remove(e.props.modifiers.hide)},isLongEnoughQuery:e=>""!==e&&e.length>=3,resetAccordionForLongQuery(t,r){t.classList.remove(e.props.modifiers.highlight.lightBlue),t.closest(`.${e.props.modifiers.blocks.firstBlock}`)?(t.querySelector(`.${e.props.modifiers.highlight.grey}`)?.classList.remove(e.props.modifiers.highlight.grey),t.classList.contains(e.props.modifiers.levels.first)&&t.classList.add(e.props.modifiers.hide)):t.closest(`.${e.props.modifiers.blocks.secondBlock}`)&&t.classList.add(e.props.modifiers.hide),e.printMatchingOccurences(t,r)},prepareLongQueryState({query:r,accordions:i,defaultModal:s,modalHeaders:a,emptyModal:o,emptyResult:n}){s&&s.classList.remove(e.props.modifiers.show),o&&o.classList.add(e.props.modifiers.show),s&&2===a.length&&(a[0].textContent=s.dataset.recommendedDestinations,a[1].textContent=s.dataset.recommendedHotels,e.setIconsOnMobile(s)),n&&(n.textContent=`"${r}"`),i.forEach(e=>{t.resetAccordionForLongQuery(e,r)})},getAccordionComparableText(t){let r=t.querySelector(e.props.accordions.text);return r?{text:r.textContent.trim().toLowerCase(),filteringByDest:!0}:{text:t.textContent.trim().toLowerCase(),filteringByDest:!1}},applyFilteredResult({accordion:r,destinationInputLowercase:i,text:s,defaultModal:a,emptyModal:o,emptyResult:n,modalHeaders:l,filteringByDest:c=!1}){if(!t.isFilterMatch(i,s))return;let d=r.closest(`ul.${e.props.modifiers.levels.first} > ${e.props.accordions.label}`);if(t.setDefaultModalVisibility(a,o),""===i||t.isShortQuery(i)){t.showAllResultState({accordion:r,destinationInputLowercase:i,defaultModal:a,modalHeaders:l,filteringByDest:c}),n&&(n.textContent=""),t.showAccordionResult({accordion:r,parent:d,filteringByDest:c}
7);return}t.showFilteredState({accordion:r,destinationInputLowercase:i,defaultModal:a,modalHeaders:l,filteringByDest:c}),n&&(n.textContent=""),t.showAccordionResult({accordion:r,parent:d,filteringByDest:c})},filterDestinationInput(r,i){if(!r||!i)return;let s=Array.from(r.querySelectorAll(e.props.accordions.label));if(!s.length)return;let a=i.value.toLowerCase(),o=r.querySelector(e.props.modals.destinations.default),n=Array.from(o?.querySelectorAll(e.props.modals.destinations.headerText)||[]),l=r.querySelector(e.props.modals.destinations.empty),c=l?.querySelector(e.props.modals.destinations.emptyResult);t.isLongEnoughQuery(a)&&t.prepareLongQueryState({query:a,accordions:s,defaultModal:o,modalHeaders:n,emptyModal:l,emptyResult:c}),s.forEach(e=>{let{text:r,filteringByDest:i}=t.getAccordionComparableText(e);t.applyFilteredResult({accordion:e,destinationInputLowercase:a,text:r,defaultModal:o,emptyModal:l,emptyResult:c,modalHeaders:n,filteringByDest:i})})},applyHotelsVisibility(t,r=null){if(!t)return;let i=e.getRootListFromBlock(t.querySelector(e.props.modals.destinations.default)?.querySelector(`.${e.props.modifiers.blocks.secondBlock}`));if(!i)return;let s=e.props.selectedDestinationId?new Set(e.props.searchIndex?.subtreeHotelIdsByParent?.[e.props.selectedDestinationId]||[]):null,a=r?new Set(r):null,o=Array.from(i.querySelectorAll(`${e.props.accordions.label}[data-hotel-id]`));o.forEach(t=>{if(t.classList.contains("mod--resortParent"))return void t.classList.add(e.props.modifiers.hide);let r=t.dataset.hotelId,i=(!a||a.has(r))&&(!s||s.has(r));t.classList.toggle(e.props.modifiers.hide,!i)}),o.forEach((t,r)=>{if(!t.classList.contains("mod--resortParent"))return;let i=!1;for(let t=r+1;t<o.length&&o[t].classList.contains("mod--resortChild");t++)if(!o[t].classList.contains(e.props.modifiers.hide)){i=!0;break}t.classList.toggle(e.props.modifiers.hide,!i)})},resetDestinationTreeState(t){if(!t)return;let r=t=>{t&&(t.classList.remove(e.props.modifiers.textStyle.light),t.textContent=t.dataset.text||t.textContent||"")};t.querySelectorAll("[data-destination-id]").forEach(t=>{t.classList.remove(e.props.modifiers.hide,e.props.modifiers.active,e.props.modifiers.highlight.lightBlue);let i=t.parentElement;i?.tagName!=="UL"||i.classList.contains(e.props.modifiers.levels.first)||i.classList.remove(e.props.modifiers.show),r(t.querySelector(e.props.accordions.text));let s=t.querySelector(e.props.accordions.title);s&&s.classList.remove(e.props.modifiers.highlight.grey)}),t.querySelectorAll("[data-hotel-id]").forEach(t=>{t.classList.remove(e.props.modifiers.highlight.lightBlue),r(t.querySelector(e.props.accordions.text)||t)})},getAncestorDestinationIds(t){let r=[],i=e.props.searchIndex?.parentByDestinationId?.[t]||null;for(;i;)r.push(i),i=e.props.searchIndex?.parentByDestinationId?.[i]||null;return r},showSelectedDestinationTree(r,i){if(!r||!i)return;let s=r.querySelector(`[data-destination-id="${i}"]`);if(!s)return;let a=e.props.searchIndex?.subtreeDestinationIdsByParent?.[i]||[],o=new Set([i,...a,...t.getAncestorDestinationIds(i)]);r.querySelectorAll("[data-destination-id]").forEach(t=>{t.classList.toggle(e.props.modifiers.hide,!o.has(t.dataset.destinationId))}),t.expandPathToDestinationNode(s),s.querySelectorAll("ul").forEach(t=>{t.classList.add(e.props.modifiers.show)})},expandPathToDestinationNode(t){let r=t;for(;r;){r.classList.add(e.props.modifiers.active);let t=r.parentElement;t?.tagName!=="UL"||t.classList.contains(e.props.modifiers.levels.first)||t.classList.add(e.props.modifiers.show),r=t?.closest("[data-destination-id]")||null}},clearDestinationSearch(r,i){Object.assign(e.props,{selectedDestinationId:null,filteredTree:e.props.sourceTree,visibleDestinationIds:[],visibleHotelIds:[],lastSearchResult:null}),e.renderTreeFromSearchData(r),e.manageDestinationPopover(r),t.applyHotelsVisibility(r),e.changeDestinationStructureOnMobile(r,null,!1),t.filterDestinationInput(r,i)},applySearchResultToDomByIds(r,i,s){if(!i?.value?.trim())return!1;let a=Array.from(r.querySelectorAll("[data-destination-id]")),o=Array.from(r.querySelectorAll("[data-hotel-id]"));if(!a.length&&!o.length)return!1;let n=new Set(s?.visibleDestinationIds||[]),l=new Set(s?.visibleHotelIds||[]),c=new Map((s?.results||[]).map(e=>[e?.item?._id,e?.item?.highlightedLabel])),d=a.some(e=>n.has(e.dataset.destinationId)),h=o.some(e=>l.has(e.dataset.hotelId));if(!d&&!h)return!1;r.querySelectorAll("[data-destination-id]").forEach(t=>{t.classList.remove(e.props.modifiers.active);let r=t.parentElement;r?.tagName!=="UL"||r.classList.contains(e.props.modifiers.levels.first)||r.classList.remove(e.props.modifiers.show)});let u=new Set;
7(s?.results||[]).forEach(({item:e})=>{e&&("destination"===e._kind&&u.add(e._id),e.parentId&&u.add(e.parentId),(e.ancestors||[]).forEach(e=>{u.add(e)}))}),u.forEach(e=>{let i=r.querySelector(`[data-destination-id="${e}"]`);i&&t.expandPathToDestinationNode(i)}),a.forEach(t=>{let r=t.dataset.destinationId;t.classList.toggle(e.props.modifiers.hide,!n.has(r));let i=t.querySelector(e.props.accordions.text);if(i){let e=c.get(r);e?i.innerHTML=e:i.textContent=i.dataset.text||""}}),t.applyHotelsVisibility(r,l),e.changeDestinationStructureOnMobile(r,null,!0),o.forEach(e=>{let t=c.get(e.dataset.hotelId);t?e.innerHTML=t:e.textContent=e.dataset.text||""}),t.reorderHotelsBySearchScore(r,s);let p=r.querySelector(e.props.modals.destinations.default);return e.setIconsOnMobile(p,!0),!0}};return t};r.dn(i),r.d(t,["default",0,i])},33505(e,t,r){r.r(t);let i=e=>{let t={getStoredSearches(){let r=e.props.lastSearches?.storageKey;if(!r)return[];if(Array.isArray(e.props.lastSearches.items)&&e.props.lastSearches.items.length){let r=t.normalizeAndPruneSearches(e.props.lastSearches.items);return r.length!==e.props.lastSearches.items.length&&(e.props.lastSearches.items=r,t.persistSearches(r)),r}try{let i=localStorage.getItem(r);if(!i)return e.props.lastSearches.items=[],[];let s=JSON.parse(i);if(!Array.isArray(s))return e.props.lastSearches.items=[],[];let a=t.normalizeAndPruneSearches(s);return e.props.lastSearches.items=a,a.length!==s.length&&t.persistSearches(a),a}catch(t){return console.error("Error reading recent searches from storage",t),e.props.lastSearches.items=[],[]}},normalizeSearchEntry(e){if(!e||"object"!=typeof e)return null;let r=t.normalizeValue(e.destination),i=t.normalizeValue(e.assistants),s=t.normalizeValue(e.eventType),a=t.normalizeValue(e.destinationPath),o=t.normalizeValue(e.capacityKey),n=t.normalizeValue(e.eventTypeKey);if(!r||!i||!s)return null;let l=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`;return{id:t.normalizeValue(e.id)||l,destination:r,assistants:i,eventType:s,destinationPath:a,capacityKey:o,eventTypeKey:n,timestamp:Number.isFinite(e.timestamp)?e.timestamp:Date.now()}},normalizeValue:e=>String(e||"").trim(),normalizeForMatch:e=>String(e||"").normalize("NFD").replaceAll(/[\u0300-\u036f]/g,"").toLowerCase().trim(),getSearchTtlMs(){let t=Number(e.props.lastSearches?.ttlMs);return Number.isFinite(t)&&t>0?t:2592e6},isExpiredSearch(e,r=Date.now()){let i=Number(e?.timestamp);return!!Number.isFinite(i)&&r-i>t.getSearchTtlMs()},normalizeAndPruneSearches(r){if(!Array.isArray(r))return[];let i=Date.now();return r.map(t.normalizeSearchEntry).filter(Boolean).filter(e=>
7!t.isExpiredSearch(e,i)).slice(-(e.props.lastSearches?.maxItems||3))},setSelectedResultPath(e,r=""){let i=t.normalizeValue(r);if(e){if(!i)return void delete e.dataset.selectedResultPath;e.dataset.selectedResultPath=i}},resolveSelectedPathByLabel(r,i){let s=t.normalizeForMatch(i);if(!r||!s)return"";for(let i of Array.from(r.querySelectorAll(`${e.props.accordions.label}[data-page-path]`)))if(t.normalizeForMatch(i.dataset.text||i.textContent)===s)return t.normalizeValue(i.dataset.pagePath);for(let i of Array.from(r.querySelectorAll(`${e.props.accordions.label}[data-destination-path]`))){let r=i.querySelector(e.props.accordions.text);if(t.normalizeForMatch(r?.dataset?.text||r?.textContent||i.textContent)===s)return t.normalizeValue(i.dataset.destinationPath)}return""},resolveFacetKeyFromLabel(r){let i=t.normalizeValue(r);if(!i)return"";let s=e.props.staticMeetingOptions?.labels||{},a=t.normalizeForMatch(i),o=Object.entries(s).find(([,e])=>t.normalizeForMatch(e)===a);return o?o[0]:i},persistSearches(t){let r=e.props.lastSearches?.storageKey;if(r)try{localStorage.setItem(r,JSON.stringify(t))}catch(e){console.error("Error writing recent searches to storage",e)}},saveCurrentSearch(r){let i=t.normalizeSearchEntry(r);if(!i)return null;
7let s=e.props.lastSearches?.maxItems||3,a=[...t.getStoredSearches(),i].slice(-s);return e.props.lastSearches.items=a,t.persistSearches(a),i},setForceDestinations(t,r){if(!t)return;let i=e.props.lastSearches.forceDestinationsDataAttr;t.dataset[i]=r?"true":"false"},shouldForceDestinations(t){if(!t)return!1;let r=e.props.lastSearches.forceDestinationsDataAttr;return"true"===t.dataset[r]},getRecentElements(t){if(!t)return{};let r=t.querySelector(e.props.modals.destinations.default),i=r?.querySelector(`.${e.props.modifiers.blocks.firstBlock}`),s=i?.querySelector(e.props.lastSearches.panel),a=s?.querySelector(e.props.lastSearches.list),o=s?.querySelector(e.props.lastSearches.showDestinationsBtn),n=i?.querySelector(e.props.lastSearches.destinationTree),l=i?.querySelector(e.props.lastSearches.firstBlockHeaderText);return{defaultModal:r,emptyModal:t.querySelector(e.props.modals.destinations.empty),firstBlock:i,recentPanel:s,recentList:a,showDestinationsBtn:o,destinationTree:n,firstBlockHeaderText:l}},createRecentSearchNode(e,t={}){let r=t.assistantsLabel||"Asistentes",i=t.eventTypeLabel||"Tipo de evento",s=document.createElement("li");s.className="c-fastbooking-lite__form__modal__content__item fb-lite-recentSearchRow-JS";let a=document.createElement("button");a.type="button",a.className="fb-lite-recentSearchItem-JS",a.dataset.searchId=e.id;let o=document.createElement("p");o.className="history__hotel-name fb-lite-recentDestination-JS",o.textContent=e.destination;let n=document.createElement("div");n.className="history__hotel-features";let l=document.createElement("span");l.className="fb-lite-recent-field";let c=document.createElement("span");c.className="fb-lite-recent-field__label",c.textContent=`${r}:`;let d=document.createElement("span");d.className="fb-lite-recentAssistants-JS",d.textContent=e.assistants,l.append(c,d);let h=document.createElement("span");h.className="fb-lite-recent-field";let u=document.createElement("span");u.className="fb-lite-recent-field__label",u.textContent=`${i}:`;let p=document.createElement("span");return p.className="fb-lite-recentEventType-JS",p.textContent=e.eventType,h.append(u,p),n.append(l,h),a.append(o,n),s.append(a),s},ensureEventsBound(t,r,i){r&&"true"!==r.dataset.fastbookingBound&&(r.dataset.fastbookingBound="true",r.addEventListener("click",r=>{let i=r.target.closest(".fb-lite-recentSearchItem-JS");i?.dataset.searchId&&e.applyRecentSearch(t,i.dataset.searchId)})),i&&"true"!==i.dataset.fastbookingBound&&(i.dataset.fastbookingBound="true",i.addEventListener("click",r=>{r.preventDefault(),e.showAllDestinationsFromRecent(t)}))},renderRecentSearches(e){let{defaultModal:r,recentList:i,showDestinationsBtn:s}=t.getRecentElements(e);if(!i)return;let a=[...t.getStoredSearches()].reverse(),o={assistantsLabel:r?.dataset.assistantsLabel,eventTypeLabel:r?.dataset.eventTypeLabel};s&&r?.dataset.showAllDestinationsLabel&&(s.textContent=r.dataset.showAllDestinationsLabel),i.innerHTML="",a.forEach(e=>{i.appendChild(t.createRecentSearchNode(e,o))}),t.ensureEventsBound(e,i,s)},applyRecentSearch(r,i){let s=t.getStoredSearches().find(e=>e.id===i);if(!s||!r)return null;let a=r.querySelector(e.props.form.inputDestination),o=r.querySelector(e.props.btns.closeSearch),n=Array.from(r.querySelectorAll(`${e.props.form.selects}:not(.${e.props.modifiers.hide}) ${e.props.form.selectsValue}`));a&&(a.value=s.destination);let l=t.normalizeValue(s.destinationPath)||t.resolveSelectedPathByLabel(r,s.destination);return t.setSelectedResultPath(r,l),n[0]&&(n[0].textContent=s.assistants,n[0].dataset.value=t.normalizeValue(s.capacityKey)||t.resolveFacetKeyFromLabel(s.assistants)),n[1]&&(n[1].textContent=s.eventType,n[1].dataset.value=t.normalizeValue(s.eventTypeKey)||t.resolveFacetKeyFromLabel(s.eventType)),t.setForceDestinations(r,!0),o?.classList.add(e.props.modifiers.active),e.updateRecentSearchesView(r,s.destination),s},showAllDestinationsFromRecent(r){if(!r)return;t.setForceDestinations(r,!0),e.updateRecentSearchesView(r,"");let i=()=>{let t="function"==typeof e.getUiService?e.getUiService():null;t?.focusFirstDestinationModalItem?.(r)};"function"==typeof requestAnimationFrame?requestAnimationFrame(i):setTimeout(i,0)}
7,resetRecentSearchesMode(e){t.setForceDestinations(e,!1)},updateRecentSearchesView(r,i=""){if(!r)return;let{defaultModal:s,emptyModal:a,recentPanel:o,recentList:n,destinationTree:l,firstBlockHeaderText:c,showDestinationsBtn:d}=t.getRecentElements(r);if(!s||!o||!l)return;let h=t.getStoredSearches().length>0,u=!!String(i||"").trim(),p=t.shouldForceDestinations(r),m=h&&!u&&!p;if(s.classList.add(e.props.modifiers.show),u&&a?.classList.remove(e.props.modifiers.show),m&&a?.classList.remove(e.props.modifiers.show),o.classList.toggle(e.props.modifiers.hide,!m),n?.classList.toggle(e.props.modifiers.show,m),n?.classList.toggle(e.props.modifiers.hide,!m),l.classList.toggle(e.props.modifiers.hide,m),l.classList.toggle(e.props.modifiers.show,!m),d?.classList.toggle(e.props.modifiers.hide,!m),c){let e=s.dataset.lastSearchesTitle||s.dataset.recommendedDestinations;c.textContent=m?e:s.dataset.recommendedDestinations}}};return t};r.dn(i),r.d(t,["default",0,i])},39568(e,t,r){r.r(t);let i=e=>{let t={getHotelNodeId(e,t,r){let i=`${t||"root"}-${e?.hotelName||"hotel"}-${r}`;return`hotel:${e?.hotelId||e?.pagePath||i}`},getRootListFromBlock:e=>e&&(e.querySelector(".fb-lite-destinationTree-JS")||Array.from(e.children).find(e=>"UL"===e.tagName))||null,getLevelClassByDepth:t=>t<=1?e.props.modifiers.levels.first:2===t?e.props.modifiers.levels.second:3===t?e.props.modifiers.levels.third:e.props.modifiers.levels.fourth,countHotelsInSubtree:e=>e?(Array.isArray(e.hotels)?e.hotels.length:0)+(Array.isArray(e.subDestinations)?e.subDestinations:[]).reduce((e,r)=>e+t.countHotelsInSubtree(r),0):0,createArrowIconElement(e){if(!e)return null;let t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},createDestinationAccordion({destinationTitle:e,hotelCount:r,normalizedHotelsLabel:i,arrowTemplateHtml:s="",includeArrow:a=!1}){let o=document.createElement("div");o.className="c-fastbooking-lite__form__modal__accordion mod--hover-grey fb-lite-modalContentTitle-JS";let n=document.createElement("div");n.className="c-fastbooking-lite__form__modal__accordionText";let l=document.createElement("span");l.className="c-fastbooking-lite__form__modal__accordionText__text fb-lite-modalText-JS",l.dataset.text=e,l.textContent=e;let c=document.createElement("span");if(c.className="c-fastbooking-lite__form__modal__hotelQuantity",c.textContent=`- ${r} ${i}`,n.append(l,c),o.append(n),a){let e=t.createArrowIconElement(s);e&&o.append(e)}return{accordion:o,text:l,quantity:c}},renderDestinationTreeNode(r,i,s,a){let o=t.getLevelClassByDepth(i),n=t.getLevelClassByDepth(i+1),l=Array.isArray(r?.subDestinations)&&r.subDestinations.length>0,c=t.countHotelsInSubtree(r),d=!!r?.path,h=String(a||"hoteles").trim()||"hoteles",u=r?.i18nTitle||"",p=document.createElement("li");if(p.setAttribute("role","treeitem"),p.setAttribute("tabindex","0"),p.dataset.destinationId=r?.id||"",p.dataset.destinationPath=r?.path||"",p.className=`c-fastbooking-lite__form__modal__content__item ${o} fb-lite-modalContentItem-JS`,d||p.classList.add("mod--without-path",e.props.modifiers.structuralNode),l){let{accordion:e}=t.createDestinationAccordion({destinationTitle:u,hotelCount:c,normalizedHotelsLabel:h,arrowTemplateHtml:s,includeArrow:!0});p.append(e);let a=document.createElement("ul");return a.setAttribute("role","group"),a.className=`c-fastbooking-lite__form__modal__content ${n}`,r.subDestinations.forEach(e=>{a.append(t.renderDestinationTreeNode(e,i+1,s,h))}),p.append(a),p}let{accordion:m,text:f,quantity:S}=t.createDestinationAccordion({destinationTitle:u,hotelCount:c,normalizedHotelsLabel:h});return i<=2?p.append(m):(p.classList.add("mod--hover-grey"),p.append(f,S)),p},flattenHotelsForRender(e){let r=[],i=e=>{e?.id&&((Array.isArray(e.hotels)?e.hotels:[]).forEach((i,s)=>{r.push({...i,_nodeId:t.getHotelNodeId(i,e.id,s),_destinationId:e.id})}),(Array.isArray(e.subDestinations)?e.subDestinations:[]).forEach(e=>i(e)))};
7return(Array.isArray(e)?e:[]).forEach(e=>i(e)),r},sortHotelsByRanking:e=>(Array.isArray(e)?e:[]).map((e,t)=>{let r=Number.parseInt(String(e?.ranking||"").trim(),10);return{hotel:e,index:t,ranking:Number.isFinite(r)?r:1/0}}).sort((e,t)=>e.ranking!==t.ranking?e.ranking-t.ranking:e.index-t.index).map(e=>e.hotel),createHotelListItem(e,t=""){let r=["c-fastbooking-lite__form__modal__content__item","mod--hover-blue","fb-lite-modalContentItem-JS",t].filter(Boolean).join(" "),i=document.createElement("li");return i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.className=r,i.dataset.text=e?.hotelName||"",i.dataset.hotelId=e?._nodeId||"",e?.meetingPath&&(i.dataset.meetingPath=e.meetingPath),e?.pagePath&&(i.dataset.pagePath=e.pagePath),Array.isArray(e?.eventTypes)&&e.eventTypes.length&&(i.dataset.eventTypes=e.eventTypes.map(e=>String(e||"").trim()).filter(Boolean).join(",")),i.textContent=e?.hotelName||"",i},normalizeResortAlias:e=>String(e||"").trim(),buildResortParentNodeId:e=>`hotel:${t.normalizeResortAlias(e).toLowerCase().replaceAll(/\s+/g,"-")}`,groupHotelsByResort(e=[]){let r=new Map;return e.forEach(e=>{let i=t.normalizeResortAlias(e?.resortAlias);i?(r.has(i)||r.set(i,{type:"resort",resortName:i,hotels:[]}),r.get(i).hotels.push(e)):r.set(e._nodeId,{type:"single",hotels:[e]})}),r},appendHotelItems(e,r,i=""){r.forEach(r=>{e.append(t.createHotelListItem(r,i))})},appendGroupedHotels(e,r){if("resort"===r.type&&r.hotels.length>1){let i={hotelName:r.resortName,_nodeId:t.buildResortParentNodeId(r.resortName)};e.append(t.createHotelListItem(i,"mod--resortParent")),t.appendHotelItems(e,r.hotels,"mod--resortChild");return}t.appendHotelItems(e,r.hotels)},renderHotelsListFromTree(r,i){let s=t.sortHotelsByRanking(t.flattenHotelsForRender(i)),a=t.groupHotelsByResort(s);r.innerHTML="",a.forEach(e=>{t.appendGroupedHotels(r,e)}),e.applyHotelsVisibility(r.closest(e.props.cssSelector))},renderTreeFromSearchData(r){let i=e.props.sourceTree;if(!Array.isArray(i)||!i.length)return;let s=r.querySelector(e.props.modals.destinations.default),a=s?.querySelector(`.${e.props.modifiers.blocks.firstBlock}`),o=s?.querySelector(`.${e.props.modifiers.blocks.secondBlock}`),n=t.getRootListFromBlock(a),l=t.getRootListFromBlock(o);if(!n||!l)return;let c=e?.props?.icons?.accordionArrow||a?.querySelector(".svg-icon.accordion-arrow")?.outerHTML,d=String(r?.dataset?.hotelslabel||"hoteles").trim()||"hoteles";n.innerHTML="",i.forEach(e=>{n.append(t.renderDestinationTreeNode(e,1,c,d))}),t.renderHotelsListFromTree(l,i),e.renderRecentSearches(r),e.updateRecentSearchesView(r),e.changeDestinationStructureOnMobile(r)}};return t};r.dn(i),r.d(t,["default",0,i])}}]); 8//# sourceMappingURL=/etc.clientlibs/barcelo/clientlibs/clientlib-components/resources/36310.b5eb5385.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.