!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("@msuntharesan/ng2-flatpickr",["exports","@angular/core","@angular/forms","@angular/common"],e):e(((t=t||self).msuntharesan=t.msuntharesan||{},t.msuntharesan["ng2-flatpickr"]={}),t.ng.core,t.ng.forms,t.ng.common)}(this,(function(t,e,n,i){"use strict";function o(t,e,n,i){var o,p=arguments.length,r=p<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(p<3?o(r):p>3?o(e,n,r):o(e,n))||r);return p>3&&r&&Object.defineProperty(e,n,r),r}function p(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}"undefined"!=typeof window&&require("flatpickr");var r=function(){function t(){var t=this;this._tabindex=0,this.defaultFlatpickrOptions={wrap:!0,clickOpens:!0,onChange:function(e){t.writeValue(e)}},this.placeholder="",this.addClass="",this.hideButton=!1,this.propagateChange=function(t){}}var i;return i=t,Object.defineProperty(t.prototype,"tabindex",{get:function(){return this._tabindex},set:function(t){this._tabindex=Number(t)},enumerable:!0,configurable:!0}),t.prototype.writeValue=function(t){this.propagateChange(t)},t.prototype.registerOnChange=function(t){this.propagateChange=t},t.prototype.registerOnTouched=function(){},t.prototype.setDateFromInput=function(t){this.flatpickrElement.nativeElement._flatpickr.setDate(t,!0)},t.prototype.setAltInputPlaceholder=function(t){this.flatpickrElement.nativeElement._flatpickr.altInput.setAttribute("placeholder",t)},t.prototype.ngAfterViewInit=function(){this.config&&Object.assign(this.defaultFlatpickrOptions,this.config),this.flatpickr=this.flatpickrElement.nativeElement.flatpickr(this.defaultFlatpickrOptions),this.setDate&&this.setDateFromInput(this.setDate)},t.prototype.ngOnChanges=function(t){this.flatpickrElement.nativeElement&&this.flatpickrElement.nativeElement._flatpickr&&(t.hasOwnProperty("setDate")&&t.setDate.currentValue&&this.setDateFromInput(t.setDate.currentValue),this.config.altInput&&t.hasOwnProperty("placeholder")&&t.placeholder.currentValue&&this.setAltInputPlaceholder(t.placeholder.currentValue))},o([e.ViewChild("flatpickr",{static:!0}),p("design:type",Object)],t.prototype,"flatpickrElement",void 0),o([e.Input(),p("design:type",Object)],t.prototype,"config",void 0),o([e.Input(),p("design:type",String)],t.prototype,"placeholder",void 0),o([e.Input(),p("design:type",String)],t.prototype,"addClass",void 0),o([e.Input(),p("design:type",Object)],t.prototype,"setDate",void 0),o([e.Input(),p("design:type",Number),p("design:paramtypes",[Number])],t.prototype,"tabindex",null),o([e.Input(),p("design:type",Object)],t.prototype,"hideButton",void 0),t=i=o([e.Component({selector:"ng2-flatpickr",template:'\n\t\t<div class="ng2-flatpickr-input-container" #flatpickr>\n\t\t\t<input *ngIf="!hideButton" class="ng2-flatpickr-input {{ addClass }}" [placeholder]="placeholder" [tabindex]="tabindex" type="text" data-input>\n\t\t\t<ng-content></ng-content>\n\t\t</div>\n\t\t',providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return i})),multi:!0}]})],t)}(),a=function(){function t(t,n,i,o){this.parent=t,this.ngControl=n,this.element=i,this.renderer=o,this.flatpickrOnChange=new e.EventEmitter,this.flatpickrOnClose=new e.EventEmitter,this.flatpickrOnOpen=new e.EventEmitter,this.flatpickrOnReady=new e.EventEmitter}return t.prototype.onClick=function(){this.flatpickr.toggle()},Object.defineProperty(t.prototype,"control",{get:function(){return this.parent?this.parent.formDirective.getControl(this.ngControl):null},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){var t=this.element.nativeElement;if(null==t)throw"Error: invalid input element specified";this.flatpickrOptions.wrap&&(this.renderer.setElementAttribute(this.element.nativeElement,"data-input",""),t=t.parentNode),this.flatpickr=t.flatpickr(this.flatpickrOptions)},t.prototype.ngOnChanges=function(t){this.flatpickr&&this.flatpickrAltInput&&t.hasOwnProperty("placeholder")&&t.placeholder.currentValue&&this.flatpickr.altInput.setAttribute("placeholder",t.placeholder.currentValue)},t.prototype.ngOnDestroy=function(){this.flatpickr&&this.flatpickr.destroy(),this.formControlListener&&(this.formControlListener.unsubscribe(),this.formControlListener=void 0),this.flatpickrOnChange=void 0,this.flatpickrOnClose=void 0,this.flatpickrOnOpen=void 0,this.flatpickrOnReady=void 0},t.prototype.ngOnInit=function(){var t=this;this.globalOnChange=this.flatpickrOptions.onChange,this.globalOnClose=this.flatpickrOptions.onClose,this.globalOnOpen=this.flatpickrOptions.onOpen,this.globalOnReady=this.flatpickrOptions.onReady,this.flatpickrOptions={altFormat:this.getOption("altFormat"),altInput:this.getOption("altInput"),altInputClass:this.getOption("altInputClass"),allowInput:this.getOption("allowInput"),appendTo:this.getOption("appendTo"),clickOpens:this.getOption("clickOpens",!0),dateFormat:this.getOption("dateFormat"),defaultDate:this.getOption("defaultDate"),disable:this.getOption("disable"),disableMobile:this.getOption("disableMobile"),enable:this.getOption("enable"),enableTime:this.getOption("enableTime"),enableSeconds:this.getOption("enableSeconds"),hourIncrement:this.getOption("hourIncrement"),inline:this.getOption("inline"),locale:this.getOption("locale"),maxDate:this.getOption("maxDate"),minDate:this.getOption("minDate"),minuteIncrement:this.getOption("minuteIncrement"),mode:this.getOption("mode"),nextArrow:this.getOption("nextArrow"),noCalendar:this.getOption("noCalendar"),onChange:this.eventOnChange.bind(this),onClose:this.eventOnClose.bind(this),onOpen:this.eventOnOpen.bind(this),onReady:this.eventOnReady.bind(this),parseDate:this.getOption("parseDate"),prevArrow:this.getOption("prevArrow"),shorthandCurrentMonth:this.getOption("shorthandCurrentMonth"),static:this.getOption("static"),time_24hr:this.getOption("time_24hr"),utc:this.getOption("utc"),weekNumbers:this.getOption("weekNumbers"),wrap:this.getOption("wrap",!0)},Object.keys(this.flatpickrOptions).forEach((function(e){void 0===t.flatpickrOptions[e]&&delete t.flatpickrOptions[e]})),this.control&&(this.formControlListener=this.control.valueChanges.subscribe((function(e){e instanceof Date||t.control.setValue(new Date(""+e),{onlySelf:!0,emitEvent:!1,emitModelToViewChange:!1,emitViewToModelChange:!1})})))},t.prototype.eventOnChange=function(t,e,n){var i={selectedDates:t,dateStr:e,instance:n};this.flatpickrOnChange&&this.flatpickrOnChange.emit(i),this.globalOnChange&&this.globalOnChange(i)},t.prototype.eventOnClose=function(t,e,n){var i={selectedDates:t,dateStr:e,instance:n};this.flatpickrOnClose&&this.flatpickrOnClose.emit(i),this.globalOnClose&&this.globalOnClose(i)},t.prototype.eventOnOpen=function(t,e,n){var i={selectedDates:t,dateStr:e,instance:n};this.flatpickrOnOpen&&this.flatpickrOnOpen.emit(i),this.globalOnOpen&&this.globalOnOpen(i)},t.prototype.eventOnReady=function(t,e,n){var i={selectedDates:t,dateStr:e,instance:n};this.flatpickrOnReady&&this.flatpickrOnReady.emit(i),this.globalOnReady&&this.globalOnReady(i)},t.prototype.getOption=function(t,e){var n="flatpickr"+t.substring(0,1).toUpperCase()+t.substring(1);return void 0!==this[n]?this[n]:void 0!==this.flatpickrOptions[t]?this.flatpickrOptions[t]:e},o([e.Input("flatpickr"),p("design:type",Object)],t.prototype,"flatpickrOptions",void 0),o([e.Input("placeholder"),p("design:type",String)],t.prototype,"placeholder",void 0),o([e.Input("altFormat"),p("design:type",String)],t.prototype,"flatpickrAltFormat",void 0),o([e.Input("altInput"),p("design:type",Boolean)],t.prototype,"flatpickrAltInput",void 0),o([e.Input("altInputClass"),p("design:type",String)],t.prototype,"flatpickrAltInputClass",void 0),o([e.Input("allowInput"),p("design:type",Boolean)],t.prototype,"flatpickrAllowInput",void 0),o([e.Input("appendTo"),p("design:type",HTMLElement)],t.prototype,"flatpickrAppendTo",void 0),o([e.Input("clickOpens"),p("design:type",Boolean)],t.prototype,"flatpickrClickOpens",void 0),o([e.Input("dateFormat"),p("design:type",String)],t.prototype,"flatpickrDateFormat",void 0),o([e.Input("defaultDate"),p("design:type",Object)],t.prototype,"flatpickrDefaultDate",void 0),o([e.Input("disable"),p("design:type",Array)],t.prototype,"flatpickrDisable",void 0),o([e.Input("disableMobile"),p("design:type",Boolean)],t.prototype,"flatpickrDisableMobile",void 0),o([e.Input("enable"),p("design:type",Array)],t.prototype,"flatpickrEnable",void 0),o([e.Input("enableTime"),p("design:type",Boolean)],t.prototype,"flatpickrEnableTime",void 0),o([e.Input("enableSeconds"),p("design:type",Boolean)],t.prototype,"flatpickrEnableSeconds",void 0),o([e.Input("hourIncrement"),p("design:type",Number)],t.prototype,"flatpickrHourIncrement",void 0),o([e.Input("inline"),p("design:type",Boolean)],t.prototype,"flatpickrInline",void 0),o([e.Input("locale"),p("design:type",Object)],t.prototype,"flatpickrLocale",void 0),o([e.Input("maxDate"),p("design:type",Object)],t.prototype,"flatpickrMaxDate",void 0),o([e.Input("minDate"),p("design:type",Object)],t.prototype,"flatpickrMinDate",void 0),o([e.Input("minuteIncrement"),p("design:type",Number)],t.prototype,"flatpickrMinuteIncrement",void 0),o([e.Input("mode"),p("design:type",String)],t.prototype,"flatpickrMode",void 0),o([e.Input("nextArrow"),p("design:type",String)],t.prototype,"flatpickrNextArrow",void 0),o([e.Input("noCalendar"),p("design:type",Boolean)],t.prototype,"flatpickrNoCalendar",void 0),o([e.Input("parseDate"),p("design:type",Function)],t.prototype,"flatpickrParseDate",void 0),o([e.Input("prevArrow"),p("design:type",String)],t.prototype,"flatpickrPrevArrow",void 0),o([e.Input("shorthandCurrentMonth"),p("design:type",Boolean)],t.prototype,"flatpickrShorthandCurrentMonth",void 0),o([e.Input("static"),p("design:type",Boolean)],t.prototype,"flatpickrStatic",void 0),o([e.Input("time_24hr"),p("design:type",Boolean)],t.prototype,"flatpickrTime_24hr",void 0),o([e.Input("utc"),p("design:type",Boolean)],t.prototype,"flatpickrUtc",void 0),o([e.Input("weekNumbers"),p("design:type",Boolean)],t.prototype,"flatpickrWeekNumbers",void 0),o([e.Input("wrap"),p("design:type",Boolean)],t.prototype,"flatpickrWrap",void 0),o([e.Output("onChange"),p("design:type",e.EventEmitter)],t.prototype,"flatpickrOnChange",void 0),o([e.Output("onClose"),p("design:type",e.EventEmitter)],t.prototype,"flatpickrOnClose",void 0),o([e.Output("onOpen"),p("design:type",e.EventEmitter)],t.prototype,"flatpickrOnOpen",void 0),o([e.Output("onReady"),p("design:type",e.EventEmitter)],t.prototype,"flatpickrOnReady",void 0),o([e.HostListener("dblclick"),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",void 0)],t.prototype,"onClick",null),t=o([e.Directive({selector:"[flatpickr]",exportAs:"ng2-flatpickr"}),p("design:paramtypes",[n.ControlContainer,n.NgControl,e.ElementRef,e.Renderer])],t)}(),l=function(){function t(){}return t=o([e.NgModule({imports:[i.CommonModule],declarations:[r,a],exports:[r,a]})],t)}();t.Ng2FlatpickrComponent=r,t.Ng2FlatpickrDirective=a,t.Ng2FlatpickrModule=l,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=msuntharesan-ng2-flatpickr.umd.min.js.map