PageSourceSearch

https://www.riccionehotelaugustus.it/riccionehotelaugustus.it/theme10/js/main.js

js riccionehotelaugustus.it collected 2026-10-04 01:34:52 UTC 245,175 bytes, 3,204 lines download raw bytes

vendor: 5,227 bytes, lines 1-2
1/* flatpickr v4.6.3,, @license MIT */
2!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).flatpickr=t()}(this,function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],n={_disable:[],_enable:[],allowInput:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enable:[],enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},a={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},i=function(e){return("0"+e).slice(-2)},o=function(e){return!0===e?1:0};function r(e,t,n){var a;return void 0===n&&(n=!1),function(){var i=this,o=arguments;null!==a&&clearTimeout(a),a=window.setTimeout(function(){a=null,n||e.apply(i,o)},t),n&&!a&&e.apply(i,o)}}var l=function(e){return e instanceof Array?e:[e]};function c(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function d(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function s(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function u(e,t){var n=d("div","numInputWrapper"),a=d("input","numInput "+e),i=d("span","arrowUp"),o=d("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==t)for(var r in t)a.setAttribute(r,t[r]);return n.appendChild(a),n.appendChild(i),n.appendChild(o),n}var f=function(){},m=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},g={D:f,F:function(e,t,n){e.setMonth(n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,n){e.setHours(e.getHours()%12+12*o(new RegExp(n.amPM[1],"i").test(t)))},M:function(e,t,n){e.setMonth(n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t,n){var a=parseInt(t),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+n.firstDayOfWeek),i},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:f,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},u:function(e,t){return new Date(parseFloat(t))},w:f,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},p={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"
2(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},h={Z:function(e){return e.toISOString()},D:function(e,t,n){return t.weekdays.shorthand[h.w(e,t,n)]},F:function(e,t,n){return m(h.n(e,t,n)-1,!1,t)},G:function(e,t,n){return i(h.h(e,t,n))},H:function(e){return i(e.getHours())},J:function(e,t){return void 0!==t.ordinal?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e,t){return t.amPM[o(e.getHours()>11)]},M:function(e,t){return m(e.getMonth(),!0,t)},S:function(e){return i(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,n){return n.getWeek(e)},Y:function(e){return e.getFullYear()},d:function(e){return i(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return i(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return i(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},v=function(e){var t=e.config,i=void 0===t?n:t,o=e.l10n,r=void 0===o?a:o;return function(e,t,n){var a=n||r;return void 0!==i.formatDate?i.formatDate(e,t,a):t.split("").map(function(t,n,o){return h[t]&&"\\"!==o[n-1]?h[t](e,a,i):"\\"!==t?t:""}).join("")}},D=function(e){var t=e.config,i=void 0===t?n:t,o=e.l10n,r=void 0===o?a:o;return function(e,t,a,o){if(0===e||e){var l,c=o||r,d=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var s=t||(i||n).dateFormat,u=String(e).trim();if("today"===u)l=new Date,a=!0;else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else if(i&&i.parseDate)l=i.parseDate(e,s);else{l=i&&i.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var f=void 0,m=[],h=0,v=0,D="";h<s.length;h++){var w=s[h],b="\\"===w,C="\\"===s[h-1]||b;if(p[w]&&!C){D+=p[w];var M=new RegExp(D).exec(e);M&&(f=!0)&&m["Y"!==w?"push":"unshift"]({fn:g[w],val:M[++v]})}else b||(D+=".");m.forEach(function(e){var t=e.fn,n=e.val;return l=t(l,n,c)||l})}l=f?l:void 0}}if(l instanceof Date&&!isNaN(l.getTime()))return!0===a&&l.setHours(0,0,0,0),l;i.errorHandler(new Error("Invalid date provided: "+d))}}};function w(e,t,n){return void 0===n&&(n=!0),!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime()}var b=function(e,t,n){return e>Math.min(t,n)&&e<Math.max(t,n)},C={DAY:864e5};"function"!=typeof Object.assign&&(Object.assign=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(!e)throw TypeError("Cannot convert undefined or null to object");for(var a=function(t){t&&Object.keys(t).forEach(function(n){return e[n]=t[n]})},i=0,o=t;i<o.length;i++){a(o[i])}return e});var M=300;function y(f,g){var h={config:e({},n,E.defaultConfig),l10n:a};function y(e){return e.bind(h)}function x(){var e=h.config;!1===e.weekNumbers&&1===e.showMonths||!0!==e.noCalendar&&window.requestAnimationFrame(function(){if(void 0!==h.calendarContainer&&(h.calendarContainer.style.visibility="hidden",h.calendarContainer.style.display="block"),void 0!==h.daysContainer){var t=(h.days.offsetWidth+1)*e.showMonths;h.daysContainer.style.width=t+"px",h.calendarContainer.style.width=t+(void 0!==h.weekWrapper?h.weekWrapper.offsetWidth:0)+"px",h.calendarContainer.style.removeProperty("visibility"),h.calendarContainer.style.removeProperty("display")}})}function T(e){0===h.selectedDates.length&&ie(),void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var t="keydown"===e.type,n=e.target;void 0!==h.amPM&&e.target===h.amPM&&(h.amPM.textContent=h.l10n.amPM[o(h.amPM.textContent===h.l10n.amPM[0])]);var a=parseFloat(n.getAttribute("min")),r=parseFloat(n.getAttribute("max")),l=parseFloat(n.getAttribute("step")),c=parseInt(n.value,10),d=e.delta||(t?38===e.which?1:-1:0),s=c+l*d;if(void 0!==n.value&&2===n.value.length){var u=n===h.hourElement,f=n===h.minuteElement;s<a?(s=r+s+o(!u)+(o(u)&&o(!h.amPM)),f&&j(void 0,-1,h.hourElement)):s>r&&(s=n===h.hourElement?s-r-o(!h.amPM):a,f&&j(void 0,1,h.hourElement)),h.amPM&&u&&(1===l?s+c===23:Math.abs(s-c)>l)&&(h.amPM.textContent=h.l10n.amPM[o(h.amPM.textContent===h.l10n.amPM[0])]),n.value=i(s)}}(e);var t=h._input.value;k(),we(),h._input.value!==t&&h._debouncedChange()}function k(){if(void 0!==h.hourElement&&void 0!==h.minuteElement){var e,t,n=(parseInt(h.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(h.minuteElement.value,10)||0)%60,i=void 0!==h.secondElement?(parseInt(h.secondElement.value,10)||0)%60:0;void 0!==h.amPM&&(e=n,t=h.amPM.textContent,n=e%12+12*o(t===h.l10n.amPM[1]));var r=void 0!==h.config.minTime||h.config.minDate&&h.minDateHasTime&&h.latestSelectedDateObj&&0===w(h.latestSelectedDateObj,h.config.minDate,!0);if(void 0!==h.config.maxTime||h.config.maxDate&&h.maxDateHasTime&&h.latestSelectedDateObj&&0===w(h.latestSelectedDateObj,h.config.maxDate,!0)){var l=void 0!==h.config.maxTime?h.config.maxTime:h.config.maxDate;(n=Math.min(n,l.getHours()))===l.getHours()&&(a=Math.min(a,l.getMinutes())),a===l.getMinutes()&&(i=Math.min(i,l.getSeconds()))}if(r){var c=void 0!==h.config.minTime?h.config.minTime:h.config.minDate;(n=Math.max(n,c.getHours()))===c.getHours()&&(a=Math.max(a,c.getMinutes())),a===c.getMinutes()&&(i=Math.max(i,c.getSeconds()))}O(n,a,i)}}function I(e){var t=e||h.latestSelectedDateObj;t&&O(t.getHours(),t.getMinutes(),t.getSeconds())}function S(){var e=h.config.defaultHour,t=h.config.defaultMinute,n=h.config.defaultSeconds;if(void 0!==h.config.minDate){var a=h.config.minDate.getHours(),i=h.config.minDate.getMinutes();(e=Math.max(e,a))===a&&(t=Math.max(i,t)),e===a&&t===i&&(n=h.config.minDate.getSeconds())}if(void 0!==h.config.maxDate){var o=h.config.maxDate.getHours(),r=h.config.maxDate.getMinutes();(e=Math.min(e,o))===o&&(t=Math.min(r,t)),e===o&&t===r&&(n=h.config.maxDate.getSeconds())}O(e,t,n)}function O(e,t,n){void 0!==h.latestSelectedDateObj&&h.latestSelectedDateObj.setHours(e%24,t,n||0,0),h.hourElement&&h.minuteElement&&!h.isMobile&&(h.hourElement.value=i(h.config.time_24hr?e:(12+e)%12+12*o(e%12==0)),h.minuteElement.value=i(t),void 0!==h.amPM&&(h.amPM.textContent=h.l10n.amPM[o(e>=12)]),void 0!==h.secondElement&&(h.secondElement.value=i(n)))}function _(e){var t=parseInt(e.target.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&Q(t)}function F(e,t,n,a){return t instanceof Array?t.forEach(function(t){return F(e,t,n,a)}):e instanceof Array?e.forEach(function(e){return F(e,t,n,a)}):(e.addEventListener(t,n,a),void h._handlers.push({element:e,event:t,handler:n,options:a}))}function N(e){return function(t){1===t.which&&e(t)}}function Y(){ge("onChange")}function A(e,t){var n=void 0!==e?h.parseDate(e):h.latestSelectedDateObj||(h.config.minDate&&h.config.minDate>h.now?h.config.minDate:h.config.maxDate&&h.config.maxDate<h.now?h.config.maxDate:h.now),a=h.currentYear,i=h.currentMonth;try{void 0!==n&&(h.currentYear=n.getFullYear(),h.currentMonth=n.getMonth())}catch(e){e.message="Invalid date supplied: "+n,h.config.errorHandler(e)}t&&h.currentYear!==a&&(ge("onYearChange"),K()),!t||h.currentYear===a&&h.currentMonth===i||ge("onMonthChange"),h.redraw()}function P(e){~e.target.className.indexOf("arrow")&&j(e,e.target.classList.contains("arrowUp")?1:-1)}function j(e,t,n){var a=e&&e.target,i=n||a&&a.parentNode&&a.parentNode.firstChild,o=pe("increment");o.delta=t,i&&i.dispatchEvent(o)}function H(e,t,n,a){var i=X(t,!0),o=d("span","flatpickr-day "+e,t.getDate().toString());return o.dateObj=t,o.$i=a,o.setAttribute("aria-label",h.formatDate(t,h.config.ariaDateFormat)),-1===e.indexOf("hidden")&&0===w(t,h.now)&&(h.todayDateElem=o,o.classList.add("today"),o.setAttribute("aria-current","date")),i?(o.tabIndex=-1,he(t)&&(o.classList.add("selected"),h.selectedDateElem=o,"range"===h.config.mode&&(c(o,"startRange",h.selectedDates[0]&&0===w(t,h.selectedDates[0],!0)),c(o,"endRange",h.selectedDates[1]&&0===w(t,h.selectedDates[1],!0)),"nextMonthDay"===e&&o.classList.add("inRange")))):o.classList.add("flatpickr-disabled"),"range"===h.config.mode&&function(e){return!("range"!==h.config.mode||h.selectedDates.length<2)&&w(e,h.selectedDates[0])>=0&&w(e,h.selectedDates[1])<=0}(t)&&!he(t)&&o.classList.add("inRange"),h.weekNumbers&&1===h.config.showMonths&&"prevMonthDay"!==e&&n%7==1&&h.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+h.config.getWeek(t)+"</span>"),ge("onDayCreate",o),o}function L(e){e.focus(),"range"===h.config.mode&&ne(e)}function W(e){for(var t=e>0?0:h.config.showMonths-1,n=e>0?h.config.showMonths:-1,a=t;a!=n;a+=e)for(var i=h.daysContainer.children[a],o=e>
vendor: 4,228 bytes, line 2
20?0:i.children.length-1,r=e>0?i.children.length:-1,l=o;l!=r;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&X(c.dateObj))return c}}function R(e,t){var n=ee(document.activeElement||document.body),a=void 0!==e?e:n?document.activeElement:void 0!==h.selectedDateElem&&ee(h.selectedDateElem)?h.selectedDateElem:void 0!==h.todayDateElem&&ee(h.todayDateElem)?h.todayDateElem:W(t>0?1:-1);return void 0===a?h._input.focus():n?void function(e,t){for(var n=-1===e.className.indexOf("Month")?e.dateObj.getMonth():h.currentMonth,a=t>0?h.config.showMonths:-1,i=t>0?1:-1,o=n-h.currentMonth;o!=a;o+=i)for(var r=h.daysContainer.children[o],l=n-h.currentMonth===o?e.$i+t:t<0?r.children.length-1:0,c=r.children.length,d=l;d>=0&&d<c&&d!=(t>0?c:-1);d+=i){var s=r.children[d];if(-1===s.className.indexOf("hidden")&&X(s.dateObj)&&Math.abs(e.$i-d)>=Math.abs(t))return L(s)}h.changeMonth(i),R(W(i),0)}(a,t):L(a)}function B(e,t){for(var n=(new Date(e,t,1).getDay()-h.l10n.firstDayOfWeek+7)%7,a=h.utils.getDaysInMonth((t-1+12)%12),i=h.utils.getDaysInMonth(t),o=window.document.createDocumentFragment(),r=h.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",c=r?"nextMonthDay hidden":"nextMonthDay",s=a+1-n,u=0;s<=a;s++,u++)o.appendChild(H(l,new Date(e,t-1,s),s,u));for(s=1;s<=i;s++,u++)o.appendChild(H("",new Date(e,t,s),s,u));for(var f=i+1;f<=42-n&&(1===h.config.showMonths||u%7!=0);f++,u++)o.appendChild(H(c,new Date(e,t+1,f%i),f,u));var m=d("div","dayContainer");return m.appendChild(o),m}function J(){if(void 0!==h.daysContainer){s(h.daysContainer),h.weekNumbers&&s(h.weekNumbers);for(var e=document.createDocumentFragment(),t=0;t<h.config.showMonths;t++){var n=new Date(h.currentYear,h.currentMonth,1);n.setMonth(h.currentMonth+t),e.appendChild(B(n.getFullYear(),n.getMonth()))}h.daysContainer.appendChild(e),h.days=h.daysContainer.firstChild,"range"===h.config.mode&&1===h.selectedDates.length&&ne()}}function K(){if(!(h.config.showMonths>1||"dropdown"!==h.config.monthSelectorType)){var e=function(e){return!(void 0!==h.config.minDate&&h.currentYear===h.config.minDate.getFullYear()&&e<h.config.minDate.getMonth())&&!(void 0!==h.config.maxDate&&h.currentYear===h.config.maxDate.getFullYear()&&e>h.config.maxDate.getMonth())};h.monthsDropdownContainer.tabIndex=-1,h.monthsDropdownContainer.innerHTML="";for(var t=0;t<12;t++)if(e(t)){var n=d("option","flatpickr-monthDropdown-month");n.value=new Date(h.currentYear,t).getMonth().toString(),n.textContent=m(t,h.config.shorthandCurrentMonth,h.l10n),n.tabIndex=-1,h.currentMonth===t&&(n.selected=!0),h.monthsDropdownContainer.appendChild(n)}}}function U(){var e,t=d("div","flatpickr-month"),n=window.document.createDocumentFragment();h.config.showMonths>1||"static"===h.config.monthSelectorType?e=d("span","cur-month"):(h.monthsDropdownContainer=d("select","flatpickr-monthDropdown-months"),F(h.monthsDropdownContainer,"change",function(e){var t=e.target,n=parseInt(t.value,10);h.changeMonth(n-h.currentMonth),ge("onMonthChange")}),K(),e=h.monthsDropdownContainer);var a=u("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",h.l10n.yearAriaLabel),h.config.minDate&&i.setAttribute("min",h.config.minDate.getFullYear().toString()),h.config.maxDate&&(i.setAttribute("max",h.config.maxDate.getFullYear().toString()),i.disabled=!!h.config.minDate&&h.config.minDate.getFullYear()===h.config.maxDate.getFullYear());var o=d("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),n.appendChild(o),t.appendChild(n),{container:t,yearElement:i,monthElement:e}}function q(){s(h.monthNav),h.monthNav.appendChild(h.prevMonthNav),h.config.showMonths&&(h.yearElements=[],h.monthElements=[]);for(var e=h.config.showMonths;e--;){var t=U();h.yearElements.push(t.yearElement),h.monthElements.push(t.monthElement),h.monthNav.appendChild(t.container)}h.monthNav.appendChild(h.nextMonthNav)}function $(){h.weekdayContainer?s(h.weekdayContainer):h.weekdayContainer=d("div","flatpickr-weekdays");for(var e=h.config.showMonths;e--;){var t=d("div","flatpickr-weekdaycontainer");h.weekdayContainer.appendChild(t)}return z(),h.weekdayContainer}function z(){if(h.weekdayContainer){var e=h.l10n.firstDayOfWeek,t=h.l10n.weekdays.shorthand.slice();e>
vendor: 12,075 bytes, line 2
20&&e<t.length&&(t=t.splice(e,t.length).concat(t.splice(0,e)));for(var n=h.config.showMonths;n--;)h.weekdayContainer.children[n].innerHTML="\n      <span class='flatpickr-weekday'>\n        "+t.join("</span><span class='flatpickr-weekday'>")+"\n      </span>\n      "}}function G(e,t){void 0===t&&(t=!0);var n=t?e:e-h.currentMonth;n<0&&!0===h._hidePrevMonthArrow||n>0&&!0===h._hideNextMonthArrow||(h.currentMonth+=n,(h.currentMonth<0||h.currentMonth>11)&&(h.currentYear+=h.currentMonth>11?1:-1,h.currentMonth=(h.currentMonth+12)%12,ge("onYearChange"),K()),J(),ge("onMonthChange"),ve())}function V(e){return!(!h.config.appendTo||!h.config.appendTo.contains(e))||h.calendarContainer.contains(e)}function Z(e){if(h.isOpen&&!h.config.inline){var t="function"==typeof(r=e).composedPath?r.composedPath()[0]:r.target,n=V(t),a=t===h.input||t===h.altInput||h.element.contains(t)||e.path&&e.path.indexOf&&(~e.path.indexOf(h.input)||~e.path.indexOf(h.altInput)),i="blur"===e.type?a&&e.relatedTarget&&!V(e.relatedTarget):!a&&!n&&!V(e.relatedTarget),o=!h.config.ignoredFocusElements.some(function(e){return e.contains(t)});i&&o&&(void 0!==h.timeContainer&&void 0!==h.minuteElement&&void 0!==h.hourElement&&T(),h.close(),"range"===h.config.mode&&1===h.selectedDates.length&&(h.clear(!1),h.redraw()))}var r}function Q(e){if(!(!e||h.config.minDate&&e<h.config.minDate.getFullYear()||h.config.maxDate&&e>h.config.maxDate.getFullYear())){var t=e,n=h.currentYear!==t;h.currentYear=t||h.currentYear,h.config.maxDate&&h.currentYear===h.config.maxDate.getFullYear()?h.currentMonth=Math.min(h.config.maxDate.getMonth(),h.currentMonth):h.config.minDate&&h.currentYear===h.config.minDate.getFullYear()&&(h.currentMonth=Math.max(h.config.minDate.getMonth(),h.currentMonth)),n&&(h.redraw(),ge("onYearChange"),K())}}function X(e,t){void 0===t&&(t=!0);var n=h.parseDate(e,void 0,t);if(h.config.minDate&&n&&w(n,h.config.minDate,void 0!==t?t:!h.minDateHasTime)<0||h.config.maxDate&&n&&w(n,h.config.maxDate,void 0!==t?t:!h.maxDateHasTime)>0)return!1;if(0===h.config.enable.length&&0===h.config.disable.length)return!0;if(void 0===n)return!1;for(var a=h.config.enable.length>0,i=a?h.config.enable:h.config.disable,o=0,r=void 0;o<i.length;o++){if("function"==typeof(r=i[o])&&r(n))return a;if(r instanceof Date&&void 0!==n&&r.getTime()===n.getTime())return a;if("string"==typeof r&&void 0!==n){var l=h.parseDate(r,void 0,!0);return l&&l.getTime()===n.getTime()?a:!a}if("object"==typeof r&&void 0!==n&&r.from&&r.to&&n.getTime()>=r.from.getTime()&&n.getTime()<=r.to.getTime())return a}return!a}function ee(e){return void 0!==h.daysContainer&&(-1===e.className.indexOf("hidden")&&h.daysContainer.contains(e))}function te(e){var t=e.target===h._input,n=h.config.allowInput,a=h.isOpen&&(!n||!t),i=h.config.inline&&t&&!n;if(13===e.keyCode&&t){if(n)return h.setDate(h._input.value,!0,e.target===h.altInput?h.config.altFormat:h.config.dateFormat),e.target.blur();h.open()}else if(V(e.target)||a||i){var o=!!h.timeContainer&&h.timeContainer.contains(e.target);switch(e.keyCode){case 13:o?(e.preventDefault(),T(),de()):se(e);break;case 27:e.preventDefault(),de();break;case 8:case 46:t&&!h.config.allowInput&&(e.preventDefault(),h.clear());break;case 37:case 39:if(o||t)h.hourElement&&h.hourElement.focus();else if(e.preventDefault(),void 0!==h.daysContainer&&(!1===n||document.activeElement&&ee(document.activeElement))){var r=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),G(r),R(W(1),0)):R(void 0,r)}break;case 38:case 40:e.preventDefault();var l=40===e.keyCode?1:-1;h.daysContainer&&void 0!==e.target.$i||e.target===h.input||e.target===h.altInput?e.ctrlKey?(e.stopPropagation(),Q(h.currentYear-l),R(W(1),0)):o||R(void 0,7*l):e.target===h.currentYearElement?Q(h.currentYear-l):h.config.enableTime&&(!o&&h.hourElement&&h.hourElement.focus(),T(e),h._debouncedChange());break;case 9:if(o){var c=[h.hourElement,h.minuteElement,h.secondElement,h.amPM].concat(h.pluginElements).filter(function(e){return e}),d=c.indexOf(e.target);if(-1!==d){var s=c[d+(e.shiftKey?-1:1)];e.preventDefault(),(s||h._input).focus()}}else!h.config.noCalendar&&h.daysContainer&&h.daysContainer.contains(e.target)&&e.shiftKey&&(e.preventDefault(),h._input.focus())}}if(void 0!==h.amPM&&e.target===h.amPM)switch(e.key){case h.l10n.amPM[0].charAt(0):case h.l10n.amPM[0].charAt(0).toLowerCase():h.amPM.textContent=h.l10n.amPM[0],k(),we();break;case h.l10n.amPM[1].charAt(0):case h.l10n.amPM[1].charAt(0).toLowerCase():h.amPM.textContent=h.l10n.amPM[1],k(),we()}(t||V(e.target))&&ge("onKeyDown",e)}function ne(e){if(1===h.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var t=e?e.dateObj.getTime():h.days.firstElementChild.dateObj.getTime(),n=h.parseDate(h.selectedDates[0],void 0,!0).getTime(),a=Math.min(t,h.selectedDates[0].getTime()),i=Math.max(t,h.selectedDates[0].getTime()),o=!1,r=0,l=0,c=a;c<i;c+=C.DAY)X(new Date(c),!0)||(o=o||c>a&&c<i,c<n&&(!r||c>r)?r=c:c>n&&(!l||c<l)&&(l=c));for(var d=0;d<h.config.showMonths;d++)for(var s=h.daysContainer.children[d],u=function(a,i){var c=s.children[a],d=c.dateObj.getTime(),u=r>0&&d<r||l>0&&d>l;return u?(c.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(e){c.classList.remove(e)}),"continue"):o&&!u?"continue":(["startRange","inRange","endRange","notAllowed"].forEach(function(e){c.classList.remove(e)}),void(void 0!==e&&(e.classList.add(t<=h.selectedDates[0].getTime()?"startRange":"endRange"),n<t&&d===n?c.classList.add("startRange"):n>t&&d===n&&c.classList.add("endRange"),d>=r&&(0===l||d<=l)&&b(d,n,t)&&c.classList.add("inRange"))))},f=0,m=s.children.length;f<m;f++)u(f)}}function ae(){!h.isOpen||h.config.static||h.config.inline||le()}function ie(){h.setDate(void 0!==h.config.minDate?new Date(h.config.minDate.getTime()):new Date,!0),S(),we()}function oe(e){return function(t){var n=h.config["_"+e+"Date"]=h.parseDate(t,h.config.dateFormat),a=h.config["_"+("min"===e?"max":"min")+"Date"];void 0!==n&&(h["min"===e?"minDateHasTime":"maxDateHasTime"]=n.getHours()>0||n.getMinutes()>0||n.getSeconds()>0),h.selectedDates&&(h.selectedDates=h.selectedDates.filter(function(e){return X(e)}),h.selectedDates.length||"min"!==e||I(n),we()),h.daysContainer&&(ce(),void 0!==n?h.currentYearElement[e]=n.getFullYear().toString():h.currentYearElement.removeAttribute(e),h.currentYearElement.disabled=!!a&&void 0!==n&&a.getFullYear()===n.getFullYear())}}function re(){"object"!=typeof h.config.locale&&void 0===E.l10ns[h.config.locale]&&h.config.errorHandler(new Error("flatpickr: invalid locale "+h.config.locale)),h.l10n=e({},E.l10ns.default,"object"==typeof h.config.locale?h.config.locale:"default"!==h.config.locale?E.l10ns[h.config.locale]:void 0),p.K="("+h.l10n.amPM[0]+"|"+h.l10n.amPM[1]+"|"+h.l10n.amPM[0].toLowerCase()+"|"+h.l10n.amPM[1].toLowerCase()+")",void 0===e({},g,JSON.parse(JSON.stringify(f.dataset||{}))).time_24hr&&void 0===E.defaultConfig.time_24hr&&(h.config.time_24hr=h.l10n.time_24hr),h.formatDate=v(h),h.parseDate=D({config:h.config,l10n:h.l10n})}function le(e){if(void 0!==h.calendarContainer){ge("onPreCalendarPosition");var t=e||h._positionElement,n=Array.prototype.reduce.call(h.calendarContainer.children,function(e,t){return e+t.offsetHeight},0),a=h.calendarContainer.offsetWidth,i=h.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,l=t.getBoundingClientRect(),d=window.innerHeight-l.bottom,s="above"===o||"below"!==o&&d<n&&l.top>n,u=window.pageYOffset+l.top+(s?-n-2:t.offsetHeight+2);if(c(h.calendarContainer,"arrowTop",!s),c(h.calendarContainer,"arrowBottom",s),!h.config.inline){var f=window.pageXOffset+l.left-(null!=r&&"center"===r?(a-l.width)/2:0),m=window.document.body.offsetWidth-(window.pageXOffset+l.right),g=f+a>window.document.body.offsetWidth,p=m+a>window.document.body.offsetWidth;if(c(h.calendarContainer,"rightMost",g),!h.config.static)if(h.calendarContainer.style.top=u+"px",g)if(p){var v=document.styleSheets[0];if(void 0===v)return;var D=window.document.body.offsetWidth,w=Math.max(0,D/2-a/2),b=v.cssRules.length,C="{left:"+l.left+"px;right:auto;}";c(h.calendarContainer,"rightMost",!1),c(h.calendarContainer,"centerMost",!0),v.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+C,b),h.calendarContainer.style.left=w+"px",h.calendarContainer.style.right="auto"}else h.calendarContainer.style.left="auto",h.calendarContainer.style.right=m+"px";else h.calendarContainer.style.left=f+"px",h.calendarContainer.style.right="auto"}}}function ce(){h.config.noCalendar||h.isMobile||(ve(),J())}function de(){h._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(h.close,0):h.close()}function se(e){e.preventDefault(),e.stopPropagation();var t=function e(t,n){return n(t)?t:t.parentNode?e(t.parentNode,n):void 0}(e.target,function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled")&&!e.classList.contains("notAllowed")});if(void 0!==t){var n=t,a=h.latestSelectedDateObj=new Date(n.dateObj.getTime()),i=(a.getMonth()<h.currentMonth||a.getMonth()>h.currentMonth+h.config.showMonths-1)&&"range"!==h.config.mode;if(h.selectedDateElem=n,"single"===h.config.mode)h.selectedDates=[a];else if("multiple"===h.config.mode){var o=he(a);o?h.selectedDates.splice(parseInt(o),1):h.selectedDates.push(a)}else"range"===h.config.mode&&(2===h.selectedDates.length&&h.clear(!1,!1),h.latestSelectedDateObj=a,h.selectedDates.push(a),0!==w(a,h.selectedDates[0],!0)&&h.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()}));if(k(),i){var r=h.currentYear!==a.getFullYear();h.currentYear=a.getFullYear(),h.currentMonth=a.getMonth(),r&&(ge("onYearChange"),K()),ge("onMonthChange")}if(ve(),J(),we(),h.config.enableTime&&setTimeout(function(){return h.showTimeInput=!0},50),i||"range"===h.config.mode||1!==h.config.showMonths?void 0!==h.selectedDateElem&&void 0===h.hourElement&&h.selectedDateElem&&h.selectedDateElem.focus():L(n),void 0!==h.hourElement&&void 0!==h.hourElement&&h.hourElement.focus(),h.config.closeOnSelect){var l="single"===h.config.mode&&!h.config.enableTime,c="range"===h.config.mode&&2===h.selectedDates.length&&!h.config.enableTime;(l||c)&&de()}Y()}}h.parseDate=D({config:h.config,l10n:h.l10n}),h._handlers=[],h.pluginElements=[],h.loadedPlugins=[],h._bind=F,h._setHoursFromDate=I,h._positionCalendar=le,h.changeMonth=G,h.changeYear=Q,h.clear=function(e,t){void 0===e&&(e=!0);void 0===t&&(t=!0);h.input.value="",void 0!==h.altInput&&(h.altInput.value="");void 0!==h.mobileInput&&(h.mobileInput.value="");h.selectedDates=[],h.latestSelectedDateObj=void 0,!0===t&&(h.currentYear=h._initialDate.getFullYear(),h.currentMonth=h._initialDate.getMonth());h.showTimeInput=!1,!0===h.config.enableTime&&S();h.redraw(),e&&ge("onChange")},h.close=function(){h.isOpen=!1,h.isMobile||(void 0!==h.calendarContainer&&h.calendarContainer.classList.remove("open"),void 0!==h._input&&h._input.classList.remove("active"));ge("onClose")},h._createElement=d,h.destroy=function(){void 0!==h.config&&ge("onDestroy");for(var e=h._handlers.length;e--;){var t=h._handlers[e];t.element.removeEventListener(t.event,t.handler,t.options)}if(h._handlers=[],h.mobileInput)h.mobileInput.parentNode&&h.mobileInput.parentNode.removeChild(h.mobileInput),h.mobileInput=void 0;else if(h.calendarContainer&&h.calendarContainer.parentNode)if(h.config.static&&h.calendarContainer.parentNode){var n=h.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else h.calendarContainer.parentNode.removeChild(h.calendarContainer);h.altInput&&(h.input.type="text",h.altInput.parentNode&&h.altInput.parentNode.removeChild(h.altInput),delete h.altInput);h.input&&(h.input.type=h.input._type,h.input.classList.remove("flatpickr-input"),h.input.removeAttribute("readonly"),h.input.value="");["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","
2isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){try{delete h[e]}catch(e){}})},h.isEnabled=X,h.jumpToDate=A,h.open=function(e,t){void 0===t&&(t=h._positionElement);if(!0===h.isMobile)return e&&(e.preventDefault(),e.target&&e.target.blur()),void 0!==h.mobileInput&&(h.mobileInput.focus(),h.mobileInput.click()),void ge("onOpen");if(h._input.disabled||h.config.inline)return;var n=h.isOpen;h.isOpen=!0,n||(h.calendarContainer.classList.add("open"),h._input.classList.add("active"),ge("onOpen"),le(t));!0===h.config.enableTime&&!0===h.config.noCalendar&&(0===h.selectedDates.length&&ie(),!1!==h.config.allowInput||void 0!==e&&h.timeContainer.contains(e.relatedTarget)||setTimeout(function(){return h.hourElement.select()},50))},h.redraw=ce,h.set=function(e,n){if(null!==e&&"object"==typeof e)for(var a in Object.assign(h.config,e),e)void 0!==ue[a]&&ue[a].forEach(function(e){return e()});else h.config[e]=n,void 0!==ue[e]?ue[e].forEach(function(e){return e()}):t.indexOf(e)>-1&&(h.config[e]=l(n));h.redraw(),we(!1)},h.setDate=function(e,t,n){void 0===t&&(t=!1);void 0===n&&(n=h.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return h.clear(t);fe(e,n),h.showTimeInput=h.selectedDates.length>0,h.latestSelectedDateObj=h.selectedDates[h.selectedDates.length-1],h.redraw(),A(),I(),0===h.selectedDates.length&&h.clear(!1);we(t),t&&ge("onChange")},h.toggle=function(e){if(!0===h.isOpen)return h.close();h.open(e)};var ue={locale:[re,z],showMonths:[q,x,$],minDate:[A],maxDate:[A]};function fe(e,t){var n=[];if(e instanceof Array)n=e.map(function(e){return h.parseDate(e,t)});else if(e instanceof Date||"number"==typeof e)n=[h.parseDate(e,t)];else if("string"==typeof e)switch(h.config.mode){case"single":case"time":n=[h.parseDate(e,t)];break;case"multiple":n=e.split(h.config.conjunction).map(function(e){return h.parseDate(e,t)});break;case"range":n=e.split(h.l10n.rangeSeparator).map(function(e){return h.parseDate(e,t)})}else h.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));h.selectedDates=n.filter(function(e){return e instanceof Date&&X(e,!1)}),"range"===h.config.mode&&h.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()})}function me(e){return e.slice().map(function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?h.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:h.parseDate(e.from,void 0),to:h.parseDate(e.to,void 0)}:e}).filter(function(e){return e})}function ge(e,t){if(void 0!==h.config){var n=h.config[e];if(void 0!==n&&n.length>0)for(var a=0;n[a]&&a<n.length;a++)n[a](h.selectedDates,h.input.value,h,t);"onChange"===e&&(h.input.dispatchEvent(pe("change")),h.input.dispatchEvent(pe("input")))}}function pe(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}function he(e){for(var t=0;t<h.selectedDates.length;t++)if(0===w(h.selectedDates[t],e))return""+t;return!1}function ve(){h.config.noCalendar||h.isMobile||!h.monthNav||(h.yearElements.forEach(function(e,t){var n=new Date(h.currentYear,h.currentMonth,1);n.setMonth(h.currentMonth+t),h.config.showMonths>1||"static"===h.config.monthSelectorType?h.monthElements[t].textContent=m(n.getMonth(),h.config.shorthandCurrentMonth,h.l10n)+" ":h.monthsDropdownContainer.value=n.getMonth().toString(),e.value=n.getFullYear().toString()}),h._hidePrevMonthArrow=void 0!==h.config.minDate&&(h.currentYear===h.config.minDate.getFullYear()?h.currentMonth<=h.config.minDate.getMonth():h.currentYear<h.config.minDate.getFullYear()),h._hideNextMonthArrow=void 0!==h.config.maxDate&&(h.currentYear===h.config.maxDate.getFullYear()?h.currentMonth+1>h.config.maxDate.getMonth():h.currentYear>h.config.maxDate.getFullYear()))}function De(e){return h.selectedDates.map(function(t){return h.formatDate(t,e)}).filter(function(e,t,n){return"range"!==h.config.mode||h.config.enableTime||n.indexOf(e)===t}).join("range"!==h.config.mode?h.config.conjunction:h.l10n.rangeSeparator)}function we(e){void 0===e&&(e=!0),void 0!==h.mobileInput&&h.mobileFormatStr&&(h.mobileInput.value=void 0!==h.latestSelectedDateObj?h.formatDate(h.latestSelectedDateObj,h.mobileFormatStr):""),h.input.value=De(h.config.dateFormat),void 0!==h.altInput&&(h.altInput.value=De(h.config.altFormat)),!1!==e&&ge("onValueUpdate")}function be(e){var t=h.prevMonthNav.contains(e.target),n=h.nextMonthNav.contains(e.target);t||n?G(t?-1:1):h.yearElements.indexOf(e.target)>=0?e.target.select():e.target.classList.contains("arrowUp")?h.changeYear(h.currentYear+1):e.target.classList.contains("arrowDown")&&h.changeYear(h.currentYear-1)}return function(){h.element=h.input=f,h.isOpen=!1,function(){var a=["wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],i=e({},g,JSON.parse(JSON.stringify(f.dataset||{}))),o={};h.config.parseDate=i.parseDate,h.config.formatDate=i.formatDate,Object.defineProperty(h.config,"enable",{get:function(){return h.config._enable},set:function(e){h.config._enable=me(e)}}),Object.defineProperty(h.config,"disable",{get:function(){return h.config._disable},set:function(e){h.config._disable=me(e)}});var r="time"===i.mode;if(!i.dateFormat&&(i.enableTime||r)){var c=E.defaultConfig.dateFormat||n.dateFormat;o.dateFormat=i.noCalendar||r?"H:i"+(i.enableSeconds?":S":""):c+" H:i"+(i.enableSeconds?":S":"")}if(i.altInput&&(i.enableTime||r)&&!i.altFormat){var d=E.defaultConfig.altFormat||n.altFormat;o.altFormat=i.noCalendar||r?"h:i"+(i.enableSeconds?":S K":" K"):d+" h:i"+(i.enableSeconds?":S":"")+" K"}i.altInputClass||(h.config.altInputClass=h.input.className+" "+h.config.altInputClass),Ob
vendor: 9,055 bytes, line 2
2ject.defineProperty(h.config,"minDate",{get:function(){return h.config._minDate},set:oe("min")}),Object.defineProperty(h.config,"maxDate",{get:function(){return h.config._maxDate},set:oe("max")});var s=function(e){return function(t){h.config["min"===e?"_minTime":"_maxTime"]=h.parseDate(t,"H:i:S")}};Object.defineProperty(h.config,"minTime",{get:function(){return h.config._minTime},set:s("min")}),Object.defineProperty(h.config,"maxTime",{get:function(){return h.config._maxTime},set:s("max")}),"time"===i.mode&&(h.config.noCalendar=!0,h.config.enableTime=!0),Object.assign(h.config,o,i);for(var u=0;u<a.length;u++)h.config[a[u]]=!0===h.config[a[u]]||"true"===h.config[a[u]];t.filter(function(e){return void 0!==h.config[e]}).forEach(function(e){h.config[e]=l(h.config[e]||[]).map(y)}),h.isMobile=!h.config.disableMobile&&!h.config.inline&&"single"===h.config.mode&&!h.config.disable.length&&!h.config.enable.length&&!h.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var u=0;u<h.config.plugins.length;u++){var m=h.config.plugins[u](h)||{};for(var p in m)t.indexOf(p)>-1?h.config[p]=l(m[p]).map(y).concat(h.config[p]):void 0===i[p]&&(h.config[p]=m[p])}ge("onParseConfig")}(),re(),h.input=h.config.wrap?f.querySelector("[data-input]"):f,h.input?(h.input._type=h.input.type,h.input.type="text",h.input.classList.add("flatpickr-input"),h._input=h.input,h.config.altInput&&(h.altInput=d(h.input.nodeName,h.config.altInputClass),h._input=h.altInput,h.altInput.placeholder=h.input.placeholder,h.altInput.disabled=h.input.disabled,h.altInput.required=h.input.required,h.altInput.tabIndex=h.input.tabIndex,h.altInput.type="text",h.input.setAttribute("type","hidden"),!h.config.static&&h.input.parentNode&&h.input.parentNode.insertBefore(h.altInput,h.input.nextSibling)),h.config.allowInput||h._input.setAttribute("readonly","readonly"),h._positionElement=h.config.positionElement||h._input):h.config.errorHandler(new Error("Invalid input element specified")),function(){h.selectedDates=[],h.now=h.parseDate(h.config.now)||new Date;var e=h.config.defaultDate||("INPUT"!==h.input.nodeName&&"TEXTAREA"!==h.input.nodeName||!h.input.placeholder||h.input.value!==h.input.placeholder?h.input.value:null);e&&fe(e,h.config.dateFormat),h._initialDate=h.selectedDates.length>0?h.selectedDates[0]:h.config.minDate&&h.config.minDate.getTime()>h.now.getTime()?h.config.minDate:h.config.maxDate&&h.config.maxDate.getTime()<h.now.getTime()?h.config.maxDate:h.now,h.currentYear=h._initialDate.getFullYear(),h.currentMonth=h._initialDate.getMonth(),h.selectedDates.length>0&&(h.latestSelectedDateObj=h.selectedDates[0]),void 0!==h.config.minTime&&(h.config.minTime=h.parseDate(h.config.minTime,"H:i")),void 0!==h.config.maxTime&&(h.config.maxTime=h.parseDate(h.config.maxTime,"H:i")),h.minDateHasTime=!!h.config.minDate&&(h.config.minDate.getHours()>0||h.config.minDate.getMinutes()>0||h.config.minDate.getSeconds()>0),h.maxDateHasTime=!!h.config.maxDate&&(h.config.maxDate.getHours()>0||h.config.maxDate.getMinutes()>0||h.config.maxDate.getSeconds()>0),Object.defineProperty(h,"showTimeInput",{get:function(){return h._showTimeInput},set:function(e){h._showTimeInput=e,h.calendarContainer&&c(h.calendarContainer,"showTimeInput",e),h.isOpen&&le()}})}(),h.utils={getDaysInMonth:function(e,t){return void 0===e&&(e=h.currentMonth),void 0===t&&(t=h.currentYear),1===e&&(t%4==0&&t%100!=0||t%400==0)?29:h.l10n.daysInMonth[e]}},h.isMobile||function(){var e=window.document.createDocumentFragment();if(h.calendarContainer=d("div","flatpickr-calendar"),h.calendarContainer.tabIndex=-1,!h.config.noCalendar){if(e.appendChild((h.monthNav=d("div","flatpickr-months"),h.yearElements=[],h.monthElements=[],h.prevMonthNav=d("span","flatpickr-prev-month"),h.prevMonthNav.innerHTML=h.config.prevArrow,h.nextMonthNav=d("span","flatpickr-next-month"),h.nextMonthNav.innerHTML=h.config.nextArrow,q(),Object.defineProperty(h,"_hidePrevMonthArrow",{get:function(){return h.__hidePrevMonthArrow},set:function(e){h.__hidePrevMonthArrow!==e&&(c(h.prevMonthNav,"flatpickr-disabled",e),h.__hidePrevMonthArrow=e)}}),Object.defineProperty(h,"_hideNextMonthArrow",{get:function(){return h.__hideNextMonthArrow},set:function(e){h.__hideNextMonthArrow!==e&&(c(h.nextMonthNav,"flatpickr-disabled",e),h.__hideNextMonthArrow=e)}}),h.currentYearElement=h.yearElements[0],ve(),h.monthNav)),h.innerContainer=d("div","flatpickr-innerContainer"),h.config.weekNumbers){var t=function(){h.calendarContainer.classList.add("hasWeeks");var e=d("div","flatpickr-weekwrapper");e.appendChild(d("span","flatpickr-weekday",h.l10n.weekAbbreviation));var t=d("div","flatpickr-weeks");return e.appendChild(t),{weekWrapper:e,weekNumbers:t}}(),n=t.weekWrapper,a=t.weekNumbers;h.innerContainer.appendChild(n),h.weekNumbers=a,h.weekWrapper=n}h.rContainer=d("div","flatpickr-rContainer"),h.rContainer.appendChild($()),h.daysContainer||(h.daysContainer=d("div","flatpickr-days"),h.daysContainer.tabIndex=-1),J(),h.rContainer.appendChild(h.daysContainer),h.innerContainer.appendChild(h.rContainer),e.appendChild(h.innerContainer)}h.config.enableTime&&e.appendChild(function(){h.calendarContainer.classList.add("hasTime"),h.config.noCalendar&&h.calendarContainer.classList.add("noCalendar"),h.timeContainer=d("div","flatpickr-time"),h.timeContainer.tabIndex=-1;var e=d("span","flatpickr-time-separator",":"),t=u("flatpickr-hour",{"aria-label":h.l10n.hourAriaLabel});h.hourElement=t.getElementsByTagName("input")[0];var n=u("flatpickr-minute",{"aria-label":h.l10n.minuteAriaLabel});if(h.minuteElement=n.getElementsByTagName("input")[0],h.hourElement.tabIndex=h.minuteElement.tabIndex=-1,h.hourElement.value=i(h.latestSelectedDateObj?h.latestSelectedDateObj.getHours():h.config.time_24hr?h.config.defaultHour:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(h.config.defaultHour)),h.minuteElement.value=i(h.latestSelectedDateObj?h.latestSelectedDateObj.getMinutes():h.config.defaultMinute),h.hourElement.setAttribute("step",h.config.hourIncrement.toString()),h.minuteElement.setAttribute("step",h.config.minuteIncrement.toString()),h.hourElement.setAttribute("min",h.config.time_24hr?"0":"1"),h.hourElement.setAttribute("max",h.config.time_24hr?"23":"12"),h.minuteElement.setAttribute("min","0"),h.minuteElement.setAttribute("max","59"),h.timeContainer.appendChild(t),h.timeContainer.appendChild(e),h.timeContainer.appendChild(n),h.config.time_24hr&&h.timeContainer.classList.add("time24hr"),h.config.enableSeconds){h.timeContainer.classList.add("hasSeconds");var a=u("flatpickr-second");h.secondElement=a.getElementsByTagName("input")[0],h.secondElement.value=i(h.latestSelectedDateObj?h.latestSelectedDateObj.getSeconds():h.config.defaultSeconds),h.secondElement.setAttribute("step",h.minuteElement.getAttribute("step")),h.secondElement.setAttribute("min","0"),h.secondElement.setAttribute("max","59"),h.timeContainer.appendChild(d("span","flatpickr-time-separator",":")),h.timeContainer.appendChild(a)}return h.config.time_24hr||(h.amPM=d("span","flatpickr-am-pm",h.l10n.amPM[o((h.latestSelectedDateObj?h.hourElement.value:h.config.defaultHour)>11)]),h.amPM.title=h.l10n.toggleTitle,h.amPM.tabIndex=-1,h.timeContainer.appendChild(h.amPM)),h.timeContainer}()),c(h.calendarContainer,"rangeMode","range"===h.config.mode),c(h.calendarContainer,"animate",!0===h.config.animate),c(h.calendarContainer,"multiMonth",h.config.showMonths>1),h.calendarContainer.appendChild(e);var r=void 0!==h.config.appendTo&&void 0!==h.config.appendTo.nodeType;if((h.config.inline||h.config.static)&&(h.calendarContainer.classList.add(h.config.inline?"inline":"static"),h.config.inline&&(!r&&h.element.parentNode?h.element.parentNode.insertBefore(h.calendarContainer,h._input.nextSibling):void 0!==h.config.appendTo&&h.config.appendTo.appendChild(h.calendarContainer)),h.config.static)){var l=d("div","flatpickr-wrapper");h.element.parentNode&&h.element.parentNode.insertBefore(l,h.element),l.appendChild(h.element),h.altInput&&l.appendChild(h.altInput),l.appendChild(h.calendarContainer)}h.config.static||h.config.inline||(void 0!==h.config.appendTo?h.config.appendTo:window.document.body).appendChild(h.calendarContainer)}(),function(){if(h.config.wrap&&["open","close","toggle","clear"].forEach(function(e){Array.prototype.forEach.call(h.element.querySelectorAll("[data-"+e+"]"),function(t){return F(t,"click",h[e])})}),h.isMobile)!function(){var e=h.config.enableTime?h.config.noCalendar?"time":"datetime-local":"date";h.mobileInput=d("input",h.input.className+" flatpickr-mobile"),h.mobileInput.step=h.input.getAttribute("step")||"any",h.mobileInput.tabIndex=1,h.mobileInput.type=e,h.mobileInput.disabled=h.input.disabled,h.mobileInput.required=h.input.required,h.mobileInput.placeholder=h.input.placeholder,h.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",h.selectedDates.length>0&&(h.mobileInput.defaultValue=h.mobileInput.value=h.formatDate(h.selectedDates[0],h.mobileFormatStr)),h.config.minDate&&(h.mobileInput.min=h.formatDate(h.c
2onfig.minDate,"Y-m-d")),h.config.maxDate&&(h.mobileInput.max=h.formatDate(h.config.maxDate,"Y-m-d")),h.input.type="hidden",void 0!==h.altInput&&(h.altInput.type="hidden");try{h.input.parentNode&&h.input.parentNode.insertBefore(h.mobileInput,h.input.nextSibling)}catch(e){}F(h.mobileInput,"change",function(e){h.setDate(e.target.value,!1,h.mobileFormatStr),ge("onChange"),ge("onClose")})}();else{var e=r(ae,50);h._debouncedChange=r(Y,M),h.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&F(h.daysContainer,"mouseover",function(e){"range"===h.config.mode&&ne(e.target)}),F(window.document.body,"keydown",te),h.config.inline||h.config.static||F(window,"resize",e),void 0!==window.ontouchstart?F(window.document,"touchstart",Z):F(window.document,"mousedown",N(Z)),F(window.document,"focus",Z,{capture:!0}),!0===h.config.clickOpens&&(F(h._input,"focus",h.open),F(h._input,"mousedown",N(h.open))),void 0!==h.daysContainer&&(F(h.monthNav,"mousedown",N(be)),F(h.monthNav,["keyup","increment"],_),F(h.daysContainer,"mousedown",N(se))),void 0!==h.timeContainer&&void 0!==h.minuteElement&&void 0!==h.hourElement&&(F(h.timeContainer,["increment"],T),F(h.timeContainer,"blur",T,{capture:!0}),F(h.timeContainer,"mousedown",N(P)),F([h.hourElement,h.minuteElement],["focus","click"],function(e){return e.target.select()}),void 0!==h.secondElement&&F(h.secondElement,"focus",function(){return h.secondElement&&h.secondElement.select()}),void 0!==h.amPM&&F(h.amPM,"mousedown",N(function(e){T(e),Y()})))}}(),(h.selectedDates.length||h.config.noCalendar)&&(h.config.enableTime&&I(h.config.noCalendar?h.latestSelectedDateObj||h.config.minDate:void 0),we(!1)),x(),h.showTimeInput=h.selectedDates.length>0||h.config.noCalendar;var a=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!h.isMobile&&a&&le(),ge("onReady")}(),h}function x(e,t){for(var n=Array.prototype.slice.call(e).filter(function(e){return e instanceof HTMLElement}),a=[],i=0;i<n.length;i++){var o=n[i];try{if(null!==o.getAttribute("data-fp-omit"))continue;void 0!==o._flatpickr&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=y(o,t||{}),a.push(o._flatpickr)}catch(e){console.error(e)}}return 1===a.length?a[0]:a}"undefined"!=typeof HTMLElement&&"undefined"!=typeof HTMLCollection&&"undefined"!=typeof NodeList&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return x(this,e)},HTMLElement.prototype.flatpickr=function(e){return x([this],e)});var E=function(e,t){return"string"==typeof e?x(window.document.querySelectorAll(e),t):e instanceof Node?x([e],t):x(e,t)};return E.defaultConfig={},E.l10ns={en:e({},a),default:e({},a)},E.localize=function(t){E.l10ns.default=e({},E.l10ns.default,t)},E.setDefaults=function(t){E.defaultConfig=e({},E.defaultConfig,t)},E.parseDate=D({}),E.formatDate=v({}),E.compareDates=w,"undefined"!=typeof jQuery&&void 0!==jQuery.fn&&(jQuery.fn.flatpickr=function(e){return x(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},"undefined"!=typeof window&&(window.flatpickr=E),E});
3(function (global, factory) {
4    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
5    typeof define === 'function' && define.amd ? define(['exports'], factory) :
6    (global = global || self, factory(global.it = {}));
7  }(this, function (exports) { 'use strict';
8  
9    var fp = typeof window !== "undefined" && window.flatpickr !== undefined
10        ? window.flatpickr
11        : {
12            l10ns: {}
13        };
14    var Italian = {
15        weekdays: {
16            shorthand: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"],
17            longhand: [
18                "Domenica",
19                "Lunedì",
20                "Martedì",
21                "Mercoledì",
22                "Giovedì",
23                "Venerdì",
24                "Sabato",
25            ]
26        },
27        months: {
28            shorthand: [
29                "Gen",
30                "Feb",
31                "Mar",
32                "Apr",
33                "Mag",
34                "Giu",
35                "Lug",
36                "Ago",
37                "Set",
38                "Ott",
39                "Nov",
40                "Dic",
41            ],
42            longhand: [
43                "Gennaio",
44                "Febbraio",
45                "Marzo",
46                "Aprile",
47                "Maggio",
48                "Giugno",
49                "Luglio",
50                "Agosto",
51                "Settembre",
52                "Ottobre",
53                "Novembre",
54                "Dicembre",
55            ]
56        },
57        firstDayOfWeek: 1,
58        ordinal: function () { return "°"; },
59        rangeSeparator: " al ",
60        weekAbbreviation: "Se",
61        scrollTitle: "Scrolla per aumentare",
62        toggleTitle: "Clicca per cambiare",
63        time_24hr: true
64    };
65    fp.l10ns.it = Italian;
66    var it = fp.l10ns;
67  
68    exports.Italian = Italian;
69    exports.default = it;
70  
71    Object.defineProperty(exports, '__esModule', { value: true });
72  
73  }));
74(function (global, factory) {
75    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
76    typeof define === 'function' && define.amd ? define(['exports'], factory) :
77    (global = global || self, factory(global.de = {}));
78  }(this, function (exports) { 'use strict';
79  
80    var fp = typeof window !== "undefined" && window.flatpickr !== undefined
81        ? window.flatpickr
82        : {
83            l10ns: {}
84        };
85    var German = {
86        weekdays: {
87            shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
88            longhand: [
89                "Sonntag",
90                "Montag",
91                "Dienstag",
92                "Mittwoch",
93                "Donnerstag",
94                "Freitag",
95                "Samstag",
96            ]
97        },
98        months: {
99            shorthand: [
100                "Jan",
101                "Feb",
102                "Mär",
103                "Apr",
104                "Mai",
105                "Jun",
106                "Jul",
107                "Aug",
108                "Sep",
109                "Okt",
110                "Nov",
111                "Dez",
112            ],
113            longhand: [
114                "Januar",
115                "Februar",
116                "März",
117                "April",
118                "Mai",
119                "Juni",
120                "Juli",
121                "August",
122                "September",
123                "Oktober",
124                "November",
125                "Dezember",
126            ]
127        },
128        firstDayOfWeek: 1,
129        weekAbbreviation: "KW",
130        rangeSeparator: " bis ",
131        scrollTitle: "Zum Ändern scrollen",
132        toggleTitle: "Zum Umschalten klicken",
133        time_24hr: true
134    };
135    fp.l10ns.de = German;
136    var de = fp.l10ns;
137  
138    exports.German = German;
139    exports.default = de;
140  
141    Object.defineProperty(exports, '__esModule', { value: true });
142  
143  }));
144(function (global, factory) {
145    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
146    typeof define === 'function' && define.amd ? define(['exports'], factory) :
147    (global = global || self, factory(global.es = {}));
148  }(this, function (exports) { 'use strict';
149  
150    var fp = typeof window !== "undefined" && window.flatpickr !== undefined
151        ? window.flatpickr
152        : {
153            l10ns: {}
154        };
155    var Spanish = {
156        weekdays: {
157            shorthand: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"],
158            longhand: [
159                "Domingo",
160                "Lunes",
161                "Martes",
162                "Miércoles",
163                "Jueves",
164                "Viernes",
165                "Sábado",
166            ]
167        },
168        months: {
169            shorthand: [
170                "Ene",
171                "Feb",
172                "Mar",
173                "Abr",
174                "May",
175                "Jun",
176                "Jul",
177                "Ago",
178                "Sep",
179                "Oct",
180                "Nov",
181                "Dic",
182            ],
183            longhand: [
184                "Enero",
185                "Febrero",
186                "Marzo",
187                "Abril",
188                "Mayo",
189                "Junio",
190                "Julio",
191                "Agosto",
192                "Septiembre",
193                "Octubre",
194                "Noviembre",
195                "Diciembre",
196            ]
197        },
198        ordinal: function () {
199            return "º";
200        },
201        firstDayOfWeek: 1,
202        rangeSeparator: " a ",
203        time_24hr: true
204    };
205    fp.l10ns.es = Spanish;
206    var es = fp.l10ns;
207  
208    exports.Spanish = Spanish;
209    exports.default = es;
210  
211    Object.defineProperty(exports, '__esModule', { value: true });
212  
213  }));
214(function (global, factory) {
215    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
216    typeof define === 'function' && define.amd ? define(['exports'], factory) :
217    (global = global || self, factory(global.fr = {}));
218  }(this, function (exports) { 'use strict';
219  
220    var fp = typeof window !== "undefined" && window.flatpickr !== undefined
221        ? window.flatpickr
222        : {
223            l10ns: {}
224        };
225    var French = {
226        firstDayOfWeek: 1,
227        weekdays: {
228            shorthand: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"],
229            longhand: [
230                "dimanche",
231                "lundi",
232                "mardi",
233                "mercredi",
234                "jeudi",
235                "vendredi",
236                "samedi",
237            ]
238        },
239        months: {
240            shorthand: [
241                "janv",
242                "févr",
243                "mars",
244                "avr",
245                "mai",
246                "juin",
247                "juil",
248                "août",
249                "sept",
250                "oct",
251                "nov",
252                "déc",
253            ],
254            longhand: [
255                "janvier",
256                "février",
257                "mars",
258                "avril",
259                "mai",
260                "juin",
261                "juillet",
262                "août",
263                "septembre",
264                "octobre",
265                "novembre",
266                "décembre",
267            ]
268        },
269        ordinal: function (nth) {
270            if (nth > 1)
271                return "";
272            return "er";
273        },
274        rangeSeparator: " au ",
275        weekAbbreviation: "Sem",
276        scrollTitle: "Défiler pour augmenter la valeur",
277        toggleTitle: "Cliquer pour basculer",
278        time_24hr: true
279    };
280    fp.l10ns.fr = French;
281    var fr = fp.l10ns;
282  
283    exports.French = French;
284    exports.default = fr;
285  
286    Object.defineProperty(exports, '__esModule', { value: true });
287  
288  }));
289var form_csrf_token = null;
290
291fetch('/token', {
292    method: 'get',
293    headers: {
294        'Content-type': 'text/json; charset=UTF-8'
295    }
296}).then(function(response) {
297    if (response.ok) {
298        return response.text();
299    }
300    return Promise.reject(response);
301}).then(function(data) {
302
303    formScripts(data);
304    form_csrf_token = data;
305}).catch(function(error) {
306    console.warn('errore token.', error);
307});
308
309//si occupa di aggiungere calendario, camere, bambini età bambini dipendentemente dal tipo di form
310function formScripts(token) {
311    var forms = document.querySelectorAll('.editaForms');
312
313    forms.forEach((form, index) => {
314
315        var formtype = form.querySelector('input[name=form_type]').value;
316        var formid = form.getAttribute('data-formid');
317        var max_rooms = form.dataset.max_rooms;
318        var bloccocamere = form.querySelectorAll('.bloccocamere');
319        var i = 1; // salto la prima camera che rimane visibile
320        var l = bloccocamere.length;
321        //   console.log(formid);
322
323        var inputToken = document.createElement("input");
324        inputToken.setAttribute('type', 'hidden');
325        inputToken.setAttribute('value', token);
326        inputToken.setAttribute('name', '_token');
327        document.querySelector('#contactForm-' + formid).appendChild(inputToken);
328        
329        const today = new Date();
330        var openDate = (form.getAttribute('data-opendate') === null || form.getAttribute('data-opendate') === "") ? '' : new Date(form.getAttribute('data-opendate')) ;
331        var closeDate = (form.getAttribute('data-closedate') === null || form.getAttribute('data-closedate') === "") ? '' : new Date(form.getAttribute('data-closedate'));
332        var defaultDate = today;
333        
334        console.log('closedate',closeDate);
335        
336        if(today > closeDate){
337            openDate = new Date();
338            closeDate = '';
339        }
340        if(openDate !== '' && today < openDate){
341            defaultDate = openDate;
342        }
343         
344        if (typeof hideDefaultDate !== 'undefined' && hideDefaultDate === false) {
345            console.log('asdfasfasasf');
346        }else{
347            console.log('undefined');
348        }
349
350        // typeof hideDefaultDate !== 'undefined'
351        // se hidedefaultdate è definito && hidedefaultdate==true -> nascondi le date
352        // se hidedefaultdate è definito && hidedefaultdate==false -> visualizza le date
353
354        var optionsCalendar = {
355            "partenza": {
356                locale: lang,
357                altInput:       true,
358                altFormat:      "d-m-Y",
359                dateFormat:     "d-m-Y",
360                defaultDate:    ( typeof hideDefaultDate === 'undefined' || hideDefaultDate === false) ? defaultDate.fp_incr(global_diff_date_days) : '',
361                minDate:        openDate,
362                // maxDate:        closeDate,
363            },
364            "arrivo": {
365                locale: lang,
366                altInput:       true,
367                altFormat:      "d-m-Y",
368                dateFormat:     "d-m-Y",
369                defaultDate:    ( typeof hideDefaultDate === 'undefined' || hideDefaultDate === false) ? defaultDate : '',
370                minDate:        openDate,
371                // maxDate:        closeDate,
372                // disable: [
373                //     function(date) {
374                //             return !(
375                //                 (date.getDate() >= 10 && date.getMonth() == 4) || 
376                //                 (date.getMonth() >= 5 && date.getMonth() < 8) ||
377                //                 (date.getDate() <= 20 && date.getMonth() == 8)
378                //             )
379                //     }
380                // ],
381                /* setting initial date of return picker to the one selected in  outbound*/
382                onChange: function(dateStr, dateObj) {
383                    var newdate;
384                    var dateString = dateObj;
385                    var dateParts = dateString.split("-");
386                    // month is 0-based, that's why we need dataParts[1] - 1
387                    var dateObject = new Date(+dateParts[2], dateParts[1] - 1, +dateParts[0]);
388
389                    newdate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
390
391                    FLATPICKER_RITORNO.set("minDate", new Date(newdate.getTime() + (86400000)));
392                    FLATPICKER_RITORNO.setDate(new Date(newdate.getTime() + (86400000 * global_diff_date_after_change) ));
393                }
394            }
395        };
396
397        if (formtype == 'quote' || formtype == 'booking') {
398            var FLATPICKER_RITORNO = flatpickr('#data_partenza-' + formid, optionsCalendar.partenza);
399
400            flatpickr("#data_arrivo-" + formid, optionsCalendar.arrivo);
401        }
402
403        if (formtype == 'meeting') {
404            flatpickr("#datainizioevento-" + formid, {
405                locale: lang,
406                altInput: true,
407                altFormat: "d-m-Y",
408                dateFormat: "d-m-Y",
409                defaultDate: new Date(),
410                minDate: new Date(),
411            });
412        }
413        if (formtype == 'restaurant') {
414            flatpickr("#giornoprenotazione-" + formid, {
415                locale: lang,
416                altInput: true,
417                altFormat: "d-m-Y",
418                dateFormat: "d-m-Y",
419                defaultDate: new Date(),
420                minDate: new Date(),
421            });
422        }
423
424        if (formtype == 'quote') {
425            //setta la visibilità delle camere a 0
426            for (i; i < l; i++) {
427                bloccocamere[i].style.display = 'none';
428            }
429
430            //all'on change di numero camere visualizzo i blocchi corrispondenti
431            var selectNumCamere = form.querySelector("#rooms-" + formid);
432            if (selectNumCamere) {
433                selectNumCamere.addEventListener('change', function() {
434                    if (this.value) {
435                        for (var j = 1; j <= max_rooms; j++) {
436                            form.querySelector('#room' + j + '-' + formid).style.display = 'none';
437                            form.querySelector('#room' + j + '-' + formid).querySelector('#adultsRoom' + j + '-' + formid).disabled = true;
438                            form.querySelector('#room' + j + '-' + formid).querySelector('#childrensRoom' + j + '-' + formid).disabled = true;
439                        }
440
441                        var numRooms = this.value;
442                        for (var j = 1; j <= numRooms; j++) {
443                            form.querySelector('#room' + j + '-' + formid).style.display = 'block';
444                            form.querySelector('#room' + j + '-' + formid).querySelector('#adultsRoom' + j + '-' + formid).disabled = false;
445                            form.querySelector('#room' + j + '-' + formid).querySelector('#childrensRoom' + j + '-' + formid).disabled = false;
446                        }
447
448                    } else {
449                        for (var j = 1; j <= max_rooms; j++) {
450                            form.querySelector('#room' + j + '-' + formid).style.display = 'none';
451                            form.querySelector('#room' + j + '-' + formid).querySelector('#adultsRoom' + j + '-' + formid).disabled = true;
452                            form.querySelector('#room' + j + '-' + formid).querySelector('#childrensRoom' + j + '-' + formid).disabled = true;
453
454                        }
455                    }
456                });
457            }
458
459            //all'onchange di num bambini, per ogni camera visualizzo l'età
460            var selectBambini = form.querySelectorAll("select.numbambini").forEach(item => {
461                item.addEventListener('change', function() {
462                    var container = item.closest('.bloccocamere');
463                    var room = this.dataset.room;
464                    var numChildren = this.value;
465
466                    container.querySelectorAll('.bloccoetabambini').forEach(function(element) {
467                        element.style.display = 'none';
468                        element.querySelector('select').disabled = true;
469                    });
470
471                    for (var i = 1; i <= numChildren; i++) {
472                        container.querySelector('#bloccoetabambini' + i + 'camera' + room + '-' + formid).style.display = 'block';
473                        container.querySelector('#bloccoetabambini' + i + 'camera' + room + '-' + formid).querySelector('select').disabled = false;
474                    }
475                })
476            });
477        }
478
479        form.onsubmit = function(e) {
480            e.preventDefault();
481            var form_id = e.target.dataset.formid;
482            var button = e.target.querySelector('#sendMessageButton-' + form_id);
483
484            if (!validateForm(form_id)) {
485                return false;
486            }
487
488            if (!e.target.classList.contains('formBooking')) {
489                button.setAttribute('disabled', 'disabled');
490            }
491
492			// INIZIO / mrpreno attribution
493			try {
494				if( window.MrPRENODataAcq != undefined &&  typeof( window.MrPRENODataAcq.getAttribution ) == "function" ) {
495
496					if( form.querySelector('[name="data[attribution]"]') == null ) {
497
498						var iAttribution = document.createElement("input");
499						iAttribution.setAttribute("type", "hidden");
500						iAttribution.setAttribute("name", "data[attribution]");
501						iAttribution.setAttribute("value", window.MrPRENODataAcq.getAttribution());
502
503						form.append( iAttribution );
504					}
505				}
506			} catch(e) {
507				console.log('[mrpreno attribution]', e);
508			}
509			// FINE / mrpreno attribution
510
511            HTMLFormElement.prototype.submit.call(form);
512
513        };
514
515
516        var onLoadFormEvent = new CustomEvent("onLoadForm");
517
518        form.dispatchEvent(onLoadFormEvent);
519    });
520
521}
522
523//funzione globale per la validazione dei campi 
524function validateForm(formid) {
525    var errors = [];
526    var form = document.forms["contactForm-" + formid];
527    var elements = form.elements;
528	const atLeastOne = form.querySelectorAll('[data-atleastone]');
529
530    for (var i = 0, element; element = elements[i++];) {
531
532        element.classList.remove('error');
533        if ((element.type === "text" || (element.type === "hidden" && (element.classList.contains('data-arrivo') || element.classList.contains('data-partenza')))) && element.value === "" && element.i
533d && element.attributes["required"]) {
534            errors.push({
535                'id': element.id,
536                'status': 'error',
537                'label': 'label'
538            });
539        }
540        if (element.type === "time" && element.value === "" && element.attributes["required"]) {
541            errors.push({
542                'id': element.id,
543                'status': 'error',
544                'label': 'label'
545            });
546        }
547
548        if (element.type === "email" && !element.validity.valid && element.attributes["required"]) {
549            errors.push({
550                'id': element.id,
551                'status': 'error',
552                'label': 'label'
553            });
554        }
555        if (element.type === "file" && element.value === "" && element.attributes["required"]) {
556            errors.push({
557                'id': element.id,
558                'status': 'error',
559                'label': 'label'
560            });
561        }
562        if (element.type === "date" && element.value === "" && element.attributes["required"]) {
563            errors.push({
564                'id': element.id,
565                'element': element,
566                'status': 'error',
567                'label': 'label'
568            });
569        }
570        if (element.type === "textarea" && element.value === "" && element.attributes["required"]) {
571            errors.push({
572                'id': element.id,
573                'status': 'error',
574                'label': 'label'
575            });
576        }
577        if (element.type === "select-one" && element.value === "" && element.attributes["required"] && !element.attributes["disabled"]) {
578            errors.push({
579                'id': element.id,
580                'status': 'error',
581                'label': 'label'
582            });
583        }
584        if (element.type === "checkbox" && !element.checked && element.attributes["required"]) {
585			// questi sono checkbox obbligatori con un singolo/unico valore
586            errors.push({
587                'id': element.id,
588                'status': 'error',
589                'label': 'label'
590            });
591        }
592    }
593
594	// per i checkbox obbligatori, con più di 1 valore, controllo
595	// che abbiano selezionato almeno 1 valore
596	for(const checkBlock of atLeastOne) {
597		if(checkBlock.querySelector('[type="checkbox"]:checked') == null) {
598
599			checkBlock.querySelectorAll('[type="checkbox"]').forEach(function(input) {
600				errors.push({
601					'element': input,
602					'status': 'error',
603					'label': 'label'
604				});
605			});
606		}
607	}
608
609    if (errors.length !== 0) {
610        errors.forEach(function(error) {
611            var el;
612            if (error.id) {
613                el = document.getElementById(error.id);
614                if (el.classList.contains('data-arrivo') || el.classList.contains('data-partenza')) {
615                    el = el.nextElementSibling;
616                }
617            } else if (error.element) {
618                el = error.element;
619            }
620
621            el.classList.add('error');
622        });
623
624        var langValue = document.getElementById('lang-' + formid).value;
625
626        switch (langValue) {
627            case 'it':
628                var warningText = "Attenzione! Uno o più campi obbligatori non sono stati compilati.";
629                break;
630            case 'en':
631                var warningText = "Warning! One or more mandatory fields have not been filled in.";
632                break;
633            case 'fr':
634                var warningText = "Attention! un ou plusieurs champs obligatoires n'ont pas été renseignés.";
635                break;
636            case 'de':
637                var warningText = "Aufmerksamkeit! ein oder mehrere Pflichtfelder wurden nicht ausgefüllt.";
638                break;
639            case 'ru':
640                var warningText = "Внимание! одно или несколько обязательных полей не заполнены.";
641                break;
642            default:
643                var warningText = "Warning! One or more mandatory fields have not been filled in.";
644        }
645
646        var warningDiv = document.createElement("div");
647        warningDiv.setAttribute("class", "warningMsg");
648        var message = document.createTextNode(warningText);
649        warningDiv.appendChild(message);
650
651        if (form.querySelectorAll('.warningMsg').length < 1) {
652            form.appendChild(warningDiv);
653        }
654
655        return false;
656    } else {
657        return true;
658    }
659}
660
661document.addEventListener("DOMContentLoaded", function() {
662    //formScripts();
663});
664/*!
665 * Glide.js v3.4.1
666 * (c) 2013-2019 Jędrzej Chałubek <[email protected]> (http://jedrzejchalubek.com/)
667 * Released under the MIT License.
668 */
669!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Glide=e()}(this,function(){"use strict";var n={type:"slider",startAt:0,perView:1,focusAt:0,gap:10,autoplay:!1,hoverpause:!0,keyboard:!0,bound:!1,swipeThreshold:80,dragThreshold:120,perTouch:!1,touchRatio:.5,touchAngle:45,animationDuration:400,rewind:!0,rewindDuration:800,animationTimingFunc:"cubic-bezier(.165, .840, .440, 1)",throttle:10,direction:"ltr",peek:0,breakpoints:{},classes:{direction:{ltr:"glide--ltr",rtl:"glide--rtl"},slider:"glide--slider",carousel:"glide--carousel",swipeable:"glide--swipeable",dragging:"glide--dragging",cloneSlide:"glide__slide--clone",activeNav:"glide__bullet--active",activeSlide:"glide__slide--active",disabledArrow:"glide__arrow--disabled"}};function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t=function(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t};function o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t};function y(t){return parseInt(t)}function s(t){return"string"==typeof t}function u(t){var e=void 0===t?"undefined":r(t);return"function"===e||"object"===e&&!!t}function c(t){return"function"==typeof t}function l(t){return void 0===t}function f(t){return t.constructor===Array}function d(t,e,n){Object.defineProperty(t,e,n)}function h(t,e){var n=a({},t,e);return e.hasOwnProperty("classes")&&(n.classes=a({},t.classes,e.classes),e.classes.hasOwnProperty("direction")&&(n.classes.direction=a({},t.classes.direction,e.classes.direction))),e.hasOwnProperty("breakpoints")&&(n.breakpoints=a({},t.breakpoints,e.breakpoints)),n}var v=(t(e,[{key:"on",value:function(t,e){if(f(t))for(var n=0;n<t.length;n++)this.on(t[n],e);this.hop.call(this.events,t)||(this.events[t]=[]);var i=this.events[t].push(e)-1;return{remove:function(){delete this.events[t][i]}}}},{key:"emit",value:function(t,e){if(f(t))for(var n=0;n<t.length;n++)this.emit(t[n],e);this.hop.call(this.events,t)&&this.events[t].forEach(function(t){t(e||{})})}}]),e);function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.events=t,this.hop=t.hasOwnProperty}var p=(t(m,[{key:"mount",value:function(t){var e=0<arguments.length&&void 0!==t?t:{};return this._e.emit("mount.before"),u(e)&&(this._c=function(t,e,n){var i={};for(var r in e)c(e[r])&&(i[r]=e[r](t,i,n));for(var o in i)c(i[o].mount)&&i[o].mount();return i}(this,e,this._e)),this._e.emit("mount.after"),this}},{key:"mutate",value:function(t){var e=0<arguments.length&&void 0!==t?t:[];return f(e)&&(this._t=e),this}},{key:"update",value:function(t){var e=0<arguments.length&&void 0!==t?t:{};return this.settings=h(this.settings,e),e.hasOwnProperty("startAt")&&(this.index=e.startAt),this._e.emit("update"),this}},{key:"go",value:function(t){return this._c.Run.make(t),this}},{key:"move",value:function(t){return this._c.Transition.disable(),this._c.Move.make(t),this}},{key:"destroy",value:function(){return this._e.emit("destroy"),this}},{key:"play",value:function(t){var e=0<arguments.length&&void 0!==t&&t;return e&&(this.settings.autoplay=e),this._e.emit("play"),this}},{key:"pause",value:function(){return this._e.emit("pause"),this}},{key:"disable",value:function(){return this.disabled=!0,this}},{key:"enable",value:function(){return this.disabled=!1,this}},{key:"on",value:function(t,e){return this._e.on(t,e),this}},{key:"isType",value:function(t){return this.settings.type===t}},{key:"settings",get:function(){return this._o},set:function(t){u(t)&&(this._o=t)}},{key:"index",get:function(){return this._i},set:function(t){this._i=y(t)}},{key:"type",get:function(){return this.settings.type}},{key:"disabled",get:function(){return this._d},set:function(t){this._d=!!t}}]),m);function m(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};i(this,m),this._c={},this._t=[],this._e=new v,this.disabled=!1,this.selector=t,this.settings=h(n,e),this.index=this.settings.startAt}function g(){return(new Date).getTime()}function b(n,i,r){var o=void 0,s=void 0,u=void 0,a=void 0,c=0;r=r||{};function l(){c=!1===r.leading?0:g(),o=null,a=n.apply(s,u),o||(s=u=null)}function t(){var t=g();c||!1!==r.leading||(c=t);var e=i-(t-c);return s=this,u=arguments,e<=0||i<e?(o&&(clearTimeout(o),o=null),c=t,a=n.apply(s,u),o||(s=u=null)):o||!1===r.trailing||(o=setTimeout(l,e)),a}return t.cancel=function(){clearTimeout(o),c=0,o=s=u=null},t}var w={ltr:["marginLeft","marginRight"],rtl:["marginRight","marginLeft"]};function _(t){if(t&&t.parentNode){for(var e=t.parentNode.firstChild,n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}return[]}function k(t){return!!(t&&t instanceof window.HTMLElement)}var S='[data-glide-el="track"]';var H=(t(T,[{key:"on",value:function(t,e,n,i){var r=3<arguments.length&&void 0!==i&&i;s(t)&&(t=[t]);for(var o=0;o<t.length;o++)this.listeners[t[o]]=n,e.addEventListener(t[o],this.listeners[t[o]],r)}},{key:"off",value:function(t,e,n){var i=2<arguments.length&&void 0!==n&&n;s(t)&&(t=[t]);for(var r=0;r<t.length;r++)e.removeEventListener(t[r],this.listeners[t[r]],i)}},{key:"destroy",value:function(){delete this.listeners}}]),T);function T(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};i(this,T),this.listeners=t}var x=["ltr","rtl"],O={">":"<","<":">","=":"="};function A(t,e){return{modify:function(t){return e.Direction.is("rtl")?-t:t}}}function M(i,r,o){var s=[function(e,n){return{modify:function(t){return t+n.Gaps.value*e.index}}},function(t,e){return{modify:function(t){return t+e.Clones.grow/2}}},function(n,i){return{modify:function(t){if(0<=n.settings.focusAt){var e=i.Peek.value;return u(e)?t-e.before:t-e}return t}}}
669,function(o,s){return{modify:function(t){var e=s.Gaps.value,n=s.Sizes.width,i=o.settings.focusAt,r=s.Sizes.slideWidth;return"center"===i?t-(n/2-r/2):t-r*i-e*i}}}].concat(i._t,[A]);return{mutate:function(t){for(var e=0;e<s.length;e++){var n=s[e];c(n)&&c(n().modify)&&(t=n(i,r,o).modify(t))}return t}}}var C=!1;try{var P=Object.defineProperty({},"passive",{get:function(){C=!0}});window.addEventListener("testPassive",null,P),window.removeEventListener("testPassive",null,P)}catch(t){}var L=C,z=["touchstart","mousedown"],j=["touchmove","mousemove"],D=["touchend","touchcancel","mouseup","mouseleave"],E=["mousedown","mousemove","mouseup","mouseleave"];function R(t){return u(t)?function(n){return Object.keys(n).sort().reduce(function(t,e){return t[e]=n[e],t[e],t},{})}(t):{}}var W={Html:function(e,t){var n={mount:function(){this.root=e.selector,this.track=this.root.querySelector(S),this.slides=Array.prototype.slice.call(this.wrapper.children).filter(function(t){return!t.classList.contains(e.settings.classes.cloneSlide)})}};return d(n,"root",{get:function(){return n._r},set:function(t){s(t)&&(t=document.querySelector(t)),k(t)&&(n._r=t)}}),d(n,"track",{get:function(){return n._t},set:function(t){k(t)&&(n._t=t)}}),d(n,"wrapper",{get:function(){return n.track.children[0]}}),n},Translate:function(r,o,s){var u={set:function(t){var e=M(r,o).mutate(t);o.Html.wrapper.style.transform="translate3d("+-1*e+"px, 0px, 0px)"},remove:function(){o.Html.wrapper.style.transform=""}};return s.on("move",function(t){var e=o.Gaps.value,n=o.Sizes.length,i=o.Sizes.slideWidth;return r.isType("carousel")&&o.Run.isOffset("<")?(o.Transition.after(function(){s.emit("translate.jump"),u.set(i*(n-1))}),u.set(-i-e*n)):r.isType("carousel")&&o.Run.isOffset(">")?(o.Transition.after(function(){s.emit("translate.jump"),u.set(0)}),u.set(i*n+e*n)):u.set(t.movement)}),s.on("destroy",function(){u.remove()}),u},Transition:function(n,i,t){var r=!1,e={compose:function(t){var e=n.settings;return r?t+" 0ms "+e.animationTimingFunc:t+" "+this.duration+"ms "+e.animationTimingFunc},set:function(t){var e=0<arguments.length&&void 0!==t?t:"transform";i.Html.wrapper.style.transition=this.compose(e)},remove:function(){i.Html.wrapper.style.transition=""},after:function(t){setTimeout(function(){t()},this.duration)},enable:function(){r=!1,this.set()},disable:function(){r=!0,this.set()}};return d(e,"duration",{get:function(){var t=n.settings;return n.isType("slider")&&i.Run.offset?t.rewindDuration:t.animationDuration}}),t.on("move",function(){e.set()}),t.on(["build.before","resize","translate.jump"],function(){e.disable()}),t.on("run",function(){e.enable()}),t.on("destroy",function(){e.remove()}),e},Direction:function(t,e,n){var i={mount:function(){this.value=t.settings.direction},resolve:function(t){var e=t.slice(0,1);return this.is("rtl")?t.split(e).join(O[e]):t},is:function(t){return this.value===t},addClass:function(){e.Html.root.classList.add(t.settings.classes.direction[this.value])},removeClass:function(){e.Html.root.classList.remove(t.settings.classes.direction[this.value])}};return d(i,"value",{get:function(){return i._v},set:function(t){-1<x.indexOf(t)&&(i._v=t)}}),n.on(["destroy","update"],function(){i.removeClass()}),n.on("update",function(){i.mount()}),n.on(["build.before","update"],function(){i.addClass()}),i},Peek:function(n,t,e){var i={mount:function(){this.value=n.settings.peek}};return d(i,"value",{get:function(){return i._v},set:function(t){u(t)?(t.before=y(t.before),t.after=y(t.after)):t=y(t),i._v=t}}),d(i,"reductor",{get:function(){var t=i.value,e=n.settings.perView;return u(t)?t.before/e+t.after/e:2*t/e}}),e.on(["resize","update"],function(){i.mount()}),i},Sizes:function(t,i,e){var n={setupSlides:function(){for(var t=this.slideWidth+"px",e=i.Html.slides,n=0;n<e.length;n++)e[n].style.width=t},setupWrapper:function(t){i.Html.wrapper.style.width=this.wrapperSize+"px"},remove:function(){for(var t=i.Html.slides,e=0;e<t.length;e++)t[e].style.width="";i.Html.wrapper.style.width=""}};return d(n,"length",{get:function(){return i.Html.slides.length}}),d(n,"width",{get:function(){return i.Html.root.offsetWidth}}),d(n,"wrapperSize",{get:function(){return n.slideWidth*n.length+i.Gaps.grow+i.Clones.grow}}),d(n,"slideWidth",{get:function(){return n.width/t.settings.perView-i.Peek.reductor-i.Gaps.reductor}}),e.on(["build.before","resize","update"],function(){n.setupSlides(),n.setupWrapper()}),e.on("destroy",function(){n.remove()}),n},Gaps:function(e,o,t){var n={apply:function(t){for(var e=0,n=t.length;e<n;e++){var i=t[e].style,r=o.Direction.value;i[w[r][0]]=0!==e?this.value/2+"px":"",e!==t.length-1?i[w[r][1]]=this.value/2+"px":i[w[r][1]]=""}},remove:function(t){for(var e=0,n=t.length;e<n;e++){var i=t[e].style;i.marginLeft="",i.marginRight=""}}};return d(n,"value",{get:function(){return y(e.settings.gap)}}),d(n,"grow",{get:function(){return n.value*(o.Sizes.length-1)}}),d(n,"reductor",{get:function(){var t=e.settings.perView;return n.value*(t-1)/t}}),t.on(["build.after","update"],b(function(){n.apply(o.Html.wrapper.children)},30)),t.on("destroy",function(){n.remove(o.Html.wrapper.children)}),n},Move:function(t,i,r){var e={mount:function(){this._o=0},make:function(t){var e=this,n=0<arguments.length&&void 0!==t?t:0;this.offset=n,r.emit("move",{movement:this.value}),i.Transition.after(function(){r.emit("move.after",{movement:e.value})})}};return d(e,"offset",{get:function(){return e._o},set:function(t){e._o=l(t)?0:y(t)}}),d(e,"translate",{get:function(){return i.Sizes.slideWidth*t.index}}),d(e,"value",{get:function(){var t=this.offset,e=this.translate;return i.Direction.is("rtl")?e+t:e-t}}),r.on(["build.before","run"],function(){e.make()}),e},Clones:function(v,p,t){var e={mount:function(){this.items=[],v.isType("carousel")&&(this.items=this.collect())},collect:function(t){for(var e=0<arguments.length&&void 0!==t?t:[],n=p.Html.slides,i=v.settings,r=i.perView,o=i.classes,s=r+ +!!v.settings.peek,u=n.slice(0,s),a=n.slice(-s),c=0;c<Math.max(1,Math.floor(r/n.length));c++){for(var l=0;l<u.length;l++){var f=u[l].cloneNode(!0);f.classList.add(o.cloneSlide),e.push(f)}for(var d=0;d<a.length;d++){var h=a[d].cloneNode(!0);h.classList.add(o.cloneSlide),e.unshift(h)}}return e},append:function(){for(var t=this.items,e=p.Html,n=e.wrapper,i=e.slides,r=Math.floor(t.length/2),o=t.slice(0,r).reverse(),s=t.slice(r,t.length),u=p.Sizes.slideWidth+"px",a=0;a<s.length;a++)n.appendChild(s[a]);for(var c=0;c<o.length;c++)n.insertBefore(o[c],i[0]);for(var l=0;l<t.length;l++)t[l].style.width=u},remove:function(){for(var t=this.items,e=0;e<t.length;e++)p.Html.wrapper.removeChild(t[e])}};return d(e,"grow",{get:function(){return(p.Sizes.slideWidth+p.Gaps.value)*e.items.length}}),t.on("update",function(){e.remove(),e.mount(),e.append()}),t.on("build.before",function(){v.isType("carousel")&&e.append()}),t.on("destroy",function(){e.remove()}),e},Resize:function(t,e,n){var i=new H,r={mount:function(){this.bind()},bind:function(){i.on("resize",window,b(function(){n.emit("resize")},t.settings.throttle))},unbind:function(){i.off("resize",window)}};return n.on("destroy",function(){r.unbind(),i.destroy()}),r},Build:function(n,i,t){var e={mount:function(){t.emit("build.before"),this.typeClass(),this.activeClass(),t.emit("build.after")},typeClass:function(){i.Html.root.classList.add(n.settings.classes[n.settings.type])},activeClass:function(){var e=n.settings.classes,t=i.Html.slides[n.index];t&&(t.classList.add(e.activeSlide),_(t).forEach(function(t){t.classList.remove(e.activeSlide)}))},removeClasses:function(){var e=n.settings.classes;i.Html.root.classList.remove(e[n.settings.type]),i.Html.slides.forEac
669h(function(t){t.classList.remove(e.activeSlide)})}};return t.on(["destroy","update"],function(){e.removeClasses()}),t.on(["resize","update"],function(){e.mount()}),t.on("move.after",function(){e.activeClass()}),e},Run:function(o,n,i){var t={mount:function(){this._o=!1},make:function(t){var e=this;o.disabled||(o.disable(),this.move=t,i.emit("run.before",this.move),this.calculate(),i.emit("run",this.move),n.Transition.after(function(){e.isStart()&&i.emit("run.start",e.move),e.isEnd()&&i.emit("run.end",e.move),(e.isOffset("<")||e.isOffset(">"))&&(e._o=!1,i.emit("run.offset",e.move)),i.emit("run.after",e.move),o.enable()}))},calculate:function(){var t=this.move,e=this.length,n=t.steps,i=t.direction,r=function(t){return"number"==typeof t}(y(n))&&0!==y(n);switch(i){case">":">"===n?o.index=e:this.isEnd()?o.isType("slider")&&!o.settings.rewind||(this._o=!0,o.index=0):r?o.index+=Math.min(e-o.index,-y(n)):o.index++;break;case"<":"<"===n?o.index=0:this.isStart()?o.isType("slider")&&!o.settings.rewind||(this._o=!0,o.index=e):r?o.index-=Math.min(o.index,y(n)):o.index--;break;case"=":o.index=n}},isStart:function(){return 0===o.index},isEnd:function(){return o.index===this.length},isOffset:function(t){return this._o&&this.move.direction===t}};return d(t,"move",{get:function(){return this._m},set:function(t){var e=t.substr(1);this._m={direction:t.substr(0,1),steps:e?y(e)?y(e):e:0}}}),d(t,"length",{get:function(){var t=o.settings,e=n.Html.slides.length;return o.isType("slider")&&"center"!==t.focusAt&&t.bound?e-1-(y(t.perView)-1)+y(t.focusAt):e-1}}),d(t,"offset",{get:function(){return this._o}}),t},Swipe:function(d,h,v){var n=new H,p=0,m=0,g=0,i=!1,r=!!L&&{passive:!0},t={mount:function(){this.bindSwipeStart()},start:function(t){if(!i&&!d.disabled){this.disable();var e=this.touches(t);p=null,m=y(e.pageX),g=y(e.pageY),this.bindSwipeMove(),this.bindSwipeEnd(),v.emit("swipe.start")}},move:function(t){if(!d.disabled){var e=d.settings,n=e.touchAngle,i=e.touchRatio,r=e.classes,o=this.touches(t),s=y(o.pageX)-m,u=y(o.pageY)-g,a=Math.abs(s<<2),c=Math.abs(u<<2),l=Math.sqrt(a+c),f=Math.sqrt(c);if(!(180*(p=Math.asin(f/l))/Math.PI<n))return!1;t.stopPropagation(),h.Move.make(s*function(t){return parseFloat(t)}(i)),h.Html.root.classList.add(r.dragging),v.emit("swipe.move")}},end:function(t){if(!d.disabled){var e=d.settings,n=this.touches(t),i=this.threshold(t),r=n.pageX-m,o=180*p/Math.PI,s=Math.round(r/h.Sizes.slideWidth);this.enable(),i<r&&o<e.touchAngle?(e.perTouch&&(s=Math.min(s,y(e.perTouch))),h.Direction.is("rtl")&&(s=-s),h.Run.make(h.Direction.resolve("<"+s))):r<-i&&o<e.touchAngle?(e.perTouch&&(s=Math.max(s,-y(e.perTouch))),h.Direction.is("rtl")&&(s=-s),h.Run.make(h.Direction.resolve(">"+s))):h.Move.make(),h.Html.root.classList.remove(e.classes.dragging),this.unbindSwipeMove(),this.unbindSwipeEnd(),v.emit("swipe.end")}},bindSwipeStart:function(){var e=this,t=d.settings;t.swipeThreshold&&n.on(z[0],h.Html.wrapper,function(t){e.start(t)},r),t.dragThreshold&&n.on(z[1],h.Html.wrapper,function(t){e.start(t)},r)},unbindSwipeStart:function(){n.off(z[0],h.Html.wrapper,r),n.off(z[1],h.Html.wrapper,r)},bindSwipeMove:function(){var e=this;n.on(j,h.Html.wrapper,b(function(t){e.move(t)},d.settings.throttle),r)},unbindSwipeMove:function(){n.off(j,h.Html.wrapper,r)},bindSwipeEnd:function(){var e=this;n.on(D,h.Html.wrapper,function(t){e.end(t)})},unbindSwipeEnd:function(){n.off(D,h.Html.wrapper)},touches:function(t){return-1<E.indexOf(t.type)?t:t.touches[0]||t.changedTouches[0]},threshold:function(t){var e=d.settings;return-1<E.indexOf(t.type)?e.dragThreshold:e.swipeThreshold},enable:function(){return i=!1,h.Transition.enable(),this},disable:function(){return i=!0,h.Transition.disable(),this}};return v.on("build.after",function(){h.Html.root.classList.add(d.settings.classes.swipeable)}),v.on("destroy",function(){t.unbindSwipeStart(),t.unbindSwipeMove(),t.unbindSwipeEnd(),n.destroy()}),t},Images:function(t,e,n){var i=new H,r={mount:function(){this.bind()},bind:function(){i.on("dragstart",e.Html.wrapper,this.dragstart)},unbind:function(){i.off("dragstart",e.Html.wrapper)},dragstart:function(t){t.preventDefault()}};return n.on("destroy",function(){r.unbind(),i.destroy()}),r},Anchors:function(t,e,n){var i=new H,r=!1,o=!1,s={mount:function(){this._a=e.Html.wrapper.querySelectorAll("a"),this.bind()},bind:function(){i.on("click",e.Html.wrapper,this.click)},unbind:function(){i.off("click",e.Html.wrapper)},click:function(t){o&&(t.stopPropagation(),t.preventDefault())},detach:function(){if(o=!0,!r){for(var t=0;t<this.items.length;t++)this.items[t].draggable=!1,this.items[t].setAttribute("data-href",this.items[t].getAttribute("href")),this.items[t].removeAttribute("href");r=!0}return this},attach:function(){if(o=!1,r){for(var t=0;t<this.items.length;t++)this.items[t].draggable=!0,this.items[t].setAttribute("href",this.items[t].getAttribute("data-href"));r=!1}return this}};return d(s,"items",{get:function(){return s._a}}),n.on("swipe.move",function(){s.detach()}),n.on("swipe.end",function(){e.Transition.after(function(){s.attach()})}),n.on("destroy",function(){s.attach(),s.unbind(),i.destroy()}),s},Controls:function(i,e,t){var n=new H,r=!!L&&{passive:!0},o={mount:function(){this._n=e.Html.root.querySelectorAll('[data-glide-el="
669controls[nav]"]'),this._c=e.Html.root.querySelectorAll('[data-glide-el^="controls"]'),this.addBindings()},setActive:function(){for(var t=0;t<this._n.length;t++)this.addClass(this._n[t].children)},removeActive:function(){for(var t=0;t<this._n.length;t++)this.removeClass(this._n[t].children)},addClass:function(t){var e=i.settings,n=t[i.index];n&&(n.classList.add(e.classes.activeNav),_(n).forEach(function(t){t.classList.remove(e.classes.activeNav)}))},removeClass:function(t){var e=t[i.index];e&&e.classList.remove(i.settings.classes.activeNav)},addBindings:function(){for(var t=0;t<this._c.length;t++)this.bind(this._c[t].children)},removeBindings:function(){for(var t=0;t<this._c.length;t++)this.unbind(this._c[t].children)},bind:function(t){for(var e=0;e<t.length;e++)n.on("click",t[e],this.click),n.on("touchstart",t[e],this.click,r)},unbind:function(t){for(var e=0;e<t.length;e++)n.off(["click","touchstart"],t[e])},click:function(t){t.preventDefault(),e.Run.make(e.Direction.resolve(t.currentTarget.getAttribute("data-glide-dir")))}};return d(o,"items",{get:function(){return o._c}}),t.on(["mount.after","move.after"],function(){o.setActive()}),t.on("destroy",function(){o.removeBindings(),o.removeActive(),n.destroy()}),o},Keyboard:function(t,e,n){var i=new H,r={mount:function(){t.settings.keyboard&&this.bind()},bind:function(){i.on("keyup",document,this.press)},unbind:function(){i.off("keyup",document)},press:function(t){39===t.keyCode&&e.Run.make(e.Direction.resolve(">")),37===t.keyCode&&e.Run.make(e.Direction.resolve("<"))}};return n.on(["destroy","update"],function(){r.unbind()}),n.on("update",function(){r.mount()}),n.on("destroy",function(){i.destroy()}),r},Autoplay:function(e,n,t){var i=new H,r={mount:function(){this.start(),e.settings.hoverpause&&this.bind()},start:function(){var t=this;e.settings.autoplay&&l(this._i)&&(this._i=setInterval(function(){t.stop(),n.Run.make(">"),t.start()},this.time))},stop:function(){this._i=clearInterval(this._i)},bind:function(){var t=this;i.on("mouseover",n.Html.root,function(){t.stop()}),i.on("mouseout",n.Html.root,function(){t.start()})},unbind:function(){i.off(["mouseover","mouseout"],n.Html.root)}};return d(r,"time",{get:function(){var t=n.Html.slides[e.index].getAttribute("data-glide-autoplay");return y(t||e.settings.autoplay)}}),t.on(["destroy","update"],function(){r.unbind()}),t.on(["run.before","pause","destroy","swipe.start","update"],function(){r.stop()}),t.on(["run.after","play","swipe.end"],function(){r.start()}),t.on("update",function(){r.mount()}),t.on("destroy",function(){i.destroy()}),r},Breakpoints:function(t,e,n){var i=new H,r=t.settings,o=R(r.breakpoints),s=a({},r),u={match:function(t){if(void 0!==window.matchMedia)for(var e in t)if(t.hasOwnProperty(e)&&window.matchMedia("(max-width: "+e+"px)").matches)return t[e];return s}};return a(r,u.match(o)),i.on("resize",window,b(function(){t.settings=h(r,u.match(o))},t.settings.throttle)),n.on("update",function(){o=R(o),s=a({},r)}),n.on("destroy",function(){i.off("resize",window)}),u}};function G(){return i(this,G),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(G.__proto__||Object.getPrototypeOf(G)).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(G,p),t(G,[{key:"mount",value:function(t){var e=0<arguments.length&&void 0!==t?t:{};return function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(i):void 0}(G.prototype.__proto__||Object.getPrototypeOf(G.prototype),"mount",this).call(this,a({},W,e))}}]),G});
670
671function b64Encode(str) {
672  return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
673      return String.fromCharCode('0x' + p1);
674  }));
675}
676
677function b64Decode(str) {
678  return atob(str);
679}
680
681/*
682|*| ecookies.set(name, value[, end[, path[, domain[, secure]]]])
683end can be 'Infinity'
684|*| ecookies.get(name)
685|*| ecookies.remove(name[, path], domain)
686|*| ecookies.has(name)
687|*| ecookies.keys()
688*/  
689var Ecookies = {
690  get: function(sKey) {
691    if (!sKey) return null;
692    //return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
693    return document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1") || null;
694  },
695  set: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
696    if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) return false;
697    var sExpires = "";
698    if (vEnd) {
699      switch (vEnd.constructor) {
700        case Number:
701          sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd;
702          break;
703        case String:
704          sExpires = "; expires=" + vEnd;
705          break;
706        case Date:
707          sExpires = "; expires=" + vEnd.toUTCString();
708          break;
709      }
710    }
711    //var strCookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
712    var strCookie = encodeURIComponent(sKey) + "=" + sValue + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
713    console.log('document.cookie = '+strCookie);
714    document.cookie = strCookie;
715    return this;
716  },
717  remove: function (sKey, sPath, sDomain) {
718    if (this.has(sKey))
719      document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "");
720    return this;
721  },
722  has: function (sKey) {
723    if (!sKey) return false;
724    return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
725  },
726  keys: function () {
727    var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
728    /*for (var nLen = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) {
729      aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);
730    }*/
731    return aKeys;
732  }
733};
734  
735if(typeof window.enable_navtrack == 'undefined' || window.enable_navtrack == true) {
736
737  document.addEventListener("DOMContentLoaded", function() {
738
739    var d = document;
740    var date_now = Math.floor(Date.now()/1000);
741    if(!Ecookies.has('ent_r')) {
742      //Ecookies.set(name, value[, end[, path[, domain[, secure]]]])
743      Ecookies.set('ent_r', JSON.stringify({u: d.referrer, d: date_now}));
744    }
745    if(!Ecookies.has('ent_h')) {
746      Ecookies.set('ent_h',JSON.stringify([{u: d.URL, t: d.title, d: date_now}]));
747    } else {
748      var ent_h = JSON.parse(Ecookies.get('ent_h'));
749      if(ent_h[ent_h.length-1].u !== d.URL) {
750        ent_h.push({u: d.URL, t: d.title, d: date_now});
751        Ecookies.set('ent_h', JSON.stringify(ent_h));
752      }
753    }
754
755    var _max_try = 10;
756    var _try = 1;
757
758    var tick = setInterval(function() {
759      if(document.querySelector('form') && document.querySelector('form').length) {
760        document.querySelectorAll('form').forEach(function(form) {              
761          if(form.querySelector('.navtrack')) {
762
763			// appendo la sessione di navigazione come variabile nascosta al form
764			var _input = document.createElement('input');
765			_input.type = 'hidden';
766			_input.name = 'data[ent_h]';
767			_input.value = Ecookies.get('ent_h');
768			form.appendChild(_input);
769			var ent_r = JSON.parse(Ecookies.get('ent_r'));
770			if(ent_r && ent_r.u) {
771			  _input = document.createElement('input');
772			  _input.type = 'hidden';
773			  _input.name = 'data[ent_r]';
774			  _input.value = ent_r.u;
775			  form.appendChild(_input);          
776			}   
777
778			// al click sul pulsante di invio form, cancello dai cookie la cronologia
779            form.querySelector('.navtrack').addEventListener('click',function() {         
780              Ecookies.remove('ent_h').remove('ent_r');
781            });
782          }
783        });
784        clearInterval(tick);
785      } else {
786        if(_try === _max_try) {
787          clearInterval(tick);
788          return;
789        }
790        _try++;
791      }
792    },300);
793
794  });
795  
796}
797function global_truncate(str, no_words, suffix) {
798    var splitStr = str.split(" ").splice(0, no_words).join(" ");
799    splitStr = splitStr + suffix;
800
801    return splitStr;
802}
803
804function global_strToHTML(str) {
805    var doc = new DOMParser().parseFromString(str, "text/html");
806    return doc.body.childNodes[0];
807}
808
809function outerHTML(node) {
810    return node.outerHTML || new XMLSerializer().serializeToString(node);
811}
812
813// Gestione apertura modale al click su un elemento
814
815function global_openModalClick({
816    feedbackWords = 40,
817} = {}) {
818
819    function countWords(str) {
820        str = str.replace(/(^\s*)|(\s*$)/gi, "");
821        str = str.replace(/[ ]{2,}/gi, " ");
822        str = str.replace(/\n /, "\n");
823        return str.split(' ').length;
824    }
825
826    var feedbackContainer = document.querySelectorAll(".feedbackModal");
827
828    if (feedbackContainer.length > 0) {
829        var feedbackItems = Array();
830
831        feedbackContainer.forEach(function (el, i) {
832            var title = el.querySelectorAll('.titolo-recensione')[0].textContent;
833            var description = el.querySelectorAll('.descrizione-recensione')[0].innerHTML;
834            var info = el.querySelectorAll('.info-recensione')[0].innerHTML;
835            var score = el.getElementsByClassName('review-points')[0].outerHTML;
836
837            if (countWords(description) > feedbackWords) {
838                var truncDesc = global_truncate(
839                    description,
840                    feedbackWords,
841                    '... <a href="#" class="edtOpenModalFeedback">[ + ]</a>'
842                );
843                var htmlDesc = global_strToHTML(truncDesc);
844
845                el.querySelectorAll('.descrizione-recensione')[0].innerHTML = htmlDesc.innerHTML;
846
847                feedbackItems.push([title, description, score, info]);
848            }
849        });
850    }
851
852    var modal = document.getElementsByClassName('edtModal')[0];
853    var modalForm = document.getElementsByClassName('edtModalForm')[0];
854
855    var btn = document.querySelectorAll('.edtOpenModal');
856    var btnForm = document.querySelectorAll('.edtOpenModalForm');
857    var btnFeedback = document.querySelectorAll('.edtOpenModalFeedback');
858
859    var close = document.querySelectorAll(".close");
860
861    btn.forEach(function (el, i) {
862        el.onclick = function (event) {
863            event.preventDefault();
864            modal.style.display = "block";
865        }
866    });
867
868    btnForm.forEach(function (el, i) {
869        el.onclick = function (event) {
870            event.preventDefault();
871            modalForm.style.display = "block";
872        }
873    });
874
875    btnFeedback.forEach(function (el, i) {
876        el.onclick = function (event) {
877            event.preventDefault();
878            modal.style.display = "block";
879
880            console.log(i);
881
882            modal.getElementsByClassName('modal-header')[0].querySelectorAll('h2')[0].textContent = feedbackItems[i][0];
883            modal.getElementsByClassName('modal-body')[0].innerHTML = feedbackItems[i][1];
884            modal.getElementsByClassName('modal-footer')[0].innerHTML = feedbackItems[i][2] + ' ' + feedbackItems[i][3];
885        }
886    });
887
888    if (typeof (close) != 'undefined' && close != null) {
889        close.forEach(function (el) {
890            el.onclick = function () {
891                modal.style.display = "none";
892                modalForm.style.display = "none";
893            }
894        });
895    }
896
897    window.onclick = function (event) {
898        if (event.target == modal) {
899            modal.style.display = "none";
900            modalForm.style.display = "none";
901        }
902    }
903}
904
905// Gestione smooth scroll per ancore interne alla pagina 
906
907// Fonte: https://perishablepress.com/vanilla-javascript-scroll-anchor/
908
909function global_smoothScroll() {
910
911    var links = document.getElementsByTagName('a');
912
913    for (var i = 0; i < links.length; i++) {
914        var link = links[i];
915        if ((link.href && link.href.indexOf('#') != -1) && ((link.pathname == location.pathname) || ('/' + link.pathname == location.pathname)) && (link.search == location.search)) {
916            link.onclick = scrollAnchors;
917        }
918    }
919
920    function scrollAnchors(e, respond = null) {
921        const distanceToTop = el => Math.floor(el.getBoundingClientRect().top);
922        e.preventDefault();
923        var targetID = (respond) ? respond.getAttribute('href') : this.getAttribute('href');
924        if (targetID == '#') return;
925        const targetAnchor = document.querySelector(targetID);
926        if (!targetAnchor) return;
927        const originalTop = distanceToTop(targetAnchor);
928        var paddingScroll = targetAnchor.dataset.paddingscroll;
929
930        if (paddingScroll) {
931            var adjust = originalTop - paddingScroll;
932        }
933        else {
934            var adjust = originalTop;
935        }
936
937        window.scrollBy({ top: adjust, left: 0, behavior: 'smooth' });
938        const checkIfDone = setInterval(function () {
939            const atBottom = window.innerHeight + window.pageYOffset >= document.body.offsetHeight - 2;
940            if (distanceToTop(targetAnchor) === 0 || atBottom) {
941                targetAnchor.tabIndex = '-1';
942                targetAnchor.focus();
943                clearInterval(checkIfDone);
944            }
945        }, 100);
946    }
947}
948
949// Copertura video correlati nei video embedded di YouTube
950
951// Lato CSS si aggiungono due pseudo elementi al wrapper che contiene l'iframe
952// quando il video è in pausa o è terminato.
953// Il :before contiene l'icona del player che si posiziona al centro del video, 
954// l'::after contiene un background che simula due bande, una superiore e una inferiore
955
956// IMPORTANTE: L'URL del video embeddato deve contenere il parametro GET enablejsapi=1
957
958// Fonte: https://www.maxlaumeister.com/articles/hide-related-videos-in-youtube-embeds/
959
960function global_hideRelatedOnYtVideo(wrapperSelector) {
961    // Activate only if not already activated
962    if (window.hideYTActivated) return;
963    // Activate on all players
964    let onYouTubeIframeAPIReadyCallbacks = [];
965    for (let playerWrap of document.querySelectorAll(wrapperSelector)) {
966        let playerFrame = playerWrap.querySelector("iframe");
967
968        let tag = document.createElement('script');
969        tag.src = "https://www.youtube.com/iframe_api";
970        let firstScriptTag = document.getElementsByTagName('script')[0];
971        firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
972
973        let onPlayerStateChange = function (event) {
974            if (event.data == YT.PlayerState.ENDED) {
975                playerWrap.classList.add("ended");
976            } else if (event.data == YT.PlayerState.PAUSED) {
977                playerWrap.classList.add("paused");
978            } else if (event.data == YT.PlayerState.PLAYING) {
979                playerWrap.classList.remove("ended");
980                playerWrap.classList.remove("paused");
981            }
982        };
983
984        let player;
985        onYouTubeIframeAPIReadyCallbacks.push(function () {
986            player = new YT.Player(playerFrame, {
987                events: {
988                    'onStateChange': onPlayerStateChange
989                }
990            });
991        });
992
993        playerWrap.addEventListener("click", function () {
994            let playerState = player.getPlayerState();
995            if (playerState == YT.PlayerState.ENDED) {
996                player.seekTo(0);
997            } else if (playerState == YT.PlayerState.PAUSED) {
998                player.playVideo();
999            }
1000        });
1001    }
1002
1003    window.onYouTubeIframeAPIReady = function () {
1004        for (let callback of onYouTubeIframeAPIReadyCallbacks) {
1005            callback();
1006        }
1007    };
1008
1009    window.hideYTActivated = true;
1010}
1011
1012
1013function global_responsiveTables() {
1014    function wrap(el, wrapper) {
1015        el.parentNode.insertBefore(wrapper, el);
1016        wrapper.appendChild(el);
1017    }
1018
1019    var tables = document.querySelectorAll('.main-content table');
1020
1021    for (i = 0; i < tables.length; i++) {
1022        var wrapEl = document.createElement('div');
1023        wrapEl.classList.add('table-responsive');
1024        wrap(tables[i], wrapEl);
1025    }
1026}
1027
1028function global_responsiveScrollingTables(selector) {
1029
1030    function sideScroll(element, direction, speed, distance, step) {
1031        scrollAmount = 0;
1032        var slideTimer = setInterval(function () {
1033            if (direction == 'left') {
1034                element.scrollLeft -= step;
1035            } else {
1036                element.scrollLeft += step;
1037            }
1038            scrollAmount += step;
1039            if (scrollAmount >= distance) {
1040                window.clearInterval(slideTimer);
1041            }
1042        }, speed);
1043    }
1044
1045    /*  
1046    *   Sostituisco tutti i tag di ogni tabella con tag <div>,
1047    *   aggiungo la classe .table-responsive al <div> che sostituisce il tag <table>,
1048    *   wrappo ogni tabella in un <div> con classe .table-responsive-container    
1049    */
1050
1051    var tables = document.querySelectorAll(selector);
1052    var openingTags = /(<table\s?[^>]*>|<tr\s?[^>]*>|<td\s?[^>]*>|<th\s?[^>]*>|<tbody\s?[^>]*>)/ig;
1053    var closingTags = /(<\/table\s?[^>]*>|<\/tr\s?[^>]*>|<\/td\s?[^>]*>|<\/th\s?[^>]*>|<\/tbody\s?[^>]*>)/ig;
1054
1055    var openingTd = /(<td\s?[^>]*>)/ig;
1056    var closingTd = /(<\/td\s?[^>]*>)/ig;
1057
1058    var openTagsToRemove = /(<thead\s?[^>]*>)/ig;
1059    var closeTagsToRemove = /(<\/thead\s?[^>]*>)/ig;
1060
1061    for (i = 0; i < tables.length; i++) {
1062
1063        var customClass = tables[i].className;
1064
1065        /*
1066        *   Se la tabella ha un tag <thead>, lo rimuovo e lo reinserisco convertito in div
1067        */
1068
1069        if (tables[i].getElementsByTagName('thead')[0]) {
1070            var theadContent = tables[i].getElementsByTagName('thead')[0].innerHTML;
1071            var thead = theadContent.replace(openTagsToRemove, '').replace(closeTagsToRemove, '').replace(openingTags, '<div>').replace(closingTags, '</div>');
1072            var theadFrag = document.createRange().createContextualFragment(thead);
1073            tables[i].removeChild(tables[i].getElementsByTagName('thead')[0]);
1074        }
1075
1076        var divTable = tables[i].outerHTML.replace(openingTd, '<td><p>').replace(closingTd, '</p></td>').replace(openingTags, '<div>').replace(closingTags, '</div>');
1077        var htmlObject = document.createElement('div');
1078        htmlObject.innerHTML = divTable;
1079        htmlObject.children[0].classList.add('table-responsive-container');
1080        htmlObject.children[0].children[0].classList.add('table-responsive');
1081
1082        if (customClass) {
1083            htmlObject.children[0].children[0].classList.add(customClass);
1084        }
1085
1086        if (theadFrag) {
1087            htmlObject.children[0].children[0].insertBefore(theadFrag, htmlObject.children[0].children[0].firstChild);
1088        }
1089
1090        tables[i].outerHTML = htmlObject.innerHTML;
1091    }
1092
1093    if (window.innerWidth < 1280) {
1094        var newTables = document.querySelectorAll('.table-responsive');
1095
1096        for (i = 0; i < newTables.length; i++) {
1097
1098            /*  
1099            *   Separo la prima colonna che dovrà restare fissa
1100            */
1101
1102            var childrenCount = newTables[i].childElementCount;
1103
1104            var firstColumn = document.createElement('div');
1105
1106            for (n = 0; n < childrenCount; n++) {
1107                var itm = newTables[i].children[n].children[0];
1108                var cln = itm.cloneNode(true);
1109                firstColumn.appendChild(cln);
1110                itm.remove();
1111            }
1112
1113            var objFirstCol = document.createElement('div');
1114            var parentObjFirstCol = document.createElement('div');
1115            objFirstCol.innerHTML = firstColumn.innerHTML;
1116            objFirstCol.children[0].parentNode.classList.add('table-responsive', 'firstcolumn');
1117
1118            parentObjFirstCol.classList.add('table-responsive-container', 'firstcolumn-container');
1119            newTables[i].parentNode.before(parentObjFirstCol);
1120            parentObjFirstCol.appendChild(objFirstCol);
1121
1122            /*
1123            *   Creo un wrapper ulteriore con classe .table-responsive-wrapper,
1124            *   che conterrà la nuova tabella generata.
1125            *   Creo anche il <div> per le frecce direzionali che attivano lo scroll al touch.
1126            */
1127
1128            var wrapperElem = document.createElement('div');
1129            wrapperElem.classList.add('table-responsive-wrapper');
1130            parentObjFirstCol.parentNode.insertBefore(wrapperElem, parentObjFirstCol);
1131
1132            var tableCln = newTables[i].parentNode.cloneNode(true);
1133            var firstColumnCln = parentObjFirstCol.cloneNode(true);
1134            wrapperElem.appendChild(firstColumnCln);
1135            wrapperElem.appendChild(tableCln);
1136
1137            newTables[i].parentNode.remove();
1138            parentObjFirstCol.remove();
1139
1140            var cols = newTables[i].children[0].childElementCount;
1141
1142
1143            var scrollCmd = document.createElement('div');
1144
1145            scrollCmd.className = 'scroll-commands';
1146            if (cols > 1) {
1147                scrollCmd.innerHTML = '<div class="colprev disabled"><i class="icon-edt-arrow-left-9"></i></div>';
1148                scrollCmd.innerHTML += '<div class="colnext"><i class="icon-edt-arrow-right-9"></i></div>';
1149            }
1150            wrapperElem.prepend(scrollCmd);
1151
1152        }
1153
1154
1155        var resTables = document.querySelectorAll('.table-responsive-wrapper');
1156
1157        for (i = 0; i < resTables.length; i++) {
1158            var parTable = resTables[i].querySelector('.table-responsive-container:not(.firstcolumn-container)');
1159            var firstCol = resTables[i].querySelector('.table-responsive-container .firstcolumn');
1160            var cmdContainer = resTables[i].querySelector('.scroll-commands');
1161
1162            /*
1163            *   Calcolo e assegno la larghezza della tabella in percentuale,
1164            *   ogni colonna è larga 50%
1165            */
1166
1167            var colsCount = parTable.children[0].children[0].childElementCount;
1168            cmdContainer.setAttribute('data-cols', colsCount);
1169
1170            //if (colsCount > 1) {
1171            var tableWidthPercentage = 50 * colsCount + '%';
1172            parTable.children[0].style.width = tableWidthPercentage;
1173            // }
1174
1175            /*
1176            *   Equalizzo l'altezza di ogni cella
1177            */
1178
1179            var childrenCount = parTable.children[0].childElementCount;
1180
1181            for (n = 0; n < childrenCount; n++) {
1182                var el = parTable.children[0].children[n];
1183
1184                if (firstCol.children[n].offsetHeight <= el.offsetHeight) {
1185                    firstCol.children[n].style.height = el.offsetHeight + 'px';
1186                    el.style.height = el.offsetHeight + 'px';
1187                }
1188                else {
1189                    firstCol.children[n].style.height = firstCol.children[n].offsetHeight + 'px';
1190                    el.style.height = firstCol.children[n].offsetHeight + 'px';
1191                }
1192            }
1193
1194            /*
1195            *   Calcolo di quanti pixel deve scrollare la tabella ad ogni input 
1196            *   e assegno l'evento click ai bottoni prev e next
1197            */
1198
1199            var parTableWidth = parTable.offsetWidth;
1200            var tableWidthPx = parTableWidth * (parseInt(tableWidthPercentage) / 100);
1201
1202            var pxToScroll = (tableWidthPx / colsCount);
1203
1204            var btnPrev = resTables[i].querySelector('.colprev');
1205            var btnNext = resTables[i].querySelector('.colnext');
1206
1207            if (btnPrev && btnNext) {
1208                [btnPrev, btnNext].forEach(item => {
1209                    item.addEventListener('click', event => {
1210                        var scrollTarget = item.parentNode.parentNode.querySelector('.table-responsive-container:not(.firstcolumn-container)');
1211                        var prev = item.previousElementSibling;
1212                        var next = item.nextElementSibling;
1213                        var scrollRight = scrollTarget.scrollLeft + pxToScroll;
1214                        var firstColPos = scrollTarget.children[0].children[0].children[0].getBoundingClientRect();
1215                        var finish = scrollTarget.children[0].offsetWidth - pxToScroll;
1216
1217                        if (prev !== null) {
1218                            sideScroll(scrollTarget, 'right', 5, pxToScroll, 5);
1219
1220                            prev.classList.remove('disabled');
1221
1222                            if (scrollRight >= finish) {
1223                                item.classList.add('disabled');
1224                            }
1225                        }
1226
1227                        if (next !== null) {
1228                            sideScroll(scrollTarget, 'left', 5, pxToScroll, 5);
1229
1230                            next.classList.remove('disabled');
1231
1232                            if (Math.sign(firstColPos.left) == 1) {
1233                                item.classList.add('disabled');
1234                            }
1235                        }
1236                    })
1237                })
1238            }
1239
1240            /*
1241            *   Gestisco lo scroll dato dal touch del dito 
1242            */
1243
1244            var touchstartX = 0;
1245            var touchendX = 0;
1246            //var touchstartY = 0;
1247            //var touchendY = 0;
1248
1249            var gestureZone = parTable;
1250
1251            gestureZone.addEventListener('touchstart', function (event) {
1252                touchstartX = event.changedTouches[0].screenX;
1253                touchstartY = event.changedTouches[0].screenY;
1254            }, false);
1255
1256            gestureZone.addEventListener('touchend', function (event) {
1257                touchendX = event.changedTouches[0].screenX;
1258                touchendY = event.changedTouches[0].screenY;
1259                handleGesture(this);
1260            }, false);
1261
1262            function handleGesture(target) {
1263                var lastColPos = target.children[0].children[0].lastElementChild.getBoundingClientRect();
1264                var prev = target.parentNode.children[0].querySelector('.colprev');
1265                var next = target.parentNode.children[0].querySelector('.colnext');
1266
1267                if (prev !== null && next !== null) {
1268
1269                    if (touchendX <= touchstartX) {
1270                        // console.log('Swiped left');
1271                        var diffLeft = touchstartX - touchendX;
1272                        sideScroll(target, 'right', 5, pxToScroll - diffLeft, 5);
1273
1274                        prev.classList.remove('disabled');
1275
1276                        if (target.scrollLeft >= lastColPos.left) {
1277                            next.classList.add('disabled');
1278                        }
1279                    }
1280
1281                    if (touchendX >= touchstartX) {
1282                        // console.log('Swiped right');
1283                        var diffRight = touchendX - touchstartX;
1284                        sideScroll(target, 'left', 5, pxToScroll - diffRight, 5);
1285
1286                        next.classList.remove('disabled');
1287
1288                        if (target.scrollLeft == 0) {
1289                            prev.classList.add('disabled');
1290                        }
1291                    }
1292
1293                }
1294
1295                // if (touchendY <= touchstartY) {
1296                //     console.log('Swiped up');
1297                // }
1298
1299                // if (touchendY >= touchstartY) {
1300                //     console.log('Swiped down');
1301                // }
1302
1303                // if (touchendY === touchstartY) {
1304                //     console.log('Tap');
1305                // }
1306            }
1307        }
1308    }
1309}
1310var ref = document.referrer; 
1311
1312var hostname = new URL(site_url).hostname;
1313var tenant = hostname.split('.')[1];
1314var eventValueArray = [];
1315switch (tenant) {
1316    case 'abnershotel':
1317    case 'hoteltiffanysriccione':
1318    case 'hotelfeldbergriccione':
1319    case 'hotelambasciatori':
1320    case 'hotelcontinental':
1321    case 'maximilianshotels':
1322        eventValueArray['newsletter'] = 10;
1323        eventValueArray['fbmessenger'] = 5; 
1324        eventValueArray['booking'] = 1;
1325        eventValueArray['preventivo-sito'] = 50;
1326        eventValueArray['preventivo-sito-click'] = 10;
1327        eventValueArray['richiestainformazioni'] = 35;
1328        eventValueArray['preventivo-pdc'] = 10;
1329        eventValueArray['callback'] = 8;
1330        eventValueArray['telefono'] = 35;
1331        eventValueArray['clickemail'] = 25;
1332        eventValueArray['whatsapp'] = 7;
1333        eventValueArray['raccoltaemail'] = 5;
1334        eventValueArray['booking-click'] = 1;
1335        eventValueArray['mappa'] = 3;
1336        eventValueArray['link'] = 7;
1337        break;
1338
1339    default:
1340        eventValueArray['newsletter'] = 5;
1341        eventValueArray['fbmessenger'] = 5; 
1342        eventValueArray['booking'] = 1;
1343        eventValueArray['preventivo-sito'] = 10;
1344        eventValueArray['preventivo-sito-click'] = 10;
1345        eventValueArray['richiestainformazioni'] = 10;
1346		eventValueArray['prenotazioneristorante'] = 10;
1347		eventValueArray['prenotazionespa'] = 10;
1348		eventValueArray['lavoraconnoi'] = 5;
1349        eventValueArray['preventivo-pdc'] = 10;
1350        eventValueArray['callback'] = 8;
1351        eventValueArray['telefono'] = 7;
1352        eventValueArray['clickemail'] = 7;
1353        eventValueArray['whatsapp'] = 7;
1354        eventValueArray['raccoltaemail'] = 5;
1355        eventValueArray['booking-click'] = 1;
1356        eventValueArray['mappa'] = 3;
1357        eventValueArray['link'] = 7;
1358        break;
1359}
1360
1361var trackingClasses = {
1362    'newsletter': {
1363        'event': 'editaNewsletter',
1364        'eventCategory': 'Newsletter',
1365        'Action': 'Submit',
1366        'eventAction': 'Submit',
1367        'eventLabel': window.location.href,
1368        'eventValue': eventValueArray['newsletter'],
1369        'eventNhi': 'FALSE',
1370        'eventFacebook': 'Newsletter Submit',
1371        'eventFbStandard': 'Lead'
1372    },
1373    'fbmessenger': {
1374        'event': 'editaFb Messenger',
1375        'eventCategory': 'Fb Messenger',
1376        'Action': 'Apertura',
1377        'eventAction': 'Click',
1378        'eventLabel': window.location.href,
1379        'eventValue': eventValueArray['fbmessenger'],
1380        'eventNhi': 'FALSE',
1381        'eventFacebook': 'Fb Messenger Apertura',
1382        'eventFbStandard': 'Contact'
1383    },
1384    'livechat': {
1385            'event': 'editaLive Chat',
1386            'eventCategory': 'Live Chat',
1387            'Action': 'Click',
1388            'eventAction': 'Click',
1389            'eventLabel': window.location.href,
1390            'eventValue': '7',
1391            'eventNhi': 'FALSE',
1392            'eventFacebook': 'Live Chat',
1393            'eventFbStandard': 'Contact'
1394        },
1395    'booking': {
1396        'event': 'editaBooking',
1397        'eventCategory': 'Booking',
1398        'Action': 'Submit',
1399        'eventAction': 'Submit',
1400        'eventLabel': window.location.href,
1401        'eventValue': eventValueArray['booking'],
1402        'eventNhi': 'FALSE',
1403        'eventFacebook': 'Booking Click',
1404        'eventFbStandard': 'InitiateCheckout',
1405        'edtrack-email': '[valore]',
1406        'edtrack-guests': '[valore int]',
1407        'edtrack-children': '[valore int]',
1408        'edtrack-checkin': '[valore]',
1409        'edtrack-checkout': '[valore]'
1410    },
1411    'preventivo-sito': {
1412        'event': 'editaRichieste Preventivo',
1413        'eventCategory': 'Richieste Preventivo',
1414        'Action': 'Submit',
1415        'eventAction': 'Submit',
1416        'eventLabel': window.location.href,
1417        'eventValue': eventValueArray['preventivo-sito'],
1418        'eventNhi': 'FALSE',
1419        'eventFacebook': 'Richieste Preventivo Submit',
1420        'eventFbStandard': 'Lead',
1421		'edtrack-email': '[valore]',
1422        'edtrack-guests': 'valore int',
1423        'edtrack-children': 'valore int',
1424        'edtrack-checkin': 'valore',
1425        'edtrack-checkout': 'valore'
1426    },
1427    'preventivo-sito-click': {
1428        'event': 'editaRichieste Preventivo',
1429        'eventCategory': 'Richieste Preventivo',
1430        'Action': 'Click',
1431        'eventAction': 'Click',
1432        'eventLabel': window.location.href,
1433        'eventValue': eventValueArray['preventivo-sito-click'],
1434        'eventNhi': 'FALSE',
1435        'eventFacebook': 'Richieste Preventivo Click',
1436        'eventFbStandard': 'Lead',
1437		'edtrack-email': '[valore]',
1438        'edtrack-guests': 'valore int',
1439        'edtrack-children': 'valore int',
1440        'edtrack-checkin': 'valore',
1441        'edtrack-checkout': 'valore'
1442    },
1443    'richiestainformazioni': {
1444        'event': 'editaRichiesta Informazioni',
1445        'eventCategory': 'Richiesta Informazioni',
1446        'Action': 'Submit',
1447        'eventAction': 'Submit',
1448        'eventLabel': window.location.href,
1449        'eventValue': eventValueArray['richiestainformazioni'],
1450        'eventNhi': 'FALSE',
1451        'edtrack-selectedchoice': 'valore',
1452        'eventFacebook': 'Richiesta Informazioni Submit',
1453        'eventFbStandard': 'Lead'
1454    },
1455    'prenotazioneristorante': {
1456        'event': 'editaPrenotazione Ristorante',
1457        'eventCategory': 'Prenotazione Ristorante',
1458        'Action': 'Submit',
1459        'eventAction': 'Submit',
1460        'eventLabel': window.location.href,
1461        'eventValue': eventValueArray['prenotazioneristorante'],
1462        'eventNhi': 'FALSE',
1463        'edtrack-selectedchoice': 'valore',
1464        'eventFacebook': 'Prenotazione Ristorante Submit',
1465        'eventFbStandard': 'Lead'
1466    },
1467    'prenotazionespa': {
1468        'event': 'editaPrenotazione Spa',
1469        'eventCategory': 'Prenotazione Spa',
1470        'Action': 'Submit',
1471        'eventAction': 'Submit',
1472        'eventLabel': window.location.href,
1473        'eventValue': eventValueArray['prenotazionespa'],
1474        'eventNhi': 'FALSE',
1475        'edtrack-selectedchoice': 'valore',
1476        'eventFacebook': 'Prenotazione Spa Submit',
1477        'eventFbStandard': 'Lead'
1478    },
1479    'lavoraconnoi': {
1480        'event': 'editaLavora con noi',
1481        'eventCategory': 'Lavora con noi',
1482        'Action': 'Submit',
1483        'eventAction': 'Submit',
1484        'eventLabel': window.location.href,
1485        'eventValue': eventValueArray['lavoraconnoi'],
1486        'eventNhi': 'FALSE',
1487        'edtrack-selectedchoice': 'valore',
1488        'eventFacebook': 'Lavora con noi Submit',
1489        'eventFbStandard': 'Lead'
1490    },
1491    'preventivo-pdc': {
1492        'event': 'editaRichieste Preventivo PDC',
1493        'eventCategory': 'Richieste Preventivo PDC',
1494        'Action': 'Submit',
1495        'eventAction': 'Submit',
1496        'eventLabel': window.location.href,
1497        'eventValue': eventValueArray['preventivo-pdc'],
1498        'eventNhi': 'FALSE',
1499        'eventFacebook': 'Richieste Preventivo Submit',
1500        'eventFbStandard': 'Lead',
1501		'edtrack-email': '[valore]',
1502        'edtrack-guests': '[valore int]',
1503        'edtrack-children': '[valore int]',
1504        'edtrack-checkin': '[valore]',
1505        'edtrack-checkout': '[valore]'
1506
1507    },
1508    'callback': {
1509        'event': 'editaCallback',
1510        'eventCategory': 'Callback',
1511        'Action': 'Submit',
1512        'eventAction': 'Submit',
1513        'eventLabel': window.location.href,
1514        'eventValue': eventValueArray['callback'],
1515        'eventNhi': 'FALSE',
1516        'eventFacebook': 'Callback Submit',
1517        'eventFbStandard': 'Lead'
1518    },        
1519    'telefono': {
1520        'event': 'editaTelefono',
1521        'eventCategory': 'Telefono',
1522        'Action': 'Click',
1523        'eventAction': 'Click',
1524        'eventLabel': '{{numero telefono}}',
1525        'eventValue': eventValueArray['telefono'],
1526        'eventNhi': 'FALSE',
1527        'eventFacebook': 'Telefono Click',
1528        'eventFbStandard': 'Contact'
1529    },
1530    
1531    'clickemail': {
1532        'event': 'editaEmail',
1533        'eventCategory': 'Email',
1534        'Action': 'Click',
1535        'eventAction': 'Click',
1536        'eventLabel': '{{email cliccata}}',
1537        'eventValue': eventValueArray['clickemail'],
1538        'eventNhi': 'FALSE',
1539        'eventFacebook': 'Email Click'
1540    },
1541    'whatsapp': {
1542        'event': 'editaWhatsapp',
1543        'eventCategory': 'Whatsapp',
1544        'Action': 'Click',
1545        'eventAction': 'Click',
1546        'eventLabel': '{{numero telefono}}',
1547        'eventValue': eventValueArray['whatsapp'],
1548        'eventNhi': 'FALSE',
1549        'eventFacebook': 'Whatsapp Click',
1550        'eventFbStandard': 'Contact'
1551    },
1552    'raccoltaemail': {
1553        'event': 'editaRaccolta da Z Filtro',
1554        'eventCategory': 'Raccolta da Z Filtro',
1555        'Action': 'Click',
1556        'eventAction': 'Click',
1557        'eventLabel': window.location.href,
1558        'eventValue': eventValueArray['raccoltaemail'],
1559        'eventNhi': 'FALSE',
1560        'eventFacebook': 'Raccolta da Z Filtro Click SI',
1561        'eventFbStandard': 'Lead'
1562    },
1563    'booking-click': {
1564        'event': 'editaBooking',
1565        'eventCategory': 'Booking',
1566        'Action': 'Click',
1567        'eventAction': 'Click',
1568        'eventLabel': window.location.href,
1569        'eventValue': eventValueArray['booking-click'],
1570        'eventNhi': 'FALSE',
1571        'eventFacebook': 'Booking Click',
1572        'eventFbStandard': 'InitiateCheckout',
1573		'edtrack-email': '[valore]',
1574        'edtrack-guests': '[valore int]',
1575        'edtrack-children': '[valore int]',
1576        'edtrack-checkin': '[valore]',
1577        'edtrack-checkout': '[valore]'
1578    },
1579    'mappa': {
1580        'event': 'editaMappa',
1581        'eventCategory': 'Mappa',
1582        'Action': 'Click',
1583        'eventAction': 'Click',
1584        'eventLabel': window.location.href,
1585        'eventValue': eventValueArray['mappa'],
1586        'eventNhi': 'FALSE',
1587        'eventFacebook': 'Mappa Click'
1588    },
1589    'link': {
1590        'event': 'editaLink',
1591        'eventCategory': 'Link',
1592        'Action': 'Click',
1593        'eventAction': 'Click',
1594        'eventLabel': window.location.href,
1595        'eventValue': eventValueArray['link'],
1596        'eventNhi': 'FALSE',
1597        'eventFacebook': 'Link Click'
1598    },
1599}
1600edtTrackingCode = function () {
1601    //document.querySelectorAll('[class*=edtrack]').forEach(item => {
1602    document.querySelectorAll('[data-trackclick]').forEach( item => {
1603        item.addEventListener( 'click', event => {
1604            if( item.dataset.trackclick in trackingClasses ){
1605
1606                var data_toPush = {
1607                    'event': trackingClasses[item.dataset.trackclick]['event'],
1608                    'eventCategory': trackingClasses[item.dataset.trackclick]['eventCategory'],
1609                    'Action': trackingClasses[item.dataset.trackclick]['Action'],
1610                    'eventAction': trackingClasses[item.dataset.trackclick]['eventAction'],
1611                    'eventLabel': window.location.href,
1612                    'eventValue': trackingClasses[item.dataset.trackclick]['eventValue'],
1613                    'eventFacebook': trackingClasses[item.dataset.trackclick]['eventFacebook'],
1614                    'eventFbStandard': trackingClasses[item.dataset.trackclick]['eventFbStandard'],
1615                    'edtrack-guests': '',
1616                    'edtrack-children': '',
1617                    'edtrack-checkin': '',
1618                    'edtrack-checkout': '',
1619                    'edtrack-selectedchoice': '',
1620                    'edtrack-eventTarget': '',
1621                    'edtrack-email': '',
1622                };
1623				// sostituisco acuni placeholder ({{numero telefono}} o {{email cliccata}}) con i valori effettivi
1624				switch( item.dataset.trackclick ) {
1625					case "telefono":
1626						data_toPush['eventLabel'] = item.href.replace('tel:', '').replace(/ /g, '');
1627						data_toPush['edtrack-eventTarget'] = item.dataset.trackeventtarget;
1628						break;
1629					case "clickemail":
1630						data_toPush['eventLabel'] = item.href.replace('mailto:', '').replace(/ /g, '');
1631                        data_toPush['edtrack-eventTarget'] = item.dataset.trackeventtarget;
1632						break;
1633					case "whatsapp":
1634						data_toPush['eventLabel'] = item.href.replace(/http([s]*)\:\/\/(wa\.me|api\.whatsapp\.com)\/?/, '');
1635                        data_toPush['edtrack-eventTarget'] = item.dataset.trackeventtarget;
1636						break;
1637				}
1638
1639                dataLayer.push(data_toPush);
1640
1641                if (typeof (Storage) != "undefined" && localStorage.getItem('edt_debug') != null) {
1642                    console.log('[edt-track] event click', item.dataset.trackclick, data_toPush);
1643                }
1644            }
1645        })
1646    })
1647};
1648
1649edtTrackingCode();
1650
1651//datalayer push ip
1652var requestOptions = {
1653    method: 'GET',
1654    redirect: 'follow'
1655};
1656    // fetch("https://api.ipify.org", requestOptions)
1657    // .then(response => response.text())
1658    // .then(result => { 
1659    //     console.log(result); 
1660        
1661    //     dataLayer.push( {"event" : "pushIp", "ipAddress" : result});	
1662    // })
1663    // .catch(error => console.log('error:', error));
1664
1665document.addEventListener('submit', function(e){
1666    var form = e.target;
1667    
1668    if( form.dataset.tracksubmit in trackingClasses ){
1669        var formID = form.dataset.formid;
1670        var adultsNumber = 0;
1671        var childrensNumber = 0;
1672        var checkin = null;
1673        var checkout = null;
1674        var trattamento = null;
1675        
1676		var email = null;
1677
1678        var eventTarget = null;
1679        
1680        if(!validateForm( formID )){
1681            console.log('not valid');
1682            return false;
1683        } else{
1684            console.log('valid');
1685        }
1686        
1687        form.querySelectorAll('[data-tracksubmitfield=adults]').forEach(elem => {
1688            if(!elem.disabled){
1689                adultsNumber += Number(elem.value);
1690            }
1691        });
1692
1693        form.querySelectorAll('[data-tracksubmitfield=childrens]').forEach(elem => {
1694            if(!elem.disabled){
1695                childrensNumber += Number(elem.value);
1696            }
1697        });
1698
1699        if (form.querySelector('[data-tracksubmitfield=checkin]')) checkin = form.querySelector('[data-tracksubmitfield=checkin]').value;
1700        if (form.querySelector('[data-tracksubmitfield=checkout]')) checkout = form.querySelector('[data-tracksubmitfield=checkout]').value;
1701        if (form.querySelector('[data-tracksubmitfield=trattamento]')) trattamento = form.querySelector('[data-tracksubmitfield=trattamento]').value;
1702        
1703		if (form.querySelector('[data-tracksubmitfield=email]')) email = form.querySelector('[data-tracksubmitfield=email]').value;
1704        
1705		var data_toPush = {
1706            'event': trackingClasses[form.dataset.tracksubmit]['event'],
1707            'eventCategory': trackingClasses[form.dataset.tracksubmit]['eventCategory'],
1708            'Action': trackingClasses[form.dataset.tracksubmit]['Action'],
1709            'eventAction': trackingClasses[form.dataset.tracksubmit]['eventAction'],
1710            'eventLabel': window.location.href,
1711            'eventValue': trackingClasses[form.dataset.tracksubmit]['eventValue'],
1712            'eventFacebook': trackingClasses[form.dataset.tracksubmit]['eventFacebook'],
1713            'eventFbStandard': trackingClasses[form.dataset.tracksubmit]['eventFbStandard'],
1714            'edtrack-guests': adultsNumber,
1715            'edtrack-children': childrensNumber,
1716            'edtrack-checkin': checkin,
1717            'edtrack-checkout': checkout,
1718            'edtrack-email': email,
1719            'edtrack-selectedchoice': trattamento,
1720            'edtrack-eventTarget':  form.dataset.trackeventtarget    
1721        };
1722
1723
1724        dataLayer.push(data_toPush);
1725
1726        if (typeof (Storage) != "undefined" && localStorage.getItem('edt_debug') != null) {
1727            console.log('[edt-track] event click', form.dataset.tracksubmit, data_toPush);//debug
1728        }
1729    }
1730    
1731});
1732
1733document.addEventListener('DOMContentLoaded', function () {
1734	
1735	// INIZIO - tracciamento invio widget SimpleBooking (converto)
1736	// ATTENZIONE: non posso usare '#sb-container' come selettore perchè è lo stesso della nostra
1737	//             ShadoBox, usato nelle landing page edita. Devo quindi usare un controllo che tiene conto di questa cosa
1738	// if( document.querySelector('#sb-container') != null ) {
1739		// document.querySelector('#sb-container').addEventListener('click', function(e){
1740		document.addEventListener('click', function(e){
1741	
1742			// il pulsante di invio form può avere questi ID
1743			// sb-container_sb__form-field--checkavailability
1744			// sb-container-widget_sb__form-field--checkavailability
1745			if( !e.target.id.match(/field--checkavailability/)) return;
1746			
1747			var data_toPush = {
1748				'event': 'editaBooking',
1749				'eventCategory': 'Booking',
1750				'Action': 'Click',
1751				'eventAction': 'Click',
1752				'eventLabel': window.location.href,
1753				'eventValue': '1',
1754				'eventNhi': 'FALSE',
1755				'eventFacebook': 'Booking Click',
1756				'eventFbStandard': 'InitiateCheckout',
1757				'edtrack-guests': '',
1758				'edtrack-children': '',
1759				'edtrack-checkin': '',
1760				'edtrack-checkout': ''
1761			};
1762	
1763			dataLayer.push( data_toPush );
1764	
1765			console.log('[edt-track simplebooking]', data_toPush);
1766		});
1767	// }
1768	// FINE - tracciamento invio widget SimpleBooking (converto)
1769
1770	// INIZIO - gestione parametri utm
1771	try {
1772		if( typeof( Ecookies ) != "undefined" ) {
1773			
1774			// la prima volta che l'utente atterra sul sito mi salvo
1775			// eventuali parametri "utm_" nei cookie
1776			if( sessionStorage.getItem('edt_utm') == null ) {
1777				const urlParams = new URLSearchParams( window.location.search );
1778
1779				// se c'è il parametro "gclid" lo considero utm_source=google e utm_medium=cpc
1780				if( urlParams.get('gclid') != null && Ecookies.get('utm_source') == null && Ecookies.get('utm_medium') == null ) {
1781					Ecookies.set('utm_source', 'google');
1782					Ecookies.set('utm_medium', 'cpc');
1783				} else {
1784					// atrimenti salvo semplicemente nei cookie utm_source, utm_medium e utm_campaign così come sono
1785					if( Ecookies.get('utm_source') == null && urlParams.get('utm_source') != null ) {
1786						Ecookies.set('utm_source', urlParams.get('utm_source'));
1787					}
1788			
1789					if( Ecookies.get('utm_medium') == null && urlParams.get('utm_medium') != null ) {
1790						Ecookies.set('utm_medium', urlParams.get('utm_medium'));
1791					}
1792			
1793					if( Ecookies.get('utm_campaign') == null && urlParams.get('utm_campaign') != null ) {
1794						Ecookies.set('utm_campaign', urlParams.get('utm_campaign'));
1795					}
1796				}
1797
1798				sessionStorage.setItem('edt_utm', 'gestito');
1799			}
1800		}
1801	} catch(e) { console.log('Gestione utm', e); }
1802	// FINE - gestione parametri utm
1803});
1804
1805!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.AOS=t()}(this,function(){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t="Expected a function",n=NaN,o="[object Symbol]",i=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,c=/^0o[0-7]+$/i,s=parseInt,u="object"==typeof e&&e&&e.Object===Object&&e,d="object"==typeof self&&self&&self.Object===Object&&self,l=u||d||Function("return this")(),f=Object.prototype.toString,m=Math.max,p=Math.min,b=function(){return l.Date.now()};function v(e,n,o){var i,a,r,c,s,u,d=0,l=!1,f=!1,v=!0;if("function"!=typeof e)throw new TypeError(t);function y(t){var n=i,o=a;return i=a=void 0,d=t,c=e.apply(o,n)}function h(e){var t=e-u;return void 0===u||t>=n||t<0||f&&e-d>=r}function k(){var e=b();if(h(e))return x(e);s=setTimeout(k,function(e){var t=n-(e-u);return f?p(t,r-(e-d)):t}(e))}function x(e){return s=void 0,v&&i?y(e):(i=a=void 0,c)}function O(){var e=b(),t=h(e);if(i=arguments,a=this,u=e,t){if(void 0===s)return function(e){return d=e,s=setTimeout(k,n),l?y(e):c}(u);if(f)return s=setTimeout(k,n),y(u)}return void 0===s&&(s=setTimeout(k,n)),c}return n=w(n)||0,g(o)&&(l=!!o.leading,r=(f="maxWait"in o)?m(w(o.maxWait)||0,n):r,v="trailing"in o?!!o.trailing:v),O.cancel=function(){void 0!==s&&clearTimeout(s),d=0,i=u=a=s=void 0},O.flush=function(){return void 0===s?c:x(b())},O}function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function w(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&f.call(e)==o}(e))return n;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var u=r.test(e);return u||c.test(e)?s(e.slice(2),u?2:8):a.test(e)?n:+e}var y=function(e,n,o){var i=!0,a=!0;if("function"!=typeof e)throw new TypeError(t);return g(o)&&(i="leading"in o?!!o.leading:i,a="trailing"in o?!!o.trailing:a),v(e,n,{leading:i,maxWait:n,trailing:a})},h="Expected a function",k=NaN,x="[object Symbol]",O=/^\s+|\s+$/g,j=/^[-+]0x[0-9a-f]+$/i,E=/^0b[01]+$/i,N=/^0o[0-7]+$/i,z=parseInt,C="object"==typeof e&&e&&e.Object===Object&&e,A="object"==typeof self&&self&&self.Object===Object&&self,q=C||A||Function("return this")(),L=Object.prototype.toString,T=Math.max,M=Math.min,S=function(){return q.Date.now()};function D(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function H(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&L.call(e)==x}(e))return k;if(D(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=D(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(O,"");var n=E.test(e);return n||N.test(e)?z(e.slice(2),n?2:8):j.test(e)?k:+e}var $=function(e,t,n){var o,i,a,r,c,s,u=0,d=!1,l=!1,f=!0;if("function"!=typeof e)throw new TypeError(h);function m(t){var n=o,a=i;return o=i=void 0,u=t,r=e.apply(a,n)}function p(e){var n=e-s;return void 0===s||n>=t||n<0||l&&e-u>=a}function b(){var e=S();if(p(e))return v(e);c=setTimeout(b,function(e){var n=t-(e-s);return l?M(n,a-(e-u)):n}(e))}function v(e){return c=void 0,f&&o?m(e):(o=i=void 0,r)}function g(){var e=S(),n=p(e);if(o=arguments,i=this,s=e,n){if(void 0===c)return function(e){return u=e,c=setTimeout(b,t),d?m(e):r}(s);if(l)return c=setTimeout(b,t),m(s)}return void 0===c&&(c=setTimeout(b,t)),r}return t=H(t)||0,D(n)&&(d=!!n.leading,a=(l="maxWait"in n)?T(H(n.maxWait)||0,t):a,f="trailing"in n?!!n.trailing:f),g.cancel=function(){void 0!==c&&clearTimeout(c),u=0,o=s=i=c=void 0},g.flush=function(){return void 0===c?r:v(S())},g},W=function(){};function P(e){e&&e.forEach(function(e){var t=Array.prototype.slice.call(e.addedNodes),n=Array.prototype.slice.call(e.removedNodes
1805);if(function e(t){var n=void 0,o=void 0;for(n=0;n<t.length;n+=1){if((o=t[n]).dataset&&o.dataset.aos)return!0;if(o.children&&e(o.children))return!0}return!1}(t.concat(n)))return W()})}function Y(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}var _={isSupported:function(){return!!Y()},ready:function(e,t){var n=window.document,o=new(Y())(P);W=t,o.observe(n.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}},B=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},F=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),I=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},K=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,G=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,J=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,Q=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
1805sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;function R(){return navigator.userAgent||navigator.vendor||window.opera||""}var U=new(function(){function e(){B(this,e)}return F(e,[{key:"phone",value:function(){var e=R();return!(!K.test(e)&&!G.test(e.substr(0,4)))}},{key:"mobile",value:function(){var e=R();return!(!J.test(e)&&!Q.test(e.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}},{key:"ie11",value:function(){return"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style}}]),e}()),V=function(e,t){var n=void 0;return U.ie11()?(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,{detail:t}):n=new CustomEvent(e,{detail:t}),document.dispatchEvent(n)},X=function(e){return e.forEach(function(e,t){return function(e,t){var n=e.options,o=e.position,i=e.node,a=(e.data,function(){e.animated&&(function(e,t){t&&t.forEach(function(t){return e.classList.remove(t)})}(i,n.animatedClassNames),V("aos:out",i),e.options.id&&V("aos:in:"+e.options.id,i),e.animated=!1)});n.mirror&&t>=o.out&&!n.once?a():t>=o.in?e.animated||(function(e,t){t&&t.forEach(function(t){return e.classList.add(t)})}(i,n.animatedClassNames),V("aos:in",i),e.options.id&&V("aos:in:"+e.options.id,i),e.animated=!0):e.animated&&!n.once&&a()}(e,window.pageYOffset)})},Z=function(e){for(var t=0,n=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),n+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:n,left:t}},ee=function(e,t,n){var o=e.getAttribute("data-aos-"+t);if(void 0!==o){if("true"===o)return!0;if("false"===o)return!1}return o||n},te=function(e,t){return e.forEach(function(e,n){var o=ee(e.node,"mirror",t.mirror),i=ee(e.node,"once",t.once),a=ee(e.node,"id"),r=t.useClassNames&&e.node.getAttribute("data-aos"),c=[t.animatedClassName].concat(r?r.split(" "):[]).filter(function(e){return"string"==typeof e});t.initClassName&&e.node.classList.add(t.initClassName),e.position={in:function(e,t,n){var o=window.innerHeight,i=ee(e,"anchor"),a=ee(e,"anchor-placement"),r=Number(ee(e,"offset",a?0:t)),c=a||n,s=e;i&&document.querySelectorAll(i)&&(s=document.querySelectorAll(i)[0]);var u=Z(s).top-o;switch(c){case"top-bottom":break;case"center-bottom":u+=s.offsetHeight/2;break;case"bottom-bottom":u+=s.offsetHeight;break;case"top-center":u+=o/2;break;case"center-center":u+=o/2+s.offsetHeight/2;break;case"bottom-center":u+=o/2+s.offsetHeight;break;case"top-top":u+=o;break;case"bottom-top":u+=o+s.offsetHeight;break;case"center-top":u+=o+s.offsetHeight/2}return u+r}(e.node,t.offset,t.anchorPlacement),out:o&&function(e,t){window.innerHeight;var n=ee(e,"anchor"),o=ee(e,"offset",t),i=e;return n&&document.querySelectorAll(n)&&(i=document.querySelectorAll(n)[0]),Z(i).top+i.offsetHeight-o}(e.node,t.offset)},e.options={once:i,mirror:o,animatedClassNames:c,id:a}}),e},ne=function(){var e=document.querySelectorAll("[data-aos]");return Array.prototype.map.call(e,function(e){return{node:e}})},oe=[],ie=!1,ae={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,mirror:!1,anchorPlacement:"top-bottom",startEvent:"DOMContentLoaded",animatedClassName:"aos-animate",initClassName:"aos-init",useClassNames:!1,disableMutationObserver:!1,throttleDelay:99,debounceDelay:50},re=function(){return document.all&&!window.atob},ce=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(ie=!0),ie&&(oe=te(oe,ae),X(oe),window.addEventListener("scroll",y(function(){X(oe,ae.once)},ae.throttleDelay)))},se=function(){if(oe=ne(),de(ae.disable)||re())return ue();ce()},ue=function(){oe.forEach(function(e,t){e.node.removeAttribute("data-aos"),e.node.removeAttribute("data-aos-easing"),e.node.removeAttribute("data-aos-duration"),e.node.removeAttribute("data-aos-delay"),ae.initClassName&&e.node.classList.remove(ae.initClassName),ae.animatedClassName&&e.node.classList.remove(ae.animatedClassName)})},de=function(e){return!0===e||"mobile"===e&&U.mobile()||"phone"===e&&U.phone()||"tablet"===e&&U.tablet()||"function"==typeof e&&!0===e()};return{init:function(e){return ae=I(ae,e),oe=ne(),ae.disableMutationObserver||_.isSupported()||(console.info('\n      aos: MutationObserver is not supported on this browser,\n      code mutations observing has been disabled.\n      You may have to call "refreshHard()" by yourself.\n    '),ae.disableMutationObserver=!0),ae.disableMutationObserver||_.ready("[data-aos]",se),de(ae.disable)||re()?ue():(document.querySelector("body").setAttribute("data-aos-easing",ae.easing),document.querySelector("body").setAttribute("data-aos-duration",ae.duration),document.querySelector("body").setAttribute("data-aos-delay",ae.delay),-1===["DOMContentLoaded","load"].indexOf(ae.startEvent)?document.addEventListener(ae.startEvent,function(){ce(!0)}):window.addEventListener("load",function(){ce(!0)}
1805),"DOMContentLoaded"===ae.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1&&ce(!0),window.addEventListener("resize",$(ce,ae.debounceDelay,!0)),window.addEventListener("orientationchange",$(ce,ae.debounceDelay,!0)),oe)},refresh:ce,refreshHard:se}});
1806
1807!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Backpax=e():t.Backpax=e()}(window,function(){return function(t){var e={};function r(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,o){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(o,n,function(e){return t[e]}.bind(null,n));return o},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="bundle",r(r.s=39)}([function(t,e,r){"use strict";var o=TypeError,n=Object.getOwnPropertyDescriptor;if(n)try{n({},"")}catch(t){n=null}var i=function(){throw new o},a=n?function(){try{return arguments.callee,i}catch(t){try{return n(arguments,"callee").get}catch(t){return i}}}():i,f=r(14)(),p=Object.getPrototypeOf||function(t){return t.__proto__},u=void 0,y="undefined"==typeof Uint8Array?void 0:p(Uint8Array),c={"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer.prototype,"%ArrayIteratorPrototype%":f?p([][Symbol.iterator]()):void 0,"%ArrayPrototype%":Array.prototype,"%ArrayProto_entries%":Array.prototype.entries,"%ArrayProto_forEach%":Array.prototype.forEach,"%ArrayProto_keys%":Array.prototype.keys,"%ArrayProto_values%":Array.prototype.values,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":void 0,"%AsyncFunctionPrototype%":void 0,"%AsyncGenerator%":void 0,"%AsyncGeneratorFunction%":void 0,"%AsyncGeneratorPrototype%":void 0,"%AsyncIteratorPrototype%":u&&f&&Symbol.asyncIterator?u[Symbol.asyncIterator]():void 0,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%Boolean%":Boolean,"%BooleanPrototype%":Boolean.prototype,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%DataViewPrototype%":"undefined"==typeof DataView?void 0:DataView.prototype,"%Date%":Date,"%DatePrototype%":Date.prototype,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%ErrorPrototype%":Error.prototype,"%eval%":eval,"%EvalError%":EvalError,"%EvalErrorPrototype%":EvalError.prototype,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float32ArrayPrototype%":"undefined"==typeof Float32Array?void 0:Float32Array.prototype,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%Float64ArrayPrototype%":"undefined"==typeof Float64Array?void 0:Float64Array.prototype,"%Function%":Function,"%FunctionPrototype%":Function.prototype,"%Generator%":void 0,"%GeneratorFunction%":void 0,"%GeneratorPrototype%":void 0,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int8ArrayPrototype%":"undefined"==typeof Int8Array?void 0:Int8Array.prototype,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int16ArrayPrototype%":"undefined"==typeof Int16Array?void 0:Int8Array.prototype,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%Int32ArrayPrototype%":"undefined"==typeof Int32Array?void 0:Int32Array.prototype,"%isFinite%":isFinite,"%isNaN%":isNaN,"%
1807IteratorPrototype%":f?p(p([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%JSONParse%":"object"==typeof JSON?JSON.parse:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&f?p((new Map)[Symbol.iterator]()):void 0,"%MapPrototype%":"undefined"==typeof Map?void 0:Map.prototype,"%Math%":Math,"%Number%":Number,"%NumberPrototype%":Number.prototype,"%Object%":Object,"%ObjectPrototype%":Object.prototype,"%ObjProto_toString%":Object.prototype.toString,"%ObjProto_valueOf%":Object.prototype.valueOf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%PromisePrototype%":"undefined"==typeof Promise?void 0:Promise.prototype,"%PromiseProto_then%":"undefined"==typeof Promise?void 0:Promise.prototype.then,"%Promise_all%":"undefined"==typeof Promise?void 0:Promise.all,"%Promise_reject%":"undefined"==typeof Promise?void 0:Promise.reject,"%Promise_resolve%":"undefined"==typeof Promise?void 0:Promise.resolve,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%RangeErrorPrototype%":RangeError.prototype,"%ReferenceError%":ReferenceError,"%ReferenceErrorPrototype%":ReferenceError.prototype,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%RegExpPrototype%":RegExp.prototype,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&f?p((new Set)[Symbol.iterator]()):void 0,"%SetPrototype%":"undefined"==typeof Set?void 0:Set.prototype,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer.prototype,"%String%":String,"%StringIteratorPrototype%":f?p(""[Symbol.iterator]()):void 0,"%StringPrototype%":String.prototype,"%Symbol%":f?Symbol:void 0,"%SymbolPrototype%":f?Symbol.prototype:void 0,"%SyntaxError%":SyntaxError,"%SyntaxErrorPrototype%":SyntaxError.prototype,"%ThrowTypeError%":a,"%TypedArray%":y,"%TypedArrayPrototype%":y?y.prototype:void 0,"%TypeError%":o,"%TypeErrorPrototype%":o.prototype,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?void 0:Uint8Array.prototype,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray.prototype,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?void 0:Uint16Array.prototype,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?void 0:Uint32Array.prototype,"%URIError%":URIError,"%URIErrorPrototype%":URIError.prototype,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakMapPrototype%":"undefined"==typeof WeakMap?void 0:WeakMap.prototype,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"%WeakSetPrototype%":"undefined"==typeof WeakSet?void 0:WeakSet.prototype},s=r(4).call(Function.call,String.prototype.replace),l=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,d=/\\(\\)?/g;t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new TypeError('"allowMissing" argument must be a boolean');for(var r,i=(r=[],s(t,l,function(t,e,o,n){r[r.length]=o?s(n,d,"$1"):e||t}),r),a=function(t,e){if(!(t in c))throw new SyntaxError("intrinsic "+t+" does not exist!");if(void 0===c[t]&&!e)throw new o("intrinsic "+t+" exists, but is not available. Please file an issue!");return c[t]}("%"+(i.length>0?i[0]:"")+"%",e),f=1;f<i.length;f+=1)if(null!=a)if(n&&f+1>=i.length){var p=n(a,i[f]);if(!(e||i[f]in a))throw new o("base intrinsic for "+t+" exists, but the property is not available.");a=p?p.get||p.value:a[i[f]]}else a=a[i[f]];return a}},function(t,e,r){"use strict";var o=r(11),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,f=Object.defineProperty,p=f&&function(){var t={};try{for(var e in f(t,"x",{enumerable:!1,value:t}),t)return!1;return t.x===t}catch(t){return!1}}(),u=function(t,e,r,o){var n;e in t&&("function"!=typeof(n=o)||"[object Function]"!==i.call(n)||!o())||(p?f(t,e,{configurable:!0,enumerable:!1,value:r,writable:!0}):t[e]=r)},y=function(t,e){var r=arguments.length>2?arguments[2]:{},i=o(e);n&&(i=a.call(i,Object.getOwnPropertySymbols(e)));for(var f=0;f<i.length;f+=1)u(t,i[f],e[i[f]],r[i[f]])};y.supportsDescriptors=!!p,t.exports=y},function(t,e,r){"use strict";
1807t.exports=r(13)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var o=r(16);t.exports=Function.prototype.bind||o},function(t,e,r){"use strict";var o=r(17),n=r(18),i=r(37);t.exports=function(t){var e=o(this),r=n(e.length);if(!i(t))throw new TypeError("Array#find: predicate must be a function");if(0!==r){var a;arguments.length>0&&(a=arguments[1]);for(var f,p=0;p<r;p++)if(f=e[p],t.apply(a,[f,p,e]))return f}}},function(t,e,r){"use strict";var o=r(4),n=r(0),i=n("%Function.prototype.apply%"),a=n("%Function.prototype.call%"),f=n("%Reflect.apply%",!0)||o.call(a,i);t.exports=function(){return f(o,a,arguments)},t.exports.apply=function(){return f(o,i,arguments)}},function(t,e,r){"use strict";var o,n,i=Function.prototype.toString,a="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof a&&"function"==typeof Object.defineProperty)try{o=Object.defineProperty({},"length",{get:function(){throw n}}),n={}}catch(t){a=null}else a=null;var f=/^\s*class\b/,p=function(t){try{var e=i.call(t);return f.test(e)}catch(t){return!1}},u=Object.prototype.toString,y="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=a?function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if("function"==typeof t&&!t.prototype)return!0;try{a(t,null,o)}catch(t){if(t!==n)return!1}return!p(t)}:function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if("function"==typeof t&&!t.prototype)return!0;if(y)return function(t){try{return!p(t)&&(i.call(t),!0)}catch(t){return!1}}(t);if(p(t))return!1;var e=u.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}},function(t,e,r){"use strict";t.exports=function(){return Array.prototype.find&&1!==[,1].find(function(){return!0})?Array.prototype.find:r(5)}},function(t,e,r){"use strict";function o(t,e){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var r=Object(t),o=1;o<arguments.length;o++){var n=arguments[o];if(null!=n)for(var i=Object.keys(Object(n)),a=0,f=i.length;a<f;a++){var p=i[a],u=Object.getOwnPropertyDescriptor(n,p);void 0!==u&&u.enumerable&&(r[p]=n[p])}}return r}
1807t.exports={assign:o,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:o})}}},function(t,e,r){"use strict";var o=r(1),n=r(2),i=r(5),a=r(8),f=r(38),p=Array.prototype.slice,u=a(),y=function(t,e){n(t);var r=p.call(arguments,1);return u.apply(t,r)};o(y,{getPolyfill:a,implementation:i,shim:f}),t.exports=y},function(t,e,r){"use strict";var o=Object.prototype.hasOwnProperty,n=Object.prototype.toString,i=Array.prototype.slice,a=r(12),f=Object.prototype.propertyIsEnumerable,p=!f.call({toString:null},"toString"),u=f.call(function(){},"prototype"),y=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(t){var e=t.constructor;return e&&e.prototype===t},s={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},l=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!s["$"+t]&&o.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{c(window[t])}catch(t){return!0}}catch(t){return!0}return!1}(),d=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===n.call(t),i=a(t),f=e&&"[object String]"===n.call(t),s=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var d=u&&r;if(f&&t.length>0&&!o.call(t,0))for(var b=0;b<t.length;++b)s.push(String(b));if(i&&t.length>0)for(var v=0;v<t.length;++v)s.push(String(v));else for(var m in t)d&&"prototype"===m||!o.call(t,m)||s.push(String(m));if(p)for(var g=function(t){if("undefined"==typeof window||!l)return c(t);try{return c(t)}catch(t){return!1}}(t),h=0;h<y.length;++h)g&&"constructor"===y[h]||!o.call(t,y[h])||s.push(y[h]);return s};d.shim=function(){if(Object.keys){if(!function(){return 2===(Object.keys(arguments)||"").length}(1,2)){var t=Object.keys;Object.keys=function(e){return a(e)?t(i.call(e)):t(e)}}}else Object.keys=d;return Object.keys||d},t.exports=d},function(t,e,r){"use strict";var o=Object.prototype.toString;t.exports=function(t){var e=o.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===o.call(t.callee)),r}},function(t,e,r){"use strict";var o=r(0)("%TypeError%");t.exports=function(t,e){if(null==t)throw new o(e||"Cannot call method on "+t);return t}},function(t,e,r){"use strict";(function(e){var o=e.Symbol,n=r(15);t.exports=function(){return"function"==typeof o&&("function"==typeof Symbol&&("symbol"==typeof o("foo")&&("symbol"==typeof Symbol("bar")&&n())))}}).call(this,r(3))},function(t,e,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},function(t,e,r){"use strict";var o=Array.prototype.slice,n=Object.prototype.toString;t.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==n.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r,i=o.call(arguments,1),a=Math.max(0,e.length-i.length),f=[],p=0;p<a;p++)f.push("$"+p);if(r=Function("binder","return function ("+f.join(",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof r){var n=e.apply(this,i.concat(o.call(arguments)));return Object(n)===n?n:this}return e.apply(t,i.concat(o.call(arguments)))}),e.prototype){var u=function(){};u.prototype=e.prototype,r.prototype=new u,u.prototype=null}return r}},function(t,e,r){"use strict";var o=r(0)("%Object%"),n=r(2);t.exports=function(t){return n(t),o(t)}},function(t,e,r){"use strict";var o=r(19),n=r(20);t.exports=function(t){var e=n(t);return e<=0?0:e>o?o:e}},function(t,e,r){"use strict";var o=r(0),n=o("%Math%"),i=o("%Number%");
1807t.exports=i.MAX_SAFE_INTEGER||n.pow(2,53)-1},function(t,e,r){"use strict";var o=r(21),n=r(26);t.exports=function(t){var e=n(t);return o(e)}},function(t,e,r){"use strict";var o=r(0)("%Math%"),n=r(22),i=r(23),a=r(24),f=r(25),p=o.floor,u=o.abs;t.exports=function(t){var e=n(t);return i(e)?0:0!==e&&a(e)?f(e)*p(u(e)):e}},function(t,e,r){"use strict";t.exports=function(t){return+t}},function(t,e,r){"use strict";t.exports=Number.isNaN||function(t){return t!=t}},function(t,e,r){"use strict";var o=Number.isNaN||function(t){return t!=t};t.exports=Number.isFinite||function(t){return"number"==typeof t&&!o(t)&&t!==1/0&&t!==-1/0}},function(t,e,r){"use strict";t.exports=function(t){return t>=0?1:-1}},function(t,e,r){"use strict";var o=r(0),n=o("%TypeError%"),i=o("%Number%"),a=o("%RegExp%"),f=o("%parseInt%"),p=r(27),u=r(28),y=r(29),c=p("String.prototype.slice"),s=u(/^0b[01]+$/i),l=u(/^0o[0-7]+$/i),d=u(/^[-+]0x[0-9a-f]+$/i),b=u(new a("["+["…","​","￾"].join("")+"]","g")),v=["\t\n\v\f\r   ᠎    ","          \u2028","\u2029\ufeff"].join(""),m=new RegExp("(^["+v+"]+)|(["+v+"]+$)","g"),g=p("String.prototype.replace"),h=r(30);t.exports=function t(e){var r=y(e)?e:h(e,i);if("symbol"==typeof r)throw new n("Cannot convert a Symbol value to a number");if("string"==typeof r){if(s(r))return t(f(c(r,2),2));if(l(r))return t(f(c(r,2),8));if(b(r)||d(r))return NaN;var o=function(t){return g(t,m,"")}(r);if(o!==r)return t(o)}return i(r)}},function(t,e,r){"use strict";var o=r(0),n=r(6),i=n(o("String.prototype.indexOf"));t.exports=function(t,e){var r=o(t,!!e);return"function"==typeof r&&i(t,".prototype.")?n(r):r}},function(t,e,r){"use strict";var o=r(0)("RegExp.prototype.test"),n=r(6);t.exports=function(t){return n(o,t)}},function(t,e,r){"use strict";t.exports=function(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},function(t,e,r){"use strict";var o=r(31);t.exports=function(t){return arguments.length>1?o(t,arguments[1]):o(t)}},function(t,e,r){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,n=r(32),i=r(7),a=r(33),f=r(34);t.exports=function(t){if(n(t))return t;var e,r="default";if(arguments.length>1&&(arguments[1]===String?r="string":arguments[1]===Number&&(r="number")),o&&(Symbol.toPrimitive?e=function(t,e){var r=t[e];if(null!=r){if(!i(r))throw new TypeError(r+" returned for property "+e+" of object "+t+" is not a function");return r}}(t,Symbol.toPrimitive):f(t)&&(e=Symbol.prototype.valueOf)),void 0!==e){var p=e.call(t,r);
1807if(n(p))return p;throw new TypeError("unable to convert exotic object to primitive")}return"default"===r&&(a(t)||f(t))&&(r="string"),function(t,e){if(null==t)throw new TypeError("Cannot call method on "+t);if("string"!=typeof e||"number"!==e&&"string"!==e)throw new TypeError('hint must be "string" or "number"');var r,o,a,f="string"===e?["toString","valueOf"]:["valueOf","toString"];for(a=0;a<f.length;++a)if(r=t[f[a]],i(r)&&(o=r.call(t),n(o)))return o;throw new TypeError("No default value")}(t,"default"===r?"number":r)}},function(t,e,r){"use strict";t.exports=function(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},function(t,e,r){"use strict";var o=Date.prototype.getDay,n=Object.prototype.toString,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){return"object"==typeof t&&null!==t&&(i?function(t){try{return o.call(t),!0}catch(t){return!1}}(t):"[object Date]"===n.call(t))}},function(t,e,r){"use strict";var o=Object.prototype.toString;if(r(35)()){var n=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;t.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==o.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&i.test(n.call(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},function(t,e,r){"use strict";(function(e){var o=e.Symbol,n=r(36);t.exports=function(){return"function"==typeof o&&("function"==typeof Symbol&&("symbol"==typeof o("foo")&&("symbol"==typeof Symbol("bar")&&n())))}}).call(this,r(3))},function(t,e,r){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var n=Object.getOwnPropertyDescriptor(t,e);if(42!==n.value||!0!==n.enumerable)return!1}return!0}},function(t,e,r){"use strict";t.exports=r(7)},function(t,e,r){"use strict";var o=r(1),n=r(8);t.exports=function(){var t=n();return o(Array.prototype,{find:t},{find:function(){return Array.prototype.find!==t}}),t}},function(t,e,r){"use strict";r.r(e);var o=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},n=function(t,e,r){var o;return void 0===r&&(r=!1),function(){var n=r&&!o;clearTimeout(o),o=window.setTimeout(function(){o=void 0,r||t()},e),n&&t()}},i=r(9).assign,a=(r(10).shim(),{speed:"auto"}),f=function(){function t(t,e){var r=this;void 0===e&&(e={}),t instanceof NodeList?this.elements=t:this.elements=document.querySelectorAll(t),this.controls=[],this.items=[],this.options=i({},a,e),this.move=0,this.setup(),"requestAnimationFrame"in window&&document.addEventListener("scroll",function(){r.run()},{passive:!0}),window.addEventListener("resize",n(function(){[].forEach.call(r.elements,function(t,e){var o=t.dataset.id;if(o){var n=document.getElementById(o);n&&r.setBestImg(t,n,e)}})},100))}return t.prototype.setBestImg=function(t,e,r){var o=window.innerWidth,n=t.dataset.img,i=Object.keys(t.dataset).reduce(function(e,r){if(/img-\d*/.test(r)){var o=r.match(/img-(\d*)/);if(o&&o[1]){var n=parseInt(o[1],10);e.push({point:n,src:t.dataset[r]})}}return e},[]);i.sort(function(t,e){return t.point<e.point?-1:1});var a=i.find(function(t){return o<t.point});a&&(n=a.src);var f="url("+n+")";f!==e.style.backgroundImage&&(e.style.backgroundImage=f),this.setImgRatio(t,n,r)},t.prototype.setup=function(){var t=this;[].forEach.call(this.elements,function(e,r){e.style.position="relative",e.style.overflow="hidden";var o=(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase();e.dataset.id=o;var n=document.createElement("div");e.insertBefore(n,null),t.setBestImg(e,n,r),n.id=o,n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.right="0",n.style.bottom="0",n.style.backgroundRepeat="no-repeat",n.style.backgroundPosition="bottom center",n.style.backgroundSize="cover",n.style.transformStyle="flat",n.style.backfaceVisibility="hidden",n.style.willChange="transform",t.items.push({element:e,insert:n,elementOffsetHeight:e.offsetHeight,insertOffsetHeight:0})})},t.prototype.setImgRatio=function(t,e,r){var o=this,n=new Image;
1807n.onload=function(){var e=n.width/n.height,i=o.controls[r];i?i.ratio=e:o.controls[r]={ratio:e,speed:parseInt(t.dataset.speed,10)};var a=t.dataset.id,f=document.getElementById(a);f&&(t.offsetHeight>t.offsetWidth/e?(f.style.height=t.style.height,f.style.width=t.offsetHeight*e+"px"):(f.style.height=t.offsetWidth/e+"px",f.style.width="100%"),o.items[r].insertOffsetHeight=f.offsetHeight)},n.src=e},t.prototype.run=function(){var t=this,e=o(),r=window.innerHeight;[].forEach.call(this.items,function(o,n){var i=o.element,a=o.insert,f=i.getBoundingClientRect().top+e;if(t.controls[n]&&t.controls[n].ratio){var p=t.controls[n].ratio,u=o.elementOffsetHeight,y=o.insertOffsetHeight;if(!(e+r<f)){var c=e+r-f,s=u-y,l=t.options.speed;if("auto"===l){if(!p)return;l=(y-u)/(r+u/2)}t.controls[n]&&t.controls[n].speed&&(l=t.controls[n].speed);var d=s+c*l;c!==t.move&&requestAnimationFrame(function(){a.style.transform="translateY("+Math.round(d)+"px)"}),t.move=c}}})},t}();e.default=f}]).default});
1808/*! PhotoSwipe - v4.1.3 - 2019-01-08
1809* http://photoswipe.com
1810* Copyright (c) 2019 Dmitry Semenov; */
1811!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.PhotoSwipe=b()}(this,function(){"use strict";var a=function(a,b,c,d){var e={features:null,bind:function(a,b,c,d){var e=(d?"remove":"add")+"EventListener";b=b.split(" ");for(var f=0;f<b.length;f++)b[f]&&a[e](b[f],c,!1)},isArray:function(a){return a instanceof Array},createEl:function(a,b){var c=document.createElement(b||"div");return a&&(c.className=a),c},getScrollY:function(){var a=window.pageYOffset;return void 0!==a?a:document.documentElement.scrollTop},unbind:function(a,b,c){e.bind(a,b,c,!0)},removeClass:function(a,b){var c=new RegExp("(\\s|^)"+b+"(\\s|$)");a.className=a.className.replace(c," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")},addClass:function(a,b){e.hasClass(a,b)||(a.className+=(a.className?" ":"")+b)},hasClass:function(a,b){return a.className&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(a.className)},getChildByClass:function(a,b){for(var c=a.firstChild;c;){if(e.hasClass(c,b))return c;c=c.nextSibling}},arraySearch:function(a,b,c){for(var d=a.length;d--;)if(a[d][c]===b)return d;return-1},extend:function(a,b,c){for(var d in b)if(b.hasOwnProperty(d)){if(c&&a.hasOwnProperty(d))continue;a[d]=b[d]}},easing:{sine:{out:function(a){return Math.sin(a*(Math.PI/2))},inOut:function(a){return-(Math.cos(Math.PI*a)-1)/2}},cubic:{out:function(a){return--a*a*a+1}}},detectFeatures:function(){if(e.features)return e.features;var a=e.createEl(),b=a.style,c="",d={};if(d.oldIE=document.all&&!document.addEventListener,d.touch="ontouchstart"in window,window.requestAnimationFrame&&(d.raf=window.requestAnimationFrame,d.caf=window.cancelAnimationFrame),d.pointerEvent=!!window.PointerEvent||navigator.msPointerEnabled,!d.pointerEvent){var f=navigator.userAgent;if(/iP(hone|od)/.test(navigator.platform)){var g=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);g&&g.length>0&&(g=parseInt(g[1],10),g>=1&&g<8&&(d.isOldIOSPhone=!0))}var h=f.match(/Android\s([0-9\.]*)/),i=h?h[1]:0;i=parseFloat(i),i>=1&&(i<4.4&&(d.isOldAndroid=!0),d.androidVersion=i),d.isMobileOpera=/opera mini|o
1811pera mobi/i.test(f)}for(var j,k,l=["transform","perspective","animationName"],m=["","webkit","Moz","ms","O"],n=0;n<4;n++){c=m[n];for(var o=0;o<3;o++)j=l[o],k=c+(c?j.charAt(0).toUpperCase()+j.slice(1):j),!d[j]&&k in b&&(d[j]=k);c&&!d.raf&&(c=c.toLowerCase(),d.raf=window[c+"RequestAnimationFrame"],d.raf&&(d.caf=window[c+"CancelAnimationFrame"]||window[c+"CancelRequestAnimationFrame"]))}if(!d.raf){var p=0;d.raf=function(a){var b=(new Date).getTime(),c=Math.max(0,16-(b-p)),d=window.setTimeout(function(){a(b+c)},c);return p=b+c,d},d.caf=function(a){clearTimeout(a)}}return d.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,e.features=d,d}};e.detectFeatures(),e.features.oldIE&&(e.bind=function(a,b,c,d){b=b.split(" ");for(var e,f=(d?"detach":"attach")+"Event",g=function(){c.handleEvent.call(c)},h=0;h<b.length;h++)if(e=b[h])if("object"==typeof c&&c.handleEvent){if(d){if(!c["oldIE"+e])return!1}else c["oldIE"+e]=g;a[f]("on"+e,c["oldIE"+e])}else a[f]("on"+e,c)});var f=this,g=25,h=3,i={allowPanToNext:!0,spacing:.12,bgOpacity:1,mouseUsed:!1,loop:!0,pinchToClose:!0,closeOnScroll:!0,closeOnVerticalDrag:!0,verticalDragRange:.75,hideAnimationDuration:333,showAnimationDuration:333,showHideOpacity:!1,focus:!0,escKey:!0,arrowKeys:!0,mainScrollEndFriction:.35,panEndFriction:.35,isClickableElement:function(a){return"A"===a.tagName},getDoubleTapZoom:function(a,b){return a?1:b.initialZoomLevel<.7?1:1.33},maxSpreadZoom:1.33,modal:!0,scaleMode:"fit"};e.extend(i,d);var j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma=function(){return{x:0,y:0}},na=ma(),oa=ma(),pa=ma(),qa={},ra=0,sa={},ta=ma(),ua=0,va=!0,wa=[],xa={},ya=!1,za=function(a,b){e.extend(f,b.publicMethods),wa.push(a)},Aa=function(a){var b=ac();return a>b-1?a-b:a<0?b+a:a},Ba={},Ca=function(a,b){return Ba[a]||(Ba[a]=[]),Ba[a].push(b)},Da=function(a){var b=Ba[a];if(b){var c=Array.prototype.slice.call(arguments);c.shift();for(var d=0;d<b.length;d++)b[d].apply(f,c)}},Ea=function(){return(new Date).getTime()},Fa=function(a){ja=a,f.bg.style.opacity=a*i.bgOpacity},Ga=function(a,b,c,d,e){(!ya||e&&e!==f.currItem)&&(d/=e?e.fitRatio:f.currItem.fitRatio),a[E]=u+b+"px, "+c+"px"+v+" scale("+d+")"},Ha=function(a){ea&&(a&&(s>f.currItem.fitRatio?ya||(mc(f.currItem,!1,!0),ya=!0):ya&&(mc(f.currItem),ya=!1)),Ga(ea,pa.x,pa.y,s))},Ia=function(a){a.container&&Ga(a.container.style,a.initialPosition.x,a.initialPosition.y,a.initialZoomLevel,a)},Ja=function(a,b){b[E]=u+a+"px, 0px"+v},Ka=function(a,b){if(!i.loop&&b){var c=m+(ta.x*ra-a)/ta.x,d=Math.round(a-tb.x);(c<0&&d>0||c>=ac()-1&&d<0)&&(a=tb.x+d*i.mainScrollEndFriction)}tb.x=a,Ja(a,n)},La=function(a,b){var c=ub[a]-sa[a];return oa[a]+na[a]+c-c*(b/t)},Ma=function(a,b){a.x=b.x,a.y=b.y,b.id&&(a.id=b.id)},Na=function(a){a.x=Math.round(a.x),a.y=Math.round(a.y)},Oa=null,Pa=function(){Oa&&(e.unbind(document,"mousemove",Pa),e.addClass(a,"pswp--has_mouse"),i.mouseUsed=!0,Da("mouseUsed")),Oa=setTimeout(function(){Oa=null},100)},Qa=function(){e.bind(document,"keydown",f),N.transform&&e.bind(f.scrollWrap,"click",f),i.mouseUsed||e.bind(document,"mousemove",Pa),e.bind(window,"resize scroll orientationchange",f),Da("bindEvents")},Ra=function(){e.unbind(window,"resize scroll orientationchange",f),e.unbind(window,"scroll",r.scroll),e.unbind(document,"keydown",f),e.unbind(document,"mousemove",Pa),N.transform&&e.unbind(f.scrollWrap,"click",f),V&&e.unbind(window,p,f),clearTimeout(O),Da("unbindEvents")},Sa=function(a,b){var c=ic(f.currItem,qa,a);return b&&(da=c),c},Ta=function(a){return a||(a=f.currItem),a.initialZoomLevel},Ua=function(a){return a||(a=f.currItem),a.w>0?i.maxSpreadZoom:1},Va=function(a,b,c,d){return d===f.currItem.initialZoomLevel?(c[a]=f.currItem.initialPosition[a],!0):(c[a]=La(a,d),c[a]>b.min[a]?(c[a]=b.min[a],!0):c[a]<b.max[a]&&(c[a]=b.max[a],!0))},Wa=function(){if(E){var b=N.perspective&&!G;return u="translate"+(b?"3d(":"("),void(v=N.perspective?", 0px)":")")}E="left",e.addClass(a,"pswp--ie"),Ja=function(a,b){b.left=a+"px"},Ia=function(a){var b=a.fitRatio>1?1:a.fitRatio,c=a.container.style,d=b*a.w,e=b*a.h;c.width=d+"px",c.height=e+"px",c.left=a.initialPosition.x+"px",c.top=a.initialPosition.y+"px"},Ha=function(){if(ea){var a=ea,b=f.currItem,c=b.fitRatio>1?1:b.fitRatio,d=c*b.w,e=c*b.h;a.width=d+"px",a.height=e+"px",a.left=pa.x+"px",a.top=pa.y+"px"}}},Xa=function(a){var b="";i.escKey&&27===a.keyCode?b="close":i.arrowKeys&&(37===a.keyCode?b="prev":39===a.keyCode&&(b="next")),b&&(a.ctrlKey||a.altKey||a.shiftKey||a.metaKey||(a.preventDefault?a.preventDefault():a.returnValue=!1,f[b]()))},Ya=function(a){a&&(Y||X||fa||T)&&(a.preventDefault(),a.stopPropagation())},Za=function(){f.setScrollOffset(0,e.getScrollY())},$a={},_a=0,ab=function(a){$a[a]&&($a[a].raf&&I($a[a].raf),_a--,delete $a[a])},bb=function(a){$a[a]&&ab(a),$a[a]||(_a++,$a[a]={})},cb=function(){for(var a in $a)$a.hasOwnProperty(a)&&ab(a)},db=function(a,b,c,d,e,f,g){var h,i=Ea();
1811bb(a);var j=function(){if($a[a]){if(h=Ea()-i,h>=d)return ab(a),f(c),void(g&&g());f((c-b)*e(h/d)+b),$a[a].raf=H(j)}};j()},eb={shout:Da,listen:Ca,viewportSize:qa,options:i,isMainScrollAnimating:function(){return fa},getZoomLevel:function(){return s},getCurrentIndex:function(){return m},isDragging:function(){return V},isZooming:function(){return aa},setScrollOffset:function(a,b){sa.x=a,M=sa.y=b,Da("updateScrollOffset",sa)},applyZoomPan:function(a,b,c,d){pa.x=b,pa.y=c,s=a,Ha(d)},init:function(){if(!j&&!k){var c;f.framework=e,f.template=a,f.bg=e.getChildByClass(a,"pswp__bg"),J=a.className,j=!0,N=e.detectFeatures(),H=N.raf,I=N.caf,E=N.transform,L=N.oldIE,f.scrollWrap=e.getChildByClass(a,"pswp__scroll-wrap"),f.container=e.getChildByClass(f.scrollWrap,"pswp__container"),n=f.container.style,f.itemHolders=y=[{el:f.container.children[0],wrap:0,index:-1},{el:f.container.children[1],wrap:0,index:-1},{el:f.container.children[2],wrap:0,index:-1}],y[0].el.style.display=y[2].el.style.display="none",Wa(),r={resize:f.updateSize,orientationchange:function(){clearTimeout(O),O=setTimeout(function(){qa.x!==f.scrollWrap.clientWidth&&f.updateSize()},500)},scroll:Za,keydown:Xa,click:Ya};var d=N.isOldIOSPhone||N.isOldAndroid||N.isMobileOpera;for(N.animationName&&N.transform&&!d||(i.showAnimationDuration=i.hideAnimationDuration=0),c=0;c<wa.length;c++)f["init"+wa[c]]();if(b){var g=f.ui=new b(f,e);g.init()}Da("firstUpdate"),m=m||i.index||0,(isNaN(m)||m<0||m>=ac())&&(m=0),f.currItem=_b(m),(N.isOldIOSPhone||N.isOldAndroid)&&(va=!1),a.setAttribute("aria-hidden","false"),i.modal&&(va?a.style.position="fixed":(a.style.position="absolute",a.style.top=e.getScrollY()+"px")),void 0===M&&(Da("initialLayout"),M=K=e.getScrollY());var l="pswp--open ";for(i.mainClass&&(l+=i.mainClass+" "),i.showHideOpacity&&(l+="pswp--animate_opacity "),l+=G?"pswp--touch":"pswp--notouch",l+=N.animationName?" pswp--css_animation":"",l+=N.svg?" pswp--svg":"",e.addClass(a,l),f.updateSize(),o=-1,ua=null,c=0;c<h;c++)Ja((c+o)*ta.x,y[c].el.style);L||e.bind(f.scrollWrap,q,f),Ca("initialZoomInEnd",function(){f.setContent(y[0],m-1),f.setContent(y[2],m+1),y[0].el.style.display=y[2].el.style.display="block",i.focus&&a.focus(),Qa()}),f.setContent(y[1],m),f.updateCurrItem(),Da("afterInit"),va||(w=setInterval(function(){_a||V||aa||s!==f.currItem.initialZoomLevel||f.updateSize()},1e3)),e.addClass(a,"pswp--visible")}},close:function(){j&&(j=!1,k=!0,Da("close"),Ra(),cc(f.currItem,null,!0,f.destroy))},destroy:function(){Da("destroy"),Xb&&clearTimeout(Xb),a.setAttribute("aria-hidden","true"),a.className=J,w&&clearInterval(w),e.unbind(f.scrollWrap,q,f),e.unbind(window,"scroll",f),zb(),cb(),Ba=null},panTo:function(a,b,c){c||(a>da.min.x?a=da.min.x:a<da.max.x&&(a=da.max.x),b>da.min.y?b=da.min.y:b<da.max.y&&(b=da.max.y)),pa.x=a,pa.y=b,Ha()},handleEvent:function(a){a=a||window.event,r[a.type]&&r[a.type](a)},goTo:function(a){a=Aa(a);var b=a-m;ua=b,m=a,f.currItem=_b(m),ra-=b,Ka(ta.x*ra),cb(),fa=!1,f.updateCurrItem()},next:function(){f.goTo(m+1)},prev:function(){f.goTo(m-1)},updateCurrZoomItem:function(a){if(a&&Da("beforeChange",0),y[1].el.children.length){var b=y[1].el.children[0];ea=e.hasClass(b,"pswp__zoom-wrap")?b.style:null}else ea=null;da=f.currItem.bounds,t=s=f.currItem.initialZoomLevel,pa.x=da.center.x,pa.y=da.center.y,a&&Da("afterChange")},invalidateCurrItems:function(){x=!0;for(var a=0;a<h;a++)y[a].item&&(y[a].item.needsUpdate=!0)},updateCurrItem:function(a){if(0!==ua){var b,c=Math.abs(ua);if(!(a&&c<2)){f.currItem=_b(m),ya=!1,Da("beforeChange",ua),c>=h&&(o+=ua+(ua>0?-h:h),c=h);for(var d=0;d<c;d++)ua>0?(b=y.shift(),y[h-1]=b,o++,Ja((o+2)*ta.x,b.el.style),f.setContent(b,m-c+d+1+1)):(b=y.pop(),y.unshift(b),o--,Ja(o*ta.x,b.el.style),f.setContent(b,m+c-d-1-1));if(ea&&1===Math.abs(ua)){var e=_b(z);e.initialZoomLevel!==s&&(ic(e,qa),mc(e),Ia(e))}ua=0,f.updateCurrZoomItem(),z=m,Da("afterChange")}}},updateSize:function(b){if(!va&&i.modal){var c=e.getScrollY();if(M!==c&&(a.style.top=c+"px",M=c),!b&&xa.x===window.innerWidth&&xa.y===window.innerHeight)return;xa.x=window.innerWidth,xa.y=window.innerHeight,a.style.height=xa.y+"px"}if(qa.x=f.scrollWrap.clientWidth,qa.y=f.scrollWrap.clientHeight,Za(),ta.x=qa.x+Math.round(qa.x*i.spacing),ta.y=qa.y,Ka(ta.x*ra),Da("beforeResize"),void 0!==o){for(var d,g,j,k=0;k<h;k++)d=y[k],Ja((k+o)*ta.x,d.el.style),j=m+k-1,i.loop&&ac()>2&&(j=Aa(j)),g=_b(j),g&&(x||g.needsUpdate||!g.bounds)?(f.cleanSlide(g),f.setContent(d,j),1===k&&(f.currItem=g,f.updateCurrZoomItem(!0)),g.needsUpdate=!1):d.index===-1&&j>=0&&f.setContent(d,j),g&&g.container&&(ic(g,qa),mc(g),Ia(g));x=!1}
1811t=s=f.currItem.initialZoomLevel,da=f.currItem.bounds,da&&(pa.x=da.center.x,pa.y=da.center.y,Ha(!0)),Da("resize")},zoomTo:function(a,b,c,d,f){b&&(t=s,ub.x=Math.abs(b.x)-pa.x,ub.y=Math.abs(b.y)-pa.y,Ma(oa,pa));var g=Sa(a,!1),h={};Va("x",g,h,a),Va("y",g,h,a);var i=s,j={x:pa.x,y:pa.y};Na(h);var k=function(b){1===b?(s=a,pa.x=h.x,pa.y=h.y):(s=(a-i)*b+i,pa.x=(h.x-j.x)*b+j.x,pa.y=(h.y-j.y)*b+j.y),f&&f(b),Ha(1===b)};c?db("customZoomTo",0,1,c,d||e.easing.sine.inOut,k):k(1)}},fb=30,gb=10,hb={},ib={},jb={},kb={},lb={},mb=[],nb={},ob=[],pb={},qb=0,rb=ma(),sb=0,tb=ma(),ub=ma(),vb=ma(),wb=function(a,b){return a.x===b.x&&a.y===b.y},xb=function(a,b){return Math.abs(a.x-b.x)<g&&Math.abs(a.y-b.y)<g},yb=function(a,b){return pb.x=Math.abs(a.x-b.x),pb.y=Math.abs(a.y-b.y),Math.sqrt(pb.x*pb.x+pb.y*pb.y)},zb=function(){Z&&(I(Z),Z=null)},Ab=function(){V&&(Z=H(Ab),Qb())},Bb=function(){return!("fit"===i.scaleMode&&s===f.currItem.initialZoomLevel)},Cb=function(a,b){return!(!a||a===document)&&(!(a.getAttribute("class")&&a.getAttribute("class").indexOf("pswp__scroll-wrap")>-1)&&(b(a)?a:Cb(a.parentNode,b)))},Db={},Eb=function(a,b){return Db.prevent=!Cb(a.target,i.isClickableElement),Da("preventDragEvent",a,b,Db),Db.prevent},Fb=function(a,b){return b.x=a.pageX,b.y=a.pageY,b.id=a.identifier,b},Gb=function(a,b,c){c.x=.5*(a.x+b.x),c.y=.5*(a.y+b.y)},Hb=function(a,b,c){if(a-Q>50){var d=ob.length>2?ob.shift():{};d.x=b,d.y=c,ob.push(d),Q=a}},Ib=function(){var a=pa.y-f.currItem.initialPosition.y;return 1-Math.abs(a/(qa.y/2))},Jb={},Kb={},Lb=[],Mb=function(a){for(;Lb.length>0;)Lb.pop();return F?(la=0,mb.forEach(function(a){0===la?Lb[0]=a:1===la&&(Lb[1]=a),la++})):a.type.indexOf("touch")>-1?a.touches&&a.touches.length>0&&(Lb[0]=Fb(a.touches[0],Jb),a.touches.length>1&&(Lb[1]=Fb(a.touches[1],Kb))):(Jb.x=a.pageX,Jb.y=a.pageY,Jb.id="",Lb[0]=Jb),Lb},Nb=function(a,b){var c,d,e,g,h=0,j=pa[a]+b[a],k=b[a]>0,l=tb.x+b.x,m=tb.x-nb.x;return c=j>da.min[a]||j<da.max[a]?i.panEndFriction:1,j=pa[a]+b[a]*c,!i.allowPanToNext&&s!==f.currItem.initialZoomLevel||(ea?"h"!==ga||"x"!==a||X||(k?(j>da.min[a]&&(c=i.panEndFriction,h=da.min[a]-j,d=da.min[a]-oa[a]),(d<=0||m<0)&&ac()>1?(g=l,m<0&&l>nb.x&&(g=nb.x)):da.min.x!==da.max.x&&(e=j)):(j<da.max[a]&&(c=i.panEndFriction,h=j-da.max[a],d=oa[a]-da.max[a]),(d<=0||m>0)&&ac()>1?(g=l,m>0&&l<nb.x&&(g=nb.x)):da.min.x!==da.max.x&&(e=j))):g=l,"x"!==a)?void(fa||$||s>f.currItem.fitRatio&&(pa[a]+=b[a]*c)):(void 0!==g&&(Ka(g,!0),$=g!==nb.x),da.min.x!==da.max.x&&(void 0!==e?pa.x=e:$||(pa.x+=b.x*c)),void 0!==g)},Ob=function(a){if(!("mousedown"===a.type&&a.button>0)){if($b)return void a.preventDefault();if(!U||"mousedown"!==a.type){if(Eb(a,!0)&&a.preventDefault(),Da("pointerDown"),F){var b=e.arraySearch(mb,a.pointerId,"id");b<0&&(b=mb.length),mb[b]={x:a.pageX,y:a.pageY,id:a.pointerId}}var c=Mb(a),d=c.length;_=null,cb(),V&&1!==d||(V=ha=!0,e.bind(window,p,f),S=ka=ia=T=$=Y=W=X=!1,ga=null,Da("firstTouchStart",c),Ma(oa,pa),na.x=na.y=0,Ma(kb,c[0]),Ma(lb,kb),nb.x=ta.x*ra,ob=[{x:kb.x,y:kb.y}],Q=P=Ea(),Sa(s,!0),zb(),Ab()),!aa&&d>1&&!fa&&!$&&(t=s,X=!1,aa=W=!0,na.y=na.x=0,Ma(oa,pa),Ma(hb,c[0]),Ma(ib,c[1]),Gb(hb,ib,vb),ub.x=Math.abs(vb.x)-pa.x,ub.y=Math.abs(vb.y)-pa.y,ba=ca=yb(hb,ib))}}},Pb=function(a){if(a.preventDefault(),F){var b=e.arraySearch(mb,a.pointerId,"id");if(b>-1){var c=mb[b];c.x=a.pageX,c.y=a.pageY}}if(V){var d=Mb(a);if(ga||Y||aa)_=d;else if(tb.x!==ta.x*ra)ga="h";else{var f=Math.abs(d[0].x-kb.x)-Math.abs(d[0].y-kb.y);Math.abs(f)>=gb&&(ga=f>0?"h":"v",_=d)}}},Qb=function(){if(_){var a=_.length;if(0!==a)if(Ma(hb,_[0]),jb.x=hb.x-kb.x,jb.y=hb.y-kb.y,aa&&a>1){if(kb.x=hb.x,kb.y=hb.y,!jb.x&&!jb.y&&wb(_[1],ib))return;Ma(ib,_[1]),X||(X=!0,Da("zoomGestureStarted"));var b=yb(hb,ib),c=Vb(b);c>f.currItem.initialZoomLevel+f.currItem.initialZoomLevel/15&&(ka=!0);var d=1,e=Ta(),g=Ua();if(c<e)if(i.pinchToClose&&!ka&&t<=f.currItem.initialZoomLevel){var h=e-c,j=1-h/(e/1.2);Fa(j),Da("onPinchClose",j),ia=!0}else d=(e-c)/e,d>1&&(d=1),c=e-d*(e/3);else c>g&&(d=(c-g)/(6*e),d>1&&(d=1),c=g+d*e);d<0&&(d=0),ba=b,Gb(hb,ib,rb),na.x+=rb.x-vb.x,na.y+=rb.y-vb.y,Ma(vb,rb),pa.x=La("x",c),pa.y=La("y",c),S=c>s,s=c,Ha()}else{if(!ga)return;if(ha&&(ha=!1,Math.abs(jb.x)>=gb&&(jb.x-=_[0].x-lb.x),Math.abs(jb.y)>=gb&&(jb.y-=_[0].y-lb.y)),kb.x=hb.x,kb.y=hb.y,0===jb.x&&0===jb.y)return;if("v"===ga&&i.closeOnVerticalDrag&&!Bb()){na.y+=jb.y,pa.y+=jb.y;var k=Ib();return T=!0,Da("onVerticalDrag",k),Fa(k),void Ha()}Hb(Ea(),hb.x,hb.y),Y=!0,da=f.currItem.bounds;var l=Nb("x",jb);l||(Nb("y",jb),Na(pa),Ha())}}}
1811,Rb=function(a){if(N.isOldAndroid){if(U&&"mouseup"===a.type)return;a.type.indexOf("touch")>-1&&(clearTimeout(U),U=setTimeout(function(){U=0},600))}Da("pointerUp"),Eb(a,!1)&&a.preventDefault();var b;if(F){var c=e.arraySearch(mb,a.pointerId,"id");if(c>-1)if(b=mb.splice(c,1)[0],navigator.msPointerEnabled){var d={4:"mouse",2:"touch",3:"pen"};b.type=d[a.pointerType],b.type||(b.type=a.pointerType||"mouse")}else b.type=a.pointerType||"mouse"}var g,h=Mb(a),j=h.length;if("mouseup"===a.type&&(j=0),2===j)return _=null,!0;1===j&&Ma(lb,h[0]),0!==j||ga||fa||(b||("mouseup"===a.type?b={x:a.pageX,y:a.pageY,type:"mouse"}:a.changedTouches&&a.changedTouches[0]&&(b={x:a.changedTouches[0].pageX,y:a.changedTouches[0].pageY,type:"touch"})),Da("touchRelease",a,b));var k=-1;if(0===j&&(V=!1,e.unbind(window,p,f),zb(),aa?k=0:sb!==-1&&(k=Ea()-sb)),sb=1===j?Ea():-1,g=k!==-1&&k<150?"zoom":"swipe",aa&&j<2&&(aa=!1,1===j&&(g="zoomPointerUp"),Da("zoomGestureEnded")),_=null,Y||X||fa||T)if(cb(),R||(R=Sb()),R.calculateSwipeSpeed("x"),T){var l=Ib();if(l<i.verticalDragRange)f.close();else{var m=pa.y,n=ja;db("verticalDrag",0,1,300,e.easing.cubic.out,function(a){pa.y=(f.currItem.initialPosition.y-m)*a+m,Fa((1-n)*a+n),Ha()}),Da("onVerticalDrag",1)}}else{if(($||fa)&&0===j){var o=Ub(g,R);if(o)return;g="zoomPointerUp"}if(!fa)return"swipe"!==g?void Wb():void(!$&&s>f.currItem.fitRatio&&Tb(R))}},Sb=function(){var a,b,c={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(d){ob.length>1?(a=Ea()-Q+50,b=ob[ob.length-2][d]):(a=Ea()-P,b=lb[d]),c.lastFlickOffset[d]=kb[d]-b,c.lastFlickDist[d]=Math.abs(c.lastFlickOffset[d]),c.lastFlickDist[d]>20?c.lastFlickSpeed[d]=c.lastFlickOffset[d]/a:c.lastFlickSpeed[d]=0,Math.abs(c.lastFlickSpeed[d])<.1&&(c.lastFlickSpeed[d]=0),c.slowDownRatio[d]=.95,c.slowDownRatioReverse[d]=1-c.slowDownRatio[d],c.speedDecelerationRatio[d]=1},calculateOverBoundsAnimOffset:function(a,b){c.backAnimStarted[a]||(pa[a]>da.min[a]?c.backAnimDestination[a]=da.min[a]:pa[a]<da.max[a]&&(c.backA
1811nimDestination[a]=da.max[a]),void 0!==c.backAnimDestination[a]&&(c.slowDownRatio[a]=.7,c.slowDownRatioReverse[a]=1-c.slowDownRatio[a],c.speedDecelerationRatioAbs[a]<.05&&(c.lastFlickSpeed[a]=0,c.backAnimStarted[a]=!0,db("bounceZoomPan"+a,pa[a],c.backAnimDestination[a],b||300,e.easing.sine.out,function(b){pa[a]=b,Ha()}))))},calculateAnimOffset:function(a){c.backAnimStarted[a]||(c.speedDecelerationRatio[a]=c.speedDecelerationRatio[a]*(c.slowDownRatio[a]+c.slowDownRatioReverse[a]-c.slowDownRatioReverse[a]*c.timeDiff/10),c.speedDecelerationRatioAbs[a]=Math.abs(c.lastFlickSpeed[a]*c.speedDecelerationRatio[a]),c.distanceOffset[a]=c.lastFlickSpeed[a]*c.speedDecelerationRatio[a]*c.timeDiff,pa[a]+=c.distanceOffset[a])},panAnimLoop:function(){if($a.zoomPan&&($a.zoomPan.raf=H(c.panAnimLoop),c.now=Ea(),c.timeDiff=c.now-c.lastNow,c.lastNow=c.now,c.calculateAnimOffset("x"),c.calculateAnimOffset("y"),Ha(),c.calculateOverBoundsAnimOffset("x"),c.calculateOverBoundsAnimOffset("y"),c.speedDecelerationRatioAbs.x<.05&&c.speedDecelerationRatioAbs.y<.05))return pa.x=Math.round(pa.x),pa.y=Math.round(pa.y),Ha(),void ab("zoomPan")}};return c},Tb=function(a){return a.calculateSwipeSpeed("y"),da=f.currItem.bounds,a.backAnimDestination={},a.backAnimStarted={},Math.abs(a.lastFlickSpeed.x)<=.05&&Math.abs(a.lastFlickSpeed.y)<=.05?(a.speedDecelerationRatioAbs.x=a.speedDecelerationRatioAbs.y=0,a.calculateOverBoundsAnimOffset("x"),a.calculateOverBoundsAnimOffset("y"),!0):(bb("zoomPan"),a.lastNow=Ea(),void a.panAnimLoop())},Ub=function(a,b){var c;fa||(qb=m);var d;if("swipe"===a){var g=kb.x-lb.x,h=b.lastFlickDist.x<10;g>fb&&(h||b.lastFlickOffset.x>20)?d=-1:g<-fb&&(h||b.lastFlickOffset.x<-20)&&(d=1)}var j;d&&(m+=d,m<0?(m=i.loop?ac()-1:0,j=!0):m>=ac()&&(m=i.loop?0:ac()-1,j=!0),j&&!i.loop||(ua+=d,ra-=d,c=!0));var k,l=ta.x*ra,n=Math.abs(l-tb.x);return c||l>tb.x==b.lastFlickSpeed.x>0?(k=Math.abs(b.lastFlickSpeed.x)>0?n/Math.abs(b.lastFlickSpeed.x):333,k=Math.min(k,400),k=Math.max(k,250)):k=333,qb===m&&(c=!1),fa=!0,Da("mainScrollAnimStart"),db("mainScroll",tb.x,l,k,e.easing.cubic.out,Ka,function(){cb(),fa=!1,qb=-1,(c||qb!==m)&&f.updateCurrItem(),Da("mainScrollAnimComplete")}),c&&f.updateCurrItem(!0),c},Vb=function(a){return 1/ca*a*t},Wb=function(){var a=s,b=Ta(),c=Ua();s<b?a=b:s>c&&(a=c);var d,g=1,h=ja;return ia&&!S&&!ka&&s<b?(f.close(),!0):(ia&&(d=function(a){Fa((g-h)*a+h)}),f.zoomTo(a,0,200,e.easing.cubic.out,d),!0)};za("Gestures",{publicMethods:{initGestures:function(){var a=function(a,b,c,d,e){A=a+b,B=a+c,C=a+d,D=e?a+e:""};F=N.pointerEvent,F&&N.touch&&(N.touch=!1),F?navigator.msPointerEnabled?a("MSPointer","Down","Move","Up","Cancel"):a("pointer","down","move","up","cancel"):N.touch?(a("touch","start","move","end","cancel"),G=!0):a("mouse","down","move","up"),p=B+" "+C+" "+D,q=A,F&&!G&&(G=navigator.maxTouchPoints>1||navigator.msMaxTouchPoints>1),f.likelyTouchDevice=G,r[A]=Ob,r[B]=Pb,r[C]=Rb,D&&(r[D]=r[C]),N.touch&&(q+=" mousedown",p+=" mousemove mouseup",r.mousedown=r[A],r.mousemove=r[B],r.mouseup=r[C]),G||(i.allowPanToNext=!1)}}});var Xb,Yb,Zb,$b,_b,ac,bc,cc=function(b,c,d,g){Xb&&clearTimeout(Xb),$b=!0,Zb=!0;var h;b.initialLayout?(h=b.initialLayout,b.initialLayout=null):h=i.getThumbBoundsFn&&i.getThumbBoundsFn(m);var j=d?i.hideAnimationDuration:i.showAnimationDuration,k=function(){ab("initialZoom"),d?(f.template.removeAttribute("style"),f.bg.removeAttribute("style")):(Fa(1),c&&(c.style.display="block"),e.addClass(a,"pswp--animated-in"),Da("initialZoom"+(d?"OutEnd":"InEnd"))),g&&g(),$b=!1};if(!j||!h||void 0===h.x)return Da("initialZoom"+(d?"Out":"In")),s=b.initialZoomLevel,Ma(pa,b.initialPosition),Ha(),a.style.opacity=d?0:1,Fa(1),void(j?setTimeout(function(){k()},j):k());var n=function(){var c=l,g=!f.currItem.src||f.currItem.loadError||i.showHideOpacity;b.miniImg&&(b.miniImg.style.webkitBackfaceVisibility="hidden"),d||(s=h.w/b.w,pa.x=h.x,pa.y=h.y-K,f[g?"template":"bg"].style.opacity=.001,Ha()),bb("initialZoom"),d&&!c&&e.removeClass(a,"pswp--animated-in"),g&&(d?e[(c?"remove":"add")+"Class"](a,"pswp--animate_opacity"):setTimeout(function(){e.addClass(a,"pswp--animate_opacity")},30)),Xb=setTimeout(function(){if(Da("initialZoom"+(d?"Out":"In")),d){var f=h.w/b.w,i={x:pa.x,y:pa.y},l=s,m=ja,n=function(b){1===b?(s=f,pa.x=h.x,pa.y=h.y-M):(s=(f-l)*b+l,pa.x=(h.x-i.x)*b+i.x,pa.y=(h.y-M-i.y)*b+i.y),Ha(),g?a.style.opacity=1-b:Fa(m-b*m)};c?db("initialZoom",0,1,j,e.easing.cubic.out,n,k):(n(1),Xb=setTimeout(k,j+20))}else s=b.initialZoomLevel,Ma(pa,b.initialPosition),Ha(),Fa(1),g?a.style.opacity=1:Fa(1),Xb=setTimeout(k,j+20)},d?25:90)};n()},dc={},ec=[],fc={index:0,errorMsg:'<div class="pswp__error-msg"><a href="%url%" target="_blank">The image</a> could not be loaded.</div>',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return Yb.length}},gc=function(){return{center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}}},hc=function(a,b,c){var d=a.bounds;d.center.x=Math.round((dc.x-b)/2),d.center.y=Math.round((dc.y-c)/2)+a.vGap.top,d.max.x=b>dc.x?Math.round(dc.x-b):d.center.x,d.max.y=c>dc.y?Math.round(dc.y-c)+a.vGap.top:d.center.y,d.min.x=b>dc.x?0:d.center.x,d.min.y=c>dc.y?a.vGap.top:d.center.y},ic=function(a,b,c){if(a.src&&!a.loadError){var d=!c;if(d&&(a.vGap||(a.vGap={top:0,bottom:0}),Da("parseVerticalMargin",a)),dc.x=b.x,dc.y=b.y-a.vGap.top-a.vGap.bottom,d){var e=dc.x/a.w,f=dc.y/a.h;a.fitRatio=e<f?e:f;var g=i.scaleMode;"orig"===g?c=1:"fit"===g&&(c=a.fitRatio),c>1&&(c=1),a.initialZoomLevel=c,a.bounds||(a.bounds=gc())}if(!c)return;return hc(a,a.w*c,a.h*c),d&&c===a.initialZoomLevel&&(a.initialPosition=a.bounds.center),a.bounds}return a.w=a.h=0,a.initialZoomLevel=a.fitRatio=1,a.bounds=gc(),a.initialPosition=a.bounds.center,a.bounds},jc=function(a,b,c,d,e,g){b.loadError||d&&(b.imageAppended=!0,mc(b,d,b===f.currItem&&ya),c.appendChild(d),g&&setTimeout(function(){b&&b.loaded&&b.placeholder&&(b.placeholder.style.display="none",b.placeholder=null)},500))},kc=function(a){a.loading=!0,a.loaded=!1;var b=a.img=e.createEl("pswp__img","img"),c=function(){a.loading=!1,a.loaded=!0,a.loadComplete?a.loadComplete(a):a.img=null,b.onload=b.onerror=null,b=null};
1811return b.onload=c,b.onerror=function(){a.loadError=!0,c()},b.src=a.src,b},lc=function(a,b){if(a.src&&a.loadError&&a.container)return b&&(a.container.innerHTML=""),a.container.innerHTML=i.errorMsg.replace("%url%",a.src),!0},mc=function(a,b,c){if(a.src){b||(b=a.container.lastChild);var d=c?a.w:Math.round(a.w*a.fitRatio),e=c?a.h:Math.round(a.h*a.fitRatio);a.placeholder&&!a.loaded&&(a.placeholder.style.width=d+"px",a.placeholder.style.height=e+"px"),b.style.width=d+"px",b.style.height=e+"px"}},nc=function(){if(ec.length){for(var a,b=0;b<ec.length;b++)a=ec[b],a.holder.index===a.index&&jc(a.index,a.item,a.baseDiv,a.img,!1,a.clearPlaceholder);ec=[]}};za("Controller",{publicMethods:{lazyLoadItem:function(a){a=Aa(a);var b=_b(a);b&&(!b.loaded&&!b.loading||x)&&(Da("gettingData",a,b),b.src&&kc(b))},initController:function(){e.extend(i,fc,!0),f.items=Yb=c,_b=f.getItemAt,ac=i.getNumItemsFn,bc=i.loop,ac()<3&&(i.loop=!1),Ca("beforeChange",function(a){var b,c=i.preload,d=null===a||a>=0,e=Math.min(c[0],ac()),g=Math.min(c[1],ac());for(b=1;b<=(d?g:e);b++)f.lazyLoadItem(m+b);for(b=1;b<=(d?e:g);b++)f.lazyLoadItem(m-b)}),Ca("initialLayout",function(){f.currItem.initialLayout=i.getThumbBoundsFn&&i.getThumbBoundsFn(m)}),Ca("mainScrollAnimComplete",nc),Ca("initialZoomInEnd",nc),Ca("destroy",function(){for(var a,b=0;b<Yb.length;b++)a=Yb[b],a.container&&(a.container=null),a.placeholder&&(a.placeholder=null),a.img&&(a.img=null),a.preloader&&(a.preloader=null),a.loadError&&(a.loaded=a.loadError=!1);ec=null})},getItemAt:function(a){return a>=0&&(void 0!==Yb[a]&&Yb[a])},allowProgressiveImg:function(){return i.forceProgressiveLoading||!G||i.mouseUsed||screen.width>1200},setContent:function(a,b){i.loop&&(b=Aa(b));var c=f.getItemAt(a.index);c&&(c.container=null);var d,g=f.getItemAt(b);if(!g)return void(a.el.innerHTML="");Da("gettingData",b,g),a.index=b,a.item=g;var h=g.container=e.createEl("pswp__zoom-wrap");if(!g.src&&g.html&&(g.html.tagName?h.appendChild(g.html):h.innerHTML=g.html),lc(g),ic(g,qa),!g.src||g.loadError||g.loaded)g.src&&!g.loadError&&(d=e.createEl("pswp__img","img"),d.style.opacity=1,d.src=g.src,mc(g,d),jc(b,g,h,d,!0));else{if(g.loadComplete=function(c){if(j){if(a&&a.index===b){if(lc(c,!0))return c.loadComplete=c.img=null,ic(c,qa),Ia(c),void(a.index===m&&f.updateCurrZoomItem());c.imageAppended?!$b&&c.placeholder&&(c.placeholder.style.display="none",c.placeholder=null):N.transform&&(fa||$b)?ec.push({item:c,baseDiv:h,img:c.img,index:b,holder:a,clearPlaceholder:!0}):jc(b,c,h,c.img,fa||$b,!0)}c.loadComplete=null,c.img=null,Da("imageLoadComplete",b,c)}},e.features.transform){var k="pswp__img pswp__img--placeholder";k+=g.msrc?"":" pswp__img--placeholder--blank";var l=e.createEl(k,g.msrc?"img":"");g.msrc&&(l.src=g.msrc),mc(g,l),h.appendChild(l),g.placeholder=l}g.loading||kc(g),f.allowProgressiveImg()&&(!Zb&&N.transform?ec.push({item:g,baseDiv:h,img:g.img,index:b,holder:a}):jc(b,g,h,g.img,!0,!0))}Zb||b!==m?Ia(g):(ea=h.style,cc(g,d||g.img)),a.el.innerHTML="",a.el.appendChild(h)},cleanSlide:function(a){a.img&&(a.img.onload=a.img.onerror=null),a.loaded=a.loading=a.img=a.imageAppended=!1}}});var oc,pc={},qc=function(a,b,c){var d=document.createEvent("CustomEvent"),e={origEvent:a,target:a.target,releasePoint:b,pointerType:c||"touch"};d.initCustomEvent("pswpTap",!0,!0,e),a.target.dispatchEvent(d)};za("Tap",{publicMethods:{initTap:function(){Ca("firstTouchStart",f.onTapStart),Ca("touchRelease",f.onTapRelease),Ca("destroy",function(){pc={},oc=null})},onTapStart:function(a){a.length>1&&(clearTimeout(oc),oc=null)},onTapRelease:function(a,b){if(b&&!Y&&!W&&!_a){var c=b;if(oc&&(clearTimeout(oc),oc=null,xb(c,pc)))return void Da("doubleTap",c);if("mouse"===b.type)return void qc(a,b,"mouse");var d=a.target.tagName.toUpperCase();if("BUTTON"===d||e.hasClass(a.target,"pswp__single-tap"))return void qc(a,b);Ma(pc,c),oc=setTimeout(function(){qc(a,b),oc=null},300)}}}});var rc;za("DesktopZoom",{publicMethods:{initDesktopZoom:function(){L||(G?Ca("mouseUsed",function(){f.setupDesktopZoom()}):f.setupDesktopZoom(!0))},setupDesktopZoom:function(b){rc={};var c="wheel mousewheel DOMMouseScroll";Ca("bindEvents",function(){e.bind(a,c,f.handleMouseWheel)}),Ca("unbindEvents",function(){rc&&e.unbind(a,c,f.handleMouseWheel)}),f.mouseZoomedIn=!1;var d,g=function(){f.mouseZoomedIn&&(e.removeClass(a,"pswp--zoomed-in"),f.mouseZoomedIn=!1),s<1?e.addClass(a,"pswp--zoom-allowed"):e.removeClass(a,"pswp--zoom-allowed"),h()},h=function(){d&&(e.removeClass(a,"pswp--dragging"),d=!1)};Ca("resize",g),Ca("afterChange",g),Ca("pointerDown",function(){f.mouseZoomedIn&&(d=!0,e.addClass(a,"pswp--dragging"))}),Ca("pointerUp",h),b||g()}
1811,handleMouseWheel:function(a){if(s<=f.currItem.fitRatio)return i.modal&&(!i.closeOnScroll||_a||V?a.preventDefault():E&&Math.abs(a.deltaY)>2&&(l=!0,f.close())),!0;if(a.stopPropagation(),rc.x=0,"deltaX"in a)1===a.deltaMode?(rc.x=18*a.deltaX,rc.y=18*a.deltaY):(rc.x=a.deltaX,rc.y=a.deltaY);else if("wheelDelta"in a)a.wheelDeltaX&&(rc.x=-.16*a.wheelDeltaX),a.wheelDeltaY?rc.y=-.16*a.wheelDeltaY:rc.y=-.16*a.wheelDelta;else{if(!("detail"in a))return;rc.y=a.detail}Sa(s,!0);var b=pa.x-rc.x,c=pa.y-rc.y;(i.modal||b<=da.min.x&&b>=da.max.x&&c<=da.min.y&&c>=da.max.y)&&a.preventDefault(),f.panTo(b,c)},toggleDesktopZoom:function(b){b=b||{x:qa.x/2+sa.x,y:qa.y/2+sa.y};var c=i.getDoubleTapZoom(!0,f.currItem),d=s===c;f.mouseZoomedIn=!d,f.zoomTo(d?f.currItem.initialZoomLevel:c,b,333),e[(d?"remove":"add")+"Class"](a,"pswp--zoomed-in")}}});var sc,tc,uc,vc,wc,xc,yc,zc,Ac,Bc,Cc,Dc,Ec={history:!0,galleryUID:1},Fc=function(){return Cc.hash.substring(1)},Gc=function(){sc&&clearTimeout(sc),uc&&clearTimeout(uc)},Hc=function(){var a=Fc(),b={};if(a.length<5)return b;var c,d=a.split("&");for(c=0;c<d.length;c++)if(d[c]){var e=d[c].split("=");e.length<2||(b[e[0]]=e[1])}if(i.galleryPIDs){var f=b.pid;for(b.pid=0,c=0;c<Yb.length;c++)if(Yb[c].pid===f){b.pid=c;break}}else b.pid=parseInt(b.pid,10)-1;return b.pid<0&&(b.pid=0),b},Ic=function(){if(uc&&clearTimeout(uc),_a||V)return void(uc=setTimeout(Ic,500));vc?clearTimeout(tc):vc=!0;var a=m+1,b=_b(m);b.hasOwnProperty("pid")&&(a=b.pid);var c=yc+"&gid="+i.galleryUID+"&pid="+a;zc||Cc.hash.indexOf(c)===-1&&(Bc=!0);var d=Cc.href.split("#")[0]+"#"+c;Dc?"#"+c!==window.location.hash&&history[zc?"replaceState":"pushState"]("",document.title,d):zc?Cc.replace(d):Cc.hash=c,zc=!0,tc=setTimeout(function(){vc=!1},60)};za("History",{publicMethods:{initHistory:function(){if(e.extend(i,Ec,!0),i.history){Cc=window.location,Bc=!1,Ac=!1,zc=!1,yc=Fc(),Dc="pushState"in history,yc.indexOf("gid=")>-1&&(yc=yc.split("&gid=")[0],yc=yc.split("?gid=")[0]),Ca("afterChange",f.updateURL),Ca("unbindEvents",function(){e.unbind(window,"hashchange",f.onHashChange)});var a=function(){xc=!0,Ac||(Bc?history.back():yc?Cc.hash=yc:Dc?history.pushState("",document.title,Cc.pathname+Cc.search):Cc.hash=""),Gc()};Ca("unbindEvents",function(){l&&a()}),Ca("destroy",function(){xc||a()}),Ca("firstUpdate",function(){m=Hc().pid});var b=yc.indexOf("pid=");b>-1&&(yc=yc.substring(0,b),"&"===yc.slice(-1)&&(yc=yc.slice(0,-1))),setTimeout(function(){j&&e.bind(window,"hashchange",f.onHashChange)},40)}},onHashChange:function(){return Fc()===yc?(Ac=!0,void f.close()):void(vc||(wc=!0,f.goTo(Hc().pid),wc=!1))},updateURL:function(){Gc(),wc||(zc?sc=setTimeout(Ic,800):Ic())}}}),e.extend(f,eb)};return a});
1812/*! PhotoSwipe Default UI - 4.1.3 - 2019-01-08
1813* http://photoswipe.com
1814* Copyright (c) 2019 Dmitry Semenov; */
1815!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.PhotoSwipeUI_Default=b()}(this,function(){"use strict";var a=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=this,w=!1,x=!0,y=!0,z={barsSize:{top:44,bottom:"auto"},closeElClasses:["item","caption","zoom-wrap","ui","top-bar"],timeToIdle:4e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(a,b){return a.title?(b.children[0].innerHTML=a.title,!0):(b.children[0].innerHTML="",!1)},closeEl:!0,captionEl:!0,fullscreenEl:!0,zoomEl:!0,shareEl:!0,counterEl:!0,arrowEl:!0,preloaderEl:!0,tapToClose:!1,tapToToggleControls:!0,clickToCloseNonZoomable:!0,shareButtons:[{id:"facebook",label:"Share on Facebook",url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:"Tweet",url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{id:"pinterest",label:"Pin it",url:"http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"},{id:"download",label:"Download image",url:"{{raw_image_url}}",download:!0}],getImageURLForShare:function(){return a.currItem.src||""},getPageURLForShare:function(){return window.location.href},getTextForShare:function(){return a.currItem.title||""},indexIndicatorSep:" / ",fitControlsWidth:1200}
1815,A=function(a){if(r)return!0;a=a||window.event,q.timeToIdle&&q.mouseUsed&&!k&&K();for(var c,d,e=a.target||a.srcElement,f=e.getAttribute("class")||"",g=0;g<S.length;g++)c=S[g],c.onTap&&f.indexOf("pswp__"+c.name)>-1&&(c.onTap(),d=!0);if(d){a.stopPropagation&&a.stopPropagation(),r=!0;var h=b.features.isOldAndroid?600:30;s=setTimeout(function(){r=!1},h)}},B=function(){return!a.likelyTouchDevice||q.mouseUsed||screen.width>q.fitControlsWidth},C=function(a,c,d){b[(d?"add":"remove")+"Class"](a,"pswp__"+c)},D=function(){var a=1===q.getNumItemsFn();a!==p&&(C(d,"ui--one-slide",a),p=a)},E=function(){C(i,"share-modal--hidden",y)},F=function(){return y=!y,y?(b.removeClass(i,"pswp__share-modal--fade-in"),setTimeout(function(){y&&E()},300)):(E(),setTimeout(function(){y||b.addClass(i,"pswp__share-modal--fade-in")},30)),y||H(),!1},G=function(b){b=b||window.event;var c=b.target||b.srcElement;return a.shout("shareLinkClick",b,c),!!c.href&&(!!c.hasAttribute("download")||(window.open(c.href,"pswp_share","scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,top=100,left="+(window.screen?Math.round(screen.width/2-275):100)),y||F(),!1))},H=function(){for(var a,b,c,d,e,f="",g=0;g<q.shareButtons.length;g++)a=q.shareButtons[g],c=q.getImageURLForShare(a),d=q.getPageURLForShare(a),e=q.getTextForShare(a),b=a.url.replace("{{url}}",encodeURIComponent(d)).replace("{{image_url}}",encodeURIComponent(c)).replace("{{raw_image_url}}",c).replace("{{text}}",encodeURIComponent(e)),f+='<a href="'+b+'" target="_blank" class="pswp__share--'+a.id+'"'+(a.download?"download":"")+">"+a.label+"</a>",q.parseShareButtonOut&&(f=q.parseShareButtonOut(a,f));i.children[0].innerHTML=f,i.children[0].onclick=G},I=function(a){for(var c=0;c<q.closeElClasses.length;c++)if(b.hasClass(a,"pswp__"+q.closeElClasses[c]))return!0},J=0,K=function(){clearTimeout(u),J=0,k&&v.setIdle(!1)},L=function(a){a=a?a:window.event;var b=a.relatedTarget||a.toElement;b&&"HTML"!==b.nodeName||(clearTimeout(u),u=setTimeout(function(){v.setIdle(!0)},q.timeToIdleOutside))},M=function(){q.fullscreenEl&&!b.features.isOldAndroid&&(c||(c=v.getFullscreenAPI()),c?(b.bind(document,c.eventK,v.updateFullscreen),v.updateFullscreen(),b.addClass(a.template,"pswp--supports-fs")):b.removeClass(a.template,"pswp--supports-fs"))},N=function(){q.preloaderEl&&(O(!0),l("beforeChange",function(){clearTimeout(o),o=setTimeout(function(){a.currItem&&a.currItem.loading?(!a.allowProgressiveImg()||a.currItem.img&&!a.currItem.img.naturalWidth)&&O(!1):O(!0)},q.loadingIndicatorDelay)}),l("imageLoadComplete",function(b,c){a.currItem===c&&O(!0)}))},O=function(a){n!==a&&(C(m,"preloader--active",!a),n=a)},P=function(a){var c=a.vGap;if(B()){var g=q.barsSize;if(q.captionEl&&"auto"===g.bottom)if(f||(f=b.createEl("pswp__caption pswp__caption--fake"),f.appendChild(b.createEl("pswp__caption__center")),d.insertBefore(f,e),b.addClass(d,"pswp__ui--fit")),q.addCaptionHTMLFn(a,f,!0)){var h=f.clientHeight;c.bottom=parseInt(h,10)||44}else c.bottom=g.top;else c.bottom="auto"===g.bottom?0:g.bottom;c.top=g.top}else c.top=c.bottom=0},Q=function(){q.timeToIdle&&l("mouseUsed",function(){b.bind(document,"mousemove",K),b.bind(document,"mouseout",L),t=setInterval(function(){J++,2===J&&v.setIdle(!0)},q.timeToIdle/2)})},R=function(){l("onVerticalDrag",function(a){x&&a<.95?v.hideControls():!x&&a>=.95&&v.showControls()});var a;l("onPinchClose",function(b){x&&b<.9?(v.hideControls(),a=!0):a&&!x&&b>.9&&v.showControls()}),l("zoomGestureEnded",function(){a=!1,a&&!x&&v.showControls()})},S=[{name:"caption",option:"captionEl",onInit:function(a){e=a}},{name:"share-modal",option:"shareEl",onInit:function(a){i=a},onTap:function(){F()}},{name:"button--share",option:"shareEl",onInit:function(a){h=a},onTap:function(){F()}},{name:"button--zoom",option:"zoomEl",onTap:a.toggleDesktopZoom},{name:"counter",option:"counterEl",onInit:function(a){g=a}},{name:"button--close",option:"closeEl",onTap:a.close},{name:"button--arrow--left",option:"arrowEl",onTap:a.prev},{name:"button--arrow--right",option:"arrowEl",onTap:a.next},{name:"button--fs",option:"fullscreenEl",onTap:function(){c.isFullscreen()?c.exit():c.enter()}},{name:"preloader",option:"preloaderEl",onInit:function(a){m=a}}],T=function(){var a,c,e,f=function(d){if(d)for(var f=d.length,g=0;g<f;g++){a=d[g],c=a.className;for(var h=0;h<S.length;h++)e=S[h],c.indexOf("pswp__"+e.name)>-1&&(q[e.option]?(b.removeClass(a,"pswp__element--disabled"),e.onInit&&e.onInit(
1815a)):b.addClass(a,"pswp__element--disabled"))}};f(d.children);var g=b.getChildByClass(d,"pswp__top-bar");g&&f(g.children)};v.init=function(){b.extend(a.options,z,!0),q=a.options,d=b.getChildByClass(a.scrollWrap,"pswp__ui"),l=a.listen,R(),l("beforeChange",v.update),l("doubleTap",function(b){var c=a.currItem.initialZoomLevel;a.getZoomLevel()!==c?a.zoomTo(c,b,333):a.zoomTo(q.getDoubleTapZoom(!1,a.currItem),b,333)}),l("preventDragEvent",function(a,b,c){var d=a.target||a.srcElement;d&&d.getAttribute("class")&&a.type.indexOf("mouse")>-1&&(d.getAttribute("class").indexOf("__caption")>0||/(SMALL|STRONG|EM)/i.test(d.tagName))&&(c.prevent=!1)}),l("bindEvents",function(){b.bind(d,"pswpTap click",A),b.bind(a.scrollWrap,"pswpTap",v.onGlobalTap),a.likelyTouchDevice||b.bind(a.scrollWrap,"mouseover",v.onMouseOver)}),l("unbindEvents",function(){y||F(),t&&clearInterval(t),b.unbind(document,"mouseout",L),b.unbind(document,"mousemove",K),b.unbind(d,"pswpTap click",A),b.unbind(a.scrollWrap,"pswpTap",v.onGlobalTap),b.unbind(a.scrollWrap,"mouseover",v.onMouseOver),c&&(b.unbind(document,c.eventK,v.updateFullscreen),c.isFullscreen()&&(q.hideAnimationDuration=0,c.exit()),c=null)}),l("destroy",function(){q.captionEl&&(f&&d.removeChild(f),b.removeClass(e,"pswp__caption--empty")),i&&(i.children[0].onclick=null),b.removeClass(d,"pswp__ui--over-close"),b.addClass(d,"pswp__ui--hidden"),v.setIdle(!1)}),q.showAnimationDuration||b.removeClass(d,"pswp__ui--hidden"),l("initialZoomIn",function(){q.showAnimationDuration&&b.removeClass(d,"pswp__ui--hidden")}),l("initialZoomOut",function(){b.addClass(d,"pswp__ui--hidden")}),l("parseVerticalMargin",P),T(),q.shareEl&&h&&i&&(y=!0),D(),Q(),M(),N()},v.setIdle=function(a){k=a,C(d,"ui--idle",a)},v.update=function(){x&&a.currItem?(v.updateIndexIndicator(),q.captionEl&&(q.addCaptionHTMLFn(a.currItem,e),C(e,"caption--empty",!a.currItem.title)),w=!0):w=!1,y||F(),D()},v.updateFullscreen=function(d){d&&setTimeout(function(){a.setScrollOffset(0,b.getScrollY())},50),b[(c.isFullscreen()?"add":"remove")+"Class"](a.template,"pswp--fs")},v.updateIndexIndicator=function(){q.counterEl&&(g.innerHTML=a.getCurrentIndex()+1+q.indexIndicatorSep+q.getNumItemsFn())},v.onGlobalTap=function(c){c=c||window.event;var d=c.target||c.srcElement;if(!r)if(c.detail&&"mouse"===c.detail.pointerType){if(I(d))return void a.close();b.hasClass(d,"pswp__img")&&(1===a.getZoomLevel()&&a.getZoomLevel()<=a.currItem.fitRatio?q.clickToCloseNonZoomable&&a.close():a.toggleDesktopZoom(c.detail.releasePoint))}else if(q.tapToToggleControls&&(x?v.hideControls():v.showControls()),q.tapToClose&&(b.hasClass(d,"pswp__img")||I(d)))return void a.close()},v.onMouseOver=function(a){a=a||window.event;var b=a.target||a.srcElement;C(d,"ui--over-close",I(b))},v.hideControls=function(){b.addClass(d,"pswp__ui--hidden"),x=!1},v.showControls=function(){x=!0,w||v.update(),b.removeClass(d,"pswp__ui--hidden")},v.supportsFullscreen=function(){var a=document;return!!(a.exitFullscreen||a.mozCancelFullScreen||a.webkitExitFullscreen||a.msExitFullscreen)},v.getFullscreenAPI=function(){var b,c=document.documentElement,d="fullscreenchange";return c.requestFullscreen?b={enterK:"requestFullscreen",exitK:"exitFullscreen",elementK:"fullscreenElement",eventK:d}:c.mozRequestFullScreen?b={enterK:"mozRequestFullScreen",exitK:"mozCancelFullScreen",elementK:"mozFullScreenElement",eventK:"moz"+d}:c.webkitRequestFullscreen?b={enterK:"webkitRequestFullscreen",exitK:"webkitExitFullscreen",elementK:"webkitFullscreenElement",eventK:"webkit"+d}:c.msRequestFullscreen&&(b={enterK:"msRequestFullscreen",exitK:"msExitFullscreen",elementK:"msFullscreenElement",eventK:"MSFullscreenChange"}),b&&(b.enter=function(){return j=q.closeOnScroll,q.closeOnScroll=!1,"webkitRequestFullscreen"!==this.enterK?a.template[this.enterK]():void a.template[this.enterK](Element.ALLOW_KEYBOARD_INPUT)},b.exit=function(){return q.closeOnScroll=j,document[this.exitK]()},b.isFullscreen=function(){return document[this.elementK]}),b}};return a});
1816
1817function sectionHeader() {
1818
1819	var header		= document.querySelector('#site-header');
1820	var headerH		= header.clientHeight;
1821
1822	window.addEventListener("scroll", function (event) {
1823
1824		if (this.scrollY > (headerH - (headerH / (4 / 3)))) {
1825
1826			document.body.classList.add('scroll');
1827
1828		} else {
1829
1830			document.body.classList.remove('scroll');
1831		}
1832
1833		if ( ( window.innerHeight + window.pageYOffset ) >= document.body.offsetHeight - 2 ) {
1834
1835			document.body.classList.add('end');
1836
1837		} else {
1838
1839			document.body.classList.remove('end');
1840		}
1841
1842	}, false);
1843}
1844
1845
1846function mainMenu( button, menu ) {
1847
1848	var menuButton 	= document.getElementById( button ),
1849		mainMenu 	= document.getElementById( menu );
1850
1851	menuButton.addEventListener('click', function() {
1852
1853		if( menuButton.classList.contains('open') ) {
1854
1855			menuButton.classList.remove('open');
1856			document.body.classList.remove('scroll');
1857
1858			if( typeof headerslider !== 'undefined' ) {
1859
1860				headerslider.play();
1861			}
1862
1863			FX.fadeOut(mainMenu, {
1864				duration: 250,
1865				complete: function() {
1866				document.body.classList.remove('menu-open');
1867
1868					for (var item of document.querySelectorAll('.submenu-container')) {
1869
1870						item.classList.remove('click-show-menu');
1871					}
1872
1873					for (var item of document.querySelectorAll('.submenu-list')) {
1874
1875						item.classList.add('hide-menu');
1876						item.style.opacity = '0';
1877					}
1878				}
1879			});
1880
1881		} else {
1882
1883			menuButton.classList.add('open');
1884			document.body.classList.add('menu-open');
1885			document.body.classList.add('scroll');
1886
1887			if( typeof headerslider !== 'undefined' ) {
1888
1889				headerslider.pause();
1890			}
1891
1892			FX.fadeIn(mainMenu, {
1893				duration: 250,
1894				complete: function() {
1895
1896				}
1897			});
1898		}
1899	});
1900}
1901
1902
1903function subMenu() {
1904
1905	var submenu = document.querySelectorAll('.submenu-list');
1906	if (submenu.length < 1) return;
1907
1908	for (var item of submenu) {
1909
1910		item.classList.add('hide-menu');
1911		item.style.opacity = '0';
1912
1913		item.previousElementSibling.addEventListener('click', function(event){
1914
1915			event.preventDefault();
1916
1917			if ( !this.parentElement.classList.contains('click-show-menu') && window.innerWidth > 767 ) {
1918
1919				for (var item of document.querySelectorAll('.submenu-container')) {
1920
1921					item.classList.remove('click-show-menu');
1922				}
1923
1924				for (var item of document.querySelectorAll('.submenu-list')) {
1925
1926					item.classList.add('hide-menu');
1927					item.style.opacity = '0';
1928				}
1929
1930				if ( this.nextElementSibling.classList.contains('hide-menu') ) {
1931
1932					let elem = this.nextElementSibling;
1933
1934					elem.classList.remove('hide-menu');
1935
1936					FX.fadeIn(elem, {
1937						duration: 350,
1938						complete: function() {
1939
1940						}
1941					});
1942
1943				} else {
1944
1945					let elem = this.nextElementSibling;
1946
1947					FX.fadeOut(elem, {
1948						duration: 250,
1949						complete: function() {
1950
1951							elem.classList.add('hide-menu');
1952						}
1953					});
1954				}
1955
1956				if ( this.parentElement.classList.contains('click-show-menu') ) {
1957
1958					this.parentElement.classList.remove('click-show-menu');
1959
1960				} else {
1961
1962					this.parentElement.classList.add('click-show-menu');
1963				}
1964
1965			} else {
1966
1967				if ( this.nextElementSibling.classList.contains('hide-menu') ) {
1968
1969					let elem = this.nextElementSibling;
1970
1971					elem.classList.remove('hide-menu');
1972
1973					FX.fadeIn(elem, {
1974						duration: 450,
1975						complete: function() {
1976
1977						}
1978					});
1979
1980				} else {
1981
1982					let elem = this.nextElementSibling;
1983
1984					FX.fadeOut(elem, {
1985						duration: 250,
1986						complete: function() {
1987
1988							elem.classList.add('hide-menu');
1989							elem.style.opacity = '0';
1990						}
1991					});
1992				}
1993
1994				if ( this.parentElement.classList.contains('click-show-menu') ) {
1995
1996					this.parentElement.classList.remove('click-show-menu');
1997
1998				} else {
1999
2000					this.parentElement.classList.add('click-show-menu');
2001				}
2002			}
2003		});
2004	}
2005}
2006
2007
2008function sectionSlider() {
2009
2010	if (document.querySelectorAll('.header-slideshow').length < 1) return;
2011
2012	const slider = document.querySelector('.header-slideshow');
2013	const activeBullet = "glide__bullet--active";
2014	const bulletsContainerElement = slider.querySelector(".bullets");
2015
2016	headerslider = new Glide(slider, {
2017
2018		type: 'carousel',
2019		animationDuration: 1500,
2020		animationTimingFunc: 'ease',
2021		autoplay: 8000,
2022		hoverpause: false,
2023		gap: 0
2024
2025	}
2025).mount();
2026
2027	headerslider.on("run", () => {
2028
2029		requestAnimationFrame(() => changeActiveBullet(headerslider.index, bulletsContainerElement, activeBullet));
2030	});
2031}
2032
2033
2034
2035
2036
2037function listCamere() {
2038
2039	if (document.querySelectorAll('#camere-list').length < 1) return;
2040
2041	var sliders = document.querySelectorAll('.camere-list-slideshow');
2042	var galleries = [];
2043
2044	for ( var i = 0; i < sliders.length; i++ ) {
2045
2046		galleries[i] = new Glide( sliders[i], {
2047
2048			type: 'carousel',
2049			animationDuration: 800,
2050			animationTimingFunc: 'ease',
2051			autoplay: false,
2052			hoverpause: false,
2053			dragThreshold: false,
2054			swipeThreshold: false,
2055			perView: 1,
2056			gap: 0
2057		});
2058
2059		galleries[i].mount();
2060	}
2061}
2062
2063
2064function sectionGallery() {
2065
2066	if (document.querySelectorAll('.gallery-slideshow').length < 1) return;
2067
2068	var slideshow = new Glide('.gallery-slideshow', {
2069
2070		type: 'carousel',
2071		animationDuration: 800,
2072		animationTimingFunc: 'ease',
2073		autoplay: false,
2074		hoverpause: false,
2075		dragThreshold: false,
2076		swipeThreshold: false,
2077		perView: 3,
2078		gap: 0,
2079		breakpoints: {
2080
2081			1080:	{ perView: 3 },
2082			768: 	{ perView: 2 },
2083			767:	{ perView: 1 }
2084		}
2085
2086	}).mount();
2087}
2088
2089
2090
2091
2092function sectionServizi() {
2093
2094	var buttons = document.querySelectorAll('.button-servizio');
2095
2096	if (buttons.length < 1) return;
2097
2098	var servizi = document.querySelectorAll('.servizio-item');
2099
2100	for (button of buttons) {
2101
2102		button.addEventListener('click', function(){
2103
2104			if( !this.classList.contains('active') ) {
2105
2106				var catname = this.dataset.cat;
2107
2108				for (button of buttons) {
2109
2110					button.classList.remove('active');
2111				}
2112
2113				this.classList.add('active');
2114
2115				showHideTabs(servizi, catname);
2116			}
2117		});
2118	}
2119
2120	var allTab = document.querySelectorAll('.button-servizio');
2121
2122	document.querySelector('#servizio-after').addEventListener('click', function (event) {
2123
2124		var activeTab = document.querySelector('.button-servizio.active');
2125
2126		if (activeTab.nextElementSibling) {
2127
2128			activeTab.nextElementSibling.click();
2129
2130		} else {
2131
2132			allTab[0].click();
2133		}
2134	});
2135
2136	document.querySelector('#servizio-before').addEventListener('click', function (event) {
2137
2138		var activeTab = document.querySelector('.button-servizio.active');
2139		var lastTab = allTab.length - 1;
2140
2141		if (activeTab.previousElementSibling) {
2142
2143			activeTab.previousElementSibling.click();
2144
2145		} else {
2146
2147			allTab[lastTab].click();
2148		}
2149	});
2150}
2151
2152
2153function showHideTabs(motivi, catname) {
2154
2155	// fade out all motivi
2156	for(motivo of motivi) {
2157
2158		if( !motivo.classList.contains('hide') || catname === 'all') {
2159
2160			FX.fadeOut(motivo, {
2161				duration: 250,
2162				complete: function() {
2163
2164					// hide all offers
2165
2166					for(motivo of motivi) {
2167
2168						if (!motivo.classList.contains('hide')) {
2169
2170							motivo.classList.add('hide');
2171						}
2172					}
2173
2174
2175					// fade in
2176
2177					for(motivo of motivi) {
2178
2179						if ( motivo.classList.contains(catname) || catname === 'all' ) {
2180
2181							// show offers in the selected category
2182
2183							motivo.classList.remove('hide');
2184
2185							FX.fadeIn(motivo, {
2186								duration: 350,
2187								complete: function() {
2188
2189								}
2190							});
2191						}
2192					}
2193				}
2194			});
2195		}
2196	}
2197}
2198
2199
2200
2201function sectionOfferte() {
2202
2203	if (document.querySelectorAll('.offerte-slideshow').length < 1) return;
2204
2205	const slider = document.querySelector('.offerte-slideshow');
2206	const activeBullet = "glide__bullet--active";
2207	const bulletsContainerElement = slider.querySelector(".bullets");
2208
2209	var slideshow = new Glide(slider, {
2210
2211		type: 'carousel',
2212		animationDuration: 1000,
2213		animationTimingFunc: 'ease',
2214		autoplay: false,
2215		hoverpause: false,
2216		perView: 3,
2217		startAt: 0,
2218		gap: 48,
2219		breakpoints: {
2220
2221			1800: {
2222
2223				perView: 3,
2224				gap: 40
2225			},
2226
2227			1700: {
2228
2229				perView: 3,
2230				gap: 30
2231			},
2232
2233			1500: {
2234
2235				perView: 3,
2236				gap: 25
2237			},
2238
2239			1380: {
2240
2241				gap: 25,
2242				perView: 2
2243			},
2244
2245			768:	{
2246				gap: 25,
2247				perView: 1
2248			 }
2249		}
2250
2251	}).mount();
2252
2253	slideshow.on("run", () => {
2254
2255		requestAnimationFrame(() => changeActiveBullet(slideshow.index, bulletsContainerElement, activeBullet));
2256	});
2257}
2258
2259
2260function sectionSingleOfferta() {
2261
2262	if (document.querySelectorAll('.single-offerta-slideshow').length < 1) return;
2263
2264	const slider = document.querySelector('.single-offerta-slideshow');
2265	const activeBullet = "glide__bullet--active";
2266	const bulletsContainerElement = slider.querySelector(".bullets");
2267
2268	headerslider = new Glide(slider, {
2269
2270		type: 'carousel',
2271		animationDuration: 1500,
2272		animationTimingFunc: 'ease',
2273		autoplay: 8000,
2274		hoverpause: false,
2275		gap: 0
2276
2277	}
2277).mount();
2278
2279	headerslider.on("run", () => {
2280
2281		requestAnimationFrame(() => changeActiveBullet(headerslider.index, bulletsContainerElement, activeBullet));
2282	});
2283}
2284
2285
2286function sectionRecensioni() {
2287
2288	if (document.querySelectorAll('.feedback-slideshow').length < 1) return;
2289
2290	const slider = document.querySelector('.feedback-slideshow');
2291	const activeBullet = "glide__bullet--active";
2292	const bulletsContainerElement = slider.querySelector(".bullets");
2293
2294	var slideshow = new Glide(slider, {
2295
2296		type: 'carousel',
2297		animationDuration: 800,
2298		animationTimingFunc: 'ease',
2299		autoplay: false,
2300		hoverpause: false,
2301		gap: 30
2302
2303	}).mount();
2304
2305	slideshow.on("run", () => {
2306
2307		requestAnimationFrame(() => changeActiveBullet(slideshow.index, bulletsContainerElement, activeBullet));
2308	});
2309}
2310
2311
2312var headerslider;
2313
2314
2315const changeActiveBullet = (newIndex, containerElement, activeBullet) => {
2316
2317	const glideDir = containerElement.querySelector(`[data-glide-dir="=${newIndex}"]`);
2318	containerElement.querySelector(`.${activeBullet}`).classList.remove(activeBullet);
2319
2320	if (glideDir) glideDir.classList.add(activeBullet);
2321};
2322
2323
2324const CustomActiveClass = function (Glide, Components, Events) {
2325
2326	var Component = {
2327
2328		mount() {
2329
2330			this.changeActiveSlide();
2331		},
2332
2333		changeActiveSlide() {
2334
2335			let slides = Components.Html.slides;
2336
2337			for( const slide of slides) {
2338
2339				slide.classList.remove('is-active');
2340			}
2341
2342			slides[Glide.index].classList.add('is-active');
2343		},
2344	};
2345
2346	Events.on('move', () => {
2347
2348		Component.changeActiveSlide();
2349	});
2350
2351	return Component;
2352};
2353
2354
2355(function(){
2356
2357	function setCookie( cname, cvalue, exdays ) {
2358		var d = new Date();
2359		d.setTime( d.getTime() + ( exdays * 24 * 60 * 60 * 1000 ) );
2360		var expires = "expires="+d.toUTCString();
2361		document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
2362	}
2363
2364	function getCookie( cname ) {
2365		var name = cname + "=";
2366		var ca = document.cookie.split(';');
2367		for(var i = 0; i < ca.length; i++) {
2368			var c = ca[i];
2369			while (c.charAt(0) == ' ') {
2370			c = c.substring(1);
2371			}
2372			if (c.indexOf(name) == 0) {
2373			return c.substring(name.length, c.length);
2374			}
2375		}
2376		return "";
2377	}
2378
2379	function modalManager( data ) {
2380		var modals = document.getElementsByClassName( 'edtModal' );
2381
2382		for( let item of modals ){
2383			if( item.dataset.type == 1 ){
2384				if( item.dataset.cookie != 0){
2385					//entry popup
2386					var cookie = getCookie('openmodal');
2387					if( cookie != "true" ){
2388						setCookie( 'openmodal', 'true', item.dataset.cookie );
2389						item.style.display = "block";
2390					}
2391				}else{
2392					item.style.display = "block";
2393				}
2394			}else if( item.dataset.type == 2 ){
2395				//exit popup
2396				var exitcookie = getCookie('openexitmodal');
2397				if( exitcookie != "true" ){
2398					document.addEventListener("mouseleave", function(event){
2399						setCookie( 'openexitmodal', 'true', item.dataset.cookie );
2400						if(event.clientY <= 0 || event.clientX <= 0 || (event.clientX >= window.innerWidth || event.clientY >= window.innerHeight)){
2401							item.style.display = "block";
2402						}
2403					});
2404				}
2405			}
2406			var span = item.getElementsByClassName("close")[0];
2407
2408			if (typeof (span) != 'undefined' && span != null) {
2409				span.addEventListener("click",	function () {
2410					item.style.display = "none";
2411				});
2412			}
2413		}
2414	}
2415})();
2416
2417
2418function browserSupportsJsFeatures() {
2419
2420	if (window.Promise && window.fetch && window.Symbol) return;
2421	loadScript('https://polyfill.io/v3/polyfill.min.js');
2422}
2423
2424
2425function loadScript(src, done) {
2426
2427	var js = document.createElement('script');
2428	js.src = src;
2429
2430	if (typeof done !== 'undefined') {
2431		js.onload = function () {
2432			done();
2433		};
2434	}
2435
2436	js.onerror = function () {
2437		console.log(new Error('Failed to load script ' + src));
2438	};
2439
2440	document.body.appendChild(js);
2441}
2442
2443
2444function browserSupportsStickyFeatures() {
2445
2446	if (typeof CSS !== 'undefined' && CSS.supports("position", "sticky")) return;
2447
2448	var header = document.getElementById("header");
2449	var sticky = header.offsetTop;
2450
2451	window.onscroll = function () {
2452		if (window.pageYOffset > sticky) {
2453			header.classList.add("sticky");
2454		} else {
2455			header.classList.remove("sticky");
2456		}
2457	};
2458}
2459
2460
2461function checkBrowser() {
2462
2463	var userAgentString = navigator.userAgent;
2464
2465	var agent = {
2466		'chrome': userAgentString.indexOf("Chrome") > -1,
2467		'ie': userAgentString.indexOf("MSIE") > -1 || userAgentString.indexOf("rv:") > -1,
2468		'firefox': userAgentString.indexOf("Firefox") > -1,
2469		'safari': userAgentString.indexOf("Safari") > -1,
2470		'opera': userAgentString.indexOf("OP") > -1
2471	};
2472
2473	if ((agent.chrome) && (agent.safari)) agent.safari = false;
2474
2475	if ((agent.chrome) && (agent.opera)) agent.chrome = false;
2476
2477	for (var index in agent) {
2478		if (agent.hasOwnProperty(index)) {
2479			if (agent[index]) {
2480				document.body.classList.add(index);
2481			}
2482		}
2483	}
2484}
2485
2486
2487function countdown(countdown) {
2488
2489	// https://www.w3schools.com/howto/howto_js_countdown.asp
2490	var countDownDate = new Date(countdown.dataset.startDate).getTime();
2491	var giorni = countdown.dataset.giorni;
2492	var ore = countdown.dataset.ore;
2493
2494	var x = setInterval(function () {
2495	var now = new Date().getTime();
2496	var distance = countDownDate - now;
2497	var days = Math.floor(distance / (1000 * 60 * 60 * 24));
2498	var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
2499
2500	countdown.innerHTML = days + ' ' + giorni + ' ' + hours + ' ' + ore;
2501
2502	if (distance < 0) {
2503		clearInterval(x);
2504		countdown.innerHTML = 'countdown scaduto';
2505	}
2506
2507	}(), 60000);
2508}
2509
2510
2511function initCountdown() {
2512
2513	if (document.querySelectorAll('.countdown').length > 0) {
2514
2515		var count = document.querySelectorAll('.countdown');
2516
2517		for (var i = 0; i < count.length; i++) {
2518
2519			countdown(count[i]);
2520		}
2521	}
2522}
2523
2524
2525var initPhotoSwipeFromDOM = function (gallerySelector) {
2526
2527	// parse slide data (url, title, size ...) from DOM elements
2528	// (children of gallerySelector)
2529
2530	var parseThumbnailElements = function (el) {
2531		var thumbElements = el.childNodes,
2532			numNodes = thumbElements.length,
2533			items = [],
2534			figureEl,
2535			linkEl,
2536			size,
2537			item;
2538
2539		for (var i = 0; i < numNodes; i++) {
2540
2541			figureEl = thumbElements[i]; // <gallery-item> element
2542			// include only element nodes
2543
2544			if (figureEl.nodeType !== 1) {
2545				continue;
2546			}
2547
2548			linkEl = figureEl.querySelectorAll('a'); // <a> element
2549
2550			if (linkEl.length == 0) {
2551
2552				continue;
2553			}
2554
2555			size = linkEl[0].dataset.size.split('x');
2556
2557			// create slide object
2558			item = {
2559
2560				src: linkEl[0].attributes[0].value,
2561				w: parseInt(size[0], 10),
2562				h: parseInt(size[1], 10)
2563			};
2564
2565			if (figureEl.children.length > 1) {
2566
2567				// <figcaption> content
2568				item.title = figureEl.children[1].innerHTML;
2569			}
2570
2571			item.el = figureEl; // save link to element for getThumbBoundsFn
2572			items.push(item);
2573		}
2574
2575		return items;
2576	};
2577
2578	// find nearest parent element
2579	var closest = function closest(el, fn) {
2580
2581		return el && (fn(el) ? el : closest(el.parentNode, fn));
2582	};
2583
2584	// triggers when user clicks on thumbnail
2585	var onThumbnailsClick = function (e) {
2586
2587		e = e || window.event;
2588		e.preventDefault ? e.preventDefault() : e.returnValue = false;
2589
2590		var eTarget = e.target || e.srcElement;
2591
2592		// find root element of slide
2593		var clickedListItem = closest(eTarget, function (el) {
2594
2595			return (el.tagName && el.classList.contains('gallery-item'));
2596		});
2597
2598		if (!clickedListItem) {
2599
2600			return;
2601		}
2602
2603		// find index of clicked item by looping through all child nodes
2604		// alternatively, you may define index via data- attribute
2605		var clickedGallery = clickedListItem.parentNode,
2606			childNodes = clickedListItem.parentNode.childNodes,
2607			numChildNodes = childNodes.length,
2608			nodeIndex = 0,
2609			index;
2610
2611		for (var i = 0; i < numChildNodes; i++) {
2612
2613			if (childNodes[i].nodeType !== 1) {
2614
2615				continue;
2616			}
2617
2618			if (childNodes[i] === clickedListItem) {
2619
2620				index = nodeIndex;
2621				break;
2622			}
2623
2624			nodeIndex++;
2625		}
2626
2627		if (index >= 0) {
2628
2629			// open PhotoSwipe if valid index found
2630			openPhotoSwipe(index, clickedGallery);
2631		}
2632
2633		return false;
2634	};
2635
2636	// parse picture index and gallery index from URL (#&pid=1&gid=2)
2637	var photoswipeParseHash = function () {
2638
2639		var hash = window.location.hash.substring(1),
2640
2641			params = {};
2642
2643		if (hash.length < 5) {
2644
2645			return params;
2646		}
2647
2648		var vars = hash.split('&');
2649
2650		for (var i = 0; i < vars.length; i++) {
2651
2652			if (!vars[i]) {
2653
2654				continue;
2655			}
2656
2657			var pair = vars[i].split('=');
2658
2659			if (pair.length < 2) {
2660
2661				continue;
2662			}
2663
2664			params[pair[0]] = pair[1];
2665		}
2666
2667		if (params.gid) {
2668
2669			params.gid = parseInt(params.gid, 10);
2670		}
2671
2672		return params;
2673	};
2674
2675	var openPhotoSwipe = function (index, galleryElement, disableAnimation, fromURL) {
2676
2677		var pswpElement = document.querySelectorAll('.pswp')[0],
2678			gallery,
2679			options,
2680			items;
2681
2682		items = parseThumbnailElements(galleryElement);
2683
2684		// define options (if needed)
2685		options = {
2686
2687			shareEl: false,
2688			// define gallery index (for URL)
2689			galleryUID: galleryElement.getAttribute('data-pswp-uid'),
2690		};
2691
2692		// PhotoSwipe opened from URL
2693		if (fromURL) {
2694
2695			if (options.galleryPIDs) {
2696
2697				// parse real index when custom PIDs are used
2698				// http://photoswipe.com/documentation/faq.html#custom-pid-in-url
2699				for (var j = 0; j < items.length; j++) {
2700
2701					if (items[j].pid == index) {
2702
2703						options.index = j;
2704						break;
2705					}
2706				}
2707
2708			} else {
2709
2710				// in URL indexes start from 1
2711				options.index = parseInt(index, 10) - 1;
2712			}
2713
2714		} else {
2715
2716			options.index = parseInt(index, 10);
2717		}
2718
2719		// exit if index not found
2720		if (isNaN(options.index)) {
2721
2722			return;
2723		}
2724
2725		if (disableAnimation) {
2726
2727			options.showAnimationDuration = 0;
2728		}
2729
2730		// Pass data to PhotoSwipe and initialize it
2731		gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
2732		gallery.init();
2733	};
2734
2735	// loop through all gallery elements and bind events
2736	var galleryElements = document.querySelectorAll(gallerySelector);
2737
2738	for (var i = 0, l = galleryElements.length; i < l; i++) {
2739
2740		galleryElements[i].setAttribute('data-pswp-uid', i + 1);
2741		galleryElements[i].onclick = onThumbnailsClick;
2742	}
2743
2744	// Parse URL and open gallery if it contains #&pid=3&gid=1
2745	var hashData = photoswipeParseHash();
2746
2747	if (hashData.pid && hashData.gid) {
2748
2749		openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
2750	}
2751};
2752
2753
2754(function () {
2755	var FX = {
2756		easing: {
2757			linear: function (progress) {
2758				return progress;
2759			},
2760			quadratic: function (progress) {
2761				return Math.pow(progress, 2);
2762			},
2763			swing: function (progress) {
2764				return 0.5 - Math.cos(progress * Math.PI) / 2;
2765			},
2766			circ: function (progress) {
2767				return 1 - Math.sin(Math.acos(progress));
2768			},
2769			back: function (progress, x) {
2770				return Math.pow(progress, 2) * ((x + 1) * progress - x);
2771			},
2772			bounce: function (progress) {
2773				for (var a = 0, b = 1, result; 1; a += b, b /= 2) {
2774					if (progress >= (7 - 4 * a) / 11) {
2775						return -Math.pow((11 - 6 * a - 11 * progress) / 4, 2) + Math.pow(b, 2);
2776					}
2777				}
2778			},
2779			elastic: function (progress, x) {
2780				return Math.pow(2, 10 * (progress - 1)) * Math.cos(20 * Math.PI * x / 3 * progress);
2781			}
2782		},
2783		 animate: function (options) {
2784			var start = new Date;
2785			var id = setInterval(function () {
2786				var timePassed = new Date - start;
2787				var progress = timePassed / options.duration;
2788				if (progress > 1) {
2789					progress = 1;
2790				}
2791				options.progress = progress;
2792				var delta = options.delta(progress);
2793				options.step(delta);
2794				if (progress == 1) {
2795					clearInterval(id);
2796					options.complete();
2797				}
2798			}, options.delay || 10);
2799		},
2800		fadeOut: function (element, options) {
2801			var to = 1;
2802			this.animate({
2803				duration: options.duration,
2804				delta: function (progress) {
2805					progress = this.progress;
2806					return FX.easing.swing(progress);
2807				},
2808				complete: options.complete,
2809				step: function (delta) {
2810					element.style.opacity = to - delta;
2811				}
2812			});
2813		},
2814		fadeIn: function (element, options) {
2815			var to = 0;
2816			this.animate({
2817				duration: options.duration,
2818				delta: function (progress) {
2819					progress = this.progress;
2820					return FX.easing.swing(progress);
2821				},
2822				complete: options.complete,
2823				step: function (delta) {
2824					element.style.opacity = to + delta;
2825				}
2826			});
2827		},
2828		fadeShrink: function (element, options) {
2829			var to = 1;
2830			this.animate({
2831				duration: options.duration,
2832				delta: function (progress) {
2833					progress = this.progress;
2834					return FX.easing.swing(progress);
2835				},
2836				complete: options.complete,
2837				step: function (delta) {
2838					element.style.opacity = to - delta;
2839					element.style.transform = "scale(" + (to - delta) + ")";
2840				}
2841			});
2842		},
2843		fadeGrow: function (element, options) {
2844			var to = 0;
2845			this.animate({
2846				duration: options.duration,
2847				delta: function (progress) {
2848					progress = this.progress;
2849					return FX.easing.circ(progress);
2850				},
2851				complete: options.complete,
2852				step: function (delta) {
2853					element.style.opacity = to + delta;
2854					element.style.transform = "scale(" + (to + delta) + ")";
2855				}
2856			});
2857		}
2858	};
2859	window.FX = FX;
2860})();
2861
2862
2863function debounce( func, wait, immediate ) {
2864
2865	var timeout;
2866
2867	return function() {
2868
2869		var context = this, args = arguments;
2870
2871		var later = function() {
2872
2873			timeout = null;
2874
2875			if (!immediate) func.apply(context, args);
2876		};
2877
2878		var callNow = immediate && !timeout;
2879		clearTimeout(timeout);
2880		timeout = setTimeout(later, wait);
2881
2882		if (callNow) func.apply(context, args);
2883	};
2884};
2885
2886
2887function allClick() {
2888
2889	var clickbox = document.querySelectorAll('.allclick');
2890
2891	if (clickbox.length < 1) return;
2892
2893	Array.prototype.forEach.call(clickbox, function (item, index) {
2894
2895		var $this = item;
2896		var link = $this.querySelector('a');
2897
2898		if( link ) {
2899
2900			$this.style.cursor = 'pointer';
2901
2902			link.addEventListener('click', function (event) {
2903
2904				event.preventDefault();
2905			});
2906
2907			if (link.getAttribute('target') == '_blank') {
2908
2909				$this.addEventListener('click', function () {
2910
2911					window.open(link.getAttribute('href'));
2912				});
2913
2914			} else {
2915
2916				$this.addEventListener('click', function () {
2917
2918					window.location.href = link.getAttribute('href');
2919				});
2920			}
2921		}
2922	});
2923}
2924
2925
2926function filterOffer() {
2927
2928	var buttons = document.querySelectorAll('.button-offer');
2929	var offers = document.querySelectorAll('.offer-item');
2930	var catname = '';
2931	var select = document.getElementById('select-offer');
2932
2933	if ( buttons.length < 1 || offers.length < 1 ) return;
2934
2935	if ( isTouch() ) {
2936
2937		select.addEventListener("change", function(){
2938
2939			var catname = this.value;
2940
2941			showHideOffers(offers, catname);
2942		});
2943
2944	} else {
2945
2946		document.querySelector('.button-offer[data-cat="all"]').classList.add('active');
2947
2948		for (button of buttons) {
2949
2950			button.addEventListener('click', function(){
2951
2952				if( !this.classList.contains('active') ) {
2953
2954					catname = this.dataset.cat;
2955
2956					for (button of buttons) {
2957
2958						button.classList.remove('active');
2959					}
2960
2961					this.classList.add('active');
2962
2963					showHideOffers(offers, catname);
2964				}
2965			});
2966		}
2967	}
2968}
2969
2970
2971function showHideOffers(offers, catname) {
2972
2973	// shrink all offers
2974	for(offer of offers) {
2975
2976		if( !offer.classList.contains('hide') || catname === 'all') {
2977
2978			FX.fadeShrink(offer, {
2979				duration: 250,
2980				complete: function() {
2981
2982					// hide all offers
2983
2984					for(offer of offers) {
2985
2986						if (!offer.classList.contains('hide')) {
2987
2988							offer.classList.add('hide');
2989						}
2990					}
2991
2992
2993					// grow all offers in the selected category
2994
2995					for(offer of offers) {
2996
2997						if ( offer.classList.contains(catname) || catname === 'all' ) {
2998
2999							// show offers in the selected category
3000
3001							offer.classList.remove('hide');
3002
3003							FX.fadeGrow(offer, {
3004								duration: 350,
3005								complete: function() {
3006
3007								}
3008							});
3009						}
3010					}
3011
3012					AOS.refresh();
3013				}
3014			});
3015		}
3016	}
3017}
3018
3019
3020function svgIcons() {
3021
3022	//get all template elements
3023
3024	let templates = document.querySelectorAll('template');
3025	let icons = new Array();
3026
3027	for (template of templates) {
3028
3029		icons.push( template.id );
3030	}
3031
3032	for (icon of icons) {
3033
3034		var theElements = document.querySelectorAll('.' + icon);
3035		if( theElements.length > 0 ) {
3036
3037			var theIcon = document.getElementById( icon );
3038
3039			for (theElement of theElements) {
3040
3041				let clone = theIcon.content.cloneNode( true );
3042				theElement.appendChild( clone );
3043			}
3044		}
3045	}
3046}
3047
3048
3049function sameHeights(selectElem) {
3050
3051	if (window.innerWidth <= 767) return;
3052
3053	var nodeList = document.querySelectorAll(selectElem);
3054	var elems = [].slice.call(nodeList);
3055
3056	var tallest = Math.max.apply(Math, elems.map(function (elem, index) {
3057
3058		elem.style.minHeight = '';
3059		return elem.offsetHeight;
3060	}));
3061
3062	elems.forEach(function (elem, index, arr) {
3063
3064		elem.style.minHeight = tallest + 'px';
3065	});
3066}
3067
3068
3069function defineVh() {
3070
3071	document.documentElement.style.setProperty(
3072		'--vh',
3073		`${window.innerHeight/100}px`
3074	);
3075}
3076
3077
3078function setVh() {
3079
3080	defineVh();
3081	const debounceVh = debounce( defineVh, 100 );
3082	window.addEventListener( 'resize', debounceVh );
3083}
3084
3085
3086function isTouch() {
3087
3088	return 	( 'ontouchstart' in window ) ||
3089			( navigator.maxTouchPoints > 0 ) ||
3090			( navigator.msMaxTouchPoints > 0 );
3091}
3092
3093
3094document.addEventListener("DOMContentLoaded", function () {
3095
3096	browserSupportsJsFeatures();
3097	checkBrowser();
3098	if( isTouch() ) { document.body.classList.add('touch'); }
3099	setVh();
3100	allClick();
3101	filterOffer();
3102	initCountdown();
3103
3104	if (typeof sectionHeader === 'function') 		{ sectionHeader(); }
3105	if (typeof mainMenu === 'function') 			{ mainMenu( 'open-menu', 'main-menu' ); }
3106	if (typeof subMenu === 'function') 				{ subMenu(); }
3107	if (typeof sectionSlider === 'function') 		{ sectionSlider(); }
3108	if (typeof sectionContent === 'function') 		{ sectionContent(); }
3109	if (typeof sectionFooter === 'function')		{ sectionFooter(); }
3110
3111	initPhotoSwipeFromDOM('.gallery-editor');
3112	initPhotoSwipeFromDOM('.photogallery-slides');
3113
3114	if (typeof global_responsiveScrollingTables === 'function') {
3115
3116		global_responsiveScrollingTables('.CookieDeclarationTable');
3117	}
3118
3119	
3120	if(window.innerWidth > 1024) {
3121		var bookingForm = document.getElementById('booking');
3122		var bookingCta = document.getElementById('main-cta-container');
3123		var sliderSection = document.getElementById('slider-section');
3124		var headSliderControls = document.querySelector('.header-slideshow .slider-control
3124s');
3125
3126		if(!bookingForm) {
3127			bookingCta.classList.add('show');
3128			
3129			if(sliderSection) {
3130				sliderSection.classList.add('no-after');
3131				headSliderControls.classList.add('bottom')
3132			}
3133
3134			return;
3135		}
3136
3137		var sliderHeight = document.getElementById('slider-section').clientHeight;
3138		
3139		document.addEventListener("scroll", function() {
3140			if(window.scrollY > sliderHeight) {
3141				bookingCta.classList.add('show');
3142			}
3143			else {
3144				bookingCta.classList.remove('show');
3145			}
3146		});
3147	}
3148	
3149
3150});
3151
3152
3153AOS.init({
3154	startEvent: 'load',
3155	once: true,
3156	disable: 'mobile',
3157	useClassNames: true,
3158	initClassName: '',
3159	animatedClassName: 'animate__animated'
3160});
3161
3162
3163window.addEventListener('load', function (event) {
3164
3165	svgIcons();
3166	new Backpax( document.querySelectorAll('.parallax') );
3167
3168	if (typeof sectionCamere === 'function') 		{ sectionCamere(); }
3169	if (typeof listCamere === 'function') 			{ listCamere(); }
3170	if (typeof sectionGallery === 'function') 		{ sectionGallery(); }
3171	if (typeof sectionExtraContent === 'function') 	{ sectionExtraContent(); }
3172	if (typeof sectionHighlights === 'function') 	{ sectionHighlights(); }
3173	if (typeof sectionServizi === 'function') 		{ sectionServizi(); }
3174	if (typeof sectionBuonimotivi === 'function') 	{ sectionBuonimotivi(); }
3175	if (typeof sectionOfferte === 'function') 		{ sectionOfferte(); }
3176	if (typeof sectionSingleOfferta === 'function') { sectionSingleOfferta(); }
3177	if (typeof sectionRecensioni === 'function') 	{ sectionRecensioni(); }
3178
3179	sameHeights( '.offerta-card-content' );
3180
3181	var formBooking = document.getElementById('contactForm-2');
3182	
3183    if(formBooking) {
3184        formBooking.addEventListener("onLoadForm", function(e) {
3185            // var t1 = performance.now();
3186            // console.log("Call after " + (t1 - t0) + " milliseconds.");
3187            // console.log(e);
3188
3189            var data_arrivo = formBooking.querySelector('label[for=data_arrivo]');
3190            var data_partenza = formBooking.querySelector('label[for=data_partenza]');
3191            
3192            if ( data_arrivo && data_partenza ) {
3193                formBooking.querySelectorAll('.datepicker.data-arrivo')[1].setAttribute('id', data_arrivo.getAttribute('for'));
3194                formBooking.querySelectorAll('.datepicker.data-partenza')[1].setAttribute('id', data_partenza.getAttribute('for'));
3195            }
3196        });
3197    }
3198});
3199
3200
3201window.addEventListener('resize', function(event) {
3202
3203	sameHeights( '.offerta-card-content' );
3204});

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.