/*! * jQuery UI Mouse 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../ie","../version","../widget"],e):e(jQuery)}(function(o){"use strict";var n=!1;return o(document).on("mouseup",function(){n=!1}),o.widget("ui.mouse",{version:"1.13.3",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.on("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).on("click."+this.widgetName,function(e){if(!0===o.data(e.target,t.widgetName+".preventClickEvent"))return o.removeData(e.target,t.widgetName+".preventClickEvent"),e.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){var t,i,s;if(!n)return this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),i=1===(this._mouseDownEvent=e).which,s=!("string"!=typeof(t=this).options.cancel||!e.target.nodeName)&&o(e.target).closest(this.options.cancel).length,i&&!s&&this._mouseCapture(e)&&(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){t.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?e.preventDefault():(!0===o.data(e.target,this.widgetName+".preventClickEvent")&&o.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return t._mouseMove(e)},this._mouseUpDelegate=function(e){return t._mouseUp(e)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0)),!0},_mouseMove:function(e){if(this._mouseMoved){if(o.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&o.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});; /*! * jQuery UI Slider 1.13.3 * https://jqueryui.com * * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * https://jquery.org/license */ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../keycode","../version","../widget"],e):e(jQuery)}(function(o){"use strict";return o.widget("ui.slider",o.ui.mouse,{version:"1.13.3",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,t=this.options,i=this.element.find(".ui-slider-handle"),s=[],a=t.values&&t.values.length||1;for(i.length>a&&(i.slice(a).remove(),i=i.slice(0,a)),e=i.length;e");this.handles=i.add(o(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){o(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(!0===e.range&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:Array.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=o("
").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==e.range&&"max"!==e.range||this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,a,n,t,h,l=this,u=this.options;return!u.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var t=Math.abs(i-l.values(e));(t=this._valueMax()?this._valueMax():(t=0=t&&(i+=0this.options.max&&(e-=i),this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return e=null!==this.options.min?Math.max(e,this._precisionOf(this.options.min)):e},_precisionOf:function(e){var e=e.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(e){"vertical"===e&&this.range.css({width:"",left:""}),"horizontal"===e&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var t,i,e,s,a,n=this.options.range,h=this.options,l=this,u=!this._animateOff&&h.animate,r={};this._hasMultipleValues()?this.handles.each(function(e){i=(l.values(e)-l._valueMin())/(l._valueMax()-l._valueMin())*100,r["horizontal"===l.orientation?"left":"bottom"]=i+"%",o(this).stop(1,1)[u?"animate":"css"](r,h.animate),!0===l.options.range&&("horizontal"===l.orientation?(0===e&&l.range.stop(1,1)[u?"animate":"css"]({left:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:h.animate})):(0===e&&l.range.stop(1,1)[u?"animate":"css"]({bottom:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:h.animate}))),t=i}):(e=this.value(),s=this._valueMin(),a=this._valueMax(),i=a!==s?(e-s)/(a-s)*100:0,r["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[u?"animate":"css"](r,h.animate),"min"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:i+"%"},h.animate),"max"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:100-i+"%"},h.animate),"min"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:i+"%"},h.animate),"max"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:100-i+"%"},h.animate))},_handleEvents:{keydown:function(e){var t,i,s,a=o(e.target).data("ui-slider-handle-index");switch(e.keyCode){case o.ui.keyCode.HOME:case o.ui.keyCode.END:case o.ui.keyCode.PAGE_UP:case o.ui.keyCode.PAGE_DOWN:case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(e.preventDefault(),this._keySliding||(this._keySliding=!0,this._addClass(o(e.target),null,"ui-state-active"),!1!==this._start(e,a)))break;return}switch(s=this.options.step,t=i=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case o.ui.keyCode.HOME:i=this._valueMin();break;case o.ui.keyCode.END:i=this._valueMax();break;case o.ui.keyCode.PAGE_UP:i=this._trimAlignValue(t+(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(t-(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:if(t===this._valueMax())return;i=this._trimAlignValue(t+s);break;case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(t===this._valueMin())return;i=this._trimAlignValue(t-s)}this._slide(e,a,i)},keyup:function(e){var t=o(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,t),this._change(e,t),this._removeClass(o(e.target),null,"ui-state-active"))}}})});; /* flatpickr v4.6.13,, @license MIT */ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).flatpickr=n()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var n,t=1,a=arguments.length;t",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={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 n=e%100;if(n>3&&n<21)return"th";switch(n%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",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},r=function(e){return!0===e?1:0};function l(e,n){var t;return function(){var a=this,i=arguments;clearTimeout(t),t=setTimeout((function(){return e.apply(a,i)}),n)}}var c=function(e){return e instanceof Array?e:[e]};function s(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function d(e,n,t){var a=window.document.createElement(e);return n=n||"",t=t||"",a.className=n,void 0!==t&&(a.textContent=t),a}function u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function f(e,n){return n(e)?e:e.parentNode?f(e.parentNode,n):void 0}function m(e,n){var t=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!==n)for(var r in n)a.setAttribute(r,n[r]);return t.appendChild(a),t.appendChild(i),t.appendChild(o),t}function g(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var p=function(){},h=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},v={D:p,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours((e.getHours()>=12?12:0)+parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*r(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var a=parseInt(n),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+t.firstDayOfWeek),i},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours((e.getHours()>=12?12:0)+parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:p,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:p,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},D={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},w={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[w.w(e,n,t)]},F:function(e,n,t){return h(w.n(e,n,t)-1,!1,n)},G:function(e,n,t){return o(w.h(e,n,t))},H:function(e){return o(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[r(e.getHours()>11)]},M:function(e,n){return h(e.getMonth(),!0,n)},S:function(e){return o(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return o(e.getFullYear(),4)},d:function(e){return o(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return o(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return o(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)}},b=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o,l=e.isMobile,c=void 0!==l&&l;return function(e,n,a){var i=a||r;return void 0===t.formatDate||c?n.split("").map((function(n,a,o){return w[n]&&"\\"!==o[a-1]?w[n](e,i,t):"\\"!==n?n:""})).join(""):t.formatDate(e,n,i)}},C=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o;return function(e,n,i,o){if(0===e||e){var l,c=o||r,s=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 d=n||(t||a).dateFormat,u=String(e).trim();if("today"===u)l=new Date,i=!0;else if(t&&t.parseDate)l=t.parseDate(e,d);else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else{for(var f=void 0,m=[],g=0,p=0,h="";g=0?new Date:new Date(w.config.minDate.getTime()),t=E(w.config);n.setHours(t.hours,t.minutes,t.seconds,n.getMilliseconds()),w.selectedDates=[n],w.latestSelectedDateObj=n}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var n="keydown"===e.type,t=g(e),a=t;void 0!==w.amPM&&t===w.amPM&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]);var i=parseFloat(a.getAttribute("min")),l=parseFloat(a.getAttribute("max")),c=parseFloat(a.getAttribute("step")),s=parseInt(a.value,10),d=e.delta||(n?38===e.which?1:-1:0),u=s+c*d;if(void 0!==a.value&&2===a.value.length){var f=a===w.hourElement,m=a===w.minuteElement;ul&&(u=a===w.hourElement?u-l-r(!w.amPM):i,m&&L(void 0,1,w.hourElement)),w.amPM&&f&&(1===c?u+s===23:Math.abs(u-s)>c)&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]),a.value=o(u)}}(e);var a=w._input.value;O(),ye(),w._input.value!==a&&w._debouncedChange()}function O(){if(void 0!==w.hourElement&&void 0!==w.minuteElement){var e,n,t=(parseInt(w.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(w.minuteElement.value,10)||0)%60,i=void 0!==w.secondElement?(parseInt(w.secondElement.value,10)||0)%60:0;void 0!==w.amPM&&(e=t,n=w.amPM.textContent,t=e%12+12*r(n===w.l10n.amPM[1]));var o=void 0!==w.config.minTime||w.config.minDate&&w.minDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.minDate,!0),l=void 0!==w.config.maxTime||w.config.maxDate&&w.maxDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.maxDate,!0);if(void 0!==w.config.maxTime&&void 0!==w.config.minTime&&w.config.minTime>w.config.maxTime){var c=y(w.config.minTime.getHours(),w.config.minTime.getMinutes(),w.config.minTime.getSeconds()),s=y(w.config.maxTime.getHours(),w.config.maxTime.getMinutes(),w.config.maxTime.getSeconds()),d=y(t,a,i);if(d>s&&d=12)]),void 0!==w.secondElement&&(w.secondElement.value=o(t)))}function N(e){var n=g(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&ee(t)}function P(e,n,t,a){return n instanceof Array?n.forEach((function(n){return P(e,n,t,a)})):e instanceof Array?e.forEach((function(e){return P(e,n,t,a)})):(e.addEventListener(n,t,a),void w._handlers.push({remove:function(){return e.removeEventListener(n,t,a)}}))}function Y(){De("onChange")}function j(e,n){var t=void 0!==e?w.parseDate(e):w.latestSelectedDateObj||(w.config.minDate&&w.config.minDate>w.now?w.config.minDate:w.config.maxDate&&w.config.maxDate=0&&M(e,w.selectedDates[1])<=0)}(n)&&!be(n)&&o.classList.add("inRange"),w.weekNumbers&&1===w.config.showMonths&&"prevMonthDay"!==e&&a%7==6&&w.weekNumbers.insertAdjacentHTML("beforeend",""+w.config.getWeek(n)+""),De("onDayCreate",o),o}function W(e){e.focus(),"range"===w.config.mode&&oe(e)}function B(e){for(var n=e>0?0:w.config.showMonths-1,t=e>0?w.config.showMonths:-1,a=n;a!=t;a+=e)for(var i=w.daysContainer.children[a],o=e>0?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")&&ne(c.dateObj))return c}}function J(e,n){var t=k(),a=te(t||document.body),i=void 0!==e?e:a?t:void 0!==w.selectedDateElem&&te(w.selectedDateElem)?w.selectedDateElem:void 0!==w.todayDateElem&&te(w.todayDateElem)?w.todayDateElem:B(n>0?1:-1);void 0===i?w._input.focus():a?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():w.currentMonth,a=n>0?w.config.showMonths:-1,i=n>0?1:-1,o=t-w.currentMonth;o!=a;o+=i)for(var r=w.daysContainer.children[o],l=t-w.currentMonth===o?e.$i+n:n<0?r.children.length-1:0,c=r.children.length,s=l;s>=0&&s0?c:-1);s+=i){var d=r.children[s];if(-1===d.className.indexOf("hidden")&&ne(d.dateObj)&&Math.abs(e.$i-s)>=Math.abs(n))return W(d)}w.changeMonth(i),J(B(i),0)}(i,n):W(i)}function K(e,n){for(var t=(new Date(e,n,1).getDay()-w.l10n.firstDayOfWeek+7)%7,a=w.utils.getDaysInMonth((n-1+12)%12,e),i=w.utils.getDaysInMonth(n,e),o=window.document.createDocumentFragment(),r=w.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",c=r?"nextMonthDay hidden":"nextMonthDay",s=a+1-t,u=0;s<=a;s++,u++)o.appendChild(R("flatpickr-day "+l,new Date(e,n-1,s),0,u));for(s=1;s<=i;s++,u++)o.appendChild(R("flatpickr-day",new Date(e,n,s),0,u));for(var f=i+1;f<=42-t&&(1===w.config.showMonths||u%7!=0);f++,u++)o.appendChild(R("flatpickr-day "+c,new Date(e,n+1,f%i),0,u));var m=d("div","dayContainer");return m.appendChild(o),m}function U(){if(void 0!==w.daysContainer){u(w.daysContainer),w.weekNumbers&&u(w.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n1||"dropdown"!==w.config.monthSelectorType)){var e=function(e){return!(void 0!==w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&ew.config.maxDate.getMonth())};w.monthsDropdownContainer.tabIndex=-1,w.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=d("option","flatpickr-monthDropdown-month");t.value=new Date(w.currentYear,n).getMonth().toString(),t.textContent=h(n,w.config.shorthandCurrentMonth,w.l10n),t.tabIndex=-1,w.currentMonth===n&&(t.selected=!0),w.monthsDropdownContainer.appendChild(t)}}}function $(){var e,n=d("div","flatpickr-month"),t=window.document.createDocumentFragment();w.config.showMonths>1||"static"===w.config.monthSelectorType?e=d("span","cur-month"):(w.monthsDropdownContainer=d("select","flatpickr-monthDropdown-months"),w.monthsDropdownContainer.setAttribute("aria-label",w.l10n.monthAriaLabel),P(w.monthsDropdownContainer,"change",(function(e){var n=g(e),t=parseInt(n.value,10);w.changeMonth(t-w.currentMonth),De("onMonthChange")})),q(),e=w.monthsDropdownContainer);var a=m("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",w.l10n.yearAriaLabel),w.config.minDate&&i.setAttribute("min",w.config.minDate.getFullYear().toString()),w.config.maxDate&&(i.setAttribute("max",w.config.maxDate.getFullYear().toString()),i.disabled=!!w.config.minDate&&w.config.minDate.getFullYear()===w.config.maxDate.getFullYear());var o=d("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),t.appendChild(o),n.appendChild(t),{container:n,yearElement:i,monthElement:e}}function V(){u(w.monthNav),w.monthNav.appendChild(w.prevMonthNav),w.config.showMonths&&(w.yearElements=[],w.monthElements=[]);for(var e=w.config.showMonths;e--;){var n=$();w.yearElements.push(n.yearElement),w.monthElements.push(n.monthElement),w.monthNav.appendChild(n.container)}w.monthNav.appendChild(w.nextMonthNav)}function z(){w.weekdayContainer?u(w.weekdayContainer):w.weekdayContainer=d("div","flatpickr-weekdays");for(var e=w.config.showMonths;e--;){var n=d("div","flatpickr-weekdaycontainer");w.weekdayContainer.appendChild(n)}return G(),w.weekdayContainer}function G(){if(w.weekdayContainer){var e=w.l10n.firstDayOfWeek,t=n(w.l10n.weekdays.shorthand);e>0&&e\n "+t.join("")+"\n \n "}}function Z(e,n){void 0===n&&(n=!0);var t=n?e:e-w.currentMonth;t<0&&!0===w._hidePrevMonthArrow||t>0&&!0===w._hideNextMonthArrow||(w.currentMonth+=t,(w.currentMonth<0||w.currentMonth>11)&&(w.currentYear+=w.currentMonth>11?1:-1,w.currentMonth=(w.currentMonth+12)%12,De("onYearChange"),q()),U(),De("onMonthChange"),Ce())}function Q(e){return w.calendarContainer.contains(e)}function X(e){if(w.isOpen&&!w.config.inline){var n=g(e),t=Q(n),a=!(n===w.input||n===w.altInput||w.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(w.input)||~e.path.indexOf(w.altInput)))&&!t&&!Q(e.relatedTarget),i=!w.config.ignoredFocusElements.some((function(e){return e.contains(n)}));a&&i&&(w.config.allowInput&&w.setDate(w._input.value,!1,w.config.altInput?w.config.altFormat:w.config.dateFormat),void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement&&""!==w.input.value&&void 0!==w.input.value&&_(),w.close(),w.config&&"range"===w.config.mode&&1===w.selectedDates.length&&w.clear(!1))}}function ee(e){if(!(!e||w.config.minDate&&ew.config.maxDate.getFullYear())){var n=e,t=w.currentYear!==n;w.currentYear=n||w.currentYear,w.config.maxDate&&w.currentYear===w.config.maxDate.getFullYear()?w.currentMonth=Math.min(w.config.maxDate.getMonth(),w.currentMonth):w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&(w.currentMonth=Math.max(w.config.minDate.getMonth(),w.currentMonth)),t&&(w.redraw(),De("onYearChange"),q())}}function ne(e,n){var t;void 0===n&&(n=!0);var a=w.parseDate(e,void 0,n);if(w.config.minDate&&a&&M(a,w.config.minDate,void 0!==n?n:!w.minDateHasTime)<0||w.config.maxDate&&a&&M(a,w.config.maxDate,void 0!==n?n:!w.maxDateHasTime)>0)return!1;if(!w.config.enable&&0===w.config.disable.length)return!0;if(void 0===a)return!1;for(var i=!!w.config.enable,o=null!==(t=w.config.enable)&&void 0!==t?t:w.config.disable,r=0,l=void 0;r=l.from.getTime()&&a.getTime()<=l.to.getTime())return i}return!i}function te(e){return void 0!==w.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&w.daysContainer.contains(e))}function ae(e){var n=e.target===w._input,t=w._input.value.trimEnd()!==Me();!n||!t||e.relatedTarget&&Q(e.relatedTarget)||w.setDate(w._input.value,!0,e.target===w.altInput?w.config.altFormat:w.config.dateFormat)}function ie(e){var n=g(e),t=w.config.wrap?p.contains(n):n===w._input,a=w.config.allowInput,i=w.isOpen&&(!a||!t),o=w.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return w.setDate(w._input.value,!0,n===w.altInput?w.config.altFormat:w.config.dateFormat),w.close(),n.blur();w.open()}else if(Q(n)||i||o){var r=!!w.timeContainer&&w.timeContainer.contains(n);switch(e.keyCode){case 13:r?(e.preventDefault(),_(),fe()):me(e);break;case 27:e.preventDefault(),fe();break;case 8:case 46:t&&!w.config.allowInput&&(e.preventDefault(),w.clear());break;case 37:case 39:if(r||t)w.hourElement&&w.hourElement.focus();else{e.preventDefault();var l=k();if(void 0!==w.daysContainer&&(!1===a||l&&te(l))){var c=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),Z(c),J(B(1),0)):J(void 0,c)}}break;case 38:case 40:e.preventDefault();var s=40===e.keyCode?1:-1;w.daysContainer&&void 0!==n.$i||n===w.input||n===w.altInput?e.ctrlKey?(e.stopPropagation(),ee(w.currentYear-s),J(B(1),0)):r||J(void 0,7*s):n===w.currentYearElement?ee(w.currentYear-s):w.config.enableTime&&(!r&&w.hourElement&&w.hourElement.focus(),_(e),w._debouncedChange());break;case 9:if(r){var d=[w.hourElement,w.minuteElement,w.secondElement,w.amPM].concat(w.pluginElements).filter((function(e){return e})),u=d.indexOf(n);if(-1!==u){var f=d[u+(e.shiftKey?-1:1)];e.preventDefault(),(f||w._input).focus()}}else!w.config.noCalendar&&w.daysContainer&&w.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),w._input.focus())}}if(void 0!==w.amPM&&n===w.amPM)switch(e.key){case w.l10n.amPM[0].charAt(0):case w.l10n.amPM[0].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[0],O(),ye();break;case w.l10n.amPM[1].charAt(0):case w.l10n.amPM[1].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[1],O(),ye()}(t||Q(n))&&De("onKeyDown",e)}function oe(e,n){if(void 0===n&&(n="flatpickr-day"),1===w.selectedDates.length&&(!e||e.classList.contains(n)&&!e.classList.contains("flatpickr-disabled"))){for(var t=e?e.dateObj.getTime():w.days.firstElementChild.dateObj.getTime(),a=w.parseDate(w.selectedDates[0],void 0,!0).getTime(),i=Math.min(t,w.selectedDates[0].getTime()),o=Math.max(t,w.selectedDates[0].getTime()),r=!1,l=0,c=0,s=i;si&&sl)?l=s:s>a&&(!c||s ."+n)).forEach((function(n){var i,o,s,d=n.dateObj.getTime(),u=l>0&&d0&&d>c;if(u)return n.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach((function(e){n.classList.remove(e)}));r&&!u||(["startRange","inRange","endRange","notAllowed"].forEach((function(e){n.classList.remove(e)})),void 0!==e&&(e.classList.add(t<=w.selectedDates[0].getTime()?"startRange":"endRange"),at&&d===a&&n.classList.add("endRange"),d>=l&&(0===c||d<=c)&&(o=a,s=t,(i=d)>Math.min(o,s)&&i0||t.getMinutes()>0||t.getSeconds()>0),w.selectedDates&&(w.selectedDates=w.selectedDates.filter((function(e){return ne(e)})),w.selectedDates.length||"min"!==e||F(t),ye()),w.daysContainer&&(ue(),void 0!==t?w.currentYearElement[e]=t.getFullYear().toString():w.currentYearElement.removeAttribute(e),w.currentYearElement.disabled=!!a&&void 0!==t&&a.getFullYear()===t.getFullYear())}}function ce(){return w.config.wrap?p.querySelector("[data-input]"):p}function se(){"object"!=typeof w.config.locale&&void 0===I.l10ns[w.config.locale]&&w.config.errorHandler(new Error("flatpickr: invalid locale "+w.config.locale)),w.l10n=e(e({},I.l10ns.default),"object"==typeof w.config.locale?w.config.locale:"default"!==w.config.locale?I.l10ns[w.config.locale]:void 0),D.D="("+w.l10n.weekdays.shorthand.join("|")+")",D.l="("+w.l10n.weekdays.longhand.join("|")+")",D.M="("+w.l10n.months.shorthand.join("|")+")",D.F="("+w.l10n.months.longhand.join("|")+")",D.K="("+w.l10n.amPM[0]+"|"+w.l10n.amPM[1]+"|"+w.l10n.amPM[0].toLowerCase()+"|"+w.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},v),JSON.parse(JSON.stringify(p.dataset||{}))).time_24hr&&void 0===I.defaultConfig.time_24hr&&(w.config.time_24hr=w.l10n.time_24hr),w.formatDate=b(w),w.parseDate=C({config:w.config,l10n:w.l10n})}function de(e){if("function"!=typeof w.config.position){if(void 0!==w.calendarContainer){De("onPreCalendarPosition");var n=e||w._positionElement,t=Array.prototype.reduce.call(w.calendarContainer.children,(function(e,n){return e+n.offsetHeight}),0),a=w.calendarContainer.offsetWidth,i=w.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,l=n.getBoundingClientRect(),c=window.innerHeight-l.bottom,d="above"===o||"below"!==o&&ct,u=window.pageYOffset+l.top+(d?-t-2:n.offsetHeight+2);if(s(w.calendarContainer,"arrowTop",!d),s(w.calendarContainer,"arrowBottom",d),!w.config.inline){var f=window.pageXOffset+l.left,m=!1,g=!1;"center"===r?(f-=(a-l.width)/2,m=!0):"right"===r&&(f-=a-l.width,g=!0),s(w.calendarContainer,"arrowLeft",!m&&!g),s(w.calendarContainer,"arrowCenter",m),s(w.calendarContainer,"arrowRight",g);var p=window.document.body.offsetWidth-(window.pageXOffset+l.right),h=f+a>window.document.body.offsetWidth,v=p+a>window.document.body.offsetWidth;if(s(w.calendarContainer,"rightMost",h),!w.config.static)if(w.calendarContainer.style.top=u+"px",h)if(v){var D=function(){for(var e=null,n=0;nw.currentMonth+w.config.showMonths-1)&&"range"!==w.config.mode;if(w.selectedDateElem=t,"single"===w.config.mode)w.selectedDates=[a];else if("multiple"===w.config.mode){var o=be(a);o?w.selectedDates.splice(parseInt(o),1):w.selectedDates.push(a)}else"range"===w.config.mode&&(2===w.selectedDates.length&&w.clear(!1,!1),w.latestSelectedDateObj=a,w.selectedDates.push(a),0!==M(a,w.selectedDates[0],!0)&&w.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()})));if(O(),i){var r=w.currentYear!==a.getFullYear();w.currentYear=a.getFullYear(),w.currentMonth=a.getMonth(),r&&(De("onYearChange"),q()),De("onMonthChange")}if(Ce(),U(),ye(),i||"range"===w.config.mode||1!==w.config.showMonths?void 0!==w.selectedDateElem&&void 0===w.hourElement&&w.selectedDateElem&&w.selectedDateElem.focus():W(t),void 0!==w.hourElement&&void 0!==w.hourElement&&w.hourElement.focus(),w.config.closeOnSelect){var l="single"===w.config.mode&&!w.config.enableTime,c="range"===w.config.mode&&2===w.selectedDates.length&&!w.config.enableTime;(l||c)&&fe()}Y()}}w.parseDate=C({config:w.config,l10n:w.l10n}),w._handlers=[],w.pluginElements=[],w.loadedPlugins=[],w._bind=P,w._setHoursFromDate=F,w._positionCalendar=de,w.changeMonth=Z,w.changeYear=ee,w.clear=function(e,n){void 0===e&&(e=!0);void 0===n&&(n=!0);w.input.value="",void 0!==w.altInput&&(w.altInput.value="");void 0!==w.mobileInput&&(w.mobileInput.value="");w.selectedDates=[],w.latestSelectedDateObj=void 0,!0===n&&(w.currentYear=w._initialDate.getFullYear(),w.currentMonth=w._initialDate.getMonth());if(!0===w.config.enableTime){var t=E(w.config),a=t.hours,i=t.minutes,o=t.seconds;A(a,i,o)}w.redraw(),e&&De("onChange")},w.close=function(){w.isOpen=!1,w.isMobile||(void 0!==w.calendarContainer&&w.calendarContainer.classList.remove("open"),void 0!==w._input&&w._input.classList.remove("active"));De("onClose")},w.onMouseOver=oe,w._createElement=d,w.createDay=R,w.destroy=function(){void 0!==w.config&&De("onDestroy");for(var e=w._handlers.length;e--;)w._handlers[e].remove();if(w._handlers=[],w.mobileInput)w.mobileInput.parentNode&&w.mobileInput.parentNode.removeChild(w.mobileInput),w.mobileInput=void 0;else if(w.calendarContainer&&w.calendarContainer.parentNode)if(w.config.static&&w.calendarContainer.parentNode){var n=w.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 w.calendarContainer.parentNode.removeChild(w.calendarContainer);w.altInput&&(w.input.type="text",w.altInput.parentNode&&w.altInput.parentNode.removeChild(w.altInput),delete w.altInput);w.input&&(w.input.type=w.input._type,w.input.classList.remove("flatpickr-input"),w.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","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 w[e]}catch(e){}}))},w.isEnabled=ne,w.jumpToDate=j,w.updateValue=ye,w.open=function(e,n){void 0===n&&(n=w._positionElement);if(!0===w.isMobile){if(e){e.preventDefault();var t=g(e);t&&t.blur()}return void 0!==w.mobileInput&&(w.mobileInput.focus(),w.mobileInput.click()),void De("onOpen")}if(w._input.disabled||w.config.inline)return;var a=w.isOpen;w.isOpen=!0,a||(w.calendarContainer.classList.add("open"),w._input.classList.add("active"),De("onOpen"),de(n));!0===w.config.enableTime&&!0===w.config.noCalendar&&(!1!==w.config.allowInput||void 0!==e&&w.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return w.hourElement.select()}),50))},w.redraw=ue,w.set=function(e,n){if(null!==e&&"object"==typeof e)for(var a in Object.assign(w.config,e),e)void 0!==ge[a]&&ge[a].forEach((function(e){return e()}));else w.config[e]=n,void 0!==ge[e]?ge[e].forEach((function(e){return e()})):t.indexOf(e)>-1&&(w.config[e]=c(n));w.redraw(),ye(!0)},w.setDate=function(e,n,t){void 0===n&&(n=!1);void 0===t&&(t=w.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return w.clear(n);pe(e,t),w.latestSelectedDateObj=w.selectedDates[w.selectedDates.length-1],w.redraw(),j(void 0,n),F(),0===w.selectedDates.length&&w.clear(!1);ye(n),n&&De("onChange")},w.toggle=function(e){if(!0===w.isOpen)return w.close();w.open(e)};var ge={locale:[se,G],showMonths:[V,S,z],minDate:[j],maxDate:[j],positionElement:[ve],clickOpens:[function(){!0===w.config.clickOpens?(P(w._input,"focus",w.open),P(w._input,"click",w.open)):(w._input.removeEventListener("focus",w.open),w._input.removeEventListener("click",w.open))}]};function pe(e,n){var t=[];if(e instanceof Array)t=e.map((function(e){return w.parseDate(e,n)}));else if(e instanceof Date||"number"==typeof e)t=[w.parseDate(e,n)];else if("string"==typeof e)switch(w.config.mode){case"single":case"time":t=[w.parseDate(e,n)];break;case"multiple":t=e.split(w.config.conjunction).map((function(e){return w.parseDate(e,n)}));break;case"range":t=e.split(w.l10n.rangeSeparator).map((function(e){return w.parseDate(e,n)}))}else w.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));w.selectedDates=w.config.allowInvalidPreload?t:t.filter((function(e){return e instanceof Date&&ne(e,!1)})),"range"===w.config.mode&&w.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()}))}function he(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?w.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:w.parseDate(e.from,void 0),to:w.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function ve(){w._positionElement=w.config.positionElement||w._input}function De(e,n){if(void 0!==w.config){var t=w.config[e];if(void 0!==t&&t.length>0)for(var a=0;t[a]&&a1||"static"===w.config.monthSelectorType?w.monthElements[n].textContent=h(t.getMonth(),w.config.shorthandCurrentMonth,w.l10n)+" ":w.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()})),w._hidePrevMonthArrow=void 0!==w.config.minDate&&(w.currentYear===w.config.minDate.getFullYear()?w.currentMonth<=w.config.minDate.getMonth():w.currentYearw.config.maxDate.getMonth():w.currentYear>w.config.maxDate.getFullYear()))}function Me(e){var n=e||(w.config.altInput?w.config.altFormat:w.config.dateFormat);return w.selectedDates.map((function(e){return w.formatDate(e,n)})).filter((function(e,n,t){return"range"!==w.config.mode||w.config.enableTime||t.indexOf(e)===n})).join("range"!==w.config.mode?w.config.conjunction:w.l10n.rangeSeparator)}function ye(e){void 0===e&&(e=!0),void 0!==w.mobileInput&&w.mobileFormatStr&&(w.mobileInput.value=void 0!==w.latestSelectedDateObj?w.formatDate(w.latestSelectedDateObj,w.mobileFormatStr):""),w.input.value=Me(w.config.dateFormat),void 0!==w.altInput&&(w.altInput.value=Me(w.config.altFormat)),!1!==e&&De("onValueUpdate")}function xe(e){var n=g(e),t=w.prevMonthNav.contains(n),a=w.nextMonthNav.contains(n);t||a?Z(t?-1:1):w.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?w.changeYear(w.currentYear+1):n.classList.contains("arrowDown")&&w.changeYear(w.currentYear-1)}return function(){w.element=w.input=p,w.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],i=e(e({},JSON.parse(JSON.stringify(p.dataset||{}))),v),o={};w.config.parseDate=i.parseDate,w.config.formatDate=i.formatDate,Object.defineProperty(w.config,"enable",{get:function(){return w.config._enable},set:function(e){w.config._enable=he(e)}}),Object.defineProperty(w.config,"disable",{get:function(){return w.config._disable},set:function(e){w.config._disable=he(e)}});var r="time"===i.mode;if(!i.dateFormat&&(i.enableTime||r)){var l=I.defaultConfig.dateFormat||a.dateFormat;o.dateFormat=i.noCalendar||r?"H:i"+(i.enableSeconds?":S":""):l+" H:i"+(i.enableSeconds?":S":"")}if(i.altInput&&(i.enableTime||r)&&!i.altFormat){var s=I.defaultConfig.altFormat||a.altFormat;o.altFormat=i.noCalendar||r?"h:i"+(i.enableSeconds?":S K":" K"):s+" h:i"+(i.enableSeconds?":S":"")+" K"}Object.defineProperty(w.config,"minDate",{get:function(){return w.config._minDate},set:le("min")}),Object.defineProperty(w.config,"maxDate",{get:function(){return w.config._maxDate},set:le("max")});var d=function(e){return function(n){w.config["min"===e?"_minTime":"_maxTime"]=w.parseDate(n,"H:i:S")}};Object.defineProperty(w.config,"minTime",{get:function(){return w.config._minTime},set:d("min")}),Object.defineProperty(w.config,"maxTime",{get:function(){return w.config._maxTime},set:d("max")}),"time"===i.mode&&(w.config.noCalendar=!0,w.config.enableTime=!0);Object.assign(w.config,o,i);for(var u=0;u-1?w.config[m]=c(f[m]).map(T).concat(w.config[m]):void 0===i[m]&&(w.config[m]=f[m])}i.altInputClass||(w.config.altInputClass=ce().className+" "+w.config.altInputClass);De("onParseConfig")}(),se(),function(){if(w.input=ce(),!w.input)return void w.config.errorHandler(new Error("Invalid input element specified"));w.input._type=w.input.type,w.input.type="text",w.input.classList.add("flatpickr-input"),w._input=w.input,w.config.altInput&&(w.altInput=d(w.input.nodeName,w.config.altInputClass),w._input=w.altInput,w.altInput.placeholder=w.input.placeholder,w.altInput.disabled=w.input.disabled,w.altInput.required=w.input.required,w.altInput.tabIndex=w.input.tabIndex,w.altInput.type="text",w.input.setAttribute("type","hidden"),!w.config.static&&w.input.parentNode&&w.input.parentNode.insertBefore(w.altInput,w.input.nextSibling));w.config.allowInput||w._input.setAttribute("readonly","readonly");ve()}(),function(){w.selectedDates=[],w.now=w.parseDate(w.config.now)||new Date;var e=w.config.defaultDate||("INPUT"!==w.input.nodeName&&"TEXTAREA"!==w.input.nodeName||!w.input.placeholder||w.input.value!==w.input.placeholder?w.input.value:null);e&&pe(e,w.config.dateFormat);w._initialDate=w.selectedDates.length>0?w.selectedDates[0]:w.config.minDate&&w.config.minDate.getTime()>w.now.getTime()?w.config.minDate:w.config.maxDate&&w.config.maxDate.getTime()0&&(w.latestSelectedDateObj=w.selectedDates[0]);void 0!==w.config.minTime&&(w.config.minTime=w.parseDate(w.config.minTime,"H:i"));void 0!==w.config.maxTime&&(w.config.maxTime=w.parseDate(w.config.maxTime,"H:i"));w.minDateHasTime=!!w.config.minDate&&(w.config.minDate.getHours()>0||w.config.minDate.getMinutes()>0||w.config.minDate.getSeconds()>0),w.maxDateHasTime=!!w.config.maxDate&&(w.config.maxDate.getHours()>0||w.config.maxDate.getMinutes()>0||w.config.maxDate.getSeconds()>0)}(),w.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=w.currentMonth),void 0===n&&(n=w.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:w.l10n.daysInMonth[e]}},w.isMobile||function(){var e=window.document.createDocumentFragment();if(w.calendarContainer=d("div","flatpickr-calendar"),w.calendarContainer.tabIndex=-1,!w.config.noCalendar){if(e.appendChild((w.monthNav=d("div","flatpickr-months"),w.yearElements=[],w.monthElements=[],w.prevMonthNav=d("span","flatpickr-prev-month"),w.prevMonthNav.innerHTML=w.config.prevArrow,w.nextMonthNav=d("span","flatpickr-next-month"),w.nextMonthNav.innerHTML=w.config.nextArrow,V(),Object.defineProperty(w,"_hidePrevMonthArrow",{get:function(){return w.__hidePrevMonthArrow},set:function(e){w.__hidePrevMonthArrow!==e&&(s(w.prevMonthNav,"flatpickr-disabled",e),w.__hidePrevMonthArrow=e)}}),Object.defineProperty(w,"_hideNextMonthArrow",{get:function(){return w.__hideNextMonthArrow},set:function(e){w.__hideNextMonthArrow!==e&&(s(w.nextMonthNav,"flatpickr-disabled",e),w.__hideNextMonthArrow=e)}}),w.currentYearElement=w.yearElements[0],Ce(),w.monthNav)),w.innerContainer=d("div","flatpickr-innerContainer"),w.config.weekNumbers){var n=function(){w.calendarContainer.classList.add("hasWeeks");var e=d("div","flatpickr-weekwrapper");e.appendChild(d("span","flatpickr-weekday",w.l10n.weekAbbreviation));var n=d("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,a=n.weekNumbers;w.innerContainer.appendChild(t),w.weekNumbers=a,w.weekWrapper=t}w.rContainer=d("div","flatpickr-rContainer"),w.rContainer.appendChild(z()),w.daysContainer||(w.daysContainer=d("div","flatpickr-days"),w.daysContainer.tabIndex=-1),U(),w.rContainer.appendChild(w.daysContainer),w.innerContainer.appendChild(w.rContainer),e.appendChild(w.innerContainer)}w.config.enableTime&&e.appendChild(function(){w.calendarContainer.classList.add("hasTime"),w.config.noCalendar&&w.calendarContainer.classList.add("noCalendar");var e=E(w.config);w.timeContainer=d("div","flatpickr-time"),w.timeContainer.tabIndex=-1;var n=d("span","flatpickr-time-separator",":"),t=m("flatpickr-hour",{"aria-label":w.l10n.hourAriaLabel});w.hourElement=t.getElementsByTagName("input")[0];var a=m("flatpickr-minute",{"aria-label":w.l10n.minuteAriaLabel});w.minuteElement=a.getElementsByTagName("input")[0],w.hourElement.tabIndex=w.minuteElement.tabIndex=-1,w.hourElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getHours():w.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),w.minuteElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getMinutes():e.minutes),w.hourElement.setAttribute("step",w.config.hourIncrement.toString()),w.minuteElement.setAttribute("step",w.config.minuteIncrement.toString()),w.hourElement.setAttribute("min",w.config.time_24hr?"0":"1"),w.hourElement.setAttribute("max",w.config.time_24hr?"23":"12"),w.hourElement.setAttribute("maxlength","2"),w.minuteElement.setAttribute("min","0"),w.minuteElement.setAttribute("max","59"),w.minuteElement.setAttribute("maxlength","2"),w.timeContainer.appendChild(t),w.timeContainer.appendChild(n),w.timeContainer.appendChild(a),w.config.time_24hr&&w.timeContainer.classList.add("time24hr");if(w.config.enableSeconds){w.timeContainer.classList.add("hasSeconds");var i=m("flatpickr-second");w.secondElement=i.getElementsByTagName("input")[0],w.secondElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getSeconds():e.seconds),w.secondElement.setAttribute("step",w.minuteElement.getAttribute("step")),w.secondElement.setAttribute("min","0"),w.secondElement.setAttribute("max","59"),w.secondElement.setAttribute("maxlength","2"),w.timeContainer.appendChild(d("span","flatpickr-time-separator",":")),w.timeContainer.appendChild(i)}w.config.time_24hr||(w.amPM=d("span","flatpickr-am-pm",w.l10n.amPM[r((w.latestSelectedDateObj?w.hourElement.value:w.config.defaultHour)>11)]),w.amPM.title=w.l10n.toggleTitle,w.amPM.tabIndex=-1,w.timeContainer.appendChild(w.amPM));return w.timeContainer}());s(w.calendarContainer,"rangeMode","range"===w.config.mode),s(w.calendarContainer,"animate",!0===w.config.animate),s(w.calendarContainer,"multiMonth",w.config.showMonths>1),w.calendarContainer.appendChild(e);var i=void 0!==w.config.appendTo&&void 0!==w.config.appendTo.nodeType;if((w.config.inline||w.config.static)&&(w.calendarContainer.classList.add(w.config.inline?"inline":"static"),w.config.inline&&(!i&&w.element.parentNode?w.element.parentNode.insertBefore(w.calendarContainer,w._input.nextSibling):void 0!==w.config.appendTo&&w.config.appendTo.appendChild(w.calendarContainer)),w.config.static)){var l=d("div","flatpickr-wrapper");w.element.parentNode&&w.element.parentNode.insertBefore(l,w.element),l.appendChild(w.element),w.altInput&&l.appendChild(w.altInput),l.appendChild(w.calendarContainer)}w.config.static||w.config.inline||(void 0!==w.config.appendTo?w.config.appendTo:window.document.body).appendChild(w.calendarContainer)}(),function(){w.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(w.element.querySelectorAll("[data-"+e+"]"),(function(n){return P(n,"click",w[e])}))}));if(w.isMobile)return void function(){var e=w.config.enableTime?w.config.noCalendar?"time":"datetime-local":"date";w.mobileInput=d("input",w.input.className+" flatpickr-mobile"),w.mobileInput.tabIndex=1,w.mobileInput.type=e,w.mobileInput.disabled=w.input.disabled,w.mobileInput.required=w.input.required,w.mobileInput.placeholder=w.input.placeholder,w.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",w.selectedDates.length>0&&(w.mobileInput.defaultValue=w.mobileInput.value=w.formatDate(w.selectedDates[0],w.mobileFormatStr));w.config.minDate&&(w.mobileInput.min=w.formatDate(w.config.minDate,"Y-m-d"));w.config.maxDate&&(w.mobileInput.max=w.formatDate(w.config.maxDate,"Y-m-d"));w.input.getAttribute("step")&&(w.mobileInput.step=String(w.input.getAttribute("step")));w.input.type="hidden",void 0!==w.altInput&&(w.altInput.type="hidden");try{w.input.parentNode&&w.input.parentNode.insertBefore(w.mobileInput,w.input.nextSibling)}catch(e){}P(w.mobileInput,"change",(function(e){w.setDate(g(e).value,!1,w.mobileFormatStr),De("onChange"),De("onClose")}))}();var e=l(re,50);w._debouncedChange=l(Y,300),w.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&P(w.daysContainer,"mouseover",(function(e){"range"===w.config.mode&&oe(g(e))}));P(w._input,"keydown",ie),void 0!==w.calendarContainer&&P(w.calendarContainer,"keydown",ie);w.config.inline||w.config.static||P(window,"resize",e);void 0!==window.ontouchstart?P(window.document,"touchstart",X):P(window.document,"mousedown",X);P(window.document,"focus",X,{capture:!0}),!0===w.config.clickOpens&&(P(w._input,"focus",w.open),P(w._input,"click",w.open));void 0!==w.daysContainer&&(P(w.monthNav,"click",xe),P(w.monthNav,["keyup","increment"],N),P(w.daysContainer,"click",me));if(void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement){var n=function(e){return g(e).select()};P(w.timeContainer,["increment"],_),P(w.timeContainer,"blur",_,{capture:!0}),P(w.timeContainer,"click",H),P([w.hourElement,w.minuteElement],["focus","click"],n),void 0!==w.secondElement&&P(w.secondElement,"focus",(function(){return w.secondElement&&w.secondElement.select()})),void 0!==w.amPM&&P(w.amPM,"click",(function(e){_(e)}))}w.config.allowInput&&P(w._input,"blur",ae)}(),(w.selectedDates.length||w.config.noCalendar)&&(w.config.enableTime&&F(w.config.noCalendar?w.latestSelectedDateObj:void 0),ye(!1)),S();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!w.isMobile&&n&&de(),De("onReady")}(),w}function T(e,n){for(var t=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),a=[],i=0;i1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);; /** * ES6 Class for Agent Contact Form Widget * * @since 1.0.2 * */ class RHEAAgentContactFormClass extends elementorModules.frontend.handlers.Base { getDefaultSettings() { return { selectors : { agentContactForm : '.rhea_acf_form_box', SubmitButton: '.rhea_acf_submit', messageContainer: '.rhea-message-container', errorContainer: '.rhea-error-container', ajaxLoader: '.rhea-ajax-loader' } }; } getDefaultElements() { const selectors = this.getSettings( 'selectors' ); return { $thisElement : this.$element, $agentContactForm : this.$element.find( selectors.agentContactForm ), $formSubmitButton : this.$element.find( selectors.SubmitButton ), $messageContainer : this.$element.find( selectors.messageContainer ), $errorContainer : this.$element.find( selectors.errorContainer ), $ajaxLoader : this.$element.find( selectors.ajaxLoader ) }; } bindEvents() { this.loadContactFormHandler(); } loadContactFormHandler( event ) { let contactForm = this.elements.$agentContactForm, submitButton = this.elements.$formSubmitButton, messageContainer = this.elements.$messageContainer, errorContainer = this.elements.$errorContainer, ajaxLoader = this.elements.$ajaxLoader; if (jQuery().validate && jQuery().ajaxSubmit) { let formOptions = { beforeSubmit: function () { submitButton.attr('disabled', 'disabled'); ajaxLoader.fadeIn('fast'); messageContainer.fadeOut('fast'); errorContainer.fadeOut('fast'); }, success: function (ajax_response, statusText, xhr, $form) { let response = jQuery.parseJSON(ajax_response); ajaxLoader.fadeOut('fast'); submitButton.removeAttr('disabled'); if (response.success) { $form.resetForm(); messageContainer.html(response.message).fadeIn('fast'); setTimeout(function () { messageContainer.fadeOut('slow') }, 5000); // call reset function if it exists if (typeof inspiryResetReCAPTCHA == 'function') { inspiryResetReCAPTCHA(); } if (typeof CFOSData !== 'undefined') { setTimeout(function () { window.location.replace(CFOSData.redirectPageUrl); }, 1000); } if (typeof contactFromData !== 'undefined') { setTimeout(function () { window.location.replace(contactFromData.redirectPageUrl); }, 1000); } } else { errorContainer.html(response.message).fadeIn('fast'); } } }; // Agent form trigger jQuery(contactForm).validate({ errorLabelContainer: errorContainer, submitHandler: function (form) { jQuery(form).ajaxSubmit(formOptions); } }); } } } jQuery( window ).on( 'elementor/frontend/init', () => { const RHEAAgentContactFormHandler = ( $element ) => { elementorFrontend.elementsHandler.addHandler( RHEAAgentContactFormClass, { $element } ); }; elementorFrontend.hooks.addAction( 'frontend/element_ready/rhea-agent-contact-form-widget.default', RHEAAgentContactFormHandler ); } );; !function(){"use strict";var e,t={noop:function(){},texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"’").replace(/'/g,"’")).replace(/"/g,"”").replace(/"/g,"”").replace(/"/g,"”").replace(/[\u201D]/g,"”")).replace(/([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g,'$1="$2"')).trim()},applyReplacements:function(e,t){if(e)return t?e.replace(/{(\d+)}/g,function(e,r){return void 0!==t[r]?t[r]:e}):e},getBackgroundImage:function(e){var t=document.createElement("canvas"),r=t.getContext&&t.getContext("2d");if(e){r.filter="blur(20px) ",r.drawImage(e,0,0);var o=t.toDataURL("image/png");return t=null,o}}},r=function(){function e(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t,r,o){if(!e)return o();e.style.removeProperty("display"),e.style.opacity=t,e.style.pointerEvents="none";var a=function(i,n){var l=(performance.now()-i)/n;l<1?(e.style.opacity=t+(r-t)*l,requestAnimationFrame(()=>a(i,n))):(e.style.opacity=r,e.style.removeProperty("pointer-events"),o())};requestAnimationFrame(function(){requestAnimationFrame(function(){a(performance.now(),200)})})}return{closest:function(t,r){if(t.closest)return t.closest(r);var o=t;do{if(e(o,r))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null},matches:e,hide:function(e){e&&(e.style.display="none")},show:function(e){e&&(e.style.display="block")},fadeIn:function(e,o){r(e,0,1,o=o||t.noop)},fadeOut:function(e,o){o=o||t.noop,r(e,1,0,function(){e&&(e.style.display="none"),o()})},scrollToElement:function(e,t,r){if(!e||!t)return r?r():void 0;var o=t.querySelector(".jp-carousel-info-extra");o&&(o.style.minHeight=window.innerHeight-64+"px");var a=!0,i=Date.now(),n=t.scrollTop,l=Math.max(0,e.offsetTop-Math.max(0,window.innerHeight-function(e){var t=e.querySelector(".jp-carousel-info-footer"),r=e.querySelector(".jp-carousel-info-extra"),o=e.querySelector(".jp-carousel-info-content-wrapper");if(t&&r&&o){var a=window.getComputedStyle(r),i=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return i=isNaN(i)?0:i,o.offsetHeight+t.offsetHeight+i}return 0}(t)))-t.scrollTop;function s(){a=!1}l=Math.min(l,t.scrollHeight-window.innerHeight),t.addEventListener("wheel",s),function e(){var c,u=Date.now(),d=(c=(u-i)/300)<.5?2*c*c:1-Math.pow(-2*c+2,2)/2,p=(d=d>1?1:d)*l;if(t.scrollTop=n+p,u<=i+300&&a)return requestAnimationFrame(e);r&&r(),o&&(o.style.minHeight=""),a=!1,t.removeEventListener("wheel",s)}()},getJSONAttribute:function(e,t){if(e&&e.hasAttribute(t))try{return JSON.parse(e.getAttribute(t))}catch{return}},convertToPlainText:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},stripHTML:function(e){return e.replace(/<[^>]*>?/gm,"")},emitEvent:function(e,t,r){var o;try{o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r||null})}catch{(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,r||null)}e.dispatchEvent(o)},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}}}();function o(){var o,a,i,n,l="",s=!1,c="div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery",u=".gallery-item, .tiled-gallery-item, .blocks-gallery-item, .tiled-gallery__item",d=u+", .wp-block-image",p={},m="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,g="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function h(t){if(!s)switch(t.which){case 38:t.preventDefault(),p.overlay.scrollTop-=100;break;case 40:t.preventDefault(),p.overlay.scrollTop+=100;break;case 39:t.preventDefault(),e.slideNext();break;case 37:case 8:t.preventDefault(),e.slidePrev();break;case 27:t.preventDefault(),k()}}function f(){s=!0}function v(){s=!1}function y(e){e.role="button",e.tabIndex=0,e.ariaLabel=jetpackCarouselStrings.image_label}function w(){p.overlay||(p.overlay=document.querySelector(".jp-carousel-overlay"),p.container=p.overlay.querySelector(".jp-carousel-wrap"),p.gallery=p.container.querySelector(".jp-carousel"),p.info=p.overlay.querySelector(".jp-carousel-info"),p.caption=p.info.querySelector(".jp-carousel-caption"),p.commentField=p.overlay.querySelector("#jp-carousel-comment-form-comment-field"),p.emailField=p.overlay.querySelector("#jp-carousel-comment-form-email-field"),p.authorField=p.overlay.querySelector("#jp-carousel-comment-form-author-field"),p.urlField=p.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[p.commentField,p.emailField,p.authorField,p.urlField].forEach(function(e){e&&(e.addEventListener("focus",f),e.addEventListener("blur",v))}),p.overlay.addEventListener("click",function(e){var t,o,a=e.target,i=!!r.closest(a,".jp-carousel-close-hint"),n=!!window.matchMedia("(max-device-width: 760px)").matches;a===p.overlay?n||k():i?k():a.classList.contains("jp-carousel-image-download")?m("download_original_click"):a.classList.contains("jp-carousel-comment-login")?(t=p.currentSlide,o=t?t.attrs.attachmentId:"0",window.location.href=jetpackCarouselStrings.login_url+"%23jp-carousel-"+o):r.closest(a,"#jp-carousel-comment-form-container")?function(e){var t=e.target,o=r.getJSONAttribute(p.container,"data-carousel-extra")||{},a=p.currentSlide.attrs.attachmentId,i=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),n=document.querySelector("#jp-carousel-comment-form-spinner"),l=document.querySelector("#jp-carousel-comment-form-button-submit"),s=document.querySelector("#jp-carousel-comment-form");if(p.commentField&&p.commentField.getAttribute("id")===t.getAttribute("id"))f(),r.show(i);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(n),s.classList.add("jp-carousel-is-disabled");var c={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:p.commentField.value};if(!c.comment.length)return void j(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(c.email=p.emailField.value,c.author=p.authorField.value,c.url=p.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!c.email.length||!c.email.match("@"))return void j(jetpackCarouselStrings.no_comment_email,!1);if(!c.author.length)return void j(jetpackCarouselStrings.no_comment_author,!1)}var u=new XMLHttpRequest;u.open("POST",jetpackCarouselStrings.ajaxurl,!0),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),u.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch{return void j(jetpackCarouselStrings.comment_post_error,!1)}"approved"===e.comment_status?j(jetpackCarouselStrings.comment_approved,!0):"unapproved"===e.comment_status?j(jetpackCarouselStrings.comment_unapproved,!0):j(jetpackCarouselStrings.comment_post_error,!1),I(),_(a),l.value=jetpackCarouselStrings.post_comment,r.hide(n),s.classList.remove("jp-carousel-is-disabled")}else j(jetpackCarouselStrings.comment_post_error,!1)};var d=[];for(var m in c)if(m){var g=encodeURIComponent(m)+"="+encodeURIComponent(c[m]);d.push(g.replace(/%20/g,"+"))}var h=d.join("&");u.send(h)}}(e):(r.closest(a,".jp-carousel-photo-icons-container")||a.classList.contains("jp-carousel-photo-title"))&&function(e){e.preventDefault();var t=e.target,o=p.info.querySelector(".jp-carousel-info-extra"),a=p.info.querySelector(".jp-carousel-image-meta"),i=p.info.querySelector(".jp-carousel-comments-wrapper"),n=p.info.querySelector(".jp-carousel-icon-info"),l=p.info.querySelector(".jp-carousel-icon-comments");function s(){l&&l.classList.remove("jp-carousel-selected"),n.classList.toggle("jp-carousel-selected"),i&&i.classList.remove("jp-carousel-show"),a&&(a.classList.toggle("jp-carousel-show"),a.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}function c(){n&&n.classList.remove("jp-carousel-selected"),l.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),i&&(i.classList.toggle("jp-carousel-show"),i.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}(r.closest(t,".jp-carousel-icon-info")||t.classList.contains("jp-carousel-photo-title"))&&(a&&a.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,s):(s(),r.scrollToElement(p.info,p.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(i&&i.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,c):(c(),r.scrollToElement(p.info,p.overlay)))}(e)}),window.addEventListener("keydown",h),p.overlay.addEventListener("jp_carousel.afterOpen",function(){v(),p.slides.length<=1||(p.slides.length<=5?r.show(p.info.querySelector(".jp-swiper-pagination")):r.show(p.info.querySelector(".jp-carousel-pagination")))}),p.overlay.addEventListener("jp_carousel.beforeClose",function(){f(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(p.info.querySelector(".jp-swiper-pagination")),r.hide(p.info.querySelector(".jp-carousel-pagination"))}),p.overlay.addEventListener("jp_carousel.afterClose",function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",l="",p.isOpen=!1}),p.overlay.addEventListener("touchstart",function(e){e.touches.length>1&&e.preventDefault()}))}function j(e,t){var o=p.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML=''+e+"",r.hide(p.overlay.querySelector("#jp-carousel-comment-form-spinner")),p.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function b(){var e=document.querySelectorAll("a img[data-attachment-id]");Array.prototype.forEach.call(e,function(e){var t=e.parentElement,o=t.parentElement;if(!o.classList.contains("gallery-icon")&&!r.closest(o,u)&&t.hasAttribute("href")){var a=!1;t.getAttribute("href").split("?")[0]===e.getAttribute("data-orig-file").split("?")[0]&&1===Number(jetpackCarouselStrings.single_image_gallery_media_file)&&(a=!0),t.getAttribute("href")===e.getAttribute("data-permalink")&&(a=!0),a&&(y(e),t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}})}function S(t,r){p.isOpen?(L(r),e.slideTo(r+1)):F(t,{startIndex:r})}function L(e){(!e||e<0||e>p.slides.length)&&(e=0),p.currentSlide=p.slides[e];var o,a,i=p.currentSlide,n=i.attrs.attachmentId;H(p.slides[e]),function(e){var t=[],r=p.slides.length;if(r>1){var o=e>0?e-1:r-1;t.push(o);var a=e
"+jetpackCarouselStrings[o]+"
"+a+""}}t.innerHTML=r,t.style.removeProperty("display")}(p.slides[e].attrs.imageMeta),function(e){if(!e)return!1;var r,o=[e.attrs.origWidth,e.attrs.origHeight],a=document.createElement("a");a.href=e.attrs.src.replace(/\?.+$/,""),r=null!==a.hostname.match(/^i[\d]{1}\.wp\.com$/i)?a.href:e.attrs.origFile.replace(/\?.+$/,"");var i=p.info.querySelector(".jp-carousel-download-text"),n=p.info.querySelector(".jp-carousel-image-download");i.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),n.setAttribute("href",r),n.style.removeProperty("display")}(i),1===Number(jetpackCarouselStrings.display_comments)&&(o=p.slides[e].attrs.commentsOpened,a=p.info.querySelector("#jp-carousel-comment-form-container"),1===parseInt(o,10)?r.fadeIn(a):r.fadeOut(a),_(n),r.hide(p.info.querySelector("#jp-carousel-comment-post-results")));var s=p.info.querySelector(".jp-carousel-pagination");if(s&&p.slides.length>5){var c=e+1;s.innerHTML=""+c+" / "+p.slides.length+""}jetpackCarouselStrings.stats&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(n)+"&rand="+Math.random()),g(n),window.location.hash=l="#jp-carousel-"+n}function k(){document.body.style.overflow=a,document.documentElement.style.overflow=i,I(),f(),r.emitEvent(p.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,n||0),e.destroy(),p.isOpen=!1,p.slides=[],p.currentSlide=void 0,p.gallery.innerHTML="",r.fadeOut(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterClose")})}function x(e){if("object"!=typeof e&&(e={}),void 0===e.origFile)return"";if(void 0===e.origWidth||void 0===e.maxWidth)return e.origFile;if(void 0===e.mediumFile||void 0===e.largeFile)return e.origFile;var t=document.createElement("a");t.href=e.largeFile;var r=/^i[0-2]\.wp\.com$/i.test(t.hostname),o=q(e.largeFile,e.origWidth,r),a=parseInt(o[0],10),i=parseInt(o[1],10);if(e.origMaxWidth=e.maxWidth,e.origMaxHeight=e.maxHeight,void 0!==window.devicePixelRatio&&window.devicePixelRatio>1&&(e.maxWidth=e.maxWidth*window.devicePixelRatio,e.maxHeight=e.maxHeight*window.devicePixelRatio),a>=e.maxWidth||i>=e.maxHeight)return e.largeFile;var n=q(e.mediumFile,e.origWidth,r),l=parseInt(n[0],10),s=parseInt(n[1],10);if(l>=e.maxWidth||s>=e.maxHeight)return e.mediumFile;if(r){if(-1===e.largeFile.lastIndexOf("?"))return e.largeFile;if(e.origWidth>e.maxWidth||e.origHeight>e.maxHeight){var c=function(e){var t;try{t=new URL(e)}catch(t){return e}var r=["quality","ssl","filter","brightness","contrast","colorize","smooth"],o=Array.from(t.searchParams.entries());return t.search="",o.forEach(([e,o])=>{r.includes(e)&&t.searchParams.append(e,o)}),t}(e.largeFile);return e.origMaxWidth=2*e.maxWidth,e.origMaxHeight=2*e.maxHeight,c.searchParams.set("fit",e.origMaxWidth+","+e.origMaxHeight),c.toString()}return e.largeFile}return e.origFile}function q(e,t,r){var o,a=r?e.replace(/.*=([\d]+%2C[\d]+).*$/,"$1"):e.replace(/.*-([\d]+x[\d]+)\..+$/,"$1");return"9999"===(o=a!==e?r?a.split("%2C"):a.split("x"):[t,0])[0]&&(o[0]="0"),"9999"===o[1]&&(o[1]="0"),o}function A(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}function E(e){return!e.match(" ")&&e.match("_")?"":e}function _(e,t){var a=void 0===t,i=p.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");if(i.classList.remove("jp-carousel-show"),clearInterval(o),e){(!t||t<1)&&(t=0);var n=p.info.querySelector(".jp-carousel-comments"),l=p.info.querySelector("#jp-carousel-comments-loading");r.show(l),a&&(r.hide(n),n.innerHTML="");var s=new XMLHttpRequest,c=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;s.open("GET",c),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var u=function(){r.fadeIn(n),r.fadeOut(l)};s.onload=function(){if(p.currentSlide&&p.currentSlide.attrs.attachmentId===e){var c,d=s.status>=200&&s.status<300;try{c=JSON.parse(s.responseText)}catch{}if(!d||!c||!Array.isArray(c))return u();a&&(n.innerHTML="");for(var m=0;m'+g.gravatar_markup+'
'+g.author_markup+'
'+g.date_gmt+"
"+g.content+"
",n.appendChild(h),clearInterval(o),o=setInterval(function(){p.container.scrollTop+150>window.innerHeight&&(_(e,t+10),clearInterval(o))},300)}c.length>0&&(r.show(n),i.innerText=c.length,i.classList.add("jp-carousel-show")),r.hide(l)}},s.onerror=u,s.send()}}function H(e){var t=e.el,r=e.attrs,o=t.querySelector("img");if(!o.hasAttribute("data-loaded")){var a=!!r.previewImage,i=r.thumbSize;!a||i&&t.offsetWidth>i.width?o.src=r.src:o.src=r.previewImage,o.setAttribute("itemprop","image"),o.setAttribute("data-loaded",1)}}function T(t){var r=t.el;e&&e.slides&&(r=e.slides[e.activeIndex]);var o=t.attrs.originalElement;o.complete&&0!==o.naturalHeight?C(t,r,o):o.onload=function(){C(t,r,o)}}function C(e,r,o){var a=t.getBackgroundImage(o);e.backgroundImage=a,r.style.backgroundImage="url("+a+")",r.style.backgroundSize="cover"}function I(){p.commentField&&(p.commentField.value="")}function M(e,o){p.slides=[];var a={width:window.innerWidth,height:window.innerHeight-64};0!==o&&null!==e[o].getAttribute("data-gallery-src")&&((new Image).src=e[o].getAttribute("data-gallery-src"));var i=!!r.closest(e[0],".tiled-gallery.type-rectangular");Array.prototype.forEach.call(e,function(e,o){var n=r.closest(e,"a"),l=e.getAttribute("data-orig-file")||e.getAttribute("src-orig"),s=e.getAttribute("data-attachment-id")||e.getAttribute("data-id")||"0",c=document.querySelector('img[data-attachment-id="'+s+'"] + figcaption');c=c?c.innerHTML:e.getAttribute("data-image-caption");var u={originalElement:e,attachmentId:s,commentsOpened:e.getAttribute("data-comments-opened")||"0",imageMeta:r.getJSONAttribute(e,"data-image-meta")||{},title:e.getAttribute("data-image-title")||"",desc:e.getAttribute("data-image-description")||"",mediumFile:e.getAttribute("data-medium-file")||"",largeFile:e.getAttribute("data-large-file")||"",origFile:l||"",thumbSize:{width:e.naturalWidth,height:e.naturalHeight},caption:c||"",permalink:n&&n.getAttribute("href"),src:l||e.getAttribute("src")||""},d=r.closest(e,".tiled-gallery-item"),m=d&&d.querySelector(".tiled-gallery-caption"),g=m&&m.innerHTML;g&&(u.caption=g);var h=function(e){var t=e.getAttribute("data-orig-size")||"";if(t){var r=t.split(",");return{width:parseInt(r[0],10),height:parseInt(r[1],10)}}return{width:e.getAttribute("data-original-width")||e.getAttribute("width")||void 0,height:e.getAttribute("data-original-height")||e.getAttribute("height")||void 0}}(e);if(u.origWidth=h.width||u.thumbSize.width,u.origHeight=h.height||u.thumbSize.height,"undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.generateImgSrc?u.src=wpcom.carousel.generateImgSrc(e,a):u.src=x({origFile:u.src,origWidth:u.origWidth,origHeight:u.origHeight,maxWidth:a.width,maxHeight:a.height,mediumFile:u.mediumFile,largeFile:u.largeFile}),e.setAttribute("data-gallery-src",u.src),"0"!==u.attachmentId){u.title=t.texturize(u.title),u.desc=t.texturize(u.desc),u.caption=t.texturize(u.caption);var f=new Image,v=document.createElement("div");v.classList.add("swiper-slide"),v.setAttribute("itemprop","associatedMedia"),v.setAttribute("itemscope",""),v.setAttribute("itemtype","https://schema.org/ImageObject");var y=document.createElement("div");y.classList.add("swiper-zoom-container"),p.gallery.appendChild(v),v.appendChild(y),y.appendChild(f),v.setAttribute("data-attachment-id",u.attachmentId),v.setAttribute("data-permalink",u.permalink),v.setAttribute("data-orig-file",u.origFile),i&&(u.previewImage=u.src);var w={el:v,attrs:u,index:o};p.slides.push(w)}})}function F(e,t){if(!window.JetpackSwiper){var o=document.querySelector("#jp-carousel-loading-overlay");r.show(o);var a=document.createElement("script");return a.id="jetpack-carousel-swiper-js",a.src=window.jetpackSwiperLibraryPath.url,a.async=!0,a.onload=function(){r.hide(o),O(e,t)},a.onerror=function(){r.hide(o)},void document.head.appendChild(a)}O(e,t)}function O(t,o){var l,s={imgSelector:".gallery-item [data-attachment-id], .tiled-gallery-item [data-attachment-id], img[data-attachment-id], img[data-id]",startIndex:0},c=r.getJSONAttribute(t,"data-carousel-extra");if(!c)return;const u=t.querySelectorAll(s.imgSelector);if(u.length&&(w(),!p.isOpen)){for(var d in p.isOpen=!0,a=getComputedStyle(document.body).overflow,document.body.style.overflow="hidden",i=getComputedStyle(document.documentElement).overflow,document.documentElement.style.overflow="hidden",n=window.scrollY||window.pageYOffset||0,p.container.setAttribute("data-carousel-extra",JSON.stringify(c)),m(["open","view_image"]),o||{})s[d]=o[d];-1===s.startIndex&&(s.startIndex=0),r.emitEvent(p.overlay,"jp_carousel.beforeOpen"),p.gallery.innerHTML="",p.overlay.style.opacity=1,p.overlay.style.display="block",M(u,s.startIndex),(e=new window.JetpackSwiper(".jp-carousel-swiper-container",{centeredSlides:!0,zoom:!0,loop:p.slides.length>1,enabled:p.slides.length>1,pagination:{el:".jp-swiper-pagination",clickable:!0},navigation:{nextEl:".jp-swiper-button-next",prevEl:".jp-swiper-button-prev"},initialSlide:s.startIndex,on:{init:function(){L(s.startIndex)}},preventClicks:!1,preventClicksPropagation:!1,preventInteractionOnTransition:!r.isTouch(),threshold:5})).on("slideChange",function(e){L(e.realIndex),p.overlay.classList.remove("jp-carousel-hide-controls")}),e.on("zoomChange",function(e,t){t>1&&p.overlay.classList.add("jp-carousel-hide-controls"),1===t&&p.overlay.classList.remove("jp-carousel-hide-controls")}),e.on("doubleTap",function(e){if(clearTimeout(l),1===e.zoom.scale)var t=setTimeout(function(){p.overlay.classList.remove("jp-carousel-hide-controls"),clearTimeout(t)},150)}),e.on("tap",function(){e.zoom.scale>1&&(l=setTimeout(function(){p.overlay.classList.toggle("jp-carousel-hide-controls")},150))}),r.fadeIn(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterOpen")})}}function W(e){if("click"!==e.type){if("keydown"===e.type){const t=document.activeElement.parentElement,r=t&&t.classList.contains("tiled-gallery__item");" "!==e.key&&"Enter"!==e.key||!r||R(e)}}else R(e)}function N(e){var t=e.parentElement,o=t.parentElement,a=null;return o&&o.classList.contains("wp-block-image")?a=t.getAttribute("href"):t&&t.classList.contains("wp-block-image")&&t.querySelector(":scope > a")&&(a=t.querySelector(":scope > a").getAttribute("href")),!(a&&a.split("?")[0]!==e.getAttribute("data-orig-file").split("?")[0]&&a!==e.getAttribute("data-permalink")||t.classList.contains("gallery-caption")||r.matches(t,"figcaption"))}function R(e){if(window.CSS&&window.CSS.supports&&window.CSS.supports("display","grid")){var t,o=e.target,a=r.closest(o,c);if(a){if(!(t=a)||!t.getAttribute("data-carousel-extra"))return;if(!N(o))return;document.documentElement.style.height="auto",e.preventDefault(),e.stopPropagation();var i=r.closest(o,d),n=Array.prototype.indexOf.call(a.querySelectorAll(d),i);F(a,{startIndex:n})}}}document.body.addEventListener("click",W),document.body.addEventListener("keydown",W),document.querySelectorAll(u+"img").forEach(function(e){N(e)&&y(e)}),1===Number(jetpackCarouselStrings.single_image_gallery)&&(b(),document.body.addEventListener("is.post-load",function(){b()})),window.addEventListener("hashchange",function(){var e=/jp-carousel-(\d+)/;if(window.location.hash&&e.test(window.location.hash)){if(window.location.hash!==l||!p.isOpen)if(window.location.hash&&p.gallery&&!p.isOpen&&history.back)history.back();else{l=window.location.hash;for(var t=window.location.hash.match(e),r=parseInt(t[1],10),o=document.querySelectorAll(c),a=0;a 1024 ) { if ( $this.scrollTop() > ( headerHeight + 100 ) ) { stickyHeader.addClass( 'sticked' ); } else { stickyHeader.removeClass( 'sticked' ); } } } ); } /*-----------------------------------------------------------------------------------*/ /* Home page properties pagination /*-----------------------------------------------------------------------------------*/ const $body = $( 'body' ); $body.on( 'click', '.rhea_pagination_wrapper a', function ( e ) { e.preventDefault(); var thisParent = $( this ).parents( '.rhea_ele_property_ajax_target' ); var id = $( thisParent ).attr( 'id' ); var thisLoader = $( thisParent ).find( '.rhea_svg_loader' ); var thisInner = $( thisParent ).find( '.home-properties-section-inner-target' ); var pageNav = $( thisParent ).find( '.rhea_pagination_wrapper a' ); var thisLink = $( this ); if ( ! ( thisLink ).hasClass( 'current' ) ) { var link = $( this ).attr( 'href' ); thisInner.fadeTo( 'slow', 0.5 ); thisLoader.slideDown( 'fast' ); // thisContent.fadeOut('fast', function(){ thisParent.load( link + ' #' + id + ' .home-properties-section-inner-target', function ( response, status, xhr ) { if ( status == 'success' ) { thisInner.fadeTo( 'fast', 1 ); pageNav.removeClass( 'current' ); thisLink.addClass( 'current' ); thisLoader.slideUp( 'fast' ); if ( typeof EREloadNewsSlider != 'undefined' && $.isFunction( EREloadNewsSlider ) ) { EREloadNewsSlider(); } if ( typeof setVideoHeightElementor != 'undefined' && $.isFunction( setVideoHeightElementor ) ) { setVideoHeightElementor(); } $( 'html, body' ).animate( { scrollTop : $( '#' + id ).offset().top - 32 }, 1000 ); } else { thisInner.fadeTo( 'fast', 1 ); thisLoader.slideUp( 'fast' ); } } ); } } ); $body.on( "click", ".rhea-ultra-properties-ajax-pagination a", function ( event ) { const $this = $( this ), currentPageNum = parseInt( $this.data( 'page' ) ), propertiesContainer = $this.closest( ".rhea-ultra-properties-container" ), propertiesInner = propertiesContainer.find( '.rhea-ultra-properties-inner-container' ), propertiesStatsWrapper = propertiesContainer.find( '.rhea-ultra-properties-top-bar-stats-wrapper' ), paginationContainer = propertiesContainer.find( ".rhea-ultra-properties-ajax-pagination" ), paginationItems = propertiesContainer.find( ".pagination a" ), loader = propertiesContainer.find( ".rhea_svg_loader" ); if ( $this.hasClass( "current" ) ) { return false; } loader.slideDown(); if ( typeof propertiesMapNewData !== "undefined" ) { $.ajax( { url : ajaxurl, type : 'post', data : { action : 'rhea_map_properties_data', paged : currentPageNum, properties_args : JSON.parse( propertiesMapNewData.rheaPropertiesArgs ) }, success : function ( response ) { if ( response.data ) { const rheaUpdateMapData = $.Event( 'rheaUpdateMapData', { mapProperties : JSON.stringify( response.data ) } ); $( document ).trigger( rheaUpdateMapData ); } } } ); } $.ajax( { url : $this.attr( 'href' ), method : 'GET', success : function ( response ) { let $response = $( response ); propertiesStatsWrapper.html( $response.find( ".rhea-ultra-properties-top-bar-stats-wrapper > .rhea-ultra-properties-stats" ) ); paginationContainer.html( $response.find( ".rhea-ultra-properties-ajax-pagination > .pagination" ) ); propertiesInner.html( $response.find( ".rhea-ultra-properties-inner-container > div" ) ); paginationItems.removeClass( 'current' ); $this.addClass( 'current' ); loader.slideUp(); // Scroll to the top of the properties $( 'html, body' ).animate( { scrollTop : propertiesContainer.find( '.rhea-ultra-properties-inner-container' ).offset().top - 100 }, 1000 ); } } ); event.preventDefault(); } ); // Add class if div is empty let rheaStatusBox = $( '.rhea-ultra-property-card-three-wrapper .rhea-ultra-status-box' ); if ( 0 < rheaStatusBox.length ) { rheaStatusBox.each( function () { if ( ! $.trim( $( this ).html() ).length ) { $( this ).addClass( 'rhea-empty-wrapper' ); } } ); } // show lightbox info on button click $( 'body' ).on( 'click', '.rhea-ultra-property-card-five-popup', function () { let thisPopUp = $( this ).data( 'src' ); let galleryItems = $( thisPopUp ).find( '.rhea-gallery-item' ); galleryItems.each( function () { let thisUlr = $( this ).data( 'bg-image' ); $( this ).css( 'background-image', 'url("' + thisUlr + '")' ); } ); } ); rheaEqualWidthButtons( '.rhea-equal-width-btn-1', '.rhea-equal-width-btn-2' ); } ); /*-----------------------------------------------------------------------------------*/ /* Equal Width Buttons /*-----------------------------------------------------------------------------------*/ window.rheaEqualWidthButtons = function ( btn1, btn2 ) { const rheaW1 = $( btn1 ).innerWidth(); const rheaW2 = $( btn2 ).innerWidth(); if ( rheaW1 > rheaW2 ) { $( btn2 ).css( 'width', rheaW1 + "px" ); } else { $( btn1 ).css( 'width', rheaW2 + "px" ); } } /*-----------------------------------------------------------------------------------*/ /* Nav Menu Responsive Layout Management /*-----------------------------------------------------------------------------------*/ window.rheaMenuDisplayScreen = function ( size, widgetID ) { const lgMenu = $( ".rhea-lg-menu-" + widgetID ); const responsiveMenu = $( ".rhea-responsive-men-" + widgetID ); if ( innerWidth < size ) { lgMenu.hide(); responsiveMenu.show(); } else { lgMenu.show(); responsiveMenu.hide(); } } /*-----------------------------------------------------------------------------------*/ /* SelectPicker Drop Down Initiation /*-----------------------------------------------------------------------------------*/ window.rheaSelectPicker = function ( id ) { if ( $().selectpicker ) { $( id ).selectpicker( { iconBase : 'fas', dropupAuto : 'true', width : "100%", tickIcon : 'fa-check', selectAllText : '', deselectAllText : '' } ); } }; /*-----------------------------------------------------------------------------------*/ /* Search Form Widget /*-----------------------------------------------------------------------------------*/ window.rheaSearchFields = function ( id, fieldCount, topFields, collapsedFields ) { var divList = $( id ).find( '.rhea_prop_search__option' ); divList.sort( function ( a, b ) { return $( a ).data( "key-position" ) - $( b ).data( "key-position" ) } ); $( topFields ).html( divList ).promise().done( function () { var getDataTopBar = fieldCount; var advanceSearch = $( topFields ).find( '.rhea_prop_search__option' ); var prePendTo = $( collapsedFields ); var i = 0; var j = 0; advanceSearch.each( function () { if ( i < getDataTopBar + 1 ) { if ( $( this ).hasClass( 'hide-fields' ) ) { j = 2; } if ( $( this ).hasClass( 'rvr-hide-fields' ) ) { j++; } } i++; } ); var advanceElements = getDataTopBar + j + 1; if ( advanceElements > 0 ) { var advanceFieldsSmart = $( topFields ) .find( '.rhea_prop_search__option:nth-of-type(n+' + advanceElements + ')' ); advanceFieldsSmart.detach().prependTo( prePendTo ); } } ); }; window.rheaOpenSearchPopup = function ( trigger, popup ) { $( trigger ).on( 'click', function () { $( popup ).addClass( 'active' ); $( popup ).fadeIn( 'fast' ); } ); $( '.rhea-popup-close' ).on( 'click', function () { $( popup ).removeClass( 'active' ); $( popup ).fadeOut( 'fast' ); $( trigger ).removeClass( 'rhea_advance_open' ); } ) } window.rheaPropertySlider = function ( id, min, max, pos = 'before', separator = ',', currency = '$', min_searched = '', max_searched = '', step = 100 ) { function thousandSeparator( n ) { if ( typeof n === 'number' ) { n += ''; var x = n.split( '.' ); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test( x1 ) ) { x1 = x1.replace( rgx, '$1' + separator + '$2' ); } return x1 + x2; } else { return n; } } var getPosition = pos; var PosBefore = ''; var PosAfter = ''; if ( getPosition === 'before' ) { PosBefore = currency; } else { PosAfter = currency; } var minVal = min; var maxVal = max; if ( min_searched !== '' ) { minVal = min_searched } if ( max_searched !== '' ) { maxVal = max_searched } $( id ).slider( { range : true, min : min, max : max, step : step, values : [minVal, maxVal], slide : function ( event, ui ) { // Set interval difference between min and max price slider values if ( ui.values[0] >= ui.values[1] - Math.round( ui.values[1] / 10 ) ) { return false; } for ( var i = 0; i < ui.values.length; ++i ) { $( "input.rhea_slider_value[data-index=" + i + "]" ).val( ui.values[i] ); $( "span.rhea_price_display[data-index=" + i + "]" ) .text( PosBefore + thousandSeparator( ui.values[i] ) + PosAfter ); } } } ); }; window.rheaSearchAdvanceState = function ( buttonID, wrapperID ) { $( buttonID ).on( 'click', function () { $( buttonID ).toggleClass( 'rhea_advance_open' ); if ( $( buttonID ).hasClass( 'rhea_advance_open' ) ) { $( wrapperID ).slideDown( 'normal' ); } else { $( wrapperID ).slideUp( 'normal' ); } } ); }; window.rheaFeaturesState = function ( buttonID, wrapperID ) { $( buttonID ).on( 'click', function () { $( buttonID ).toggleClass( 'rhea_features_open' ); if ( $( buttonID ).hasClass( 'rhea_features_open' ) ) { $( wrapperID ).slideDown( 'normal' ); } else { $( wrapperID ).slideUp( 'normal' ); } } ); }; /*-----------------------------------------------------------------------------------*/ /* Search Form price change on status change /*-----------------------------------------------------------------------------------*/ window.rheaSearchStatusChange = function ( priceOther, PriceRent, statusID, rent_status = 'for-rent' ) { if ( '' !== rent_status ) { var rhea_property_status_changed = function ( new_status ) { var price_for_others = $( priceOther ); var price_for_rent = $( PriceRent ); if ( price_for_others.length > 0 && price_for_rent.length > 0 ) { if ( new_status === rent_status ) { price_for_others.addClass( 'hide-fields' ).find( 'select' ).prop( 'disabled', true ); price_for_rent.removeClass( 'hide-fields' ).find( 'select' ).prop( 'disabled', false ); } else { price_for_rent.addClass( 'hide-fields' ).find( 'select' ).prop( 'disabled', true ); price_for_others.removeClass( 'hide-fields' ).find( 'select' ).prop( 'disabled', false ); } } }; $( statusID ).change( function ( e ) { var selected_status = $( this ).val(); rhea_property_status_changed( selected_status ); $( '.rhea_multi_select_picker' ).selectpicker( 'refresh' ); } ); /* On page load ( as on search page ) */ var selected_status = $( statusID ).val(); if ( selected_status === rent_status ) { rhea_property_status_changed( selected_status ); } } }; window.minMaxPriceValidation = function ( minID, maxID ) { /** * Max and Min Price * Shows red outline if min price is bigger than max price */ /* for normal prices */ $( minID ).add( maxID ).on( 'change', function () { var min_text_val = $( minID ).val(); var min_int_val = ( isNaN( min_text_val ) ) ? 0 : parseInt( min_text_val ); var max_text_val = $( maxID ).val(); var max_int_val = ( isNaN( max_text_val ) ) ? 0 : parseInt( max_text_val ); if ( ( min_int_val >= max_int_val ) && ( min_int_val != 0 ) && ( max_int_val != 0 ) ) { $( minID ).add( maxID ).siblings( '.dropdown-toggle' ).addClass( 'rhea-error' ); } else { $( minID ).add( maxID ).siblings( '.dropdown-toggle' ).removeClass( 'rhea-error' ); } } ); }; window.minMaxRentPriceValidation = function ( minID, maxID ) { /* for rent prices */ $( minID ).add( maxID ).on( 'change', function () { var min_text_val = $( minID ).val(); var min_int_val = ( isNaN( min_text_val ) ) ? 0 : parseInt( min_text_val ); var max_text_val = $( maxID ).val(); var max_int_val = ( isNaN( max_text_val ) ) ? 0 : parseInt( max_text_val ); if ( ( min_int_val >= max_int_val ) && ( min_int_val != 0 ) && ( max_int_val != 0 ) ) { $( minID ).add( maxID ).siblings( '.dropdown-toggle' ).addClass( 'rhea-error' ); } else { $( minID ).add( maxID ).siblings( '.dropdown-toggle' ).removeClass( 'rhea-error' ); } } ); }; window.minMaxAreaValidation = function ( minID, maxID ) { /** * Max and Min Area * To show red outline if min is bigger than max */ $( minID ).add( maxID ).on( 'change', function ( obj, e ) { var min_text_val = $( minID ).val(); var min_int_val = ( isNaN( min_text_val ) ) ? 0 : parseInt( min_text_val ); var max_text_val = $( maxID ).val(); var max_int_val = ( isNaN( max_text_val ) ) ? 0 : parseInt( max_text_val ); if ( ( min_int_val >= max_int_val ) && ( min_int_val != 0 ) && ( max_int_val != 0 ) ) { $( minID ).add( maxID ).addClass( 'rhea-error' ); } else { $( minID ).add( maxID ).removeClass( 'rhea-error' ); } } ); }; /** * MapBox map widget map generation * * @since 0.9.10 * * */ window.rheaLoadMapBoxMap = function ( id, settingObj ) { let ThisMapID = id, mapBoxContainer = document.getElementById( id ); mapBoxContainer.className = mapBoxContainer.className + ' mapbox-dl-map-wrap rhea-mapbox-wrap'; if ( typeof settingObj !== "undefined" ) { if ( 0 < settingObj.properties.length && typeof settingObj.settings.api_key !== 'undefined' ) { const eleMapBoxAPI = settingObj.settings.api_key, mapBoxPropertiesData = settingObj.properties, widgetSettings = settingObj.settings, mapBoxStyle = widgetSettings.style, mapBoxMarkerType = 'pin'; //widgetSettings.marker_type; // TODO find out the proper way to implement it let tileLayer = L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution : '© OpenStreetMap' } ); // get map bounds let mapBounds = []; for ( let i = 0; i < mapBoxPropertiesData.length; i++ ) { if ( mapBoxPropertiesData[i].lat && mapBoxPropertiesData[i].lng ) { mapBounds.push( [mapBoxPropertiesData[i].lat, mapBoxPropertiesData[i].lng] ); } } // Basic map let mapBoxCenter = L.latLng( 27.664827, -81.515755 ); // given coordinates not going to matter 99.9% of the time but still added just in case. if ( 1 === mapBounds.length ) { mapBoxCenter = L.latLng( mapBounds[0] ); // this is also not going to effect 99% of the time but just in case of one property. } L.mapbox.accessToken = eleMapBoxAPI; const mapBoxProperties = L.mapbox.map( mapBoxContainer ) .setView( mapBoxCenter, 12 ) .addLayer( L.mapbox.styleLayer( mapBoxStyle ) ); if ( 1 < mapBounds.length ) { mapBoxProperties.fitBounds( mapBounds ); // fit bounds should work only for more than one properties } let markers = new L.MarkerClusterGroup(); for ( let i = 0; i < mapBoxPropertiesData.length; i++ ) { if ( mapBoxPropertiesData[i].lat && mapBoxPropertiesData[i].lng ) { let propertyMapData = mapBoxPropertiesData[i], markerLatLng = L.latLng( propertyMapData.lat, propertyMapData.lng ), propertyMarker, markerOptions = { id : propertyMapData.id, riseOnHover : true }; // Marker icon if ( propertyMapData.title ) { markerOptions.title = propertyMapData.title; } // Map marker. if ( 'pin' === mapBoxMarkerType ) { let iconOptions = { iconUrl : propertyMapData.icon, iconSize : [42, 57], iconAnchor : [20, 57], popupAnchor : [1, -54] }; if ( propertyMapData.retinaIcon ) { iconOptions.iconRetinaUrl = propertyMapData.retinaIcon; } markerOptions.icon = L.icon( iconOptions ); propertyMarker = L.marker( markerLatLng, markerOptions ); } else { propertyMarker = new L.CircleMarker( markerLatLng, { fillColor : '#1cb2ff', //widgetSettings.marker_color, color : '#1cb2ff', //widgetSettings.marker_color, weight : 2, fillOpacity : 0.6, opacity : 0.6, radius : 25 } ).addTo( mapBoxProperties ); } // Marker popup let popupContentWrapper = document.createElement( "div" ); popupContentWrapper.className = 'mapboxgl-popup-content'; let popupContent = ""; if ( propertyMapData.thumb ) { popupContent += '' + propertyMapData.title + ''; } if ( propertyMapData.title ) { popupContent += '
' + propertyMapData.title + '
'; } if ( propertyMapData.price ) { popupContent += '

' + propertyMapData.price + '

'; } popupContentWrapper.innerHTML = popupContent; propertyMarker.popupContents = popupContentWrapper; propertyMarker.id = propertyMapData.id; propertyMarker.className = 'mapboxgl-wrapper'; propertyMarker.bindPopup( popupContentWrapper ); markers.addLayer( propertyMarker ); } } mapBoxProperties.addLayer( markers ); mapBoxProperties.scrollWheelZoom.disable(); /* * Panning the marker to center of the visible map on "popupopen" event */ mapBoxProperties.on( 'popupopen', function ( e ) { // find the pixel location on the map where the popup anchor is var px = mapBoxProperties.project( e.target._popup._latlng ); // find the height of the popup container, divide by 2, subtract from the Y axis of marker location px.y -= e.target._popup._container.clientHeight / 2; // pan to new center mapBoxProperties.panTo( mapBoxProperties.unproject( px ), { animate : true } ); } ); /** * Function to find the marker in a cluster * @param {int} marker * @param {int} cluster * @returns */ function is_marker_in_cluster( marker, cluster ) { let length = cluster.length; for ( let i = 0; i < length; i++ ) { if ( cluster[i].id == marker ) { return true; } } return false; } /** * Open Popup function * @param {int} markerid */ function mapbox_open_popup( markerid ) { mapBoxProperties.eachLayer( function ( layer ) { // Checking if this layer is a cluster if ( typeof layer._childCount !== "undefined" ) { // Getting all markers in this cluster let markersincluster = layer.getAllChildMarkers(); if ( is_marker_in_cluster( markerid, markersincluster ) ) { layer.spiderfy(); markersincluster.forEach( function ( property_marker ) { if ( property_marker.id === parseInt( markerid ) ) { property_marker.openPopup(); } } ); } } else { if ( layer.id === parseInt( markerid ) ) { layer.openPopup(); } } } ); } /** * Close Popup function * @param {int} markerid */ function mapbox_close_popup( markerid ) { mapBoxProperties.eachLayer( function ( layer ) { // Checking if this layer is a cluster if ( typeof layer._childCount !== "undefined" ) { // Getting all markers in this cluster var markersincluster = layer.getAllChildMarkers(); if ( is_marker_in_cluster( markerid, markersincluster ) ) { layer.unspiderfy(); markersincluster.forEach( function ( property_marker ) { if ( property_marker.id == parseInt( markerid ) ) { layer.closePopup(); } } ); } } else { if ( layer.id == parseInt( markerid ) ) { layer.closePopup(); mapBoxProperties.closePopup(); } } } ); } let realhomesInfoboxPopupTrigger = function () { $( '.rh_popup_info_map' ).each( function ( i ) { // Getting the Property ID for mouse events let property_ID = $( this ).attr( 'data-rh-id' ).replace( /[^\d.]/g, '' ); $( this ) .on( 'mouseenter', function () { mapbox_open_popup( property_ID ); } ) .on( 'mouseleave', function () { mapbox_close_popup( property_ID ); } ); } ); return false; }; let RHisMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test( navigator.userAgent ) ? true : false; if ( ! RHisMobile ) { realhomesInfoboxPopupTrigger(); } } else { // Fallback Map var fallbackLayer = L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution : '© OpenStreetMap contributors' } ); // todo: provide an option for fallback map coordinates var fallbackMapOptions = { center : [27.664827, -81.515755], zoom : 12 }; var fallbackMap = L.map( ThisMapID, fallbackMapOptions ); fallbackMap.addLayer( fallbackLayer ); } } }; window.rheaLocationsHandler = function ( hierarchicalLocations, locationPlaceholders, selectBoxesIDs, slugsInQueryParams, selectBoxesCount, anyValue, multiSelect ) { /** * Following function automatically runs to initialize locations boxes */ ( function () { /* prepare select boxes */ prepareSelectBoxes(); let parentLocations = []; for ( let selectIndex = 0; selectIndex < selectBoxesCount; selectIndex++ ) { const currentSelect = $( '#' + selectBoxesIDs[selectIndex] ); /* loop's current select box */ const currentIsLast = ( selectBoxesCount === ( selectIndex + 1 ) ); /* check if current select box is last */ if ( selectIndex === 0 ) { /* First iteration */ parentLocations = addParentLocations( currentSelect, currentIsLast ); } else { /* later iterations */ /* If parents locations array is not empty then there could be children to add in current select box */ if ( parentLocations.length > 0 ) { let currentLocations = []; const previousSelect = $( '#' + selectBoxesIDs[selectIndex - 1] ); /* loop through all if value is "any" */ if ( previousSelect.val() === anyValue ) { for ( let i = 0; i < parentLocations.length; i++ ) { let tempLocations = addChildrenLocations( currentSelect, parentLocations[i].children, '', currentIsLast ); if ( tempLocations.length > 0 ) { currentLocations = $.merge( currentLocations, tempLocations ); } } } else { /* Otherwise add only children of previous selected location, It there are any. */ let previousLocation = searchLocation( previousSelect.val(), hierarchicalLocations ); if ( previousLocation && previousLocation.children.length > 0 ) { currentLocations = addChildrenLocations( currentSelect, previousLocation.children, '', currentIsLast ); } } /* hook up updateChildSelect function with previous select change event */ previousSelect.change( updateChildSelect ); /* currentLocations variable is passed to parentLocations for code below and for next iteration */ parentLocations = currentLocations; } } /* If parentLocations is empty */ if ( parentLocations.length === 0 ) { /* disable current select and children selects if any */ disableSelect( currentSelect ); /* No need for further iterations */ break; } else { /* Select the right option within current select based on query parameters */ selectParamOption( currentSelect ); } } /* end of loop */ } )(); /* Run the function immediately after declaration */ /** * Adds top level locations to given select box, If addAllChildren is true then it adds all children locations as well * @param targetSelect * @param addAllChildren * @returns {*[]} */ function addParentLocations( targetSelect, addAllChildren ) { let addedLocations = []; let insertionCounter = 0; /* loop through top level locations */ hierarchicalLocations.forEach( function ( currentLocation, index, locationsArray ) { targetSelect.append( '' ); addedLocations[insertionCounter++] = currentLocation; if ( addAllChildren && currentLocation.children.length ) { addChildrenLocations( targetSelect, currentLocation.children, '- ', addAllChildren ); } } ); return addedLocations; } /** * Adds top level locations form given childrenLocations array to targetSelect box, If addAllChildren is true then it adds all children locations as well * @param targetSelect * @param childrenLocations * @param prefix * @param addAllChildren * @returns {*[]} */ function addChildrenLocations( targetSelect, childrenLocations, prefix, addAllChildren ) { let addedChildrenLocations = []; let insertionCounter = 0; /* loop through all children locations */ childrenLocations.forEach( function ( currentLocation, index, locationsArray ) { targetSelect.append( '' ); addedChildrenLocations[insertionCounter++] = currentLocation; /* If a current location has children then add those as well */ if ( addAllChildren && currentLocation.children.length ) { let tempLocations = addChildrenLocations( targetSelect, currentLocation.children, prefix + '- ', addAllChildren ); if ( tempLocations.length > 0 ) { /* merge newly added children locations with existing children locations array */ addedChildrenLocations = $.merge( addedChildrenLocations, tempLocations ); } } } ); return addedChildrenLocations; } /** * Search a location from given locations array for given slug * @param slug * @param locations * @returns {boolean} location OR false if no location is found */ function searchLocation( slug, locations ) { let targetLocation = false; for ( let index = 0; index < locations.length; index++ ) { let currentLocation = locations[index]; if ( currentLocation.slug === slug ) { targetLocation = currentLocation; break; } if ( currentLocation.children.length > 0 ) { targetLocation = searchLocation( slug, currentLocation.children ); if ( targetLocation ) { break; } } } return targetLocation; } /** * Update child select box based on change in selected value of parent select box * @param event */ function updateChildSelect( event ) { let selectedSlug = $( this ).val(); let currentSelectIndex = selectBoxesIDs.indexOf( $( this ).attr( 'id' ) ); /* When "any" is selected, Also no need to run this on last select box */ if ( selectedSlug === anyValue && ( currentSelectIndex > -1 ) && ( currentSelectIndex < ( selectBoxesCount - 1 ) ) ) { for ( let s = currentSelectIndex; s < ( selectBoxesCount - 1 ); s++ ) { /* check if child select is Last */ let childSelectIsLast = ( selectBoxesCount === ( s + 2 ) ); /* find child select box, empty it and add any options to it */ let childSelect = $( '#' + selectBoxesIDs[s + 1] ); childSelect.empty(); addAnyOption( childSelect ); /* loop through select options to find and add children locations into next select */ let anyChildLocations = []; $( '#' + selectBoxesIDs[s] + ' > option' ).each( function () { if ( this.value !== anyValue ) { let relatedLocation = searchLocation( this.value, hierarchicalLocations ); if ( relatedLocation && relatedLocation.children.length > 0 ) { let tempChildrenLocations = addChildrenLocations( childSelect, relatedLocation.children, '', childSelectIsLast ); if ( tempChildrenLocations.length > 0 ) { anyChildLocations = $.merge( anyChildLocations, tempChildrenLocations ); } } } } ); /* enable next select if options are added otherwise disable it */ if ( anyChildLocations.length > 0 ) { enableSelect( childSelect ); } else { disableSelect( childSelect ); break; } } /* end of for loop */ } else { /* In case of valid location selection */ let selectedParentLocation = searchLocation( selectedSlug, hierarchicalLocations ); if ( selectedParentLocation ) { let childLocations = []; for ( let childSelectIndex = currentSelectIndex + 1; childSelectIndex < selectBoxesCount; childSelectIndex++ ) { /* check if child select is Last */ let childSelectIsLast = ( selectBoxesCount === ( childSelectIndex + 1 ) ); /* find and empty child select box */ let childSelect = $( '#' + selectBoxesIDs[childSelectIndex] ); childSelect.empty(); /* First iteration */ if ( childLocations.length === 0 ) { if ( selectedParentLocation.children.length > 0 ) { addAnyOption( childSelect ); let tempLocations = addChildrenLocations( childSelect, selectedParentLocation.children, '', childSelectIsLast ); if ( tempLocations.length > 0 ) { childLocations = tempLocations; } } } else if ( childLocations.length > 0 ) { /* 2nd and later iterations */ let currentLocations = []; for ( let i = 0; i < childLocations.length; i++ ) { let tempChildLocation = childLocations[i]; if ( tempChildLocation.children.length > 0 ) { addAnyOption( childSelect ); let tempLocations = addChildrenLocations( childSelect, tempChildLocation.children, '', childSelectIsLast ); if ( tempLocations.length > 0 ) { currentLocations = $.merge( currentLocations, tempLocations ); } } } /* If there are current locations OR none, assign current locations array to child locations*/ childLocations = currentLocations; } if ( childLocations.length > 0 ) { enableSelect( childSelect ); } else { disableSelect( childSelect ); break; } } /* end of for loop */ } } } /** * Adds Any value and select index based place holder text to given select box. * @param targetSelect */ function addAnyOption( targetSelect ) { if ( targetSelect.has( 'option' ).length > 0 ) { return; } /* current select box index */ let targetSelectIndex = selectBoxesIDs.indexOf( targetSelect.attr( 'id' ) ); /* For location fields in search form */ if ( targetSelect.parents( '.rhea_prop_search__select' ) .hasClass( 'rhea_location_prop_search_' + targetSelectIndex ) ) { targetSelect.append( '' ); } } /** * Disable a select box and next select boxes if exists * @param targetSelect */ function disableSelect( targetSelect ) { let targetSelectID = targetSelect.attr( 'id' ); targetSelect.empty(); targetSelect.closest( '.option-bar' ).addClass( 'disabled' ); if ( targetSelect.is( ':enabled' ) ) { targetSelect.prop( 'disabled', true ); targetSelect.parents( '.rhea_prop_search__select' ).addClass( 'rhea_disable_parent' ); } let targetSelectIndex = selectBoxesIDs.indexOf( targetSelectID ); // target select box index let nextSelectBoxesCount = selectBoxesCount - ( targetSelectIndex + 1 ); /* Disable next select box as well */ if ( nextSelectBoxesCount > 0 ) { let nextSelect = $( '#' + selectBoxesIDs[targetSelectIndex + 1] ); disableSelect( nextSelect ); } } /** * Enable a select box * @param targetSelect */ function enableSelect( targetSelect ) { let targetSelectID = targetSelect.attr( 'id' ); if ( targetSelect.is( ':disabled' ) ) { targetSelect.prop( 'disabled', false ); } // remove class from parents targetSelect.parents( '.rhea_prop_search__select' ).map( function () { if ( $( this ).hasClass( 'rhea_disable_parent' ) ) { $( this ).removeClass( 'rhea_disable_parent' ); } } ); /* Remove .option-bar's disabled class */ let optionWrapper = targetSelect.closest( '.option-bar' ); if ( optionWrapper.hasClass( 'disabled' ) ) { optionWrapper.removeClass( 'disabled' ); } } /** * Mark the current value in query params as selected in related select box * @param currentSelect */ function selectParamOption( currentSelect ) { if ( Object.keys( slugsInQueryParams ).length > 0 ) { let selectName = currentSelect.attr( 'name' ); if ( typeof selectName !== "undefined" ) { selectName = selectName.replace( /[\[\]]+/g, '' ); /* remove box brackets as for multi select location brackets comes with name */ } if ( typeof slugsInQueryParams[selectName] !== 'undefined' ) { let tempValue = slugsInQueryParams[selectName]; if ( Array.isArray( tempValue ) ) { for ( let i = 0; i < tempValue.length; i++ ) { currentSelect.find( 'option[value="' + tempValue[i] + '"]' ).prop( 'selected', true ); } } else { currentSelect.find( 'option[value="' + tempValue + '"]' ).prop( 'selected', true ); } } } } /** * Append options with Any value or None value depending on conditions */ function prepareSelectBoxes() { /* Loop through select boxes and prepare them with basic option */ for ( let selectIndex = 0; selectIndex < selectBoxesCount; selectIndex++ ) { let currentSelectId = selectBoxesIDs[selectIndex]; let currentSelect = $( '#' + currentSelectId ); /* For location fields in search form */ if ( ( multiSelect !== 'multiple' ) && ( currentSelect.has( 'option' ).length === 0 ) && ( currentSelect.parents( '.rhea_prop_search__select' ) .hasClass( 'rhea_location_prop_search_' + selectIndex ) ) ) { addAnyOption( currentSelect ); } } } }; var rheaLocationSuccessList = function ( data, thisParent, refreshList = false ) { if ( true === refreshList ) { thisParent.find( 'option' ).not( ':selected, .none' ).remove().end(); } var getSelected = $( thisParent ).val(); jQuery.each( data, function ( index, text ) { if ( getSelected ) { if ( getSelected.indexOf( text[0] ) < 0 ) { thisParent.append( $( '' ) ); } } else { thisParent.append( $( '' ) ); } } ); thisParent.selectpicker( 'refresh' ); $( parent ).find( 'ul.dropdown-menu li:first-of-type a' ).focus(); $( parent ).find( 'input' ).focus(); }; var rheaLoaderFadeIn = function ( parent ) { $( parent ).find( '.rhea-location-ajax-loader' ).fadeIn( 'fast' ); }; var rheaLoaderFadeOut = function ( parent ) { $( parent ).find( '.rhea-location-ajax-loader' ).fadeOut( 'fast' ); }; var rheaTriggerAjaxOnLoad = function ( parent, thisParent, ajaxurl, hideEmpty, SortAlpha, fieldValue = '' ) { $.ajax( { url : ajaxurl, dataType : 'json', delay : 250, // delay in ms while typing when to perform a AJAX search data : { action : 'rhea_get_location_options', // AJAX action for admin-ajax.php query : fieldValue, hideemptyfields : hideEmpty, sortplpha : SortAlpha }, beforeSend : rheaLoaderFadeIn( parent ), success : function ( data ) { rheaLoaderFadeOut( parent ); rheaLocationSuccessList( data, thisParent, true ); } } ); }; var rheaTriggerAjaxOnScroll = function ( parent, thisParent, farmControl, ajaxurl, hideEmpty, SortAlpha, fieldValue = '' ) { var paged = 2; farmControl.on( 'keyup', function ( e ) { paged = 2; fieldValue = $( this ).val(); } ); var targetInner = $( parent ).find( 'div.inner' ); targetInner.on( 'scroll', function () { var thisInner = $( this ); var thisInnerHeight = thisInner.innerHeight(); var getScrollIndex = thisInner.scrollTop() + thisInnerHeight; if ( getScrollIndex >= $( this )[0].scrollHeight ) { $.ajax( { url : ajaxurl, dataType : 'json', delay : 250, // delay in ms while typing when to perform a AJAX search data : { action : 'rhea_get_location_options', // AJAX action for admin-ajax.php query : fieldValue, page : paged, hideemptyfields : hideEmpty, sortplpha : SortAlpha }, // beforeSend: loaderFadeIn(), beforeSend : rheaLoaderFadeIn( parent ), success : function ( data ) { rheaLoaderFadeOut( parent ); paged++; rheaLocationSuccessList( data, thisParent, false ); if ( ! $.trim( data ) ) { $( parent ).find( '.rhea-location-ajax-loader' ).fadeTo( "fast", 0 ); } } } ); } } ); }; window.rheaAjaxSelect = function ( parent, id, ajaxurl, hideEmpty, SortAlpha ) { var farmControl = $( parent ).find( '.form-control' ); var thisParent = $( id ); rheaTriggerAjaxOnScroll( parent, thisParent, farmControl, ajaxurl, hideEmpty, SortAlpha ); rheaTriggerAjaxOnLoad( parent, thisParent, ajaxurl, hideEmpty, SortAlpha ); farmControl.on( 'keyup', function ( e ) { var fieldValue = $( this ).val(); fieldValue = fieldValue.trim(); var wordcounts = jQuery.trim( fieldValue ).length; $( parent ).find( '.rhea-location-ajax-loader' ).fadeTo( "fast", 1 ); if ( wordcounts > 0 ) { $.ajax( { url : ajaxurl, dataType : 'json', delay : 250, // delay in ms while typing when to perform a AJAX search data : { action : 'rhea_get_location_options', // AJAX action for admin-ajax.php query : fieldValue, hideemptyfields : hideEmpty, sortplpha : SortAlpha }, beforeSend : rheaLoaderFadeIn( parent ), success : function ( data ) { rheaLoaderFadeOut( parent ); thisParent.find( 'option' ).not( ':selected' ).remove().end(); // var options = []; if ( fieldValue && data ) { rheaLocationSuccessList( data, thisParent ); } else { thisParent.find( 'option' ).not( ':selected' ).remove().end(); thisParent.selectpicker( 'refresh' ); $( parent ).find( 'ul.dropdown-menu li:first-of-type a' ).focus(); $( parent ).find( 'input' ).focus(); } } } ); } else { rheaTriggerAjaxOnLoad( parent, thisParent, ajaxurl, hideEmpty, SortAlpha ) } } ); }; window.searchFormAjaxKeywords = function ( id, url ) { var inputField = $( id ).find( 'input' ); inputField.keyup( function () { var charCount = inputField.val().length; if ( charCount > 1 ) { $( id ).find( '.rhea-properties-data-list' ).slideDown(); $( id ).find( '.rhea_sfoi_ajax_loader' ).show(); $( id ).find( '.rhea-field-icon-wrapper' ).addClass( 'rhea-search-fade' ) $.ajax( { url : url, type : 'POST', data : { action : 'rh_sfoi_data_fetch', keyword : $( this ).val() }, success : function ( data ) { $( id ).find( '.rhea-properties-data-list' ).html( data ); $( id ).find( '.rhea_sfoi_ajax_loader' ).hide(); $( id ).find( '.rhea-field-icon-wrapper' ).removeClass( 'rhea-search-fade' ) } } ); } else { $( id ).find( '.rhea-properties-data-list' ).slideUp(); } } ); } window.rheaTestimonialsTwoCarousel = function ( id, itemsFluid = 4, items = 3, itemsTab = 2, itemsMob = 1, gap = 30, dots = true, rtl = false ) { if ( $().owlCarousel ) { $( id ).owlCarousel( { loop : false, dots : dots, nav : false, margin : gap, rtl : rtl, responsive : { 0 : { items : itemsMob }, 767 : { items : itemsTab }, 1024 : { items : items }, 1440 : { items : itemsFluid } } } ); } }; window.rheaTestimonialsThreeCarousel = function ( slide1, slide2, navSelectors, animationspeed = '600', slideshowspeed = '5000', slideShow1 = true, direction1 = 'horizontal', animation1 = 'fade', reverse1 = false, animation2 = 'fade', reverse2 = false ) { if ( $().flexslider ) { $( slide1 ).flexslider( { controlNav : false, directionNav : false, animationLoop : true, slideshow : slideShow1, direction : direction1, animation : animation1, reverse : reverse1, animationSpeed : animationspeed, slideshowSpeed : slideshowspeed } ); $( slide2 ).flexslider( { controlNav : false, animation : animation2, animationLoop : true, slideshow : slideShow1, reverse : reverse2, customDirectionNav : $( navSelectors ), sync : $( slide1 ), animationSpeed : animationspeed, slideshowSpeed : slideshowspeed } ); } }; window.rheaTestimonialsFourCarousel = function ( slider, navSelectors, animation = 'fade', animationSpeed = '600', reverse = false, slideshow = false, slideshowSpeed = '5000' ) { if ( $().flexslider ) { $( slider ).flexslider( { controlNav : false, directionNav : false, animation : animation, animationSpeed : animationSpeed, reverse : reverse, slideshow : slideshow, slideshowSpeed : slideshowSpeed } ); $( navSelectors ).on( 'click', function ( event ) { $( slider ).flexslider( $( this ).attr( 'href' ) ); event.preventDefault(); } ); } }; window.EREloadNewsSlider = function () { if ( $().flexslider ) { $( '.rhea-listing-news-slider' ).each( function () { $( this ).flexslider( { animation : "slide", slideshow : false, controlNav : false, customDirectionNav : $( this ).next( '.rhea-news-directional-nav' ).find( 'a' ) } ); } ); } } window.ultraFeaturedSlider = function ( s1, s2 ) { var s1 = $( s1 ); var s2 = $( s2 ); var maxItems = 3; var $sliderItemTotal = $( ".rhea-slider-item-total" ); s2.flexslider( { move : 1, directionNav : false, animation : "slide", controlNav : false, animationLoop : false, slideshow : false, itemWidth : 10, itemMargin : 12, asNavFor : s1, maxItems : maxItems, minItems : 1, start : function ( item ) { slideCounter( item ); }, after : function ( item ) { slideCounter( item ); } } ); function slideCounter( item ) { $sliderItemTotal.text( item.count - maxItems - item.currentSlide ); } s1.flexslider( { smoothHeight : true, animation : "fade", controlNav : false, animationLoop : false, slideshow : false, sync : s2 } ); } window.rheaSubmitContactForm = function ( formID, btnSelector ) { if ( jQuery().validate && jQuery().ajaxSubmit ) { var submitButton = $( btnSelector ), ajaxLoader = $( formID ).find( '.rhea-ajax-loader' ), messageContainer = $( formID ).find( '.rhea-message-container' ), errorContainer = $( formID ).find( ".rhea-error-container" ); var formOptions = { beforeSubmit : function () { submitButton.attr( 'disabled', 'disabled' ); ajaxLoader.fadeIn( 'fast' ); messageContainer.fadeOut( 'fast' ); errorContainer.fadeOut( 'fast' ); }, success : function ( ajax_response, statusText, xhr, $form ) { var response = $.parseJSON( ajax_response ); ajaxLoader.fadeOut( 'fast' ); submitButton.removeAttr( 'disabled' ); if ( response.success ) { $form.resetForm(); messageContainer.html( response.message ).fadeIn( 'fast' ); setTimeout( function () { messageContainer.fadeOut( 'slow' ) }, 5000 ); // call reset function if it exists if ( typeof inspiryResetReCAPTCHA == 'function' ) { inspiryResetReCAPTCHA(); } if ( typeof CFOSData !== 'undefined' ) { setTimeout( function () { window.location.replace( CFOSData.redirectPageUrl ); }, 1000 ); } if ( typeof contactFromData !== 'undefined' ) { setTimeout( function () { window.location.replace( contactFromData.redirectPageUrl ); }, 1000 ); } } else { errorContainer.html( response.message ).fadeIn( 'fast' ); } } }; // Agent single page form $( formID ).validate( { errorLabelContainer : errorContainer, submitHandler : function ( form ) { $( form ).ajaxSubmit( formOptions ); } } ); } }; function isInViewport( node ) { var rect = node.getBoundingClientRect(); return ( ( rect.height > 0 || rect.width > 0 ) && rect.bottom >= 0 && rect.right >= 0 && rect.top <= ( window.innerHeight || document.documentElement.clientHeight ) && rect.left <= ( window.innerWidth || document.documentElement.clientWidth ) ) } function scrollParallax( selector ) { var scrolled = jQuery( window ).scrollTop(); jQuery( selector ).each( function ( index, element ) { var initY = jQuery( this ).offset().top; var height = jQuery( this ).height(); var endY = initY + jQuery( this ).height(); // Check if the element is in the viewport. var visible = isInViewport( this ); if ( visible ) { var diff = scrolled - initY; var ratio = Math.round( ( diff / height ) * 100 ); jQuery( this ).css( 'background-position', 'center ' + parseInt( ( ratio * 1 ) ) + 'px' ) } } ) } jQuery( '.ere_cta_parallax' ).each( function () { scrollParallax( this ); } ); jQuery( window ).scroll( function () { jQuery( '.ere_cta_parallax' ).each( function () { scrollParallax( this ); } ); } ); // Testimonials Five Carousel window.rheaTestimonialsFiveCarousel = function ( settings ) { if ( $().owlCarousel ) { let carouselOptions = { items : 1, margin : 0, nav : false, autoHeight : true, loop : settings.loop, autoplay : settings.autoplay, autoplayTimeout : settings.autoplaySpeed, autoplayHoverPause : true, smartSpeed : settings.animationSpeed, dotsContainer : settings.dots, rtl : $( 'body' ).hasClass( 'rtl' ) }; if ( 'fade' === settings.slideAnimation ) { carouselOptions.animateOut = 'fadeOut'; carouselOptions.animateIn = 'fadeIn'; } $( settings.id ).owlCarousel( carouselOptions ); } }; // Image Carousel Widget Script. window.rheaImageCarousel = function ( settings ) { if ( $().slick ) { const imageCarouselWrap = $( settings.wrapper ), imageCarousel = $( settings.id ); imageCarousel.on( 'init', function ( event, slick, direction ) { $( event.currentTarget ).show(); } ); imageCarousel.slick( { fade : settings.fade, speed : settings.speed, infinite : settings.infinite, autoplay : settings.autoplay, autoplaySpeed : settings.autoplaySpeed, pauseOnHover : settings.pauseOnHover, pauseOnInteraction : settings.pauseOnInteraction, slidesToShow : settings.slidesToShow, slidesToScroll : settings.slidesToScroll, rows : 1, slidesPerRow : 1, dots : settings.dots, arrows : settings.arrows, prevArrow : imageCarouselWrap.find( '.rhea-image-carousel-button-prev' ), nextArrow : imageCarouselWrap.find( '.rhea-image-carousel-button-next' ), vertical : false, mobileFirst : true, adaptiveHeight : false, rtl : $( 'body' ).hasClass( 'rtl' ), responsive : [ { breakpoint : 1025, settings : { slidesToShow : settings.slidesToShow, slidesToScroll : settings.slidesToScroll } }, { breakpoint : 768, settings : { slidesToShow : settings.slidesToShowTablet, slidesToScroll : settings.slidesToScrollTablet } }, { breakpoint : 380, settings : { slidesToShow : settings.slidesToShowMobile, slidesToScroll : settings.slidesToScrollMobile } }, { breakpoint : 0, settings : { slidesToShow : 1, slidesToScroll : 1 } } ] } ); } }; // Accordion Widget Script. window.rheaAccordion = function ( id ) { $( '#' + id + ' > .rhea-accordion-title' ).on( 'click', function ( event ) { var $this = $( this ); if ( $this.hasClass( 'rhea-accordion-active' ) ) { $this.next( '.rhea-accordion-content' ).slideUp( 500, function () { $this.removeClass( 'rhea-accordion-active' ) } ); } else { $this.siblings( '.rhea-accordion-title' ).removeClass( 'rhea-accordion-active' ); $this.addClass( 'rhea-accordion-active' ) .next( '.rhea-accordion-content' ) .slideDown( 500 ) .siblings( '.rhea-accordion-content' ) .slideUp( 500 ); } } ); }; // Tabs Widget Script. window.rheaTabs = function ( id ) { const tabsContainer = $( '#' + id ); const tabsList = tabsContainer.find( '.rhea-tabs-list li' ); const tabsContentWrapper = tabsContainer.find( '.rhea-tabs-content-wrapper' ); const tabsContent = tabsContainer.find( '.rhea-tabs-content-wrapper .rhea-tabs-content' ); if ( tabsContent.length ) { let minHeight = 0; let contentHeights = []; tabsContent.each( function ( index ) { // Gather all content wrapper heights. contentHeights.push( $( this ).outerHeight() ); } ); if ( contentHeights ) { // Find max value in the array and add with wrapper's space. minHeight = Math.max.apply( Math, contentHeights ) + ( tabsContentWrapper.outerHeight() - tabsContentWrapper.height() ); // Set container minimum height tabsContainer.css( 'min-height', minHeight ); } } tabsList.on( 'click', function ( event ) { const $this = $( this ); tabsList.removeClass( 'rhea-tabs-active' ); $this.addClass( 'rhea-tabs-active' ); // Hide all content and show current one. tabsContent.hide().removeClass( 'rhea-tabs-active' ); tabsContent.eq( $this.index() ).show().addClass( 'rhea-tabs-active' ); } ); }; // Image Gallery Widget Script. window.rheaImageGallery = function ( settings ) { if ( jQuery().isotope ) { const container = $( settings.containerId ), filterLinks = $( settings.filters ), galleryOptions = { filter : "*", animationEngine : 'best-available', itemSelector : settings.itemSelector }; if ( 'grid' === settings.layout ) { galleryOptions.layoutMode = 'fitRows'; } const gallery = container.isotope( galleryOptions ); // Re-layout gallery.isotope( 'layout' ); filterLinks.on( 'click', function ( event ) { filterLinks.removeClass( 'current' ); $( this ).addClass( 'current' ); gallery.isotope( { filter : '.' + $( this ).attr( 'data-filter' ) } ); event.preventDefault(); } ); } }; // Get width and height and set the width/position of Featured Properties slider nav window.rheaFeaturedNavPosition = function ( id1, id2 ) { var sliderWidth = $( id1 ).outerWidth(); var slideHeight = $( id1 ).outerHeight(); $( id2 ).width( sliderWidth ); $( id2 ).css( 'top', slideHeight ); } // Schedule Tour Form Widget Script. window.rheaScheduleTourForm = function ( id ) { if ( jQuery().validate && jQuery().ajaxSubmit ) { const formId = $( id ), submitButton = formId.find( '.rhea-stf-submit' ), ajaxLoader = formId.find( '.rhea-stf-ajax-loader' ), messageContainer = formId.find( '.rhea-stf-message-container' ), errorContainer = formId.find( ".rhea-stf-error-container" ); const formOptions = { beforeSubmit : function () { submitButton.attr( 'disabled', 'disabled' ); ajaxLoader.fadeIn( 'fast' ); messageContainer.fadeOut( 'fast' ); errorContainer.fadeOut( 'fast' ); }, success : function ( ajax_response, statusText, xhr, $form ) { var response = $.parseJSON( ajax_response ); ajaxLoader.fadeOut( 'fast' ); submitButton.removeAttr( 'disabled' ); if ( response.success ) { $form.resetForm(); messageContainer.html( response.message ).fadeIn( 'fast' ); setTimeout( function () { messageContainer.fadeOut( 'slow' ) }, 5000 ); // Call reset function if it exists. // if (typeof inspiryResetReCAPTCHA == 'function') { // inspiryResetReCAPTCHA(); // } } else { errorContainer.html( response.message ).fadeIn( 'fast' ); } } }; $( id ).validate( { errorLabelContainer : errorContainer, submitHandler : function ( form ) { $( form ).ajaxSubmit( formOptions ); } } ); } }; if ( jQuery().isotope ) { $( '.rhea_properties_cities_wrapper.masonry' ).isotope( { itemSelector : '.rhea_property_city', //percentPosition: true, masonry : { //columnWidth: 300, horizontalOrder : true } } ) } /** * Enable empty values dropdown fields again on clicking the browser back button */ window.onload = function ( event ) { setTimeout( function () { $( '.rhea_multi_select_picker' ).selectpicker( 'refresh' ); $( '.rhea_multi_select_picker_location ' ).selectpicker( 'refresh' ); }, 500 ); } /** * Hotel Services Slider */ window.rheaServicesSlider = function ( id ) { const carousel = $( id ).find( '.rhea-service-carousel-tabs' ); const slider = $( id ).find( '.rhea-service-carousel-images' ); const navPrev = $( id ).find( '.rhea-prev-service' ); const navNext = $( id ).find( '.rhea-next-service' ); carousel.slick( { slidesToShow : 4, slidesToScroll : 1, asNavFor : slider, dots : false, centerMode : false, focusOnSelect : true, prevArrow : navPrev, nextArrow : navNext, responsive : [ { breakpoint : 1200, settings : { slidesToShow : 3 } }, { breakpoint : 800, settings : { slidesToShow : 2 } } ] } ); slider.slick( { slidesToShow : 1, slidesToScroll : 1, arrows : false, fade : true, draggable : false } ); } /** * RVR guests fields counter */ window.rvrGuestsFieldsCounter = function ( field, wrapper ) { $( '.rhea-guests-number' ).each( function () { let decrement = $( this ).find( '.minus' ); let increment = $( this ).find( '.plus' ); let $input = $( this ).find( 'input' ); let currentCounter = ''; let adultsRequired = false; if ( $( this ).hasClass( 'adults-field' ) ) { currentCounter = $( this ).closest( '.rhea-guests-field-dropdown-box' ).find( '.adults i' ); adultsRequired = true; } if ( $( this ).hasClass( 'children-field' ) ) { currentCounter = $( this ).closest( '.rhea-guests-field-dropdown-box' ).find( '.children i' ); } if ( $( this ).hasClass( 'infants-field' ) ) { currentCounter = $( this ).closest( '.rhea-guests-field-dropdown-box' ).find( '.infants i' ); } decrement.on( 'click', function () { let count = parseInt( $input.val() ) - 1; if ( true === adultsRequired ) { count = count < 1 ? 1 : count; } else { count = count < 0 ? 0 : count; } $input.val( count ); $input.change(); currentCounter.html( count ); return false; } ); increment.on( 'click', function () { let count = parseInt( $input.val() ) + 1; $input.val( count ); $input.change(); currentCounter.html( count ); return false; } ); } ); $( field ).on( 'click', function () { if ( ! $( wrapper ).hasClass( 'active' ) ) { $( wrapper ).addClass( 'active' ); } else { $( wrapper ).removeClass( 'active' ); } } ); //Close guests field dropdown if click outside the wrapper $( 'body' ).on( "click", function ( e ) { const target = $( '.rhea-guests-field-dropdown-box, .rhea-guests-field-dropdown-box *' ); const targetDrop = $( '.rhea-rvr-guests-fields-wrapper' ); if ( targetDrop.hasClass( 'active' ) ) { if ( $( e.target ).is( target ) === false && $( e.target ).is( targetDrop ) === false ) { targetDrop.removeClass( "active" ); } } } ); } } )( jQuery ); ;