1jQuery(document).ready(function($){let modalContainer=$('<div id="modalContainer"></div>').appendTo('body');let avSearchStarted=!1;let activeForm=null;let modalOpen=!1;let headerEvaluate=null;function setModalOpen(open){modalOpen=open;if(headerEvaluate)headerEvaluate();} 2function activeFields(){return activeForm?activeForm.data('avSearch'):null} 3let modalTemplateHTML=null;function fireAvSearchStarted($form){if(!avSearchStarted){avSearchStarted=!0;var location=$form.data('location')||'general';window.dataLayer=window.dataLayer||[];dataLayer.push({'event':'av_search_started','search_location':location})}} 4function getDefaultStartDate(){var currentDate=moment();var currentMonth=currentDate.month();if(currentMonth>=4&¤tMonth<=10){return moment().month(11).date(1)}else{return currentDate}} 5function openNativePicker(selectEl){if(!selectEl)return;if(typeof selectEl.showPicker==='function'){try{selectEl.showPicker();return}catch(e){}} 6const event=new MouseEvent('mousedown',{view:window,bubbles:!0,cancelable:!0});selectEl.dispatchEvent(event)} 7$('.av-search-form').each(function(){const $form=$(this);const dateRangeInput=$form.find('input[name="daterange"]');const destinationInput=$form.find('input[name="destination"]');const guestsSelect=$form.find('select[name="guests"]');const budgetSelect=$form.find('select[name="budget"]');$form.data('avSearch',{dateRangeInput:dateRangeInput,destinationInput:destinationInput,guestsSelect:guestsSelect,budgetSelect:budgetSelect});destinationInput.on('focus click',function(){fireAvSearchStarted($form)});dateRangeInput.on('focus click',function(){fireAvSearchStarted($form)});guestsSelect.on('focus click',function(){fireAvSearchStarted($form)});budgetSelect.on('focus click',function(){fireAvSearchStarted($form)});var today=moment();var linkedCalendarsEl=$(window).width()<768?!1:!0;var startDate,endDate;var dateRangeValue=dateRangeInput.val();if(dateRangeValue&&dateRangeValue.trim()!==''){var dates=dateRangeValue.split(' - ');if(dates.length===2){startDate=moment(dates[0],'DD/MM/YYYY');endDate=moment(dates[1],'DD/MM/YYYY');if(startDate.isBefore(today)){startDate=today}}} 8if(dateRangeInput.length){dateRangeInput.daterangepicker({autoUpdateInput:!1,opens:'center',autoApply:!0,linkedCalendars:linkedCalendarsEl,minDate:moment(),startDate:getDefaultStartDate(),locale:{format:'DD/MM/YYYY'},isInvalidDate:function(date){return date.day()!==0},isCustomDate:function(date){let classes=[];var formattedDate=date.format('YYYY-MM-DD');var today=moment().format('YYYY-MM-DD');if(formattedDate>today){classes.push('week-available')} 9if(formattedDate==today){classes.push('today','position-relative')} 10return classes.join(' ')}})} 11dateRangeInput.on('apply.daterangepicker',function(ev,picker){if(picker.startDate.format('YYYY-MM-DD')===picker.endDate.format('YYYY-MM-DD')){const newEndDate=moment(picker.startDate).add(7,'days');picker.setEndDate(newEndDate);alert('Check-in and Check-out dates cannot be the same. Please select different dates.');return!1} 12$(this).val(picker.startDate.format('DD/MM/YYYY')+' - '+picker.endDate.format('DD/MM/YYYY'))});dateRangeInput.on('cancel.daterangepicker',function(ev,picker){$(this).val('')});destinationInput.on('focus click',function(e){activeForm=$form;loadModal()});destinationInput.on('input',function(){const searchTerm=$(this).val().toLowerCase().trim();const $exploreAll=$('.destination-card').filter(function(){return $(this).find('.resort-name').text().trim()==='Explore All'}).closest('.col-6');if(searchTerm===''||searchTerm.indexOf(',')!==-1){$('.destination-card').closest('.col-6').show();return} 13let hasMatches=!1;$('.destination-card').each(function(){const $card=$(this);const $resortText=$card.find('.resort-name').text().toLowerCase();const isExploreAll=$resortText.includes('explore all');if(isExploreAll){return} 14const matches=$resortText.includes(searchTerm);if(matches){$card.closest('.col-6').show();hasMatches=!0}else{$card.closest('.col-6').hide()}});if(hasMatches){$exploreAll.show()}else if(searchTerm){$('.destination-card').closest('.col-6').hide();$exploreAll.show()}else{$exploreAll.hide()}});dateRangeInput.on('apply.daterangepicker',function(ev,picker){setTimeout(()=>{openNativePicker(guestsSelect[0])},100)});guestsSelect.on('change',function(){setTimeout(()=>{openNativePicker(budgetSelect[0])},100)});$form.on('submit',function(e){e.preventDefault();const destination=destinationInput.val();const daterange=dateRangeInput.val();const guests=guestsSelect.val();const budget=budgetSelect.val();const location=$form.data('location')||'general';window.dataLayer=window.dataLayer||[];dataLayer.push({'event':'av_search','search_location':location,'search_destination':destination,'search_daterange':daterange,'search_guests':guests,'search_budget':budget});if(location==='home'){dataLayer.push({'event':'av_search_home'})}else if(location==='results'){dataLayer.push({'event':'av_search_results'})}else if(location==='resort'){dataLayer.push({'event':'av_search_resort'})} 15this.submit()})});const $headerForm=$('.av-search-form[data-instance="header"]');if($headerForm.length){const headerFields=$headerForm.data('avSearch');let headerPickerOpen=!1;let headerActive=null;let evalTimer=null;headerEvaluate=function(){clearTimeout(evalTimer);evalTimer=setTimeout(function(){const focusWithin=$headerForm[0].contains(document.activeElement);const modalForHeader=modalOpen&&activeForm&&activeForm[0]===$headerForm[0];const active=!!(focusWithin||modalForHeader||headerPickerOpen);if(active!==headerActive){headerActive=active;document.dispatchEvent(new CustomEvent('bramble:header-search',{detail:{active:active}}))}},0)};$headerForm.on('focusin focusout',headerEvaluate);headerFields.dateRangeInput.on('show.daterangepicker',function(){headerPickerOpen=!0;headerEvaluate()});headerFields.dateRangeInput.on('hide.daterangepicker',function(){headerPickerOpen=!1;headerEvaluate()});const heroForm=document.querySelector('.av-search-form[data-location="home"]');const headerSlot=$headerForm.closest('.bs_header_search_slot')[0];const headerBar=document.querySelector('.header_3_design');if(heroForm&&headerSlot&&headerBar&&document.body.classList.contains('home')){const REVEAL_OFFSET=0;let ticking=!1;function updateHeaderSearchReveal(){ticking=!1;if(headerBar.classList.contains('bs_search_active'))return;const covered=heroForm.getBoundingClientRect().bottom<=headerBar.offsetHeight+REVEAL_OFFSET;headerSlot.classList.toggle('is-revealed',covered)} 16window.addEventListener('scroll',function(){if(!ticking){ticking=!0;requestAnimationFrame(updateHeaderSearchReveal)}},{passive:!0});window.addEventListener('resize',updateHeaderSearchReveal);updateHeaderSearchReveal()}} 17function openDatePicker(){const f=activeFields();if(f&&f.dateRangeInput.data('daterangepicker')){f.dateRangeInput.data('daterangepicker').show()}} 18function loadModal(){if($('#destinationModal').length&&modalContainer.children().length){return} 19if(modalTemplateHTML===null){const $tpl=$('#modalTemplate');modalTemplateHTML=$tpl.html();$tpl.empty()} 20modalContainer.html(modalTemplateHTML);initializeModal()} 21function initializeModal(){const modal=$('#destinationModal');modal.modal({backdrop:!1,keyboard:!0,focus:!0,scroll:!0});window._modalOpenedAt=Date.now();modal.modal('show');positionModal();setModalOpen(!0);modal.on('hidden.bs.modal',function(){setModalOpen(!1);modalContainer.empty();const f=activeFields();const isHeader=activeForm&&activeForm.data('instance')==='header';if(f&&!isHeader&&f.destinationInput.val().trim()!==''){setTimeout(openDatePicker,50)}});modal.on('show.bs.modal',function(){$('body').removeClass('modal-open')});prefillSelectedFromInput();syncInputFromSelection();$('#destinationModal').on('click','.destination-card',function(e){e.preventDefault();e.stopPropagation();const $card=$(this);const resort=$card.data('resort');if(resort==='Explore All'){$('#destinationModal .destination-card').removeClass('selected');$card.addClass('selected')}else{$('#destinationModal .destination-card[data-resort="Explore All"]').removeClass('selected');$card.toggleClass('selected')} 22syncInputFromSelection()})} 23function collectSelectedResorts(){const picks=[];$('#destinationModal .destination-card.selected').each(function(){const r=$(this).data('resort');if(r)picks.push(String(r));});return picks} 24function prefillSelectedFromInput(){const f=activeFields();if(!f)return;const current=(f.destinationInput.val()||'').trim();if(!current)return;const wanted=current.split(',').map(s=>
24s.trim()).filter(Boolean);if(wanted.length===0)return;$('#destinationModal .destination-card').each(function(){const r=String($(this).data('resort')||'').trim();if(r&&wanted.indexOf(r)!==-1){$(this).addClass('selected')}})} 25function syncInputFromSelection(){const f=activeFields();if(!f)return;const picks=collectSelectedResorts();f.destinationInput.val(picks.join(', '))} 26const positionModal=()=>{const f=activeFields();if(!f)return;if($(window).width()>=768){const input=f.destinationInput;const inputPosition=input.offset();const inputHeight=input.outerHeight();const scrollTop=$(window).scrollTop();$('.destination-modal .modal-dialog').css({'position':'fixed','top':(inputPosition.top-scrollTop+inputHeight-10)+'px','left':(inputPosition.left-4)+'px','max-width':'800px'})}else{$('.destination-modal .modal-dialog').css({'position':'','top':'','left':'','max-width':''})}};$(window).on('resize scroll',function(){if($('#destinationModal').hasClass('show')&&$(window).width()>=768){positionModal()}});$(document).on('click',function(e){const modal=$('#destinationModal');if(!modal.length||!modal.hasClass('show'))return;if(window._modalOpenedAt&&(Date.now()-window._modalOpenedAt)<250)return;const $mc=$('#modalContainer');if($mc.is(e.target)||$mc.has(e.target).length)return;const f=activeFields();if(f&&(f.destinationInput.is(e.target)||f.destinationInput.has(e.target).length))return;modal.modal('hide')})})
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.