UNPKG

fundamental-ngx

Version:

SAP Fundamentals, implemented in Angular

1 lines 219 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("popper.js"),require("@angular/animations"),require("focus-trap"),require("rxjs/operators"),require("rxjs"),require("@angular/forms"),require("@angular/common"),require("@angular/core")):"function"==typeof define&&define.amd?define("fundamental-ngx",["exports","popper.js","@angular/animations","focus-trap","rxjs/operators","rxjs","@angular/forms","@angular/common","@angular/core"],t):t(e["fundamental-ngx"]={},e.Popper,e.ng.animations,e.focusTrap,e.rxjs.operators,e.rxjs,e.ng.forms,e.ng.common,e.ng.core)}(this,function(e,t,n,i,o,s,a,r,l){"use strict";t=t&&t.hasOwnProperty("default")?t["default"]:t,i=i&&i.hasOwnProperty("default")?i["default"]:i;var d=function(e,t){return(d=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 p(e,t){function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var c=function(){return(c=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,s=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(i=s.next()).done;)a.push(i.value)}catch(r){o={error:r}}finally{try{i&&!i.done&&(n=s["return"])&&n.call(s)}finally{if(o)throw o.error}}return a}function h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e}var f=(y.prototype._addClassToElement=function(e){var t;(t=this._elementRef.nativeElement.classList).add.apply(t,h(e.split(" ")))},y.prototype._addStyleToElement=function(e,t){this._elementRef.nativeElement.style[e]=t},y.prototype.ngOnChanges=function(){for(var e=this._elementRef.nativeElement.classList;0<e.length;)e.remove(e.item(0));this["class"]&&this._addClassToElement(this["class"]),this._setProperties()},y.prototype.ngOnInit=function(){this._setProperties()},y.propDecorators={"class":[{type:l.Input}]},y);function y(e){this._elementRef=e,this._setProperties()}var g,m=(p(b,g=f),b.prototype._setProperties=function(){var t=this;this._addClassToElement("fd-button"),this.compact&&this._addClassToElement("fd-button--compact"),this.glyph&&this._addClassToElement("sap-icon--"+this.glyph),this.fdType&&this._addClassToElement("fd-button--"+this.fdType),this.options&&("string"==typeof this.options?this._addClassToElement("fd-button--"+this.options):Array.isArray(this.options)&&this.options.forEach(function(e){"string"==typeof e&&t._addClassToElement("fd-button--"+e)}))},b.decorators=[{type:l.Directive,args:[{selector:"[fd-button]"}]}],b.ctorParameters=function(){return[{type:l.ElementRef}]},b.propDecorators={compact:[{type:l.Input}],glyph:[{type:l.Input}],fdType:[{type:l.Input}],semantic:[{type:l.Input}],options:[{type:l.Input}],size:[{type:l.Input}]},b);function b(e){var t=g.call(this,e)||this;return t.elementRef=e,t}var v=(C.decorators=[{type:l.NgModule,args:[{imports:[r.CommonModule],exports:[m],declarations:[m]}]}],C);function C(){}var I,w="sap-icon--",D=(p(_,I=f),_.prototype._setProperties=function(){this.glyph&&this._addClassToElement(w+this.glyph),this.size&&this._addClassToElement(w+this.size)},_.decorators=[{type:l.Component,args:[{selector:"fd-icon",template:"",host:{role:"presentation"},encapsulation:l.ViewEncapsulation.None}]}],_.ctorParameters=function(){return[{type:l.ElementRef}]},_.propDecorators={glyph:[{type:l.Input}],size:[{type:l.Input}]},_);function _(e){var t=I.call(this,e)||this;return t.elementRef=e,t.size="",t}var E=(k.decorators=[{type:l.NgModule,args:[{imports:[r.CommonModule],exports:[D],declarations:[D]}]}],k);function k(){}var O=(T.decorators=[{type:l.Directive,args:[{selector:"[fd-action-bar]",host:{"class":"fd-action-bar"}}]}],T);function T(){}var R=(x.decorators=[{type:l.Directive,args:[{selector:"[fd-action-bar-title]",host:{"class":"fd-action-bar__title"}}]}],x);function x(){}var S=(F.decorators=[{type:l.Directive,args:[{selector:"[fd-action-bar-description]"}]}],F);function F(){}var V=(M.decorators=[{type:l.Directive,args:[{selector:"[fd-action-bar-header]",host:{"class":"fd-action-bar__header"}}]}],M);function M(){}var P=(L.decorators=[{type:l.Directive,args:[{selector:"[fd-action-bar-actions]",host:{"class":"fd-action-bar__actions"}}]}],L);function L(){}var A=(H.decorators=[{type:l.Directive,args:[{selector:"[fd-action-bar-back]",host:{"class":"fd-action-bar__back"}}]}],H);function H(){}var N=(B.decorators=[{type:l.Directive,args:[{selector:"[fd-action-bar-mobile]",host:{style:"width: 319px;"}}]}],B);function B(){}var j=($.decorators=[{type:l.NgModule,args:[{declarations:[O,R,S,V,P,A,N],imports:[r.CommonModule,v,E],exports:[O,R,S,V,P,A,N]}]}],$);function $(){}var K=(z.prototype.dismiss=function(e){this._afterDismissed.next(e)},z);function z(){this._afterDismissed=new s.Subject,this.afterDismissed=this._afterDismissed.asObservable()}var G,Y=n.trigger("fadeAlertNgIf",[n.transition(":enter",[n.style({opacity:0}),n.animate("250ms ease-in-out",n.style({opacity:1}))]),n.transition(":leave",[n.style({opacity:1,marginTop:"*",paddingTop:"*",paddingBottom:"*",height:"*",overflow:"hidden"}),n.animate("400ms ease-in-out",n.style({opacity:0,marginTop:0,paddingTop:0,paddingBottom:0,height:0,overflow:"hidden"}))])]),U=n.trigger("alertContainerNgIf",[n.transition(":leave",[n.style({opacity:1}),n.animate("400ms ease-in-out",n.style({opacity:0}))])]),W=0,q=(p(J,G=f),J.prototype.ngOnInit=function(){this.alertRef&&this.open(),this._setProperties()},J.prototype.ngAfterViewInit=function(){this.childComponentType&&(this.childComponentType instanceof l.Type?this.loadFromComponent(this.childComponentType):this.childComponentType instanceof l.TemplateRef?this.loadFromTemplate(this.childComponentType):this.loadFromString(this.childComponentType),this.cdRef.detectChanges())},J.prototype.dismiss=function(e,t){void 0===t&&(t=!1),t&&(this.elRef.nativeElement.classList.add("fd-has-display-none"),this.elRef.nativeElement.classList.remove("fd-has-display-block")),this.alertRef?this.alertRef.dismiss(e):(this.elRef.nativeElement.classList.add("fd-has-display-none"),this.elRef.nativeElement.classList.remove("fd-has-display-block")),this.onDismiss.emit()},J.prototype.open=function(){var t=this;if(!this.alertRef){if("block"===this.elRef.nativeElement.style.display)return;this.elRef.nativeElement.classList.remove("fd-has-display-none"),this.elRef.nativeElement.classList.add("fd-has-display-block")}0<=this.duration&&setTimeout(function(){if(t.mousePersist){var e=function(){!0===t.mouseInAlert?setTimeout(e,500):t.dismiss()};e()}else t.dismiss()},this.duration)},J.prototype.handleAlertMouseEvent=function(e){"mouseenter"===e.type?this.mouseInAlert=!0:"mouseleave"===e.type&&(this.mouseInAlert=!1)},J.prototype._setProperties=function(){this._addClassToElement("fd-alert"),this.type&&this._addClassToElement("fd-alert--"+this.type),this.dismissible&&this._addClassToElement("fd-alert--dismissible")},J.prototype.loadFromTemplate=function(e){var t={$implicit:this.alertRef};this.componentRef=this.containerRef.createEmbeddedView(e,t)},J.prototype.loadFromComponent=function(e){var t=this.componentFactoryResolver.resolveComponentFactory(e);this.containerRef.clear(),this.componentRef=this.containerRef.createComponent(t)},J.prototype.loadFromString=function(e){this.containerRef.clear(),this.message=e},J.decorators=[{type:l.Component,args:[{selector:"fd-alert",template:'<button class="fd-alert__close"\n *ngIf="dismissible"\n (click)="dismiss(undefined, true)"\n [attr.aria-controls]="id"\n [attr.aria-label]="dismissLabel">\n</button>\n<ng-container #container>{{message}}</ng-container>\n<ng-content></ng-content>\n',host:{"[attr.aria-labelledby]":"ariaLabelledBy","[attr.aria-label]":"ariaLabel","[style.width]":"width","[style.min-width]":"minWidth",role:"alert","[attr.id]":"id","[@fadeAlertNgIf]":""},animations:[Y],encapsulation:l.ViewEncapsulation.None,styles:[".fd-alert{display:block}"]}]}],J.ctorParameters=function(){return[{type:l.ElementRef},{type:l.ChangeDetectorRef},{type:l.ComponentFactoryResolver},{type:K,decorators:[{type:l.Optional}]}]},J.propDecorators={containerRef:[{type:l.ViewChild,args:["container",{read:l.ViewContainerRef}]}],dismissible:[{type:l.Input}],type:[{type:l.Input}],id:[{type:l.Input}],duration:[{type:l.Input}],mousePersist:[{type:l.Input}],ariaLabelledBy:[{type:l.Input}],ariaLabel:[{type:l.Input}],dismissLabel:[{type:l.Input}],width:[{type:l.Input}],minWidth:[{type:l.Input}],message:[{type:l.Input}],onDismiss:[{type:l.Output}],handleAlertMouseEvent:[{type:l.HostListener,args:["mouseenter",["$event"]]},{type:l.HostListener,args:["mouseleave",["$event"]]}]},J);function J(e,t,n,i){var o=G.call(this,e)||this;return o.elRef=e,o.cdRef=t,o.componentFactoryResolver=n,o.alertRef=i,o.dismissible=!0,o.id="fd-alert-"+W++,o.duration=1e4,o.mousePersist=!1,o.ariaLabelledBy=null,o.ariaLabel=null,o.dismissLabel="Dismiss",o.onDismiss=new l.EventEmitter,o.mouseInAlert=!1,o}var Q=(X.decorators=[{type:l.Component,args:[{selector:"fd-alert-container",template:"",host:{"[@alertContainerNgIf]":""},animations:[U],encapsulation:l.ViewEncapsulation.None,styles:["\n .fd-alert-container {\n position: fixed;\n display: flex;\n flex-direction: column;\n z-index: 5000;\n align-items: center;\n top: 0;\n right: 50%;\n left: 50%;\n }\n "]}]}],X.propDecorators={fdAlertContainerClass:[{type:l.HostBinding,args:["class.fd-alert-container"]}]},X);function X(){this.fdAlertContainerClass=!0}var Z=function Br(){this.dismissible=!0,this.width="33vw",this.minWidth="300px",this.duration=1e4,this.mousePersist=!1,this.ariaLabelledBy=null,this.ariaLabel=null},ee=(te.prototype.get=function(e,t,n){var i=this._additionalTokens.get(e);return i||this._parentInjector.get(e,t)},te);function te(e,t){this._parentInjector=e,this._additionalTokens=t}var ne=(ie.prototype.hasOpenAlerts=function(){return this.alerts&&0<this.alerts.length},ie.prototype.open=function(e,t){var n=this;void 0===t&&(t=new Z),this.alerts&&0!==this.alerts.length||this.openAlertContainer(),t=Object.assign(new Z,t);var i=new WeakMap,o=new K;o.data=t?t.data:undefined,i.set(K,o);var s=this.componentFactoryResolver.resolveComponentFactory(q).create(new ee(this.injector,i));s.location.nativeElement.style.marginTop="10px",this.appRef.attachView(s.hostView);var a=o.afterDismissed.subscribe(function(){n.destroyAlertComponent(s),a.unsubscribe()}),r=Object.assign({},t);Object.keys(r).forEach(function(e){"data"!==e&&(s.instance[e]=r[e])}),s.instance.childComponentType=e;var l=s.hostView.rootNodes[0];return this.alertContainerRef.location.nativeElement.appendChild(l),this.alerts.push(s),o},ie.prototype.dismissAll=function(){var t=this;this.alerts.forEach(function(e){t.destroyAlertComponent(e)})},ie.prototype.destroyAlertComponent=function(e){this.alerts[this.alerts.indexOf(e)]=null,this.alerts=this.alerts.filter(function(e){return null!==e&&e!==undefined}),this.appRef.detachView(e.hostView),e.destroy(),!this.alertContainerRef||this.alerts&&0!==this.alerts.length||this.destroyAlertContainer()},ie.prototype.openAlertContainer=function(){var e=this.componentFactoryResolver.resolveComponentFactory(Q).create(this.injector);this.appRef.attachView(e.hostView);var t=e.hostView.rootNodes[0];document.body.appendChild(t),this.alertContainerRef=e},ie.prototype.destroyAlertContainer=function(){this.appRef.detachView(this.alertContainerRef.hostView),this.alertContainerRef.destroy(),this.alertContainerRef=undefined},ie.decorators=[{type:l.Injectable}],ie.ctorParameters=function(){return[{type:l.ComponentFactoryResolver},{type:l.ApplicationRef},{type:l.Injector}]},ie);function ie(e,t,n){this.componentFactoryResolver=e,this.appRef=t,this.injector=n,this.alerts=[]}var oe=(se.decorators=[{type:l.NgModule,args:[{declarations:[q,Q],imports:[r.CommonModule,E],exports:[q,Q],entryComponents:[Q,q],providers:[ne]}]}],se);function se(){}var ae,re=(p(le,ae=f),le.prototype._setProperties=function(){this.status&&this._addClassToElement("fd-badge--"+this.status),this.modifier&&this._addClassToElement("fd-badge--"+this.modifier)},le.decorators=[{type:l.Directive,args:[{selector:"[fd-badge]"}]}],le.ctorParameters=function(){return[{type:l.ElementRef}]},le.propDecorators={status:[{type:l.Input}],modifier:[{type:l.Input}],fdBadgeClass:[{type:l.HostBinding,args:["class.fd-badge"]}]},le);function le(e){var t=ae.call(this,e)||this;return t.elementRef=e,t.fdBadgeClass=!0,t}var de,pe=(p(ce,de=f),ce.prototype._setProperties=function(){this._addClassToElement("fd-label"),this.status&&this._addClassToElement("fd-label--"+this.status)},ce.decorators=[{type:l.Directive,args:[{selector:"[fd-label]"}]}],ce.ctorParameters=function(){return[{type:l.ElementRef}]},ce.propDecorators={status:[{type:l.Input}]},ce);function ce(e){var t=de.call(this,e)||this;return t.elementRef=e,t.status="",t}var ue,he=(p(fe,ue=f),fe.prototype._setProperties=function(){this._addClassToElement("fd-status-label"),this.status&&this._addClassToElement("fd-status-label--"+this.status),this.statusIcon&&this._addClassToElement("fd-status-label--"+this.statusIcon),this.icon&&this._addClassToElement("sap-icon--"+this.icon)},fe.decorators=[{type:l.Directive,args:[{selector:"[fd-status-label]"}]}],fe.ctorParameters=function(){return[{type:l.ElementRef}]},fe.propDecorators={status:[{type:l.Input}],statusIcon:[{type:l.Input}],icon:[{type:l.Input}]},fe);function fe(e){var t=ue.call(this,e)||this;return t.elementRef=e,t.status="",t.statusIcon="",t.icon="",t}var ye=(ge.decorators=[{type:l.NgModule,args:[{imports:[r.CommonModule],exports:[re,pe,he],declarations:[re,pe,he]}]}],ge);function ge(){}var me=(be.decorators=[{type:l.Directive,args:[{selector:"fd-breadcrumb",host:{"class":"fd-breadcrumb"}}]}],be);function be(){}var ve=(Ce.decorators=[{type:l.Directive,args:[{selector:"fd-breadcrumb-item",host:{"class":"fd-breadcrumb__item"}}]}],Ce);function Ce(){}var Ie=(we.decorators=[{type:l.Directive,args:[{selector:"[fd-breadcrumb-link]",host:{"class":"fd-breadcrumb__link"}}]}],we);function we(){}var De=(_e.decorators=[{type:l.NgModule,args:[{imports:[r.CommonModule],exports:[me,ve,Ie],declarations:[me,ve,Ie]}]}],_e);function _e(){}var Ee=(ke.decorators=[{type:l.Component,args:[{selector:"fd-button-group",template:"<ng-content></ng-content>\n",host:{role:"group"},encapsulation:l.ViewEncapsulation.None}]}],ke.propDecorators={fdButtonGroupClass:[{type:l.HostBinding,args:["class.fd-button-group"]}]},ke);function ke(){this.fdButtonGroupClass=!0}var Oe,Te=(p(Re,Oe=f),Re.prototype._setProperties=function(){this.size&&this._addClassToElement("fd-button--"+this.size),this.glyph&&this._addClassToElement("sap-icon--"+this.glyph),this.state&&this._addClassToElement("is-"+this.state)},Re.decorators=[{type:l.Directive,args:[{selector:"[fd-button-grouped]"}]}],Re.ctorParameters=function(){return[{type:l.ElementRef}]},Re.propDecorators={size:[{type:l.Input}],glyph:[{type:l.Input}],state:[{type:l.Input}],compact:[{type:l.Input},{type:l.HostBinding,args:["class.fd-button--compact"]}],fdButtonGroupedClass:[{type:l.HostBinding,args:["class.fd-button--grouped"]}]},Re);function Re(e){var t=Oe.call(this,e)||this;return t.elementRef=e,t.compact=!1,t.fdButtonGroupedClass=!0,t}var xe=(Se.decorators=[{type:l.NgModule,args:[{imports:[r.CommonModule],exports:[Ee,Te],declarations:[Ee,Te]}]}],Se);function Se(){}var Fe=(Ve.decorators=[{type:l.Injectable,args:[{providedIn:"root"}]}],Ve.ngInjectableDef=l.defineInjectable({factory:function(){return new Ve},token:Ve,providedIn:"root"}),Ve);function Ve(){this.yearSelectionLabel="Year selection",this.previousYearLabel="Previous year",this.nextYearLabel="Next year",this.monthSelectionLabel="Month selection",this.previousMonthLabel="Previous month",this.nextMonthLabel="Next month"}function Me(e){return new He(e)}var Pe=(Le.decorators=[{type:l.Injectable,args:[{providedIn:"root",useFactory:Me,deps:[l.LOCALE_ID]}]}],Le.ngInjectableDef=l.defineInjectable({factory:function(){return Me(l.inject(l.LOCALE_ID))},token:Le,providedIn:"root"}),Le);function Le(){this.i18nChange=new s.Subject}var Ae,He=(p(Ne,Ae=Pe),Ne.prototype.getDayAriaLabel=function(e){return e.getDate()+" "+this.monthsFull[e.getMonth()]+" "+e.getFullYear()},Ne.prototype.getAllFullMonthNames=function(){return this.monthsFull},Ne.prototype.getAllShortMonthNames=function(){return this.monthsShort},Ne.prototype.getAllShortWeekdays=function(){return this.weekdaysShort},Ne.prototype.checkForFallback=function(){this.weekdaysShort&&0!==this.weekdaysShort.length||(this.weekdaysShort=this.weekdaysFallback),this.monthsShort&&0!==this.monthsShort.length||(this.monthsShort=this.monthsShortFallback),this.monthsFull&&0!==this.monthsFull.length||(this.monthsFull=this.monthsFullFallback)},Ne.decorators=[{type:l.Injectable}],Ne.ctorParameters=function(){return[{type:String,decorators:[{type:l.Optional},{type:l.Inject,args:[l.LOCALE_ID]}]}]},Ne);function Ne(e){var t=Ae.call(this)||this;if(t.locale=e,t.weekdaysFallback=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],t.monthsFullFallback=["January","February","March","April","May","June","July","August","September","October","November","December"],t.monthsShortFallback=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],e){var n=r.getLocaleDayNames(e,r.FormStyle.Standalone,r.TranslationWidth.Short);t.weekdaysShort=n.map(function(e,t){return n[t%7]}),t.monthsShort=r.getLocaleMonthNames(e,r.FormStyle.Standalone,r.TranslationWidth.Abbreviated),t.monthsFull=r.getLocaleMonthNames(e,r.FormStyle.Standalone,r.TranslationWidth.Wide)}return t.checkForFallback(),t}var Be=(Object.defineProperty(je.prototype,"previousLabel",{get:function(){return"year"!==this.activeView?this.calendarI18nLabels.previousMonthLabel:this.calendarI18nLabels.previousYearLabel},enumerable:!0,configurable:!0}),Object.defineProperty(je.prototype,"nextLabel",{get:function(){return this.activeView,this.calendarI18nLabels.nextMonthLabel},enumerable:!0,configurable:!0}),Object.defineProperty(je.prototype,"monthLabel",{get:function(){return this.calendarI18n.getAllFullMonthNames()[this.currentlyDisplayed.month-1]},enumerable:!0,configurable:!0}),je.prototype.isOnMonthView=function(){return"month"===this.activeView},je.prototype.isOnYearView=function(){return"year"===this.activeView},je.prototype.processViewChange=function(e){e===this.activeView?this.activeView="day":this.activeView=e,this.activeViewChange.emit(this.activeView)},je.decorators=[{type:l.Component,args:[{selector:"fd-calendar-header",template:'<header class="fd-calendar__header">\n <div class="fd-calendar__navigation">\n <div class="fd-calendar__action">\n <button class="fd-button--standard fd-button--light fd-button--compact sap-icon--slim-arrow-left"\n [attr.id]="id + \'-left-arrow\'"\n [attr.aria-label]="previousLabel"\n [attr.aria-disabled]="false"\n type="button"\n (click)="previousClicked.emit()">\n </button>\n </div>\n <div class="fd-calendar__action">\n <button class="fd-button--light fd-button--compact"\n [attr.aria-label]="calendarI18nLabels.monthSelectionLabel"\n [attr.aria-selected]="isOnMonthView()"\n (click)="processViewChange(\'month\')"\n type="button">\n {{monthLabel}}\n </button>\n </div>\n <div class="fd-calendar__action">\n <button class="fd-button--light fd-button--compact"\n [attr.aria-label]="calendarI18nLabels.yearSelectionLabel"\n [attr.aria-selected]="isOnYearView()"\n (click)="processViewChange(\'year\')"\n type="button">\n {{currentlyDisplayed.year}}\n </button>\n </div>\n <div class="fd-calendar__action">\n <button class="fd-button--standard fd-button--light fd-button--compact sap-icon--slim-arrow-right"\n [attr.id]="id + \'-right-arrow\'"\n [attr.aria-label]="nextLabel"\n [attr.aria-disabled]="false"\n (click)="nextClicked.emit()"\n type="button">\n </button>\n </div>\n </div>\n</header>\n',encapsulation:l.ViewEncapsulation.None,host:{"[attr.id]":'id + "-header"'},styles:[""]}]}],je.ctorParameters=function(){return[{type:Fe},{type:Pe}]},je.propDecorators={activeView:[{type:l.Input}],currentlyDisplayed:[{type:l.Input}],id:[{type:l.Input}],activeViewChange:[{type:l.Output}],previousClicked:[{type:l.Output}],nextClicked:[{type:l.Output}]},je);function je(e,t){this.calendarI18nLabels=e,this.calendarI18n=t,this.activeViewChange=new l.EventEmitter,this.previousClicked=new l.EventEmitter,this.nextClicked=new l.EventEmitter}var $e=(Ke.getDaysInMonth=function(e,t){var n;return 2===e?(n=t)%4!=0||n%400!=0&&n%100==0?28:29:e%2==0&&e<8||e%2==1&&8<e?30:31},Ke.datesEqual=function(e,t){return!(!e||!t)&&e.toDateString()===t.toDateString()},Ke.prototype.onKeydownHandler=function(e,t){switch(e.code){case"Enter":case"Space":e.preventDefault(),this.onKeySelect.next(t);break;case"ArrowLeft":e.preventDefault(),0===t?(this.onListStartApproach.next(),this.onFocusIdChange.next(11)):this.onFocusIdChange.next(t-1);break;case"ArrowRight":e.preventDefault(),11===t?(this.onListEndApproach.next(),this.onFocusIdChange.next(0)):this.onFocusIdChange.next(t+1);break;case"ArrowUp":e.preventDefault(),t<=3?(this.onListStartApproach.next(),this.onFocusIdChange.next(t+8)):this.onFocusIdChange.next(t-4);break;case"ArrowDown":e.preventDefault(),8<=t?(this.onListEndApproach.next(),this.onFocusIdChange.next(t-8)):this.onFocusIdChange.next(t+4);break;case"Tab":this.focusEscapeFunction&&!e.shiftKey&&(e.preventDefault(),this.focusEscapeFunction())}},Ke);function Ke(){this.onKeySelect=new s.Subject,this.onListEndApproach=new s.Subject,this.onListStartApproach=new s.Subject,this.onFocusIdChange=new s.Subject}var ze=(Ge.getToday=function(){var e=new Date;return new Ge(e.getFullYear(),e.getMonth()+1,e.getDate())},Ge.getModelFromDate=function(e){if(e)return new Ge(e.getFullYear(),e.getMonth()+1,e.getDate())},Ge.prototype.toDateString=function(){return this.year&&this.month&&this.day&&this.isDateValid()?this.toDate().toDateString():""},Ge.prototype.getTimeStamp=function(){return this.year&&this.month&&this.day?this.toDate().getTime():-1},Ge.prototype.getDay=function(){return this.year&&this.month&&this.day?this.toDate().getDay()+1:-1},Ge.prototype.nextDay=function(){var e=$e.getDaysInMonth(this.month,this.year),t=this.day>=e?1:this.day+1,n=1!==t?this.month:11<this.month?1:this.month+1;return new Ge(1!==n?this.year:this.year+1,n,t)},Ge.prototype.previousDay=function(){var e=$e.getDaysInMonth(this.month,this.year),t=1===this.day?e:this.day+1,n=t!==e?this.month:1===this.month?12:this.month-1;return new Ge(12!==n?this.year:this.year-1,n,t)},Ge.prototype.toDate=function(){return new Date(this.year,this.month-1,this.day)},Ge.prototype.isDateValid=function(){return!(!this||!(this.year&&this.month&&this.day)||this.year<=0||this.month<1||12<this.month||this.day<1||this.day>$e.getDaysInMonth(this.month,this.year))},Ge);function Ge(e,t,n){this.year=e,this.month=t,this.day=n}var Ye=(Ue.prototype.selectDate=function(e,t){t&&(t.stopPropagation(),t.preventDefault(),this.newFocusedDayId=e.id,this.focusElement(this.newFocusedDayId)),e.blocked||e.disabled||("single"===this.calType?(this.selectedDate=e.date,this.selectedDateChange.emit(e.date),this.buildDayViewGrid()):0===this.selectCounter||2===this.selectCounter?(this.selectedRangeDate={start:e.date,end:null},this.selectedRangeDateChange.emit(this.selectedRangeDate),this.buildDayViewGrid()):1===this.selectCounter&&(this.selectedRangeDate.start.getTimeStamp()<e.date.getTimeStamp()?this.selectedRangeDate={start:this.selectedRangeDate.start,end:e.date}:this.selectedRangeDate={start:e.date,end:null},this.selectedRangeDateChange.emit(this.selectedRangeDate),this.buildDayViewGrid()))},Ue.prototype.ngOnInit=function(){var e=this;this.buildDayViewGrid(),this.shortWeekDays=this.getShortWeekDays(),this.calendarI18n.i18nChange.pipe(o.takeUntil(this.onDestroy$)).subscribe(function(){return e.shortWeekDays=e.getShortWeekDays()})},Object.defineProperty(Ue.prototype,"selectCounter",{get:function(){return this.selectedRangeDate&&this.selectedRangeDate.start?!this.selectedRangeDate.start||this.selectedRangeDate.end&&!$e.datesEqual(this.selectedRangeDate.start,this.selectedRangeDate.end)?this.selectedRangeDate.start&&this.selectedRangeDate.end?2:void 0:1:0},enumerable:!0,configurable:!0}),Ue.prototype.onKeydownDayHandler=function(e,t,n){if("Tab"!==e.code||e.shiftKey)switch(e.code){case"Space":case"Enter":e.preventDefault(),this.selectDate(t),this.newFocusedDayId=t.id;break;case"ArrowUp":e.preventDefault(),0<n.y?this.newFocusedDayId=this.dayViewGrid[n.y-1][n.x].id:(this.selectPreviousMonth(),this.newFocusedDayId=this.dayViewGrid[this.dayViewGrid.length-1][n.x].id);break;case"ArrowDown":e.preventDefault(),n.y<this.dayViewGrid.length-1?this.newFocusedDayId=this.dayViewGrid[n.y+1][n.x].id:(this.selectNextMonth(),this.newFocusedDayId=this.dayViewGrid[0][n.x].id);break;case"ArrowLeft":e.preventDefault(),0<n.x?this.newFocusedDayId=this.dayViewGrid[n.y][n.x-1].id:0<n.y?this.newFocusedDayId=this.dayViewGrid[n.y-1][this.dayViewGrid[0].length-1].id:(this.selectPreviousMonth(),this.newFocusedDayId=this.dayViewGrid[this.dayViewGrid.length-1][this.dayViewGrid[0].length-1].id);break;case"ArrowRight":e.preventDefault(),n.x<this.dayViewGrid[0].length-1?this.newFocusedDayId=this.dayViewGrid[n.y][n.x+1].id:n.y<this.dayViewGrid.length-1?this.newFocusedDayId=this.dayViewGrid[n.y+1][0].id:(this.selectNextMonth(),this.newFocusedDayId=this.dayViewGrid[0][0].id)}else this.focusEscapeFunction&&(e.preventDefault(),this.focusEscapeFunction());this.newFocusedDayId&&this.focusElement(this.newFocusedDayId)},Ue.prototype.ngOnChanges=function(){this.buildDayViewGrid()},Ue.prototype.ngAfterViewChecked=function(){this.newFocusedDayId&&(this.focusElement(this.newFocusedDayId),this.newFocusedDayId=null)},Ue.prototype.focusElement=function(e){var t=this.eRef.nativeElement.querySelector("#"+e);t&&t.focus()},Ue.prototype.focusActiveDay=function(){this.newFocusedDayId=this.getActiveCell(this.calendarDayList.filter(function(e){return"current"===e.monthStatus})).id},Object.defineProperty(Ue.prototype,"calendarDayList",{get:function(){return this.dayViewGrid.reduce(function(e,t){return t=t||[],e.concat(t)})},enumerable:!0,configurable:!0}),Ue.prototype.selectPreviousMonth=function(){1<this.currentlyDisplayed.month?this.currentlyDisplayed=c({},this.currentlyDisplayed,{month:this.currentlyDisplayed.month-1}):this.currentlyDisplayed={year:this.currentlyDisplayed.year-1,month:12},this.buildDayViewGrid(),this.previousMonthSelect.emit()},Ue.prototype.selectNextMonth=function(){1<this.currentlyDisplayed.month?this.currentlyDisplayed=c({},this.currentlyDisplayed,{month:this.currentlyDisplayed.month+1}):this.currentlyDisplayed={year:this.currentlyDisplayed.year+1,month:1},this.buildDayViewGrid(),this.nextMonthSelect.emit()},Ue.prototype.populateCalendar=function(){var n=this,e=[];return e=(e=this.getPreviousMonthDays(e)).concat(this.getCurrentMonthDays()),(e=this.getNextMonthDays(e)).forEach(function(e,t){return e.id=n.id+"-fd-day-"+(Math.floor(t/7)+1)+t%7}),e},Ue.prototype.buildDayViewGrid=function(){this.currentlyDisplayed||(this.selectedDate?this.currentlyDisplayed={month:this.selectedDate.month,year:this.selectedDate.year}:this.currentlyDisplayed={month:ze.getToday().month,year:ze.getToday().year});for(var e=this.populateCalendar(),t=[];0<e.length;)t.push(e.splice(0,7));this.dayViewGrid=t},Ue.prototype.getCurrentMonthDays=function(){for(var e=this.currentlyDisplayed.month,t=this.currentlyDisplayed.year,n=[],i=$e.getDaysInMonth(e,t),o=1;o<=i;o++){var s=new ze(t,e,o);n.push(c({},this.getDay(s),{monthStatus:"current",today:$e.datesEqual(ze.getToday(),s)}))}return this.getActiveCell(n).isTabIndexed=!0,n},Ue.prototype.getActiveCell=function(e){return e.find(function(e){return e.selected})?e.find(function(e){return e.selected}):e.find(function(e){return e.today})?e.find(function(e){return e.today}):e[0]},Ue.prototype.getPreviousMonthDays=function(e){var t=1<this.currentlyDisplayed.month?this.currentlyDisplayed.month-1:12,n=1<this.currentlyDisplayed.month?this.currentlyDisplayed.year:this.currentlyDisplayed.year-1,i=$e.getDaysInMonth(t,n),o=i,s=new ze(n,t,i).getDay()-this.startingDayOfWeek;if(s<0&&(s+=7),s<6)for(;0<=s;){var a=new ze(n,t,o-s);e.push(c({},this.getDay(a),{monthStatus:"previous"})),s--}return e},Ue.prototype.getNextMonthDays=function(e){for(var t=this.currentlyDisplayed.month<12?this.currentlyDisplayed.month+1:1,n=this.currentlyDisplayed.month<12?this.currentlyDisplayed.year:this.currentlyDisplayed.year+1,i=42-e.length,o=1;o<=i;o++){var s=new ze(n,t,o);e.push(c({},this.getDay(s),{monthStatus:"next"}))}return e},Ue.prototype.getDay=function(e){var t={date:e,weekDay:e.getDay(),disabled:this.disableFunction(e),blocked:this.blockFunction(e),selected:"single"===this.calType&&$e.datesEqual(e,this.selectedDate)||this.selectedRangeDate&&$e.datesEqual(e,this.selectedRangeDate.start)||this.selectedRangeDate&&$e.datesEqual(e,this.selectedRangeDate.end),selectedFirst:this.selectedRangeDate&&$e.datesEqual(e,this.selectedRangeDate.start),selectedLast:this.selectedRangeDate&&$e.datesEqual(e,this.selectedRangeDate.end),selectedRange:this.selectedRangeDate&&this.selectedRangeDate.start&&this.selectedRangeDate.start.getTimeStamp()<e.getTimeStamp()&&this.selectedRangeDate.end&&this.selectedRangeDate.end.getTimeStamp()>e.getTimeStamp(),ariaLabel:this.calendarI18n.getDayAriaLabel(e.toDate())};return"range"!==this.calType||0!==this.selectCounter&&2!==this.selectCounter?1===this.selectCounter&&(this.disableRangeEndFunction&&!t.disabled&&(t.disabled=this.disableRangeEndFunction(t.date)),this.blockRangeEndFunction&&!t.blocked&&(t.blocked=this.blockRangeEndFunction(t.date))):(this.disableRangeStartFunction&&!t.disabled&&(t.disabled=this.disableRangeStartFunction(t.date)),this.blockRangeStartFunction&&!t.blocked&&(t.blocked=this.blockRangeStartFunction(t.date))),t},Ue.prototype.getShortWeekDays=function(){return this.calendarI18n.getAllShortWeekdays().slice(this.startingDayOfWeek-1).concat(this.calendarI18n.getAllShortWeekdays().slice(0,this.startingDayOfWeek-1)).map(function(e){return e[0].toLocaleUpperCase()})},Ue.decorators=[{type:l.Component,args:[{selector:"fd-calendar-day-view",template:'<table class="fd-calendar__table" role="grid">\n <thead class="fd-calendar__group">\n <tr class="fd-calendar__row">\n <th class="fd-calendar__column-header" *ngFor="let day of shortWeekDays">\n <span class="fd-calendar__day-of-week">{{day}}</span>\n </th>\n </tr>\n </thead>\n <tbody class="fd-calendar__group">\n <tr class="fd-calendar__row"\n *ngFor="let row of dayViewGrid; let rowIndex = index;">\n\n <td class="fd-calendar__item"\n role="gridcell"\n [attr.aria-label]="cell.ariaLabel"\n *ngFor="let cell of row; let cellIndex = index;"\n [ngClass]="{\n \'fd-calendar__item--other-month\': cell.monthStatus !== \'current\',\n \'is-selected\': cell.selected,\n \'is-selected-range-last\': cell.selectedLast && !cell.selectedFirst,\n \'is-selected-range-first\': cell.selectedFirst,\n \'is-selected-range\': cell.selectedRange && !cell.selectedFirst && !cell.selectedLast,\n \'fd-calendar__item--current\': cell.today,\n \'is-disabled\': cell.disabled,\n \'is-blocked\': cell.blocked\n }"\n [attr.id]="cell.id"\n [attr.tabindex]="cell.isTabIndexed ? 0 : -1"\n (click)="selectDate(cell, $event)"\n (keydown)="onKeydownDayHandler($event, cell, { x: cellIndex, y: rowIndex })"\n >\n <span class="fd-calendar__text" role="button">{{cell.date.day}}</span>\n </td>\n </tr>\n </tbody>\n</table>\n',encapsulation:l.ViewEncapsulation.None,host:{"[attr.id]":'id + "-day-view"'},styles:[""]}]}],Ue.ctorParameters=function(){return[{type:Pe},{type:l.ElementRef}]},Ue.propDecorators={fdCalendarDateViewClass:[{type:l.HostBinding,args:["class.fd-calendar__dates"]}],currentlyDisplayed:[{type:l.Input}],selectedDate:[{type:l.Input}],selectedRangeDate:[{type:l.Input}],startingDayOfWeek:[{type:l.Input}],calType:[{type:l.Input}],id:[{type:l.Input}],focusEscapeFunction:[{type:l.Input}],selectedRangeDateChange:[{type:l.Output}],nextMonthSelect:[{type:l.Output}],previousMonthSelect:[{type:l.Output}],selectedDateChange:[{type:l.Output}],disableFunction:[{type:l.Input}],disableRangeStartFunction:[{type:l.Input}],disableRangeEndFunction:[{type:l.Input}],blockRangeStartFunction:[{type:l.Input}],blockRangeEndFunction:[{type:l.Input}],blockFunction:[{type:l.Input}]},Ue);function Ue(e,t){this.calendarI18n=e,this.eRef=t,this.newFocusedDayId="",this.onDestroy$=new s.Subject,this.fdCalendarDateViewClass=!0,this.calType="single",this.selectedRangeDateChange=new l.EventEmitter,this.nextMonthSelect=new l.EventEmitter,this.previousMonthSelect=new l.EventEmitter,this.selectedDateChange=new l.EventEmitter,this.disableFunction=function(e){return!1},this.disableRangeStartFunction=function(e){return!1},this.disableRangeEndFunction=function(e){return!1},this.blockRangeStartFunction=function(e){return!1},this.blockRangeEndFunction=function(e){return!1},this.blockFunction=function(e){return!1}}var We=(qe.prototype.ngOnInit=function(){var t=this;this.monthNames=this.calendarI18n.getAllShortMonthNames(),this.calendarI18n.i18nChange.pipe(o.takeUntil(this.onDestroy$)).subscribe(function(){t.monthNames=t.calendarI18n.getAllShortMonthNames(),t.cdRef.detectChanges()}),this.calendarService.focusEscapeFunction=this.focusEscapeFunction,this.calendarService.onFocusIdChange.pipe(o.takeUntil(this.onDestroy$)).subscribe(function(e){return t.focusElement("#"+t.id+"-fd-month-"+e)}),this.calendarService.onKeySelect.pipe(o.takeUntil(this.onDestroy$)).subscribe(function(e){return t.selectMonth(e)})},qe.prototype.ngOnDestroy=function(){this.onDestroy$.next(),this.onDestroy$.complete()},Object.defineProperty(qe.prototype,"currentMonth",{get:function(){return ze.getToday().month},enumerable:!0,configurable:!0}),Object.defineProperty(qe.prototype,"monthOffset",{get:function(){return this._monthOffset},enumerable:!0,configurable:!0}),qe.prototype.selectMonth=function(e,t){t&&t.stopPropagation(),this.monthSelected=e+this.monthOffset,this.monthClicked.emit(this.monthSelected)},qe.prototype.onKeydownMonthHandler=function(e,t){this.calendarService.onKeydownHandler(e,t)},qe.prototype.focusElement=function(e){var t=this.eRef.nativeElement.querySelector(e);t&&t.focus()},qe.decorators=[{type:l.Component,args:[{selector:"fd-calendar-month-view",template:'<div class="fd-calendar__months">\n <ul class="fd-calendar__list">\n <li class="fd-calendar__item"\n *ngFor="let month of monthNames; let i = index"\n [ngClass]="{\n \'fd-calendar__item--current\': i + monthOffset === currentMonth,\n \'is-selected\': i + monthOffset === monthSelected\n }"\n [attr.tabIndex]="i + monthOffset === monthSelected ? 0 : -1"\n [attr.id]="id + \'-fd-month-\' + i"\n (keydown)="onKeydownMonthHandler($event, i)"\n (click)="selectMonth(i, $event)">\n <span role="button" class="fd-calendar__text">\n {{ month }}\n </span>\n </li>\n </ul>\n</div>\n',encapsulation:l.ViewEncapsulation.None,host:{"[attr.id]":'id + "-month-view"'},styles:[""]}]}],qe.ctorParameters=function(){return[{type:l.ElementRef},{type:l.ChangeDetectorRef},{type:Pe},{type:$e}]},qe.propDecorators={id:[{type:l.Input}],monthSelected:[{type:l.Input}],focusEscapeFunction:[{type:l.Input}],monthClicked:[{type:l.Output}]},qe);function qe(e,t,n,i){this.eRef=e,this.cdRef=t,this.calendarI18n=n,this.calendarService=i,this._monthOffset=1,this.onDestroy$=new s.Subject,this.monthClicked=new l.EventEmitter}var Je=(Qe.prototype.ngAfterViewChecked=function(){this.newFocusedYearId&&(this.focusElement(this.newFocusedYearId),this.newFocusedYearId=null)},Qe.prototype.ngOnInit=function(){var t=this;this.firstYearInList=this.yearSelected,this.constructYearList(),this.calendarService.onFocusIdChange.pipe(o.takeUntil(this.onDestroy$)).subscribe(function(e){t.newFocusedYearId=t.id+"-fd-year-"+e,t.focusElement(t.newFocusedYearId)}),this.calendarService.focusEscapeFunction=this.focusEscapeFunction,this.calendarService.onKeySelect.pipe(o.takeUntil(this.onDestroy$)).subscribe(function(e){return t.selectYear(t.calendarYearList[e])}),this.calendarService.onListStartApproach.pipe(o.takeUntil(this.onDestroy$)).subscribe(function(){return t.loadPreviousYearList()}),this.calendarService.onListEndApproach.pipe(o.takeUntil(this.onDestroy$)).subscribe(function(){return t.loadNextYearList()})},Qe.prototype.ngOnDestroy=function(){this.onDestroy$.next(),this.onDestroy$.complete()},Qe.prototype.getActiveYear=function(){var t=this,e=this.calendarYearList.find(function(e){return e===t.yearSelected});if(e)return e;var n=this.calendarYearList.find(function(e){return e===t.currentYear});return n||this.calendarYearList[0]},Qe.prototype.onKeydownYearHandler=function(e,t){this.calendarService.onKeydownHandler(e,t)},Qe.prototype.loadNextYearList=function(){this.firstYearInList+=12,this.constructYearList()},Qe.prototype.loadPreviousYearList=function(){this.firstYearInList-=12,this.constructYearList()},Qe.prototype.focusElement=function(e){this.eRef.nativeElement.querySelector("#"+e)&&this.eRef.nativeElement.querySelector("#"+e).focus()},Qe.prototype.selectYear=function(e,t){t&&t.stopPropagation(),this.yearSelected=e,this.yearClicked.emit(this.yearSelected)},Qe.prototype.constructYearList=function(){this.calendarYearList=[];for(var e=0;e<12;++e)this.calendarYearList.push(this.firstYearInList+e);this.activeYear=this.getActiveYear()},Qe.decorators=[{type:l.Component,args:[{selector:"fd-calendar-year-view",template:'<div class="fd-calendar__years">\n <ul class="fd-calendar__list">\n <li class="fd-calendar__item"\n *ngFor="let year of calendarYearList; let i = index"\n [ngClass]="{\n \'is-selected\': (year == yearSelected),\n \'fd-calendar__item--current\': (year == currentYear)\n }"\n [attr.id]="id + \'-fd-year-\' + i"\n [attr.tabindex]="year === activeYear ? 0 : -1"\n (keydown)="onKeydownYearHandler($event, i)"\n (click)="selectYear(year, $event)">\n <span role="button" class="fd-calendar__text">\n {{ year }}\n </span>\n </li>\n </ul>\n</div>\n',encapsulation:l.ViewEncapsulation.None,host:{"[attr.id]":'id + "-year-view"'},styles:[""]}]}],Qe.ctorParameters=function(){return[{type:l.ElementRef},{type:$e}]},Qe.propDecorators={id:[{type:l.Input}],focusEscapeFunction:[{type:l.Input}],yearSelected:[{type:l.Input}],yearClicked:[{type:l.Output}]},Qe);function Qe(e,t){this.eRef=e,this.calendarService=t,this.currentYear=ze.getToday().year,this.firstYearInList=this.currentYear,this.onDestroy$=new s.Subject,this.yearClicked=new l.EventEmitter}var Xe=0,Ze=(et.prototype.ngOnInit=function(){this.prepareDisplayedView()},et.prototype.writeValue=function(e){var t=!0;e&&("single"===this.calType?(t=(e=e).isDateValid(),(this.selectedDate=e).isDateValid()&&this.prepareDisplayedView()):"range"===this.calType&&((e=e).start&&e.end||(t=!1),e.start&&!e.start.isDateValid()&&(t=!1),e.end&&!e.end.isDateValid()&&(t=!1),this.selectedRangeDate={start:e.start,end:e.end},t&&this.prepareDisplayedView())),this.isValidDateChange.emit(t)},et.prototype.validate=function(e){return this.isModelValid()?null:{dateValidation:{valid:!1}}},et.prototype.registerOnChange=function(e){this.onChange=e},et.prototype.registerOnTouched=function(e){this.onTouched=e},et.prototype.setDisabledState=function(e){},et.prototype.handleActiveViewChange=function(e){this.activeView=e,this.activeViewChange.emit(e)},et.prototype.selectedDateChanged=function(e){this.selectedDate=e,this.onChange(e),this.onTouched(),this.selectedDateChange.emit(e),this.closeCalendar.emit()},et.prototype.selectedRangeDateChanged=function(e){e&&(this.selectedRangeDate={start:e.start,end:e.end?e.end:e.start},this.selectedRangeDateChange.emit(this.selectedRangeDate),this.onChange(this.selectedRangeDate),this.onTouched(),this.closeCalendar.emit())},et.prototype.handleNextArrowClick=function(){switch(this.activeView){case"day":this.displayNextMonth();break;case"month":this.displayNextYear();break;case"year":this.displayNextYearList()}this.onTouched()},et.prototype.handlePreviousArrowClick=function(){switch(this.activeView){case"day":this.displayPreviousMonth();break;case"month":this.displayPreviousYear();break;case"year":this.displayPreviousYearList()}this.onTouched()},et.prototype.displayNextMonth=function(){12===this.currentlyDisplayed.month?this.currentlyDisplayed={year:this.currentlyDisplayed.year+1,month:1}:this.currentlyDisplayed={year:this.currentlyDisplayed.year,month:this.currentlyDisplayed.month+1}},et.prototype.displayPreviousMonth=function(){this.currentlyDisplayed.month<=1?this.currentlyDisplayed={year:this.currentlyDisplayed.year-1,month:12}:this.currentlyDisplayed={year:this.currentlyDisplayed.year,month:this.currentlyDisplayed.month-1}},et.prototype.displayNextYear=function(){this.currentlyDisplayed={month:this.currentlyDisplayed.month,year:this.currentlyDisplayed.year+1}},et.prototype.displayPreviousYear=function(){this.currentlyDisplayed={month:this.currentlyDisplayed.month,year:this.currentlyDisplayed.year-1}},et.prototype.displayNextYearList=function(){this.yearViewComponent.loadNextYearList()},et.prototype.displayPreviousYearList=function(){this.yearViewComponent.loadPreviousYearList()},et.prototype.setCurrentlyDisplayed=function(e){this.currentlyDisplayed={month:e.month,year:e.year}},et.prototype.handleMonthViewChange=function(e){this.currentlyDisplayed={month:e,year:this.currentlyDisplayed.year},this.activeView="day",this.activeViewChange.emit(this.activeView),this.changeDetectorRef.detectChanges(),this.dayViewComponent.focusActiveDay()},et.prototype.selectedYear=function(e){this.activeView="day",this.currentlyDisplayed.year=e,this.changeDetectorRef.detectChanges(),this.dayViewComponent.focusActiveDay()},et.prototype.isModelValid=function(){return"single"===this.calType?this.selectedDate&&this.selectedDate instanceof ze&&this.selectedDate.isDateValid():this.selectedRangeDate&&this.selectedRangeDate.start&&this.selectedRangeDate.start instanceof ze&&this.selectedRangeDate.start.isDateValid()&&this.selectedRangeDate.end&&this.selectedRangeDate.end instanceof ze&&this.selectedRangeDate.start.isDateValid()},et.prototype.prepareDisplayedView=function(){if("single"===this.calType&&this.selectedDate&&this.selectedDate.month&&this.selectedDate.year)this.currentlyDisplayed={month:this.selectedDate.month,year:this.selectedDate.year};else if(this.selectedRangeDate&&this.selectedRangeDate.start)this.currentlyDisplayed={month:this.selectedRangeDate.start.month,year:this.selectedRangeDate.start.year};else if(this.selectedRangeDate&&this.selectedRangeDate.end)this.currentlyDisplayed={month:this.selectedRangeDate.end.month,year:this.selectedRangeDate.end.year};else{var e=ze.getToday();this.currentlyDisplayed={month:e.month,year:e.year}}},et.decorators=[{type:l.Component,args:[{selector:"fd-calendar",template:'<fd-calendar-header [currentlyDisplayed]="currentlyDisplayed"\n [activeView]="activeView"\n (activeViewChange)="handleActiveViewChange($event)"\n [id]="id"\n (nextClicked)="handleNextArrowClick()"\n (previousClicked)="handlePreviousArrowClick()"\n></fd-calendar-header>\n<ng-container [ngSwitch]="activeView">\n <div class="fd-calendar__content">\n <fd-calendar-day-view *ngSwitchCase="\'day\'"\n [selectedDate]="selectedDate"\n (selectedDateChange)="selectedDateChanged($event)"\n [selectedRangeDate]="selectedRangeDate"\n (selectedRangeDateChange)="selectedRangeDateChanged($event)"\n [currentlyDisplayed]="currentlyDisplayed"\n [startingDayOfWeek]="startingDayOfWeek"\n [blockFunction]="blockFunction"\n [disableFunction]="disableFunction"\n [disableRangeEndFunction]="disableRangeEndFunction"\n [blockRangeEndFunction]="blockRangeEndFunction"\n [disableRangeStartFunction]="disableRangeStartFunction"\n [blockRangeStartFunction]="blockRangeStartFunction"\n [calType]="calType"\n [id]="id"\n [focusEscapeFunction]="escapeFocusFunction"\n (nextMonthSelect)="displayNextMonth()"\n (previousMonthSelect)="displayPreviousMonth()"\n ></fd-calendar-day-view>\n <fd-calendar-month-view *ngSwitchCase="\'month\'"\n [monthSelected]="currentlyDisplayed?.month"\n [id]="id"\n [focusEscapeFunction]="escapeFocusFunction"\n (monthClicked)="handleMonthViewChange($event)"\n ></fd-calendar-month-view>\n <fd-calendar-year-view *ngSwitchCase="\'year\'"\n (yearClicked)="selectedYear($event)"\n [yearSelected]="currentlyDisplayed.year"\n [id]="id"\n [focusEscapeFunction]="escapeFocusFunction">\n </fd-calendar-year-view>\n </div>\n</ng-container>\n\n',encapsulation:l.ViewEncapsulation.None,providers:[{provide:a.NG_VALUE_ACCESSOR,useExisting:l.forwardRef(function(){return et}),multi:!0},{provide:a.NG_VALIDATORS,useExisting:l.forwardRef(function(){return et}),multi:!0}],host:{"(blur)":"onTouched()","[attr.id]":"id"},styles:[".fd-calendar__content{min-height:276px;background:#fff}.fd-calendar__content li:focus,.fd-calendar__content td:focus{outline:0;box-shadow:inset 0 0 2px 2px var(--fd-color-neutral-3)}.fd-calendar__content li:focus:after,.fd-calendar__content td:focus:after{display:none}"]}]}],et.ctorParameters=function(){return[{type:Pe},{type:l.ChangeDetectorRef}]},et.propDecorators={dayViewComponent:[{type:l.ViewChild,args:[Ye]}],yearViewComponent:[{type:l.ViewChild,args:[Je]}],fdCalendarClass:[{type:l.HostBinding,args:["class.fd-calendar"]}],fdHasDisplayBlockClass:[{type:l.HostBinding,args:["class.fd-has-display-block"]}],selectedDate:[{type:l.Input}],selectedRangeDate:[{type:l.Input}],activeView:[{type:l.Input}],startingDayOfWeek:[{type:l.Input}],calType:[{type:l.Input}],id:[{type:l.Input}],activeViewChange:[{type:l.Output}],selectedDateChange:[{type:l.Output}],selectedRangeDateChange:[{type:l.Output}],isValidDateChange:[{type:l.Output}],closeCalendar:[{type:l.Output}],disableFunction:[{type:l.Input}],disableRangeStartFunction:[{type:l.Input}],disableRangeEndFunction:[{type:l.Input}],blockRangeStartFunction:[{type:l.Input}],blockRangeEndFunction:[{type:l.Input}],blockFunction:[{type:l.Input}],escapeFocusFunction:[{type:l.Input}]},et);function et(e,t){var n=this;this.calendarI18n=e,this.changeDetectorRef=t,this.fdCalendarClass=!0,this.fdHasDisplayBlockClass=!0,this.selectedDate=ze.getToday(),this.activeView="day",this.startingDayOfWeek=1,this.calType="single",this.id="fd-calendar-"+Xe++,this.activeViewChange=new l.EventEmitter,this.selectedDateChange=new l.EventEmitter,this.selectedRangeDateChange=new l.EventEmitter,this.isValidDateChange=new l.EventEmitter,this.closeCalendar=new l.EventEmitter,this.onChange=function(){},this.onTouched=function(){},this.disableFunction=function(e){return!1},this.disableRangeStartFunction=function(e){return!1},this.disableRangeEndFunction=function(e){return!1},this.blockRangeStartFunction=function(e){return!1},this.blockRangeEndFunction=function(e){return!1},this.blockFunction=function(e){return!1},this.escapeFocusFunction=function(){document.getElementById(n.id+"-left-arrow")&&document.getElementById(n.id+"-left-arrow").focus()}}var tt=(nt.decorators=[{type:l.NgModule,args:[{declarations:[Ze,Be,Ye,We,Je],imports:[r.CommonModule,E],exports:[Ze,Ye,Be,Je,We],providers:[$e]}]}],nt);function nt(){}var it=(ot.prototype.ngAfterViewInit=function(){this.content instanceof l.TemplateRef?this.loadFromTemplate(this.content):this.contentString=this.content,this.setupFocusTrap(),this.isSetup.emit(),this.cdRef.detectChanges()},ot.prototype.ngOnDestroy=function(){this.focusTrap&&this.focusTrap.deactivate()},ot.prototype.loadFromTemplate=function(e){this.containerRef.clear();var t={$implicit:this.context};this.componentRef=this.containerRef.createEmbeddedView(e,t)},ot.prototype.setupFocusTrap=function(){if(this.focusTrapped)try{this.focusTrap=i(this.elRef.nativeElement,{clickOutsideDeactivates:!0,escapeDeactivates:!1,initialFocus:this.elRef