<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">define(['moment','underscore','ko','jquery','mageUtils','Magento_Ui/js/form/element/date','Southflorals_Delivery/js/checkout/datepicker'],function(moment,_,ko,$,utils,AbstractField){'use strict';return AbstractField.extend({defaults:{elementTmpl:'Southflorals_Delivery/form/element/date',options:{}},initConfig:function(){this._super();this.southFloralsDeliveryConfig=this.options.southFloralsDeliveryConfig;this.options.beforeShowDay=this.restrictDates.bind(this);return this;},getElem:function(){return this;},prepareDateTimeFormats:function(){this.pickerDateTimeFormat=this.options.dateFormat;if(this.options.showsTime){this.pickerDateTimeFormat+=' '+this.options.timeFormat;}
this.pickerDateTimeFormat=this.normalizeDate(this.pickerDateTimeFormat);if(this.dateFormat){this.inputDateFormat=this.dateFormat;}
this.inputDateFormat=this.normalizeDate(this.inputDateFormat);this.outputDateFormat=this.normalizeDate(this.outputDateFormat);this.validationParams.dateFormat=this.outputDateFormat;},normalizeDate:function(mageFormat){var result=mageFormat;_.each(this.map,function(moment,mage){result=result.replace(new RegExp(mage,'g'),moment);});return result;},map:{'D':'DDD','d':'D','EEEE':'dddd','EEE':'ddd','e':'d','y':'Y','a':'A'},milliseconds:3600*24*1000,dateValidationIteration:0,dateValidationIterationLimit:90,restrictDates:function(d){if(this.disableSameDay(d)||this.disableNextDay(d)||this.restrictDateLessToday(d)){return[false,""];}else if(this.notRestrictWorkingDays(d)){return[true,""];}else if(this.minDays(d)||this.maxDays(d)||this.restrictDateInterval(d)||this.restrictHolidays(d)||this.daysOfWeek(d)){return[false,""];}
return[true,""];},restrictDateLessToday:function(d){var today=new Date(this.southFloralsDeliveryConfig.current_date),todayYMD=this._getDateYMD(today),currentYMD=this._getDateYMD(d);return currentYMD&lt;todayYMD;},notRestrictWorkingDays:function(d){return this.restrictDate(d,this.southFloralsDeliveryConfig.workingdays);},daysOfWeek:function(d){return!!(this.southFloralsDeliveryConfig.days_week&amp;&amp;$.inArray(d.getDay(),this.southFloralsDeliveryConfig.days_week)!=-1);},disableSameDay:function(d){if(this.southFloralsDeliveryConfig.enabled_same_day==1){var today=new Date(this.southFloralsDeliveryConfig.current_date);if(today.getYear()==d.getYear()&amp;&amp;today.getMonth()==d.getMonth()&amp;&amp;today.getDate()==d.getDate()){today=this.setDateTime(this.southFloralsDeliveryConfig.time_same_day,today);var todayCurrentTime=new Date(this.southFloralsDeliveryConfig.current_date);var currentH=todayCurrentTime.getHours()+this.southFloralsDeliveryConfig.time_offset;todayCurrentTime.setHours(currentH);if((+todayCurrentTime)&gt;(+today)){return true;}}}
return false;},disableNextDay:function(d){if(this.southFloralsDeliveryConfig.enabled_next_day==1){var today=new Date(),tomorrow=new Date((+today)+this.milliseconds);if(tomorrow.getYear()==d.getYear()&amp;&amp;tomorrow.getMonth()==d.getMonth()&amp;&amp;tomorrow.getDate()==d.getDate()){today=this.setDateTime(this.southFloralsDeliveryConfig.time_next_day,today);var todayCurrentTime=new Date();if((+todayCurrentTime)&gt;(+today)){return true;}}}
return false;},setDateTime:function(stringTime,day){var time=stringTime.split(',');day.setHours(time[0]);day.setMinutes(time[1]);day.setSeconds(time[2]);return day;},restrictHolidays:function(d){return this.restrictDate(d,this.southFloralsDeliveryConfig.holidays);},restrictDateInterval:function(d){var isNeedRestrict=false;_.each(this.southFloralsDeliveryConfig.dintervals,function(interval){var fromYear=interval.from.year;var toYear=interval.to.year;var fromMonth=interval.from.month-1;var toMonth=interval.to.month-1;var fromDay=interval.from.day;var toDay=interval.to.day;if(toYear==0||fromYear==0){fromYear=toYear=d.getFullYear();}
if(interval.from.month==0||interval.to.month==0){toMonth=fromMonth=d.getMonth();}
var inputDate=new Date(d.getFullYear(),d.getMonth(),d.getDate());var fromDate=new Date(fromYear,fromMonth,fromDay);var toDate=new Date(toYear,toMonth,toDay);if(fromDate&gt;toDate){if((fromYear&lt;=d.getFullYear()&amp;&amp;toYear&gt;=d.getFullYear())&amp;&amp;(inputDate&gt;=fromDate||inputDate&lt;=toDate)){isNeedRestrict=true;return false;}}else{if(inputDate&gt;=fromDate&amp;&amp;inputDate&lt;=toDate){isNeedRestrict=true;return false;}}});return isNeedRestrict;},restrictDate:function(d,type){var isset=function(ear,month,day){return(type[ear]!==void(0)&amp;&amp;type[ear][month]!==void(0)&amp;&amp;type[ear][month][day]!==void(0));};if(isset(d.getFullYear(),d.getMonth()+1,d.getDate())){return type[d.getFullYear()][d.getMonth()+1][d.getDate()];}
if(isset(d.getFullYear(),0,d.getDate())){return type[d.getFullYear()][0][d.getDate()];}
if(isset(0,d.getMonth()+1,d.getDate())){return type[0][d.getMonth()+1][d.getDate()];}
if(isset(0,0,d.getDate())){return type[0][0][d.getDate()];}
return false;},minDays:function(d){if(this.southFloralsDeliveryConfig.min_days&gt;0){var today=new Date(),resctrict=new Date((+today)+this.southFloralsDeliveryConfig.min_days*this.milliseconds),todayDate=this._getDateYMD(today),resctrictDate=this._getDateYMD(resctrict),currentDate=this._getDateYMD(d);if(currentDate&gt;=todayDate&amp;&amp;currentDate&lt;resctrictDate){return true;}}
return false;},maxDays:function(d){if(this.southFloralsDeliveryConfig.max_days&gt;0){var today=new Date(),resctrict=new Date((+today)+this.southFloralsDeliveryConfig.max_days*this.milliseconds),resctrictDate=this._getDateYMD(resctrict),currentDate=this._getDateYMD(d);if(currentDate&gt;=resctrictDate){return true;}}
return false;},_getDateYMD:function(date){return new Date(date.getFullYear(),date.getMonth(),date.getDate());},getValidDate:function(date,increment){var validationResult=this.restrictDates(date)[0];if(validationResult===false){if(this.dateValidationIteration&lt;this.dateValidationIterationLimit){if(increment){date.setDate(date.getDate()+1);}else{date.setDate(date.getDate()-1);}
this.dateValidationIteration++;return this.getValidDate(date,increment);}else{this.dateValidationIteration=0;return false;}}
this.dateValidationIteration=0;return date;},onValueChange:function(value){var dateFormat,shiftedValue;if(value){if(this.options.showsTime){shiftedValue=moment.tz(value,'UTC').tz(this.storeTimeZone);}else{dateFormat=this.shiftedValue()?this.outputDateFormat:this.inputDateFormat;shiftedValue=moment(value,dateFormat);}
var date=new Date(shiftedValue.year(),shiftedValue.month(),shiftedValue.date());var validDate=this.getValidDate(date,true);if(!validDate){validDate=this.getValidDate(date,false);}
if(validDate){shiftedValue=moment(validDate).format(this.pickerDateTimeFormat);}else{shiftedValue='';}}else{shiftedValue='';}
if(shiftedValue!==this.shiftedValue()){this.shiftedValue(shiftedValue);}}});});</pre></body></html>