Content Aware Sidebars – Unlimited Widget Areas - Version 3.13.1

Version Description

  • [new] identical taxonomy names are now displayed with their post type
  • [fixed] taxonomy and attachment condition suggestions would not display all results
  • [updated] wp-content-aware-engine library
  • [updated] freemius sdk

Pro Plan:

  • [new] support for auto-updates
Download this release

Release Info

Developer intoxstudio
Plugin Icon 128x128 Content Aware Sidebars – Unlimited Widget Areas
Version 3.13.1
Comparing to
See all releases

Code changes from version 3.13 to 3.13.1

Files changed (36) hide show
  1. admin/db-updates.php +3 -3
  2. app.php +1 -1
  3. assets/js/cas_admin.min.js +1 -1
  4. assets/js/flatpickr.min.js +1 -1
  5. assets/js/suggest-sidebars.min.js +1 -1
  6. assets/js/widgets.min.js +1 -1
  7. changelog.txt +16 -0
  8. content-aware-sidebars.php +3 -1
  9. lib/freemius/assets/css/admin/account.css +1 -1
  10. lib/freemius/config.php +391 -388
  11. lib/freemius/includes/class-freemius.php +107 -6
  12. lib/freemius/includes/class-fs-plugin-updater.php +49 -6
  13. lib/freemius/includes/fs-plugin-info-dialog.php +16 -10
  14. lib/freemius/includes/i18n.php +2 -0
  15. lib/freemius/includes/sdk/FreemiusWordPress.php +5 -1
  16. lib/freemius/languages/freemius-cs_CZ.mo +0 -0
  17. lib/freemius/languages/freemius-da_DK.mo +0 -0
  18. lib/freemius/languages/freemius-en.mo +0 -0
  19. lib/freemius/languages/freemius-es_ES.mo +0 -0
  20. lib/freemius/languages/freemius-fr_FR.mo +0 -0
  21. lib/freemius/languages/freemius-he_IL.mo +0 -0
  22. lib/freemius/languages/freemius-hu_HU.mo +0 -0
  23. lib/freemius/languages/freemius-it_IT.mo +0 -0
  24. lib/freemius/languages/freemius-ja.mo +0 -0
  25. lib/freemius/languages/freemius-nl_NL.mo +0 -0
  26. lib/freemius/languages/freemius-ru_RU.mo +0 -0
  27. lib/freemius/languages/freemius-ta.mo +0 -0
  28. lib/freemius/languages/freemius-zh_CN.mo +0 -0
  29. lib/freemius/start.php +1 -1
  30. lib/freemius/templates/account.php +23 -0
  31. lib/freemius/templates/forms/affiliation.php +2 -0
  32. lib/wp-content-aware-engine/assets/js/condition_groups.min.js +1 -1
  33. lib/wp-content-aware-engine/bootstrap.php +1 -1
  34. lib/wp-content-aware-engine/module/post_type.php +3 -3
  35. lib/wp-content-aware-engine/module/taxonomy.php +44 -18
  36. readme.txt +12 -17
admin/db-updates.php CHANGED
@@ -16,17 +16,17 @@ $cas_db_updater->register_version_update('3.1', 'cas_update_to_31');
16
  $cas_db_updater->register_version_update('3.4', 'cas_update_to_34');
17
  $cas_db_updater->register_version_update('3.5.1', 'cas_update_to_351');
18
  $cas_db_updater->register_version_update('3.8', 'cas_update_to_38');
19
- $cas_db_updater->register_version_update('3.13', 'cas_update_to_313');
20
 
21
  /**
22
  * Enable legacy date module and
23
  * negated conditions if in use
24
  *
25
- * @since 3.13
26
  *
27
  * @return bool
28
  */
29
- function cas_update_to_313()
30
  {
31
  global $wpdb;
32
 
16
  $cas_db_updater->register_version_update('3.4', 'cas_update_to_34');
17
  $cas_db_updater->register_version_update('3.5.1', 'cas_update_to_351');
18
  $cas_db_updater->register_version_update('3.8', 'cas_update_to_38');
19
+ $cas_db_updater->register_version_update('3.13.1', 'cas_update_to_3131');
20
 
21
  /**
22
  * Enable legacy date module and
23
  * negated conditions if in use
24
  *
25
+ * @since 3.13.1
26
  *
27
  * @return bool
28
  */
29
+ function cas_update_to_3131()
30
  {
31
  global $wpdb;
32
 
app.php CHANGED
@@ -11,7 +11,7 @@ defined('ABSPATH') || exit;
11
  final class CAS_App
12
  {
13
  const PLUGIN_VERSION_KEY = 'cas_db_version';
14
- const PLUGIN_VERSION = '3.13';
15
 
16
  /**
17
  * Prefix for sidebar id
11
  final class CAS_App
12
  {
13
  const PLUGIN_VERSION_KEY = 'cas_db_version';
14
+ const PLUGIN_VERSION = '3.13.1';
15
 
16
  /**
17
  * Prefix for sidebar id
assets/js/cas_admin.min.js CHANGED
@@ -4,4 +4,4 @@
4
  * @license GPLv3
5
  * @copyright 2019 by Joachim Jensen
6
  */
7
- !function($){"use strict";var n={current_section:0,sections:[],init:function(){this.tabController(),this.actionOptionHandler(),this.suggestVisibility(),this.initSidebarActivation(),$(".js-cas-color-field").wpColorPicker(),$(".js-cas-html").on("change",function(t){var e=$(this);$(e.data("target")).attr("disabled",!e.is(":checked"))}).trigger("change")},initSidebarActivation:function(){flatpickr.l10ns.default.weekdays=CASAdmin.weekdays,flatpickr.l10ns.default.months=CASAdmin.months,flatpickr.l10ns.default.firstDayOfWeek=CASAdmin.weekStart;var t=-1===CASAdmin.timeFormat.toLowerCase().indexOf("a"),i=flatpickr(".js-cas-activation",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,n){(e||a.config.minDate)&&a.set("minDate",e?new Date(t):null),e?s.prop("checked",!1):s.is(":checked")||a.clear()}}),a=flatpickr(".js-cas-expiry",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,n){(e||i.config.maxDate)&&i.set("maxDate",e?new Date(t):null)}}),s=$(".js-cas-status");s.on("change",function(t){$(this).is(":checked")?i.clear():i.selectedDates.length||a.clear()})},initTabSections:function(){$(".js-cas-tabs").find(".nav-tab").each(function(){var t=this.href.lastIndexOf("#");if(0<=t){var e=this.href.substr(t);n.sections.push(e),$(e).hide()}})},tabController:function(){this.initTabSections(),this.setCurrentSection(window.location.hash),$("#poststuff").on("click",".js-nav-link",function(t){n.setCurrentSection(this.href)})},findSectionByURL:function(t){var e=this.sections.indexOf(t.substring(t.lastIndexOf("#")));return 0<=e?e:null},setCurrentSection:function(t){var e=this.findSectionByURL(t)||0,n=$(".js-cas-tabs").find(".nav-tab");n.eq(e).is(":visible")&&($(this.sections[this.current_section]).hide(),n.eq(this.current_section).removeClass("nav-tab-active"),this.current_section=e,$(this.sections[this.current_section]).show(),n.eq(this.current_section).addClass("nav-tab-active"),$("#_cas_section").val("#top"+this.sections[this.current_section]))},actionOptionHandler:function(){var t=$("#cas-options"),n=t.find(".js-cas-action");t.on("change",".js-cas-handle",function(){var t=$(this),e=n.filter(".js-cas-action-"+t.val());n.not(e).hide().find("input,select").attr("disabled",!0),e.fadeIn("fast").find("input,select").attr("disabled",!1)}),t.find(".js-cas-handle").trigger("change")},suggestVisibility:function(){var e=$(".js-cas-visibility");e.select2({theme:"wpca",placeholder:CASAdmin.allVisibility,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,nextSearchTerm:function(t,e){return e},data:CASAdmin.visibility}).on("select2:selecting",function(t){e.data("forceOpen",!0)}).on("select2:close",function(t){e.data("forceOpen")&&(t.preventDefault(),e.select2("open"),e.data("forceOpen",!1))}),e.data("value")&&e.val(e.data("value").toString().split(",")).trigger("change")}};$(document).ready(function(){n.init()})}(jQuery);
4
  * @license GPLv3
5
  * @copyright 2019 by Joachim Jensen
6
  */
7
+ !function($){"use strict";var e={current_section:0,sections:[],init:function(){this.tabController(),this.actionOptionHandler(),this.suggestVisibility(),this.initSidebarActivation(),$(".js-cas-color-field").wpColorPicker(),$(".js-cas-html").on("change",function(t){var e=$(this);$(e.data("target")).attr("disabled",!e.is(":checked"))}).trigger("change")},initSidebarActivation:function(){flatpickr.l10ns.default.weekdays=CASAdmin.weekdays,flatpickr.l10ns.default.months=CASAdmin.months,flatpickr.l10ns.default.firstDayOfWeek=CASAdmin.weekStart;var t=-1===CASAdmin.timeFormat.toLowerCase().indexOf("a"),i=flatpickr(".js-cas-activation",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,n){(e||s.config.minDate)&&s.set("minDate",e?new Date(t):null),e?a.prop("checked",!1):a.is(":checked")||s.clear()}}),s=flatpickr(".js-cas-expiry",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,n){(e||i.config.maxDate)&&i.set("maxDate",e?new Date(t):null)}}),a=$(".js-cas-status");a.on("change",function(t){$(this).is(":checked")?i.clear():i.selectedDates.length||s.clear()})},initTabSections:function(){$(".js-cas-tabs").find(".nav-tab").each(function(){var t=this.href.lastIndexOf("#");0<=t&&(t=this.href.substr(t),e.sections.push(t),$(t).hide())})},tabController:function(){this.initTabSections(),this.setCurrentSection(window.location.hash),$("#poststuff").on("click",".js-nav-link",function(t){e.setCurrentSection(this.href)})},findSectionByURL:function(t){t=this.sections.indexOf(t.substring(t.lastIndexOf("#")));return 0<=t?t:null},setCurrentSection:function(t){var e=this.findSectionByURL(t)||0,t=$(".js-cas-tabs").find(".nav-tab");t.eq(e).is(":visible")&&($(this.sections[this.current_section]).hide(),t.eq(this.current_section).removeClass("nav-tab-active"),this.current_section=e,$(this.sections[this.current_section]).show(),t.eq(this.current_section).addClass("nav-tab-active"),$("#_cas_section").val("#top"+this.sections[this.current_section]))},actionOptionHandler:function(){var t=$("#cas-options"),e=t.find(".js-cas-action");t.on("change",".js-cas-handle",function(){var t=$(this),t=e.filter(".js-cas-action-"+t.val());e.not(t).hide().find("input,select").attr("disabled",!0),t.fadeIn("fast").find("input,select").attr("disabled",!1)}),t.find(".js-cas-handle").trigger("change")},suggestVisibility:function(){var e=$(".js-cas-visibility");e.select2({theme:"wpca",placeholder:CASAdmin.allVisibility,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,nextSearchTerm:function(t,e){return e},data:CASAdmin.visibility}).on("select2:selecting",function(t){e.data("forceOpen",!0)}).on("select2:close",function(t){e.data("forceOpen")&&(t.preventDefault(),e.select2("open"),e.data("forceOpen",!1))}),e.data("value")&&e.val(e.data("value").toString().split(",")).trigger("change")}};$(document).ready(function(){e.init()})}(jQuery);
assets/js/flatpickr.min.js CHANGED
@@ -1,2 +1,2 @@
1
  /*! flatpickr v3.0.6, @license MIT */
2
- function FlatpickrInstance(e,t){function c(e){return e.bind(Z)}function s(e){Z.config.noCalendar&&!Z.selectedDates.length&&(Z.selectedDates=[Z.now]),function(e){e.preventDefault();var t="keydown"===e.type,n=(e.type,e.type,e.target);if(Z.amPM&&e.target===Z.amPM)return e.target.textContent=["AM","PM"]["AM"===e.target.textContent|0];var a=Number(n.min),i=Number(n.max),r=Number(n.step),o=parseInt(n.value,10),l=o+r*(e.delta||(t?38===e.which?1:-1:Math.max(-1,Math.min(1,e.wheelDelta||-e.deltaY))||0));if(void 0!==n.value&&2===n.value.length){var c=n===Z.hourElement,s=n===Z.minuteElement;l<a?(l=i+l+!c+(c&&!Z.amPM),s&&h(null,-1,Z.hourElement)):i<l&&(l=n===Z.hourElement?l-i-!Z.amPM:a,s&&h(null,1,Z.hourElement)),Z.amPM&&c&&(1===r?l+o===23:Math.abs(l-o)>r)&&(Z.amPM.textContent="PM"===Z.amPM.textContent?"AM":"PM"),n.value=Z.pad(l)}}(e),Z.selectedDates.length&&(!Z.minDateHasTime||"input"!==e.type||2<=e.target.value.length?(d(),B()):setTimeout(function(){d(),B()},1e3))}function d(){if(Z.config.enableTime){var e=(parseInt(Z.hourElement.value,10)||0)%(Z.amPM?12:24),t=(parseInt(Z.minuteElement.value,10)||0)%60,n=Z.config.enableSeconds?(parseInt(Z.secondElement.value,10)||0)%60:0;void 0!==Z.amPM&&(e=e%12+12*("PM"===Z.amPM.textContent)),Z.minDateHasTime&&0===V(Z.latestSelectedDateObj,Z.config.minDate)&&(e=Math.max(e,Z.config.minDate.getHours()))===Z.config.minDate.getHours()&&(t=Math.max(t,Z.config.minDate.getMinutes())),Z.maxDateHasTime&&0===V(Z.latestSelectedDateObj,Z.config.maxDate)&&(e=Math.min(e,Z.config.maxDate.getHours()))===Z.config.maxDate.getHours()&&(t=Math.min(t,Z.config.maxDate.getMinutes())),a(e,t,n)}}function l(e){var t=e||Z.latestSelectedDateObj;t&&a(t.getHours(),t.getMinutes(),t.getSeconds())}function a(e,t,n){Z.selectedDates.length&&Z.latestSelectedDateObj.setHours(e%24,t,n||0,0),Z.config.enableTime&&!Z.isMobile&&(Z.hourElement.value=Z.pad(Z.config.time_24hr?e:(12+e)%12+12*(e%12==0)),Z.minuteElement.value=Z.pad(t),Z.config.time_24hr||(Z.amPM.textContent=12<=e?"PM":"AM"),!0===Z.config.enableSeconds&&(Z.secondElement.value=Z.pad(n)))}function n(e){var t=e.target.value;e.delta&&(t=(parseInt(t)+e.delta).toString()),4!==t.length&&"Enter"!==e.key||(Z.currentYearElement.blur(),/[^\d]/.test(t)||N(t))}function i(t,n,a){return n instanceof Array?n.forEach(function(e){return i(t,e,a)}):t instanceof Array?t.forEach(function(e){return i(e,n,a)}):(t.addEventListener(n,a),void Z._handlers.push({element:t,event:n,handler:a}))}function r(t){return function(e){return 1===e.which&&t(e)}}function o(){if(Z._handlers=[],Z._animationLoop=[],Z.config.wrap&&["open","close","toggle","clear"].forEach(function(t){Array.prototype.forEach.call(Z.element.querySelectorAll("[data-"+t+"]"),function(e){return i(e,"mousedown",r(Z[t]))})}),Z.isMobile)return function(){var e=Z.config.enableTime?Z.config.noCalendar?"time":"datetime-local":"date";Z.mobileInput=U("input",Z.input.className+" flatpickr-mobile"),Z.mobileInput.step="any",Z.mobileInput.tabIndex=1,Z.mobileInput.type=e,Z.mobileInput.disabled=Z.input.disabled,Z.mobileInput.placeholder=Z.input.placeholder,Z.mobileFormatStr="datetime-local"==e?"Y-m-d\\TH:i:S":"date"==e?"Y-m-d":"H:i:S",Z.selectedDates.length&&(Z.mobileInput.defaultValue=Z.mobileInput.value=Z.formatDate(Z.selectedDates[0],Z.mobileFormatStr)),Z.config.minDate&&(Z.mobileInput.min=Z.formatDate(Z.config.minDate,"Y-m-d")),Z.config.maxDate&&(Z.mobileInput.max=Z.formatDate(Z.config.maxDate,"Y-m-d")),Z.input.type="hidden",Z.config.altInput&&(Z.altInput.type="hidden");try{Z.input.parentNode.insertBefore(Z.mobileInput,Z.input.nextSibling)}catch(e){}Z.mobileInput.addEventListener("change",function(e){Z.setDate(e.target.value,!1,Z.mobileFormatStr),j("Change"),j("Close")})}();if(Z.debouncedResize=G(S,50),Z.triggerChange=function(){j("Change")},Z.debouncedChange=G(Z.triggerChange,300),"range"===Z.config.mode&&Z.daysContainer&&i(Z.daysContainer,"mouseover",function(e){return I(e.target)}),i(window.document.body,"keydown",T),Z.config.static||i(Z._input,"keydown",T),Z.config.inline||Z.config.static||i(window,"resize",Z.debouncedResize),void 0!==window.ontouchstart&&i(window.document,"touchstart",E),i(window.document,"mousedown",r(E)),i(Z._input,"blur",E),!0===Z.config.clickOpens&&(i(Z._input,"focus",Z.open),i(Z._input,"mousedown",r(Z.open))),Z.config.noCalendar||(Z.monthNav.addEventListener("wheel",function(e){return e.preventDefault()}),i(Z.monthNav,"wheel",G(J,10)),i(Z.monthNav,"mousedown",r(K)),i(Z.monthNav,["keyup","increment"],n),i(Z.daysContainer,"mousedown",r(A)),Z.config.animate&&(i(Z.daysContainer,["webkitAnimationEnd","animationend"],f),i(Z.monthNav,["webkitAnimationEnd","animationend"],m))),Z.config.enableTime){i(Z.timeContainer,["wheel","input","increment"],s),i(Z.timeContainer,"mousedown",r(p)),i(Z.timeContainer,["wheel","increment"],Z.debouncedChange),i(Z.timeContainer,"input",Z.triggerChange),i([Z.hourElement,Z.minuteElement],"focus",function(e){return e.target.select()}),void 0!==Z.secondElement&&i(Z.secondElement,"focus",function(){return Z.secondElement.select()}),void 0!==Z.amPM&&i(Z.amPM,"mousedown",r(function(e){s(e),Z.triggerChange(e)}))}}function u(){for(var e=Z._animationLoop.length;e--;)Z._animationLoop[e](),Z._animationLoop.splice(e,1)}function f(e){if(1<Z.daysContainer.childNodes.length)switch(e.animationName){case"fpSlideLeft":Z.daysContainer.lastChild.classList.remove("slideLeftNew"),Z.daysContainer.removeChild(Z.daysContainer.firstChild),Z.days=Z.daysContainer.firstChild,u();break;case"fpSlideRight":Z.daysContainer.firstChild.classList.remove("slideRightNew"),Z.daysContainer.removeChild(Z.daysContainer.lastChild),Z.days=Z.daysContainer.firstChild,u()}}function m(e){switch(e.animationName){case"fpSlideLeftNew":case"fpSlideRightNew":Z.navigationCurrentMonth.classList.remove("slideLeftNew"),Z.navigationCurrentMonth.classList.remove("slideRightNew");for(var t=Z.navigationCurrentMonth;t.nextSibling&&/curr/.test(t.nextSibling.className);)Z.monthNav.removeChild(t.nextSibling);for(;t.previousSibling&&/curr/.test(t.previousSibling.className);)Z.monthNav.removeChild(t.previousSibling);Z.oldCurMonth=null}}function g(e){e=e?Z.parseDate(e):Z.latestSelectedDateObj||(Z.config.minDate>Z.now?Z.config.minDate:Z.config.maxDate&&Z.config.maxDate<Z.now?Z.config.maxDate:Z.now);try{Z.currentYear=e.getFullYear(),Z.currentMonth=e.getMonth()}catch(e){}Z.redraw()}function p(e){~e.target.className.indexOf("arrow")&&h(e,e.target.classList.contains("arrowUp")?1:-1)}function h(e,t,n){var a=n||e.target.parentNode.childNodes[0],i=H("increment");i.delta=t,a.dispatchEvent(i)}function D(e){var t=U("div","numInputWrapper"),n=U("input","numInput "+e),a=U("span","arrowUp"),i=U("span","arrowDown");return n.type="text",n.pattern="\\d*",t.appendChild(n),t.appendChild(a),t.appendChild(i),t}function v(){var e=window.document.createDocumentFragment();Z.calendarContainer=U("div","flatpickr-calendar"),Z.calendarContainer.tabIndex=-1,Z.config.noCalendar||(e.appendChild(function(){var e=window.document.createDocumentFragment();Z.monthNav=U("div","flatpickr-month"),Z.prevMonthNav=U("span","flatpickr-prev-month"),Z.prevMonthNav.innerHTML=Z.config.prevArrow,Z.currentMonthElement=U("span","cur-month"),Z.currentMonthElement.title=Z.l10n.scrollTitle;var t=D("cur-year");return Z.currentYearElement=t.childNodes[0],Z.currentYearElement.title=Z.l10n.scrollTitle,Z.config.minDate&&(Z.currentYearElement.min=Z.config.minDate.getFullYear()),Z.config.maxDate&&(Z.currentYearElement.max=Z.config.maxDate.getFullYear(),Z.currentYearElement.disabled=Z.config.minDate&&Z.config.minDate.getFullYear()===Z.config.maxDate.getFullYear()),Z.nextMonthNav=U("span","flatpickr-next-month"),Z.nextMonthNav.innerHTML=Z.config.nextArrow,Z.navigationCurrentMonth=U("span","flatpickr-current-month"),Z.navigationCurrentMonth.appendChild(Z.currentMonthElement),Z.navigationCurrentMonth.appendChild(t),e.appendChild(Z.prevMonthNav),e.appendChild(Z.navigationCurrentMonth),e.appendChild(Z.nextMonthNav),Z.monthNav.appendChild(e),Object.defineProperty(Z,"_hidePrevMonthArrow",{get:function(){return this.__hidePrevMonthArrow},set:function(e){this.__hidePrevMonthArrow!==e&&(Z.prevMonthNav.style.display=e?"none":"block"),this.__hidePrevMonthArrow=e}}),Object.defineProperty(Z,"_hideNextMonthArrow",{get:function(){return this.__hideNextMonthArrow},set:function(e){this.__hideNextMonthArrow!==e&&(Z.nextMonthNav.style.display=e?"none":"block"),this.__hideNextMonthArrow=e}}),W(),Z.monthNav}()),Z.innerContainer=U("div","flatpickr-innerContainer"),Z.config.weekNumbers&&Z.innerContainer.appendChild((Z.calendarContainer.classList.add("hasWeeks"),Z.weekWrapper=U("div","flatpickr-weekwrapper"),Z.weekWrapper.appendChild(U("span","flatpickr-weekday",Z.l10n.weekAbbreviation)),Z.weekNumbers=U("div","flatpickr-weeks"),Z.weekWrapper.appendChild(Z.weekNumbers),Z.weekWrapper)),Z.rContainer=U("div","flatpickr-rContainer"),Z.rContainer.appendChild(y()),Z.daysContainer||(Z.daysContainer=U("div","flatpickr-days"),Z.daysContainer.tabIndex=-1),M(),Z.rContainer.appendChild(Z.daysContainer),Z.innerContainer.appendChild(Z.rContainer),e.appendChild(Z.innerContainer)),Z.config.enableTime&&e.appendChild(function(){Z.calendarContainer.classList.add("hasTime"),Z.config.noCalendar&&Z.calendarContainer.classList.add("noCalendar"),Z.timeContainer=U("div","flatpickr-time"),Z.timeContainer.tabIndex=-1;var e=U("span","flatpickr-time-separator",":"),t=D("flatpickr-hour");Z.hourElement=t.childNodes[0];var n=D("flatpickr-minute");if(Z.minuteElement=n.childNodes[0],Z.hourElement.tabIndex=Z.minuteElement.tabIndex=-1,Z.hourElement.value=Z.pad(Z.latestSelectedDateObj?Z.latestSelectedDateObj.getHours():Z.config.defaultHour),Z.minuteElement.value=Z.pad(Z.latestSelectedDateObj?Z.latestSelectedDateObj.getMinutes():Z.config.defaultMinute),Z.hourElement.step=Z.config.hourIncrement,Z.minuteElement.step=Z.config.minuteIncrement,Z.hourElement.min=Z.config.time_24hr?0:1,Z.hourElement.max=Z.config.time_24hr?23:12,Z.minuteElement.min=0,Z.minuteElement.max=59,Z.hourElement.title=Z.minuteElement.title=Z.l10n.scrollTitle,Z.timeContainer.appendChild(t),Z.timeContainer.appendChild(e),Z.timeContainer.appendChild(n),Z.config.time_24hr&&Z.timeContainer.classList.add("time24hr"),Z.config.enableSeconds){Z.timeContainer.classList.add("hasSeconds");var a=D("flatpickr-second");Z.secondElement=a.childNodes[0],Z.secondElement.value=Z.latestSelectedDateObj?Z.pad(Z.latestSelectedDateObj.getSeconds()):"00",Z.secondElement.step=Z.minuteElement.step,Z.secondElement.min=Z.minuteElement.min,Z.secondElement.max=Z.minuteElement.max,Z.timeContainer.appendChild(U("span","flatpickr-time-separator",":")),Z.timeContainer.appendChild(a)}return Z.config.time_24hr||(Z.amPM=U("span","flatpickr-am-pm",["AM","PM"][11<Z.hourElement.value|0]),Z.amPM.title=Z.l10n.toggleTitle,Z.amPM.tabIndex=-1,Z.timeContainer.appendChild(Z.amPM)),Z.timeContainer}()),q(Z.calendarContainer,"rangeMode","range"===Z.config.mode),q(Z.calendarContainer,"animate",Z.config.animate),Z.calendarContainer.appendChild(e);var t=Z.config.appendTo&&Z.config.appendTo.nodeType;if(Z.config.inline||Z.config.static){if(Z.calendarContainer.classList.add(Z.config.inline?"inline":"static"),Z.config.inline&&!t)return Z.element.parentNode.insertBefore(Z.calendarContainer,Z._input.nextSibling);if(Z.config.static){var n=U("div","flatpickr-wrapper");return Z.element.parentNode.insertBefore(n,Z.element),n.appendChild(Z.element),Z.altInput&&n.appendChild(Z.altInput),void n.appendChild(Z.calendarContainer)}}(t?Z.config.appendTo:window.document.body).appendChild(Z.calendarContainer)}function C(e,t,n,a){var i,r=_(t,!0),o=U("span","flatpickr-day "+e,t.getDate());return o.dateObj=t,o.$i=a,o.setAttribute("aria-label",Z.formatDate(t,Z.config.ariaDateFormat)),0===V(t,Z.now)&&(Z.todayDateElem=o).classList.add("today"),r?(o.tabIndex=-1,R(t)&&(o.classList.add("selected"),Z.selectedDateElem=o,"range"===Z.config.mode&&(q(o,"startRange",0===V(t,Z.selectedDates[0])),q(o,"endRange",0===V(t,Z.selectedDates[1]))))):(o.classList.add("disabled"),Z.selectedDates[0]&&t>Z.minRangeDate&&t<Z.selectedDates[0]?Z.minRangeDate=t:Z.selectedDates[0]&&t<Z.maxRangeDate&&t>Z.selectedDates[0]&&(Z.maxRangeDate=t)),"range"===Z.config.mode&&(i=t,!("range"!==Z.config.mode||Z.selectedDates.length<2)&&0<=V(i,Z.selectedDates[0])&&V(i,Z.selectedDates[1])<=0&&!R(t)&&o.classList.add("inRange"),1===Z.selectedDates.length&&(t<Z.minRangeDate||t>Z.maxRangeDate)&&o.classList.add("notAllowed")),Z.config.weekNumbers&&"prevMonthDay"!==e&&n%7==1&&Z.weekNumbers.insertAdjacentHTML("beforeend","<span class='disabled flatpickr-day'>"+Z.config.getWeek(t)+"</span>"),j("DayCreate",o),o}function w(e,t){function n(){(i=i||Z.days.childNodes[a]).focus(),"range"===Z.config.mode&&I(i)}var a=e+t||0,i=void 0!==e?Z.days.childNodes[a]:Z.selectedDateElem||Z.todayDateElem||Z.days.childNodes[0];if(void 0===i&&0!==t)return 0<t?(Z.changeMonth(1),a%=42):t<0&&(Z.changeMonth(-1),a+=42),b(n);n()}function b(e){if(!0===Z.config.animate)return Z._animationLoop.push(e);e()}function M(e){var t=(new Date(Z.currentYear,Z.currentMonth,1).getDay()-Z.l10n.firstDayOfWeek+7)%7,n="range"===Z.config.mode;Z.prevMonthDays=Z.utils.getDaysinMonth((Z.currentMonth-1+12)%12),Z.selectedDateElem=void 0,Z.todayDateElem=void 0;var a=Z.utils.getDaysinMonth(),i=window.document.createDocumentFragment(),r=Z.prevMonthDays+1-t,o=0;for(Z.config.weekNumbers&&Z.weekNumbers.firstChild&&(Z.weekNumbers.textContent=""),n&&(Z.minRangeDate=new Date(Z.currentYear,Z.currentMonth-1,r),Z.maxRangeDate=new Date(Z.currentYear,Z.currentMonth+1,(42-t)%a));r<=Z.prevMonthDays;r++,o++)i.appendChild(C("prevMonthDay",new Date(Z.currentYear,Z.currentMonth-1,r),r,o));for(r=1;r<=a;r++,o++)i.appendChild(C("",new Date(Z.currentYear,Z.currentMonth,r),r,o));for(var l=a+1;l<=42-t;l++,o++)i.appendChild(C("nextMonthDay",new Date(Z.currentYear,Z.currentMonth+1,l%a),l,o));n&&1===Z.selectedDates.length&&i.childNodes[0]?(Z._hidePrevMonthArrow=Z._hidePrevMonthArrow||Z.minRangeDate>i.childNodes[0].dateObj,Z._hideNextMonthArrow=Z._hideNextMonthArrow||Z.maxRangeDate<new Date(Z.currentYear,Z.currentMonth+1,1)):W();var c=U("div","dayContainer");if(c.appendChild(i),Z.config.animate&&void 0!==e)for(;1<Z.daysContainer.childNodes.length;)Z.daysContainer.removeChild(Z.daysContainer.firstChild);else!function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(Z.daysContainer);return 0<=e?Z.daysContainer.appendChild(c):Z.daysContainer.insertBefore(c,Z.daysContainer.firstChild),Z.days=Z.daysContainer.firstChild,Z.daysContainer}function y(){Z.weekdayContainer||(Z.weekdayContainer=U("div","flatpickr-weekdays"));var e=Z.l10n.firstDayOfWeek,t=Z.l10n.weekdays.shorthand.slice();return 0<e&&e<t.length&&(t=[].concat(t.splice(e,t.length),t.splice(0,e))),Z.weekdayContainer.innerHTML="\n\t\t<span class=flatpickr-weekday>\n\t\t\t"+t.join("</span><span class=flatpickr-weekday>")+"\n\t\t</span>\n\t\t",Z.weekdayContainer}function k(e,t,n){var a=(t=void 0===t||t)?e:e-Z.currentMonth,i=!Z.config.animate||!1===n;if(!(a<0&&Z._hidePrevMonthArrow||0<a&&Z._hideNextMonthArrow)){if(Z.currentMonth+=a,(Z.currentMonth<0||11<Z.currentMonth)&&(Z.currentYear+=11<Z.currentMonth?1:-1,Z.currentMonth=(Z.currentMonth+12)%12,j("YearChange")),M(i?void 0:a),i)return j("MonthChange"),W();var r=Z.navigationCurrentMonth;if(a<0)for(;r.nextSibling&&/curr/.test(r.nextSibling.className);)Z.monthNav.removeChild(r.nextSibling);else if(0<a)for(;r.previousSibling&&/curr/.test(r.previousSibling.className);)Z.monthNav.removeChild(r.previousSibling);if(Z.oldCurMonth=Z.navigationCurrentMonth,Z.navigationCurrentMonth=Z.monthNav.insertBefore(Z.oldCurMonth.cloneNode(!0),0<a?Z.oldCurMonth.nextSibling:Z.oldCurMonth),0<a?(Z.daysContainer.firstChild.classList.add("slideLeft"),Z.daysContainer.lastChild.classList.add("slideLeftNew"),Z.oldCurMonth.classList.add("slideLeft"),Z.navigationCurrentMonth.classList.add("slideLeftNew")):a<0&&(Z.daysContainer.firstChild.classList.add("slideRightNew"),Z.daysContainer.lastChild.classList.add("slideRight"),Z.oldCurMonth.classList.add("slideRight"),Z.navigationCurrentMonth.classList.add("slideRightNew")),Z.currentMonthElement=Z.navigationCurrentMonth.firstChild,Z.currentYearElement=Z.navigationCurrentMonth.lastChild.childNodes[0],W(),Z.oldCurMonth.firstChild.textContent=Z.utils.monthToStr(Z.currentMonth-a),j("MonthChange"),document.activeElement&&document.activeElement.$i){var o=document.activeElement.$i;b(function(){w(o,0)})}}}function x(e){return!(!Z.config.appendTo||!Z.config.appendTo.contains(e))||Z.calendarContainer.contains(e)}function E(e){if(Z.isOpen&&!Z.config.inline){var t=x(e.target),n=e.target===Z.input||e.target===Z.altInput||Z.element.contains(e.target)||e.path&&e.path.indexOf&&(~e.path.indexOf(Z.input)||~e.path.indexOf(Z.altInput));("blur"===e.type?!n||!e.relatedTarget||x(e.relatedTarget):n||t)||-1!==Z.config.ignoredFocusElements.indexOf(e.target)||(Z.close(),"range"===Z.config.mode&&1===Z.selectedDates.length&&(Z.clear(!1),Z.redraw()))}}function N(e){if(!(!e||Z.currentYearElement.min&&e<Z.currentYearElement.min||Z.currentYearElement.max&&e>Z.currentYearElement.max)){var t=parseInt(e,10),n=Z.currentYear!==t;Z.currentYear=t||Z.currentYear,Z.config.maxDate&&Z.currentYear===Z.config.maxDate.getFullYear()?Z.currentMonth=Math.min(Z.config.maxDate.getMonth(),Z.currentMonth):Z.config.minDate&&Z.currentYear===Z.config.minDate.getFullYear()&&(Z.currentMonth=Math.max(Z.config.minDate.getMonth(),Z.currentMonth)),n&&(Z.redraw(),j("YearChange"))}}function _(e,t){if(Z.config.minDate&&V(e,Z.config.minDate,void 0!==t?t:!Z.minDateHasTime)<0||Z.config.maxDate&&0<V(e,Z.config.maxDate,void 0!==t?t:!Z.maxDateHasTime))return!1;if(!Z.config.enable.length&&!Z.config.disable.length)return!0;for(var n,a=Z.parseDate(e,null,!0),i=0<Z.config.enable.length,r=i?Z.config.enable:Z.config.disable,o=0;o<r.length;o++){if((n=r[o])instanceof Function&&n(a))return i;if(n instanceof Date&&n.getTime()===a.getTime())return i;if("string"==typeof n&&Z.parseDate(n,null,!0).getTime()===a.getTime())return i;if("object"===(void 0===n?"undefined":_typeof(n))&&n.from&&n.to&&a>=n.from&&a<=n.to)return i}return!i}function T(e){var t=e.target===Z._input,n=x(e.target),a=Z.config.allowInput,i=Z.isOpen&&(!a||!t),r=Z.config.inline&&t&&!a;if("Enter"===e.key&&a&&t)return Z.setDate(Z._input.value,!0,e.target===Z.altInput?Z.config.altFormat:Z.config.dateFormat),e.target.blur();if(n||i||r){var o=Z.timeContainer&&Z.timeContainer.contains(e.target);switch(e.key){case"Enter":o?B():A(e);break;case"Escape":e.preventDefault(),Z.close();break;case"ArrowLeft":case"ArrowRight":if(!o)if(e.preventDefault(),Z.daysContainer){var l="ArrowRight"===e.key?1:-1;e.ctrlKey?k(l,!0):w(e.target.$i,l)}else Z.config.enableTime&&!o&&Z.hourElement.focus();break;case"ArrowUp":case"ArrowDown":e.preventDefault();var c="ArrowDown"===e.key?1:-1;Z.daysContainer?e.ctrlKey?(N(Z.currentYear-c),w(e.target.$i,0)):o||w(e.target.$i,7*c):Z.config.enableTime&&(o||Z.hourElement.focus(),s(e));break;case"Tab":e.target===Z.hourElement?(e.preventDefault(),Z.minuteElement.select()):e.target===Z.minuteElement&&(Z.secondElement||Z.amPM)?(e.preventDefault(),(Z.secondElement||Z.amPM).focus()):e.target===Z.secondElement&&(e.preventDefault(),Z.amPM.focus());break;case"a":e.target===Z.amPM&&(Z.amPM.textContent="AM",d(),B());break;case"p":e.target===Z.amPM&&(Z.amPM.textContent="PM",d(),B())}j("KeyDown",e)}}function I(o){if(1===Z.selectedDates.length&&o.classList.contains("flatpickr-day")){for(var l=o.dateObj,c=Z.parseDate(Z.selectedDates[0],null,!0),s=Math.min(l.getTime(),Z.selectedDates[0].getTime()),d=Math.max(l.getTime(),Z.selectedDates[0].getTime()),u=!1,e=s;e<d;e+=Z.utils.duration.DAY)if(!_(new Date(e))){u=!0;break}for(var t=Z.days.childNodes[0].dateObj.getTime(),n=0;n<42;n++,t+=Z.utils.duration.DAY)!function(e,t){var n=e<Z.minRangeDate.getTime()||e>Z.maxRangeDate.getTime(),a=Z.days.childNodes[t];if(n)return Z.days.childNodes[t].classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(e){a.classList.remove(e)});if(u&&!n)return;["startRange","inRange","endRange","notAllowed"].forEach(function(e){a.classList.remove(e)});var i=Math.max(Z.minRangeDate.getTime(),s),r=Math.min(Z.maxRangeDate.getTime(),d);o.classList.add(l<Z.selectedDates[0]?"startRange":"endRange"),c<l&&e===c.getTime()?a.classList.add("startRange"):l<c&&e===c.getTime()&&a.classList.add("endRange"),i<=e&&e<=r&&a.classList.add("inRange")}(t,n)}}function S(){!Z.isOpen||Z.config.static||Z.config.inline||Y()}function F(i){return function(e){var t=Z.config["_"+i+"Date"]=Z.parseDate(e),n=Z.config["_"+("min"===i?"max":"min")+"Date"],a=e&&t instanceof Date;a&&(Z[i+"DateHasTime"]=t.getHours()||t.getMinutes()||t.getSeconds()),Z.selectedDates&&(Z.selectedDates=Z.selectedDates.filter(function(e){return _(e)}),Z.selectedDates.length||"min"!==i||l(t),B()),Z.daysContainer&&(O(),a?Z.currentYearElement[i]=t.getFullYear():Z.currentYearElement.removeAttribute(i),Z.currentYearElement.disabled=n&&t&&n.getFullYear()===t.getFullYear())}}function Y(e){var t=0<arguments.length&&void 0!==e?e:Z._positionElement;if(void 0!==Z.calendarContainer){var n=Z.calendarContainer.offsetHeight,a=Z.calendarContainer.offsetWidth,i=Z.config.position,r=t.getBoundingClientRect(),o=window.innerHeight-r.bottom,l="above"===i||"below"!==i&&o<n&&r.top>n,c=window.pageYOffset+r.top+(l?-n-2:t.offsetHeight+2);if(q(Z.calendarContainer,"arrowTop",!l),q(Z.calendarContainer,"arrowBottom",l),!Z.config.inline){var s=window.pageXOffset+r.left,d=window.document.body.offsetWidth-r.right,u=s+a>window.document.body.offsetWidth;q(Z.calendarContainer,"rightMost",u),Z.config.static||(Z.calendarContainer.style.top=c+"px",u?(Z.calendarContainer.style.left="auto",Z.calendarContainer.style.right=d+"px"):(Z.calendarContainer.style.left=s+"px",Z.calendarContainer.style.right="auto"))}}}function O(){Z.config.noCalendar||Z.isMobile||(y(),W(),M())}function A(e){if(e.preventDefault(),e.stopPropagation(),e.target.classList.contains("flatpickr-day")&&!e.target.classList.contains("disabled")&&!e.target.classList.contains("notAllowed")){var t=Z.latestSelectedDateObj=new Date(e.target.dateObj.getTime()),n=t.getMonth()!==Z.currentMonth&&"range"!==Z.config.mode;if(Z.selectedDateElem=e.target,"single"===Z.config.mode)Z.selectedDates=[t];else if("multiple"===Z.config.mode){var a=R(t);a?Z.selectedDates.splice(a,1):Z.selectedDates.push(t)}else"range"===Z.config.mode&&(2===Z.selectedDates.length&&Z.clear(),Z.selectedDates.push(t),0!==V(t,Z.selectedDates[0],!0)&&Z.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()}));if(d(),n){var i=Z.currentYear!==t.getFullYear();Z.currentYear=t.getFullYear(),Z.currentMonth=t.getMonth(),i&&j("YearChange"),j("MonthChange")}if(M(),Z.minDateHasTime&&Z.config.enableTime&&0===V(t,Z.config.minDate)&&l(Z.config.minDate),B(),Z.config.enableTime&&setTimeout(function(){return Z.showTimeInput=!0},50),"range"===Z.config.mode&&(1===Z.selectedDates.length?(I(e.target),Z._hidePrevMonthArrow=Z._hidePrevMonthArrow||Z.minRangeDate>Z.days.childNodes[0].dateObj,Z._hideNextMonthArrow=Z._hideNextMonthArrow||Z.maxRangeDate<new Date(Z.currentYear,Z.currentMonth+1,1)):W()),j("Change"),n?b(function(){return Z.selectedDateElem.focus()}):w(e.target.$i,0),Z.config.enableTime&&setTimeout(function(){return Z.hourElement.select()},451),Z.config.closeOnSelect){var r="single"===Z.config.mode&&!Z.config.enableTime,o="range"===Z.config.mode&&2===Z.selectedDates.length&&!Z.config.enableTime;(r||o)&&Z.close()}}}function L(e,t){if(e instanceof Array)Z.selectedDates=e.map(function(e){return Z.parseDate(e,t)});else if(e instanceof Date||!isNaN(e))Z.selectedDates=[Z.parseDate(e,t)];else if(e&&e.substring)switch(Z.config.mode){case"single":Z.selectedDates=[Z.parseDate(e,t)];break;case"multiple":Z.selectedDates=e.split("; ").map(function(e){return Z.parseDate(e,t)});break;case"range":Z.selectedDates=e.split(Z.l10n.rangeSeparator).map(function(e){return Z.parseDate(e,t)})}Z.selectedDates=Z.selectedDates.filter(function(e){return e instanceof Date&&_(e,!1)}),Z.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()})}function P(e){for(var t=e.length;t--;)"string"==typeof e[t]||+e[t]?e[t]=Z.parseDate(e[t],null,!0):e[t]&&e[t].from&&e[t].to&&(e[t].from=Z.parseDate(e[t].from),e[t].to=Z.parseDate(e[t].to));return e.filter(function(e){return e})}function j(e,t){var n=Z.config["on"+e];if(void 0!==n&&0<n.length)for(var a=0;n[a]&&a<n.length;a++)n[a](Z.selectedDates,Z.input.value,Z,t);"Change"===e&&(Z.input.dispatchEvent(H("change")),Z.input.dispatchEvent(H("input")))}function H(e){return Z._supportsEvents?new Event(e,{bubbles:!0}):(Z._[e+"Event"]=document.createEvent("Event"),Z._[e+"Event"].initEvent(e,!0,!0),Z._[e+"Event"])}function R(e){for(var t=0;t<Z.selectedDates.length;t++)if(0===V(Z.selectedDates[t],e))return""+t;return!1}function W(){Z.config.noCalendar||Z.isMobile||!Z.monthNav||(Z.currentMonthElement.textContent=Z.utils.monthToStr(Z.currentMonth)+" ",Z.currentYearElement.value=Z.currentYear,Z._hidePrevMonthArrow=Z.config.minDate&&(Z.currentYear===Z.config.minDate.getFullYear()?Z.currentMonth<=Z.config.minDate.getMonth():Z.currentYear<Z.config.minDate.getFullYear()),Z._hideNextMonthArrow=Z.config.maxDate&&(Z.currentYear===Z.config.maxDate.getFullYear()?Z.currentMonth+1>Z.config.maxDate.getMonth():Z.currentYear>Z.config.maxDate.getFullYear()))}function B(e){if(!Z.selectedDates.length)return Z.clear(e);Z.isMobile&&(Z.mobileInput.value=Z.selectedDates.length?Z.formatDate(Z.latestSelectedDateObj,Z.mobileFormatStr):"");var t="range"!==Z.config.mode?"; ":Z.l10n.rangeSeparator;Z.input.value=Z.selectedDates.map(function(e){return Z.formatDate(e,Z.config.dateFormat)}).join(t),Z.config.altInput&&(Z.altInput.value=Z.selectedDates.map(function(e){return Z.formatDate(e,Z.config.altFormat)}).join(t)),!1!==e&&j("ValueUpdate")}function J(e){e.preventDefault();var t,n=Z.currentYearElement.parentNode.contains(e.target);if(e.target===Z.currentMonthElement||n){var a=(t=e,Math.max(-1,Math.min(1,t.wheelDelta||-t.deltaY)));n?(N(Z.currentYear+a),e.target.value=Z.currentYear):Z.changeMonth(a,!0,!1)}}function K(e){var t=Z.prevMonthNav.contains(e.target),n=Z.nextMonthNav.contains(e.target);t||n?k(t?-1:1):e.target===Z.currentYearElement?(e.preventDefault(),Z.currentYearElement.select()):"arrowUp"===e.target.className?Z.changeYear(Z.currentYear+1):"arrowDown"===e.target.className&&Z.changeYear(Z.currentYear-1)}function U(e,t,n){var a=window.document.createElement(e);return t=t||"",n=n||"",a.className=t,void 0!==n&&(a.textContent=n),a}function z(e){return e instanceof Array?e:[e]}function q(e,t,n){if(n)return e.classList.add(t);e.classList.remove(t)}function G(n,a,i){var r=void 0;return function(){var e=this,t=arguments;clearTimeout(r),r=setTimeout(function(){r=null,i||n.apply(e,t)},a),i&&!r&&n.apply(e,t)}}function V(e,t,n){return e instanceof Date&&t instanceof Date&&(!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime())}var Z=this;return Z._={},Z._.afterDayAnim=b,Z._bind=i,Z._compareDates=V,Z._setHoursFromDate=l,Z.changeMonth=k,Z.changeYear=N,Z.clear=function(e){Z.input.value="",Z.altInput&&(Z.altInput.value=""),Z.mobileInput&&(Z.mobileInput.value=""),Z.selectedDates=[],Z.latestSelectedDateObj=void 0,Z.showTimeInput=!1,Z.redraw(),!1!==e&&j("Change")},Z.close=function(){Z.isOpen=!1,Z.isMobile||(Z.calendarContainer.classList.remove("open"),Z._input.classList.remove("active")),j("Close")},Z._createElement=U,Z.destroy=function(){void 0!==Z.config&&j("Destroy");for(var e=Z._handlers.length;e--;){var t=Z._handlers[e];t.element.removeEventListener(t.event,t.handler)}Z._handlers=[],Z.mobileInput?(Z.mobileInput.parentNode&&Z.mobileInput.parentNode.removeChild(Z.mobileInput),Z.mobileInput=null):Z.calendarContainer&&Z.calendarContainer.parentNode&&Z.calendarContainer.parentNode.removeChild(Z.calendarContainer),Z.altInput&&(Z.input.type="text",Z.altInput.parentNode&&Z.altInput.parentNode.removeChild(Z.altInput),delete Z.altInput),Z.input&&(Z.input.type=Z.input._type,Z.input.classList.remove("flatpickr-input"),Z.input.removeAttribute("readonly"),Z.input.value=""),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){return delete Z[e]})},Z.isEnabled=_,Z.jumpToDate=g,Z.open=function(e,t){if(Z.isMobile)return e&&(e.preventDefault(),e.target.blur()),setTimeout(function(){Z.mobileInput.click()},0),void j("Open");Z.isOpen||Z._input.disabled||Z.config.inline||(Z.isOpen=!0,Z.calendarContainer.classList.add("open"),Y(t),Z._input.classList.add("active"),j("Open"))},Z.redraw=O,Z.set=function(e,t){Z.config[e]=t,Z.redraw(),g()},Z.setDate=function(e,t,n){if(0!==e&&!e)return Z.clear(t);L(e,n),Z.showTimeInput=0<Z.selectedDates.length,Z.latestSelectedDateObj=Z.selectedDates[0],Z.redraw(),g(),l(),B(t),t&&j("Change")},Z.toggle=function(){if(Z.isOpen)return Z.close();Z.open()},Z.element=Z.input=e,Z.instanceConfig=t||{},Z.parseDate=FlatpickrInstance.prototype.parseDate.bind(Z),Z.formatDate=FlatpickrInstance.prototype.formatDate.bind(Z),Z.formats=Object.create(FlatpickrInstance.prototype.formats),["D","F","J","M","W","l"].forEach(function(e){Z.formats[e]=FlatpickrInstance.prototype.formats[e].bind(Z)}),Z.revFormat.F=FlatpickrInstance.prototype.revFormat.F.bind(Z),Z.revFormat.M=FlatpickrInstance.prototype.revFormat.M.bind(Z),function(){var e=["wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange"];Z.config=Object.create(flatpickr.defaultConfig);var n=_extends({},Z.instanceConfig,JSON.parse(JSON.stringify(Z.element.dataset||{})));Z.config.parseDate=n.parseDate,Z.config.formatDate=n.formatDate,Object.defineProperty(Z.config,"enable",{get:function(){return Z.config._enable||[]},set:function(e){return Z.config._enable=P(e)}}),Object.defineProperty(Z.config,"disable",{get:function(){return Z.config._disable||[]},set:function(e){return Z.config._disable=P(e)}}),_extends(Z.config,n),!n.dateFormat&&n.enableTime&&(Z.config.dateFormat=Z.config.noCalendar?"H:i"+(Z.config.enableSeconds?":S":""):flatpickr.defaultConfig.dateFormat+" H:i"+(Z.config.enableSeconds?":S":"")),n.altInput&&n.enableTime&&!n.altFormat&&(Z.config.altFormat=Z.config.noCalendar?"h:i"+(Z.config.enableSeconds?":S K":" K"):flatpickr.defaultConfig.altFormat+" h:i"+(Z.config.enableSeconds?":S":"")+" K"),Object.defineProperty(Z.config,"minDate",{get:function(){return this._minDate},set:F("min")}),Object.defineProperty(Z.config,"maxDate",{get:function(){return this._maxDate},set:F("max")}),Z.config.minDate=n.minDate,Z.config.maxDate=n.maxDate;for(var a=0;a<e.length;a++)Z.config[e[a]]=!0===Z.config[e[a]]||"true"===Z.config[e[a]];for(var i=t.length;i--;)void 0!==Z.config[t[i]]&&(Z.config[t[i]]=z(Z.config[t[i]]||[]).map(c));for(var r=0;r<Z.config.plugins.length;r++){var o=Z.config.plugins[r](Z)||{};for(var l in o)Z.config[l]instanceof Array||~t.indexOf(l)?Z.config[l]=z(o[l]).map(c).concat(Z.config[l]):void 0===n[l]&&(Z.config[l]=o[l])}j("ParseConfig")}(),"object"!==_typeof(Z.config.locale)&&flatpickr.l10ns[Z.config.locale],Z.l10n=_extends(Object.create(flatpickr.l10ns.default),"object"===_typeof(Z.config.locale)?Z.config.locale:"default"!==Z.config.locale&&flatpickr.l10ns[Z.config.locale]||{}),Z.input=Z.config.wrap?Z.element.querySelector("[data-input]"):Z.element,Z.input&&(Z.input._type=Z.input.type,Z.input.type="text",Z.input.classList.add("flatpickr-input"),Z._input=Z.input,Z.config.altInput&&(Z.altInput=U(Z.input.nodeName,Z.input.className+" "+Z.config.altInputClass),Z._input=Z.altInput,Z.altInput.placeholder=Z.input.placeholder,Z.altInput.disabled=Z.input.disabled,Z.altInput.required=Z.input.required,Z.altInput.type="text",Z.input.type="hidden",!Z.config.static&&Z.input.parentNode&&Z.input.parentNode.insertBefore(Z.altInput,Z.input.nextSibling)),Z.config.allowInput||Z._input.setAttribute("readonly","readonly"),Z._positionElement=Z.config.positionElement||Z._input),function(){Z.selectedDates=[],Z.now=new Date;var e=Z.config.defaultDate||Z.input.value;e&&L(e,Z.config.dateFormat);var t=Z.selectedDates.length?Z.selectedDates[0]:Z.config.minDate&&Z.config.minDate.getTime()>Z.now?Z.config.minDate:Z.config.maxDate&&Z.config.maxDate.getTime()<Z.now?Z.config.maxDate:Z.now;Z.currentYear=t.getFullYear(),Z.currentMonth=t.getMonth(),Z.selectedDates.length&&(Z.latestSelectedDateObj=Z.selectedDates[0]),Z.minDateHasTime=Z.config.minDate&&(Z.config.minDate.getHours()||Z.config.minDate.getMinutes()||Z.config.minDate.getSeconds()),Z.maxDateHasTime=Z.config.maxDate&&(Z.config.maxDate.getHours()||Z.config.maxDate.getMinutes()||Z.config.maxDate.getSeconds()),Object.defineProperty(Z,"latestSelectedDateObj",{get:function(){return Z._selectedDateObj||Z.selectedDates[Z.selectedDates.length-1]},set:function(e){Z._selectedDateObj=e}}),Z.isMobile||Object.defineProperty(Z,"showTimeInput",{get:function(){return Z._showTimeInput},set:function(e){Z._showTimeInput=e,Z.calendarContainer&&q(Z.calendarContainer,"showTimeInput",e),Y()}})}(),Z.utils={duration:{DAY:864e5},getDaysinMonth:function(e,t){return e=void 0===e?Z.currentMonth:e,t=void 0===t?Z.currentYear:t,1===e&&(t%4==0&&t%100!=0||t%400==0)?29:Z.l10n.daysInMonth[e]},monthToStr:function(e,t){return t=void 0===t?Z.config.shorthandCurrentMonth:t,Z.l10n.months[(t?"short":"long")+"hand"][e]}},Z.isOpen=!1,Z.isMobile=!Z.config.disableMobile&&!Z.config.inline&&"single"===Z.config.mode&&!Z.config.disable.length&&!Z.config.enable.length&&!Z.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Z.isMobile||v(),o(),(Z.selectedDates.length||Z.config.noCalendar)&&(Z.config.enableTime&&l(Z.config.noCalendar?Z.latestSelectedDateObj||Z.config.minDate:null),B()),Z.showTimeInput=0<Z.selectedDates.length||Z.config.noCalendar,Z.config.weekNumbers&&(Z.calendarContainer.style.width=Z.daysContainer.offsetWidth+Z.weekWrapper.offsetWidth+"px"),Z.isMobile||Y(),j("Ready"),Z}function _flatpickr(e,t){for(var n=Array.prototype.slice.call(e),a=[],i=0;i<n.length;i++)try{if(null!==n[i].getAttribute("data-fp-omit"))continue;n[i]._flatpickr&&(n[i]._flatpickr.destroy(),n[i]._flatpickr=null),n[i]._flatpickr=new FlatpickrInstance(n[i],t||{}),a.push(n[i]._flatpickr)}catch(e){}return 1===a.length?a[0]:a}function flatpickr(e,t){return e instanceof NodeList?_flatpickr(e,t):e instanceof HTMLElement?_flatpickr([e],t):_flatpickr(window.document.querySelectorAll(e),t)}var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};FlatpickrInstance.prototype={formats:{Z:function(e){return e.toISOString()},D:function(e){return this.l10n.weekdays.shorthand[this.formats.w(e)]},F:function(e){return this.utils.monthToStr(this.formats.n(e)-1,!1)},G:function(e){return FlatpickrInstance.prototype.pad(FlatpickrInstance.prototype.formats.h(e))},H:function(e){return FlatpickrInstance.prototype.pad(e.getHours())},J:function(e){return e.getDate()+this.l10n.ordinal(e.getDate())},K:function(e){return 11<e.getHours()?"PM":"AM"},M:function(e){return this.utils.monthToStr(e.getMonth(),!0)},S:function(e){return FlatpickrInstance.prototype.pad(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e){return this.config.getWeek(e)},Y:function(e){return e.getFullYear()},d:function(e){return FlatpickrInstance.prototype.pad(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return FlatpickrInstance.prototype.pad(e.getMinutes())},j:function(e){return e.getDate()},l:function(e){return this.l10n.weekdays.longhand[e.getDay()]},m:function(e){return FlatpickrInstance.prototype.pad(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},formatDate:function(a,e){var i=this;return void 0!==this.config&&void 0!==this.config.formatDate?this.config.formatDate(a,e):e.split("").map(function(e,t,n){return i.formats[e]&&"\\"!==n[t-1]?i.formats[e](a):"\\"!==e?e:""}).join("")},revFormat:{D:function(){},F:function(e,t){e.setMonth(this.l10n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t){var n=e.getHours();12!==n&&e.setHours(n%12+12*/pm/i.test(t))},M:function(e,t){e.setMonth(this.l10n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(t)},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t){return t=parseInt(t),new Date(e.getFullYear(),0,2+7*(t-1),0,0,0,0,0)},Y:function(e,t){e.setFullYear(t)},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:function(){},m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},w:function(){},y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},tokenRegex:{D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"(am|AM|Am|aM|pm|PM|Pm|pM)",M:"(\\w+)",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:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},pad:function(e){return("0"+e).slice(-2)},parseDate:function(e,t,n){if(0!==e&&!e)return null;if(e instanceof Date)e=new Date(e.getTime());else if(void 0!==e.toFixed)e=new Date(e);else{var a=t||(this.config||flatpickr.defaultConfig).dateFormat;if("today"===(e=String(e).trim()))e=new Date,n=!0;else if(/Z$/.test(e)||/GMT$/.test(e))e=new Date(e);else if(this.config&&this.config.parseDate)e=this.config.parseDate(e,a);else{for(var i=this.config&&this.config.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),r=void 0,o=0,l=0,c="";o<a.length;o++){var s=a[o],d="\\"===s,u="\\"===a[o-1]||d;if(this.tokenRegex[s]&&!u){c+=this.tokenRegex[s];var f=new RegExp(c).exec(e);f&&(r=!0)&&(i=this.revFormat[s](i,f[++l])||i)}else d||(c+=".")}e=r?i:null}}return e instanceof Date?(!0===n&&e.setHours(0,0,0,0),e):null}},"undefined"!=typeof HTMLElement&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return _flatpickr(this,e)},HTMLElement.prototype.flatpickr=function(e){return _flatpickr([this],e)}),flatpickr.defaultConfig=FlatpickrInstance.defaultConfig={mode:"single",position:"auto",animate:-1===window.navigator.userAgent.indexOf("MSIE"),wrap:!1,weekNumbers:!1,allowInput:!1,clickOpens:!0,closeOnSelect:!0,time_24hr:!1,enableTime:!1,noCalendar:!1,dateFormat:"Y-m-d",ariaDateFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",altFormat:"F j, Y",defaultDate:null,minDate:null,maxDate:null,parseDate:null,formatDate:null,getWeek:function(e){var t=new Date(e.getTime()),n=new Date(t.getFullYear(),0,1);return Math.ceil(((t-n)/864e5+n.getDay()+1)/7)},enable:[],disable:[],shorthandCurrentMonth:!1,inline:!1,static:!1,appendTo:null,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",enableSeconds:!1,hourIncrement:1,minuteIncrement:5,defaultHour:12,defaultMinute:0,disableMobile:!1,locale:"default",plugins:[],ignoredFocusElements:[],onClose:void 0,onChange:void 0,onDayCreate:void 0,onMonthChange:void 0,onOpen:void 0,onParseConfig:void 0,onReady:void 0,onValueUpdate:void 0,onYearChange:void 0,onKeyDown:void 0,onDestroy:void 0},flatpickr.l10ns={en:{weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(3<t&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle"}},flatpickr.l10ns.default=Object.create(flatpickr.l10ns.en),flatpickr.localize=function(e){return _extends(flatpickr.l10ns.default,e||{})},flatpickr.setDefaults=function(e){return _extends(flatpickr.defaultConfig,e||{})},"undefined"!=typeof jQuery&&(jQuery.fn.flatpickr=function(e){return _flatpickr(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+parseInt(e,10))},"undefined"!=typeof module&&(module.exports=flatpickr);
1
  /*! flatpickr v3.0.6, @license MIT */
2
+ function FlatpickrInstance(e,t){function c(e){return e.bind(Z)}function s(e){Z.config.noCalendar&&!Z.selectedDates.length&&(Z.selectedDates=[Z.now]),function(e){e.preventDefault();var t="keydown"===e.type,n=(e.type,e.type,e.target);if(Z.amPM&&e.target===Z.amPM)return e.target.textContent=["AM","PM"]["AM"===e.target.textContent|0];var a=Number(n.min),i=Number(n.max),r=Number(n.step),o=parseInt(n.value,10),l=o+r*(e.delta||(t?38===e.which?1:-1:Math.max(-1,Math.min(1,e.wheelDelta||-e.deltaY))||0));void 0!==n.value&&2===n.value.length&&(t=n===Z.hourElement,e=n===Z.minuteElement,l<a?(l=i+l+!t+(t&&!Z.amPM),e&&h(null,-1,Z.hourElement)):i<l&&(l=n===Z.hourElement?l-i-!Z.amPM:a,e&&h(null,1,Z.hourElement)),Z.amPM&&t&&(1===r?l+o===23:Math.abs(l-o)>r)&&(Z.amPM.textContent="PM"===Z.amPM.textContent?"AM":"PM"),n.value=Z.pad(l))}(e),Z.selectedDates.length&&(!Z.minDateHasTime||"input"!==e.type||2<=e.target.value.length?(d(),B()):setTimeout(function(){d(),B()},1e3))}function d(){var e,t,n;Z.config.enableTime&&(e=(parseInt(Z.hourElement.value,10)||0)%(Z.amPM?12:24),t=(parseInt(Z.minuteElement.value,10)||0)%60,n=Z.config.enableSeconds?(parseInt(Z.secondElement.value,10)||0)%60:0,void 0!==Z.amPM&&(e=e%12+12*("PM"===Z.amPM.textContent)),Z.minDateHasTime&&0===V(Z.latestSelectedDateObj,Z.config.minDate)&&(e=Math.max(e,Z.config.minDate.getHours()))===Z.config.minDate.getHours()&&(t=Math.max(t,Z.config.minDate.getMinutes())),Z.maxDateHasTime&&0===V(Z.latestSelectedDateObj,Z.config.maxDate)&&(e=Math.min(e,Z.config.maxDate.getHours()))===Z.config.maxDate.getHours()&&(t=Math.min(t,Z.config.maxDate.getMinutes())),a(e,t,n))}function i(e){e=e||Z.latestSelectedDateObj;e&&a(e.getHours(),e.getMinutes(),e.getSeconds())}function a(e,t,n){Z.selectedDates.length&&Z.latestSelectedDateObj.setHours(e%24,t,n||0,0),Z.config.enableTime&&!Z.isMobile&&(Z.hourElement.value=Z.pad(Z.config.time_24hr?e:(12+e)%12+12*(e%12==0)),Z.minuteElement.value=Z.pad(t),Z.config.time_24hr||(Z.amPM.textContent=12<=e?"PM":"AM"),!0===Z.config.enableSeconds&&(Z.secondElement.value=Z.pad(n)))}function n(e){var t=e.target.value;e.delta&&(t=(parseInt(t)+e.delta).toString()),4!==t.length&&"Enter"!==e.key||(Z.currentYearElement.blur(),/[^\d]/.test(t)||N(t))}function r(t,n,a){return n instanceof Array?n.forEach(function(e){return r(t,e,a)}):t instanceof Array?t.forEach(function(e){return r(e,n,a)}):(t.addEventListener(n,a),void Z._handlers.push({element:t,event:n,handler:a}))}function o(t){return function(e){return 1===e.which&&t(e)}}function l(){if(Z._handlers=[],Z._animationLoop=[],Z.config.wrap&&["open","close","toggle","clear"].forEach(function(t){Array.prototype.forEach.call(Z.element.querySelectorAll("[data-"+t+"]"),function(e){return r(e,"mousedown",o(Z[t]))})}),Z.isMobile)return function(){var e=Z.config.enableTime?Z.config.noCalendar?"time":"datetime-local":"date";Z.mobileInput=U("input",Z.input.className+" flatpickr-mobile"),Z.mobileInput.step="any",Z.mobileInput.tabIndex=1,Z.mobileInput.type=e,Z.mobileInput.disabled=Z.input.disabled,Z.mobileInput.placeholder=Z.input.placeholder,Z.mobileFormatStr="datetime-local"==e?"Y-m-d\\TH:i:S":"date"==e?"Y-m-d":"H:i:S",Z.selectedDates.length&&(Z.mobileInput.defaultValue=Z.mobileInput.value=Z.formatDate(Z.selectedDates[0],Z.mobileFormatStr)),Z.config.minDate&&(Z.mobileInput.min=Z.formatDate(Z.config.minDate,"Y-m-d")),Z.config.maxDate&&(Z.mobileInput.max=Z.formatDate(Z.config.maxDate,"Y-m-d")),Z.input.type="hidden",Z.config.altInput&&(Z.altInput.type="hidden");try{Z.input.parentNode.insertBefore(Z.mobileInput,Z.input.nextSibling)}catch(e){}Z.mobileInput.addEventListener("change",function(e){Z.setDate(e.target.value,!1,Z.mobileFormatStr),j("Change"),j("Close")})}(),0;Z.debouncedResize=G(S,50),Z.triggerChange=function(){j("Change")},Z.debouncedChange=G(Z.triggerChange,300),"range"===Z.config.mode&&Z.daysContainer&&r(Z.daysContainer,"mouseover",function(e){return I(e.target)}),r(window.document.body,"keydown",T),Z.config.static||r(Z._input,"keydown",T),Z.config.inline||Z.config.static||r(window,"resize",Z.debouncedResize),void 0!==window.ontouchstart&&r(window.document,"touchstart",E),r(window.document,"mousedown",o(E)),r(Z._input,"blur",E),!0===Z.config.clickOpens&&(r(Z._input,"focus",Z.open),r(Z._input,"mousedown",o(Z.open))),Z.config.noCalendar||(Z.monthNav.addEventListener("wheel",function(e){return e.preventDefault()}),r(Z.monthNav,"wheel",G(J,10)),r(Z.monthNav,"mousedown",o(K)),r(Z.monthNav,["keyup","increment"],n),r(Z.daysContainer,"mousedown",o(A)),Z.config.animate&&(r(Z.daysContainer,["webkitAnimationEnd","animationend"],f),r(Z.monthNav,["webkitAnimationEnd","animationend"],m))),Z.config.enableTime&&(r(Z.timeContainer,["wheel","input","increment"],s),r(Z.timeContainer,"mousedown",o(p)),r(Z.timeContainer,["wheel","increment"],Z.debouncedChange),r(Z.timeContainer,"input",Z.triggerChange),r([Z.hourElement,Z.minuteElement],"focus",function(e){return e.target.select()}),void 0!==Z.secondElement&&r(Z.secondElement,"focus",function(){return Z.secondElement.select()}),void 0!==Z.amPM&&r(Z.amPM,"mousedown",o(function(e){s(e),Z.triggerChange(e)})))}function u(){for(var e=Z._animationLoop.length;e--;)Z._animationLoop[e](),Z._animationLoop.splice(e,1)}function f(e){if(1<Z.daysContainer.childNodes.length)switch(e.animationName){case"fpSlideLeft":Z.daysContainer.lastChild.classList.remove("slideLeftNew"),Z.daysContainer.removeChild(Z.daysContainer.firstChild),Z.days=Z.daysContainer.firstChild,u();break;case"fpSlideRight":Z.daysContainer.firstChild.classList.remove("slideRightNew"),Z.daysContainer.removeChild(Z.daysContainer.lastChild),Z.days=Z.daysContainer.firstChild,u()}}function m(e){switch(e.animationName){case"fpSlideLeftNew":case"fpSlideRightNew":Z.navigationCurrentMonth.classList.remove("slideLeftNew"),Z.navigationCurrentMonth.classList.remove("slideRightNew");for(var t=Z.navigationCurrentMonth;t.nextSibling&&/curr/.test(t.nextSibling.className);)Z.monthNav.removeChild(t.nextSibling);for(;t.previousSibling&&/curr/.test(t.previousSibling.className);)Z.monthNav.removeChild(t.previousSibling);Z.oldCurMonth=null}}function g(e){e=e?Z.parseDate(e):Z.latestSelectedDateObj||(Z.config.minDate>Z.now?Z.config.minDate:Z.config.maxDate&&Z.config.maxDate<Z.now?Z.config.maxDate:Z.now);try{Z.currentYear=e.getFullYear(),Z.currentMonth=e.getMonth()}catch(e){}Z.redraw()}function p(e){~e.target.className.indexOf("arrow")&&h(e,e.target.classList.contains("arrowUp")?1:-1)}function h(e,t,n){n=n||e.target.parentNode.childNodes[0],e=H("increment");e.delta=t,n.dispatchEvent(e)}function D(e){var t=U("div","numInputWrapper"),n=U("input","numInput "+e),a=U("span","arrowUp"),e=U("span","arrowDown");return n.type="text",n.pattern="\\d*",t.appendChild(n),t.appendChild(a),t.appendChild(e),t}function v(){var e=window.document.createDocumentFragment();Z.calendarContainer=U("div","flatpickr-calendar"),Z.calendarContainer.tabIndex=-1,Z.config.noCalendar||(e.appendChild(function(){var e=window.document.createDocumentFragment();Z.monthNav=U("div","flatpickr-month"),Z.prevMonthNav=U("span","flatpickr-prev-month"),Z.prevMonthNav.innerHTML=Z.config.prevArrow,Z.currentMonthElement=U("span","cur-month"),Z.currentMonthElement.title=Z.l10n.scrollTitle;var t=D("cur-year");return Z.currentYearElement=t.childNodes[0],Z.currentYearElement.title=Z.l10n.scrollTitle,Z.config.minDate&&(Z.currentYearElement.min=Z.config.minDate.getFullYear()),Z.config.maxDate&&(Z.currentYearElement.max=Z.config.maxDate.getFullYear(),Z.currentYearElement.disabled=Z.config.minDate&&Z.config.minDate.getFullYear()===Z.config.maxDate.getFullYear()),Z.nextMonthNav=U("span","flatpickr-next-month"),Z.nextMonthNav.innerHTML=Z.config.nextArrow,Z.navigationCurrentMonth=U("span","flatpickr-current-month"),Z.navigationCurrentMonth.appendChild(Z.currentMonthElement),Z.navigationCurrentMonth.appendChild(t),e.appendChild(Z.prevMonthNav),e.appendChild(Z.navigationCurrentMonth),e.appendChild(Z.nextMonthNav),Z.monthNav.appendChild(e),Object.defineProperty(Z,"_hidePrevMonthArrow",{get:function(){return this.__hidePrevMonthArrow},set:function(e){this.__hidePrevMonthArrow!==e&&(Z.prevMonthNav.style.display=e?"none":"block"),this.__hidePrevMonthArrow=e}}),Object.defineProperty(Z,"_hideNextMonthArrow",{get:function(){return this.__hideNextMonthArrow},set:function(e){this.__hideNextMonthArrow!==e&&(Z.nextMonthNav.style.display=e?"none":"block"),this.__hideNextMonthArrow=e}}),W(),Z.monthNav}()),Z.innerContainer=U("div","flatpickr-innerContainer"),Z.config.weekNumbers&&Z.innerContainer.appendChild((Z.calendarContainer.classList.add("hasWeeks"),Z.weekWrapper=U("div","flatpickr-weekwrapper"),Z.weekWrapper.appendChild(U("span","flatpickr-weekday",Z.l10n.weekAbbreviation)),Z.weekNumbers=U("div","flatpickr-weeks"),Z.weekWrapper.appendChild(Z.weekNumbers),Z.weekWrapper)),Z.rContainer=U("div","flatpickr-rContainer"),Z.rContainer.appendChild(y()),Z.daysContainer||(Z.daysContainer=U("div","flatpickr-days"),Z.daysContainer.tabIndex=-1),M(),Z.rContainer.appendChild(Z.daysContainer),Z.innerContainer.appendChild(Z.rContainer),e.appendChild(Z.innerContainer)),Z.config.enableTime&&e.appendChild(function(){Z.calendarContainer.classList.add("hasTime"),Z.config.noCalendar&&Z.calendarContainer.classList.add("noCalendar"),Z.timeContainer=U("div","flatpickr-time"),Z.timeContainer.tabIndex=-1;var e=U("span","flatpickr-time-separator",":"),t=D("flatpickr-hour");Z.hourElement=t.childNodes[0];var n=D("flatpickr-minute");Z.minuteElement=n.childNodes[0],Z.hourElement.tabIndex=Z.minuteElement.tabIndex=-1,Z.hourElement.value=Z.pad(Z.latestSelectedDateObj?Z.latestSelectedDateObj.getHours():Z.config.defaultHour),Z.minuteElement.value=Z.pad(Z.latestSelectedDateObj?Z.latestSelectedDateObj.getMinutes():Z.config.defaultMinute),Z.hourElement.step=Z.config.hourIncrement,Z.minuteElement.step=Z.config.minuteIncrement,Z.hourElement.min=Z.config.time_24hr?0:1,Z.hourElement.max=Z.config.time_24hr?23:12,Z.minuteElement.min=0,Z.minuteElement.max=59,Z.hourElement.title=Z.minuteElement.title=Z.l10n.scrollTitle,Z.timeContainer.appendChild(t),Z.timeContainer.appendChild(e),Z.timeContainer.appendChild(n),Z.config.time_24hr&&Z.timeContainer.classList.add("time24hr"),Z.config.enableSeconds&&(Z.timeContainer.classList.add("hasSeconds"),n=D("flatpickr-second"),Z.secondElement=n.childNodes[0],Z.secondElement.value=Z.latestSelectedDateObj?Z.pad(Z.latestSelectedDateObj.getSeconds()):"00",Z.secondElement.step=Z.minuteElement.step,Z.secondElement.min=Z.minuteElement.min,Z.secondElement.max=Z.minuteElement.max,Z.timeContainer.appendChild(U("span","flatpickr-time-separator",":")),Z.timeContainer.appendChild(n));return Z.config.time_24hr||(Z.amPM=U("span","flatpickr-am-pm",["AM","PM"][11<Z.hourElement.value|0]),Z.amPM.title=Z.l10n.toggleTitle,Z.amPM.tabIndex=-1,Z.timeContainer.appendChild(Z.amPM)),Z.timeContainer}()),q(Z.calendarContainer,"rangeMode","range"===Z.config.mode),q(Z.calendarContainer,"animate",Z.config.animate),Z.calendarContainer.appendChild(e);var t=Z.config.appendTo&&Z.config.appendTo.nodeType;if(Z.config.inline||Z.config.static){if(Z.calendarContainer.classList.add(Z.config.inline?"inline":"static"),Z.config.inline&&!t)return Z.element.parentNode.insertBefore(Z.calendarContainer,Z._input.nextSibling);if(Z.config.static){e=U("div","flatpickr-wrapper");return Z.element.parentNode.insertBefore(e,Z.element),e.appendChild(Z.element),Z.altInput&&e.appendChild(Z.altInput),e.appendChild(Z.calendarContainer),0}}(t?Z.config.appendTo:window.document.body).appendChild(Z.calendarContainer)}function C(e,t,n,a){var i=_(t,!0),r=U("span","flatpickr-day "+e,t.getDate());return r.dateObj=t,r.$i=a,r.setAttribute("aria-label",Z.formatDate(t,Z.config.ariaDateFormat)),0===V(t,Z.now)&&(Z.todayDateElem=r).classList.add("today"),i?(r.tabIndex=-1,R(t)&&(r.classList.add("selected"),Z.selectedDateElem=r,"range"===Z.config.mode&&(q(r,"startRange",0===V(t,Z.selectedDates[0])),q(r,"endRange",0===V(t,Z.selectedDates[1]))))):(r.classList.add("disabled"),Z.selectedDates[0]&&t>Z.minRangeDate&&t<Z.selectedDates[0]?Z.minRangeDate=t:Z.selectedDates[0]&&t<Z.maxRangeDate&&t>Z.selectedDates[0]&&(Z.maxRangeDate=t)),"range"===Z.config.mode&&(i=t,!("range"!==Z.config.mode||Z.selectedDates.length<2)&&0<=V(i,Z.selectedDates[0])&&V(i,Z.selectedDates[1])<=0&&!R(t)&&r.classList.add("inRange"),1===Z.selectedDates.length&&(t<Z.minRangeDate||t>Z.maxRangeDate)&&r.classList.add("notAllowed")),Z.config.weekNumbers&&"prevMonthDay"!==e&&n%7==1&&Z.weekNumbers.insertAdjacentHTML("beforeend","<span class='disabled flatpickr-day'>"+Z.config.getWeek(t)+"</span>"),j("DayCreate",r),r}function w(e,t){var n=e+t||0,a=void 0!==e?Z.days.childNodes[n]:Z.selectedDateElem||Z.todayDateElem||Z.days.childNodes[0],e=function(){(a=a||Z.days.childNodes[n]).focus(),"range"===Z.config.mode&&I(a)};if(void 0===a&&0!==t)return 0<t?(Z.changeMonth(1),n%=42):t<0&&(Z.changeMonth(-1),n+=42),b(e);e()}function b(e){if(!0===Z.config.animate)return Z._animationLoop.push(e);e()}function M(e){var t=(new Date(Z.currentYear,Z.currentMonth,1).getDay()-Z.l10n.firstDayOfWeek+7)%7,n="range"===Z.config.mode;Z.prevMonthDays=Z.utils.getDaysinMonth((Z.currentMonth-1+12)%12),Z.selectedDateElem=void 0,Z.todayDateElem=void 0;var a=Z.utils.getDaysinMonth(),i=window.document.createDocumentFragment(),r=Z.prevMonthDays+1-t,o=0;for(Z.config.weekNumbers&&Z.weekNumbers.firstChild&&(Z.weekNumbers.textContent=""),n&&(Z.minRangeDate=new Date(Z.currentYear,Z.currentMonth-1,r),Z.maxRangeDate=new Date(Z.currentYear,Z.currentMonth+1,(42-t)%a));r<=Z.prevMonthDays;r++,o++)i.appendChild(C("prevMonthDay",new Date(Z.currentYear,Z.currentMonth-1,r),r,o));for(r=1;r<=a;r++,o++)i.appendChild(C("",new Date(Z.currentYear,Z.currentMonth,r),r,o));for(var l=a+1;l<=42-t;l++,o++)i.appendChild(C("nextMonthDay",new Date(Z.currentYear,Z.currentMonth+1,l%a),l,o));n&&1===Z.selectedDates.length&&i.childNodes[0]?(Z._hidePrevMonthArrow=Z._hidePrevMonthArrow||Z.minRangeDate>i.childNodes[0].dateObj,Z._hideNextMonthArrow=Z._hideNextMonthArrow||Z.maxRangeDate<new Date(Z.currentYear,Z.currentMonth+1,1)):W();n=U("div","dayContainer");if(n.appendChild(i),Z.config.animate&&void 0!==e)for(;1<Z.daysContainer.childNodes.length;)Z.daysContainer.removeChild(Z.daysContainer.firstChild);else!function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(Z.daysContainer);return 0<=e?Z.daysContainer.appendChild(n):Z.daysContainer.insertBefore(n,Z.daysContainer.firstChild),Z.days=Z.daysContainer.firstChild,Z.daysContainer}function y(){Z.weekdayContainer||(Z.weekdayContainer=U("div","flatpickr-weekdays"));var e=Z.l10n.firstDayOfWeek,t=Z.l10n.weekdays.shorthand.slice();return 0<e&&e<t.length&&(t=[].concat(t.splice(e,t.length),t.splice(0,e))),Z.weekdayContainer.innerHTML="\n\t\t<span class=flatpickr-weekday>\n\t\t\t"+t.join("</span><span class=flatpickr-weekday>")+"\n\t\t</span>\n\t\t",Z.weekdayContainer}function k(e,t,n){e=(t=void 0===t||t)?e:e-Z.currentMonth,n=!Z.config.animate||!1===n;if(!(e<0&&Z._hidePrevMonthArrow||0<e&&Z._hideNextMonthArrow)){if(Z.currentMonth+=e,(Z.currentMonth<0||11<Z.currentMonth)&&(Z.currentYear+=11<Z.currentMonth?1:-1,Z.currentMonth=(Z.currentMonth+12)%12,j("YearChange")),M(n?void 0:e),n)return j("MonthChange"),W();var a,i=Z.navigationCurrentMonth;if(e<0)for(;i.nextSibling&&/curr/.test(i.nextSibling.className);)Z.monthNav.removeChild(i.nextSibling);else if(0<e)for(;i.previousSibling&&/curr/.test(i.previousSibling.className);)Z.monthNav.removeChild(i.previousSibling);Z.oldCurMonth=Z.navigationCurrentMonth,Z.navigationCurrentMonth=Z.monthNav.insertBefore(Z.oldCurMonth.cloneNode(!0),0<e?Z.oldCurMonth.nextSibling:Z.oldCurMonth),0<e?(Z.daysContainer.firstChild.classList.add("slideLeft"),Z.daysContainer.lastChild.classList.add("slideLeftNew"),Z.oldCurMonth.classList.add("slideLeft"),Z.navigationCurrentMonth.classList.add("slideLeftNew")):e<0&&(Z.daysContainer.firstChild.classList.add("slideRightNew"),Z.daysContainer.lastChild.classList.add("slideRight"),Z.oldCurMonth.classList.add("slideRight"),Z.navigationCurrentMonth.classList.add("slideRightNew")),Z.currentMonthElement=Z.navigationCurrentMonth.firstChild,Z.currentYearElement=Z.navigationCurrentMonth.lastChild.childNodes[0],W(),Z.oldCurMonth.firstChild.textContent=Z.utils.monthToStr(Z.currentMonth-e),j("MonthChange"),document.activeElement&&document.activeElement.$i&&(a=document.activeElement.$i,b(function(){w(a,0)}))}}function x(e){return!(!Z.config.appendTo||!Z.config.appendTo.contains(e))||Z.calendarContainer.contains(e)}function E(e){var t,n;Z.isOpen&&!Z.config.inline&&(t=x(e.target),n=e.target===Z.input||e.target===Z.altInput||Z.element.contains(e.target)||e.path&&e.path.indexOf&&(~e.path.indexOf(Z.input)||~e.path.indexOf(Z.altInput)),("blur"===e.type?!n||!e.relatedTarget||x(e.relatedTarget):n||t)||-1!==Z.config.ignoredFocusElements.indexOf(e.target)||(Z.close(),"range"===Z.config.mode&&1===Z.selectedDates.length&&(Z.clear(!1),Z.redraw())))}function N(e){var t;!e||Z.currentYearElement.min&&e<Z.currentYearElement.min||Z.currentYearElement.max&&e>Z.currentYearElement.max||(t=parseInt(e,10),e=Z.currentYear!==t,Z.currentYear=t||Z.currentYear,Z.config.maxDate&&Z.currentYear===Z.config.maxDate.getFullYear()?Z.currentMonth=Math.min(Z.config.maxDate.getMonth(),Z.currentMonth):Z.config.minDate&&Z.currentYear===Z.config.minDate.getFullYear()&&(Z.currentMonth=Math.max(Z.config.minDate.getMonth(),Z.currentMonth)),e&&(Z.redraw(),j("YearChange")))}function _(e,t){if(Z.config.minDate&&V(e,Z.config.minDate,void 0!==t?t:!Z.minDateHasTime)<0||Z.config.maxDate&&0<V(e,Z.config.maxDate,void 0!==t?t:!Z.maxDateHasTime))return!1;if(!Z.config.enable.length&&!Z.config.disable.length)return!0;for(var n,a=Z.parseDate(e,null,!0),i=0<Z.config.enable.length,r=i?Z.config.enable:Z.config.disable,o=0;o<r.length;o++){if((n=r[o])instanceof Function&&n(a))return i;if(n instanceof Date&&n.getTime()===a.getTime())return i;if("string"==typeof n&&Z.parseDate(n,null,!0).getTime()===a.getTime())return i;if("object"===(void 0===n?"undefined":_typeof(n))&&n.from&&n.to&&a>=n.from&&a<=n.to)return i}return!i}function T(e){var t=e.target===Z._input,n=x(e.target),a=Z.config.allowInput,i=Z.isOpen&&(!a||!t),r=Z.config.inline&&t&&!a;if("Enter"===e.key&&a&&t)return Z.setDate(Z._input.value,!0,e.target===Z.altInput?Z.config.altFormat:Z.config.dateFormat),e.target.blur();if(n||i||r){var o=Z.timeContainer&&Z.timeContainer.contains(e.target);switch(e.key){case"Enter":o?B():A(e);break;case"Escape":e.preventDefault(),Z.close();break;case"ArrowLeft":case"ArrowRight":o||(e.preventDefault(),Z.daysContainer?(l="ArrowRight"===e.key?1:-1,e.ctrlKey?k(l,!0):w(e.target.$i,l)):Z.config.enableTime&&!o&&Z.hourElement.focus());break;case"ArrowUp":case"ArrowDown":e.preventDefault();var l="ArrowDown"===e.key?1:-1;Z.daysContainer?e.ctrlKey?(N(Z.currentYear-l),w(e.target.$i,0)):o||w(e.target.$i,7*l):Z.config.enableTime&&(o||Z.hourElement.focus(),s(e));break;case"Tab":e.target===Z.hourElement?(e.preventDefault(),Z.minuteElement.select()):e.target===Z.minuteElement&&(Z.secondElement||Z.amPM)?(e.preventDefault(),(Z.secondElement||Z.amPM).focus()):e.target===Z.secondElement&&(e.preventDefault(),Z.amPM.focus());break;case"a":e.target===Z.amPM&&(Z.amPM.textContent="AM",d(),B());break;case"p":e.target===Z.amPM&&(Z.amPM.textContent="PM",d(),B())}j("KeyDown",e)}}function I(i){if(1===Z.selectedDates.length&&i.classList.contains("flatpickr-day")){for(var r=i.dateObj,o=Z.parseDate(Z.selectedDates[0],null,!0),l=Math.min(r.getTime(),Z.selectedDates[0].getTime()),c=Math.max(r.getTime(),Z.selectedDates[0].getTime()),s=!1,e=l;e<c;e+=Z.utils.duration.DAY)if(!_(new Date(e))){s=!0;break}for(var t=Z.days.childNodes[0].dateObj.getTime(),n=0;n<42;n++,t+=Z.utils.duration.DAY)!function(e,t){var n=e<Z.minRangeDate.getTime()||e>Z.maxRangeDate.getTime(),a=Z.days.childNodes[t];if(n)return Z.days.childNodes[t].classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(e){a.classList.remove(e)});if(s&&!n)return;["startRange","inRange","endRange","notAllowed"].forEach(function(e){a.classList.remove(e)});t=Math.max(Z.minRangeDate.getTime(),l),n=Math.min(Z.maxRangeDate.getTime(),c);i.classList.add(r<Z.selectedDates[0]?"startRange":"endRange"),o<r&&e===o.getTime()?a.classList.add("startRange"):r<o&&e===o.getTime()&&a.classList.add("endRange"),t<=e&&e<=n&&a.classList.add("inRange")}(t,n)}}function S(){!Z.isOpen||Z.config.static||Z.config.inline||Y()}function F(a){return function(e){var t=Z.config["_"+a+"Date"]=Z.parseDate(e),n=Z.config["_"+("min"===a?"max":"min")+"Date"],e=e&&t instanceof Date;e&&(Z[a+"DateHasTime"]=t.getHours()||t.getMinutes()||t.getSeconds()),Z.selectedDates&&(Z.selectedDates=Z.selectedDates.filter(function(e){return _(e)}),Z.selectedDates.length||"min"!==a||i(t),B()),Z.daysContainer&&(O(),e?Z.currentYearElement[a]=t.getFullYear():Z.currentYearElement.removeAttribute(a),Z.currentYearElement.disabled=n&&t&&n.getFullYear()===t.getFullYear())}}function Y(e){var t,n,a,i,r,o=0<arguments.length&&void 0!==e?e:Z._positionElement;void 0!==Z.calendarContainer&&(t=Z.calendarContainer.offsetHeight,r=Z.calendarContainer.offsetWidth,n=Z.config.position,i=o.getBoundingClientRect(),a=window.innerHeight-i.bottom,a="above"===n||"below"!==n&&a<t&&i.top>t,o=window.pageYOffset+i.top+(a?-t-2:o.offsetHeight+2),q(Z.calendarContainer,"arrowTop",!a),q(Z.calendarContainer,"arrowBottom",a),Z.config.inline||(a=window.pageXOffset+i.left,i=window.document.body.offsetWidth-i.right,r=a+r>window.document.body.offsetWidth,q(Z.calendarContainer,"rightMost",r),Z.config.static||(Z.calendarContainer.style.top=o+"px",r?(Z.calendarContainer.style.left="auto",Z.calendarContainer.style.right=i+"px"):(Z.calendarContainer.style.left=a+"px",Z.calendarContainer.style.right="auto"))))}function O(){Z.config.noCalendar||Z.isMobile||(y(),W(),M())}function A(e){var t,n,a;e.preventDefault(),e.stopPropagation(),!e.target.classList.contains("flatpickr-day")||e.target.classList.contains("disabled")||e.target.classList.contains("notAllowed")||(a=(t=Z.latestSelectedDateObj=new Date(e.target.dateObj.getTime())).getMonth()!==Z.currentMonth&&"range"!==Z.config.mode,Z.selectedDateElem=e.target,"single"===Z.config.mode?Z.selectedDates=[t]:"multiple"===Z.config.mode?(n=R(t))?Z.selectedDates.splice(n,1):Z.selectedDates.push(t):"range"===Z.config.mode&&(2===Z.selectedDates.length&&Z.clear(),Z.selectedDates.push(t),0!==V(t,Z.selectedDates[0],!0)&&Z.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()})),d(),a&&(n=Z.currentYear!==t.getFullYear(),Z.currentYear=t.getFullYear(),Z.currentMonth=t.getMonth(),n&&j("YearChange"),j("MonthChange")),M(),Z.minDateHasTime&&Z.config.enableTime&&0===V(t,Z.config.minDate)&&i(Z.config.minDate),B(),Z.config.enableTime&&setTimeout(function(){return Z.showTimeInput=!0},50),"range"===Z.config.mode&&(1===Z.selectedDates.length?(I(e.target),Z._hidePrevMonthArrow=Z._hidePrevMonthArrow||Z.minRangeDate>Z.days.childNodes[0].dateObj,Z._hideNextMonthArrow=Z._hideNextMonthArrow||Z.maxRangeDate<new Date(Z.currentYear,Z.currentMonth+1,1)):W()),j("Change"),a?b(function(){return Z.selectedDateElem.focus()}):w(e.target.$i,0),Z.config.enableTime&&setTimeout(function(){return Z.hourElement.select()},451),Z.config.closeOnSelect&&(a="single"===Z.config.mode&&!Z.config.enableTime,e="range"===Z.config.mode&&2===Z.selectedDates.length&&!Z.config.enableTime,(a||e)&&Z.close()))}function L(e,t){if(e instanceof Array)Z.selectedDates=e.map(function(e){return Z.parseDate(e,t)});else if(e instanceof Date||!isNaN(e))Z.selectedDates=[Z.parseDate(e,t)];else if(e&&e.substring)switch(Z.config.mode){case"single":Z.selectedDates=[Z.parseDate(e,t)];break;case"multiple":Z.selectedDates=e.split("; ").map(function(e){return Z.parseDate(e,t)});break;case"range":Z.selectedDates=e.split(Z.l10n.rangeSeparator).map(function(e){return Z.parseDate(e,t)})}Z.selectedDates=Z.selectedDates.filter(function(e){return e instanceof Date&&_(e,!1)}),Z.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()})}function P(e){for(var t=e.length;t--;)"string"==typeof e[t]||+e[t]?e[t]=Z.parseDate(e[t],null,!0):e[t]&&e[t].from&&e[t].to&&(e[t].from=Z.parseDate(e[t].from),e[t].to=Z.parseDate(e[t].to));return e.filter(function(e){return e})}function j(e,t){var n=Z.config["on"+e];if(void 0!==n&&0<n.length)for(var a=0;n[a]&&a<n.length;a++)n[a](Z.selectedDates,Z.input.value,Z,t);"Change"===e&&(Z.input.dispatchEvent(H("change")),Z.input.dispatchEvent(H("input")))}function H(e){return Z._supportsEvents?new Event(e,{bubbles:!0}):(Z._[e+"Event"]=document.createEvent("Event"),Z._[e+"Event"].initEvent(e,!0,!0),Z._[e+"Event"])}function R(e){for(var t=0;t<Z.selectedDates.length;t++)if(0===V(Z.selectedDates[t],e))return""+t;return!1}function W(){Z.config.noCalendar||Z.isMobile||!Z.monthNav||(Z.currentMonthElement.textContent=Z.utils.monthToStr(Z.currentMonth)+" ",Z.currentYearElement.value=Z.currentYear,Z._hidePrevMonthArrow=Z.config.minDate&&(Z.currentYear===Z.config.minDate.getFullYear()?Z.currentMonth<=Z.config.minDate.getMonth():Z.currentYear<Z.config.minDate.getFullYear()),Z._hideNextMonthArrow=Z.config.maxDate&&(Z.currentYear===Z.config.maxDate.getFullYear()?Z.currentMonth+1>Z.config.maxDate.getMonth():Z.currentYear>Z.config.maxDate.getFullYear()))}function B(e){if(!Z.selectedDates.length)return Z.clear(e);Z.isMobile&&(Z.mobileInput.value=Z.selectedDates.length?Z.formatDate(Z.latestSelectedDateObj,Z.mobileFormatStr):"");var t="range"!==Z.config.mode?"; ":Z.l10n.rangeSeparator;Z.input.value=Z.selectedDates.map(function(e){return Z.formatDate(e,Z.config.dateFormat)}).join(t),Z.config.altInput&&(Z.altInput.value=Z.selectedDates.map(function(e){return Z.formatDate(e,Z.config.altFormat)}).join(t)),!1!==e&&j("ValueUpdate")}function J(e){e.preventDefault();var t,n=Z.currentYearElement.parentNode.contains(e.target);e.target!==Z.currentMonthElement&&!n||(t=e,t=Math.max(-1,Math.min(1,t.wheelDelta||-t.deltaY)),n?(N(Z.currentYear+t),e.target.value=Z.currentYear):Z.changeMonth(t,!0,!1))}function K(e){var t=Z.prevMonthNav.contains(e.target),n=Z.nextMonthNav.contains(e.target);t||n?k(t?-1:1):e.target===Z.currentYearElement?(e.preventDefault(),Z.currentYearElement.select()):"arrowUp"===e.target.className?Z.changeYear(Z.currentYear+1):"arrowDown"===e.target.className&&Z.changeYear(Z.currentYear-1)}function U(e,t,n){e=window.document.createElement(e);return t=t||"",n=n||"",e.className=t,void 0!==n&&(e.textContent=n),e}function z(e){return e instanceof Array?e:[e]}function q(e,t,n){if(n)return e.classList.add(t);e.classList.remove(t)}function G(n,a,i){var r=void 0;return function(){var e=this,t=arguments;clearTimeout(r),r=setTimeout(function(){r=null,i||n.apply(e,t)},a),i&&!r&&n.apply(e,t)}}function V(e,t,n){return e instanceof Date&&t instanceof Date&&(!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime())}var Z=this;return Z._={},Z._.afterDayAnim=b,Z._bind=r,Z._compareDates=V,Z._setHoursFromDate=i,Z.changeMonth=k,Z.changeYear=N,Z.clear=function(e){Z.input.value="",Z.altInput&&(Z.altInput.value=""),Z.mobileInput&&(Z.mobileInput.value=""),Z.selectedDates=[],Z.latestSelectedDateObj=void 0,Z.showTimeInput=!1,Z.redraw(),!1!==e&&j("Change")},Z.close=function(){Z.isOpen=!1,Z.isMobile||(Z.calendarContainer.classList.remove("open"),Z._input.classList.remove("active")),j("Close")},Z._createElement=U,Z.destroy=function(){void 0!==Z.config&&j("Destroy");for(var e=Z._handlers.length;e--;){var t=Z._handlers[e];t.element.removeEventListener(t.event,t.handler)}Z._handlers=[],Z.mobileInput?(Z.mobileInput.parentNode&&Z.mobileInput.parentNode.removeChild(Z.mobileInput),Z.mobileInput=null):Z.calendarContainer&&Z.calendarContainer.parentNode&&Z.calendarContainer.parentNode.removeChild(Z.calendarContainer),Z.altInput&&(Z.input.type="text",Z.altInput.parentNode&&Z.altInput.parentNode.removeChild(Z.altInput),delete Z.altInput),Z.input&&(Z.input.type=Z.input._type,Z.input.classList.remove("flatpickr-input"),Z.input.removeAttribute("readonly"),Z.input.value=""),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(e){return delete Z[e]})},Z.isEnabled=_,Z.jumpToDate=g,Z.open=function(e,t){if(Z.isMobile)return e&&(e.preventDefault(),e.target.blur()),setTimeout(function(){Z.mobileInput.click()},0),void j("Open");Z.isOpen||Z._input.disabled||Z.config.inline||(Z.isOpen=!0,Z.calendarContainer.classList.add("open"),Y(t),Z._input.classList.add("active"),j("Open"))},Z.redraw=O,Z.set=function(e,t){Z.config[e]=t,Z.redraw(),g()},Z.setDate=function(e,t,n){if(0!==e&&!e)return Z.clear(t);L(e,n),Z.showTimeInput=0<Z.selectedDates.length,Z.latestSelectedDateObj=Z.selectedDates[0],Z.redraw(),g(),i(),B(t),t&&j("Change")},Z.toggle=function(){if(Z.isOpen)return Z.close();Z.open()},Z.element=Z.input=e,Z.instanceConfig=t||{},Z.parseDate=FlatpickrInstance.prototype.parseDate.bind(Z),Z.formatDate=FlatpickrInstance.prototype.formatDate.bind(Z),Z.formats=Object.create(FlatpickrInstance.prototype.formats),["D","F","J","M","W","l"].forEach(function(e){Z.formats[e]=FlatpickrInstance.prototype.formats[e].bind(Z)}),Z.revFormat.F=FlatpickrInstance.prototype.revFormat.F.bind(Z),Z.revFormat.M=FlatpickrInstance.prototype.revFormat.M.bind(Z),function(){var e=["wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange"];Z.config=Object.create(flatpickr.defaultConfig);var n=_extends({},Z.instanceConfig,JSON.parse(JSON.stringify(Z.element.dataset||{})));Z.config.parseDate=n.parseDate,Z.config.formatDate=n.formatDate,Object.defineProperty(Z.config,"enable",{get:function(){return Z.config._enable||[]},set:function(e){return Z.config._enable=P(e)}}),Object.defineProperty(Z.config,"disable",{get:function(){return Z.config._disable||[]},set:function(e){return Z.config._disable=P(e)}}),_extends(Z.config,n),!n.dateFormat&&n.enableTime&&(Z.config.dateFormat=Z.config.noCalendar?"H:i"+(Z.config.enableSeconds?":S":""):flatpickr.defaultConfig.dateFormat+" H:i"+(Z.config.enableSeconds?":S":"")),n.altInput&&n.enableTime&&!n.altFormat&&(Z.config.altFormat=Z.config.noCalendar?"h:i"+(Z.config.enableSeconds?":S K":" K"):flatpickr.defaultConfig.altFormat+" h:i"+(Z.config.enableSeconds?":S":"")+" K"),Object.defineProperty(Z.config,"minDate",{get:function(){return this._minDate},set:F("min")}),Object.defineProperty(Z.config,"maxDate",{get:function(){return this._maxDate},set:F("max")}),Z.config.minDate=n.minDate,Z.config.maxDate=n.maxDate;for(var a=0;a<e.length;a++)Z.config[e[a]]=!0===Z.config[e[a]]||"true"===Z.config[e[a]];for(var i=t.length;i--;)void 0!==Z.config[t[i]]&&(Z.config[t[i]]=z(Z.config[t[i]]||[]).map(c));for(var r=0;r<Z.config.plugins.length;r++){var o,l=Z.config.plugins[r](Z)||{};for(o in l)Z.config[o]instanceof Array||~t.indexOf(o)?Z.config[o]=z(l[o]).map(c).concat(Z.config[o]):void 0===n[o]&&(Z.config[o]=l[o])}j("ParseConfig")}(),"object"!==_typeof(Z.config.locale)&&flatpickr.l10ns[Z.config.locale],Z.l10n=_extends(Object.create(flatpickr.l10ns.default),"object"===_typeof(Z.config.locale)?Z.config.locale:"default"!==Z.config.locale&&flatpickr.l10ns[Z.config.locale]||{}),Z.input=Z.config.wrap?Z.element.querySelector("[data-input]"):Z.element,Z.input&&(Z.input._type=Z.input.type,Z.input.type="text",Z.input.classList.add("flatpickr-input"),Z._input=Z.input,Z.config.altInput&&(Z.altInput=U(Z.input.nodeName,Z.input.className+" "+Z.config.altInputClass),Z._input=Z.altInput,Z.altInput.placeholder=Z.input.placeholder,Z.altInput.disabled=Z.input.disabled,Z.altInput.required=Z.input.required,Z.altInput.type="text",Z.input.type="hidden",!Z.config.static&&Z.input.parentNode&&Z.input.parentNode.insertBefore(Z.altInput,Z.input.nextSibling)),Z.config.allowInput||Z._input.setAttribute("readonly","readonly"),Z._positionElement=Z.config.positionElement||Z._input),function(){Z.selectedDates=[],Z.now=new Date;var e=Z.config.defaultDate||Z.input.value;e&&L(e,Z.config.dateFormat),e=Z.selectedDates.length?Z.selectedDates[0]:Z.config.minDate&&Z.config.minDate.getTime()>Z.now?Z.config.minDate:Z.config.maxDate&&Z.config.maxDate.getTime()<Z.now?Z.config.maxDate:Z.now,Z.currentYear=e.getFullYear(),Z.currentMonth=e.getMonth(),Z.selectedDates.length&&(Z.latestSelectedDateObj=Z.selectedDates[0]),Z.minDateHasTime=Z.config.minDate&&(Z.config.minDate.getHours()||Z.config.minDate.getMinutes()||Z.config.minDate.getSeconds()),Z.maxDateHasTime=Z.config.maxDate&&(Z.config.maxDate.getHours()||Z.config.maxDate.getMinutes()||Z.config.maxDate.getSeconds()),Object.defineProperty(Z,"latestSelectedDateObj",{get:function(){return Z._selectedDateObj||Z.selectedDates[Z.selectedDates.length-1]},set:function(e){Z._selectedDateObj=e}}),Z.isMobile||Object.defineProperty(Z,"showTimeInput",{get:function(){return Z._showTimeInput},set:function(e){Z._showTimeInput=e,Z.calendarContainer&&q(Z.calendarContainer,"showTimeInput",e),Y()}})}(),Z.utils={duration:{DAY:864e5},getDaysinMonth:function(e,t){return e=void 0===e?Z.currentMonth:e,t=void 0===t?Z.currentYear:t,1===e&&(t%4==0&&t%100!=0||t%400==0)?29:Z.l10n.daysInMonth[e]},monthToStr:function(e,t){return t=void 0===t?Z.config.shorthandCurrentMonth:t,Z.l10n.months[(t?"short":"long")+"hand"][e]}},Z.isOpen=!1,Z.isMobile=!Z.config.disableMobile&&!Z.config.inline&&"single"===Z.config.mode&&!Z.config.disable.length&&!Z.config.enable.length&&!Z.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Z.isMobile||v(),l(),(Z.selectedDates.length||Z.config.noCalendar)&&(Z.config.enableTime&&i(Z.config.noCalendar?Z.latestSelectedDateObj||Z.config.minDate:null),B()),Z.showTimeInput=0<Z.selectedDates.length||Z.config.noCalendar,Z.config.weekNumbers&&(Z.calendarContainer.style.width=Z.daysContainer.offsetWidth+Z.weekWrapper.offsetWidth+"px"),Z.isMobile||Y(),j("Ready"),Z}function _flatpickr(e,t){for(var n=Array.prototype.slice.call(e),a=[],i=0;i<n.length;i++)try{if(null!==n[i].getAttribute("data-fp-omit"))continue;n[i]._flatpickr&&(n[i]._flatpickr.destroy(),n[i]._flatpickr=null),n[i]._flatpickr=new FlatpickrInstance(n[i],t||{}),a.push(n[i]._flatpickr)}catch(e){}return 1===a.length?a[0]:a}function flatpickr(e,t){return e instanceof NodeList?_flatpickr(e,t):e instanceof HTMLElement?_flatpickr([e],t):_flatpickr(window.document.querySelectorAll(e),t)}var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,a=arguments[t];for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};FlatpickrInstance.prototype={formats:{Z:function(e){return e.toISOString()},D:function(e){return this.l10n.weekdays.shorthand[this.formats.w(e)]},F:function(e){return this.utils.monthToStr(this.formats.n(e)-1,!1)},G:function(e){return FlatpickrInstance.prototype.pad(FlatpickrInstance.prototype.formats.h(e))},H:function(e){return FlatpickrInstance.prototype.pad(e.getHours())},J:function(e){return e.getDate()+this.l10n.ordinal(e.getDate())},K:function(e){return 11<e.getHours()?"PM":"AM"},M:function(e){return this.utils.monthToStr(e.getMonth(),!0)},S:function(e){return FlatpickrInstance.prototype.pad(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e){return this.config.getWeek(e)},Y:function(e){return e.getFullYear()},d:function(e){return FlatpickrInstance.prototype.pad(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return FlatpickrInstance.prototype.pad(e.getMinutes())},j:function(e){return e.getDate()},l:function(e){return this.l10n.weekdays.longhand[e.getDay()]},m:function(e){return FlatpickrInstance.prototype.pad(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},formatDate:function(a,e){var i=this;return void 0!==this.config&&void 0!==this.config.formatDate?this.config.formatDate(a,e):e.split("").map(function(e,t,n){return i.formats[e]&&"\\"!==n[t-1]?i.formats[e](a):"\\"!==e?e:""}).join("")},revFormat:{D:function(){},F:function(e,t){e.setMonth(this.l10n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t){var n=e.getHours();12!==n&&e.setHours(n%12+12*/pm/i.test(t))},M:function(e,t){e.setMonth(this.l10n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(t)},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t){return t=parseInt(t),new Date(e.getFullYear(),0,2+7*(t-1),0,0,0,0,0)},Y:function(e,t){e.setFullYear(t)},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:function(){},m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},w:function(){},y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},tokenRegex:{D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"(am|AM|Am|aM|pm|PM|Pm|pM)",M:"(\\w+)",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:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},pad:function(e){return("0"+e).slice(-2)},parseDate:function(e,t,n){if(0!==e&&!e)return null;if(e instanceof Date)e=new Date(e.getTime());else if(void 0!==e.toFixed)e=new Date(e);else{var a=t||(this.config||flatpickr.defaultConfig).dateFormat;if("today"===(e=String(e).trim()))e=new Date,n=!0;else if(/Z$/.test(e)||/GMT$/.test(e))e=new Date(e);else if(this.config&&this.config.parseDate)e=this.config.parseDate(e,a);else{for(var i=this.config&&this.config.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),r=void 0,o=0,l=0,c="";o<a.length;o++){var s=a[o],d="\\"===s,u="\\"===a[o-1]||d;this.tokenRegex[s]&&!u?(c+=this.tokenRegex[s],(u=new RegExp(c).exec(e))&&(r=!0)&&(i=this.revFormat[s](i,u[++l])||i)):d||(c+=".")}e=r?i:null}}return e instanceof Date?(!0===n&&e.setHours(0,0,0,0),e):null}},"undefined"!=typeof HTMLElement&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return _flatpickr(this,e)},HTMLElement.prototype.flatpickr=function(e){return _flatpickr([this],e)}),flatpickr.defaultConfig=FlatpickrInstance.defaultConfig={mode:"single",position:"auto",animate:-1===window.navigator.userAgent.indexOf("MSIE"),wrap:!1,weekNumbers:!1,allowInput:!1,clickOpens:!0,closeOnSelect:!0,time_24hr:!1,enableTime:!1,noCalendar:!1,dateFormat:"Y-m-d",ariaDateFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",altFormat:"F j, Y",defaultDate:null,minDate:null,maxDate:null,parseDate:null,formatDate:null,getWeek:function(e){var t=new Date(e.getTime()),e=new Date(t.getFullYear(),0,1);return Math.ceil(((t-e)/864e5+e.getDay()+1)/7)},enable:[],disable:[],shorthandCurrentMonth:!1,inline:!1,static:!1,appendTo:null,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",enableSeconds:!1,hourIncrement:1,minuteIncrement:5,defaultHour:12,defaultMinute:0,disableMobile:!1,locale:"default",plugins:[],ignoredFocusElements:[],onClose:void 0,onChange:void 0,onDayCreate:void 0,onMonthChange:void 0,onOpen:void 0,onParseConfig:void 0,onReady:void 0,onValueUpdate:void 0,onYearChange:void 0,onKeyDown:void 0,onDestroy:void 0},flatpickr.l10ns={en:{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){e%=100;if(3<e&&e<21)return"th";switch(e%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"}},flatpickr.l10ns.default=Object.create(flatpickr.l10ns.en),flatpickr.localize=function(e){return _extends(flatpickr.l10ns.default,e||{})},flatpickr.setDefaults=function(e){return _extends(flatpickr.defaultConfig,e||{})},"undefined"!=typeof jQuery&&(jQuery.fn.flatpickr=function(e){return _flatpickr(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+parseInt(e,10))},"undefined"!=typeof module&&(module.exports=flatpickr);
assets/js/suggest-sidebars.min.js CHANGED
@@ -4,4 +4,4 @@
4
  * @license GPLv3
5
  * @copyright 2019 by Joachim Jensen
6
  */
7
- !function($){"use strict";var e={init:function(){this.suggestSidebars(),this.toggleSidebarInputs()},toggleSidebarInputs:function(){$(".js-cas-more").click(function(e){e.preventDefault();var t=$(this),n=$(t.data("toggle")),a=t.children(":first");a.hasClass("dashicons-arrow-down-alt2")?(a.addClass("dashicons-arrow-up-alt2").removeClass("dashicons-arrow-down-alt2"),n.slideDown()):(a.addClass("dashicons-arrow-down-alt2").removeClass("dashicons-arrow-up-alt2"),n.slideUp())})},suggestSidebars:function(){$(".js-cas-sidebars").each(function(){$(this).select2({theme:"wpca",minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"100%",escapeMarkup:function(e){return e},createTag:function(e){var t=$.trim(e.term);return""===t?null:{id:"_"+t.replace(/,/g,"__"),text:t,new:!0}},templateSelection:function(e){return(e.new?"<b>("+CAS.labelNew+")</b> ":"")+e.text},templateResult:function(e){return(e.new?"<b>"+CAS.createNew+":</b> ":"")+e.text},templateNoMatches:function(e){return CAS.notFound}})})}};$(document).ready(function(){e.init()})}(jQuery);
4
  * @license GPLv3
5
  * @copyright 2019 by Joachim Jensen
6
  */
7
+ !function($){"use strict";var e={init:function(){this.suggestSidebars(),this.toggleSidebarInputs()},toggleSidebarInputs:function(){$(".js-cas-more").click(function(e){e.preventDefault();var t=$(this),e=$(t.data("toggle")),t=t.children(":first");t.hasClass("dashicons-arrow-down-alt2")?(t.addClass("dashicons-arrow-up-alt2").removeClass("dashicons-arrow-down-alt2"),e.slideDown()):(t.addClass("dashicons-arrow-down-alt2").removeClass("dashicons-arrow-up-alt2"),e.slideUp())})},suggestSidebars:function(){$(".js-cas-sidebars").each(function(){$(this).select2({theme:"wpca",minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"100%",escapeMarkup:function(e){return e},createTag:function(e){e=$.trim(e.term);return""===e?null:{id:"_"+e.replace(/,/g,"__"),text:e,new:!0}},templateSelection:function(e){return(e.new?"<b>("+CAS.labelNew+")</b> ":"")+e.text},templateResult:function(e){return(e.new?"<b>"+CAS.createNew+":</b> ":"")+e.text},templateNoMatches:function(e){return CAS.notFound}})})}};$(document).ready(function(){e.init()})}(jQuery);
assets/js/widgets.min.js CHANGED
@@ -4,4 +4,4 @@
4
  * @license GPLv3
5
  * @copyright 2019 by Joachim Jensen
6
  */
7
- !function($){"use strict";var e={$sidebarContainer:$(".widget-liquid-right"),$widgetContainer:$("#available-widgets"),init:function(){this.openSidebarByURL(),this.addSidebarToolbar(),this.addWidgetSearch(),this.enhancedWidgetManager()},openSidebarByURL:function(){if(window.location.hash){var e=this.$sidebarContainer.find(".widgets-holder-wrap"),i=e.has(window.location.hash);i.length&&i.add(e.first()).find(".handlediv,.sidebar-name-arrow").trigger("click")}},enhancedWidgetManager:function(){if($("body").hasClass("cas-widget-manager")){this.$widgetContainer.find(".widget").draggable("option","scroll",!1);var i=this,a=$("#widgets-left .inactive-sidebar");a.toggle(this.$widgetContainer.hasClass("closed")),this.$widgetContainer.find(".sidebar-name").click(function(e){a.toggle(i.$widgetContainer.hasClass("closed"))})}},addWidgetSearch:function(){var e=$(".widget",this.$widgetContainer).get().reverse();$(".sidebar-description",this.$widgetContainer).prepend('<input type="search" class="js-cas-widget-filter cas-filter" placeholder="'+CASAdmin.filterWidgets+'...">'),this.searchWidgetListener(e)},searchWidgetListener:function(i){var a,s="";this.$widgetContainer.on("input",".js-cas-widget-filter",function(e){var t=$(this).val();t!=s&&(s=t,a&&clearTimeout(a),a=setTimeout(function(){$(i).each(function(e,i){var a=$(i);a.find(".widget-title :nth-child(1)").text().search(new RegExp(t,"i"))<0?a.fadeOut():(a.prependTo(a.parent()),a.fadeIn().css("display",""))})},250))})},addSidebarToolbar:function(){var e='<div class="wp-filter cas-filter-sidebar"><a href="admin.php?page=wpcas-edit" class="button button-primary">'+CASAdmin.addNew+'</a><div class="sidebars-toggle"><a href="#" title="'+CASAdmin.collapse+'" class="js-sidebars-toggle" data-toggle="0"><span class="dashicons dashicons-arrow-up-alt2"></span></a><a href="#" title="'+CASAdmin.expand+'" class="js-sidebars-toggle" data-toggle="1"><span class="dashicons dashicons-arrow-down-alt2"></span></a></div><input type="search" class="js-cas-filter cas-filter" placeholder="'+CASAdmin.filterSidebars+'..."></div>';this.$sidebarContainer.prepend(e),this.searchSidebarListener(),this.addSidebarToggle()},addSidebarToggle:function(){var a=$(document),t=this.$sidebarContainer.find(".widgets-holder-wrap");$("body").on("click",".js-sidebars-toggle",function(e){e.preventDefault();var i=!!$(this).data("toggle");t.toggleClass("closed",!i),i&&t.children(".widgets-sortables").sortable("refresh"),a.triggerHandler("wp-pin-menu")})},searchSidebarListener:function(){var i,a=this,s="";this.$sidebarContainer.on("input",".js-cas-filter",function(e){var t=$(this).val();t!=s&&(s=t,i&&clearTimeout(i),i=setTimeout(function(){$(".widgets-holder-wrap",a.$sidebarContainer).each(function(e,i){var a=$(i);a.find(".sidebar-name :nth-child(2)").text().search(new RegExp(t,"i"))<0?a.fadeOut():a.fadeIn()})},250))})}};$(document).ready(function(){e.init()})}(jQuery);
4
  * @license GPLv3
5
  * @copyright 2019 by Joachim Jensen
6
  */
7
+ !function($){"use strict";var e={$sidebarContainer:$(".widget-liquid-right"),$widgetContainer:$("#available-widgets"),init:function(){this.openSidebarByURL(),this.addSidebarToolbar(),this.addWidgetSearch(),this.enhancedWidgetManager()},openSidebarByURL:function(){var e,i;!window.location.hash||(i=(e=this.$sidebarContainer.find(".widgets-holder-wrap")).has(window.location.hash)).length&&i.add(e.first()).find(".handlediv,.sidebar-name-arrow").trigger("click")},enhancedWidgetManager:function(){var i,a;$("body").hasClass("cas-widget-manager")&&(this.$widgetContainer.find(".widget").draggable("option","scroll",!1),i=this,(a=$("#widgets-left .inactive-sidebar")).toggle(this.$widgetContainer.hasClass("closed")),this.$widgetContainer.find(".sidebar-name").click(function(e){a.toggle(i.$widgetContainer.hasClass("closed"))}))},addWidgetSearch:function(){var e=$(".widget",this.$widgetContainer).get().reverse();$(".sidebar-description",this.$widgetContainer).prepend('<input type="search" class="js-cas-widget-filter cas-filter" placeholder="'+CASAdmin.filterWidgets+'...">'),this.searchWidgetListener(e)},searchWidgetListener:function(i){var t,s="";this.$widgetContainer.on("input",".js-cas-widget-filter",function(e){var a=$(this).val();a!=s&&(s=a,t&&clearTimeout(t),t=setTimeout(function(){$(i).each(function(e,i){i=$(i);i.find(".widget-title :nth-child(1)").text().search(new RegExp(a,"i"))<0?i.fadeOut():(i.prependTo(i.parent()),i.fadeIn().css("display",""))})},250))})},addSidebarToolbar:function(){var e='<div class="wp-filter cas-filter-sidebar"><a href="admin.php?page=wpcas-edit" class="button button-primary">'+CASAdmin.addNew+'</a><div class="sidebars-toggle"><a href="#" title="'+CASAdmin.collapse+'" class="js-sidebars-toggle" data-toggle="0"><span class="dashicons dashicons-arrow-up-alt2"></span></a><a href="#" title="'+CASAdmin.expand+'" class="js-sidebars-toggle" data-toggle="1"><span class="dashicons dashicons-arrow-down-alt2"></span></a></div><input type="search" class="js-cas-filter cas-filter" placeholder="'+CASAdmin.filterSidebars+'..."></div>';this.$sidebarContainer.prepend(e),this.searchSidebarListener(),this.addSidebarToggle()},addSidebarToggle:function(){var i=$(document),a=this.$sidebarContainer.find(".widgets-holder-wrap");$("body").on("click",".js-sidebars-toggle",function(e){e.preventDefault();e=!!$(this).data("toggle");a.toggleClass("closed",!e),e&&a.children(".widgets-sortables").sortable("refresh"),i.triggerHandler("wp-pin-menu")})},searchSidebarListener:function(){var i,t=this,s="";this.$sidebarContainer.on("input",".js-cas-filter",function(e){var a=$(this).val();a!=s&&(s=a,i&&clearTimeout(i),i=setTimeout(function(){$(".widgets-holder-wrap",t.$sidebarContainer).each(function(e,i){i=$(i);i.find(".sidebar-name :nth-child(2)").text().search(new RegExp(a,"i"))<0?i.fadeOut():i.fadeIn()})},250))})}};$(document).ready(function(){e.init()})}(jQuery);
changelog.txt CHANGED
@@ -1,3 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 3.10.1 =
2
 
3
  * [fixed] minor bug when using quick select with woocommerce
1
+ = 3.11.1 =
2
+
3
+ * [fixed] conditions would not always be auto-saved
4
+
5
+ = 3.11 =
6
+
7
+ * [new] condition type cache for improved performance
8
+ * [updated] ui improvements
9
+ * [updated] wp-content-aware-engine library
10
+ * [updated] freemius sdk
11
+
12
+ **Pro Plan:**
13
+
14
+ * [updated] sticky option now fully supports most themes out of the box
15
+ * [fixed] sticky option would in some cases result in error
16
+
17
  = 3.10.1 =
18
 
19
  * [fixed] minor bug when using quick select with woocommerce
content-aware-sidebars.php CHANGED
@@ -9,9 +9,11 @@
9
  Plugin Name: Content Aware Sidebars
10
  Plugin URI: https://dev.institute/wordpress-sidebars/
11
  Description: Unlimited custom sidebars and widget areas for any post, page, category etc.
12
- Version: 3.13
13
  Author: Joachim Jensen - DEV Institute
14
  Author URI: https://dev.institute
 
 
15
  Text Domain: content-aware-sidebars
16
  Domain Path: /lang/
17
  License: GPLv3
9
  Plugin Name: Content Aware Sidebars
10
  Plugin URI: https://dev.institute/wordpress-sidebars/
11
  Description: Unlimited custom sidebars and widget areas for any post, page, category etc.
12
+ Version: 3.13.1
13
  Author: Joachim Jensen - DEV Institute
14
  Author URI: https://dev.institute
15
+ Requires at least: 4.8
16
+ Requires PHP: 5.6
17
  Text Domain: content-aware-sidebars
18
  Domain Path: /lang/
19
  License: GPLv3
lib/freemius/assets/css/admin/account.css CHANGED
@@ -1 +1 @@
1
- label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}#fs_account .postbox,#fs_account .widefat{max-width:800px}#fs_account h3{font-size:1.3em;padding:12px 15px;margin:0 0 12px 0;line-height:1.4;border-bottom:1px solid #F1F1F1}#fs_account h3 .dashicons{width:26px;height:26px;font-size:1.3em}#fs_account i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .dashicons{vertical-align:middle}#fs_account .fs-header-actions{position:absolute;top:17px;right:15px;font-size:0.9em}#fs_account .fs-header-actions ul{margin:0}#fs_account .fs-header-actions li{float:left}#fs_account .fs-header-actions li form{display:inline-block}#fs_account .fs-header-actions li a{text-decoration:none}#fs_account_details .button-group{float:right}.rtl #fs_account .fs-header-actions{left:15px;right:auto}.fs-key-value-table{width:100%}.fs-key-value-table form{display:inline-block}.fs-key-value-table tr td:first-child{text-align:right}.fs-key-value-table tr td:first-child nobr{font-weight:bold}.fs-key-value-table tr td:first-child form{display:block}.fs-key-value-table tr td.fs-right{text-align:right}.fs-key-value-table tr.fs-odd{background:#ebebeb}.fs-key-value-table td,.fs-key-value-table th{padding:10px}.fs-key-value-table code{line-height:28px}.fs-key-value-table var,.fs-key-value-table code,.fs-key-value-table input[type="text"]{color:#0073AA;font-size:16px;background:none}.fs-key-value-table input[type="text"]{width:100%;font-weight:bold}.fs-field-beta_program label{margin-left:7px}label.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error{background:#dc3232}#fs_sites .fs-scrollable-table .fs-table-body{max-height:200px;overflow:auto;border:1px solid #e5e5e5}#fs_sites .fs-scrollable-table .fs-table-body>table.widefat{border:none !important}#fs_sites .fs-scrollable-table .fs-main-column{width:100%}#fs_sites .fs-scrollable-table .fs-site-details td:first-of-type{text-align:right;color:grey;width:1px}#fs_sites .fs-scrollable-table .fs-site-details td:last-of-type{text-align:right}#fs_sites .fs-scrollable-table .fs-install-details table tr td{width:1px;white-space:nowrap}#fs_sites .fs-scrollable-table .fs-install-details table tr td:last-of-type{width:auto}#fs_addons h3{border:none;margin-bottom:0;padding:4px 5px}#fs_addons td{vertical-align:middle}#fs_addons thead{white-space:nowrap}#fs_addons td:first-child,#fs_addons th:first-child{text-align:left;font-weight:bold}#fs_addons td:last-child,#fs_addons th:last-child{text-align:right}#fs_addons th{font-weight:bold}#fs_billing_address{width:100%}#fs_billing_address tr td{width:50%;padding:5px}#fs_billing_address tr:first-of-type td{padding-top:0}#fs_billing_address span{font-weight:bold}#fs_billing_address input,#fs_billing_address select{display:block;width:100%;margin-top:5px}#fs_billing_address input::-moz-placeholder,#fs_billing_address select::-moz-placeholder{color:transparent;opacity:1}#fs_billing_address input:-ms-input-placeholder,#fs_billing_address select:-ms-input-placeholder{color:transparent}#fs_billing_address input::-webkit-input-placeholder,#fs_billing_address select::-webkit-input-placeholder{color:transparent}#fs_billing_address input.fs-read-mode,#fs_billing_address select.fs-read-mode{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode td span{display:none}#fs_billing_address.fs-read-mode input,#fs_billing_address.fs-read-mode select{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode input::-moz-placeholder,#fs_billing_address.fs-read-mode select::-moz-placeholder{color:#ccc;opacity:1}#fs_billing_address.fs-read-mode input:-ms-input-placeholder,#fs_billing_address.fs-read-mode select:-ms-input-placeholder{color:#ccc}#fs_billing_address.fs-read-mode input::-webkit-input-placeholder,#fs_billing_address.fs-read-mode select::-webkit-input-placeholder{color:#ccc}#fs_billing_address button{display:block;width:100%}
1
+ label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.fs-notice[data-id="license_not_whitelabeled"].success,.fs-notice[data-id="license_whitelabeled"].success{color:inherit;border-left-color:#00a0d2}.fs-notice[data-id="license_not_whitelabeled"].success label.fs-plugin-title,.fs-notice[data-id="license_whitelabeled"].success label.fs-plugin-title{display:none}#fs_account .postbox,#fs_account .widefat{max-width:800px}#fs_account h3{font-size:1.3em;padding:12px 15px;margin:0 0 12px 0;line-height:1.4;border-bottom:1px solid #F1F1F1}#fs_account h3 .dashicons{width:26px;height:26px;font-size:1.3em}#fs_account i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .dashicons{vertical-align:middle}#fs_account .fs-header-actions{position:absolute;top:17px;right:15px;font-size:0.9em}#fs_account .fs-header-actions ul{margin:0}#fs_account .fs-header-actions li{float:left}#fs_account .fs-header-actions li form{display:inline-block}#fs_account .fs-header-actions li a{text-decoration:none}#fs_account_details .button-group{float:right}.rtl #fs_account .fs-header-actions{left:15px;right:auto}.fs-key-value-table{width:100%}.fs-key-value-table form{display:inline-block}.fs-key-value-table tr td:first-child{text-align:right}.fs-key-value-table tr td:first-child nobr{font-weight:bold}.fs-key-value-table tr td:first-child form{display:block}.fs-key-value-table tr td.fs-right{text-align:right}.fs-key-value-table tr.fs-odd{background:#ebebeb}.fs-key-value-table td,.fs-key-value-table th{padding:10px}.fs-key-value-table code{line-height:28px}.fs-key-value-table var,.fs-key-value-table code,.fs-key-value-table input[type="text"]{color:#0073AA;font-size:16px;background:none}.fs-key-value-table input[type="text"]{width:100%;font-weight:bold}.fs-field-beta_program label{margin-left:7px}label.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error{background:#dc3232}#fs_sites .fs-scrollable-table .fs-table-body{max-height:200px;overflow:auto;border:1px solid #e5e5e5}#fs_sites .fs-scrollable-table .fs-table-body>table.widefat{border:none !important}#fs_sites .fs-scrollable-table .fs-main-column{width:100%}#fs_sites .fs-scrollable-table .fs-site-details td:first-of-type{text-align:right;color:grey;width:1px}#fs_sites .fs-scrollable-table .fs-site-details td:last-of-type{text-align:right}#fs_sites .fs-scrollable-table .fs-install-details table tr td{width:1px;white-space:nowrap}#fs_sites .fs-scrollable-table .fs-install-details table tr td:last-of-type{width:auto}#fs_addons h3{border:none;margin-bottom:0;padding:4px 5px}#fs_addons td{vertical-align:middle}#fs_addons thead{white-space:nowrap}#fs_addons td:first-child,#fs_addons th:first-child{text-align:left;font-weight:bold}#fs_addons td:last-child,#fs_addons th:last-child{text-align:right}#fs_addons th{font-weight:bold}#fs_billing_address{width:100%}#fs_billing_address tr td{width:50%;padding:5px}#fs_billing_address tr:first-of-type td{padding-top:0}#fs_billing_address span{font-weight:bold}#fs_billing_address input,#fs_billing_address select{display:block;width:100%;margin-top:5px}#fs_billing_address input::-moz-placeholder,#fs_billing_address select::-moz-placeholder{color:transparent;opacity:1}#fs_billing_address input:-ms-input-placeholder,#fs_billing_address select:-ms-input-placeholder{color:transparent}#fs_billing_address input::-webkit-input-placeholder,#fs_billing_address select::-webkit-input-placeholder{color:transparent}#fs_billing_address input.fs-read-mode,#fs_billing_address select.fs-read-mode{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode td span{display:none}#fs_billing_address.fs-read-mode input,#fs_billing_address.fs-read-mode select{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode input::-moz-placeholder,#fs_billing_address.fs-read-mode select::-moz-placeholder{color:#ccc;opacity:1}#fs_billing_address.fs-read-mode input:-ms-input-placeholder,#fs_billing_address.fs-read-mode select:-ms-input-placeholder{color:#ccc}#fs_billing_address.fs-read-mode input::-webkit-input-placeholder,#fs_billing_address.fs-read-mode select::-webkit-input-placeholder{color:#ccc}#fs_billing_address button{display:block;width:100%}
lib/freemius/config.php CHANGED
@@ -1,388 +1,391 @@
1
- <?php
2
- /**
3
- * @package Freemius
4
- * @copyright Copyright (c) 2015, Freemius, Inc.
5
- * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6
- * @since 1.0.4
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) ) {
10
- exit;
11
- }
12
-
13
- if ( ! defined( 'WP_FS__SLUG' ) ) {
14
- define( 'WP_FS__SLUG', 'freemius' );
15
- }
16
- if ( ! defined( 'WP_FS__DEV_MODE' ) ) {
17
- define( 'WP_FS__DEV_MODE', false );
18
- }
19
-
20
- #--------------------------------------------------------------------------------
21
- #region API Connectivity Issues Simulation
22
- #--------------------------------------------------------------------------------
23
-
24
- if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY' ) ) {
25
- define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY', false );
26
- }
27
- if ( ! defined( 'WP_FS__SIMULATE_NO_CURL' ) ) {
28
- define( 'WP_FS__SIMULATE_NO_CURL', false );
29
- }
30
- if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) {
31
- define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false );
32
- }
33
- if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) {
34
- define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false );
35
- }
36
- if ( WP_FS__SIMULATE_NO_CURL ) {
37
- define( 'FS_SDK__SIMULATE_NO_CURL', true );
38
- }
39
- if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) {
40
- define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', true );
41
- }
42
- if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) {
43
- define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', true );
44
- }
45
-
46
- #endregion
47
-
48
- if ( ! defined( 'WP_FS__SIMULATE_FREEMIUS_OFF' ) ) {
49
- define( 'WP_FS__SIMULATE_FREEMIUS_OFF', false );
50
- }
51
-
52
- if ( ! defined( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES' ) ) {
53
- /**
54
- * @since 1.1.7.3
55
- * @author Vova Feldman (@svovaf)
56
- *
57
- * I'm not sure if shared servers periodically change IP, or the subdomain of the
58
- * admin dashboard. Also, I've seen sites that have strange loop of switching
59
- * between domains on a daily basis. Therefore, to eliminate the risk of
60
- * multiple unwanted connectivity test pings, temporary ignore domain or
61
- * server IP changes.
62
- */
63
- define( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES', false );
64
- }
65
-
66
- /**
67
- * If your dev environment supports custom public network IP setup
68
- * like VVV, please update WP_FS__LOCALHOST_IP with your public IP
69
- * and uncomment it during dev.
70
- */
71
- if ( ! defined( 'WP_FS__LOCALHOST_IP' ) ) {
72
- // VVV default public network IP.
73
- define( 'WP_FS__VVV_DEFAULT_PUBLIC_IP', '192.168.50.4' );
74
-
75
- // define( 'WP_FS__LOCALHOST_IP', WP_FS__VVV_DEFAULT_PUBLIC_IP );
76
- }
77
-
78
- /**
79
- * If true and running with secret key, the opt-in process
80
- * will skip the email activation process which is invoked
81
- * when the email of the context user already exist in Freemius
82
- * database (as a security precaution, to prevent sharing user
83
- * secret with unauthorized entity).
84
- *
85
- * IMPORTANT:
86
- * AS A SECURITY PRECAUTION, WE VALIDATE THE TIMESTAMP OF THE OPT-IN REQUEST.
87
- * THEREFORE, MAKE SURE THAT WHEN USING THIS PARAMETER,YOUR TESTING ENVIRONMENT'S
88
- * CLOCK IS SYNCED.
89
- */
90
- if ( ! defined( 'WP_FS__SKIP_EMAIL_ACTIVATION' ) ) {
91
- define( 'WP_FS__SKIP_EMAIL_ACTIVATION', false );
92
- }
93
-
94
-
95
- #--------------------------------------------------------------------------------
96
- #region Directories
97
- #--------------------------------------------------------------------------------
98
-
99
- if ( ! defined( 'WP_FS__DIR' ) ) {
100
- define( 'WP_FS__DIR', dirname( __FILE__ ) );
101
- }
102
- if ( ! defined( 'WP_FS__DIR_INCLUDES' ) ) {
103
- define( 'WP_FS__DIR_INCLUDES', WP_FS__DIR . '/includes' );
104
- }
105
- if ( ! defined( 'WP_FS__DIR_TEMPLATES' ) ) {
106
- define( 'WP_FS__DIR_TEMPLATES', WP_FS__DIR . '/templates' );
107
- }
108
- if ( ! defined( 'WP_FS__DIR_ASSETS' ) ) {
109
- define( 'WP_FS__DIR_ASSETS', WP_FS__DIR . '/assets' );
110
- }
111
- if ( ! defined( 'WP_FS__DIR_CSS' ) ) {
112
- define( 'WP_FS__DIR_CSS', WP_FS__DIR_ASSETS . '/css' );
113
- }
114
- if ( ! defined( 'WP_FS__DIR_JS' ) ) {
115
- define( 'WP_FS__DIR_JS', WP_FS__DIR_ASSETS . '/js' );
116
- }
117
- if ( ! defined( 'WP_FS__DIR_IMG' ) ) {
118
- define( 'WP_FS__DIR_IMG', WP_FS__DIR_ASSETS . '/img' );
119
- }
120
- if ( ! defined( 'WP_FS__DIR_SDK' ) ) {
121
- define( 'WP_FS__DIR_SDK', WP_FS__DIR_INCLUDES . '/sdk' );
122
- }
123
-
124
- #endregion
125
-
126
- /**
127
- * Domain / URL / Address
128
- */
129
- define( 'WP_FS__ROOT_DOMAIN_PRODUCTION', 'freemius.com' );
130
- define( 'WP_FS__DOMAIN_PRODUCTION', 'wp.freemius.com' );
131
- define( 'WP_FS__ADDRESS_PRODUCTION', 'https://' . WP_FS__DOMAIN_PRODUCTION );
132
-
133
- if ( ! defined( 'WP_FS__DOMAIN_LOCALHOST' ) ) {
134
- define( 'WP_FS__DOMAIN_LOCALHOST', 'wp.freemius' );
135
- }
136
- if ( ! defined( 'WP_FS__ADDRESS_LOCALHOST' ) ) {
137
- define( 'WP_FS__ADDRESS_LOCALHOST', 'http://' . WP_FS__DOMAIN_LOCALHOST . ':8080' );
138
- }
139
-
140
- if ( ! defined( 'WP_FS__TESTING_DOMAIN' ) ) {
141
- define( 'WP_FS__TESTING_DOMAIN', 'fswp' );
142
- }
143
-
144
- #--------------------------------------------------------------------------------
145
- #region HTTP
146
- #--------------------------------------------------------------------------------
147
-
148
- if ( ! defined( 'WP_FS__IS_HTTP_REQUEST' ) ) {
149
- define( 'WP_FS__IS_HTTP_REQUEST', isset( $_SERVER['HTTP_HOST'] ) );
150
- }
151
-
152
- if ( ! defined( 'WP_FS__IS_HTTPS' ) ) {
153
- define( 'WP_FS__IS_HTTPS', ( WP_FS__IS_HTTP_REQUEST &&
154
- // Checks if CloudFlare's HTTPS (Flexible SSL support).
155
- isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) &&
156
- 'https' === strtolower( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
157
- ) ||
158
- // Check if HTTPS request.
159
- ( isset( $_SERVER['HTTPS'] ) && 'on' == $_SERVER['HTTPS'] ) ||
160
- ( isset( $_SERVER['SERVER_PORT'] ) && 443 == $_SERVER['SERVER_PORT'] )
161
- );
162
- }
163
-
164
- if ( ! defined( 'WP_FS__IS_POST_REQUEST' ) ) {
165
- define( 'WP_FS__IS_POST_REQUEST', ( WP_FS__IS_HTTP_REQUEST &&
166
- strtoupper( $_SERVER['REQUEST_METHOD'] ) == 'POST' ) );
167
- }
168
-
169
- if ( ! defined( 'WP_FS__REMOTE_ADDR' ) ) {
170
- define( 'WP_FS__REMOTE_ADDR', fs_get_ip() );
171
- }
172
-
173
- if ( ! defined( 'WP_FS__IS_LOCALHOST' ) ) {
174
- if ( defined( 'WP_FS__LOCALHOST_IP' ) ) {
175
- define( 'WP_FS__IS_LOCALHOST', ( WP_FS__LOCALHOST_IP === WP_FS__REMOTE_ADDR ) );
176
- } else {
177
- define( 'WP_FS__IS_LOCALHOST', WP_FS__IS_HTTP_REQUEST &&
178
- is_string( WP_FS__REMOTE_ADDR ) &&
179
- ( substr( WP_FS__REMOTE_ADDR, 0, 4 ) === '127.' ||
180
- WP_FS__REMOTE_ADDR === '::1' )
181
- );
182
- }
183
- }
184
-
185
- if ( ! defined( 'WP_FS__IS_LOCALHOST_FOR_SERVER' ) ) {
186
- define( 'WP_FS__IS_LOCALHOST_FOR_SERVER', ( ! WP_FS__IS_HTTP_REQUEST ||
187
- false !== strpos( $_SERVER['HTTP_HOST'], 'localhost' ) ) );
188
- }
189
-
190
- #endregion
191
-
192
- if ( ! defined( 'WP_FS__IS_PRODUCTION_MODE' ) ) {
193
- // By default, run with Freemius production servers.
194
- define( 'WP_FS__IS_PRODUCTION_MODE', true );
195
- }
196
-
197
- if ( ! defined( 'WP_FS__ADDRESS' ) ) {
198
- define( 'WP_FS__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? WP_FS__ADDRESS_PRODUCTION : WP_FS__ADDRESS_LOCALHOST ) );
199
- }
200
-
201
-
202
- #--------------------------------------------------------------------------------
203
- #region API
204
- #--------------------------------------------------------------------------------
205
-
206
- if ( ! defined( 'WP_FS__API_ADDRESS_LOCALHOST' ) ) {
207
- define( 'WP_FS__API_ADDRESS_LOCALHOST', 'http://api.freemius-local.com:8080' );
208
- }
209
- if ( ! defined( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST' ) ) {
210
- define( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST', 'http://sandbox-api.freemius:8080' );
211
- }
212
-
213
- // Set API address for local testing.
214
- if ( ! WP_FS__IS_PRODUCTION_MODE ) {
215
- if ( ! defined( 'FS_API__ADDRESS' ) ) {
216
- define( 'FS_API__ADDRESS', WP_FS__API_ADDRESS_LOCALHOST );
217
- }
218
- if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
219
- define( 'FS_API__SANDBOX_ADDRESS', WP_FS__API_SANDBOX_ADDRESS_LOCALHOST );
220
- }
221
- }
222
-
223
- #endregion
224
-
225
- #--------------------------------------------------------------------------------
226
- #region Checkout
227
- #--------------------------------------------------------------------------------
228
-
229
- if ( ! defined( 'FS_CHECKOUT__ADDRESS_PRODUCTION' ) ) {
230
- define( 'FS_CHECKOUT__ADDRESS_PRODUCTION', 'https://checkout.freemius.com' );
231
- }
232
-
233
- if ( ! defined( 'FS_CHECKOUT__ADDRESS_LOCALHOST' ) ) {
234
- define( 'FS_CHECKOUT__ADDRESS_LOCALHOST', 'http://checkout.freemius-local.com:8080' );
235
- }
236
-
237
- if ( ! defined( 'FS_CHECKOUT__ADDRESS' ) ) {
238
- define( 'FS_CHECKOUT__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? FS_CHECKOUT__ADDRESS_PRODUCTION : FS_CHECKOUT__ADDRESS_LOCALHOST ) );
239
- }
240
-
241
- #endregion
242
-
243
- define( 'WP_FS___OPTION_PREFIX', 'fs' . ( WP_FS__IS_PRODUCTION_MODE ? '' : '_dbg' ) . '_' );
244
-
245
- if ( ! defined( 'WP_FS__ACCOUNTS_OPTION_NAME' ) ) {
246
- define( 'WP_FS__ACCOUNTS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'accounts' );
247
- }
248
- if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) {
249
- define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' );
250
- }
251
- if ( ! defined( 'WP_FS__GDPR_OPTION_NAME' ) ) {
252
- define( 'WP_FS__GDPR_OPTION_NAME', WP_FS___OPTION_PREFIX . 'gdpr' );
253
- }
254
- define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
255
-
256
- /**
257
- * Module types
258
- *
259
- * @since 1.2.2
260
- */
261
- define( 'WP_FS__MODULE_TYPE_PLUGIN', 'plugin' );
262
- define( 'WP_FS__MODULE_TYPE_THEME', 'theme' );
263
-
264
- /**
265
- * Billing Frequencies
266
- */
267
- define( 'WP_FS__PERIOD_ANNUALLY', 'annual' );
268
- define( 'WP_FS__PERIOD_MONTHLY', 'monthly' );
269
- define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' );
270
-
271
- /**
272
- * Plans
273
- */
274
- define( 'WP_FS__PLAN_DEFAULT_PAID', false );
275
- define( 'WP_FS__PLAN_FREE', 'free' );
276
- define( 'WP_FS__PLAN_TRIAL', 'trial' );
277
-
278
- /**
279
- * Times in seconds
280
- */
281
- if ( ! defined( 'WP_FS__TIME_5_MIN_IN_SEC' ) ) {
282
- define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 );
283
- }
284
- if ( ! defined( 'WP_FS__TIME_10_MIN_IN_SEC' ) ) {
285
- define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
286
- }
287
- // define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
288
- if ( ! defined( 'WP_FS__TIME_12_HOURS_IN_SEC' ) ) {
289
- define( 'WP_FS__TIME_12_HOURS_IN_SEC', 43200 );
290
- }
291
- if ( ! defined( 'WP_FS__TIME_24_HOURS_IN_SEC' ) ) {
292
- define( 'WP_FS__TIME_24_HOURS_IN_SEC', WP_FS__TIME_12_HOURS_IN_SEC * 2 );
293
- }
294
- if ( ! defined( 'WP_FS__TIME_WEEK_IN_SEC' ) ) {
295
- define( 'WP_FS__TIME_WEEK_IN_SEC', 7 * WP_FS__TIME_24_HOURS_IN_SEC );
296
- }
297
-
298
- #--------------------------------------------------------------------------------
299
- #region Debugging
300
- #--------------------------------------------------------------------------------
301
-
302
- if ( ! defined( 'WP_FS__DEBUG_SDK' ) ) {
303
- $debug_mode = get_option( 'fs_debug_mode', null );
304
-
305
- if ( $debug_mode === null ) {
306
- $debug_mode = false;
307
- add_option( 'fs_debug_mode', $debug_mode );
308
- }
309
-
310
- define( 'WP_FS__DEBUG_SDK', is_numeric( $debug_mode ) ? ( 0 < $debug_mode ) : WP_FS__DEV_MODE );
311
- }
312
-
313
- if ( ! defined( 'WP_FS__ECHO_DEBUG_SDK' ) ) {
314
- define( 'WP_FS__ECHO_DEBUG_SDK', WP_FS__DEV_MODE && ! empty( $_GET['fs_dbg_echo'] ) );
315
- }
316
- if ( ! defined( 'WP_FS__LOG_DATETIME_FORMAT' ) ) {
317
- define( 'WP_FS__LOG_DATETIME_FORMAT', 'Y-m-d H:i:s' );
318
- }
319
- if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
320
- define( 'FS_API__LOGGER_ON', WP_FS__DEBUG_SDK );
321
- }
322
-
323
- if ( WP_FS__ECHO_DEBUG_SDK ) {
324
- error_reporting( E_ALL );
325
- }
326
-
327
- #endregion
328
-
329
- if ( ! defined( 'WP_FS__SCRIPT_START_TIME' ) ) {
330
- define( 'WP_FS__SCRIPT_START_TIME', time() );
331
- }
332
- if ( ! defined( 'WP_FS__DEFAULT_PRIORITY' ) ) {
333
- define( 'WP_FS__DEFAULT_PRIORITY', 10 );
334
- }
335
- if ( ! defined( 'WP_FS__LOWEST_PRIORITY' ) ) {
336
- define( 'WP_FS__LOWEST_PRIORITY', 999999999 );
337
- }
338
-
339
- #--------------------------------------------------------------------------------
340
- #region Multisite Network
341
- #--------------------------------------------------------------------------------
342
-
343
- /**
344
- * Do not use this define directly, it will have the wrong value
345
- * during plugin uninstall/deletion when the inclusion of the plugin
346
- * is triggered due to registration with register_uninstall_hook().
347
- *
348
- * Instead, use fs_is_network_admin().
349
- *
350
- * @author Vova Feldman (@svovaf)
351
- */
352
- if ( ! defined( 'WP_FS__IS_NETWORK_ADMIN' ) ) {
353
- define( 'WP_FS__IS_NETWORK_ADMIN',
354
- is_multisite() &&
355
- ( is_network_admin() ||
356
- ( ( defined( 'DOING_AJAX' ) && DOING_AJAX &&
357
- ( isset( $_REQUEST['_fs_network_admin'] ) /*||
358
- ( ! empty( $_REQUEST['action'] ) && 'delete-plugin' === $_REQUEST['action'] )*/ )
359
- ) ||
360
- // Plugin uninstall.
361
- defined( 'WP_UNINSTALL_PLUGIN' ) )
362
- )
363
- );
364
- }
365
-
366
- /**
367
- * Do not use this define directly, it will have the wrong value
368
- * during plugin uninstall/deletion when the inclusion of the plugin
369
- * is triggered due to registration with register_uninstall_hook().
370
- *
371
- * Instead, use fs_is_blog_admin().
372
- *
373
- * @author Vova Feldman (@svovaf)
374
- */
375
- if ( ! defined( 'WP_FS__IS_BLOG_ADMIN' ) ) {
376
- define( 'WP_FS__IS_BLOG_ADMIN', is_blog_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['_fs_blog_admin'] ) ) );
377
- }
378
-
379
- if ( ! defined( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED' ) ) {
380
- // Set to true to show network level settings even if delegated to site admins.
381
- define( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED', false );
382
- }
383
-
384
- #endregion
385
-
386
- if ( ! defined( 'WP_FS__DEMO_MODE' ) ) {
387
- define( 'WP_FS__DEMO_MODE', false );
388
- }
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6
+ * @since 1.0.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ if ( ! defined( 'WP_FS__SLUG' ) ) {
14
+ define( 'WP_FS__SLUG', 'freemius' );
15
+ }
16
+ if ( ! defined( 'WP_FS__DEV_MODE' ) ) {
17
+ define( 'WP_FS__DEV_MODE', false );
18
+ }
19
+
20
+ #--------------------------------------------------------------------------------
21
+ #region API Connectivity Issues Simulation
22
+ #--------------------------------------------------------------------------------
23
+
24
+ if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY' ) ) {
25
+ define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY', false );
26
+ }
27
+ if ( ! defined( 'WP_FS__SIMULATE_NO_CURL' ) ) {
28
+ define( 'WP_FS__SIMULATE_NO_CURL', false );
29
+ }
30
+ if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) {
31
+ define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false );
32
+ }
33
+ if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) {
34
+ define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false );
35
+ }
36
+ if ( WP_FS__SIMULATE_NO_CURL ) {
37
+ define( 'FS_SDK__SIMULATE_NO_CURL', true );
38
+ }
39
+ if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) {
40
+ define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', true );
41
+ }
42
+ if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) {
43
+ define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', true );
44
+ }
45
+
46
+ #endregion
47
+
48
+ if ( ! defined( 'WP_FS__SIMULATE_FREEMIUS_OFF' ) ) {
49
+ define( 'WP_FS__SIMULATE_FREEMIUS_OFF', false );
50
+ }
51
+
52
+ if ( ! defined( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES' ) ) {
53
+ /**
54
+ * @since 1.1.7.3
55
+ * @author Vova Feldman (@svovaf)
56
+ *
57
+ * I'm not sure if shared servers periodically change IP, or the subdomain of the
58
+ * admin dashboard. Also, I've seen sites that have strange loop of switching
59
+ * between domains on a daily basis. Therefore, to eliminate the risk of
60
+ * multiple unwanted connectivity test pings, temporary ignore domain or
61
+ * server IP changes.
62
+ */
63
+ define( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES', false );
64
+ }
65
+
66
+ /**
67
+ * If your dev environment supports custom public network IP setup
68
+ * like VVV, please update WP_FS__LOCALHOST_IP with your public IP
69
+ * and uncomment it during dev.
70
+ */
71
+ if ( ! defined( 'WP_FS__LOCALHOST_IP' ) ) {
72
+ // VVV default public network IP.
73
+ define( 'WP_FS__VVV_DEFAULT_PUBLIC_IP', '192.168.50.4' );
74
+
75
+ // define( 'WP_FS__LOCALHOST_IP', WP_FS__VVV_DEFAULT_PUBLIC_IP );
76
+ }
77
+
78
+ /**
79
+ * If true and running with secret key, the opt-in process
80
+ * will skip the email activation process which is invoked
81
+ * when the email of the context user already exist in Freemius
82
+ * database (as a security precaution, to prevent sharing user
83
+ * secret with unauthorized entity).
84
+ *
85
+ * IMPORTANT:
86
+ * AS A SECURITY PRECAUTION, WE VALIDATE THE TIMESTAMP OF THE OPT-IN REQUEST.
87
+ * THEREFORE, MAKE SURE THAT WHEN USING THIS PARAMETER,YOUR TESTING ENVIRONMENT'S
88
+ * CLOCK IS SYNCED.
89
+ */
90
+ if ( ! defined( 'WP_FS__SKIP_EMAIL_ACTIVATION' ) ) {
91
+ define( 'WP_FS__SKIP_EMAIL_ACTIVATION', false );
92
+ }
93
+
94
+
95
+ #--------------------------------------------------------------------------------
96
+ #region Directories
97
+ #--------------------------------------------------------------------------------
98
+
99
+ if ( ! defined( 'WP_FS__DIR' ) ) {
100
+ define( 'WP_FS__DIR', dirname( __FILE__ ) );
101
+ }
102
+ if ( ! defined( 'WP_FS__DIR_INCLUDES' ) ) {
103
+ define( 'WP_FS__DIR_INCLUDES', WP_FS__DIR . '/includes' );
104
+ }
105
+ if ( ! defined( 'WP_FS__DIR_TEMPLATES' ) ) {
106
+ define( 'WP_FS__DIR_TEMPLATES', WP_FS__DIR . '/templates' );
107
+ }
108
+ if ( ! defined( 'WP_FS__DIR_ASSETS' ) ) {
109
+ define( 'WP_FS__DIR_ASSETS', WP_FS__DIR . '/assets' );
110
+ }
111
+ if ( ! defined( 'WP_FS__DIR_CSS' ) ) {
112
+ define( 'WP_FS__DIR_CSS', WP_FS__DIR_ASSETS . '/css' );
113
+ }
114
+ if ( ! defined( 'WP_FS__DIR_JS' ) ) {
115
+ define( 'WP_FS__DIR_JS', WP_FS__DIR_ASSETS . '/js' );
116
+ }
117
+ if ( ! defined( 'WP_FS__DIR_IMG' ) ) {
118
+ define( 'WP_FS__DIR_IMG', WP_FS__DIR_ASSETS . '/img' );
119
+ }
120
+ if ( ! defined( 'WP_FS__DIR_SDK' ) ) {
121
+ define( 'WP_FS__DIR_SDK', WP_FS__DIR_INCLUDES . '/sdk' );
122
+ }
123
+
124
+ #endregion
125
+
126
+ /**
127
+ * Domain / URL / Address
128
+ */
129
+ define( 'WP_FS__ROOT_DOMAIN_PRODUCTION', 'freemius.com' );
130
+ define( 'WP_FS__DOMAIN_PRODUCTION', 'wp.freemius.com' );
131
+ define( 'WP_FS__ADDRESS_PRODUCTION', 'https://' . WP_FS__DOMAIN_PRODUCTION );
132
+
133
+ if ( ! defined( 'WP_FS__DOMAIN_LOCALHOST' ) ) {
134
+ define( 'WP_FS__DOMAIN_LOCALHOST', 'wp.freemius' );
135
+ }
136
+ if ( ! defined( 'WP_FS__ADDRESS_LOCALHOST' ) ) {
137
+ define( 'WP_FS__ADDRESS_LOCALHOST', 'http://' . WP_FS__DOMAIN_LOCALHOST . ':8080' );
138
+ }
139
+
140
+ if ( ! defined( 'WP_FS__TESTING_DOMAIN' ) ) {
141
+ define( 'WP_FS__TESTING_DOMAIN', 'fswp' );
142
+ }
143
+
144
+ #--------------------------------------------------------------------------------
145
+ #region HTTP
146
+ #--------------------------------------------------------------------------------
147
+
148
+ if ( ! defined( 'WP_FS__IS_HTTP_REQUEST' ) ) {
149
+ define( 'WP_FS__IS_HTTP_REQUEST', isset( $_SERVER['HTTP_HOST'] ) );
150
+ }
151
+
152
+ if ( ! defined( 'WP_FS__IS_HTTPS' ) ) {
153
+ define( 'WP_FS__IS_HTTPS', ( WP_FS__IS_HTTP_REQUEST &&
154
+ // Checks if CloudFlare's HTTPS (Flexible SSL support).
155
+ isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) &&
156
+ 'https' === strtolower( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
157
+ ) ||
158
+ // Check if HTTPS request.
159
+ ( isset( $_SERVER['HTTPS'] ) && 'on' == $_SERVER['HTTPS'] ) ||
160
+ ( isset( $_SERVER['SERVER_PORT'] ) && 443 == $_SERVER['SERVER_PORT'] )
161
+ );
162
+ }
163
+
164
+ if ( ! defined( 'WP_FS__IS_POST_REQUEST' ) ) {
165
+ define( 'WP_FS__IS_POST_REQUEST', ( WP_FS__IS_HTTP_REQUEST &&
166
+ strtoupper( $_SERVER['REQUEST_METHOD'] ) == 'POST' ) );
167
+ }
168
+
169
+ if ( ! defined( 'WP_FS__REMOTE_ADDR' ) ) {
170
+ define( 'WP_FS__REMOTE_ADDR', fs_get_ip() );
171
+ }
172
+
173
+ if ( ! defined( 'WP_FS__IS_LOCALHOST' ) ) {
174
+ if ( defined( 'WP_FS__LOCALHOST_IP' ) ) {
175
+ define( 'WP_FS__IS_LOCALHOST', ( WP_FS__LOCALHOST_IP === WP_FS__REMOTE_ADDR ) );
176
+ } else {
177
+ define( 'WP_FS__IS_LOCALHOST', WP_FS__IS_HTTP_REQUEST &&
178
+ is_string( WP_FS__REMOTE_ADDR ) &&
179
+ ( substr( WP_FS__REMOTE_ADDR, 0, 4 ) === '127.' ||
180
+ WP_FS__REMOTE_ADDR === '::1' )
181
+ );
182
+ }
183
+ }
184
+
185
+ if ( ! defined( 'WP_FS__IS_LOCALHOST_FOR_SERVER' ) ) {
186
+ define( 'WP_FS__IS_LOCALHOST_FOR_SERVER', ( ! WP_FS__IS_HTTP_REQUEST ||
187
+ false !== strpos( $_SERVER['HTTP_HOST'], 'localhost' ) ) );
188
+ }
189
+
190
+ #endregion
191
+
192
+ if ( ! defined( 'WP_FS__IS_PRODUCTION_MODE' ) ) {
193
+ // By default, run with Freemius production servers.
194
+ define( 'WP_FS__IS_PRODUCTION_MODE', true );
195
+ }
196
+
197
+ if ( ! defined( 'WP_FS__ADDRESS' ) ) {
198
+ define( 'WP_FS__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? WP_FS__ADDRESS_PRODUCTION : WP_FS__ADDRESS_LOCALHOST ) );
199
+ }
200
+
201
+
202
+ #--------------------------------------------------------------------------------
203
+ #region API
204
+ #--------------------------------------------------------------------------------
205
+
206
+ if ( ! defined( 'WP_FS__API_ADDRESS_LOCALHOST' ) ) {
207
+ define( 'WP_FS__API_ADDRESS_LOCALHOST', 'http://api.freemius-local.com:8080' );
208
+ }
209
+ if ( ! defined( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST' ) ) {
210
+ define( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST', 'http://sandbox-api.freemius:8080' );
211
+ }
212
+
213
+ // Set API address for local testing.
214
+ if ( ! WP_FS__IS_PRODUCTION_MODE ) {
215
+ if ( ! defined( 'FS_API__ADDRESS' ) ) {
216
+ define( 'FS_API__ADDRESS', WP_FS__API_ADDRESS_LOCALHOST );
217
+ }
218
+ if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
219
+ define( 'FS_API__SANDBOX_ADDRESS', WP_FS__API_SANDBOX_ADDRESS_LOCALHOST );
220
+ }
221
+ }
222
+
223
+ #endregion
224
+
225
+ #--------------------------------------------------------------------------------
226
+ #region Checkout
227
+ #--------------------------------------------------------------------------------
228
+
229
+ if ( ! defined( 'FS_CHECKOUT__ADDRESS_PRODUCTION' ) ) {
230
+ define( 'FS_CHECKOUT__ADDRESS_PRODUCTION', 'https://checkout.freemius.com' );
231
+ }
232
+
233
+ if ( ! defined( 'FS_CHECKOUT__ADDRESS_LOCALHOST' ) ) {
234
+ define( 'FS_CHECKOUT__ADDRESS_LOCALHOST', 'http://checkout.freemius-local.com:8080' );
235
+ }
236
+
237
+ if ( ! defined( 'FS_CHECKOUT__ADDRESS' ) ) {
238
+ define( 'FS_CHECKOUT__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? FS_CHECKOUT__ADDRESS_PRODUCTION : FS_CHECKOUT__ADDRESS_LOCALHOST ) );
239
+ }
240
+
241
+ #endregion
242
+
243
+ define( 'WP_FS___OPTION_PREFIX', 'fs' . ( WP_FS__IS_PRODUCTION_MODE ? '' : '_dbg' ) . '_' );
244
+
245
+ if ( ! defined( 'WP_FS__ACCOUNTS_OPTION_NAME' ) ) {
246
+ define( 'WP_FS__ACCOUNTS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'accounts' );
247
+ }
248
+ if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) {
249
+ define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' );
250
+ }
251
+ if ( ! defined( 'WP_FS__GDPR_OPTION_NAME' ) ) {
252
+ define( 'WP_FS__GDPR_OPTION_NAME', WP_FS___OPTION_PREFIX . 'gdpr' );
253
+ }
254
+ define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
255
+
256
+ /**
257
+ * Module types
258
+ *
259
+ * @since 1.2.2
260
+ */
261
+ define( 'WP_FS__MODULE_TYPE_PLUGIN', 'plugin' );
262
+ define( 'WP_FS__MODULE_TYPE_THEME', 'theme' );
263
+
264
+ /**
265
+ * Billing Frequencies
266
+ */
267
+ define( 'WP_FS__PERIOD_ANNUALLY', 'annual' );
268
+ define( 'WP_FS__PERIOD_MONTHLY', 'monthly' );
269
+ define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' );
270
+
271
+ /**
272
+ * Plans
273
+ */
274
+ define( 'WP_FS__PLAN_DEFAULT_PAID', false );
275
+ define( 'WP_FS__PLAN_FREE', 'free' );
276
+ define( 'WP_FS__PLAN_TRIAL', 'trial' );
277
+
278
+ /**
279
+ * Times in seconds
280
+ */
281
+ if ( ! defined( 'WP_FS__TIME_5_MIN_IN_SEC' ) ) {
282
+ define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 );
283
+ }
284
+ if ( ! defined( 'WP_FS__TIME_10_MIN_IN_SEC' ) ) {
285
+ define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
286
+ }
287
+ // define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
288
+ if ( ! defined( 'WP_FS__TIME_12_HOURS_IN_SEC' ) ) {
289
+ define( 'WP_FS__TIME_12_HOURS_IN_SEC', 43200 );
290
+ }
291
+ if ( ! defined( 'WP_FS__TIME_24_HOURS_IN_SEC' ) ) {
292
+ define( 'WP_FS__TIME_24_HOURS_IN_SEC', WP_FS__TIME_12_HOURS_IN_SEC * 2 );
293
+ }
294
+ if ( ! defined( 'WP_FS__TIME_WEEK_IN_SEC' ) ) {
295
+ define( 'WP_FS__TIME_WEEK_IN_SEC', 7 * WP_FS__TIME_24_HOURS_IN_SEC );
296
+ }
297
+
298
+ #--------------------------------------------------------------------------------
299
+ #region Debugging
300
+ #--------------------------------------------------------------------------------
301
+
302
+ if ( ! defined( 'WP_FS__DEBUG_SDK' ) ) {
303
+ $debug_mode = get_option( 'fs_debug_mode', null );
304
+
305
+ if ( $debug_mode === null ) {
306
+ $debug_mode = false;
307
+ add_option( 'fs_debug_mode', $debug_mode );
308
+ }
309
+
310
+ define( 'WP_FS__DEBUG_SDK', is_numeric( $debug_mode ) ? ( 0 < $debug_mode ) : WP_FS__DEV_MODE );
311
+ }
312
+
313
+ if ( ! defined( 'WP_FS__ECHO_DEBUG_SDK' ) ) {
314
+ define( 'WP_FS__ECHO_DEBUG_SDK', WP_FS__DEV_MODE && ! empty( $_GET['fs_dbg_echo'] ) );
315
+ }
316
+ if ( ! defined( 'WP_FS__LOG_DATETIME_FORMAT' ) ) {
317
+ define( 'WP_FS__LOG_DATETIME_FORMAT', 'Y-m-d H:i:s' );
318
+ }
319
+ if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
320
+ define( 'FS_API__LOGGER_ON', WP_FS__DEBUG_SDK );
321
+ }
322
+
323
+ if ( WP_FS__ECHO_DEBUG_SDK ) {
324
+ error_reporting( E_ALL );
325
+ }
326
+
327
+ #endregion
328
+
329
+ if ( ! defined( 'WP_FS__SCRIPT_START_TIME' ) ) {
330
+ define( 'WP_FS__SCRIPT_START_TIME', time() );
331
+ }
332
+ if ( ! defined( 'WP_FS__DEFAULT_PRIORITY' ) ) {
333
+ define( 'WP_FS__DEFAULT_PRIORITY', 10 );
334
+ }
335
+ if ( ! defined( 'WP_FS__LOWEST_PRIORITY' ) ) {
336
+ define( 'WP_FS__LOWEST_PRIORITY', 999999999 );
337
+ }
338
+
339
+ #--------------------------------------------------------------------------------
340
+ #region Multisite Network
341
+ #--------------------------------------------------------------------------------
342
+
343
+ /**
344
+ * Do not use this define directly, it will have the wrong value
345
+ * during plugin uninstall/deletion when the inclusion of the plugin
346
+ * is triggered due to registration with register_uninstall_hook().
347
+ *
348
+ * Instead, use fs_is_network_admin().
349
+ *
350
+ * @author Vova Feldman (@svovaf)
351
+ */
352
+ if ( ! defined( 'WP_FS__IS_NETWORK_ADMIN' ) ) {
353
+ define( 'WP_FS__IS_NETWORK_ADMIN',
354
+ is_multisite() &&
355
+ ( is_network_admin() ||
356
+ ( ( defined( 'DOING_AJAX' ) && DOING_AJAX &&
357
+ ( isset( $_REQUEST['_fs_network_admin'] ) /*||
358
+ ( ! empty( $_REQUEST['action'] ) && 'delete-plugin' === $_REQUEST['action'] )*/ )
359
+ ) ||
360
+ // Plugin uninstall.
361
+ defined( 'WP_UNINSTALL_PLUGIN' ) )
362
+ )
363
+ );
364
+ }
365
+
366
+ /**
367
+ * Do not use this define directly, it will have the wrong value
368
+ * during plugin uninstall/deletion when the inclusion of the plugin
369
+ * is triggered due to registration with register_uninstall_hook().
370
+ *
371
+ * Instead, use fs_is_blog_admin().
372
+ *
373
+ * @author Vova Feldman (@svovaf)
374
+ */
375
+ if ( ! defined( 'WP_FS__IS_BLOG_ADMIN' ) ) {
376
+ define( 'WP_FS__IS_BLOG_ADMIN', is_blog_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['_fs_blog_admin'] ) ) );
377
+ }
378
+
379
+ if ( ! defined( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED' ) ) {
380
+ // Set to true to show network level settings even if delegated to site admins.
381
+ define( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED', false );
382
+ }
383
+
384
+ #endregion
385
+
386
+ if ( ! defined( 'WP_FS__DEMO_MODE' ) ) {
387
+ define( 'WP_FS__DEMO_MODE', false );
388
+ }
389
+ if ( ! defined( 'FS_SDK__SSLVERIFY' ) ) {
390
+ define( 'FS_SDK__SSLVERIFY', false );
391
+ }
lib/freemius/includes/class-freemius.php CHANGED
@@ -1674,6 +1674,7 @@
1674
  $this->add_ajax_action( 'update_billing', array( &$this, '_update_billing_ajax_action' ) );
1675
  $this->add_ajax_action( 'start_trial', array( &$this, '_start_trial_ajax_action' ) );
1676
  $this->add_ajax_action( 'set_data_debug_mode', array( &$this, '_set_data_debug_mode' ) );
 
1677
 
1678
  if ( $this->_is_network_active && fs_is_network_admin() ) {
1679
  $this->add_ajax_action( 'network_activate', array( &$this, '_network_activate_ajax_action' ) );
@@ -7736,7 +7737,10 @@
7736
  * @author Leo Fajardo (@leorw)
7737
  * @since 1.2.2
7738
  */
7739
- if ( is_plugin_active( $other_version_basename ) ) {
 
 
 
7740
  deactivate_plugins( $other_version_basename );
7741
  }
7742
  }
@@ -9021,12 +9025,25 @@
9021
  'is_uninstalled' => false,
9022
  );
9023
 
9024
- $plugins_update_data[] = $new_plugin;
9025
  $network_plugins_cache->plugins[ $basename ] = $new_plugin;
9026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9027
  if ( isset( $site_active_plugins[ $basename ] ) ) {
9028
  $site_active_plugins_cache->plugins[ $basename ] = $new_plugin;
9029
- $site_active_plugins_cache->plugins[ $basename ]['is_active'] = true;
9030
  }
9031
  }
9032
  }
@@ -13130,6 +13147,61 @@
13130
  }
13131
  }
13132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13133
  /**
13134
  * @author Leo Fajardo (@leorw)
13135
  * @since 2.3.0
@@ -20679,6 +20751,13 @@
20679
  }
20680
 
20681
  if ( 'none' !== $plan_change ) {
 
 
 
 
 
 
 
20682
  $this->do_action( 'after_license_change', $plan_change, $this->get_plan() );
20683
  }
20684
  }
@@ -22293,6 +22372,26 @@
22293
 
22294
  $this->_handle_account_edits();
22295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22296
  $this->do_action( 'account_page_load_before_departure' );
22297
  }
22298
 
@@ -23453,10 +23552,12 @@
23453
  * @since 1.0.3
23454
  */
23455
  function _redirect_on_activation_hook() {
23456
- $url = $this->get_after_plugin_activation_redirect_url();
 
23457
 
23458
- if ( is_string( $url ) ) {
23459
- fs_redirect( $url );
 
23460
  }
23461
  }
23462
 
1674
  $this->add_ajax_action( 'update_billing', array( &$this, '_update_billing_ajax_action' ) );
1675
  $this->add_ajax_action( 'start_trial', array( &$this, '_start_trial_ajax_action' ) );
1676
  $this->add_ajax_action( 'set_data_debug_mode', array( &$this, '_set_data_debug_mode' ) );
1677
+ $this->add_ajax_action( 'toggle_whitelabel_mode', array( &$this, '_toggle_whitelabel_mode_ajax_handler' ) );
1678
 
1679
  if ( $this->_is_network_active && fs_is_network_admin() ) {
1680
  $this->add_ajax_action( 'network_activate', array( &$this, '_network_activate_ajax_action' ) );
7737
  * @author Leo Fajardo (@leorw)
7738
  * @since 1.2.2
7739
  */
7740
+ if (
7741
+ is_plugin_active( $other_version_basename ) &&
7742
+ $this->apply_filters( 'deactivate_on_activation', true )
7743
+ ) {
7744
  deactivate_plugins( $other_version_basename );
7745
  }
7746
  }
9025
  'is_uninstalled' => false,
9026
  );
9027
 
 
9028
  $network_plugins_cache->plugins[ $basename ] = $new_plugin;
9029
 
9030
+ $is_site_level_active = (
9031
+ isset( $site_active_plugins[ $basename ] ) &&
9032
+ $site_active_plugins[ $basename ]['is_active']
9033
+ );
9034
+
9035
+ /**
9036
+ * If not network active, set the activity status based on the site-level plugin status.
9037
+ */
9038
+ if ( ! $new_plugin['is_active'] ) {
9039
+ $new_plugin['is_active'] = $is_site_level_active;
9040
+ }
9041
+
9042
+ $plugins_update_data[] = $new_plugin;
9043
+
9044
  if ( isset( $site_active_plugins[ $basename ] ) ) {
9045
  $site_active_plugins_cache->plugins[ $basename ] = $new_plugin;
9046
+ $site_active_plugins_cache->plugins[ $basename ]['is_active'] = $is_site_level_active;
9047
  }
9048
  }
9049
  }
13147
  }
13148
  }
13149
 
13150
+ /**
13151
+ * @author Edgar Melkonyan
13152
+ * @since 2.4.1
13153
+ *
13154
+ * @throws Freemius_Exception
13155
+ */
13156
+ function _toggle_whitelabel_mode_ajax_handler() {
13157
+ $this->_logger->entrance();
13158
+
13159
+ $this->check_ajax_referer( 'toggle_whitelabel_mode' );
13160
+
13161
+ if ( ! $this->is_user_admin() ) {
13162
+ // Only for admins.
13163
+ self::shoot_ajax_failure();
13164
+ }
13165
+
13166
+ $license = $this->get_api_user_scope()->call(
13167
+ "/licenses/{$this->_site->license_id}.json",
13168
+ 'put',
13169
+ array( 'is_whitelabeled' => ! $this->_license->is_whitelabeled )
13170
+ );
13171
+
13172
+ if ( ! $this->is_api_result_entity( $license ) ) {
13173
+ self::shoot_ajax_failure(
13174
+ FS_Api::is_api_error_object( $license ) ?
13175
+ $license->error->message :
13176
+ fs_text_inline( "An unknown error has occurred while trying to toggle the license's white-label mode.", 'unknown-error-occurred', $this->get_slug() )
13177
+ );
13178
+ }
13179
+
13180
+ $this->_license->is_whitelabeled = $license->is_whitelabeled;
13181
+ $this->_store_licenses();
13182
+
13183
+ $this->_sync_license();
13184
+
13185
+ if ( ! $license->is_whitelabeled ) {
13186
+ $this->_admin_notices->remove_sticky( 'license_whitelabeled' );
13187
+ } else {
13188
+ $this->_admin_notices->add_sticky(
13189
+ sprintf(
13190
+ $this->get_text_inline(
13191
+ 'Your %s license was flagged as white-labeled to hide sensitive information from the WP Admin (e.g. your email, license key, prices, billing address & invoices). If you ever wish to revert it back, you can easily do it through your %s. If this was a mistake you can also %s.',
13192
+ 'license_whitelabeled'
13193
+ ),
13194
+ "<strong>{$this->get_plugin_title()}</strong>",
13195
+ sprintf( '<a href="https://users.freemius.com" target="_blank">%s</a>', $this->get_text_inline( 'User Dashboard', 'user-dashboard' ) ),
13196
+ sprintf( '<a href="#" class="fs-toggle-whitelabel-mode">%s</a>', $this->get_text_inline( 'revert it now', 'revert-it-now' ) )
13197
+ ),
13198
+ 'license_whitelabeled'
13199
+ );
13200
+ }
13201
+
13202
+ self::shoot_ajax_response( array( 'success' => true ) );
13203
+ }
13204
+
13205
  /**
13206
  * @author Leo Fajardo (@leorw)
13207
  * @since 2.3.0
20751
  }
20752
 
20753
  if ( 'none' !== $plan_change ) {
20754
+ if (
20755
+ ! is_object( $this->_license ) ||
20756
+ ! $this->_license->is_whitelabeled
20757
+ ) {
20758
+ $this->_admin_notices->remove_sticky( 'license_whitelabeled' );
20759
+ }
20760
+
20761
  $this->do_action( 'after_license_change', $plan_change, $this->get_plan() );
20762
  }
20763
  }
22372
 
22373
  $this->_handle_account_edits();
22374
 
22375
+ if (
22376
+ is_object( $this->_license ) &&
22377
+ $this->_license->user_id == $this->_user->id &&
22378
+ ! $this->is_whitelabeled( true )
22379
+ ) {
22380
+ $this->_admin_notices->add(
22381
+ sprintf(
22382
+ $this->get_text_inline( "Is this your client's site? %s if you wish to hide sensitive info like your email, license key, prices, billing address & invoices from the WP Admin.", 'license_not_whitelabeled' ),
22383
+ sprintf(
22384
+ '<a href="#" class="fs-toggle-whitelabel-mode">%s</a>',
22385
+ $this->get_text_inline( 'Click here', 'click-here' )
22386
+ )
22387
+ ),
22388
+ '',
22389
+ 'success',
22390
+ false,
22391
+ 'license_not_whitelabeled'
22392
+ );
22393
+ }
22394
+
22395
  $this->do_action( 'account_page_load_before_departure' );
22396
  }
22397
 
23552
  * @since 1.0.3
23553
  */
23554
  function _redirect_on_activation_hook() {
23555
+ if ( $this->apply_filters( 'redirect_on_activation', true ) ) {
23556
+ $url = $this->get_after_plugin_activation_redirect_url();
23557
 
23558
+ if ( is_string( $url ) ) {
23559
+ fs_redirect( $url );
23560
+ }
23561
  }
23562
  }
23563
 
lib/freemius/includes/class-fs-plugin-updater.php CHANGED
@@ -542,23 +542,66 @@
542
  }
543
  }
544
 
 
 
 
545
  if ( is_object( $this->_update_details ) ) {
 
 
 
 
546
  if ( ! isset( $transient_data->response ) ) {
547
  $transient_data->response = array();
548
  }
549
 
550
  // Add plugin to transient data.
551
- $transient_data->response[ $this->_fs->premium_plugin_basename() ] = $this->_fs->is_plugin() ?
552
  $this->_update_details :
553
  (array) $this->_update_details;
554
- } else if ( isset( $transient_data->response ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
  /**
556
- * Ensure that there's no update data for the plugin to prevent upgrading the premium version to the latest free version.
557
  *
558
- * @author Leo Fajardo (@leorw)
559
- * @since 2.3.0
560
  */
561
- unset( $transient_data->response[ $this->_fs->premium_plugin_basename() ] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
  }
563
 
564
  $slug = $this->_fs->get_slug();
542
  }
543
  }
544
 
545
+ // Alias.
546
+ $basename = $this->_fs->premium_plugin_basename();
547
+
548
  if ( is_object( $this->_update_details ) ) {
549
+ if ( isset( $transient_data->no_update ) ) {
550
+ unset( $transient_data->no_update[ $basename ] );
551
+ }
552
+
553
  if ( ! isset( $transient_data->response ) ) {
554
  $transient_data->response = array();
555
  }
556
 
557
  // Add plugin to transient data.
558
+ $transient_data->response[ $basename ] = $this->_fs->is_plugin() ?
559
  $this->_update_details :
560
  (array) $this->_update_details;
561
+ } else {
562
+ if ( isset( $transient_data->response ) ) {
563
+ /**
564
+ * Ensure that there's no update data for the plugin to prevent upgrading the premium version to the latest free version.
565
+ *
566
+ * @author Leo Fajardo (@leorw)
567
+ * @since 2.3.0
568
+ */
569
+ unset( $transient_data->response[ $basename ] );
570
+ }
571
+
572
+ if ( ! isset( $transient_data->no_update ) ) {
573
+ $transient_data->no_update = array();
574
+ }
575
+
576
  /**
577
+ * Add product to no_update transient data to properly integrate with WP 5.5 auto-updates UI.
578
  *
579
+ * @since 2.4.1
580
+ * @link https://make.wordpress.org/core/2020/07/30/recommended-usage-of-the-updates-api-to-support-the-auto-updates-ui-for-plugins-and-themes-in-wordpress-5-5/
581
  */
582
+ $transient_data->no_update[ $basename ] = $this->_fs->is_plugin() ?
583
+ (object) array(
584
+ 'id' => $basename,
585
+ 'slug' => $this->_fs->get_slug(),
586
+ 'plugin' => $basename,
587
+ 'new_version' => $this->_fs->get_plugin_version(),
588
+ 'url' => '',
589
+ 'package' => '',
590
+ 'icons' => array(),
591
+ 'banners' => array(),
592
+ 'banners_rtl' => array(),
593
+ 'tested' => '',
594
+ 'requires_php' => '',
595
+ 'compatibility' => new stdClass(),
596
+ ) :
597
+ array(
598
+ 'theme' => $basename,
599
+ 'new_version' => $this->_fs->get_plugin_version(),
600
+ 'url' => '',
601
+ 'package' => '',
602
+ 'requires' => '',
603
+ 'requires_php' => '',
604
+ );
605
  }
606
 
607
  $slug = $this->_fs->get_slug();
lib/freemius/includes/fs-plugin-info-dialog.php CHANGED
@@ -260,14 +260,20 @@
260
  if ( $has_valid_blog_id ) {
261
  restore_current_blog();
262
  }
 
263
 
264
- if ( is_object( $fs_addon ) ) {
265
- $data->has_purchased_license = $fs_addon->has_active_valid_license();
266
- } else {
267
- $account_addons = $this->_fs->get_account_addons();
268
- if ( ! empty( $account_addons ) && in_array( $selected_addon->id, $account_addons ) ) {
269
- $data->has_purchased_license = true;
270
- }
 
 
 
 
 
271
  }
272
  }
273
 
@@ -577,7 +583,7 @@
577
 
578
  $has_installed_version = ( 'install' !== $this->status['status'] );
579
 
580
- if ( ! $api->has_paid_plan ) {
581
  /**
582
  * Free-only add-on.
583
  *
@@ -1203,7 +1209,7 @@
1203
 
1204
  $(document).ready(function () {
1205
  var $plan = $('.plugin-information-pricing .fs-plan[data-plan-id=<?php echo $plan->id ?>]');
1206
- $plan.find('input[type=radio]').live('click', function () {
1207
  _updateCtaUrl(
1208
  $plan.attr('data-plan-id'),
1209
  $(this).val(),
@@ -1635,4 +1641,4 @@
1635
  iframe_footer();
1636
  exit;
1637
  }
1638
- }
260
  if ( $has_valid_blog_id ) {
261
  restore_current_blog();
262
  }
263
+ }
264
 
265
+ /**
266
+ * Check if there's a purchased license in case the add-on can only be installed/downloaded as part of a purchased bundle.
267
+ *
268
+ * @author Leo Fajardo (@leorw)
269
+ * @since 2.4.1
270
+ */
271
+ if ( is_object( $fs_addon ) ) {
272
+ $data->has_purchased_license = $fs_addon->has_active_valid_license();
273
+ } else {
274
+ $account_addons = $this->_fs->get_account_addons();
275
+ if ( ! empty( $account_addons ) && in_array( $selected_addon->id, $account_addons ) ) {
276
+ $data->has_purchased_license = true;
277
  }
278
  }
279
 
583
 
584
  $has_installed_version = ( 'install' !== $this->status['status'] );
585
 
586
+ if ( ! $api->has_paid_plan && ! $api->has_purchased_license ) {
587
  /**
588
  * Free-only add-on.
589
  *
1209
 
1210
  $(document).ready(function () {
1211
  var $plan = $('.plugin-information-pricing .fs-plan[data-plan-id=<?php echo $plan->id ?>]');
1212
+ $plan.find('input[type=radio]').on('click', function () {
1213
  _updateCtaUrl(
1214
  $plan.attr('data-plan-id'),
1215
  $(this).val(),
1641
  iframe_footer();
1642
  exit;
1643
  }
1644
+ }
lib/freemius/includes/i18n.php CHANGED
@@ -98,6 +98,8 @@
98
  'error' => _fs_text( 'Error' ),
99
  'failed-finding-main-path' => _fs_text( 'Freemius SDK couldn\'t find the plugin\'s main file. Please contact sdk@freemius.com with the current error.' ),
100
  'learn-more' => _fs_text( 'Learn more' ),
 
 
101
 
102
  #region Affiliation
103
  'affiliation' => _fs_text( 'Affiliation' ),
98
  'error' => _fs_text( 'Error' ),
99
  'failed-finding-main-path' => _fs_text( 'Freemius SDK couldn\'t find the plugin\'s main file. Please contact sdk@freemius.com with the current error.' ),
100
  'learn-more' => _fs_text( 'Learn more' ),
101
+ 'license_not_whitelabeled' => _fs_text( "Is this your client's site? %s if you wish to hide sensitive info like your billing address and invoices from the WP Admin."),
102
+ 'license_whitelabeled' => _fs_text( 'Your %s license was flagged as white-labeled to hide sensitive information from the WP Admin (e.g. your billing address and invoices). If you ever wish to revert it back, you can easily do it through your %s. If this was a mistake you can also %s.'),
103
 
104
  #region Affiliation
105
  'affiliation' => _fs_text( 'Affiliation' ),
lib/freemius/includes/sdk/FreemiusWordPress.php CHANGED
@@ -59,6 +59,10 @@
59
  }
60
  }
61
 
 
 
 
 
62
  $curl_version = FS_SDK__HAS_CURL ?
63
  curl_version() :
64
  array( 'version' => '7.37' );
@@ -401,7 +405,7 @@
401
  }
402
 
403
  if ( 'https' === substr( strtolower( $request_url ), 0, 5 ) ) {
404
- $pWPRemoteArgs['sslverify'] = false;
405
  }
406
 
407
  if ( false !== $pBeforeExecutionFunction &&
59
  }
60
  }
61
 
62
+ if ( ! defined( 'FS_SDK__SSLVERIFY' ) ) {
63
+ define( 'FS_SDK__SSLVERIFY', false );
64
+ }
65
+
66
  $curl_version = FS_SDK__HAS_CURL ?
67
  curl_version() :
68
  array( 'version' => '7.37' );
405
  }
406
 
407
  if ( 'https' === substr( strtolower( $request_url ), 0, 5 ) ) {
408
+ $pWPRemoteArgs['sslverify'] = FS_SDK__SSLVERIFY;
409
  }
410
 
411
  if ( false !== $pBeforeExecutionFunction &&
lib/freemius/languages/freemius-cs_CZ.mo CHANGED
Binary file
lib/freemius/languages/freemius-da_DK.mo CHANGED
Binary file
lib/freemius/languages/freemius-en.mo CHANGED
Binary file
lib/freemius/languages/freemius-es_ES.mo CHANGED
Binary file
lib/freemius/languages/freemius-fr_FR.mo CHANGED
Binary file
lib/freemius/languages/freemius-he_IL.mo CHANGED
Binary file
lib/freemius/languages/freemius-hu_HU.mo CHANGED
Binary file
lib/freemius/languages/freemius-it_IT.mo CHANGED
Binary file
lib/freemius/languages/freemius-ja.mo CHANGED
Binary file
lib/freemius/languages/freemius-nl_NL.mo CHANGED
Binary file
lib/freemius/languages/freemius-ru_RU.mo CHANGED
Binary file
lib/freemius/languages/freemius-ta.mo CHANGED
Binary file
lib/freemius/languages/freemius-zh_CN.mo CHANGED
Binary file
lib/freemius/start.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @var string
17
  */
18
- $this_sdk_version = '2.4.0.1';
19
 
20
  #region SDK Selection Logic --------------------------------------------------------------------
21
 
15
  *
16
  * @var string
17
  */
18
+ $this_sdk_version = '2.4.1';
19
 
20
  #region SDK Selection Logic --------------------------------------------------------------------
21
 
lib/freemius/templates/account.php CHANGED
@@ -1056,6 +1056,29 @@
1056
  });
1057
  });
1058
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  })(jQuery);
1060
  </script>
1061
  <?php
1056
  });
1057
  });
1058
 
1059
+ $( '.fs-toggle-whitelabel-mode' ).click( function () {
1060
+ var $toggleLink = $( this );
1061
+
1062
+ $.ajax( {
1063
+ url : ajaxurl,
1064
+ method: 'POST',
1065
+ data : {
1066
+ action : '<?php echo $fs->get_ajax_action( 'toggle_whitelabel_mode' ) ?>',
1067
+ security : '<?php echo $fs->get_ajax_security( 'toggle_whitelabel_mode' ) ?>',
1068
+ module_id: <?php echo $fs->get_id() ?>
1069
+ },
1070
+ beforeSend: function () {
1071
+ $toggleLink.parent().text( '<?php
1072
+ $is_whitelabeled ?
1073
+ fs_esc_html_echo_inline( 'Disabling white-label mode', 'disabling-whitelabel-mode' ) :
1074
+ fs_esc_html_echo_inline( 'Enabling white-label mode', 'enabling-whitelabel-mode' )
1075
+ ?>' + '...' );
1076
+ },
1077
+ complete: function () {
1078
+ location.reload();
1079
+ }
1080
+ } );
1081
+ });
1082
  })(jQuery);
1083
  </script>
1084
  <?php
lib/freemius/templates/forms/affiliation.php CHANGED
@@ -220,10 +220,12 @@
220
  <p class="description"><?php echo esc_html( sprintf( fs_text_inline( 'Please provide details on how you intend to promote %s (please be as specific as possible).', 'promotion-method-desc-field-desc', $slug ), $plugin_title ) ) ?></p>
221
  <?php endif ?>
222
  </div>
 
223
  <div>
224
  <input type="checkbox" id="legal_consent_checkbox">
225
  <label for="legal_consent_checkbox">I agree to the <a href="<?php echo $affiliate_program_terms_url ?>" target="_blank" rel="noopener">Referrer Program</a>'s terms & conditions.</label>
226
  </div>
 
227
  </form>
228
  </div>
229
  <?php if ( ! $is_affiliate ) : ?>
220
  <p class="description"><?php echo esc_html( sprintf( fs_text_inline( 'Please provide details on how you intend to promote %s (please be as specific as possible).', 'promotion-method-desc-field-desc', $slug ), $plugin_title ) ) ?></p>
221
  <?php endif ?>
222
  </div>
223
+ <?php if ( ! $is_affiliate ) : ?>
224
  <div>
225
  <input type="checkbox" id="legal_consent_checkbox">
226
  <label for="legal_consent_checkbox">I agree to the <a href="<?php echo $affiliate_program_terms_url ?>" target="_blank" rel="noopener">Referrer Program</a>'s terms & conditions.</label>
227
  </div>
228
+ <?php endif ?>
229
  </form>
230
  </div>
231
  <?php if ( ! $is_affiliate ) : ?>
lib/wp-content-aware-engine/assets/js/condition_groups.min.js CHANGED
@@ -4,4 +4,4 @@
4
  * @license GPLv3
5
  * @copyright 2020 by Joachim Jensen
6
  */
7
- var CAE=CAE||{};!function($,CAE){"use strict";CAE.settings={views:{}},CAE.Models={},CAE.Models.Alert=Backbone.Model.extend({defaults:{text:"",success:!0},sync:function(){return!1},url:"",reset:function(){this.set(this.defaults)}}),CAE.Models.Condition=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:{module:null,label:"",placeholder:"",values:[],default_value:null},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this)},sync:function(){return!1},url:""}),CAE.Models.Group=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:function(){var e=WPCA.meta_default;return e.id=null,e.status="wpca_or",e.exposure=1,e},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this),this.conditions||(this.conditions=new CAE.Models.ConditionCollection)},parse:function(e){var t=[];if(_.has(e,"conditions")){for(var n in e.conditions)if(e.conditions.hasOwnProperty(n)){var i=[],o=e.conditions[n];for(var s in o.data)o.data.hasOwnProperty(s)&&i.push({text:"object"==typeof o.data[s]?o.data[s].text:o.data[s],id:s});delete o.data,o.module=n,o.values=i,t.push(o)}delete e.conditions}return this.conditions=new CAE.Models.ConditionCollection(t),e},sync:function(){return!1},url:""}),CAE.Models.GroupCollection=Backbone.Collection.extend({model:CAE.Models.Group,parse:function(e){return e}}),CAE.Models.ConditionCollection=Backbone.Collection.extend({model:CAE.Models.Condition}),CAE.Views={},CAE.Views.Alert=Backbone.Epoxy.View.extend({bindings:"data-vm",tagName:"div",className:"wpca-alert",template:"<div data-vm=\"classes:{'wpca-success':success,'wpca-error':not(success)},text:text\"></div>",timer:4e3,success:function(e){this.model.set({text:e,success:!0})},failure:function(e){this.model.set({text:e,success:!1})},dismiss:function(){var e=this;this.$el.fadeOut("slow",function(){e.model.reset()})},initialize:function(){this.listenTo(this.model,"change:text",this.show),this.$el.appendTo("body").hide().html(this.template)},show:function(){if(""!==this.model.get("text")){this.$el.fadeIn("slow");var e=this;setTimeout(function(){e.dismiss()},this.timer)}}}),CAE.Views.Condition=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Condition,tagName:"div",className:"cas-condition",templateName:"#wpca-template-condition",events:{"click .js-wpca-condition-remove":"removeModel"},initialize:function(){this.listenTo(this.model,"destroy",this.remove);var e=$(this.templateName);e.length?(this.template=e.html(),this.$el.append(this.template),this.createSuggestInput()):this.model.destroy()},removeModel:function(e){var t=this;this.$el.slideUp(300,function(){t.model.destroy()})},createSuggestInput:function(){var n=this.$el.find(".js-wpca-suggest");if(n.length){var i=this.model,e=this.model.get("values"),t=$("<div></div>").html(i.get("placeholder")).text();n.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:i.get("module"),theme:"wpca",dir:WPCA.text_direction,placeholder:t,minimumInputLength:0,closeOnSelect:!0,width:"100%",language:{noResults:function(){return WPCA.noResults},searching:function(){return WPCA.searching+"..."},loadingMore:function(){return WPCA.loadingMore+"..."}},nextSearchTerm:function(e,t){return t},templateResult:function(e){return e.level?$('<span class="wpca-level-'+e.level+'">'+e.text+"</span>"):e.text},data:e,dataAdapter:l.wpcaDataAdapter,ajax:{}}).on("select2:selecting",function(e){n.data("forceOpen",!0)}).on("select2:closing",function(e){n.data("forceOpen")&&(e.preventDefault(),n.data("forceOpen",!1))}),e.length&&n.val(_.map(e,function(e){return e.id})).trigger("change"),n.on("change",function(e){var t=n.select2("data");i.set("values",t)})}}}),CAE.Views.Group=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Group,tagName:"li",className:"cas-group-single",template:$("#wpca-template-group").html(),itemView:function(e){if(CAE.Views[e.model.get("module")])var t=new(CAE.Views[e.model.get("module")])(e);else t=new CAE.Views.Condition(e);return t},events:{"click .js-wpca-save-group":"saveGroup","click .js-wpca-options":"showOptions"},computeds:{statusNegated:{deps:["status"],get:function(e){return"negated"==e},set:function(e){var t=e?"negated":"wpca_or";this.setBinding("status",t)}},statusExcept:{deps:["status"],get:function(e){return"wpca_except"==e},set:function(e){var t=e?"wpca_except":"wpca_or";this.setBinding("status",t)}},statusLabel:function(){switch(this.getBinding("status")){case"wpca_except":return WPCA.condition_except;case"negated":return WPCA.condition_not;default:return WPCA.condition_or}}},bindingFilters:{int:{get:function(e){return e?1:0},set:function(e){return e?1:0}},binary:{get:function(e){return e?1:0},set:function(e){return e?1:0}},hasModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return e.filter(function(e){return t.hasOwnProperty(e.get("module"))}).length==arguments.length-1},hasAnyModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return!!e.find(function(e){return t.hasOwnProperty(e.get("module"))})}},initialize:function(){this.collection=this.model.conditions,this.$el.hide().html(this.template).fadeIn(300),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"add remove",this.saveAddRemove);var i=this,o=$(".js-wpca-add-and",this.$el);o.select2({theme:"wpca",placeholder:"+ "+WPCA.newCondition,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"resolve",nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data;if(!i.model.conditions.findWhere({module:t.id})){var n=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});i.model.conditions.add(n)}o.val(null).trigger("change")})},showOptions:function(e){$(e.delegateTarget).find(".cas-group-options").slideToggle(200),$(e.currentTarget).toggleClass("active")},saveChanges:function(e,t){e&&i.start(this)},saveAddRemove:function(e,t,n){t.length?n.add?""!==e.get("default_value")&&i.start(this):this.model.get("id")&&i.start(this):(i.clear(this),this.model.get("id")?this.saveGroup():this.removeModel())},removeModel:function(){var e=this;this.$el.slideUp(400,function(){e.model.destroy()})},saveGroup:function(e){var i=this.$el.find(".spinner"),o=this.$el.find(".js-wpca-save-group"),t=this,n=_.clone(this.model.attributes);n.action="wpca/add-rule",n.token=l.nonce,n.current_id=l.sidebarID,n.post_type=WPCA.post_type,n.conditions={},this.model.conditions.each(function(e){e.get("values").length?n.conditions[e.get("module")]=e.get("values").map(function(e){return e.id}):""!==e.get("default_value")&&(n.conditions[e.get("module")]=[e.get("default_value")])}),o.attr("disabled",!0),i.addClass("is-active"),$.ajax({url:ajaxurl,data:n,dataType:"JSON",type:"POST",success:function(e){l.alert.success(e.message),e.removed?t.removeModel():e.new_post_id&&t.model.set("id",e.new_post_id,{silent:!0}),e.removed||(o.hide(),i.removeClass("is-active"),t.model.restartTracking(),t.model.conditions.each(function(e){e.restartTracking()}))},error:function(e,t,n){o.attr("disabled",!1).show(),i.removeClass("is-active"),l.alert.failure(e.responseJSON.data)}})},slideRemove:function(){this.$el.slideUp(400,function(){this.remove()})}}),CAE.Views.GroupCollection=Backbone.Epoxy.View.extend({bindings:"data-vm",el:"#cas-groups",collection:CAE.Models.GroupCollection,events:{"click .js-wpca-add-quick":"addGroupQuick","click .js-wpca-save":"saveAll"},conditionsById:{},initialize:function(){var o=this;this.conditionsById=_.chain(WPCA.conditions).pluck(["children"]).flatten().indexBy("id").value();var s=$(".js-wpca-add-or",this.$el);s.select2({theme:"wpca",placeholder:"+ "+WPCA.newGroup,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"auto",nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data,n=new CAE.Models.Group,i=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});o.collection.add(n),n.conditions.add(i),s.val(null).trigger("change")})},itemView:function(e){return new CAE.Views.Group(e)},addGroupQuick:function(e){e.preventDefault();var t=$(e.currentTarget).data("config"),n=new CAE.Models.Group;for(var i in n.set(t.options),this.collection.add(n),t.modules)if(this.conditionsById.hasOwnProperty(t.modules[i])){var o=this.conditionsById[t.modules[i]],s=new CAE.Models.Condition({module:o.id,label:o.text,placeholder:o.placeholder,default_value:o.default_value});n.conditions.add(s)}}}),$.fn.select2.amd.require(["select2/selection/search"],function(e){e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(""),this.handleSearch()}},null,!0),$.fn.select2.amd.require(["select2/results"],function(e){e.prototype.ensureHighlightVisible=function(){this.$results.resize()}},null,!0),$.fn.select2.amd.define("select2/data/wpcaAdapter",["select2/data/array","select2/utils"],function(e,t){function n(e,t){n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype.query=function(n,i){n.term=n.term||"";var o=this.options.options,s=o.cachedResults[n.term],a=n.page||1;if(s&&s.page>=a){if(!(1<a))return void i({results:s.items,pagination:{more:s.more}});a=s.page}clearTimeout(o.searchTimer),o.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:n.term,paged:a,limit:20,action:"wpca/module/"+o.type,sidebar_id:l.sidebarID,nonce:l.nonce},dataType:"JSON",type:"POST",success:function(e){var t=!(e.length<20);o.cachedResults[n.term]={page:a,more:t,items:s?o.cachedResults[n.term].items.concat(e):e},i({results:e,pagination:{more:t}})}})},o.quietMillis)},n});var i={treshold:2e3,timerQueue:{},start:function(e){this.clear(e);var t=this;this.timerQueue[e.cid]=window.setTimeout(function(){t.set(e)},this.treshold)},set:function(e){e.saveGroup()},clear:function(e){e&&this.timerQueue[e.cid]&&window.clearInterval(this.timerQueue[e.cid])}},l={nonce:$("#_ca_nonce").val(),sidebarID:$("#post_ID").val(),alert:null,wpcaDataAdapter:$.fn.select2.amd.require("select2/data/wpcaAdapter"),init:function(){this.alert=new CAE.Views.Alert({model:new CAE.Models.Alert}),CAE.conditionGroups=new CAE.Views.GroupCollection({collection:new CAE.Models.GroupCollection(WPCA.groups,{parse:!0})})}};$(document).ready(function(){l.init()})}(jQuery,CAE);
4
  * @license GPLv3
5
  * @copyright 2020 by Joachim Jensen
6
  */
7
+ var CAE=CAE||{};!function($,CAE){"use strict";CAE.settings={views:{}},CAE.Models={},CAE.Models.Alert=Backbone.Model.extend({defaults:{text:"",success:!0},sync:function(){return!1},url:"",reset:function(){this.set(this.defaults)}}),CAE.Models.Condition=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:{module:null,label:"",placeholder:"",values:[],default_value:null},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this)},sync:function(){return!1},url:""}),CAE.Models.Group=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:function(){var e=WPCA.meta_default;return e.id=null,e.status="wpca_or",e.exposure=1,e},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this),this.conditions||(this.conditions=new CAE.Models.ConditionCollection)},parse:function(e){var t=[];if(_.has(e,"conditions")){for(var n in e.conditions)if(e.conditions.hasOwnProperty(n)){var i=[],o=e.conditions[n];for(var s in o.data)o.data.hasOwnProperty(s)&&i.push({text:"object"==typeof o.data[s]?o.data[s].text:o.data[s],id:s});delete o.data,o.module=n,o.values=i,t.push(o)}delete e.conditions}return this.conditions=new CAE.Models.ConditionCollection(t),e},sync:function(){return!1},url:""}),CAE.Models.GroupCollection=Backbone.Collection.extend({model:CAE.Models.Group,parse:function(e){return e}}),CAE.Models.ConditionCollection=Backbone.Collection.extend({model:CAE.Models.Condition}),CAE.Views={},CAE.Views.Alert=Backbone.Epoxy.View.extend({bindings:"data-vm",tagName:"div",className:"wpca-alert",template:"<div data-vm=\"classes:{'wpca-success':success,'wpca-error':not(success)},text:text\"></div>",timer:4e3,success:function(e){this.model.set({text:e,success:!0})},failure:function(e){this.model.set({text:e,success:!1})},dismiss:function(){var e=this;this.$el.fadeOut("slow",function(){e.model.reset()})},initialize:function(){this.listenTo(this.model,"change:text",this.show),this.$el.appendTo("body").hide().html(this.template)},show:function(){if(""!==this.model.get("text")){this.$el.fadeIn("slow");var e=this;setTimeout(function(){e.dismiss()},this.timer)}}}),CAE.Views.Condition=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Condition,tagName:"div",className:"cas-condition",templateName:"#wpca-template-condition",events:{"click .js-wpca-condition-remove":"removeModel"},initialize:function(){this.listenTo(this.model,"destroy",this.remove);var e=$(this.templateName);e.length?(this.template=e.html(),this.$el.append(this.template),this.createSuggestInput()):this.model.destroy()},removeModel:function(e){var t=this;this.$el.slideUp(300,function(){t.model.destroy()})},createSuggestInput:function(){var n=this.$el.find(".js-wpca-suggest");if(n.length){var i=this.model,e=this.model.get("values"),t=$("<div></div>").html(i.get("placeholder")).text();n.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:i.get("module"),theme:"wpca",dir:WPCA.text_direction,placeholder:t,minimumInputLength:0,closeOnSelect:!0,width:"100%",language:{noResults:function(){return WPCA.noResults},searching:function(){return WPCA.searching+"..."},loadingMore:function(){return WPCA.loadingMore+"..."}},nextSearchTerm:function(e,t){return t},templateResult:function(e){return e.level?$('<span class="wpca-level-'+e.level+'">'+e.text+"</span>"):e.text},data:e,dataAdapter:l.wpcaDataAdapter,ajax:{}}).on("select2:selecting",function(e){n.data("forceOpen",!0)}).on("select2:closing",function(e){n.data("forceOpen")&&(e.preventDefault(),n.data("forceOpen",!1))}),e.length&&n.val(_.map(e,function(e){return e.id})).trigger("change"),n.on("change",function(e){var t=n.select2("data");i.set("values",t)})}}}),CAE.Views.Group=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Group,tagName:"li",className:"cas-group-single",template:$("#wpca-template-group").html(),itemView:function(e){if(CAE.Views[e.model.get("module")])var t=new(CAE.Views[e.model.get("module")])(e);else t=new CAE.Views.Condition(e);return t},events:{"click .js-wpca-save-group":"saveGroup","click .js-wpca-options":"showOptions"},computeds:{statusNegated:{deps:["status"],get:function(e){return"negated"==e},set:function(e){var t=e?"negated":"wpca_or";this.setBinding("status",t)}},statusExcept:{deps:["status"],get:function(e){return"wpca_except"==e},set:function(e){var t=e?"wpca_except":"wpca_or";this.setBinding("status",t)}},statusLabel:function(){switch(this.getBinding("status")){case"wpca_except":return WPCA.condition_except;case"negated":return WPCA.condition_not;default:return WPCA.condition_or}}},bindingFilters:{int:{get:function(e){return e?1:0},set:function(e){return e?1:0}},binary:{get:function(e){return e?1:0},set:function(e){return e?1:0}},hasModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return e.filter(function(e){return t.hasOwnProperty(e.get("module"))}).length==arguments.length-1},hasAnyModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return!!e.find(function(e){return t.hasOwnProperty(e.get("module"))})}},initialize:function(){this.collection=this.model.conditions,this.$el.hide().html(this.template).fadeIn(300),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"add remove",this.saveAddRemove);var i=this,o=$(".js-wpca-add-and",this.$el);o.select2({theme:"wpca",placeholder:"+ "+WPCA.newCondition,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"resolve",matcher:l.wpcaModuleMatcher,nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data;if(!i.model.conditions.findWhere({module:t.id})){var n=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});i.model.conditions.add(n)}o.val(null).trigger("change")})},showOptions:function(e){$(e.delegateTarget).find(".cas-group-options").slideToggle(200),$(e.currentTarget).toggleClass("active")},saveChanges:function(e,t){e&&i.start(this)},saveAddRemove:function(e,t,n){t.length?n.add?""!==e.get("default_value")&&i.start(this):this.model.get("id")&&i.start(this):(i.clear(this),this.model.get("id")?this.saveGroup():this.removeModel())},removeModel:function(){var e=this;this.$el.slideUp(400,function(){e.model.destroy()})},saveGroup:function(e){var i=this.$el.find(".spinner"),o=this.$el.find(".js-wpca-save-group"),t=this,n=_.clone(this.model.attributes);n.action="wpca/add-rule",n.token=l.nonce,n.current_id=l.sidebarID,n.post_type=WPCA.post_type,n.conditions={},this.model.conditions.each(function(e){e.get("values").length?n.conditions[e.get("module")]=e.get("values").map(function(e){return e.id}):""!==e.get("default_value")&&(n.conditions[e.get("module")]=[e.get("default_value")])}),o.attr("disabled",!0),i.addClass("is-active"),$.ajax({url:ajaxurl,data:n,dataType:"JSON",type:"POST",success:function(e){l.alert.success(e.message),e.removed?t.removeModel():e.new_post_id&&t.model.set("id",e.new_post_id,{silent:!0}),e.removed||(o.hide(),i.removeClass("is-active"),t.model.restartTracking(),t.model.conditions.each(function(e){e.restartTracking()}))},error:function(e,t,n){o.attr("disabled",!1).show(),i.removeClass("is-active"),l.alert.failure(e.responseJSON.data)}})},slideRemove:function(){this.$el.slideUp(400,function(){this.remove()})}}),CAE.Views.GroupCollection=Backbone.Epoxy.View.extend({bindings:"data-vm",el:"#cas-groups",collection:CAE.Models.GroupCollection,events:{"click .js-wpca-add-quick":"addGroupQuick","click .js-wpca-save":"saveAll"},conditionsById:{},initialize:function(){var o=this;this.conditionsById=_.chain(WPCA.conditions).pluck(["children"]).flatten().indexBy("id").value();var s=$(".js-wpca-add-or",this.$el);s.select2({theme:"wpca",placeholder:"+ "+WPCA.newGroup,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"auto",matcher:l.wpcaModuleMatcher,nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data,n=new CAE.Models.Group,i=new CAE.Models.Condition({module:t.id,label:t.text,placeholder:t.placeholder,default_value:t.default_value});o.collection.add(n),n.conditions.add(i),s.val(null).trigger("change")})},itemView:function(e){return new CAE.Views.Group(e)},addGroupQuick:function(e){e.preventDefault();var t=$(e.currentTarget).data("config"),n=new CAE.Models.Group;for(var i in n.set(t.options),this.collection.add(n),t.modules)if(this.conditionsById.hasOwnProperty(t.modules[i])){var o=this.conditionsById[t.modules[i]],s=new CAE.Models.Condition({module:o.id,label:o.text,placeholder:o.placeholder,default_value:o.default_value});n.conditions.add(s)}}}),$.fn.select2.amd.require(["select2/selection/search"],function(e){e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(""),this.handleSearch()}},null,!0),$.fn.select2.amd.require(["select2/results"],function(e){e.prototype.ensureHighlightVisible=function(){this.$results.resize()}},null,!0),$.fn.select2.amd.define("select2/wpca/conditionData",["select2/data/array","select2/utils"],function(e,t){function n(e,t){n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype.query=function(n,i){n.term=n.term||"";var o=this.options.options,s=o.cachedResults[n.term],a=n.page||1;if(s&&s.page>=a){if(!(1<a))return void i({results:s.items,pagination:{more:s.more}});a=s.page}clearTimeout(o.searchTimer),o.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:n.term,paged:a,limit:20,action:"wpca/module/"+o.type,sidebar_id:l.sidebarID,nonce:l.nonce},dataType:"JSON",type:"POST",success:function(e){var t=!(e.length<20);o.cachedResults[n.term]={page:a,more:t,items:s?o.cachedResults[n.term].items.concat(e):e},i({results:e,pagination:{more:t}})}})},o.quietMillis)},n}),$.fn.select2.amd.define("select2/wpca/moduleMatcher",["select2/diacritics"],function(t){function l(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}return function e(t,n){if(null==t.term||""===t.term.trim())return n;var i=l(n.text).toUpperCase(),o=l(t.term).toUpperCase();if(-1<i.indexOf(o))return n;if(n.children&&0<n.children.length){for(var s=$.extend(!0,{},n),a=n.children.length-1;0<=a;a--)null==e(t,n.children[a])&&s.children.splice(a,1);return 0<s.children.length?s:e(t,s)}return null}});var i={treshold:2e3,timerQueue:{},start:function(e){this.clear(e);var t=this;this.timerQueue[e.cid]=window.setTimeout(function(){t.set(e)},this.treshold)},set:function(e){e.saveGroup()},clear:function(e){e&&this.timerQueue[e.cid]&&window.clearInterval(this.timerQueue[e.cid])}},l={nonce:$("#_ca_nonce").val(),sidebarID:$("#post_ID").val(),alert:null,wpcaDataAdapter:$.fn.select2.amd.require("select2/wpca/conditionData"),wpcaModuleMatcher:$.fn.select2.amd.require("select2/wpca/moduleMatcher"),init:function(){this.alert=new CAE.Views.Alert({model:new CAE.Models.Alert}),CAE.conditionGroups=new CAE.Views.GroupCollection({collection:new CAE.Models.GroupCollection(WPCA.groups,{parse:!0})})}};$(function(){l.init()})}(jQuery,CAE);
lib/wp-content-aware-engine/bootstrap.php CHANGED
@@ -12,7 +12,7 @@ defined('ABSPATH') || exit;
12
  * Version of this WPCA
13
  * @var string
14
  */
15
- $this_wpca_version = '9.1.1';
16
 
17
  /**
18
  * Class to make sure the latest
12
  * Version of this WPCA
13
  * @var string
14
  */
15
+ $this_wpca_version = '9.1.1.2';
16
 
17
  /**
18
  * Class to make sure the latest
lib/wp-content-aware-engine/module/post_type.php CHANGED
@@ -135,7 +135,7 @@ class WPCAModule_post_type extends WPCAModule_Base
135
  ))
136
  ));
137
  } else {
138
- if (is_post_type_hierarchical($args['post_type']) && !$args['post__in']) {
139
  $args['posts_per_page'] = -1;
140
  $args['paged'] = 0;
141
  $args['orderby'] = 'menu_order title';
@@ -328,7 +328,7 @@ class WPCAModule_post_type extends WPCAModule_Base
328
  }
329
 
330
  $post_status = array('publish','private','future','draft');
331
- if ($post_status == 'attachment') {
332
  $post_status = array('inherit');
333
  }
334
 
@@ -503,7 +503,7 @@ class WPCAModule_post_type extends WPCAModule_Base
503
  // Get sidebars with post ancestor wanting to auto-select post
504
  $query = new WP_Query(array(
505
  'post_type' => WPCACore::TYPE_CONDITION_GROUP,
506
- 'post_status' => array('wpca_or','wpca_and','publish'),
507
  'meta_query' => array(
508
  'relation' => 'AND',
509
  array(
135
  ))
136
  ));
137
  } else {
138
+ if (is_post_type_hierarchical($args['post_type']) && !isset($args['post__in'])) {
139
  $args['posts_per_page'] = -1;
140
  $args['paged'] = 0;
141
  $args['orderby'] = 'menu_order title';
328
  }
329
 
330
  $post_status = array('publish','private','future','draft');
331
+ if ($post_type_name == 'attachment') {
332
  $post_status = array('inherit');
333
  }
334
 
503
  // Get sidebars with post ancestor wanting to auto-select post
504
  $query = new WP_Query(array(
505
  'post_type' => WPCACore::TYPE_CONDITION_GROUP,
506
+ 'post_status' => array(WPCACore::STATUS_OR,WPCACore::STATUS_EXCEPT,WPCACore::STATUS_PUBLISHED),
507
  'meta_query' => array(
508
  'relation' => 'AND',
509
  array(
lib/wp-content-aware-engine/module/taxonomy.php CHANGED
@@ -301,18 +301,13 @@ class WPCAModule_taxonomy extends WPCAModule_Base
301
  $terms_by_tax[$term->taxonomy][] = $term;
302
  }
303
 
 
304
  foreach ($this->_get_taxonomies() as $taxonomy) {
305
  $posts = isset($terms_by_tax[$taxonomy->name]) ? $terms_by_tax[$taxonomy->name] : 0;
306
 
307
  if ($posts || isset($ids[$taxonomy->name])) {
308
- $placeholder = '/'.sprintf(__('%s Archives', WPCA_DOMAIN), $taxonomy->labels->singular_name);
309
- $placeholder = $taxonomy->labels->all_items.$placeholder;
310
-
311
- $group_data[$this->id.'-'.$taxonomy->name] = array(
312
- 'label' => $taxonomy->label,
313
- 'placeholder' => $placeholder,
314
- 'default_value' => $taxonomy->name
315
- );
316
 
317
  if ($posts) {
318
  $retval = array();
@@ -331,6 +326,41 @@ class WPCAModule_taxonomy extends WPCAModule_Base
331
  return $group_data;
332
  }
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  /**
335
  * @since 2.0
336
  * @param array $list
@@ -339,15 +369,11 @@ class WPCAModule_taxonomy extends WPCAModule_Base
339
  */
340
  public function list_module($list)
341
  {
 
342
  foreach ($this->_get_taxonomies() as $taxonomy) {
343
- $placeholder = '/'.sprintf(__('%s Archives', WPCA_DOMAIN), $taxonomy->labels->singular_name);
344
- $placeholder = $taxonomy->labels->all_items.$placeholder;
345
- $list[] = array(
346
- 'id' => $this->id.'-'.$taxonomy->name,
347
- 'text' => $taxonomy->label,
348
- 'placeholder' => $placeholder,
349
- 'default_value' => $taxonomy->name
350
- );
351
  }
352
  return $list;
353
  }
@@ -371,7 +397,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
371
  'include' => $args['include'],
372
  'taxonomy' => $taxonomy_name,
373
  'number' => $args['limit'],
374
- 'offset' => ($args['paged'] - 1) * $args['number'],
375
  'orderby' => 'name',
376
  'order' => 'ASC',
377
  'search' => $args['search'],
@@ -448,7 +474,7 @@ class WPCAModule_taxonomy extends WPCAModule_Base
448
  // Get sidebars with term ancestor wanting to auto-select term
449
  $query = new WP_Query(array(
450
  'post_type' => WPCACore::TYPE_CONDITION_GROUP,
451
- 'post_status' => array('wpca_or','wpca_and','publish'),
452
  'meta_query' => array(
453
  array(
454
  'key' => WPCACore::PREFIX . 'autoselect',
301
  $terms_by_tax[$term->taxonomy][] = $term;
302
  }
303
 
304
+ $title_count = $this->get_title_count();
305
  foreach ($this->_get_taxonomies() as $taxonomy) {
306
  $posts = isset($terms_by_tax[$taxonomy->name]) ? $terms_by_tax[$taxonomy->name] : 0;
307
 
308
  if ($posts || isset($ids[$taxonomy->name])) {
309
+ $group_data[$this->id.'-'.$taxonomy->name] = $this->get_list_data($taxonomy, $title_count[$taxonomy->label]);
310
+ $group_data[$this->id.'-'.$taxonomy->name]['label'] = $group_data[$this->id.'-'.$taxonomy->name]['text'];
 
 
 
 
 
 
311
 
312
  if ($posts) {
313
  $retval = array();
326
  return $group_data;
327
  }
328
 
329
+ /**
330
+ * Count taxonomy labels to find shared ones
331
+ *
332
+ * @return array
333
+ */
334
+ protected function get_title_count()
335
+ {
336
+ $title_count = array();
337
+ foreach ($this->_get_taxonomies() as $taxonomy) {
338
+ if (!isset($title_count[$taxonomy->label])) {
339
+ $title_count[$taxonomy->label] = 0;
340
+ }
341
+ $title_count[$taxonomy->label]++;
342
+ }
343
+ return $title_count;
344
+ }
345
+
346
+ protected function get_list_data($taxonomy, $title_count)
347
+ {
348
+ $placeholder = '/'.sprintf(__('%s Archives', WPCA_DOMAIN), $taxonomy->labels->singular_name);
349
+ $placeholder = $taxonomy->labels->all_items.$placeholder;
350
+ $label = $taxonomy->label;
351
+
352
+ if (count($taxonomy->object_type) === 1 && $title_count > 1) {
353
+ $post_type = get_post_type_object($taxonomy->object_type[0]);
354
+ $label .= ' (' . $post_type->label . ')';
355
+ }
356
+
357
+ return array(
358
+ 'text' => $label,
359
+ 'placeholder' => $placeholder,
360
+ 'default_value' => $taxonomy->name
361
+ );
362
+ }
363
+
364
  /**
365
  * @since 2.0
366
  * @param array $list
369
  */
370
  public function list_module($list)
371
  {
372
+ $title_count = $this->get_title_count();
373
  foreach ($this->_get_taxonomies() as $taxonomy) {
374
+ $data = $this->get_list_data($taxonomy, $title_count[$taxonomy->label]);
375
+ $data['id'] = $this->id.'-'.$taxonomy->name;
376
+ $list[] = $data;
 
 
 
 
 
377
  }
378
  return $list;
379
  }
397
  'include' => $args['include'],
398
  'taxonomy' => $taxonomy_name,
399
  'number' => $args['limit'],
400
+ 'offset' => ($args['paged'] - 1) * $args['limit'],
401
  'orderby' => 'name',
402
  'order' => 'ASC',
403
  'search' => $args['search'],
474
  // Get sidebars with term ancestor wanting to auto-select term
475
  $query = new WP_Query(array(
476
  'post_type' => WPCACore::TYPE_CONDITION_GROUP,
477
+ 'post_status' => array(WPCACore::STATUS_OR,WPCACore::STATUS_EXCEPT,WPCACore::STATUS_PUBLISHED),
478
  'meta_query' => array(
479
  array(
480
  'key' => WPCACore::PREFIX . 'autoselect',
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: custom sidebars, sidebar, hide sidebar, display widgets, widget, bbpress,
5
  Requires at least: 4.8
6
  Requires PHP: 5.6
7
  Tested up to: 5.5
8
- Stable tag: 3.13
9
  License: GPLv3
10
 
11
  Display new sidebars and widget areas on any post, page, category etc. Works with all themes, no code required.
@@ -172,6 +172,17 @@ Of course! Check out the links below:
172
 
173
  ####Highlights
174
 
 
 
 
 
 
 
 
 
 
 
 
175
  = 3.13 =
176
 
177
  * [new] exception conditions
@@ -219,20 +230,4 @@ Of course! Check out the links below:
219
  * [new] action to display widget area after paragraphs
220
  * [updated] css will no longer be loaded for empty sidebars
221
 
222
- = 3.11.1 =
223
-
224
- * [fixed] conditions would not always be auto-saved
225
-
226
- = 3.11 =
227
-
228
- * [new] condition type cache for improved performance
229
- * [updated] ui improvements
230
- * [updated] wp-content-aware-engine library
231
- * [updated] freemius sdk
232
-
233
- **Pro Plan:**
234
-
235
- * [updated] sticky option now fully supports most themes out of the box
236
- * [fixed] sticky option would in some cases result in error
237
-
238
  See changelog.txt for previous changes.
5
  Requires at least: 4.8
6
  Requires PHP: 5.6
7
  Tested up to: 5.5
8
+ Stable tag: 3.13.1
9
  License: GPLv3
10
 
11
  Display new sidebars and widget areas on any post, page, category etc. Works with all themes, no code required.
172
 
173
  ####Highlights
174
 
175
+ = 3.13.1 =
176
+
177
+ * [new] identical taxonomy names are now displayed with their post type
178
+ * [fixed] taxonomy and attachment condition suggestions would not display all results
179
+ * [updated] wp-content-aware-engine library
180
+ * [updated] freemius sdk
181
+
182
+ **Pro Plan:**
183
+
184
+ * [new] support for auto-updates
185
+
186
  = 3.13 =
187
 
188
  * [new] exception conditions
230
  * [new] action to display widget area after paragraphs
231
  * [updated] css will no longer be loaded for empty sidebars
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  See changelog.txt for previous changes.