UNPKG

ngx-bootstrap

Version:
1 lines 82.5 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs/operators"),require("ngx-bootstrap/chronos"),require("rxjs"),require("ngx-bootstrap/mini-ngrx"),require("ngx-bootstrap/positioning"),require("@angular/animations"),require("ngx-bootstrap/component-loader"),require("@angular/forms"),require("@angular/common"),require("ngx-bootstrap/utils")):"function"==typeof define&&define.amd?define("ngx-bootstrap/datepicker",["exports","@angular/core","rxjs/operators","ngx-bootstrap/chronos","rxjs","ngx-bootstrap/mini-ngrx","ngx-bootstrap/positioning","@angular/animations","ngx-bootstrap/component-loader","@angular/forms","@angular/common","ngx-bootstrap/utils"],t):t(((e=e||self)["ngx-bootstrap"]=e["ngx-bootstrap"]||{},e["ngx-bootstrap"].datepicker={}),e.ng.core,e.rxjs.operators,e.chronos,e.rxjs,e.miniNgrx,e.positioning,e.ng.animations,e.componentLoader,e.ng.forms,e.ng.common,e.utils)}(this,function(e,t,n,i,a,s,r,o,c,d,l,u){"use strict";var p=function(e,t){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function h(e,t){function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function f(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,a,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)r.push(i.value)}catch(e){a={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return r}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e}var b=function(){function e(){this.adaptivePosition=!1,this.isAnimated=!1,this.containerClass="theme-green",this.displayMonths=1,this.showWeekNumbers=!0,this.dateInputFormat="L",this.rangeSeparator=" - ",this.rangeInputFormat="L",this.monthTitle="MMMM",this.yearTitle="YYYY",this.dayLabel="D",this.monthLabel="MMMM",this.yearLabel="YYYY",this.weekNumbers="w"}return e.decorators=[{type:t.Injectable}],e}(),g=function(){function e(){this._customRangesFish=[]}return Object.defineProperty(e.prototype,"minDate",{set:function(e){this._effects.setMinDate(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDate",{set:function(e){this._effects.setMaxDate(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"daysDisabled",{set:function(e){this._effects.setDaysDisabled(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"datesDisabled",{set:function(e){this._effects.setDatesDisabled(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisabled",{set:function(e){this._effects.setDisabled(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateCustomClasses",{set:function(e){this._effects.setDateCustomClasses(e)},enumerable:!0,configurable:!0}),e.prototype.setViewMode=function(e){},e.prototype.navigateTo=function(e){},e.prototype.dayHoverHandler=function(e){},e.prototype.weekHoverHandler=function(e){},e.prototype.monthHoverHandler=function(e){},e.prototype.yearHoverHandler=function(e){},e.prototype.daySelectHandler=function(e){},e.prototype.monthSelectHandler=function(e){},e.prototype.yearSelectHandler=function(e){},e.prototype._stopPropagation=function(e){e.stopPropagation()},e}(),v=function(){function e(){}return e.prototype.calculate=function(){return{type:e.CALCULATE}},e.prototype.format=function(){return{type:e.FORMAT}},e.prototype.flag=function(){return{type:e.FLAG}},e.prototype.select=function(t){return{type:e.SELECT,payload:t}},e.prototype.changeViewMode=function(t){return{type:e.CHANGE_VIEWMODE,payload:t}},e.prototype.navigateTo=function(t){return{type:e.NAVIGATE_TO,payload:t}},e.prototype.navigateStep=function(t){return{type:e.NAVIGATE_OFFSET,payload:t}},e.prototype.setOptions=function(t){return{type:e.SET_OPTIONS,payload:t}},e.prototype.selectRange=function(t){return{type:e.SELECT_RANGE,payload:t}},e.prototype.hoverDay=function(t){return{type:e.HOVER,payload:t.isHovered?t.cell.date:null}},e.prototype.minDate=function(t){return{type:e.SET_MIN_DATE,payload:t}},e.prototype.maxDate=function(t){return{type:e.SET_MAX_DATE,payload:t}},e.prototype.daysDisabled=function(t){return{type:e.SET_DAYSDISABLED,payload:t}},e.prototype.datesDisabled=function(t){return{type:e.SET_DATESDISABLED,payload:t}},e.prototype.isDisabled=function(t){return{type:e.SET_IS_DISABLED,payload:t}},e.prototype.setDateCustomClasses=function(t){return{type:e.SET_DATE_CUSTOM_CLASSES,payload:t}},e.prototype.setLocale=function(t){return{type:e.SET_LOCALE,payload:t}},e.CALCULATE="[datepicker] calculate dates matrix",e.FORMAT="[datepicker] format datepicker values",e.FLAG="[datepicker] set flags",e.SELECT="[datepicker] select date",e.NAVIGATE_OFFSET="[datepicker] shift view date",e.NAVIGATE_TO="[datepicker] change view date",e.SET_OPTIONS="[datepicker] update render options",e.HOVER="[datepicker] hover date",e.CHANGE_VIEWMODE="[datepicker] switch view mode",e.SET_MIN_DATE="[datepicker] set min date",e.SET_MAX_DATE="[datepicker] set max date",e.SET_DAYSDISABLED="[datepicker] set days disabled",e.SET_DATESDISABLED="[datepicker] set dates disabled",e.SET_IS_DISABLED="[datepicker] set is disabled",e.SET_DATE_CUSTOM_CLASSES="[datepicker] set date custom classes",e.SET_LOCALE="[datepicker] set datepicker locale",e.SELECT_RANGE="[daterangepicker] select dates range",e.decorators=[{type:t.Injectable}],e}(),D=function(){function e(){this._defaultLocale="en",this._locale=new a.BehaviorSubject(this._defaultLocale),this._localeChange=this._locale.asObservable()}return Object.defineProperty(e.prototype,"locale",{get:function(){return this._locale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localeChange",{get:function(){return this._localeChange},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentLocale",{get:function(){return this._locale.getValue()},enumerable:!0,configurable:!0}),e.prototype.use=function(e){e!==this.currentLocale&&this._locale.next(e)},e.decorators=[{type:t.Injectable}],e}(),_=function(){function e(e,t){this._actions=e,this._localeService=t,this._subs=[]}return e.prototype.init=function(e){return this._store=e,this},e.prototype.setValue=function(e){this._store.dispatch(this._actions.select(e))},e.prototype.setRangeValue=function(e){this._store.dispatch(this._actions.selectRange(e))},e.prototype.setMinDate=function(e){return this._store.dispatch(this._actions.minDate(e)),this},e.prototype.setMaxDate=function(e){return this._store.dispatch(this._actions.maxDate(e)),this},e.prototype.setDaysDisabled=function(e){return this._store.dispatch(this._actions.daysDisabled(e)),this},e.prototype.setDatesDisabled=function(e){return this._store.dispatch(this._actions.datesDisabled(e)),this},e.prototype.setDisabled=function(e){return this._store.dispatch(this._actions.isDisabled(e)),this},e.prototype.setDateCustomClasses=function(e){return this._store.dispatch(this._actions.setDateCustomClasses(e)),this},e.prototype.setOptions=function(e){var t=Object.assign({locale:this._localeService.currentLocale},e);return this._store.dispatch(this._actions.setOptions(t)),this},e.prototype.setBindings=function(e){return e.daysCalendar=this._store.select(function(e){return e.flaggedMonths}).pipe(n.filter(function(e){return!!e})),e.monthsCalendar=this._store.select(function(e){return e.flaggedMonthsCalendar}).pipe(n.filter(function(e){return!!e})),e.yearsCalendar=this._store.select(function(e){return e.yearsCalendarFlagged}).pipe(n.filter(function(e){return!!e})),e.viewMode=this._store.select(function(e){return e.view.mode}),e.options=this._store.select(function(e){return e.showWeekNumbers}).pipe(n.map(function(e){return{showWeekNumbers:e}})),this},e.prototype.setEventHandlers=function(e){var t=this;return e.setViewMode=function(e){t._store.dispatch(t._actions.changeViewMode(e))},e.navigateTo=function(e){t._store.dispatch(t._actions.navigateStep(e.step))},e.dayHoverHandler=function(e){var n=e.cell;n.isOtherMonth||n.isDisabled||(t._store.dispatch(t._actions.hoverDay(e)),n.isHovered=e.isHovered)},e.monthHoverHandler=function(e){e.cell.isHovered=e.isHovered},e.yearHoverHandler=function(e){e.cell.isHovered=e.isHovered},e.monthSelectHandler=function(e){e.isDisabled||t._store.dispatch(t._actions.navigateTo({unit:{month:i.getMonth(e.date),year:i.getFullYear(e.date)},viewMode:"day"}))},e.yearSelectHandler=function(e){e.isDisabled||t._store.dispatch(t._actions.navigateTo({unit:{year:i.getFullYear(e.date)},viewMode:"month"}))},this},e.prototype.registerDatepickerSideEffects=function(){var e=this;return this._subs.push(this._store.select(function(e){return e.view}).subscribe(function(t){e._store.dispatch(e._actions.calculate())})),this._subs.push(this._store.select(function(e){return e.monthsModel}).pipe(n.filter(function(e){return!!e})).subscribe(function(t){return e._store.dispatch(e._actions.format())})),this._subs.push(this._store.select(function(e){return e.formattedMonths}).pipe(n.filter(function(e){return!!e})).subscribe(function(t){return e._store.dispatch(e._actions.flag())})),this._subs.push(this._store.select(function(e){return e.selectedDate}).pipe(n.filter(function(e){return!!e})).subscribe(function(t){return e._store.dispatch(e._actions.flag())})),this._subs.push(this._store.select(function(e){return e.selectedRange}).pipe(n.filter(function(e){return!!e})).subscribe(function(t){return e._store.dispatch(e._actions.flag())})),this._subs.push(this._store.select(function(e){return e.monthsCalendar}).subscribe(function(){return e._store.dispatch(e._actions.flag())})),this._subs.push(this._store.select(function(e){return e.yearsCalendarModel}).pipe(n.filter(function(e){return!!e})).subscribe(function(){return e._store.dispatch(e._actions.flag())})),this._subs.push(this._store.select(function(e){return e.hoveredDate}).pipe(n.filter(function(e){return!!e})).subscribe(function(t){return e._store.dispatch(e._actions.flag())})),this._subs.push(this._store.select(function(e){return e.dateCustomClasses}).pipe(n.filter(function(e){return!!e})).subscribe(function(t){return e._store.dispatch(e._actions.flag())})),this._subs.push(this._localeService.localeChange.subscribe(function(t){return e._store.dispatch(e._actions.setLocale(t))})),this},e.prototype.destroy=function(){var e,t;try{for(var n=f(this._subs),i=n.next();!i.done;i=n.next()){i.value.unsubscribe()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.decorators=[{type:t.Injectable}],e.ctorParameters=function(){return[{type:v},{type:D}]},e}(),k={date:new Date,mode:"day"},w=Object.assign(new b,{locale:"en",view:k,selectedRange:[],monthViewOptions:{width:7,height:6}});function C(e,t,n){var a=t&&i.isBefore(i.endOf(e,"month"),t,"day"),s=n&&i.isAfter(i.startOf(e,"month"),n,"day");return a||s}function M(e,t,n){var a=t&&i.isBefore(i.endOf(e,"year"),t,"day"),s=n&&i.isAfter(i.startOf(e,"year"),n,"day");return a||s}function x(e,t){for(var n=e.initialDate,a=new Array(e.height),s=0;s<e.height;s++){a[s]=new Array(e.width);for(var r=0;r<e.width;r++)a[s][r]=t(n),n=i.shiftDate(n,e.shift)}return a}function S(e,t){var n=i.getFirstDayOfMonth(e),a=function(e,t){if(i.isFirstDayOfWeek(e,t.firstDayOfWeek))return e;var n=function(e,t){if(0===t)return e;var n=e-t%7;return n<0?n+7:n}(i.getDay(e),t.firstDayOfWeek);return i.shiftDate(e,{day:-n})}(n,t);return{daysMatrix:x({width:t.width,height:t.height,initialDate:a,shift:{day:1}},function(e){return e}),month:n}}function O(e){var t=i.getLocale(e),n=t.weekdaysShort(),a=t.firstDayOfWeek();return m(n.slice(a),n.slice(0,a))}function I(e,t){return e.weeks.forEach(function(n){n.days.forEach(function(a,s){var r,o,c=!i.isSameMonth(a.date,e.month),d=!c&&i.isSameDay(a.date,t.hoveredDate),l=!c&&t.selectedRange&&i.isSameDay(a.date,t.selectedRange[0]),u=!c&&t.selectedRange&&i.isSameDay(a.date,t.selectedRange[1]),p=!c&&i.isSameDay(a.date,t.selectedDate)||l||u,h=!c&&t.selectedRange&&function(e,t,n){if(!e||!t[0])return!1;if(t[1])return e>t[0]&&e<=t[1];if(n)return e>t[0]&&e<=n;return!1}(a.date,t.selectedRange,t.hoveredDate),f=t.isDisabled||i.isBefore(a.date,t.minDate,"day")||i.isAfter(a.date,t.maxDate,"day")||i.isDisabledDay(a.date,t.daysDisabled)||(r=a.date,!(void 0===(o=t.datesDisabled)||!o||!o.length)&&o.some(function(e){return i.isSame(r,e,"date")})),y=new Date,m=!c&&i.isSameDay(a.date,y),b=t.dateCustomClasses&&t.dateCustomClasses.map(function(e){return i.isSameDay(a.date,e.date)?e.classes:[]}).reduce(function(e,t){return e.concat(t)},[]).join(" ")||"",g=Object.assign({},a,{isOtherMonth:c,isHovered:d,isSelected:p,isSelectionStart:l,isSelectionEnd:u,isInRange:h,isDisabled:f,isToday:m,customClasses:b});a.isOtherMonth===g.isOtherMonth&&a.isHovered===g.isHovered&&a.isSelected===g.isSelected&&a.isSelectionStart===g.isSelectionStart&&a.isSelectionEnd===g.isSelectionEnd&&a.isDisabled===g.isDisabled&&a.isInRange===g.isInRange&&a.customClasses===g.customClasses||(n.days[s]=g)})}),e.hideLeftArrow=t.isDisabled||t.monthIndex>0&&t.monthIndex!==t.displayMonths,e.hideRightArrow=t.isDisabled||t.monthIndex<t.displayMonths&&t.monthIndex+1!==t.displayMonths,e.disableLeftArrow=C(i.shiftDate(e.month,{month:-1}),t.minDate,t.maxDate),e.disableRightArrow=C(i.shiftDate(e.month,{month:1}),t.minDate,t.maxDate),e}function E(e,t){return!t||e>=t}var A=4,H=3,T={month:1};function V(e,t){var n=i.startOf(e,"year");return{months:x({width:H,height:A,initialDate:n,shift:T},function(e){return{date:e,label:i.formatDate(e,t.monthLabel,t.locale)}}),monthTitle:"",yearTitle:i.formatDate(e,t.yearTitle,t.locale)}}var P=4,R=4,F=P*R,L=-1*(Math.floor(F/2)-1),j={year:1};function N(e,t){var n=i.shiftDate(e,{year:L}),a=x({width:R,height:P,initialDate:n,shift:j},function(e){return{date:e,label:i.formatDate(e,t.yearLabel,t.locale)}});return{years:a,monthTitle:"",yearTitle:function(e,t){var n=i.formatDate(e[0][0].date,t.yearTitle,t.locale),a=i.formatDate(e[P-1][R-1].date,t.yearTitle,t.locale);return n+" - "+a}(a,t)}}function Y(e,t){switch(void 0===e&&(e=w),t.type){case v.CALCULATE:return function(e){var t=e.displayMonths,n=e.view.date;if("day"===e.view.mode){e.monthViewOptions.firstDayOfWeek=i.getLocale(e.locale).firstDayOfWeek();for(var a=new Array(t),s=0;s<t;s++)a[s]=S(n,e.monthViewOptions),n=i.shiftDate(n,{month:1});return Object.assign({},e,{monthsModel:a})}if("month"===e.view.mode){for(var r=new Array(t),o=0;o<t;o++)r[o]=V(n,B(e)),n=i.shiftDate(n,{year:1});return Object.assign({},e,{monthsCalendar:r})}if("year"===e.view.mode){var c=new Array(t);for(o=0;o<t;o++)c[o]=N(n,B(e)),n=i.shiftDate(n,{year:F});return Object.assign({},e,{yearsCalendarModel:c})}return e}(e);case v.FORMAT:return function(e,t){if("day"===e.view.mode){var n=e.monthsModel.map(function(t,n){return function(e,t,n){return{month:e.month,monthTitle:i.formatDate(e.month,t.monthTitle,t.locale),yearTitle:i.formatDate(e.month,t.yearTitle,t.locale),weekNumbers:(a=e.daysMatrix,s=t.weekNumbers,r=t.locale,a.map(function(e){return e[0]?i.formatDate(e[0],s,r):""})),weekdays:O(t.locale),weeks:e.daysMatrix.map(function(e,a){return{days:e.map(function(e,s){return{date:e,label:i.formatDate(e,t.dayLabel,t.locale),monthIndex:n,weekIndex:a,dayIndex:s}})}})};var a,s,r}(t,B(e),n)});return Object.assign({},e,{formattedMonths:n})}var a=e.displayMonths,s=e.view.date;if("month"===e.view.mode){for(var r=new Array(a),o=0;o<a;o++)r[o]=V(s,B(e)),s=i.shiftDate(s,{year:1});return Object.assign({},e,{monthsCalendar:r})}if("year"===e.view.mode){var c=new Array(a);for(o=0;o<a;o++)c[o]=N(s,B(e)),s=i.shiftDate(s,{year:16});return Object.assign({},e,{yearsCalendarModel:c})}return e}(e);case v.FLAG:return function(e,t){if("day"===e.view.mode){var n=e.formattedMonths.map(function(t,n){return I(t,{isDisabled:e.isDisabled,minDate:e.minDate,maxDate:e.maxDate,daysDisabled:e.daysDisabled,datesDisabled:e.datesDisabled,hoveredDate:e.hoveredDate,selectedDate:e.selectedDate,selectedRange:e.selectedRange,displayMonths:e.displayMonths,dateCustomClasses:e.dateCustomClasses,monthIndex:n})});return Object.assign({},e,{flaggedMonths:n})}if("month"===e.view.mode){var a=e.monthsCalendar.map(function(t,n){return a=t,s={isDisabled:e.isDisabled,minDate:e.minDate,maxDate:e.maxDate,hoveredMonth:e.hoveredMonth,displayMonths:e.displayMonths,monthIndex:n},a.months.forEach(function(e,t){e.forEach(function(e,n){var r=i.isSameMonth(e.date,s.hoveredMonth),o=s.isDisabled||C(e.date,s.minDate,s.maxDate),c=Object.assign(e,{isHovered:r,isDisabled:o});e.isHovered===c.isHovered&&e.isDisabled===c.isDisabled||(a.months[t][n]=c)})}),a.hideLeftArrow=s.monthIndex>0&&s.monthIndex!==s.displayMonths,a.hideRightArrow=s.monthIndex<s.displayMonths&&s.monthIndex+1!==s.displayMonths,a.disableLeftArrow=M(i.shiftDate(a.months[0][0].date,{year:-1}),s.minDate,s.maxDate),a.disableRightArrow=M(i.shiftDate(a.months[0][0].date,{year:1}),s.minDate,s.maxDate),a;var a,s});return Object.assign({},e,{flaggedMonthsCalendar:a})}if("year"===e.view.mode){var s=e.yearsCalendarModel.map(function(t,n){return function(e,t){e.years.forEach(function(n,a){n.forEach(function(n,s){var r=i.isSameYear(n.date,t.hoveredYear),o=t.isDisabled||M(n.date,t.minDate,t.maxDate),c=Object.assign(n,{isHovered:r,isDisabled:o});n.isHovered===c.isHovered&&n.isDisabled===c.isDisabled||(e.years[a][s]=c)})}),e.hideLeftArrow=t.yearIndex>0&&t.yearIndex!==t.displayMonths,e.hideRightArrow=t.yearIndex<t.displayMonths&&t.yearIndex+1!==t.displayMonths,e.disableLeftArrow=M(i.shiftDate(e.years[0][0].date,{year:-1}),t.minDate,t.maxDate);var n=e.years.length-1,a=e.years[n].length-1;return e.disableRightArrow=M(i.shiftDate(e.years[n][a].date,{year:1}),t.minDate,t.maxDate),e}(t,{isDisabled:e.isDisabled,minDate:e.minDate,maxDate:e.maxDate,hoveredYear:e.hoveredYear,displayMonths:e.displayMonths,yearIndex:n})});return Object.assign({},e,{yearsCalendarFlagged:s})}return e}(e);case v.NAVIGATE_OFFSET:var n=i.shiftDate(i.startOf(e.view.date,"month"),t.payload),a={view:{mode:e.view.mode,date:n}};return Object.assign({},e,a);case v.NAVIGATE_TO:var s=t.payload,r=(n=i.setFullDate(e.view.date,s.unit),a=void 0,void 0);return a=E(s.viewMode,e.minMode)?{view:{date:n,mode:r=s.viewMode}}:{selectedDate:n,view:{date:n,mode:r=e.view.mode}},Object.assign({},e,a);case v.CHANGE_VIEWMODE:if(!E(t.payload,e.minMode))return e;a={view:{date:n=e.view.date,mode:r=t.payload}};return Object.assign({},e,a);case v.HOVER:return Object.assign({},e,{hoveredDate:t.payload});case v.SELECT:a={selectedDate:t.payload,view:e.view},r=e.view.mode,n=z(t.payload||e.view.date,e.minDate,e.maxDate);return a.view={mode:r,date:n},Object.assign({},e,a);case v.SET_OPTIONS:r=(a=t.payload).minMode?a.minMode:e.view.mode,n=z(i.isDateValid(a.value)&&a.value||i.isArray(a.value)&&i.isDateValid(a.value[0])&&a.value[0]||e.view.date,a.minDate,a.maxDate);return a.view={mode:r,date:n},a.value&&(i.isArray(a.value)&&(a.selectedRange=a.value),a.value instanceof Date&&(a.selectedDate=a.value)),Object.assign({},e,a);case v.SELECT_RANGE:a={selectedRange:t.payload,view:e.view},r=e.view.mode,n=z(t.payload&&t.payload[0]||e.view.date,e.minDate,e.maxDate);return a.view={mode:r,date:n},Object.assign({},e,a);case v.SET_MIN_DATE:return Object.assign({},e,{minDate:t.payload});case v.SET_MAX_DATE:return Object.assign({},e,{maxDate:t.payload});case v.SET_IS_DISABLED:return Object.assign({},e,{isDisabled:t.payload});case v.SET_DATE_CUSTOM_CLASSES:return Object.assign({},e,{dateCustomClasses:t.payload});default:return e}}function B(e){return{locale:e.locale,monthTitle:e.monthTitle,yearTitle:e.yearTitle,dayLabel:e.dayLabel,monthLabel:e.monthLabel,yearLabel:e.yearLabel,weekNumbers:e.weekNumbers}}function z(e,t,n){var a=Array.isArray(e)?e[0]:e;return t&&i.isAfter(t,a,"day")?t:n&&i.isBefore(n,a,"day")?n:a}var $=function(e){function n(){var t=new a.BehaviorSubject({type:"[datepicker] dispatcher init"}),n=new s.MiniState(w,t,Y);return e.call(this,t,Y,n)||this}return h(n,e),n.decorators=[{type:t.Injectable}],n.ctorParameters=function(){return[]},n}(s.MiniStore),W=o.trigger("datepickerAnimation",[o.state("animated-down",o.style({height:"*",overflow:"hidden"})),o.transition("* => animated-down",[o.style({height:0,overflow:"hidden"}),o.animate("220ms cubic-bezier(0, 0, 0.2, 1)")]),o.state("animated-up",o.style({height:"*",overflow:"hidden"})),o.transition("* => animated-up",[o.style({height:"*",overflow:"hidden"}),o.animate("220ms cubic-bezier(0, 0, 0.2, 1)")]),o.transition("* => unanimated",o.animate("0s"))]),G=function(e){function i(n,i,a,s,r,o,c){var d=e.call(this)||this;return d._config=i,d._store=a,d._element=s,d._actions=r,d._positionService=c,d.valueChange=new t.EventEmitter,d.animationState="void",d._subs=[],d._effects=o,n.setStyle(s.nativeElement,"display","block"),n.setStyle(s.nativeElement,"position","absolute"),d}return h(i,e),Object.defineProperty(i.prototype,"value",{set:function(e){this._effects.setValue(e)},enumerable:!0,configurable:!0}),i.prototype.ngOnInit=function(){var e=this;this._positionService.setOptions({modifiers:{flip:{enabled:this._config.adaptivePosition}},allowedPositions:["top","bottom"]}),this._positionService.event$.pipe(n.take(1)).subscribe(function(){e._positionService.disable(),e._config.isAnimated?e.animationState=e.isTopPosition?"animated-up":"animated-down":e.animationState="unanimated"}),this.isOtherMonthsActive=this._config.selectFromOtherMonth,this.containerClass=this._config.containerClass,this._effects.init(this._store).setOptions(this._config).setBindings(this).setEventHandlers(this).registerDatepickerSideEffects(),this._subs.push(this._store.select(function(e){return e.selectedDate}).subscribe(function(t){return e.valueChange.emit(t)}))},Object.defineProperty(i.prototype,"isTopPosition",{get:function(){return this._element.nativeElement.classList.contains("top")},enumerable:!0,configurable:!0}),i.prototype.positionServiceEnable=function(){this._positionService.enable()},i.prototype.daySelectHandler=function(e){(this.isOtherMonthsActive?e.isDisabled:e.isOtherMonth||e.isDisabled)||this._store.dispatch(this._actions.select(e.date))},i.prototype.ngOnDestroy=function(){var e,t;try{for(var n=f(this._subs),i=n.next();!i.done;i=n.next()){i.value.unsubscribe()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._effects.destroy()},i.decorators=[{type:t.Component,args:[{selector:"bs-datepicker-container",providers:[$,_],template:'\x3c!-- days calendar view mode --\x3e\n<div class="bs-datepicker" [ngClass]="containerClass" *ngIf="viewMode | async">\n <div\n class="bs-datepicker-container"\n [@datepickerAnimation]="animationState"\n (@datepickerAnimation.done)="positionServiceEnable()">\n \x3c!--calendars--\x3e\n <div class="bs-calendar-container" [ngSwitch]="viewMode | async" role="application">\n \x3c!--days calendar--\x3e\n <div *ngSwitchCase="\'day\'" class="bs-media-container">\n <bs-days-calendar-view\n *ngFor="let calendar of (daysCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n [options]="options | async"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="dayHoverHandler($event)"\n (onHoverWeek)="weekHoverHandler($event)"\n (onSelect)="daySelectHandler($event)"\n ></bs-days-calendar-view>\n </div>\n\n \x3c!--months calendar--\x3e\n <div *ngSwitchCase="\'month\'" class="bs-media-container">\n <bs-month-calendar-view\n *ngFor="let calendar of (monthsCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="monthHoverHandler($event)"\n (onSelect)="monthSelectHandler($event)"\n ></bs-month-calendar-view>\n </div>\n\n \x3c!--years calendar--\x3e\n <div *ngSwitchCase="\'year\'" class="bs-media-container">\n <bs-years-calendar-view\n *ngFor="let calendar of (yearsCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async )?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="yearHoverHandler($event)"\n (onSelect)="yearSelectHandler($event)"\n ></bs-years-calendar-view>\n </div>\n\n </div>\n\n \x3c!--applycancel buttons--\x3e\n <div class="bs-datepicker-buttons" *ngIf="false">\n <button class="btn btn-success">Apply</button>\n <button class="btn btn-default">Cancel</button>\n </div>\n\n </div>\n\n \x3c!--custom dates or date ranges picker--\x3e\n <div class="bs-datepicker-custom-range" *ngIf="false">\n <bs-custom-date-view [ranges]="_customRangesFish"></bs-custom-date-view>\n </div>\n</div>\n',host:{class:"bottom","(click)":"_stopPropagation($event)",role:"dialog","aria-label":"calendar"},animations:[W]}]}],i.ctorParameters=function(){return[{type:t.Renderer2},{type:b},{type:$},{type:t.ElementRef},{type:v},{type:_},{type:r.PositioningService}]},i}(g),q=function(){function e(e,n,i,a,s){this._config=e,this.placement="bottom",this.triggers="click",this.outsideClick=!0,this.container="body",this.outsideEsc=!0,this.bsValueChange=new t.EventEmitter,this._subs=[],Object.assign(this,this._config),this._datepicker=s.createLoader(n,a,i),this.onShown=this._datepicker.onShown,this.onHidden=this._datepicker.onHidden}return Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._datepicker.isShown},set:function(e){e?this.show():this.hide()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bsValue",{set:function(e){this._bsValue!==e&&(this._bsValue=e,this.bsValueChange.emit(e))},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this._datepicker.listen({outsideClick:this.outsideClick,outsideEsc:this.outsideEsc,triggers:this.triggers,show:function(){return e.show()}}),this.setConfig()},e.prototype.ngOnChanges=function(e){this._datepickerRef&&this._datepickerRef.instance&&(e.minDate&&(this._datepickerRef.instance.minDate=this.minDate),e.maxDate&&(this._datepickerRef.instance.maxDate=this.maxDate),e.daysDisabled&&(this._datepickerRef.instance.daysDisabled=this.daysDisabled),e.datesDisabled&&(this._datepickerRef.instance.datesDisabled=this.datesDisabled),e.isDisabled&&(this._datepickerRef.instance.isDisabled=this.isDisabled),e.dateCustomClasses&&(this._datepickerRef.instance.dateCustomClasses=this.dateCustomClasses))},e.prototype.show=function(){var e=this;this._datepicker.isShown||(this.setConfig(),this._datepickerRef=this._datepicker.provide({provide:b,useValue:this._config}).attach(G).to(this.container).position({attachment:this.placement}).show({placement:this.placement}),this._subs.push(this.bsValueChange.subscribe(function(t){e._datepickerRef.instance.value=t})),this._subs.push(this._datepickerRef.instance.valueChange.subscribe(function(t){e.bsValue=t,e.hide()})))},e.prototype.hide=function(){var e,t;this.isOpen&&this._datepicker.hide();try{for(var n=f(this._subs),i=n.next();!i.done;i=n.next()){i.value.unsubscribe()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.toggle=function(){if(this.isOpen)return this.hide();this.show()},e.prototype.setConfig=function(){this._config=Object.assign({},this._config,this.bsConfig,{value:this._bsValue,isDisabled:this.isDisabled,minDate:this.minDate||this.bsConfig&&this.bsConfig.minDate,maxDate:this.maxDate||this.bsConfig&&this.bsConfig.maxDate,daysDisabled:this.daysDisabled||this.bsConfig&&this.bsConfig.daysDisabled,dateCustomClasses:this.dateCustomClasses||this.bsConfig&&this.bsConfig.dateCustomClasses,datesDisabled:this.datesDisabled||this.bsConfig&&this.bsConfig.datesDisabled,minMode:this.minMode||this.bsConfig&&this.bsConfig.minMode})},e.prototype.ngOnDestroy=function(){this._datepicker.dispose()},e.decorators=[{type:t.Directive,args:[{selector:"[bsDatepicker]",exportAs:"bsDatepicker"}]}],e.ctorParameters=function(){return[{type:b},{type:t.ElementRef},{type:t.Renderer2},{type:t.ViewContainerRef},{type:c.ComponentLoaderFactory}]},e.propDecorators={placement:[{type:t.Input}],triggers:[{type:t.Input}],outsideClick:[{type:t.Input}],container:[{type:t.Input}],outsideEsc:[{type:t.Input}],isOpen:[{type:t.Input}],onShown:[{type:t.Output}],onHidden:[{type:t.Output}],bsValue:[{type:t.Input}],bsConfig:[{type:t.Input}],isDisabled:[{type:t.Input}],minDate:[{type:t.Input}],maxDate:[{type:t.Input}],minMode:[{type:t.Input}],daysDisabled:[{type:t.Input}],datesDisabled:[{type:t.Input}],dateCustomClasses:[{type:t.Input}],bsValueChange:[{type:t.Output}]},e}(),U=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return h(n,e),n.decorators=[{type:t.Injectable}],n}(b),Z=function(e){function n(t,n,i,a,s,r,o){var c=e.call(this,t,n,i,a,s,r,o)||this;return t.setStyle(a.nativeElement,"display","inline-block"),t.setStyle(a.nativeElement,"position","static"),c}return h(n,e),n.decorators=[{type:t.Component,args:[{selector:"bs-datepicker-inline-container",providers:[$,_],template:'\x3c!-- days calendar view mode --\x3e\n<div class="bs-datepicker" [ngClass]="containerClass" *ngIf="viewMode | async">\n <div\n class="bs-datepicker-container"\n [@datepickerAnimation]="animationState"\n (@datepickerAnimation.done)="positionServiceEnable()">\n \x3c!--calendars--\x3e\n <div class="bs-calendar-container" [ngSwitch]="viewMode | async" role="application">\n \x3c!--days calendar--\x3e\n <div *ngSwitchCase="\'day\'" class="bs-media-container">\n <bs-days-calendar-view\n *ngFor="let calendar of (daysCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n [options]="options | async"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="dayHoverHandler($event)"\n (onHoverWeek)="weekHoverHandler($event)"\n (onSelect)="daySelectHandler($event)"\n ></bs-days-calendar-view>\n </div>\n\n \x3c!--months calendar--\x3e\n <div *ngSwitchCase="\'month\'" class="bs-media-container">\n <bs-month-calendar-view\n *ngFor="let calendar of (monthsCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="monthHoverHandler($event)"\n (onSelect)="monthSelectHandler($event)"\n ></bs-month-calendar-view>\n </div>\n\n \x3c!--years calendar--\x3e\n <div *ngSwitchCase="\'year\'" class="bs-media-container">\n <bs-years-calendar-view\n *ngFor="let calendar of (yearsCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async )?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="yearHoverHandler($event)"\n (onSelect)="yearSelectHandler($event)"\n ></bs-years-calendar-view>\n </div>\n\n </div>\n\n \x3c!--applycancel buttons--\x3e\n <div class="bs-datepicker-buttons" *ngIf="false">\n <button class="btn btn-success">Apply</button>\n <button class="btn btn-default">Cancel</button>\n </div>\n\n </div>\n\n \x3c!--custom dates or date ranges picker--\x3e\n <div class="bs-datepicker-custom-range" *ngIf="false">\n <bs-custom-date-view [ranges]="_customRangesFish"></bs-custom-date-view>\n </div>\n</div>\n',host:{"(click)":"_stopPropagation($event)"},animations:[W]}]}],n.ctorParameters=function(){return[{type:t.Renderer2},{type:b},{type:$},{type:t.ElementRef},{type:v},{type:_},{type:r.PositioningService}]},n}(G),Q=function(){function e(e,n,i,a,s){this._config=e,this._elementRef=n,this.bsValueChange=new t.EventEmitter,this._subs=[],Object.assign(this,this._config),this._datepicker=s.createLoader(n,a,i)}return Object.defineProperty(e.prototype,"bsValue",{set:function(e){this._bsValue!==e&&(this._bsValue=e,this.bsValueChange.emit(e))},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.setConfig(),this._datepickerRef=this._datepicker.provide({provide:b,useValue:this._config}).attach(Z).to(this._elementRef).show(),this._subs.push(this.bsValueChange.subscribe(function(t){e._datepickerRef.instance.value=t})),this._subs.push(this._datepickerRef.instance.valueChange.subscribe(function(t){e.bsValue=t}))},e.prototype.ngOnChanges=function(e){this._datepickerRef&&this._datepickerRef.instance&&(e.minDate&&(this._datepickerRef.instance.minDate=this.minDate),e.maxDate&&(this._datepickerRef.instance.maxDate=this.maxDate),e.datesDisabled&&(this._datepickerRef.instance.datesDisabled=this.datesDisabled),e.isDisabled&&(this._datepickerRef.instance.isDisabled=this.isDisabled),e.dateCustomClasses&&(this._datepickerRef.instance.dateCustomClasses=this.dateCustomClasses))},e.prototype.setConfig=function(){this._config=Object.assign({},this._config,this.bsConfig,{value:this._bsValue,isDisabled:this.isDisabled,minDate:this.minDate||this.bsConfig&&this.bsConfig.minDate,maxDate:this.maxDate||this.bsConfig&&this.bsConfig.maxDate,dateCustomClasses:this.dateCustomClasses||this.bsConfig&&this.bsConfig.dateCustomClasses,datesDisabled:this.datesDisabled||this.bsConfig&&this.bsConfig.datesDisabled})},e.prototype.ngOnDestroy=function(){this._datepicker.dispose()},e.decorators=[{type:t.Directive,args:[{selector:"bs-datepicker-inline",exportAs:"bsDatepickerInline"}]}],e.ctorParameters=function(){return[{type:U},{type:t.ElementRef},{type:t.Renderer2},{type:t.ViewContainerRef},{type:c.ComponentLoaderFactory}]},e.propDecorators={bsValue:[{type:t.Input}],bsConfig:[{type:t.Input}],isDisabled:[{type:t.Input}],minDate:[{type:t.Input}],maxDate:[{type:t.Input}],dateCustomClasses:[{type:t.Input}],datesDisabled:[{type:t.Input}],bsValueChange:[{type:t.Output}]},e}(),K={provide:d.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return J}),multi:!0},X={provide:d.NG_VALIDATORS,useExisting:t.forwardRef(function(){return J}),multi:!0},J=function(){function e(e,t,n,i,a){var s=this;this._picker=e,this._localeService=t,this._renderer=n,this._elRef=i,this.changeDetection=a,this._onChange=Function.prototype,this._onTouched=Function.prototype,this._validatorChange=Function.prototype,this._picker.bsValueChange.subscribe(function(e){s._setInputValue(e),s._value!==e&&(s._value=e,s._onChange(e),s._onTouched()),s.changeDetection.markForCheck()}),this._localeService.localeChange.subscribe(function(){s._setInputValue(s._value)})}return e.prototype._setInputValue=function(e){var t=e?i.formatDate(e,this._picker._config.dateInputFormat,this._localeService.currentLocale):"";this._renderer.setProperty(this._elRef.nativeElement,"value",t)},e.prototype.onChange=function(e){this.writeValue(e.target.value),this._onChange(this._value),this._onTouched()},e.prototype.validate=function(e){var t=e.value;if(null==t||""===t)return null;if(i.isDate(t)){if(!i.isDateValid(t))return{bsDate:{invalid:t}};if(this._picker&&this._picker.minDate&&i.isBefore(t,this._picker.minDate,"date"))return{bsDate:{minDate:this._picker.minDate}};if(this._picker&&this._picker.maxDate&&i.isAfter(t,this._picker.maxDate,"date"))return{bsDate:{maxDate:this._picker.maxDate}}}},e.prototype.registerOnValidatorChange=function(e){this._validatorChange=e},e.prototype.writeValue=function(e){if(e){var t=this._localeService.currentLocale;if(!i.getLocale(t))throw new Error('Locale "'+t+'" is not defined, please add it with "defineLocale(...)"');this._value=i.parseDate(e,this._picker._config.dateInputFormat,this._localeService.currentLocale)}else this._value=null;this._picker.bsValue=this._value},e.prototype.setDisabledState=function(e){this._picker.isDisabled=e,e?this._renderer.setAttribute(this._elRef.nativeElement,"disabled","disabled"):this._renderer.removeAttribute(this._elRef.nativeElement,"disabled")},e.prototype.registerOnChange=function(e){this._onChange=e},e.prototype.registerOnTouched=function(e){this._onTouched=e},e.prototype.onBlur=function(){this._onTouched()},e.prototype.hide=function(){this._picker.hide(),this._renderer.selectRootElement(this._elRef.nativeElement).blur()},e.decorators=[{type:t.Directive,args:[{selector:"input[bsDatepicker]",host:{"(change)":"onChange($event)","(keyup.esc)":"hide()","(blur)":"onBlur()"},providers:[K,X]}]}],e.ctorParameters=function(){return[{type:q,decorators:[{type:t.Host}]},{type:D},{type:t.Renderer2},{type:t.ElementRef},{type:t.ChangeDetectorRef}]},e}(),ee=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.displayMonths=2,t.isAnimated=!1,t}return h(n,e),n.decorators=[{type:t.Injectable}],n}(b),te=function(e){function i(n,i,a,s,r,o){var c=e.call(this)||this;return c._actions=i,c._config=a,c._store=s,c._element=r,c._positionService=o,c.valueChange=new t.EventEmitter,c.animationState="void",c._rangeStack=[],c._subs=[],c._effects=n,c}return h(i,e),Object.defineProperty(i.prototype,"value",{set:function(e){this._effects.setRangeValue(e)},enumerable:!0,configurable:!0}),i.prototype.ngOnInit=function(){var e=this;this._positionService.setOptions({modifiers:{flip:{enabled:this._config.adaptivePosition}},allowedPositions:["top","bottom"]}),this._positionService.event$.pipe(n.take(1)).subscribe(function(){e._positionService.disable(),e._config.isAnimated?e.animationState=e.isTopPosition?"animated-up":"animated-down":e.animationState="unanimated"}),this.containerClass=this._config.containerClass,this.isOtherMonthsActive=this._config.selectFromOtherMonth,this._effects.init(this._store).setOptions(this._config).setBindings(this).setEventHandlers(this).registerDatepickerSideEffects(),this._subs.push(this._store.select(function(e){return e.selectedRange}).subscribe(function(t){return e.valueChange.emit(t)}))},Object.defineProperty(i.prototype,"isTopPosition",{get:function(){return this._element.nativeElement.classList.contains("top")},enumerable:!0,configurable:!0}),i.prototype.positionServiceEnable=function(){this._positionService.enable()},i.prototype.daySelectHandler=function(e){(this.isOtherMonthsActive?e.isDisabled:e.isOtherMonth||e.isDisabled)||(1===this._rangeStack.length&&(this._rangeStack=e.date>=this._rangeStack[0]?[this._rangeStack[0],e.date]:[e.date]),0===this._rangeStack.length&&(this._rangeStack=[e.date]),this._store.dispatch(this._actions.selectRange(this._rangeStack)),2===this._rangeStack.length&&(this._rangeStack=[]))},i.prototype.ngOnDestroy=function(){var e,t;try{for(var n=f(this._subs),i=n.next();!i.done;i=n.next()){i.value.unsubscribe()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._effects.destroy()},i.decorators=[{type:t.Component,args:[{selector:"bs-daterangepicker-container",providers:[$,_],template:'\x3c!-- days calendar view mode --\x3e\n<div class="bs-datepicker" [ngClass]="containerClass" *ngIf="viewMode | async">\n <div\n class="bs-datepicker-container"\n [@datepickerAnimation]="animationState"\n (@datepickerAnimation.done)="positionServiceEnable()">\n \x3c!--calendars--\x3e\n <div class="bs-calendar-container" [ngSwitch]="viewMode | async" role="application">\n \x3c!--days calendar--\x3e\n <div *ngSwitchCase="\'day\'" class="bs-media-container">\n <bs-days-calendar-view\n *ngFor="let calendar of (daysCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n [options]="options | async"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="dayHoverHandler($event)"\n (onHoverWeek)="weekHoverHandler($event)"\n (onSelect)="daySelectHandler($event)"\n ></bs-days-calendar-view>\n </div>\n\n \x3c!--months calendar--\x3e\n <div *ngSwitchCase="\'month\'" class="bs-media-container">\n <bs-month-calendar-view\n *ngFor="let calendar of (monthsCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="monthHoverHandler($event)"\n (onSelect)="monthSelectHandler($event)"\n ></bs-month-calendar-view>\n </div>\n\n \x3c!--years calendar--\x3e\n <div *ngSwitchCase="\'year\'" class="bs-media-container">\n <bs-years-calendar-view\n *ngFor="let calendar of (yearsCalendar | async)"\n [class.bs-datepicker-multiple]="(daysCalendar | async )?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="yearHoverHandler($event)"\n (onSelect)="yearSelectHandler($event)"\n ></bs-years-calendar-view>\n </div>\n\n </div>\n\n \x3c!--applycancel buttons--\x3e\n <div class="bs-datepicker-buttons" *ngIf="false">\n <button class="btn btn-success">Apply</button>\n <button class="btn btn-default">Cancel</button>\n </div>\n\n </div>\n\n \x3c!--custom dates or date ranges picker--\x3e\n <div class="bs-datepicker-custom-range" *ngIf="false">\n <bs-custom-date-view [ranges]="_customRangesFish"></bs-custom-date-view>\n </div>\n</div>\n',host:{class:"bottom","(click)":"_stopPropagation($event)",style:"position: absolute; display: block;",role:"dialog","aria-label":"calendar"},animations:[W]}]}],i.ctorParameters=function(){return[{type:_},{type:v},{type:b},{type:$},{type:t.ElementRef},{type:r.PositioningService}]},i}(g),ne=function(){function e(e,n,i,a,s){this._config=e,this.placement="bottom",this.triggers="click",this.outsideClick=!0,this.container="body",this.outsideEsc=!0,this.bsValueChange=new t.EventEmitter,this._subs=[],this._datepicker=s.createLoader(n,a,i),Object.assign(this,e),this.onShown=this._datepicker.onShown,this.onHidden=this._datepicker.onHidden}return Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._datepicker.isShown},set:function(e){e?this.show():this.hide()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bsValue",{set:function(e){this._bsValue!==e&&(this._bsValue=e,this.bsValueChange.emit(e))},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this._datepicker.listen({outsideClick:this.outsideClick,outsideEsc:this.outsideEsc,triggers:this.triggers,show:function(){return e.show()}}),this.setConfig()},e.prototype.ngOnChanges=function(e){this._datepickerRef&&this._datepickerRef.instance&&(e.minDate&&(this._datepickerRef.instance.minDate=this.minDate),e.maxDate&&(this._datepickerRef.instance.maxDate=this.maxDate),e.datesDisabled&&(this._datepickerRef.instance.datesDisabled=this.datesDisabled),e.isDisabled&&(this._datepickerRef.instance.isDisabled=this.isDisabled),e.dateCustomClasses&&(this._datepickerRef.instance.dateCustomClasses=this.dateCustomClasses))},e.prototype.show=function(){var e=this;this._datepicker.isShown||(this.setConfig(),this._datepickerRef=this._datepicker.provide({provide:b,useValue:this._config}).attach(te).to(this.container).position({attachment:this.placement}).show({placement:this.placement}),this._subs.push(this.bsValueChange.subscribe(function(t){e._datepickerRef.instance.value=t})),this._subs.push(this._datepickerRef.instance.valueChange.pipe(n.filter(function(e){return e&&e[0]&&!!e[1]})).subscribe(function(t){e.bsValue=t,e.hide()})))},e.prototype.setConfig=function(){this._config=Object.assign({},this._config,this.bsConfig,{value:this._bsValue,isDisabled:this.isDisabled,minDate:this.minDate||this.bsConfig&&this.bsConfig.minDate,maxDate:this.maxDate||this.bsConfig&&this.bsConfig.maxDate,dateCustomClasses:this.dateCustomClasses||this.bsConfig&&this.bsConfig.dateCustomClasses,datesDisabled:this.datesDisabled||this.bsConfig&&this.bsConfig.datesDisabled})},e.prototype.hide=function(){var e,t;this.isOpen&&this._datepicker.hide();try{for(var n=f(this._subs),i=n.next();!i.done;i=n.next()){i.value.unsubscribe()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.toggle=function(){if(this.isOpen)return this.hide();this.show()},e.prototype.ngOnDestroy=function(){this._datepicker.dispose()},e.decorators=[{type:t.Directive,args:[{selector:"[bsDaterangepicker]",exportAs:"bsDaterangepicker"}]}],e.ctorParameters=function(){return[{type:ee},{type:t.ElementRef},{type:t.Renderer2},{type:t.ViewContainerRef},{type:c.ComponentLoaderFactory}]},e.propDecorators={placement:[{type:t.Input}],triggers:[{type:t.Input}],outsideClick:[{type:t.Input}],container:[{type:t.Input}],outsideEsc:[{type:t.Input}],isOpen:[{type:t.Input}],onShown:[{type:t.Output}],onHidden:[{type:t.Output}],bsValue:[{type:t.Input}],bsConfig:[{type:t.Input}],isDisabled:[{type:t.Input}],minDate:[{type:t.Input}],maxDate:[{type:t.Input}],dateCustomClasses:[{type:t.Input}],datesDisabled:[{type:t.Input}],bsValueChange:[{type:t.Output}]},e}(),ie={provide:d.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return se}),multi:!0},ae={provide:d.NG_VALIDATORS,useExisting:t.forwardRef(function(){return se}),multi:!0},se=function(){function e(e,t,n,i,a){var s=this;this._picker=e,this._localeService=t,this._renderer=n,this._elRef=i,this.changeDetection=a,this._onChange=Function.prototype,this._onTouched=Function.prototype,this._validatorChange=Function.prototype,this._picker.bsValueChange.subscribe(function(e){s._setInputValue(e),s._value!==e&&(s._value=e,s._onChange(e),s._onTouched()),s.changeDetection.markForCheck()}),this._localeService.localeChange.subscribe(function(){s._setInputValue(s._value)})}return e.prototype._setInputValue=function(e){var t="";if(e){var n=e[0]?i.formatDate(e[0],this._picker._config.rangeInputFormat,this._localeService.currentLocale):"",a=e[1]?i.formatDate(e[1],this._picker._config.rangeInputFormat,this._localeService.currentLocale):"";t=n&&a?n+this._picker._config.rangeSeparator+a:""}this._renderer.setProperty(this._elRef.nativeElement,"value",t)},e.prototype.onChange=function(e){this.writeValue(e.target.value),this._onChange(this._value),this._onTouched()},e.prototype.validate=function(e){var t=e.value;if(null==t||!i.isArray(t))return null;var n=i.isDateValid(t[0]),a=i.isDateValid(t[1]);return n?a?this._picker&&this._picker.minDate&&i.isBefore(t[0],this._picker.minDate,"date")?{bsDate:{minDate:this._picker.minDate}}:this._picker&&this._picker.maxDate&&i.isAfter(t[1],this._picker.maxDate,"date")?{bsDate:{maxDate:this._picker.maxDate}}:void 0:{bsDate:{invalid:t[1]}}:{bsDate:{invalid:t[0]}}},e.prototype.registerOnValidatorChange=function(e){this._validatorChange=e},e.prototype.writeValue=function(e){var t=this;if(e){var n=this._localeService.currentLocale;if(!i.getLocale(n))throw new Error('Locale "'+n+'" is not defined, please add it with "defineLocale(...)"');var a=[];"string"==typeof e&&(a=e.split(this._picker._config.rangeSeparator)),Array.isArray(e)&&(a=e),this._value=a.map(function(e){return i.parseDate(e,t._picker._config.dateInputFormat,t._localeService.currentLocale)}).map(function(e){return isNaN(e.valueOf())?null:e})}else this._value=null;this._picker.bsValue=this._value},e.prototype.setDisabledState=function(e){this._picker.isDisabled=e,e?this._renderer.setAttribute(this._elRef.nativeElement,"disabled","disabled"):this._renderer.removeAttribute(this._elRef.nativeElement,"disabled")},e.prototype.registerOnChange=function(e){this._onChange=e},e.prototype.registerOnTouched=function(e){this._onTouched=e},e.prototype.onBlur=function(){this._onTouched()},e.prototype.hide=function(){this._picker.hide(),this._renderer.selectRootElement(this._elRef.nativeElement).blur()},e.decorators=[{type:t.Directive,args:[{selector:"input[bsDaterangepicker]",host:{"(change)":"onChange($event)","(keyup.esc)":"hide()","(blur)":"onBlur()"},providers:[ie,ae]}]}],e.ctorParameters=function(){return[{type:ne,decorators:[{type:t.Host}]},{type:D},{type:t.Renderer2},{type:t.ElementRef},{type:t.ChangeDetectorRef}]},e}(),re=function(){function e(){}return e.decorators=[{type:t.Component,args:[{selector:"bs-calendar-layout",template:'\n \x3c!-- current date, will be added in nearest releases --\x3e\n <bs-current-date title="hey there" *ngIf="false"></bs-current-date>\n\n \x3c!--navigation--\x3e\n <div class="bs-datepicker-head">\n <ng-content select="bs-datepicker-navigation-view"></ng-content>\n </div>\n\n <div class="bs-datepicker-body">\n <ng-content></ng-content>\n </div>\n\n \x3c!--timepicker--\x3e\n <bs-timepicker *ngIf="false"></bs-timepicker>\n '}]}],e}(),oe=function(){function e(){}return e.decorators=[{type:t.Component,args:[{selector:"bs-current-date",template:'<div class="current-timedate"><span>{{ title }}</span></div>'}]}],e.propDecorators={title:[{type:t.Input}]},e}(),ce=function(){function e(){}return e.decorators=[{type:t.Component,args:[{selector:"bs-custom-date-view",template:'\n <div class="bs-datepicker-predefined-btns">\n <button *ngFor="let range of ranges">{{ range.label }}</button>\n <button *ngIf="isCustomRangeShown">Custom Range</button>\n </div>\n ',changeDetection:t.ChangeDetectionStrategy.OnPush}]}],e.propDecorators={isCustomRangeShown:[{type:t.Input}],ranges:[{type:t.Input}]},e}(),de=function(){function e(e,t,n){this._config=e,this._elRef=t,this._renderer=n}return e.prototype.ngOnInit=function(){var e=this;this.day.isToday&&this._config&&this.