text: (typeof define=="function"&&define.amd?define:function(e,t,a){(a||t)()})("kendo.datepicker",["kendo.calendar","kendo.popup","kendo.dateinput"],function(){return function(e,t){function a(t){var a=t.parseFormats,i=t.format;_.normalize(t),(a=e.isArray(a)?a:[a]).length||a.push("yyyy-MM-dd"),-1===e.inArray(i,a)&&a.splice(0,0,t.format),t.parseFormats=a}function i(e){e.preventDefault()}var n=window.kendo,s=n.ui,o=s.Widget,r=n.parseDate,l=n.keys,d=n.template,u=n._activeElement,c=".kendoDatePicker",p="click"+c,h="k-state-default",m="k-state-disabled",f="mousedown"+c,_=n.calendar,v=_.isInRange,k=_.restrictValue,g=_.isEqualDatePart,w=e.extend,b=e.proxy,y=Date,x=function(t){var a,i=document.body,o=e("<div />").attr("aria-hidden","true").addClass("k-calendar-container").appendTo(i);this.options=t=t||{},(a=t.id)&&(a+="_dateview",o.attr("id",a),this._dateViewID=a),this.popup=new s.Popup(o,w(t.popup,t,{name:"Popup",isRtl:n.support.isRtl(t.anchor)})),this.div=o,this.value(t.value)};x.prototype={_calendar:function(){var t,a=this.calendar,o=this.options;a||(t=e("<div />").attr("id",n.guid()).appendTo(this.popup.element).on(f,i).on(p,"td:has(.k-link)",b(this._click,this)),this.calendar=a=new s.Calendar(t),this._setOptions(o),n.calendar.makeUnselectable(a.element),a.navigate(this._value||this._current,o.start),this.value(this._value))},_setOptions:function(e){this.calendar.setOptions({focusOnNav:!1,change:e.change,culture:e.culture,dates:e.dates,depth:e.depth,footer:e.footer,format:e.format,max:e.max,min:e.min,month:e.month,weekNumber:e.weekNumber,start:e.start,disableDates:e.disableDates})},setOptions:function(e){var t=this.options,a=e.disableDates;a&&(e.disableDates=_.disabled(a)),this.options=w(t,e,{change:t.change,close:t.close,open:t.open}),this.calendar&&this._setOptions(this.options)},destroy:function(){this.popup.destroy()},open:function(){this._calendar(),this.popup.open()},close:function(){this.popup.close()},min:function(e){this._option("min",e)},max:function(e){this._option("max",e)},toggle:function(){this[this.popup.visible()?"close":"open"]()},move:function(e){var t=e.keyCode,a=this.calendar,i=e.ctrlKey&&t==l.DOWN||t==l.ENTER,n=!1;if(e.altKey)t==l.DOWN?(this.open(),e.preventDefault(),n=!0):t==l.UP&&(this.close(),e.preventDefault(),n=!0);else if(this.popup.visible()){if(t==l.ESC||i&&a._cell.hasClass("k-state-selected"))return this.close(),e.preventDefault(),!0;this._current=a._move(e),n=!0}return n},current:function(e){this._current=e,this.calendar._focus(e)},value:function(e){var t=this.calendar,a=this.options,i=a.disableDates;i&&i(e)&&(e=null),this._value=e,this._current=new y(+k(e,a.min,a.max)),t&&t.value(e)},_click:function(e){-1!==e.currentTarget.className.indexOf("k-state-selected")&&this.close()},_option:function(e,t){var a=this.calendar;this.options[e]=t,a&&a[e](t)}},x.normalize=a,n.DateView=x;var D=o.extend({init:function(t,i){var l,d=this;o.fn.init.call(d,t,i),t=d.element,(i=d.options).disableDates=n.calendar.disabled(i.disableDates),i.min=r(t.attr("min"))||r(i.min),i.max=r(t.attr("max"))||r(i.max),a(i),d._initialOptions=w({},i),d._wrapper(),d.dateView=new x(w({},i,{id:t.attr("id"),anchor:d.wrapper,change:function(){d._change(this.value()),d.close()},close:function(e){d.trigger("close")?e.preventDefault():(t.attr("aria-expanded",!1),l.attr("aria-hidden",!0))},open:function(e){var a,i=d.options;d.trigger("open")?e.preventDefault():(d.element.val()!==d._oldText&&(a=r(t.val(),i.parseFormats,i.culture),d.dateView[a?"current":"value"](a)),t.attr("aria-expanded",!0),l.attr("aria-hidden",!1),d._updateARIA(a))}})),l=d.dateView.div,d._icon();try{t[0].setAttribute("type","text")}catch(u){t[0].type="text"}t.addClass("k-input").attr({role:"combobox","aria-expanded":!1,"aria-owns":d.dateView._dateViewID}),d._reset(),d._template(),t.is("[disabled]")||e(d.element).parents("fieldset").is(":disabled")?d.enable(!1):d.readonly(t.is("[readonly]")),i.dateInput&&(d._dateInput=new s.DateInput(t,{culture:i.culture,format:i.format,min:i.min,max:i.max,value:i.value})),d._old=d._update(i.value||d.element.val()),d._oldText=t.val(),n.notify(d)},events:["open","close","change"],options:{name:"DatePicker",value:null,footer:"",format:"",culture:"",parseFormats:[],min:new Date(1900,0,1),max:new Date(2099,11,31),start:"month",depth:"month",animation:{},month:{},dates:[],disableDates:null,ARIATemplate:'Current focused date is #=kendo.toString(data.current, "D")#',dateInput:!1,weekNumber:!1},setOptions:function(e){var t=this._value;o.fn.setOptions.call(this,e),(e=this.options).min=r(e.min),e.max=r(e.max),a(e),this.dateView.setOptions(e),this._dateInput&&this._dateInput.setOptions({culture:e.culture,format:e.format,min:e.min,max:e.max,value:e.value}),t&&(this.element.val(n.toString(t,e.format,e.culture)),this._updateARIA(t))},_editable:function(e){var t=this,a=t._dateIcon.off(c),n=t.element.off(c),s=t._inputWrapper.off(c),o=e.readonly,r=e.disable;o||r?(s.addClass(r?m:h).removeClass(r?h:m),n.attr("disabled",r).attr("readonly",o).attr("aria-disabled",r)):(s.addClass(h).removeClass(m).on("mouseenter.kendoDatePicker mouseleave.kendoDatePicker",t._toggleHover),n.removeAttr("disabled").removeAttr("readonly").attr("aria-disabled",!1).on("keydown"+c,b(t._keydown,t)).on("focusout"+c,b(t._blur,t)).on("focus"+c,function(){t._inputWrapper.addClass("k-state-focused")}),a.on(p,b(t._click,t)).on(f,i))},readonly:function(e){this._editable({readonly:void 0===e||e,disable:!1})},enable:function(e){this._editable({readonly:!1,disable:!(e=void 0===e||e)})},destroy:function(){o.fn.destroy.call(this),this.dateView.destroy(),this.element.off(c),this._dateIcon.off(c),this._inputWrapper.off(c),this._form&&this._form.off("reset",this._resetHandler)},open:function(){this.dateView.open()},close:function(){this.dateView.close()},min:function(e){return this._option("min",e)},max:function(e){return this._option("max",e)},value:function(e){if(void 0===e)return this._value;this._old=this._update(e),null===this._old&&this.element.val(""),this._oldText=this.element.val()},_toggleHover:function(t){e(t.currentTarget).toggleClass("k-state-hover","mouseenter"===t.type)},_blur:function(){var e=this.element.val();this.close(),e!==this._oldText&&this._change(e),this._inputWrapper.removeClass("k-state-focused")},_click:function(){var e=this.element;this.dateView.toggle(),n.support.touch||e[0]===u()||e.focus()},_change:function(e){var t,a=this.element.val();e=this._update(e);var i=(t=!n.calendar.isEqualDate(this._old,e))&&!this._typing,s=a!==this.element.val();(i||s)&&this.element.trigger("change"),t&&(this._old=e,this._oldText=this.element.val(),this.trigger("change")),this._typing=!1},_keydown:function(e){var t=this.dateView,a=this.element.val(),i=!1;t.popup.visible()||e.keyCode!=l.ENTER||a===this._oldText?(i=t.move(e),this._updateARIA(t._current),i?this._dateInput&&e.stopImmediatePropagation&&e.stopImmediatePropagation():this._typing=!0):this._change(a)},_icon:function(){var t,a=this.element;(t=a.next("span.k-select"))[0]||(t=e('<span unselectable="on" class="k-select" aria-label="select"><span class="k-icon k-i-calendar"></span></span>').insertAfter(a)),this._dateIcon=t.attr({role:"button","aria-controls":this.dateView._dateViewID})},_option:function(e,t){var a=this.options;if(void 0===t)return a[e];(t=r(t,a.parseFormats,a.culture))&&(a[e]=new y(+t),this.dateView[e](t))},_update:function(e){var t,a=this.options,i=a.min,s=a.max,o=this._value,l=r(e,a.parseFormats,a.culture),d=null===l&&null===o||l instanceof Date&&o instanceof Date;return a.disableDates(l)&&(l=null,this._old||this.element.val()||(e=null)),+l==+o&&d?((t=n.toString(l,a.format,a.culture))!==e&&this.element.val(null===l?e:t),l):(null!==l&&g(l,i)?l=k(l,i,s):v(l,i,s)||(l=null),this._value=l,this.dateView.value(l),this._dateInput&&l?this._dateInput.value(l||e):this.element.val(n.toString(l||e,a.format,a.culture)),this._updateARIA(l),l)},_wrapper:function(){var t,a=this.element;(t=a.parents(".k-datepicker"))[0]||(t=(t=a.wrap("<span />").parent().addClass("k-picker-wrap k-state-default")).wrap("<span />").parent()),t[0].style.cssText=a[0].style.cssText,a.css({width:"100%",height:a[0].style.height}),this.wrapper=t.addClass("k-widget k-datepicker k-header").addClass(a[0].className),this._inputWrapper=e(t[0].firstChild)},_reset:function(){var t=this,a=t.element,i=a.attr("form"),n=i?e("#"+i):a.closest("form");n[0]&&(t._resetHandler=function(){t.value(a[0].defaultValue),t.max(t._initialOptions.max),t.min(t._initialOptions.min)},t._form=n.on("reset",t._resetHandler))},_template:function(){this._ariaTemplate=d(this.options.ARIATemplate)},_updateARIA:function(e){var t,a=this.dateView.calendar;this.element.removeAttr("aria-activedescendant"),a&&((t=a._cell).attr("aria-label",this._ariaTemplate({current:e||a.current()})),this.element.attr("aria-activedescendant",t.attr("id")))}});s.plugin(D)}(window.kendo.jQuery),window.kendo});