wishthis/semantic/dist/components/calendar.min.js
2022-01-13 14:00:31 +01:00

11 lines
No EOL
26 KiB
JavaScript

/*
* # Fomantic UI - 2.8.8
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2022 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(re,T,k,ie){"use strict";re.isFunction=re.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},T=void 0!==T&&T.Math==Math?T:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),re.fn.calendar=function(g){var D,e=re(this),y=e.selector||"",v=(new Date).getTime(),b=[],C=g,w="string"==typeof C,M=[].slice.call(arguments,1),x={5:{row:4,column:3},10:{row:3,column:2},15:{row:2,column:2},20:{row:3,column:1},30:{row:2,column:1}},ne=["","one","two","three","four","five","six","seven","eight"];return e.each(function(){var c,e,$=re.isPlainObject(g)?re.extend(!0,{},re.fn.calendar.settings,g):re.extend({},re.fn.calendar.settings),Q=$.className,t=$.namespace,n=$.selector,Z=$.formatter,a=$.parser,X=$.metadata,_=x[$.minTimeGap],s=$.error,r="."+t,i="module-"+t,o=re(this),l=o.find(n.input),ee=o.find(n.popup),d=o.find(n.activator),u=this,p=o.data(i),f=!1,te=o.hasClass(Q.inverted),m=!1,h=!1,ae={initialize:function(){ae.debug("Initializing calendar for",u,o),c=ae.get.isTouch(),ae.setup.config(),ae.setup.popup(),ae.setup.inline(),ae.setup.input(),ae.setup.date(),ae.create.calendar(),ae.bind.events(),ae.observeChanges(),ae.instantiate()},instantiate:function(){ae.verbose("Storing instance of calendar"),p=ae,o.data(i,p)},destroy:function(){ae.verbose("Destroying previous calendar for",u),o.removeData(i),ae.unbind.events(),ae.disconnect.classObserver()},setup:{config:function(){null!==ae.get.minDate()&&ae.set.minDate(o.data(X.minDate)),null!==ae.get.maxDate()&&ae.set.maxDate(o.data(X.maxDate)),ae.setting("type",ae.get.type()),ae.setting("on",$.on||(l.length?"focus":"click"))},popup:function(){var e,t,a;$.inline||(d.length||(d=o.children().first()).length)&&(re.fn.popup!==ie?(ee.length||(a=0!==(t=d.parent()).closest(n.append).length?"appendTo":"prependTo",ee=re("<div/>").addClass(Q.popup)[a](t)),ee.addClass(Q.calendar),te&&ee.addClass(Q.inverted),e=function(){return ae.refreshTooltips(),$.onVisible.apply(ee,arguments)},a=$.onHidden,l.length||(ee.attr("tabindex","0"),e=function(){return ae.refreshTooltips(),ae.focus(),$.onVisible.apply(ee,arguments)},a=function(){return ae.blur(),$.onHidden.apply(ee,arguments)}),t=ae.setting("on"),a=re.extend({},$.popupOptions,{popup:ee,on:t,hoverable:"hover"===t,closable:"click"===t,onShow:function(){return ae.set.focusDate(ae.get.date()),ae.set.mode(ae.get.validatedMode($.startMode)),$.onShow.apply(ee,arguments)},onVisible:e,onHide:$.onHide,onHidden:a}),ae.popup(a)):ae.error(s.popup))},inline:function(){d.length&&!$.inline||($.inline=!0,ee=re("<div/>").addClass(Q.calendar).appendTo(o),l.length||ee.attr("tabindex","0"))},input:function(){$.touchReadonly&&l.length&&c&&l.prop("readonly",!0),ae.check.disabled()},date:function(){var e;$.initialDate?e=a.date($.initialDate,$):o.data(X.date)!==ie?e=a.date(o.data(X.date),$):l.length&&(e=a.date(l.val(),$)),ae.set.date(e,$.formatInput,!1),ae.set.mode(ae.get.mode(),!1)}},trigger:{change:function(){var e,t=l[0];t&&(e=k.createEvent("HTMLEvents"),ae.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},create:{calendar:function(){var e,t,a,n=ae.get.mode(),r=new Date,i=ae.get.date(),o=ae.get.focusDate(),s=ae.helper.dateInRange(o||i||$.initialDate||r);o||ae.set.focusDate(o=s,!1,!1);var l="year"===n,d="month"===n,u="day"===n,c="hour"===n,p="minute"===n,f="time"===$.type,m=Math.max($.multiMonth,1),h=u?ae.get.monthOffset():0,g=s.getMinutes(),D=s.getHours(),y=s.getDate(),v=s.getMonth()+h,b=s.getFullYear(),C=u?$.showWeekNumbers?8:7:c?4:_.column,w=u||c?6:_.row,M=u?m:1,x=ee,T=x.hasClass("left")?"right center":"left center";for(x.empty(),1<M&&(a=re("<div/>").addClass(Q.grid).appendTo(x)),t=0;t<M;t++){1<M&&(x=re("<div/>").addClass(Q.column).appendTo(a));var k=v+t,O=(new Date(b,k,1).getDay()-$.firstDayOfWeek%7+7)%7;!$.constantHeight&&u&&(j=new Date(b,k+1,0).getDate()+O,w=Math.ceil(j/7));var F=l?10:d?1:0,N=u?1:0,A=c||p?1:0,E=c||p?y:1,H=new Date(b-F,k-N,E-A,D),Y=new Date(b+F,k+N,E+A,D),I=l?new Date(10*Math.ceil(b/10)-9,0,0):d?new Date(b,0,0):u?new Date(b,k,0):new Date(b,k,y,-1),j=l?new Date(10*Math.ceil(b/10)+1,0,1):d?new Date(b+1,0,1):u?new Date(b,k+1,1):new Date(b,k,y+1),F=n;u&&$.showWeekNumbers&&(F+=" andweek");N=re("<table/>").addClass(Q.table).addClass(F).addClass(ne[C]+" column").appendTo(x);te&&N.addClass(Q.inverted);var S=C;if(!f){var E=re("<thead/>").appendTo(N),q=re("<tr/>").appendTo(E),W=re("<th/>").attr("colspan",""+C).appendTo(q),A=l||d?new Date(b,0,1):u?new Date(b,k,1):new Date(b,k,y,D,g),F=re("<span/>").addClass(Q.link).appendTo(W);F.text(Z.header(A,n,$));var R,A=d?$.disableYear?"day":"year":u?$.disableMonth?"year":"month":"day";if(F.data(X.mode,A),0===t&&((R=re("<span/>").addClass(Q.prev).appendTo(W)).data(X.focusDate,H),R.toggleClass(Q.disabledCell,!ae.helper.isDateInRange(I,n)),re("<i/>").addClass(Q.prevIcon).appendTo(R)),t===M-1&&((R=re("<span/>").addClass(Q.next).appendTo(W)).data(X.focusDate,Y),R.toggleClass(Q.disabledCell,!ae.helper.isDateInRange(j,n)),re("<i/>").addClass(Q.nextIcon).appendTo(R)),u)for(q=re("<tr/>").appendTo(E),$.showWeekNumbers&&((W=re("<th/>").appendTo(q)).text($.text.weekNo),W.addClass(Q.weekCell),S--),G=0;G<S;G++)(W=re("<th/>").appendTo(q)).text(Z.dayColumnHeader((G+$.firstDayOfWeek)%7,$))}for(var V=re("<tbody/>").appendTo(N),G=l?10*Math.ceil(b/10)-9:u?1-O:0,P=0;P<w;P++)for(q=re("<tr/>").appendTo(V),u&&$.showWeekNumbers&&((W=re("<th/>").appendTo(q)).text(ae.get.weekOfYear(b,k,G+1-$.firstDayOfWeek)),W.addClass(Q.weekCell)),e=0;e<S;e++,G++){var B=l?new Date(G,k,1,D,g):d?new Date(b,G,1,D,g):u?new Date(b,k,G,D,g):c?new Date(b,k,y,G):new Date(b,k,y,D,G*$.minTimeGap),K=l?G:d?$.text.monthsShort[G]:u?B.getDate():Z.time(B,$,!0);(W=re("<td/>").addClass(Q.cell).appendTo(q)).text(K),W.data(X.date,B);var U,J=u&&B.getMonth()!==(k+12)%12,z=!$.selectAdjacentDays&&J||!ae.helper.isDateInRange(B,n)||$.isDisabled(B,n)||ae.helper.isDisabled(B,n)||!ae.helper.isEnabled(B,n);z?null!==(L=ae.helper.findDayAsObject(B,n,$.disabledDates))&&L[X.message]&&(W.attr("data-tooltip",L[X.message]),W.attr("data-position",L[X.position]||T),(L[X.inverted]||te&&L[X.inverted]===ie)&&W.attr("data-inverted",""),L[X.variation]&&W.attr("data-variation",L[X.variation])):null!==(U=ae.helper.findDayAsObject(B,n,$.eventDates))&&(W.addClass(U[X.class]||$.eventClass),U[X.message]&&(W.attr("data-tooltip",U[X.message]),W.attr("data-position",U[X.position]||T),(U[X.inverted]||te&&U[X.inverted]===ie)&&W.attr("data-inverted",""),U[X.variation]&&W.attr("data-variation",U[X.variation])));var K=ae.helper.dateEqual(B,i,n),L=ae.helper.dateEqual(B,r,n);W.toggleClass(Q.adjacentCell,J&&!U),W.toggleClass(Q.disabledCell,z),W.toggleClass(Q.activeCell,K&&!(J&&z)),c||p||W.toggleClass(Q.todayCell,!J&&L),Z.cell(W,B,{mode:n,adjacent:J,disabled:z,active:K,today:L}),ae.helper.dateEqual(B,o,n)&&ae.set.focusDate(B,!1,!1)}$.today&&(O=re("<tr/>").appendTo(V),(O=re("<td/>").attr("colspan",""+C).addClass(Q.today).appendTo(O)).text(Z.today($)),O.data(X.date,r)),ae.update.focus(!1,N),$.inline&&ae.refreshTooltips()}}},update:{focus:function(e,t){t=t||ee;var o=ae.get.mode(),a=ae.get.date(),s=ae.get.focusDate(),l=ae.get.startDate(),d=ae.get.endDate(),u=(e?s:null)||a||(c?null:s);t.find("td").each(function(){var e,t,a,n,r=re(this),i=r.data(X.date);i&&(e=r.hasClass(Q.disabledCell),t=r.hasClass(Q.activeCell),a=r.hasClass(Q.adjacentCell),n=ae.helper.dateEqual(i,s,o),i=!!u&&(!!l&&ae.helper.isDateInRange(i,o,l,u)||!!d&&ae.helper.isDateInRange(i,o,u,d)),r.toggleClass(Q.focusCell,n&&(!c||f)&&(!a||$.selectAdjacentDays&&a)&&!e),ae.helper.isTodayButton(r)||r.toggleClass(Q.rangeCell,i&&!t&&!e))})}},refresh:function(){ae.create.calendar()},refreshTooltips:function(){var n=re(T).width();ee.find("td[data-position]").each(function(){var e=re(this),t=T.getComputedStyle(e[0],":after").width.replace(/[^0-9\.]/g,""),a=e.attr("data-position"),t=n-e.width()-(parseInt(t,10)||250)>e.offset().left?"right":"left";-1===a.indexOf(t)&&e.attr("data-position",a.replace(/(left|right)/,t))})},bind:{events:function(){ae.debug("Binding events"),ee.on("mousedown"+r,ae.event.mousedown),ee.on("touchstart"+r,ae.event.mousedown),ee.on("mouseup"+r,ae.event.mouseup),ee.on("touchend"+r,ae.event.mouseup),ee.on("mouseover"+r,ae.event.mouseover),l.length?(l.on("input"+r,ae.event.inputChange),l.on("focus"+r,ae.event.inputFocus),l.on("blur"+r,ae.event.inputBlur),l.on("keydown"+r,ae.event.keydown)):ee.on("keydown"+r,ae.event.keydown)}},unbind:{events:function(){ae.debug("Unbinding events"),ee.off(r),l.length&&l.off(r)}},event:{mouseover:function(e){var t=re(e.target).data(X.date),e=1===e.buttons;t&&ae.set.focusDate(t,!1,!0,e)},mousedown:function(e){l.length&&e.preventDefault(),f=0<=e.type.indexOf("touch");e=re(e.target).data(X.date);e&&ae.set.focusDate(e,!1,!0,!0)},mouseup:function(e){ae.focus(),e.preventDefault(),e.stopPropagation(),f=!1;var t,a,n=re(e.target);n.hasClass("disabled")||(t=(n=(a=n.parent()).data(X.date)||a.data(X.focusDate)||a.data(X.mode)?a:n).data(X.date),e=n.data(X.focusDate),a=n.data(X.mode),t&&!1!==$.onSelect.call(u,t,ae.get.mode())?(n=n.hasClass(Q.today),ae.selectDate(t,n)):e?ae.set.focusDate(e):a&&ae.set.mode(a))},keydown:function(e){var t,a,n,r,i,o,s,l=e.which;27!==l&&9!==l||ae.popup("hide"),ae.popup("is visible")&&(37===l||38===l||39===l||40===l?(i="day"===(o=ae.get.mode())?7:"hour"===o?4:"minute"===o?_.column:3,s=37===l?-1:38===l?-i:39==l?1:i,s*="minute"===o?$.minTimeGap:1,a=(t=ae.get.focusDate()||ae.get.date()||new Date).getFullYear()+("year"===o?s:0),n=t.getMonth()+("month"===o?s:0),r=t.getDate()+("day"===o?s:0),i=t.getHours()+("hour"===o?s:0),s=t.getMinutes()+("minute"===o?s:0),s=new Date(a,n,r,i,s),"time"===$.type&&(s=ae.helper.mergeDateTime(t,s)),ae.helper.isDateInRange(s,o)&&ae.set.focusDate(s)):13===l&&(o=ae.get.mode(),(s=ae.get.focusDate())&&!$.isDisabled(s,o)&&!ae.helper.isDisabled(s,o)&&ae.helper.isEnabled(s,o)&&ae.selectDate(s),e.preventDefault(),e.stopPropagation())),38!==l&&40!==l||(e.preventDefault(),ae.popup("show"))},inputChange:function(){var e=l.val(),e=a.date(e,$);ae.set.date(e,!1)},inputFocus:function(){ee.addClass(Q.active)},inputBlur:function(){var e;ee.removeClass(Q.active),$.formatInput&&(e=ae.get.date(),e=Z.datetime(e,$),l.val(e)),h&&(ae.trigger.change(),h=!1)},class:{mutation:function(e){e.forEach(function(e){"class"===e.attributeName&&ae.check.disabled()})}}},observeChanges:function(){"MutationObserver"in T&&(e=new MutationObserver(ae.event.class.mutation),ae.debug("Setting up mutation observer",e),ae.observe.class())},disconnect:{classObserver:function(){l.length&&e&&e.disconnect()}},observe:{class:function(){l.length&&e&&e.observe(o[0],{attributes:!0})}},is:{disabled:function(){return o.hasClass(Q.disabled)}},check:{disabled:function(){l.attr("tabindex",ae.is.disabled()?-1:0)}},get:{weekOfYear:function(e,t,a){return t=Date.UTC(e,t,a+3)/864e5,a=Math.floor(t/7),t=new Date(6048e5*a).getUTCFullYear(),a-Math.floor(Date.UTC(t,0,7)/6048e5)+1},date:function(){return ae.helper.sanitiseDate(o.data(X.date))||null},inputDate:function(){return l.val()},focusDate:function(){return o.data(X.focusDate)||null},startDate:function(){var e=ae.get.calendarModule($.startCalendar);return(e?e.get.date():o.data(X.startDate))||null},endDate:function(){var e=ae.get.calendarModule($.endCalendar);return(e?e.get.date():o.data(X.endDate))||null},minDate:function(){return o.data(X.minDate)||null},maxDate:function(){return o.data(X.maxDate)||null},monthOffset:function(){return o.data(X.monthOffset)||0},mode:function(){var e=o.data(X.mode)||$.startMode;return ae.get.validatedMode(e)},validatedMode:function(e){var t=ae.get.validModes();return 0<=re.inArray(e,t)?e:"time"===$.type?"hour":"month"===$.type?"month":"year"===$.type?"year":"day"},type:function(){return o.data(X.type)||$.type},validModes:function(){var e=[];return"time"!==$.type&&($.disableYear&&"year"!==$.type||e.push("year"),($.disableMonth||"year"===$.type)&&"month"!==$.type||e.push("month"),0<=$.type.indexOf("date")&&e.push("day")),0<=$.type.indexOf("time")&&(e.push("hour"),$.disableMinute||e.push("minute")),e},isTouch:function(){try{return k.createEvent("TouchEvent"),!0}catch(e){return!1}},calendarModule:function(e){return e?(e=!(e instanceof re)?re(e).first():e).data(i):null}},set:{date:function(e,t,a){t=!1!==t,a=!1!==a,e=ae.helper.sanitiseDate(e),e=ae.helper.dateInRange(e);var n=ae.get.mode(),r=Z.datetime(e,$);if(a&&!1===$.onBeforeChange.call(u,e,r,n))return!1;if(ae.set.focusDate(e),$.isDisabled(e,n))return!1;var i=ae.get.endDate();i&&e&&i<e&&ae.set.endDate(ie),ae.set.dataKeyValue(X.date,e),t&&l.length&&l.val(r),a&&$.onChange.call(u,e,r,n)},startDate:function(e,t){e=ae.helper.sanitiseDate(e);var a=ae.get.calendarModule($.startCalendar);a&&a.set.date(e),ae.set.dataKeyValue(X.startDate,e,t)},endDate:function(e,t){e=ae.helper.sanitiseDate(e);var a=ae.get.calendarModule($.endCalendar);a&&a.set.date(e),ae.set.dataKeyValue(X.endDate,e,t)},focusDate:function(e,t,a,n){e=ae.helper.sanitiseDate(e),e=ae.helper.dateInRange(e);var r="day"===ae.get.mode(),i=ae.get.focusDate();r&&e&&i&&((i=12*(e.getFullYear()-i.getFullYear())+e.getMonth()-i.getMonth())&&(i=ae.get.monthOffset()-i,ae.set.monthOffset(i,!1)));e=ae.set.dataKeyValue(X.focusDate,e,!!e&&t);a=!1!==a&&e&&!1===t||m!=n,m=n,a&&ae.update.focus(n)},minDate:function(e){e=ae.helper.sanitiseDate(e),null!==$.maxDate&&$.maxDate<=e?ae.verbose("Unable to set minDate variable bigger that maxDate variable",e,$.maxDate):(ae.setting("minDate",e),ae.set.dataKeyValue(X.minDate,e))},maxDate:function(e){e=ae.helper.sanitiseDate(e),null!==$.minDate&&$.minDate>=e?ae.verbose("Unable to set maxDate variable lower that minDate variable",e,$.minDate):(ae.setting("maxDate",e),ae.set.dataKeyValue(X.maxDate,e))},monthOffset:function(e,t){var a=Math.max($.multiMonth,1);e=Math.max(1-a,Math.min(0,e)),ae.set.dataKeyValue(X.monthOffset,e,t)},mode:function(e,t){ae.set.dataKeyValue(X.mode,e,t)},dataKeyValue:function(e,t,a){var n=o.data(e),n=n===t||n<=t&&t<=n;return t?o.data(e,t):o.removeData(e),(a=!1!==a&&!n)&&ae.refresh(),!n}},selectDate:function(e,t){ae.verbose("New date selection",e);var a,n=ae.get.mode();t||"minute"===n||$.disableMinute&&"hour"===n||"date"===$.type&&"day"===n||"month"===$.type&&"month"===n||"year"===$.type&&"year"===n?!1===ae.set.date(e)||(h=!0,$.closable&&(ae.popup("hide"),(a=ae.get.calendarModule($.endCalendar))&&("focus"!==a.setting("on")&&a.popup("show"),a.focus()))):(a="year"===n?$.disableMonth?"day":"month":"month"===n?"day":"day"===n?"hour":"minute",ae.set.mode(a),"hour"===n||"day"===n&&ae.get.date()?ae.set.date(e,!0,!1):ae.set.focusDate(e))},changeDate:function(e){ae.set.date(e)},clear:function(){ae.set.date(ie)},popup:function(){return d.popup.apply(d,arguments)},focus:function(){(l.length?l:ee).focus()},blur:function(){(l.length?l:ee).blur()},helper:{isDisabled:function(a,n){return("day"===n||"month"===n||"year"===n)&&("day"===n&&-1!==$.disabledDaysOfWeek.indexOf(a.getDay())||$.disabledDates.some(function(e){if((e="string"==typeof e?ae.helper.sanitiseDate(e):e)instanceof Date)return ae.helper.dateEqual(a,e,n);if(null!==e&&"object"==typeof e){if(e[X.year])return"number"==typeof e[X.year]?a.getFullYear()==e[X.year]:Array.isArray(e[X.year])?-1<e[X.year].indexOf(a.getFullYear()):void 0;if(e[X.month]){if("number"==typeof e[X.month])return a.getMonth()==e[X.month];if(Array.isArray(e[X.month]))return-1<e[X.month].indexOf(a.getMonth());if(e[X.month]instanceof Date){var t=ae.helper.sanitiseDate(e[X.month]);return a.getMonth()==t.getMonth()&&a.getFullYear()==t.getFullYear()}}else if(e[X.date]&&"day"===n)return e[X.date]instanceof Date?ae.helper.dateEqual(a,ae.helper.sanitiseDate(e[X.date]),n):Array.isArray(e[X.date])?e[X.date].some(function(e){return ae.helper.dateEqual(a,e,n)}):void 0}}))},isEnabled:function(t,a){return"day"!==a||(0===$.enabledDates.length||$.enabledDates.some(function(e){return(e="string"==typeof e?ae.helper.sanitiseDate(e):e)instanceof Date?ae.helper.dateEqual(t,e,a):null!==e&&"object"==typeof e&&e[X.date]?ae.helper.dateEqual(t,ae.helper.sanitiseDate(e[X.date]),a):void 0}))},findDayAsObject:function(t,a,e){if("day"===a||"month"===a||"year"===a)for(var n,r=0;r<e.length;r++){if((n="string"==typeof(n=e[r])?ae.helper.sanitiseDate(n):n)instanceof Date&&ae.helper.dateEqual(t,n,a)){var i={};return i[X.date]=n,i}if(null!==n&&"object"==typeof n)if(n[X.year]){if("number"==typeof n[X.year]&&t.getFullYear()==n[X.year])return n;if(Array.isArray(n[X.year])&&-1<n[X.year].indexOf(t.getFullYear()))return n}else if(n[X.month]){if("number"==typeof n[X.month]&&t.getMonth()==n[X.month])return n;if(Array.isArray(n[X.month])){if(-1<n[X.month].indexOf(t.getMonth()))return n}else if(n[X.month]instanceof Date){i=ae.helper.sanitiseDate(n[X.month]);if(t.getMonth()==i.getMonth()&&t.getFullYear()==i.getFullYear())return n}}else if(n[X.date]&&"day"===a){if(n[X.date]instanceof Date&&ae.helper.dateEqual(t,ae.helper.sanitiseDate(n[X.date]),a))return n;if(Array.isArray(n[X.date])&&n[X.date].some(function(e){return ae.helper.dateEqual(t,e,a)}))return n}}return null},sanitiseDate:function(e){return!(e=!(e instanceof Date)?a.date(""+e,$):e)||isNaN(e.getTime())?null:e},dateDiff:function(e,t,a){var n="time"===$.type,r="year"===(a=a||"day"),i=r||"month"===a,o="minute"===a,a=o||"hour"===a;return e=new Date(n?2e3:e.getFullYear(),n||r?0:e.getMonth(),n||i?1:e.getDate(),a?e.getHours():0,o?$.minTimeGap*Math.floor(e.getMinutes()/$.minTimeGap):0),(t=new Date(n?2e3:t.getFullYear(),n||r?0:t.getMonth(),n||i?1:t.getDate(),a?t.getHours():0,o?$.minTimeGap*Math.floor(t.getMinutes()/$.minTimeGap):0)).getTime()-e.getTime()},dateEqual:function(e,t,a){return!!e&&!!t&&0===ae.helper.dateDiff(e,t,a)},isDateInRange:function(e,t,a,n){var r;return a||n||(a=(r=ae.get.startDate())&&$.minDate?new Date(Math.max(r,$.minDate)):r||$.minDate,n=$.maxDate),a=a&&new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),$.minTimeGap*Math.ceil(a.getMinutes()/$.minTimeGap)),!(!e||a&&0<ae.helper.dateDiff(e,a,t)||n&&0<ae.helper.dateDiff(n,e,t))},dateInRange:function(e,t,a){t||a||(t=(n=ae.get.startDate())&&$.minDate?new Date(Math.max(n,$.minDate)):n||$.minDate,a=$.maxDate),t=t&&new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),$.minTimeGap*Math.ceil(t.getMinutes()/$.minTimeGap));var n="time"===$.type;return e&&(t&&0<ae.helper.dateDiff(e,t,"minute")?n?ae.helper.mergeDateTime(e,t):t:a&&0<ae.helper.dateDiff(a,e,"minute")?n?ae.helper.mergeDateTime(e,a):a:e)},mergeDateTime:function(e,t){return e&&t?new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes()):t},isTodayButton:function(e){return e.text()===$.text.today}},setting:function(e,t){if(ae.debug("Changing setting",e,t),re.isPlainObject(e))re.extend(!0,$,e);else{if(t===ie)return $[e];re.isPlainObject($[e])?re.extend(!0,$[e],t):$[e]=t}},internal:function(e,t){if(re.isPlainObject(e))re.extend(!0,ae,e);else{if(t===ie)return ae[e];ae[e]=t}},debug:function(){!$.silent&&$.debug&&($.performance?ae.performance.log(arguments):(ae.debug=Function.prototype.bind.call(console.info,console,$.name+":"),ae.debug.apply(console,arguments)))},verbose:function(){!$.silent&&$.verbose&&$.debug&&($.performance?ae.performance.log(arguments):(ae.verbose=Function.prototype.bind.call(console.info,console,$.name+":"),ae.verbose.apply(console,arguments)))},error:function(){$.silent||(ae.error=Function.prototype.bind.call(console.error,console,$.name+":"),ae.error.apply(console,arguments))},performance:{log:function(e){var t,a;$.performance&&(a=(t=(new Date).getTime())-(v||t),v=t,b.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:u,"Execution Time":a})),clearTimeout(ae.performance.timer),ae.performance.timer=setTimeout(ae.performance.display,500)},display:function(){var e=$.name+":",a=0;v=!1,clearTimeout(ae.performance.timer),re.each(b,function(e,t){a+=t["Execution Time"]}),e+=" "+a+"ms",y&&(e+=" '"+y+"'"),(console.group!==ie||console.table!==ie)&&0<b.length&&(console.groupCollapsed(e),console.table?console.table(b):re.each(b,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),b=[]}},invoke:function(n,e,t){var r,i,a,o=p;return e=e||M,t=u||t,"string"==typeof n&&o!==ie&&(n=n.split(/[\. ]/),r=n.length-1,re.each(n,function(e,t){var a=e!=r?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(re.isPlainObject(o[a])&&e!=r)o=o[a];else{if(o[a]!==ie)return i=o[a],!1;{if(!re.isPlainObject(o[t])||e==r)return o[t]!==ie?i=o[t]:ae.error(s.method,n),!1;o=o[t]}}})),re.isFunction(i)?a=i.apply(t,e):i!==ie&&(a=i),Array.isArray(D)?D.push(a):D!==ie?D=[D,a]:a!==ie&&(D=a),i}};w?(p===ie&&ae.initialize(),ae.invoke(C)):(p!==ie&&p.invoke("destroy"),ae.initialize())}),D!==ie?D:this},re.fn.calendar.settings={name:"Calendar",namespace:"calendar",silent:!1,debug:!1,verbose:!1,performance:!1,type:"datetime",firstDayOfWeek:0,constantHeight:!0,today:!1,closable:!0,monthFirst:!0,touchReadonly:!0,inline:!1,on:null,initialDate:null,startMode:!1,minDate:null,maxDate:null,ampm:!0,disableYear:!1,disableMonth:!1,disableMinute:!1,formatInput:!0,startCalendar:null,endCalendar:null,multiMonth:1,minTimeGap:5,showWeekNumbers:null,disabledDates:[],disabledDaysOfWeek:[],enabledDates:[],eventDates:[],centuryBreak:60,currentCentury:2e3,selectAdjacentDays:!1,popupOptions:{position:"bottom left",lastResort:"bottom left",prefer:"opposite",hideOnScroll:!1},text:{days:["S","M","T","W","T","F","S"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",now:"Now",am:"AM",pm:"PM",weekNo:"Week"},formatter:{header:function(e,t,a){return"year"===t?a.formatter.yearHeader(e,a):"month"===t?a.formatter.monthHeader(e,a):"day"===t?a.formatter.dayHeader(e,a):"hour"===t?a.formatter.hourHeader(e,a):a.formatter.minuteHeader(e,a)},yearHeader:function(e,t){e=10*Math.ceil(e.getFullYear()/10);return e-9+" - "+(2+e)},monthHeader:function(e,t){return e.getFullYear()},dayHeader:function(e,t){return t.text.months[e.getMonth()]+" "+e.getFullYear()},hourHeader:function(e,t){return t.formatter.date(e,t)},minuteHeader:function(e,t){return t.formatter.date(e,t)},dayColumnHeader:function(e,t){return t.text.days[e]},datetime:function(e,t){if(!e)return"";var a="time"===t.type?"":t.formatter.date(e,t),e=t.type.indexOf("time")<0?"":t.formatter.time(e,t,!1);return a+("datetime"===t.type?" ":"")+e},date:function(e,t){if(!e)return"";var a=e.getDate(),n=t.text.months[e.getMonth()],e=e.getFullYear();return"year"===t.type?e:"month"===t.type?n+" "+e:(t.monthFirst?n+" "+a:a+" "+n)+", "+e},time:function(e,t,a){if(!e)return"";var n=e.getHours(),r=e.getMinutes(),e="";return t.ampm&&(e=" "+(n<12?t.text.am:t.text.pm),n=0===n?12:12<n?n-12:n),n+":"+(r<10?"0":"")+r+e},today:function(e){return"date"===e.type?e.text.today:e.text.now},cell:function(e,t,a){}},parser:{date:function(e,t){if(e instanceof Date)return e;if(!e)return null;if(0===(e=String(e).trim()).length)return null;e.match(/^[0-9]{4}[\/\-\.][0-9]{1,2}[\/\-\.][0-9]{1,2}$/)&&(e=e.replace(/[\/\-\.]/g,"/")+" 00:00:00"),e=t.monthFirst||!e.match(/^[0-9]{1,2}[\/\-\.]/)?e:e.replace(/[\/\-\.]/g,"/").replace(/([0-9]+)\/([0-9]+)/,"$2/$1");var a,n,r,i=new Date(e);if(!(null!==e.match(/^[0-9]+$/))&&!isNaN(i.getDate()))return i;e=e.toLowerCase();var o,s,l,d=-1,u=-1,c=-1,p=-1,f=-1,m=ie,h="time"===t.type,i=t.type.indexOf("time")<0,g=e.split(t.regExp.dateWords),D=e.split(t.regExp.dateNumbers);if(!i)for(m=0<=re.inArray(t.text.am.toLowerCase(),g)||!(0<=re.inArray(t.text.pm.toLowerCase(),g))&&ie,a=0;a<D.length;a++)if(0<=(s=D[a]).indexOf(":")){if(u<0||d<0)for(l=s.split(":"),r=0;r<Math.min(2,l.length);r++)n=parseInt(l[r]),isNaN(n)&&(n=0),0===r?u=n%24:d=n%60;D.splice(a,1)}if(!h){for(a=0;a<g.length;a++)if(!((o=g[a]).length<=0)){for(n=0;n<t.text.months.length;n++)if(t.text.months[n].substring(0,o.length).toLowerCase()===o){p=n+1;break}if(0<=p)break}for(a=0;a<D.length;a++)if(n=parseInt(D[a]),!isNaN(n)&&n>=t.centuryBreak&&a===D.length-1){n<=99&&(n+=t.currentCentury-100),f=n,D.splice(a,1);break}if(p<0)for(a=0;a<D.length;a++)if(r=1<a||t.monthFirst?a:1===a?0:1,n=parseInt(D[r]),!isNaN(n)&&1<=n&&n<=12){p=n,D.splice(r,1);break}for(a=0;a<D.length;a++)if(n=parseInt(D[a]),!isNaN(n)&&1<=n&&n<=31){c=n,D.splice(a,1);break}if(f<0)for(a=D.length-1;0<=a;a--)if(n=parseInt(D[a]),!isNaN(n)){n<=99&&(n+=t.currentCentury),f=n,D.splice(a,1);break}}if(!i){if(u<0)for(a=0;a<D.length;a++)if(n=parseInt(D[a]),!isNaN(n)&&0<=n&&n<=23){u=n,D.splice(a,1);break}if(d<0)for(a=0;a<D.length;a++)if(n=parseInt(D[a]),!isNaN(n)&&0<=n&&n<=59){d=n,D.splice(a,1);break}}if(d<0&&u<0&&c<0&&p<0&&f<0)return null;d<0&&(d=0),u<0&&(u=0),c<0&&(c=1),p<0&&(p=1),f<0&&(f=(new Date).getFullYear()),m!==ie&&(m?12===u&&(u=0):u<12&&(u+=12));m=new Date(f,p-1,c,u,d);return m.getMonth()===p-1&&m.getFullYear()===f||(m=new Date(f,p,0,u,d)),isNaN(m.getTime())?null:m}},onBeforeChange:function(e,t,a){return!0},onChange:function(e,t,a){},onShow:function(){},onVisible:function(){},onHide:function(){},onHidden:function(){},onSelect:function(e,t){},isDisabled:function(e,t){return!1},selector:{popup:".ui.popup",input:"input",activator:"input",append:".inline.field,.inline.fields"},regExp:{dateWords:/[^A-Za-z\u00C0-\u024F]+/g,dateNumbers:/[^\d:]+/g},error:{popup:"UI Popup, a required component is not included in this page",method:"The method you called is not defined."},className:{calendar:"calendar",active:"active",popup:"ui popup",grid:"ui equal width grid",column:"column",table:"ui celled center aligned unstackable table",inverted:"inverted",prev:"prev link",next:"next link",prevIcon:"chevron left icon",nextIcon:"chevron right icon",link:"link",cell:"link",disabledCell:"disabled",weekCell:"disabled",adjacentCell:"adjacent",activeCell:"active",rangeCell:"range",focusCell:"focus",todayCell:"today",today:"today link",disabled:"disabled"},metadata:{date:"date",focusDate:"focusDate",startDate:"startDate",endDate:"endDate",minDate:"minDate",maxDate:"maxDate",mode:"mode",type:"type",monthOffset:"monthOffset",message:"message",class:"class",inverted:"inverted",variation:"variation",position:"position",month:"month",year:"year"},eventClass:"blue"}}(jQuery,window,document);