11 lines
No EOL
28 KiB
JavaScript
11 lines
No EOL
28 KiB
JavaScript
/*
|
|
* # Fomantic UI - 2.9.3
|
|
* https://github.com/fomantic/Fomantic-UI
|
|
* https://fomantic-ui.com/
|
|
*
|
|
* Copyright 2023 Contributors
|
|
* Released under the MIT license
|
|
* https://opensource.org/licenses/MIT
|
|
*
|
|
*/
|
|
!function(oe,x,T){"use strict";x=void 0!==x&&x.Math===Math?x:globalThis,oe.fn.calendar=function(m){var g,e=oe(this),y=oe(T),D=Date.now(),v=[],b=m,M="string"==typeof b,C=[].slice.call(arguments,1),w={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}},re=["","one","two","three","four","five","six","seven","eight"];return e.each(function(){var p,e,z=oe.isPlainObject(m)?oe.extend(!0,{},oe.fn.calendar.settings,m):oe.extend({},oe.fn.calendar.settings),_=z.className,a=z.namespace,n=z.selector,Q=z.formatter,Z=z.parser,X=z.metadata,ee=w[z.minTimeGap],l=z.error,t="."+a,r="module-"+a,o=oe(this),i=o.find(n.input),s=o.find(n.activator),d=this,u=o.data(r),te=u&&u.popupId?y.find("#"+u.popupId):o.find(n.popup),c=!1,ae=o.hasClass(_.inverted),f=!1,h=!1,ne={initialize:function(){ne.debug("Initializing calendar for",d,o),p=ne.get.isTouch(),ne.setup.config(),ne.setup.popup(),ne.setup.inline(),ne.setup.input(),ne.setup.date(),ne.create.calendar(),ne.bind.events(),ne.observeChanges(),ne.instantiate()},instantiate:function(){ne.verbose("Storing instance of calendar"),u=ne,o.data(r,u)},destroy:function(){ne.verbose("Destroying previous calendar for",d),o.removeData(r),ne.unbind.events(),ne.disconnect.classObserver()},setup:{config:function(){null!==ne.get.minDate()&&ne.set.minDate(o.data(X.minDate)),null!==ne.get.maxDate()&&ne.set.maxDate(o.data(X.maxDate)),ne.setting("type",ne.get.type()),ne.setting("on",z.on||"click")},popup:function(){var e,t;z.inline||0===s.length&&0===(s=o.children().first()).length||(void 0===oe.fn.popup?ne.error(l.popup):((te=0===te.length?z.context?(ne.popupId=a+"_popup_"+(Math.random().toString(16)+"000000000").slice(2,10),oe("<div/>",{id:ne.popupId}).addClass(_.popup).appendTo(y.find(z.context))):(e=0<(t=s.parent()).closest(n.append).length?"appendTo":"prependTo",oe("<div/>").addClass(_.popup)[e](t)):te).addClass(_.calendar),ae&&te.addClass(_.inverted),e=function(){return ne.refreshTooltips(),z.onVisible.apply(te,arguments)},0===i.length&&(te.attr("tabindex","0"),e=function(){return ne.refreshTooltips(),ne.focus(),z.onVisible.apply(te,arguments)}),t=ne.setting("on"),t=oe.extend({},z.popupOptions,{popup:te,movePopup:!z.context,on:t,hoverable:"hover"===t,closable:"click"===t,onShow:function(){return ne.set.focusDate(ne.get.date()),ne.set.mode(ne.get.validatedMode(z.startMode)),z.onShow.apply(te,arguments)},onVisible:e,onHide:z.onHide,onHidden:function(){return ne.blur(),z.onHidden.apply(te,arguments)}}),ne.popup(t)))},inline:function(){0<s.length&&!z.inline||(z.inline=!0,te=oe("<div/>").addClass(_.calendar).appendTo(o),0===i.length&&te.attr("tabindex","0"))},input:function(){z.touchReadonly&&0<i.length&&p&&i.prop("readonly",!0),ne.check.disabled()},date:function(){var e;z.initialDate?e=Z.date(z.initialDate,z):void 0!==o.data(X.date)?e=Z.date(o.data(X.date),z):0<i.length&&(e=Z.date(i.val(),z)),ne.set.date(e,z.formatInput,!1),ne.set.mode(ne.get.mode(),!1)}},trigger:{change:function(){var e,t=i[0];t&&(e=T.createEvent("HTMLEvents"),ne.verbose("Triggering native change event"),e.initEvent("change",!0,!1),t.dispatchEvent(e))}},create:{calendar:function(){var e,t,j,a=ne.get.mode(),n=new Date,q=ne.get.date(),r=ne.get.focusDate(),o=ne.helper.dateInRange(r||q||Z.date(z.initialDate,z)||n),i=(r||ne.set.focusDate(r=o,!1,!1),"year"===a),s="month"===a,l="day"===a,d="hour"===a,u="minute"===a,W="time"===z.type,R=Math.max(z.multiMonth,1),V=l?ne.get.monthOffset():0,p=o.getMinutes(),c=o.getHours(),f=o.getDate(),G=o.getMonth()+V,h=o.getFullYear(),m=l?z.showWeekNumbers?8:7:d?4:ee.column,P=l||d?6:ee.row,g=l?R:1,y=(D=te).hasClass("left")?"right center":"left center";for(D.empty(),1<g&&(j=oe("<div/>").addClass(_.grid).appendTo(D)),t=0;t<g;t++){1<g&&(D=oe("<div/>").addClass(_.column).appendTo(j));var D,v=G+t,B=(new Date(h,v,1).getDay()-z.firstDayOfWeek%7+7)%7,b=(!z.constantHeight&&l&&(b=new Date(h,v+1,0).getDate()+B,P=Math.ceil(b/7)),i?10:s?1:0),M=l?1:0,C=d||u?1:0,w=d||u?f:1,x=new Date(h-b,v-M,w-C,c),M=new Date(h+b,v+M,w+C,c),w=i?new Date(10*Math.ceil(h/10)-9,0,0):s?new Date(h,0,0):l?new Date(h,v,0):new Date(h,v,f,-1),C=i?new Date(10*Math.ceil(h/10)+1,0,1):s?new Date(h+1,0,1):l?new Date(h,v+1,1):new Date(h,v,f+1),T=a,T=(l&&z.showWeekNumbers&&(T+=" andweek"),oe("<table/>").addClass(_.table).addClass(T).addClass(re[m]+" column").appendTo(D)),K=(ae&&T.addClass(_.inverted),m);if(!W){var U=oe("<thead/>").appendTo(T),Y=oe("<tr/>").appendTo(U),k=oe("<th/>").attr("colspan",""+m).appendTo(Y),O=i||s?new Date(h,0,1):l?new Date(h,v,1):new Date(h,v,f,c,p),A=oe("<span/>").addClass(_.link).appendTo(k),O=(A.text(ne.helper.dateFormat(Q[a+"Header"],O)),s?z.disableYear?"day":"year":l?z.disableMonth?"year":"month":"day");if(A.data(X.mode,O),0===t&&((A=oe("<span/>").addClass(_.prev).appendTo(k)).data(X.focusDate,x),A.toggleClass(_.disabledCell,!ne.helper.isDateInRange(w,a)),oe("<i/>").addClass(_.prevIcon).appendTo(A)),t===g-1&&((O=oe("<span/>").addClass(_.next).appendTo(k)).data(X.focusDate,M),O.toggleClass(_.disabledCell,!ne.helper.isDateInRange(C,a)),oe("<i/>").addClass(_.nextIcon).appendTo(O)),l)for(Y=oe("<tr/>").appendTo(U),z.showWeekNumbers&&((k=oe("<th/>").appendTo(Y)).text(z.text.weekNo),k.addClass(_.weekCell),K--),N=0;N<K;N++)(k=oe("<th/>").appendTo(Y)).text(Q.dayColumnHeader((N+z.firstDayOfWeek)%7,z))}for(var J=oe("<tbody/>").appendTo(T),N=i?10*Math.ceil(h/10)-9:l?1-B:0,L=0;L<P;L++)for(Y=oe("<tr/>").appendTo(J),l&&z.showWeekNumbers&&((k=oe("<th/>").appendTo(Y)).text(ne.get.weekOfYear(h,v,N+1-z.firstDayOfWeek)),k.addClass(_.weekCell)),e=0;e<K;e++,N++){var F,H=i?new Date(N,v,1,c,p):s?new Date(h,N,1,c,p):l?new Date(h,v,N,c,p):d?new Date(h,v,f,N):new Date(h,v,f,c,N*z.minTimeGap),E=i?N:s?z.text.monthsShort[N]:l?H.getDate():ne.helper.dateFormat(Q.cellTime,H),E=((k=oe("<td/>").addClass(_.cell).appendTo(Y)).text(E),k.data(X.date,H),l&&H.getMonth()!==(v+12)%12),I=!z.selectAdjacentDays&&E||!ne.helper.isDateInRange(H,a)||z.isDisabled(H,a)||ne.helper.isDisabled(H,a)||!ne.helper.isEnabled(H,a),S=(I?(null!==(S=ne.helper.findDayAsObject(H,a,z.disabledDates))&&S[X.message]&&(k.attr("data-tooltip",S[X.message]),k.attr("data-position",S[X.position]||y),(S[X.inverted]||ae&&void 0===S[X.inverted])&&k.attr("data-inverted",""),S[X.variation]&&k.attr("data-variation",S[X.variation])),"hour"===a&&null!==(S=ne.helper.findHourAsObject(H,a,z.disabledHours))&&S[X.message]&&(k.attr("data-tooltip",S[X.message]),k.attr("data-position",S[X.position]||y),(S[X.inverted]||ae&&void 0===S[X.inverted])&&k.attr("data-inverted",""),S[X.variation]&&k.attr("data-variation",S[X.variation]))):null!==(F=ne.helper.findDayAsObject(H,a,z.eventDates))&&(k.addClass(F[X.class]||z.eventClass),F[X.message]&&(k.attr("data-tooltip",F[X.message]),k.attr("data-position",F[X.position]||y),(F[X.inverted]||ae&&void 0===F[X.inverted])&&k.attr("data-inverted",""),F[X.variation]&&k.attr("data-variation",F[X.variation]))),ne.helper.dateEqual(H,q,a)),$=ne.helper.dateEqual(H,n,a),E=(k.toggleClass(_.adjacentCell,E&&!F),k.toggleClass(_.disabledCell,I),k.toggleClass(_.activeCell,S&&!(E&&I)),d||u||k.toggleClass(_.todayCell,!E&&$),{mode:a,adjacent:E,disabled:I,active:S,today:$});Q.cell(k,H,E),ne.helper.dateEqual(H,r,a)&&ne.set.focusDate(H,!1,!1)}z.today&&(x=oe("<tr/>").appendTo(J),(w=oe("<td/>").attr("colspan",""+m).addClass(_.today).appendTo(x)).text(Q.today(z)),w.data(X.date,n)),ne.update.focus(!1,T),z.inline&&ne.refreshTooltips()}}},update:{focus:function(e,t){t=t||te;var i=ne.get.mode(),a=ne.get.date(),s=ne.get.focusDate(),l=ne.get.startDate(),d=ne.get.endDate(),u=(e?s:null)||a||(p?null:s);t.find("td").each(function(){var e,t,a,n,r=oe(this),o=r.data(X.date);o&&(e=r.hasClass(_.disabledCell),t=r.hasClass(_.activeCell),a=r.hasClass(_.adjacentCell),n=ne.helper.dateEqual(o,s,i),o=!!u&&(!!l&&ne.helper.isDateInRange(o,i,l,u)||!!d&&ne.helper.isDateInRange(o,i,u,d)),r.toggleClass(_.focusCell,n&&(!p||c)&&(!a||z.selectAdjacentDays&&a)&&!e),ne.helper.isTodayButton(r)||r.toggleClass(_.rangeCell,o&&!t&&!e))})}},refresh:function(){ne.create.calendar()},refreshTooltips:function(){var n=oe(x).width();te.find("td[data-position]").each(function(){var e=oe(this),t=x.getComputedStyle(e[0],"::after").width.replace(/[^\d.]/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(){ne.debug("Binding events"),te.on("mousedown"+t,ne.event.mousedown),te.on("touchstart"+t,ne.event.mousedown),te.on("mouseup"+t,ne.event.mouseup),te.on("touchend"+t,ne.event.mouseup),te.on("mouseover"+t,ne.event.mouseover),0<i.length?(i.on("input"+t,ne.event.inputChange),i.on("focus"+t,ne.event.inputFocus),i.on("blur"+t,ne.event.inputBlur),i.on("keydown"+t,ne.event.keydown)):te.on("keydown"+t,ne.event.keydown)}},unbind:{events:function(){ne.debug("Unbinding events"),te.off(t),0<i.length&&i.off(t)}},event:{mouseover:function(e){var t=oe(e.target).data(X.date),e=1===e.buttons;t&&ne.set.focusDate(t,!1,!0,e)},mousedown:function(e){0<i.length&&e.preventDefault(),c=0<=e.type.indexOf("touch");e=oe(e.target).data(X.date);e&&ne.set.focusDate(e,!1,!0,!0)},mouseup:function(e){ne.focus(),e.preventDefault(),e.stopPropagation(),c=!1;var t,a,n,e=oe(e.target);e.hasClass("disabled")||(t=(e=(t=e.parent()).data(X.date)||t.data(X.focusDate)||t.data(X.mode)?t:e).data(X.date),a=e.data(X.focusDate),n=e.data(X.mode),t&&!1!==z.onSelect.call(d,t,ne.get.mode())?(e=e.hasClass(_.today),ne.selectDate(t,e)):a?ne.set.focusDate(a):n&&ne.set.mode(n))},keydown:function(e){var t=e.which;if(9===t&&ne.popup("hide"),ne.popup("is visible")){var a=ne.get.mode();switch(t){case 37:case 38:case 39:case 40:var n="day"===a?7:"hour"===a?4:"minute"===a?ee.column:3,n=37===t?-1:38===t?-n:39===t?1:n,r=(n*="minute"===a?z.minTimeGap:1,ne.get.focusDate()||ne.get.date()||new Date),o=r.getFullYear()+("year"===a?n:0),i=r.getMonth()+("month"===a?n:0),s=r.getDate()+("day"===a?n:0),l=r.getHours()+("hour"===a?n:0),n=r.getMinutes()+("minute"===a?n:0),o=new Date(o,i,s,l,n);"time"===z.type&&(o=ne.helper.mergeDateTime(r,o)),ne.helper.isDateInRange(o,a)&&ne.set.focusDate(o);break;case 13:i=ne.get.focusDate();i&&!z.isDisabled(i,a)&&!ne.helper.isDisabled(i,a)&&ne.helper.isEnabled(i,a)&&!1!==z.onSelect.call(d,i,ne.get.mode())&&ne.selectDate(i),e.preventDefault(),e.stopPropagation();break;case 27:ne.popup("hide"),e.stopPropagation()}}38!==t&&40!==t||(e.preventDefault(),ne.popup("show"))},inputChange:function(){var e=i.val(),e=Z.date(e,z);ne.set.date(e,!1)},inputFocus:function(){te.addClass(_.active)},inputBlur:function(){var e;te.removeClass(_.active),z.formatInput&&(e=ne.get.date(),e=ne.helper.dateFormat(Q[z.type],e),i.val(e)),h&&(ne.trigger.change(),h=!1)},class:{mutation:function(e){e.forEach(function(e){"class"===e.attributeName&&ne.check.disabled()})}}},observeChanges:function(){"MutationObserver"in x&&(e=new MutationObserver(ne.event.class.mutation),ne.debug("Setting up mutation observer",e),ne.observe.class())},disconnect:{classObserver:function(){0<i.length&&e&&e.disconnect()}},observe:{class:function(){0<i.length&&e&&e.observe(o[0],{attributes:!0})}},is:{disabled:function(){return o.hasClass(_.disabled)}},check:{disabled:function(){i.attr("tabindex",ne.is.disabled()?-1:0)}},get:{weekOfYear:function(e,t,a){e=Date.UTC(e,t,a+3)/864e5,t=Math.floor(e/7),a=new Date(6048e5*t).getUTCFullYear();return t-Math.floor(Date.UTC(a,0,7)/6048e5)+1},formattedDate:function(e,t){return ne.helper.dateFormat(e||Q[z.type],t||ne.get.date())},date:function(){return ne.helper.sanitiseDate(o.data(X.date))||null},inputDate:function(){return i.val()},focusDate:function(){return o.data(X.focusDate)||null},startDate:function(){var e=ne.get.calendarModule(z.startCalendar);return(e?e.get.date():o.data(X.startDate))||null},endDate:function(){var e=ne.get.calendarModule(z.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)||z.monthOffset||0},mode:function(){var e=o.data(X.mode)||z.startMode;return ne.get.validatedMode(e)},validatedMode:function(e){var t=ne.get.validModes();return 0<=oe.inArray(e,t)?e:"time"===z.type?"hour":"month"===z.type?"month":"year"===z.type?"year":"day"},type:function(){return o.data(X.type)||z.type},validModes:function(){var e=[];return"time"!==z.type&&(z.disableYear&&"year"!==z.type||e.push("year"),(z.disableMonth||"year"===z.type)&&"month"!==z.type||e.push("month"),0<=z.type.indexOf("date")&&e.push("day")),0<=z.type.indexOf("time")&&(e.push("hour"),z.disableMinute||e.push("minute")),e},isTouch:function(){try{return T.createEvent("TouchEvent"),!0}catch(e){return!1}},calendarModule:function(e){return e?(e=e instanceof oe?e:y.find(e).first()).data(r):null}},set:{date:function(e,t,a){t=!1!==t,a=!1!==a,e=ne.helper.sanitiseDate(e),e=ne.helper.dateInRange(e);var n=ne.get.mode(),r=ne.helper.dateFormat(Q[z.type],e);if(a&&!1===z.onBeforeChange.call(d,e,r,n))return!1;if(ne.set.focusDate(e),z.isDisabled(e,n))return!1;var o=ne.get.endDate();o&&e&&o<e&&ne.set.endDate(),ne.set.dataKeyValue(X.date,e),t&&0<i.length&&i.val(r),a&&z.onChange.call(d,e,r,n)},startDate:function(e,t){e=ne.helper.sanitiseDate(e);var a=ne.get.calendarModule(z.startCalendar);a&&a.set.date(e),ne.set.dataKeyValue(X.startDate,e,t)},endDate:function(e,t){e=ne.helper.sanitiseDate(e);var a=ne.get.calendarModule(z.endCalendar);a&&a.set.date(e),ne.set.dataKeyValue(X.endDate,e,t)},focusDate:function(e,t,a,n){e=ne.helper.sanitiseDate(e),e=ne.helper.dateInRange(e);var r="day"===ne.get.mode(),o=ne.get.focusDate(),r=(r&&e&&o&&((r=12*(e.getFullYear()-o.getFullYear())+e.getMonth()-o.getMonth())&&(o=ne.get.monthOffset()-r,ne.set.monthOffset(o,!1))),ne.set.dataKeyValue(X.focusDate,e,!!e&&t));a=!1!==a&&r&&!1===t||f!=n,f=n,a&&ne.update.focus(n)},minDate:function(e){e=ne.helper.sanitiseDate(e),null!==z.maxDate&&z.maxDate<=e?ne.verbose("Unable to set minDate variable bigger that maxDate variable",e,z.maxDate):(ne.setting("minDate",e),ne.set.dataKeyValue(X.minDate,e))},maxDate:function(e){e=ne.helper.sanitiseDate(e),null!==z.minDate&&z.minDate>=e?ne.verbose("Unable to set maxDate variable lower that minDate variable",e,z.minDate):(ne.setting("maxDate",e),ne.set.dataKeyValue(X.maxDate,e))},monthOffset:function(e,t){var a=Math.max(z.multiMonth,1);e=Math.max(1-a,Math.min(0,e)),ne.set.dataKeyValue(X.monthOffset,e,t)},mode:function(e,t){ne.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)&&ne.refresh(),!n}},selectDate:function(e,t){ne.verbose("New date selection",e);var a=ne.get.mode();t||"minute"===a||z.disableMinute&&"hour"===a||"date"===z.type&&"day"===a||"month"===z.type&&"month"===a||"year"===z.type&&"year"===a?!1!==ne.set.date(e)&&(h=!0,z.closable&&(ne.popup("hide"),(t=ne.get.calendarModule(z.endCalendar))&&(t.refresh(),"focus"!==t.setting("on")&&t.popup("show"),t.focus()))):(t="year"===a?z.disableMonth?"day":"month":"month"===a?"day":"day"===a?"hour":"minute",ne.set.mode(t),"hour"===a||"day"===a&&ne.get.date()?ne.set.date(e,!0,!1):ne.set.focusDate(e))},changeDate:function(e){ne.set.date(e)},clear:function(){ne.set.date()},popup:function(){return s.popup.apply(s,arguments)},focus:function(){(0<i.length?i:te).trigger("focus")},blur:function(){(0<i.length?i:te).trigger("blur")},helper:{dateFormat:function(e,t){if(!(t instanceof Date))return"";if("function"==typeof e)return e.call(ne,t,z);var a=t.getDate(),n=t.getMonth(),r=t.getFullYear(),o=t.getDay(),i=t.getHours(),s=t.getMinutes(),t=t.getSeconds(),l=ne.get.weekOfYear(r,n,a+1-z.firstDayOfWeek),d=i%12||12,u=(i<12?z.text.am:z.text.pm).toLowerCase(),p={D:a,DD:("0"+a).slice(-2),M:n+1,MM:("0"+(n+1)).slice(-2),MMM:z.text.monthsShort[n],MMMM:z.text.months[n],Y:r,YY:String(r).slice(2),YYYY:r,d:o,dd:z.text.dayNamesShort[o].slice(0,2),ddd:z.text.dayNamesShort[o],dddd:z.text.dayNames[o],h:d,hh:("0"+d).slice(-2),H:i,HH:("0"+i).slice(-2),m:s,mm:("0"+s).slice(-2),s:t,ss:("0"+t).slice(-2),a:u,A:u.toUpperCase(),S:["th","st","nd","rd"][3<a%10||a%100-a%10==10?0:a%10],w:l,ww:("0"+l).slice(-2)};return e.replace(z.regExp.token,function(e){return e in p?p[e]:e.slice(1,-1)})},isDisabled:function(n,r){return("day"===r||"month"===r||"year"===r||"hour"===r)&&("day"===r&&-1!==z.disabledDaysOfWeek.indexOf(n.getDay())||z.disabledDates.some(function(e){var t,a=!1;return(e="string"==typeof e?ne.helper.sanitiseDate(e):e)instanceof Date?a=ne.helper.dateEqual(n,e,r):null!==e&&"object"==typeof e&&(e[X.year]?"number"==typeof e[X.year]?a=n.getFullYear()===e[X.year]:Array.isArray(e[X.year])&&(a=-1<e[X.year].indexOf(n.getFullYear())):e[X.month]?"number"==typeof e[X.month]?a=n.getMonth()===e[X.month]:Array.isArray(e[X.month])?a=-1<e[X.month].indexOf(n.getMonth()):e[X.month]instanceof Date&&(t=ne.helper.sanitiseDate(e[X.month]),a=n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear()):e[X.date]&&"day"===r&&(e[X.date]instanceof Date?a=ne.helper.dateEqual(n,ne.helper.sanitiseDate(e[X.date]),r):Array.isArray(e[X.date])&&(a=e[X.date].some(function(e){return ne.helper.dateEqual(n,e,r)})))),a})||"hour"===r&&z.disabledHours.some(function(e){var t=!1;return(e="string"==typeof e?ne.helper.sanitiseDate(e):e)instanceof Date?t=ne.helper.dateEqual(n,e,r):"number"==typeof e?t=n.getHours()===e:null!==e&&"object"==typeof e&&(e[X.date]&&(e[X.date]instanceof Date?t=ne.helper.dateEqual(n,ne.helper.sanitiseDate(e[X.date])):Array.isArray(e[X.date])&&(t=e[X.date].some(function(e){return ne.helper.dateEqual(n,e,r)}))),e[X.days]&&("number"==typeof e[X.days]?t=n.getDay()===e[X.days]:Array.isArray(e[X.days])&&(t=-1<e[X.days].indexOf(n.getDay()))),e[X.hours]&&("number"==typeof e[X.hours]?t=t&&n.getHours()===e[X.hours]:Array.isArray(e[X.hours])&&(t=t&&-1<e[X.hours].indexOf(n.getHours())))),t}))},isEnabled:function(a,n){return"day"!==n||(0===z.enabledDates.length||z.enabledDates.some(function(e){var t=!1;return(e="string"==typeof e?ne.helper.sanitiseDate(e):e)instanceof Date?t=ne.helper.dateEqual(a,e,n):null!==e&&"object"==typeof e&&e[X.date]&&(t=ne.helper.dateEqual(a,ne.helper.sanitiseDate(e[X.date]),n)),t}))},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])?ne.helper.sanitiseDate(n):n)instanceof Date&&ne.helper.dateEqual(t,n,a))return(o={})[X.date]=n,o;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){var o=ne.helper.sanitiseDate(n[X.month]);if(t.getMonth()===o.getMonth()&&t.getFullYear()===o.getFullYear())return n}}else if(n[X.date]&&"day"===a){if(n[X.date]instanceof Date&&ne.helper.dateEqual(t,ne.helper.sanitiseDate(n[X.date]),a))return n;if(Array.isArray(n[X.date])&&n[X.date].some(function(e){return ne.helper.dateEqual(t,e,a)}))return n}}return null},findHourAsObject:function(t,a,e){if("hour"===a)for(var n,r=function(e,t){if(t[X.hours])return"number"==typeof t[X.hours]&&e.getHours()===t[X.hours]||Array.isArray(t[X.hours])&&-1<t[X.hours].indexOf(e.getHours())?t:void 0},o=0;o<e.length;o++){if("number"==typeof(n=e[o])&&t.getHours()===n)return null;if(null!==n&&"object"==typeof n)if(n[X.days]&&r(t,n)){if("number"==typeof n[X.days]&&t.getDay()===n[X.days])return n;if(Array.isArray(n[X.days])&&-1<n[X.days].indexOf(t.getDay()))return n}else if(n[X.date]&&r(t,n)){if(n[X.date]instanceof Date&&ne.helper.dateEqual(t,ne.helper.sanitiseDate(n[X.date])))return n;if(Array.isArray(n[X.date])&&n[X.date].some(function(e){return ne.helper.dateEqual(t,e,a)}))return n}else if(r(t,n))return n}return null},sanitiseDate:function(e){return!(e=e instanceof Date?e:Z.date(""+e,z))||isNaN(e.getTime())?null:e},dateDiff:function(e,t,a){var n="time"===z.type,r="year"===(a=a||"day"),o=r||"month"===a,i="minute"===a,a=i||"hour"===a;return e=new Date(n?2e3:e.getFullYear(),n||r?0:e.getMonth(),n||o?1:e.getDate(),a?e.getHours():0,i?z.minTimeGap*Math.floor(e.getMinutes()/z.minTimeGap):0),(t=new Date(n?2e3:t.getFullYear(),n||r?0:t.getMonth(),n||o?1:t.getDate(),a?t.getHours():0,i?z.minTimeGap*Math.floor(t.getMinutes()/z.minTimeGap):0)).getTime()-e.getTime()},dateEqual:function(e,t,a){return!!e&&!!t&&0===ne.helper.dateDiff(e,t,a)},isDateInRange:function(e,t,a,n){var r;return a||n||(a=(r=ne.get.startDate())&&z.minDate?new Date(Math.max(r,z.minDate)):r||z.minDate,n=z.maxDate),a=a&&new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),z.minTimeGap*Math.ceil(a.getMinutes()/z.minTimeGap)),!(!e||a&&0<ne.helper.dateDiff(e,a,t)||n&&0<ne.helper.dateDiff(n,e,t))},dateInRange:function(e,t,a){t||a||(t=(n=ne.get.startDate())&&z.minDate?new Date(Math.max(n,z.minDate)):n||z.minDate,a=z.maxDate),t=t&&new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),z.minTimeGap*Math.ceil(t.getMinutes()/z.minTimeGap));var n="time"===z.type;return e&&(t&&0<ne.helper.dateDiff(e,t,"minute")?n?ne.helper.mergeDateTime(e,t):t:a&&0<ne.helper.dateDiff(a,e,"minute")?n?ne.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()===z.text.today}},setting:function(e,t){if(ne.debug("Changing setting",e,t),oe.isPlainObject(e))oe.extend(!0,z,e);else{if(void 0===t)return z[e];oe.isPlainObject(z[e])?oe.extend(!0,z[e],t):z[e]=t}},internal:function(e,t){if(oe.isPlainObject(e))oe.extend(!0,ne,e);else{if(void 0===t)return ne[e];ne[e]=t}},debug:function(){!z.silent&&z.debug&&(z.performance?ne.performance.log(arguments):(ne.debug=Function.prototype.bind.call(console.info,console,z.name+":"),ne.debug.apply(console,arguments)))},verbose:function(){!z.silent&&z.verbose&&z.debug&&(z.performance?ne.performance.log(arguments):(ne.verbose=Function.prototype.bind.call(console.info,console,z.name+":"),ne.verbose.apply(console,arguments)))},error:function(){z.silent||(ne.error=Function.prototype.bind.call(console.error,console,z.name+":"),ne.error.apply(console,arguments))},performance:{log:function(e){var t,a;z.performance&&(a=(t=Date.now())-(D||t),D=t,v.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:d,"Execution Time":a})),clearTimeout(ne.performance.timer),ne.performance.timer=setTimeout(function(){ne.performance.display()},500)},display:function(){var e=z.name+":",a=0;D=!1,clearTimeout(ne.performance.timer),oe.each(v,function(e,t){a+=t["Execution Time"]}),e+=" "+a+"ms",0<v.length&&(console.groupCollapsed(e),console.table?console.table(v):oe.each(v,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),v=[]}},invoke:function(n,e,t){var r,o,a,i,s=u;return e=e||C,t=t||d,"string"==typeof n&&void 0!==s&&(n=n.split(/[ .]/),r=n.length-1,oe.each(n,function(e,t){var a=e!==r?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(oe.isPlainObject(s[a])&&e!==r)s=s[a];else{if(void 0!==s[a])return o=s[a],!1;{if(!oe.isPlainObject(s[t])||e===r)return void 0!==s[t]?o=s[t]:ne.error(l.method,n),!1;s=s[t]}}})),"function"==typeof(i=o)&&"number"!=typeof i.nodeType?a=o.apply(t,e):void 0!==o&&(a=o),Array.isArray(g)?g.push(a):void 0!==g?g=[g,a]:void 0!==a&&(g=a),o}};M?(void 0===u&&ne.initialize(),ne.invoke(b)):(void 0!==u&&u.invoke("destroy"),ne.initialize())}),void 0!==g?g:this},oe.fn.calendar.settings={name:"Calendar",namespace:"calendar",silent:!1,debug:!1,verbose:!1,performance:!0,context:!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,disableYear:!1,disableMonth:!1,disableMinute:!1,formatInput:!0,startCalendar:null,endCalendar:null,multiMonth:1,monthOffset:0,minTimeGap:5,showWeekNumbers:!1,disabledHours:[],disabledDates:[],disabledDaysOfWeek:[],enabledDates:[],eventDates:[],centuryBreak:60,currentCentury:2e3,selectAdjacentDays:!1,popupOptions:{position:"bottom left",lastResort:"bottom left",prefer:"opposite",observeChanges:!1,hideOnScroll:!1},text:{days:["S","M","T","W","T","F","S"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],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:{yearHeader:function(e,t){e=10*Math.ceil(e.getFullYear()/10);return e-9+" - "+(2+e)},monthHeader:"YYYY",dayHeader:"MMMM YYYY",hourHeader:"MMMM D, YYYY",minuteHeader:"MMMM D, YYYY",dayColumnHeader:function(e,t){return t.text.days[e]},datetime:"MMMM D, YYYY h:mm A",date:"MMMM D, YYYY",time:"h:mm A",cellTime:"h:mm A",month:"MMMM YYYY",year:"YYYY",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().replace(/([./:-])\s+/g,"$1").replace(/\s+([./:-])/g,"$1").replace(/\s+/g," ")).length)return null;/^\d{4}(?:[./-]\d{1,2}){2}$/.test(e)&&(e=e.replace(/[./-]/g,"/")+" 00:00:00"),e=t.monthFirst||!/^\d{1,2}[./-]/.test(e)?e:e.replace(/[./-]/g,"/").replace(/(\d+)\/(\d+)/,"$2/$1");var a,n,r,o=new Date(e);if(!(null!==e.match(/^\d+$/))&&!isNaN(o.getDate()))return o;e=e.toLowerCase();var i,s,l,d,u=-1,p=-1,c=-1,f=-1,h=-1,o="time"===t.type,m=t.type.indexOf("time")<0,g=e.split(t.regExp.dateWords),y=e.split(t.regExp.dateNumbers);if(!m)for(i=0<=oe.inArray(t.text.am.toLowerCase(),g)||!(0<=oe.inArray(t.text.pm.toLowerCase(),g))&&void 0,a=0;a<y.length;a++)if(0<=(l=y[a]).indexOf(":")){if(p<0||u<0)for(d=l.split(":"),r=0;r<Math.min(2,d.length);r++)n=parseInt(d[r],10),isNaN(n)&&(n=0),0===r?p=n%24:u=n%60;y.splice(a,1)}if(!o){for(a=0;a<g.length;a++)if(!((s=g[a]).length<=0)){for(n=0;n<t.text.months.length;n++)if(t.text.months[n].slice(0,s.length).toLowerCase()===s){f=n+1;break}if(0<=f)break}for(a=0;a<y.length;a++)if(n=parseInt(y[a],10),!isNaN(n)&&n>=t.centuryBreak&&a===y.length-1){n<=99&&(n+=t.currentCentury-100),h=n,y.splice(a,1);break}if(f<0)for(a=0;a<y.length;a++)if(r=1<a||t.monthFirst?a:1===a?0:1,n=parseInt(y[r],10),!isNaN(n)&&1<=n&&n<=12){f=n,y.splice(r,1);break}for(a=0;a<y.length;a++)if(n=parseInt(y[a],10),!isNaN(n)&&1<=n&&n<=31){c=n,y.splice(a,1);break}if(h<0)for(a=y.length-1;0<=a;a--)if(n=parseInt(y[a],10),!isNaN(n)){n<=99&&(n+=t.currentCentury),h=n,y.splice(a,1);break}}if(!m){if(p<0)for(a=0;a<y.length;a++)if(n=parseInt(y[a],10),!isNaN(n)&&0<=n&&n<=23){p=n,y.splice(a,1);break}if(u<0)for(a=0;a<y.length;a++)if(n=parseInt(y[a],10),!isNaN(n)&&0<=n&&n<=59){u=n,y.splice(a,1);break}}if(u<0&&p<0&&c<0&&f<0&&h<0)return null;u<0&&(u=0),p<0&&(p=0),c<0&&(c=1),f<0&&(f=1),h<0&&(h=(new Date).getFullYear()),void 0!==i&&(i?12===p&&(p=0):p<12&&(p+=12));e=new Date(h,f-1,c,p,u);return e.getMonth()===f-1&&e.getFullYear()===h||(e=new Date(h,f,0,p,u)),isNaN(e.getTime())?null:e}},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,token:/d{1,4}|D{1,2}|M{1,4}|YY(?:YY)?|([Hhmsw])\1?|[ASYa]|"[^"]*"|'[^']*'/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",hours:"hours",days:"days"},eventClass:"blue"}}(jQuery,window,document); |