/* * # Fomantic UI - 2.7.8 * https://github.com/fomantic/Fomantic-UI * http://fomantic-ui.com/ * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ !function(he,e,M,x){"use strict";he.isFunction=he.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},e=void 0!==e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),he.fn.calendar=function(r){var g,e=he(this),o=e.selector||"",D=(new Date).getTime(),v=[],y=r,b="string"==typeof y,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}};return e.each(function(){var c,se,ue=he.isPlainObject(r)?he.extend(!0,{},he.fn.calendar.settings,r):he.extend({},he.fn.calendar.settings),de=ue.className,e=ue.namespace,i=ue.selector,pe=ue.formatter,a=ue.parser,ce=ue.metadata,fe=w[ue.minTimeGap],l=ue.error,t="."+e,n="module-"+e,s=he(this),u=s.find(i.input),me=s.find(i.popup),d=s.find(i.activator),p=this,f=s.data(n),m=!1,h=!1;se={initialize:function(){se.debug("Initializing calendar for",p,s),c=se.get.isTouch(),se.setup.config(),se.setup.popup(),se.setup.inline(),se.setup.input(),se.setup.date(),se.create.calendar(),se.bind.events(),se.instantiate()},instantiate:function(){se.verbose("Storing instance of calendar"),f=se,s.data(n,f)},destroy:function(){se.verbose("Destroying previous calendar for",p),s.removeData(n),se.unbind.events()},setup:{config:function(){null!==se.get.minDate()&&se.set.minDate(s.data(ce.minDate)),null!==se.get.maxDate()&&se.set.maxDate(s.data(ce.maxDate))},popup:function(){if(!ue.inline&&(d.length||(d=s.children().first()).length))if(he.fn.popup!==x){if(!me.length){var e=d.parent(),t=0!==e.closest(i.append).length?"appendTo":"prependTo";me=he("
").addClass(de.popup)[t](e)}me.addClass(de.calendar);var a=ue.onVisible,n=ue.onHidden;u.length||(me.attr("tabindex","0"),a=function(){return se.focus(),ue.onVisible.apply(me,arguments)},n=function(){return se.blur(),ue.onHidden.apply(me,arguments)});var r=ue.on||(u.length?"focus":"click"),o=he.extend({},ue.popupOptions,{popup:me,on:r,hoverable:"hover"===r,onShow:function(){return se.set.focusDate(se.get.date()),se.set.mode(ue.startMode),ue.onShow.apply(me,arguments)},onVisible:a,onHide:ue.onHide,onHidden:n});se.popup(o)}else se.error(l.popup)},inline:function(){d.length&&!ue.inline||(me=he("
").addClass(de.calendar).appendTo(s),u.length||me.attr("tabindex","0"))},input:function(){ue.touchReadonly&&u.length&&c&&u.prop("readonly",!0)},date:function(){if(ue.initialDate){var e=a.date(ue.initialDate,ue);se.set.date(e,ue.formatInput,!1)}else if(s.data(ce.date)!==x){e=a.date(s.data(ce.date),ue);se.set.date(e,ue.formatInput,!1)}else if(u.length){var t=u.val();e=a.date(t,ue);se.set.date(e,ue.formatInput,!1)}}},create:{calendar:function(){var e,t,a,n,r,o,i,l=se.get.mode(),s=new Date,u=se.get.date(),d=se.get.focusDate(),p=d||u||ue.initialDate||s;p=se.helper.dateInRange(p),d||(d=p,se.set.focusDate(d,!1,!1));var c="year"===l,f="month"===l,m="day"===l,h="hour"===l,g="minute"===l,D="time"===ue.type,v=Math.max(ue.multiMonth,1),y=m?se.get.monthOffset():0,b=p.getMinutes(),C=p.getHours(),w=p.getDate(),M=p.getMonth()+y,x=p.getFullYear(),T=m?ue.showWeekNumbers?8:7:h?4:fe.column,k=m||h?6:fe.row,O=m?v:1,N=me,F=N.hasClass("left")?"right center":"left center";for(N.empty(),1").addClass(de.grid).appendTo(N)),n=0;n").addClass(de.column).appendTo(i);var H=M+n,I=(new Date(x,H,1).getDay()-ue.firstDayOfWeek%7+7)%7;if(!ue.constantHeight&&m){var E=new Date(x,H+1,0).getDate()+I;k=Math.ceil(E/7)}var j=c?10:f?1:0,Y=m?1:0,A=h||g?1:0,W=h||g?w:1,R=new Date(x-j,H-Y,W-A,C),q=new Date(x+j,H+Y,W+A,C),S=c?new Date(10*Math.ceil(x/10)-9,0,0):f?new Date(x,0,0):m?new Date(x,H,0):new Date(x,H,w,-1),V=c?new Date(10*Math.ceil(x/10)+1,0,1):f?new Date(x+1,0,1):m?new Date(x,H+1,1):new Date(x,H,w+1),G=l;m&&ue.showWeekNumbers&&(G+=" andweek");var P=he("").addClass(de.table).addClass(G).appendTo(N),K=T;if(!D){var U=he("").appendTo(P);r=he("").appendTo(U),o=he("").appendTo(U),ue.showWeekNumbers&&((o=he("").appendTo(P);for(e=c?10*Math.ceil(x/10)-9:m?1-I:0,t=0;t").appendTo(Z),m&&ue.showWeekNumbers&&((o=he("").appendTo(Z),le=he("
").attr("colspan",""+T).appendTo(r);var J=c||f?new Date(x,0,1):m?new Date(x,H,1):new Date(x,H,w,C,b),z=he("").addClass(de.link).appendTo(o);z.text(pe.header(J,l,ue));var B=f?ue.disableYear?"day":"year":m?ue.disableMonth?"year":"month":"day";if(z.data(ce.mode,B),0===n){var L=he("").addClass(de.prev).appendTo(o);L.data(ce.focusDate,R),L.toggleClass(de.disabledCell,!se.helper.isDateInRange(S,l)),he("").addClass(de.prevIcon).appendTo(L)}if(n===O-1){var Q=he("").addClass(de.next).appendTo(o);Q.data(ce.focusDate,q),Q.toggleClass(de.disabledCell,!se.helper.isDateInRange(V,l)),he("").addClass(de.nextIcon).appendTo(Q)}if(m)for(r=he("
").appendTo(r)).text(ue.text.weekNo),o.addClass(de.weekCell),K--),e=0;e").appendTo(r)).text(pe.dayColumnHeader((e+ue.firstDayOfWeek)%7,ue))}var Z=he("
").appendTo(r)).text(se.get.weekOfYear(x,H,e+1-ue.firstDayOfWeek)),o.addClass(de.weekCell)),a=0;a").addClass(de.cell).appendTo(r)).text($),o.data(ce.date,X);var _=m&&X.getMonth()!==(H+12)%12,ee=!ue.selectAdjacentDays&&_||!se.helper.isDateInRange(X,l)||ue.isDisabled(X,l)||se.helper.isDisabled(X,l)||!se.helper.isEnabled(X,l);if(ee){var te=se.helper.findDayAsObject(X,l,ue.disabledDates);null!==te&&te[ce.message]&&(o.attr("data-tooltip",te[ce.message]),o.attr("data-position",F))}else{var ae=se.helper.findDayAsObject(X,l,ue.eventDates);null!==ae&&(o.addClass(ae[ce.class]||ue.eventClass),ae[ce.message]&&(o.attr("data-tooltip",ae[ce.message]),o.attr("data-position",F)))}var ne=se.helper.dateEqual(X,u,l),re=se.helper.dateEqual(X,s,l);o.toggleClass(de.adjacentCell,_),o.toggleClass(de.disabledCell,ee),o.toggleClass(de.activeCell,ne&&!_),h||g||o.toggleClass(de.todayCell,!_&&re);var oe={mode:l,adjacent:_,disabled:ee,active:ne,today:re};pe.cell(o,X,oe),se.helper.dateEqual(X,d,l)&&se.set.focusDate(X,!1,!1)}if(ue.today){var ie=he("
").attr("colspan",""+T).addClass(de.today).appendTo(ie);le.text(pe.today(ue)),le.data(ce.date,s)}se.update.focus(!1,P)}}},update:{focus:function(e,t){t=t||me;var l=se.get.mode(),a=se.get.date(),s=se.get.focusDate(),u=se.get.startDate(),d=se.get.endDate(),p=(e?s:null)||a||(c?null:s);t.find("td").each(function(){var e=he(this),t=e.data(ce.date);if(t){var a=e.hasClass(de.disabledCell),n=e.hasClass(de.activeCell),r=e.hasClass(de.adjacentCell),o=se.helper.dateEqual(t,s,l),i=!!p&&(!!u&&se.helper.isDateInRange(t,l,u,p)||!!d&&se.helper.isDateInRange(t,l,p,d));e.toggleClass(de.focusCell,o&&(!c||m)&&(!r||ue.selectAdjacentDays&&r)&&!a),e.toggleClass(de.rangeCell,i&&!n&&!a)}})}},refresh:function(){se.create.calendar()},bind:{events:function(){se.debug("Binding events"),me.on("mousedown"+t,se.event.mousedown),me.on("touchstart"+t,se.event.mousedown),me.on("mouseup"+t,se.event.mouseup),me.on("touchend"+t,se.event.mouseup),me.on("mouseover"+t,se.event.mouseover),u.length?(u.on("input"+t,se.event.inputChange),u.on("focus"+t,se.event.inputFocus),u.on("blur"+t,se.event.inputBlur),u.on("click"+t,se.event.inputClick),u.on("keydown"+t,se.event.keydown)):me.on("keydown"+t,se.event.keydown)}},unbind:{events:function(){se.debug("Unbinding events"),me.off(t),u.length&&u.off(t)}},event:{mouseover:function(e){var t=he(e.target).data(ce.date),a=1===e.buttons;t&&se.set.focusDate(t,!1,!0,a)},mousedown:function(e){u.length&&e.preventDefault(),m=0<=e.type.indexOf("touch");var t=he(e.target).data(ce.date);t&&se.set.focusDate(t,!1,!0,!0)},mouseup:function(e){se.focus(),e.preventDefault(),e.stopPropagation(),m=!1;var t=he(e.target);if(!t.hasClass("disabled")){var a=t.parent();(a.data(ce.date)||a.data(ce.focusDate)||a.data(ce.mode))&&(t=a);var n=t.data(ce.date),r=t.data(ce.focusDate),o=t.data(ce.mode);if(n&&!1!==ue.onSelect.call(p,n,se.get.mode())){var i=t.hasClass(de.today);se.selectDate(n,i)}else r?se.set.focusDate(r):o&&se.set.mode(o)}},keydown:function(e){var t=e.which;if(27!==t&&9!==t||se.popup("hide"),se.popup("is visible"))if(37===t||38===t||39===t||40===t){var a="day"===(p=se.get.mode())?7:"hour"===p?4:"minute"===p?fe.column:3,n=37===t?-1:38===t?-a:39==t?1:a;n*="minute"===p?ue.minTimeGap:1;var r=se.get.focusDate()||se.get.date()||new Date,o=r.getFullYear()+("year"===p?n:0),i=r.getMonth()+("month"===p?n:0),l=r.getDate()+("day"===p?n:0),s=r.getHours()+("hour"===p?n:0),u=r.getMinutes()+("minute"===p?n:0),d=new Date(o,i,l,s,u);"time"===ue.type&&(d=se.helper.mergeDateTime(r,d)),se.helper.isDateInRange(d,p)&&se.set.focusDate(d)}else if(13===t){var p=se.get.mode(),c=se.get.focusDate();c&&!ue.isDisabled(c,p)&&!se.helper.isDisabled(c,p)&&se.helper.isEnabled(c,p)&&se.selectDate(c),e.preventDefault(),e.stopPropagation()}38!==t&&40!==t||(e.preventDefault(),se.popup("show"))},inputChange:function(){var e=u.val(),t=a.date(e,ue);se.set.date(t,!1)},inputFocus:function(){me.addClass(de.active)},inputBlur:function(){if(me.removeClass(de.active),ue.formatInput){var e=se.get.date(),t=pe.datetime(e,ue);u.val(t)}},inputClick:function(){se.popup("show")}},get:{weekOfYear:function(e,t,a){var n,r,o;return n=Date.UTC(e,t,a+3)/864e5,r=Math.floor(n/7),o=new Date(6048e5*r).getUTCFullYear(),r-Math.floor(Date.UTC(o,0,7)/6048e5)+1},date:function(){return se.helper.sanitiseDate(s.data(ce.date))||null},inputDate:function(){return u.val()},focusDate:function(){return s.data(ce.focusDate)||null},startDate:function(){var e=se.get.calendarModule(ue.startCalendar);return(e?e.get.date():s.data(ce.startDate))||null},endDate:function(){var e=se.get.calendarModule(ue.endCalendar);return(e?e.get.date():s.data(ce.endDate))||null},minDate:function(){return s.data(ce.minDate)||null},maxDate:function(){return s.data(ce.maxDate)||null},monthOffset:function(){return s.data(ce.monthOffset)||0},mode:function(){var e=s.data(ce.mode)||ue.startMode,t=se.get.validModes();return 0<=he.inArray(e,t)?e:"time"===ue.type?"hour":"month"===ue.type?"month":"year"===ue.type?"year":"day"},validModes:function(){var e=[];return"time"!==ue.type&&(ue.disableYear&&"year"!==ue.type||e.push("year"),(ue.disableMonth||"year"===ue.type)&&"month"!==ue.type||e.push("month"),0<=ue.type.indexOf("date")&&e.push("day")),0<=ue.type.indexOf("time")&&(e.push("hour"),ue.disableMinute||e.push("minute")),e},isTouch:function(){try{return M.createEvent("TouchEvent"),!0}catch(e){return!1}},calendarModule:function(e){return e?(e instanceof he||(e=he(e).first()),e.data(n)):null}},set:{date:function(e,t,a){t=!1!==t,a=!1!==a,e=se.helper.sanitiseDate(e),e=se.helper.dateInRange(e);var n=se.get.mode(),r=pe.datetime(e,ue);if(a&&!1===ue.onChange.call(p,e,r,n))return!1;if(se.set.focusDate(e),ue.isDisabled(e,n))return!1;var o=se.get.endDate();o&&e&&o=e?se.verbose("Unable to set maxDate variable lower that minDate variable",e,ue.minDate):(se.setting("maxDate",e),se.set.dataKeyValue(ce.maxDate,e))},monthOffset:function(e,t){var a=Math.max(ue.multiMonth,1);e=Math.max(1-a,Math.min(0,e)),se.set.dataKeyValue(ce.monthOffset,e,t)},mode:function(e,t){se.set.dataKeyValue(ce.mode,e,t)},dataKeyValue:function(e,t,a){var n=s.data(e),r=n===t||n<=t&&t<=n;return t?s.data(e,t):s.removeData(e),(a=!1!==a&&!r)&&se.refresh(),!r}},selectDate:function(e,t){se.verbose("New date selection",e);var a=se.get.mode();if(t||"minute"===a||ue.disableMinute&&"hour"===a||"date"===ue.type&&"day"===a||"month"===ue.type&&"month"===a||"year"===ue.type&&"year"===a){if(!(!1===se.set.date(e))&&ue.closable){se.popup("hide");var n=se.get.calendarModule(ue.endCalendar);n&&(n.popup("show"),n.focus())}}else{var r="year"===a?ue.disableMonth?"day":"month":"month"===a?"day":"day"===a?"hour":"minute";se.set.mode(r),"hour"===a||"day"===a&&se.get.date()?se.set.date(e):se.set.focusDate(e)}},changeDate:function(e){se.set.date(e)},clear:function(){se.set.date(x)},popup:function(){return d.popup.apply(d,arguments)},focus:function(){u.length?u.focus():me.focus()},blur:function(){u.length?u.blur():me.blur()},helper:{isDisabled:function(t,a){return"day"===a&&(-1!==ue.disabledDaysOfWeek.indexOf(t.getDay())||ue.disabledDates.some(function(e){return"string"==typeof e&&(e=se.helper.sanitiseDate(e)),e instanceof Date?se.helper.dateEqual(t,e,a):null!==e&&"object"==typeof e&&e[ce.date]?se.helper.dateEqual(t,se.helper.sanitiseDate(e[ce.date]),a):void 0}))},isEnabled:function(t,a){return"day"!==a||(0===ue.enabledDates.length||ue.enabledDates.some(function(e){return"string"==typeof e&&(e=se.helper.sanitiseDate(e)),e instanceof Date?se.helper.dateEqual(t,e,a):null!==e&&"object"==typeof e&&e[ce.date]?se.helper.dateEqual(t,se.helper.sanitiseDate(e[ce.date]),a):void 0}))},findDayAsObject:function(e,t,a){if("day"===t)for(var n,r=0,o=a.length;r=t.centuryBreak&&a===h.length-1){n<=99&&(n+=t.currentCentury-100),d=n,h.splice(a,1);break}if(u<0)for(a=0;a