@progress/kendo-dateinputs-common 0.4.3-develop.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cdn/main.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@progress/kendo-date-math"),require("tslib")):"function"==typeof define&&define.amd?define([,],e):"object"==typeof exports?exports.KendoDateinputsCommon=e(require("@progress/kendo-date-math"),require("tslib")):t.KendoDateinputsCommon=e(t.KendoDateMath,t.self)}(self,((t,e)=>(()=>{"use strict";var i={761:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Constants=void 0,e.Constants={formatSeparator:"_",twoDigitYearMax:68,defaultDateFormat:"d",defaultLocaleId:"en"}},953:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DateObject=void 0;var n=i(231),a=i(930),s=i(506),r=i(849),o=i(761),l=/d|M|H|h|m|s/,h=function(){function t(t){var e=t.intlService,i=t.formatPlaceholder,a=t.format,s=t.cycleTime,r=void 0!==s&&s,l=t.twoDigitYearMax,h=void 0===l?o.Constants.twoDigitYearMax:l,u=t.value,c=void 0===u?null:u,d=t.autoCorrectParts,p=void 0===d||d,m=t.toggleDayPeriod,v=void 0!==m&&m;if(this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.dayperiod=!0,this.leadingZero=null,this.typedMonthPart="",this.knownParts="adHhmMsEyS",this.symbols={E:"E",H:"H",M:"M",a:"a",d:"d",h:"h",m:"m",s:"s",y:"y",S:"S"},this._value=this.getDefaultDate(),this.cycleTime=!1,this._partiallyInvalidDate={startDate:null,invalidDateParts:{E:{value:null,date:null,startDateOffset:0},H:{value:null,date:null,startDateOffset:0},M:{value:null,date:null,startDateOffset:0},a:{value:null,date:null,startDateOffset:0},d:{value:null,date:null,startDateOffset:0},h:{value:null,date:null,startDateOffset:0},m:{value:null,date:null,startDateOffset:0},s:{value:null,date:null,startDateOffset:0},y:{value:null,date:null,startDateOffset:0},S:{value:null,date:null,startDateOffset:0}}},this.setOptions({intlService:e,formatPlaceholder:i,format:a,cycleTime:r,twoDigitYearMax:h,value:c,autoCorrectParts:p,toggleDayPeriod:v}),c)this._value=(0,n.cloneDate)(c);else{this._value=this.getDefaultDate();for(var g=this.dateFormatString(this.value,this.format).symbols,f=0;f<g.length;f++)this.setExisting(g[f],!1)}}return Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){(!t||t instanceof Date)&&(this._value=t,this.resetInvalidDate())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localeId",{get:function(){for(var t=o.Constants.defaultLocaleId,e=Object.keys(this.intl.cldr),i=0;i<e.length;i++){var n=e[i],a=this.intl.cldr[n];if(a.name&&a.calendar&&a.numbers&&a.name!==o.Constants.defaultLocaleId){t=a.name;break}}return t},enumerable:!1,configurable:!0}),t.prototype.setOptions=function(t){this.intl=t.intlService,this.formatPlaceholder=t.formatPlaceholder||"wide",this.format=t.format,this.cycleTime=t.cycleTime,this.monthNames=this.allFormattedMonths(this.localeId),this.dayPeriods=this.allDayPeriods(this.localeId),this.twoDigitYearMax=t.twoDigitYearMax,this.autoCorrectParts=t.autoCorrectParts,this.toggleDayPeriod=t.toggleDayPeriod},t.prototype.setValue=function(t){t?(0,n.isEqual)(t,this._value)||(this._value=(0,n.cloneDate)(t),this.modifyExisting(!0)):(this._value=this.getDefaultDate(),this.modifyExisting(!1)),this.resetInvalidDate()},t.prototype.hasValue=function(){var t=this;return this.intl.splitDateFormat(this.format,this.localeId).reduce((function(e,i){return e||"literal"!==i.type&&"dayperiod"!==i.type&&t.getExisting(i.pattern[0])}),!1)},t.prototype.getValue=function(){for(var t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return(0,n.cloneDate)(this.value)},t.prototype.createDefaultDate=function(){return(0,n.createDate)(2e3,0,31)},t.prototype.getDefaultDate=function(){return(0,n.getDate)(this.createDefaultDate())},t.prototype.getFormattedDate=function(t){return this.intl.formatDate(this.getValue(),t,this.localeId)},t.prototype.getTextAndFormat=function(t){void 0===t&&(t="");var e=t||this.format,i=this.intl.formatDate(this.value,e,this.localeId),n=this.dateFormatString(this.value,e);if(!this.autoCorrectParts&&this._partiallyInvalidDate.startDate){for(var a="",o=this.intl.formatDate(this.value,e,this.localeId),l=this.getFormattedInvalidDates(e),h=0;h<o.length;h++){var u=n.symbols[h];if("literal"===n.partMap[h].type)a+=i[h];else if(this.getInvalidDatePartValue(u)){var c=this.getPartsForSegment(n,h);if("M"===u){var d=((0,r.parseToInt)(this.getInvalidDatePartValue(u))+1).toString();c.length>2?a+=l[u][h]:this.getInvalidDatePartValue(u)?(a+=(0,s.padZero)(c.length-d.length)+d,h+=c.length-1):a+=l[u][h]}else this.getInvalidDatePartValue(u)?(d=this.getInvalidDatePartValue(u).toString(),a+=(0,s.padZero)(c.length-d.length)+d,h+=c.length-1):a+=l[u][h]}else a+=i[h]}i=a}return this.merge(i,n)},t.prototype.getFormattedInvalidDates=function(t){var e=this;void 0===t&&(t="");var i=t||this.format,n={E:"",H:"",M:"",a:"",d:"",h:"",m:"",s:"",y:"",S:""};return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(t){var a=e.getInvalidDatePart(t).date;if(a){var s=e.intl.formatDate(a,i,e.localeId);n[t]=s}})),n},t.prototype.modifyExisting=function(t){for(var e=this.dateFormatString(this.value,this.format).symbols,i=0;i<e.length;i++)this.setExisting(e[i],t)},t.prototype.getExisting=function(t){switch(t){case"y":return this.year;case"M":case"L":return this.month;case"d":return this.date;case"E":return this.date&&this.month&&this.year;case"h":case"H":return this.hours;case"t":case"a":return this.dayperiod;case"m":return this.minutes;case"s":return this.seconds;case"S":return this.milliseconds;default:return!0}},t.prototype.setExisting=function(t,e){switch(t){case"y":this.year=e,!1===e&&this._value.setFullYear(2e3);break;case"M":this.month=e,!1===e&&this.autoCorrectParts&&this._value.setMonth(0);break;case"d":this.date=e;break;case"h":case"H":this.hours=e;break;case"t":case"a":this.dayperiod=e;break;case"m":this.minutes=e;break;case"s":this.seconds=e;break;case"S":this.milliseconds=e}this.getValue()&&this.resetInvalidDate()},t.prototype.modifyPart=function(t,e){if((0,r.isPresent)(t)&&(0,r.isPresent)(e)&&0!==e){var i,a=(0,n.cloneDate)(this.value),s=!1,o="M"===t,l="d"===t||"E"===t,h=this.getExisting(t);if(this.autoCorrectParts||!l&&!o){var u=a.getHours();switch(t){case"y":a.setFullYear(a.getFullYear()+e);break;case"M":a=(0,n.addMonths)(this.value,e);break;case"d":case"E":a.setDate(a.getDate()+e);break;case"h":case"H":a.setHours(a.getHours()+e),s=!0;break;case"m":a.setMinutes(a.getMinutes()+e),s=!0;break;case"s":a.setSeconds(a.getSeconds()+e),s=!0;break;case"S":a.setMilliseconds(a.getMilliseconds()+e);break;case"a":this.toggleDayPeriod?a.setHours(u>=12?u-12:u+12):a.setHours(a.getHours()+12*e),s=!0}}else{var c=this._partiallyInvalidDate.invalidDateParts||{},d=this.getInvalidDatePartValue(t),p=c.y.value||a.getFullYear(),m=c.M.value||a.getMonth(),v=c.d.value||c.E.value||a.getDate(),g=c.h.value||c.H.value||a.getHours(),f=c.m.value||a.getMinutes(),y=c.s.value||a.getSeconds(),D=c.S.value||a.getMilliseconds();switch(t){case"y":p+=e;break;case"M":m+=e;break;case"d":case"E":v+=e}if("M"===t){if((m<0||m>11)&&h)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(!h){if(m<0)m=(0,r.clamp)(m%11+1+11,0,11);else{var E=(0,r.isPresent)(d)?m:(e-1)%12;m=(0,r.clamp)(E,0,11)}m=(0,r.clamp)(m,0,11)}m=(0,r.clamp)(m,0,11)}else if("d"===t)if(h){if(v<=0||v>31)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t)}else if(!h){if((0,r.isPresent)(d)&&(v<=0||v>31))return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(e<0){var P=(0,r.isPresent)(d)?v:31-Math.abs(e%31)+1;v=(0,r.clamp)(P,1,31)}else P=(0,r.isPresent)(d)?v:e%31,v=(0,r.clamp)(P,1,31);v=(0,r.clamp)(v,1,31)}var b=(0,n.createDate)(p,m,v,g,f,y,D),S=o||l?this.modifyDateSymbolWithValue(a,t,o?m:v):null,M=(0,r.areDatePartsEqualTo)(b,p,m,v,g,f,y,D);this.getValue()&&(0,r.areDatePartsEqualTo)(b,p,m,v,g,f,y,D)?(a=(0,n.cloneDate)(b),this.markDatePartsAsExisting()):o&&S?S.getMonth()===m?this.getExisting("d")?M?(a=(0,n.cloneDate)(b),this.resetInvalidDateSymbol(t)):(i=!0,this.setInvalidDatePart(t,{value:m,date:(0,n.cloneDate)(S),startDateOffset:e,startDate:(0,n.cloneDate)(this.value)}),this.setExisting(t,!1)):M?(this.resetInvalidDateSymbol(t),a=(0,n.cloneDate)(b),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(t),a=(0,n.cloneDate)(S)):(i=!0,this.setInvalidDatePart(t,{value:m,date:(0,n.cloneDate)(S),startDateOffset:e,startDate:(0,n.cloneDate)(this.value)}),this.setExisting(t,!1)):l&&S&&(S.getDate()===v?this.getExisting("M")?M?(a=(0,n.cloneDate)(b),this.resetInvalidDateSymbol(t)):(i=!0,this.setInvalidDatePart(t,{value:v,date:(0,n.cloneDate)(S),startDateOffset:e,startDate:(0,n.cloneDate)(this.value)}),this.setExisting(t,!1)):M?(a=(0,n.cloneDate)(b),this.resetInvalidDateSymbol(t),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(t),a=(0,n.cloneDate)(S)):(i=!0,this.setInvalidDatePart(t,{value:v,date:(0,n.cloneDate)(this.value),startDateOffset:e,startDate:(0,n.cloneDate)(this.value)}),this.setExisting(t,!1)))}this.shouldNormalizeCentury()&&(a=this.normalizeCentury(a)),s&&!this.cycleTime&&(a.getDate(),this._value.getDate()),i||(this.setExisting(t,!0),this._value=a,this.getValue()&&this.resetInvalidDate())}},t.prototype.parsePart=function(t){for(var e=t.symbol,i=t.currentChar,a=t.resetSegmentValue,o=t.cycleSegmentValue,l=t.rawTextValue,h=t.isDeleting,u=t.originalFormat,c=!o,d=this.dateFormatString(this.value,this.format),p=d.partMap.filter((function(t){return"literal"===t.type})).map((function(t,e){return{datePartIndex:e,type:t.type,pattern:t.pattern,literal:""}})),m=d.partMap.map((function(t){return{type:t.type,pattern:t.pattern,text:""}})),v=0;v<p.length;v++){for(var g=p[v],f=0;f<g.pattern.length;f++)p[v+f]&&(p[v+f].literal=g.pattern[f]);v+=g.pattern.length-1}for(v=0;v<m.length;v++){for(g=m[v],f=0;f<g.pattern.length;f++)m[v+f]&&(m[v+f].text=g.pattern[f]);v+=g.pattern.length-1}var y={value:null,switchToNext:!1,resetPart:c&&"M"===e&&d.partMap.filter((function(t){return"month"===t.type})).some((function(t){return t.pattern.length>2})),hasInvalidDatePart:!1};if(!i){if(!c)return this.resetLeadingZero(),this.setExisting(e,!1),this.resetInvalidDateSymbol(e),(0,r.extend)(y,{value:null,switchToNext:!1});for(v=0;v<p.length;v++){var D=p[v].literal,E=l.startsWith(D),P=l.endsWith(D),b=l.indexOf(D+D)>=0;if(E||P||b)return this.resetLeadingZero(),this.setExisting(e,!1),this.resetInvalidDateSymbol(e),(0,r.extend)(y,{value:null,switchToNext:!1})}}var S=this.intl.formatDate(this.value,this.format,this.localeId),M=d.symbols,I=!1,x="",O="",w="",C="",F="",V="",k="";for(v=0;v<m.length;v++)k+=m[v].text;var T=this.format===M||this.format===k||this.format===u||this.format.length===u.length,_=(T?k:u).indexOf(e),A=(T?k:u).lastIndexOf(e)-_+1,N=u.length-l.length;if(c||!c&&!this.autoCorrectParts){for(v=0;v<S.length;v++)M[v]===e?(O+=this.getExisting(e)?S[v]:"0",N>0?w.length+N<A&&(w+=l[v]||""):w+=l[v]||"",I=!0):I?(V+=S[v],F+=S[v]):(x+=S[v],C+=S[v]);if(T&&(k.length<l.length?w+=i:!h&&(u.length,l.length),w.length>A))return(0,r.extend)(y,{value:null,switchToNext:!1});if(!T||T&&!this.autoCorrectParts){for(O="",w="",x="",V="",I=!1,v=0;v<u.length;v++)u[v]===e?(O+=this.getExisting(e)?S[v]||"":"0",N>0?w.length+N<A&&(w+=l[v]||""):w+=l[v]||"",I=!0):I?V+=l[v-N]||"":x+=l[v]||"";u.length<l.length&&(w+=i)}}if(!c)if(this.autoCorrectParts)for(O="",w="",x="",V="",I=!1,v=0;v<S.length;v++)M[v]===e?(O+=this.getExisting(e)?S[v]:"0",I=!0):I?V+=S[v]:x+=S[v];else O=a?w:O;var j=null,L=this.matchMonth(i),K=this.matchDayPeriod(i,e),W="0"===i,H=this.leadingZero||{};W?("0"===w&&(w=O),0!==(0,r.parseToInt)(a?i:(c?w:O)+i)||this.isAbbrMonth(d.partMap,e)||"a"===e||this.incrementLeadingZero(e)):this.resetLeadingZero();var B=this.partPattern(d.partMap,e),Z=B?B.pattern:null,R=this.patternLength(Z)||Z.length;if(c&&h&&!w)return this.setExisting(e,!1),(0,r.extend)(y,{value:null,switchToNext:!1});var Y=O.length-3,U=!0,q=c?w:O;for(v=Math.max(0,Y);v<=O.length&&U;v++){q=a?i:c?w:O.substring(v)+i,!c&&this.autoCorrectParts||(U=!1,q=(0,s.unpadZero)(q),q=(0,s.padZero)(R-q.length)+q);var z=parseInt(q,10),G=x+q+V;(j=this.intl.parseDate(G,this.format,this.localeId))&&this.value&&d.partMap.every((function(t){return"year"!==t.type&&"month"!==t.type&&"day"!=t.type}))&&(j.setFullYear(this.value.getFullYear()),j.setMonth(this.value.getMonth()),j.setDate(this.value.getDate()));var J=!1;c&&!(0,r.isValidDate)(j)&&this.autoCorrectParts&&(j=this.intl.parseDate(C+q+F,this.format,this.localeId),J=!0);var $=!isNaN(parseInt(i,10))||c&&h&&""===i;if(!j&&!isNaN(z)&&$&&this.autoCorrectParts){if("M"===e&&!L){var Q=z-1;Q>-1&&Q<12&&((j=(0,n.cloneDate)(this.value)).setMonth(Q),j.getMonth()!==Q&&(j=(0,n.lastDayOfMonth)((0,n.addMonths)(j,-1))))}"y"===e&&(j=(0,n.createDate)(parseInt(q,10),this.month?this.value.getMonth():0,this.date?this.value.getDate():1,this.hours?this.value.getHours():0,this.minutes?this.value.getMinutes():0,this.seconds?this.value.getSeconds():0,this.milliseconds?this.value.getMilliseconds():0),(c&&(0,r.isValidDate)(j)||!c&&j)&&this.date&&j.getDate()!==this.value.getDate()&&(j=(0,n.lastDayOfMonth)((0,n.addMonths)(j,-1))))}if(c&&(0,r.isValidDate)(j)||!c&&j){var X=this.isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:J,middle:q,patternValue:Z,basePrefix:C,baseSuffix:F,prefix:x,suffix:V,symbol:e,patternLength:R,leadingZero:H}),tt=X.switchToNext;return this.shouldNormalizeCentury()&&(j=this.normalizeCentury(j)),"H"===e&&j.getHours()>=12&&this.setExisting("a",!0),this._value=j,this.setExisting(e,!0),this.resetInvalidDateSymbol(e),this.autoCorrectParts||("M"===e?this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d")):"d"===e&&this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M")),this.hasInvalidDatePart()||(this.markDatePartsAsExisting(),X.peekedDate||!X.switchToNext||this.autoCorrectParts||"M"===e||"d"===e&&30===X.parsedPeekedValue&&1===this.value.getMonth()&&(tt=!1))),(0,r.extend)(y,{value:this.value,switchToNext:tt})}}if(L&&(j=this.intl.parseDate(x+L+V,this.format,this.localeId)))return this._value=j,this.setExisting(e,!0),(0,r.extend)(y,{value:this.value,switchToNext:!1});if(K&&(j=this.intl.parseDate(x+K+V,this.format)||this.intl.parseDate(C+K+F,this.format)))return this._value=j,this.setExisting(e,!0),(0,r.extend)(y,{value:this.value,switchToNext:!0});if(W&&"a"!==e&&this.setExisting(e,!1),!this.autoCorrectParts){var et=void 0,it=c?w:q,nt=(0,r.parseToInt)(it);if((0,r.isNumber)(nt)&&(0,r.isParseableToInt)(it)){if("d"===e&&(nt<=0||nt>31)||"M"===e&&(nt<=0||nt>11)){if(c)return(0,r.extend)(y,{value:null,switchToNext:!1});it=i,nt=(0,r.parseToInt)(it)}if(!(0,r.isNumber)(nt)||!(0,r.isParseableToInt)(it))return(0,r.extend)(y,{value:null,switchToNext:!1});et="M"===e?nt-1:nt;var at="M"===e,st="d"===e,rt=(0,n.cloneDate)(this._value),ot=this._partiallyInvalidDate.invalidDateParts||{},lt=ot.y.value||rt.getFullYear(),ht=at?et:ot.M.value||rt.getMonth(),ut=st?et:ot.d.value||ot.E.value||rt.getDate(),ct=ot.h.value||ot.H.value||rt.getHours(),dt=ot.m.value||rt.getMinutes(),pt=ot.s.value||rt.getSeconds(),mt=ot.S.value||rt.getMilliseconds(),vt=(0,n.createDate)(lt,ht,ut,ct,dt,pt,mt),gt=(0,r.areDatePartsEqualTo)(vt,lt,ht,ut,ct,dt,pt,mt),ft=at||st?this.modifyDateSymbolWithValue(rt,e,at?ht:ut):null,yt=!1;if(at&&ft?ft.getMonth()===ht?this.getExisting("d")?gt?(rt=(0,n.cloneDate)(vt),this.resetInvalidDateSymbol(e)):(yt=!0,this.setInvalidDatePart(e,{value:ht,date:(0,n.cloneDate)(ft),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1)):gt?(this.resetInvalidDateSymbol(e),rt=(0,n.cloneDate)(vt),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(e),rt=(0,n.cloneDate)(ft)):(yt=!0,this.setInvalidDatePart(e,{value:ht,date:(0,n.cloneDate)(ft),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1)):st&&ft&&(ft.getDate()===ut?this.getExisting("M")?gt?(rt=(0,n.cloneDate)(vt),this.resetInvalidDateSymbol(e)):(yt=!0,this.setInvalidDatePart(e,{value:ut,date:(0,n.cloneDate)(ft),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1)):gt?(rt=(0,n.cloneDate)(vt),this.resetInvalidDateSymbol(e),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(e),rt=(0,n.cloneDate)(ft)):(yt=!0,this.setInvalidDatePart(e,{value:ut,date:(0,n.cloneDate)(this.value),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1))),!yt){if(this.setExisting(e,!0),c&&!(0,r.isValidDate)(j)){var Dt=this.intl.parseDate(C+q+F,this.format,this.localeId);(0,r.isValidDate)(Dt)&&(this._value=Dt)}else this._value=rt;this.getValue()&&this.resetInvalidDate()}return tt=!1,tt="M"===e?nt>=2||it.length>=2:T?this.isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:!this.autoCorrectParts,middle:q,patternValue:Z,basePrefix:C,baseSuffix:F,prefix:x,suffix:V,symbol:e,patternLength:R,leadingZero:H}).switchToNext:it.length>A,(0,r.extend)(y,{value:null,switchToNext:tt,hasInvalidDatePart:yt})}}return(0,r.extend)(y,{value:null,switchToNext:!1})},t.prototype.symbolMap=function(t){return this.intl.splitDateFormat(this.format,this.localeId).reduce(s.dateSymbolMap,{})[t]},t.prototype.resetLeadingZero=function(){var t=null!==this.leadingZero;return this.setLeadingZero(null),t},t.prototype.setLeadingZero=function(t){this.leadingZero=t},t.prototype.getLeadingZero=function(){return this.leadingZero||{}},t.prototype.normalizeCentury=function(t){if(!(0,r.isPresent)(t))return t;var e=(0,r.cropTwoDigitYear)(t),i=this.getNormalizedCenturyBase(e);return(0,r.setYears)(t,i+e)},t.prototype.incrementLeadingZero=function(t){var e=this.leadingZero||{};e[t]=(e[t]||0)+1,this.leadingZero=e},t.prototype.isAbbrMonth=function(t,e){var i=this.partPattern(t,e);return"month"===i.type&&i.names},t.prototype.partPattern=function(t,e){return t.filter((function(t){return-1!==t.pattern.indexOf(e)}))[0]},t.prototype.peek=function(t,e){var i=t.replace(/^0*/,"")+"0";return(0,s.padZero)(e.length-i.length)+i},t.prototype.matchMonth=function(t){if(this.typedMonthPart+=t.toLowerCase(),0===this.monthNames.length)return"";for(;this.typedMonthPart.length>0;){for(var e=0;e<this.monthNames.length;e++)if(0===this.monthNames[e].toLowerCase().indexOf(this.typedMonthPart))return this.monthNames[e];var i=parseInt(this.typedMonthPart,10);if(i>=1&&i<=12&&i.toString()===this.typedMonthPart)return this.monthNames[i-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""},t.prototype.matchDayPeriod=function(t,e){var i=t.toLowerCase();if("a"===e&&this.dayPeriods){if(this.dayPeriods.am.toLowerCase().startsWith(i))return this.dayPeriods.am;if(this.dayPeriods.pm.toLowerCase().startsWith(i))return this.dayPeriods.pm}return""},t.prototype.allFormattedMonths=function(t){void 0===t&&(t="en");for(var e=this.intl.splitDateFormat(this.format,this.localeId),i=0;i<e.length;i++)if("month"===e[i].type&&e[i].names)return this.intl.dateFormatNames(t,e[i].names);return[]},t.prototype.allDayPeriods=function(t){void 0===t&&(t="en");for(var e=this.intl.splitDateFormat(this.format),i=0;i<e.length;i++)if("dayperiod"===e[i].type&&e[i].names)return this.intl.dateFormatNames(t,e[i].names);return null},t.prototype.patternLength=function(t){return"y"===t[0]?4:l.test(t)?2:0},t.prototype.dateFormatString=function(t,e){for(var i=this.intl.splitDateFormat(e,this.localeId),n=[],s=[],r=0;r<i.length;r++)for(var l=this.intl.formatDate(t,{pattern:i[r].pattern},this.localeId).length;l>0;)n.push(this.symbols[i[r].pattern[0]]||o.Constants.formatSeparator),s.push(i[r]),l--;var h=new a.Mask;return h.symbols=n.join(""),h.partMap=s,h},t.prototype.merge=function(t,e){for(var i="",n="",a=e.symbols,o=!1,l=0,h=this.getFormattedInvalidDates(a),u=a.length-1;u>=0;u--){var c=this.getPartsForSegment(e,u);if(-1===this.knownParts.indexOf(a[u])||this.getExisting(a[u]))this.autoCorrectParts?i=t[u]+i:t.length!==a.length?o?i=t[u]+i:l>0?(i=t[u]+i,--l<=0&&(o=!0)):i=(t[u+t.length-a.length]||"")+i:i=t[u]+i,n=a[u]+n;else{var d=a[u],p=0;if(this.autoCorrectParts||!this.autoCorrectParts&&!this.getInvalidDatePartValue(d)){for(;u>=0&&d===a[u];)u--;u++}if(this.leadingZero&&this.leadingZero[d])i="0"+i;else if(!this.autoCorrectParts&&this.getInvalidDatePartValue(d)){var m=this.getInvalidDatePartValue(d).toString();"M"===d?(m=((0,r.parseToInt)(this.getInvalidDatePartValue(d))+1).toString(),c.length>2?i=h[d][u]+i:(m=((0,r.parseToInt)(this.getInvalidDatePartValue(d))+1).toString(),i=(0,s.padZero)(c.length-m.length)+m+i,p=c.length-1,l=m.length-c.length)):(i=(0,s.padZero)(c.length-m.length)+m+i,p=c.length-1,l=m.length-c.length)}else i=this.dateFieldName(e.partMap[u])+i;for(;n.length<i.length;)n=a[u]+n;0!==p&&(u=u-p+(t.length-a.length))}}return{text:i,format:n}},t.prototype.dateFieldName=function(t){var e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:"formatPattern"===e?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))},t.prototype.getNormalizedCenturyBase=function(t){return t>this.twoDigitYearMax?1900:2e3},t.prototype.shouldNormalizeCentury=function(){return this.intl.splitDateFormat(this.format).some((function(t){return"yy"===t.pattern}))},t.prototype.resetInvalidDate=function(){var t=this;this._partiallyInvalidDate.startDate=null,Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(e){t.resetInvalidDatePart(e)}))},t.prototype.resetInvalidDateSymbol=function(t){var e=this;this.resetInvalidDatePart(t);var i=!0;Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(t){e._partiallyInvalidDate.invalidDateParts[t]&&(0,r.isPresent)(e._partiallyInvalidDate.invalidDateParts[t].value)&&(i=!1)})),i&&this.resetInvalidDate()},t.prototype.resetInvalidDatePart=function(t){this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t]={value:null,date:null,startDateOffset:0})},t.prototype.getInvalidDatePart=function(t){return this._partiallyInvalidDate.invalidDateParts[t]||{}},t.prototype.getInvalidDatePartValue=function(t){return(this._partiallyInvalidDate.invalidDateParts[t]||{}).value},t.prototype.setInvalidDatePart=function(t,e){var i=e.value,n=void 0===i?null:i,a=e.date,s=void 0===a?null:a,r=e.startDateOffset,o=void 0===r?0:r,l=e.startDate,h=void 0===l?null:l;this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t].value=n,this._partiallyInvalidDate.invalidDateParts[t].date=s,this._partiallyInvalidDate.invalidDateParts[t].startDateOffset=o,this._partiallyInvalidDate.startDate=h)},t.prototype.hasInvalidDatePart=function(){var t=this,e=!1;return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(i){t._partiallyInvalidDate.invalidDateParts[i]&&(0,r.isPresent)(t._partiallyInvalidDate.invalidDateParts[i].value)&&(e=!0)})),e},t.prototype.modifyDateSymbolWithOffset=function(t,e,i){var a=(0,n.cloneDate)(t),s=!1;switch(e){case"y":a.setFullYear(a.getFullYear()+i);break;case"M":a=(0,n.addMonths)(this.value,i);break;case"d":case"E":a.setDate(a.getDate()+i);break;case"h":case"H":a.setHours(a.getHours()+i),s=!0;break;case"m":a.setMinutes(a.getMinutes()+i),s=!0;break;case"s":a.setSeconds(a.getSeconds()+i),s=!0;break;case"S":a.setMilliseconds(a.getMilliseconds()+i);break;case"a":a.setHours(a.getHours()+12*i),s=!0}return{date:a,timeModified:s}},t.prototype.modifyDateSymbolWithValue=function(t,e,i){var a=(0,n.cloneDate)(t);switch(e){case"y":a.setFullYear(i);break;case"M":a=(0,n.addMonths)(t,i-t.getMonth());break;case"d":case"E":a.setDate(i);break;case"h":case"H":case"a":a.setHours(i);break;case"m":a.setMinutes(i);break;case"s":a.setSeconds(i);break;case"S":a.setMilliseconds(i)}return a},t.prototype.markDatePartsAsExisting=function(){this.modifyExisting(!0)},t.prototype.getPartsForSegment=function(t,e){for(var i=t.partMap[e],n=[],a=e;a<t.partMap.length;a++){var s=t.partMap[a];if(i.type!==s.type||i.pattern!==s.pattern)break;n.push(s)}for(a=e-1;a>=0&&(s=t.partMap[a],i.type===s.type&&i.pattern===s.pattern);a--)n.unshift(s);return n},t.prototype.isPeekDateOverflowingDatePart=function(t){var e=t.useBasePrefixAndSuffix,i=t.middle,n=t.patternValue,a=t.basePrefix,o=t.baseSuffix,l=t.prefix,h=t.suffix,u=t.symbol,c=t.patternLength,d=t.leadingZero,p=this.peek(i,n),m=e?"".concat(a).concat(p).concat(o):"".concat(l).concat(p).concat(h),v=this.intl.parseDate(m,this.format,this.localeId),g=((this.leadingZero||{})[u]||0)+(0,s.unpadZero)(i).length>=c;return{peekedDate:v,peekedDateString:m,peekedValue:p,parsedPeekedValue:(0,r.parseToInt)(p),switchToNext:null===v||(d[u]?n.length<=i.length:g)}},t}();e.DateObject=h},503:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Key=void 0,e.Key={DELETE:"Delete",BACKSPACE:"Backspace",TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",SPACE:" ",END:"End",HOME:"Home",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown"}},874:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.KeyCode=void 0,e.KeyCode={BACKSPACE:8,DELETE:46,TAB:9,ENTER:13,ESCAPE:27,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40,SPACE:32,END:35,HOME:36,PAGE_UP:33,PAGE_DOWN:34}},930:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Mask=void 0;e.Mask=function(){this.symbols="",this.partMap=[]}},179:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Observable=void 0;var n=i(849),a={events:{}},s=function(){function t(t){this.options=(0,n.extend)({},a,t)}return t.prototype.destroy=function(){this.options={}},t.prototype.trigger=function(t,e){void 0===e&&(e={});var i={defaultPrevented:!1,preventDefault:function(){i.defaultPrevented=!0}};return!!(0,n.isFunction)(this.options.events[t])&&(this.options.events[t]((0,n.extend)(i,e,{sender:this})),i.defaultPrevented)},t}();e.Observable=s},849:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isIOS=e.isValidDate=e.areDatePartsEqualTo=e.millisecondStepFor=e.millisecondDigitsInFormat=e.setYears=e.cropTwoDigitYear=e.isFunction=e.noop=e.deepExtend=e.extend=e.clamp=e.isParseableToInt=e.parseToInt=e.isNumber=e.isDocumentAvailable=e.isPresent=void 0;var n=i(426),a=i(231),s=function(t){return t&&"object"==typeof t&&!Array.isArray(t)};e.isPresent=function(t){return null!=t},e.isDocumentAvailable=function(){return!!document},e.isNumber=function(t){return(0,e.isPresent)(t)&&"number"==typeof t&&!Number.isNaN(t)},e.parseToInt=function(t){return parseInt(t,10)},e.isParseableToInt=function(t){return(0,e.isNumber)((0,e.parseToInt)(t))&&/^[0-9]+$/.test(t)},e.clamp=function(t,e,i){return Math.min(i,Math.max(e,t))},e.extend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Object.assign.apply(Object,t)},e.deepExtend=function(t){for(var i,a,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(!r.length)return t;var l=r.shift();if(s(t)&&s(l))for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&"__proto__"!==h&&"constructor"!==h&&"prototype"!==h&&(l[h]instanceof HTMLElement?t[h]=l[h]:!s(l[h])||l[h]instanceof Date?(0,e.extend)(t,((a={})[h]=l[h],a)):(t[h]&&s(t[h])||(0,e.extend)(t,((i={})[h]={},i)),(0,e.deepExtend)(t[h],l[h])));return e.deepExtend.apply(void 0,n.__spreadArray([t],r,!1))},e.noop=function(){},e.isFunction=function(t){return"function"==typeof t},e.cropTwoDigitYear=function(t){return!(0,e.isPresent)(t)||isNaN(t.getTime())?0:Number(t.getFullYear().toString().slice(-2))},e.setYears=function(t,e){var i=(0,a.cloneDate)(t);return i.setFullYear(e),i},e.millisecondDigitsInFormat=function(t){var e=t&&t.match(/S+(\1)/);return e?e[0].length:0},e.millisecondStepFor=function(t){return Math.pow(10,3-t)},e.areDatePartsEqualTo=function(t,e,i,n,a,s,r,o){return!(!t||t.getFullYear()!==e||t.getMonth()!==i||t.getDate()!==n||t.getHours()!==a||t.getMinutes()!==s||t.getSeconds()!==r||t.getMilliseconds()!==o)},e.isValidDate=function(t){return(0,e.isPresent)(t)&&t.getTime&&(0,e.isNumber)(t.getTime())},e.isIOS=function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/Macintosh/i.test(navigator.userAgent)}},415:(t,e,i)=>{var n;Object.defineProperty(e,"__esModule",{value:!0}),e.DateInput=void 0;var a=i(426),s=i(953),r=i(506),o=i(874),l=i(503),h=i(849),u=i(179),c=i(655),d=i(231),p=i(761),m="dragStart",v="drop",g="touchstart",f="mousedown",y="mouseup",D="click",E="input",P="keydown",b="focus",S="blur",M="paste",I="DOMMouseScroll",x="mousewheel",O="valueChange",w="inputEnd",C="blurEnd",F="focusEnd",V="change",k={format:"d",hasPlaceholder:!1,placeholder:null,cycleTime:!0,locale:null,steps:{millisecond:1,second:1,minute:1,hour:1,day:1,month:1,year:1},formatPlaceholder:null,events:(n={},n[O]=null,n[E]=null,n[w]=null,n[b]=null,n[F]=null,n[S]=null,n[C]=null,n[P]=null,n[x]=null,n[V]=null,n),selectNearestSegmentOnFocus:!1,selectPreviousSegmentOnBackspace:!1,enableMouseWheel:!1,allowCaretMode:!1,autoSwitchParts:!0,autoSwitchKeys:[],twoDigitYearMax:p.Constants.twoDigitYearMax,autoCorrectParts:!0,autoFill:!1,toggleDayPeriod:!1},T=function(t){function e(e,i){var n=t.call(this,i)||this;return n.dateObject=null,n.currentText="",n.currentFormat="",n.interactionMode=c.DateInputInteractionMode.None,n.previousElementSelection={start:0,end:0},n.init(e,i),n}return a.__extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.dateObject&&this.dateObject.getValue()},enumerable:!1,configurable:!0}),e.prototype.init=function(t,e){var i=(0,h.isValidDate)(this.options.value)?(0,d.cloneDate)(this.options.value):new Date(e.formattedValue);(0,h.isValidDate)(i)||(i=null),this.element=t,this.options=(0,h.extend)({},k,e,{steps:a.__assign(a.__assign({},k.steps),e.steps)}),this.intl=this.options.intlService,this.dateObject=this.createDateObject(),this.dateObject.setValue(i),this.setTextAndFormat(),this.bindEvents(),this.resetSegmentValue=!0,this.interactionMode=c.DateInputInteractionMode.None,this.forceUpdate()},e.prototype.destroy=function(){this.unbindEvents(),this.dateObject=null,t.prototype.destroy.call(this)},e.prototype.bindEvents=function(){this.onElementDragStart=this.onElementDragStart.bind(this),this.element.addEventListener(m,this.onElementDragStart),this.onElementDrop=this.onElementDrop.bind(this),this.element.addEventListener(v,this.onElementDrop),this.onElementClick=this.onElementClick.bind(this),this.element.addEventListener(D,this.onElementClick),this.onElementMouseDown=this.onElementMouseDown.bind(this),this.element.addEventListener(f,this.onElementMouseDown),this.element.addEventListener(g,this.onElementMouseDown),this.onElementMouseUp=this.onElementMouseUp.bind(this),this.element.addEventListener(y,this.onElementMouseUp),this.onElementInput=this.onElementInput.bind(this),this.element.addEventListener(E,this.onElementInput),this.onElementKeyDown=this.onElementKeyDown.bind(this),this.element.addEventListener(P,this.onElementKeyDown),this.onElementFocus=this.onElementFocus.bind(this),this.element.addEventListener(b,this.onElementFocus),this.onElementBlur=this.onElementBlur.bind(this),this.element.addEventListener(S,this.onElementBlur),this.onElementChange=this.onElementChange.bind(this),this.element.addEventListener(V,this.onElementChange),this.onElementPaste=this.onElementPaste.bind(this),this.element.addEventListener(M,this.onElementPaste),this.onElementMouseWheel=this.onElementMouseWheel.bind(this),this.element.addEventListener(I,this.onElementMouseWheel),this.element.addEventListener(x,this.onElementMouseWheel)},e.prototype.unbindEvents=function(){this.element.removeEventListener(m,this.onElementDragStart),this.element.removeEventListener(v,this.onElementDrop),this.element.removeEventListener(g,this.onElementMouseDown),this.element.removeEventListener(f,this.onElementMouseDown),this.element.removeEventListener(y,this.onElementMouseUp),this.element.removeEventListener(D,this.onElementClick),this.element.removeEventListener(E,this.onElementInput),this.element.removeEventListener(P,this.onElementKeyDown),this.element.removeEventListener(b,this.onElementFocus),this.element.removeEventListener(S,this.onElementBlur),this.element.removeEventListener(V,this.onElementChange),this.element.removeEventListener(M,this.onElementPaste),this.element.removeEventListener(I,this.onElementMouseWheel),this.element.removeEventListener(x,this.onElementMouseWheel)},e.prototype.setOptions=function(t,e){void 0===e&&(e=!1),this.options=(0,h.extend)({},this.options,t,{steps:a.__assign(a.__assign({},k.steps),t.steps)}),this.setDateObjectOptions(),e&&(this.unbindEvents(),this.init(this.element,this.options))},e.prototype.setDateObjectOptions=function(){if(this.dateObject){var t=this.getDateObjectOptions();this.dateObject.setOptions(t)}},e.prototype.resetLocale=function(){this.unbindEvents(),this.init(this.element,this.options)},e.prototype.isInCaretMode=function(){return this.interactionMode===c.DateInputInteractionMode.Caret},e.prototype.focus=function(){this.element.focus(),this.options.selectNearestSegmentOnFocus&&this.selectNearestSegment(0)},e.prototype.onElementDragStart=function(t){t.preventDefault()},e.prototype.onElementDrop=function(t){t.preventDefault()},e.prototype.onElementMouseDown=function(){this.mouseDownStarted=!0,this.focusedPriorToMouseDown=this.isActive},e.prototype.onElementMouseUp=function(t){this.mouseDownStarted=!1,t.preventDefault()},e.prototype.onElementClick=function(t){this.mouseDownStarted=!1,this.switchedPartOnPreviousKeyAction=!1;var e=this.selection;if(this.isInCaretMode()&&this.forceUpdate(),3===t.detail);else if(this.isActive&&this.options.selectNearestSegmentOnFocus){var i=this.element.selectionStart!==this.element.selectionEnd,n=(0,h.isPresent)(this.options.placeholder)&&!this.dateObject.hasValue()&&!this.focusedPriorToMouseDown,a=!i&&n?0:this.caret()[0];this.selectNearestSegment(a)}else this.setSelection(this.selectionByIndex(e.start))},e.prototype.onElementInput=function(t){this.triggerInput({event:t});var e=this.elementValue;if(this.element&&this.dateObject){var i=this.switchedPartOnPreviousKeyAction;if(this.isPasteInProgress)return this.options.allowCaretMode&&(this.resetSegmentValue=!1),this.updateOnPaste(t),void(this.isPasteInProgress=!1);var n=this.keyDownEvent||{},a=n.keyCode===o.KeyCode.BACKSPACE||n.key===l.Key.BACKSPACE,s=n.keyCode===o.KeyCode.DELETE||n.key===l.Key.DELETE,u=this.interactionMode;!this.options.allowCaretMode||u===c.DateInputInteractionMode.Caret||s||a||(this.resetSegmentValue=!0),this.options.allowCaretMode?this.interactionMode=c.DateInputInteractionMode.Caret:this.interactionMode=c.DateInputInteractionMode.Selection;var m=this.isInCaretMode();if(m&&this.keyDownEvent.key===l.Key.SPACE)this.restorePreviousInputEventState();else{var v=this.dateObject&&this.dateObject.getValue(),g=this.dateObject?this.dateObject.value:null,f=this.dateObject.getTextAndFormat(),y=f.text,D=f.format;this.currentFormat=D;var E;E=m&&(a||s||u===c.DateInputInteractionMode.Caret)?this.previousElementValue:y;var P=this.elementValue,b=(0,r.approximateStringMatching)({oldText:E,newText:P,formatPattern:this.currentFormat,selectionStart:this.selection.start,isInCaretMode:m,keyEvent:this.keyDownEvent});if(b&&b.length&&b[0]&&b[0][1]!==p.Constants.formatSeparator&&(this.switchedPartOnPreviousKeyAction=!1),!m||b&&0!==b.length){if(m&&1===b.length){if(!b[0]||!b[0][0])return void this.restorePreviousInputEventState();if(m&&b[0]&&(b[0][0]===p.Constants.formatSeparator||b[0][1]===p.Constants.formatSeparator))return void this.restorePreviousInputEventState()}var S=1===b.length&&b[0][1]===p.Constants.formatSeparator,M=[],I=!1,x=null;if(!S)for(var O=0;O<b.length;O++){var w=this.dateObject.parsePart({symbol:b[O][0],currentChar:b[O][1],resetSegmentValue:this.resetSegmentValue,cycleSegmentValue:!this.isInCaretMode(),rawTextValue:this.element.value,isDeleting:a||s,originalFormat:this.currentFormat});M.push(w),w.value||(x={type:"parse"}),I=w.switchToNext}this.options.autoSwitchParts||(I=!1),this.resetSegmentValue=!1;var C,F=this.options.format===this.currentFormat||(0,h.isPresent)(this.options.format)&&this.options.format.length>1,V=M[M.length-1],k=V&&!(0,h.isPresent)(V.value),T=m&&(a||s)&&k,_=!!V&&V.resetPart,A=this.dateObject.getValue(),N=!(0,d.isEqual)(v,A),j=this.dateObject.value,L=this.selection;if(m){var K=b&&b.length>0?b[0][0]:null,W=this.dateObject.getLeadingZero()[K];b.length&&b[0][0]!==p.Constants.formatSeparator?I?(this.forceUpdateWithSelection(),this.switchDateSegment(1)):_?(C=this.currentFormat[L.start])?(this.forceUpdate(),this.setSelection(this.selectionBySymbol(C))):this.restorePreviousInputEventState():T?(this.forceUpdate(),b.length&&b[0][0]!==p.Constants.formatSeparator&&this.setSelection(this.selectionBySymbol(b[0][0]))):k?"0"===t.data&&W||((0,h.isPresent)(v)&&!(0,h.isPresent)(A)?this.restorePreviousInputEventState():!(0,h.isPresent)(v)&&(0,h.isPresent)(A)?this.forceUpdateWithSelection():(0,h.isPresent)(v)&&(0,h.isPresent)(A)?N?this.forceUpdateWithSelection():this.restorePreviousInputEventState():(0,h.isPresent)(v)||(0,h.isPresent)(A)?g!==j||this.restorePreviousInputEventState():this.forceUpdateWithSelection()):k||F||this.forceUpdateWithSelection():(this.options.autoSwitchParts||b[0][1]!==p.Constants.formatSeparator)&&this.setSelection(this.selectionBySymbol(b[0][0]))}else m||(this.forceUpdate(),b.length&&b[0][0]!==p.Constants.formatSeparator&&this.setSelection(this.selectionBySymbol(b[0][0])),this.options.autoSwitchParts?S?(this.resetSegmentValue=!0,i||this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0):I&&(this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0):V&&V.switchToNext?this.resetSegmentValue=!0:S&&(this.resetSegmentValue=!0,i||this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0),a&&this.options.selectPreviousSegmentOnBackspace&&this.switchDateSegment(-1));this.tryTriggerValueChange({oldValue:v,event:t}),this.triggerInputEnd({event:t,error:x,oldElementValue:e,newElementValue:this.elementValue}),m&&this.setTextAndFormat()}else this.restorePreviousInputEventState()}}},e.prototype.onElementFocus=function(t){this.triggerFocus({event:t})||(this.isActive=!0,this.interactionMode=c.DateInputInteractionMode.None,this.switchedPartOnPreviousKeyAction=!1,this.refreshElementValue(),this.mouseDownStarted||this.caret(0,this.elementValue.length),this.mouseDownStarted=!1,this.triggerFocusEnd({event:t}))},e.prototype.onElementBlur=function(t){this.resetSegmentValue=!0,this.isActive=!1,this.triggerBlur({event:t})||(this.options.autoFill&&this.autoFill(),this.interactionMode=c.DateInputInteractionMode.None,this.switchedPartOnPreviousKeyAction=!1,this.refreshElementValue(),this.triggerBlurEnd({event:t}))},e.prototype.onElementChange=function(t){this.triggerChange({event:t})},e.prototype.onElementKeyDown=function(t){if(!this.triggerKeyDown({event:t})){var e=this.selection,i=e.start,n=e.end,a=t;if(this.keyDownEvent=t,this.previousElementValue=this.element.value,this.previousElementSelection={start:i,end:n},this.keyEventMatchesAutoSwitchKeys(t)){var s=t.keyCode===o.KeyCode.TAB;if(!s)return t.preventDefault(),void this.switchDateSegment(1);var r=this.selection,l=r.start,h=r.end;if(t.shiftKey&&s?this.switchDateSegment(-1):this.switchDateSegment(1),l!==this.selection.start||h!==this.selection.end)return void t.preventDefault()}var u=this.currentFormat[this.selection.start],c=this.getStepFromSymbol(u),d=!1,p=this.elementValue;if(!(t.altKey||t.ctrlKey||t.metaKey||t.keyCode===o.KeyCode.TAB)){switch(t.keyCode){case o.KeyCode.ARROW_LEFT:this.switchDateSegment(-1),d=!0,this.switchedPartOnPreviousKeyAction=!1;break;case o.KeyCode.ARROW_UP:this.modifyDateSegmentValue(c,u,a),p!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:p}),d=!0,this.switchedPartOnPreviousKeyAction=!1;break;case o.KeyCode.ARROW_RIGHT:this.switchDateSegment(1),d=!0,this.switchedPartOnPreviousKeyAction=!1;break;case o.KeyCode.ARROW_DOWN:this.modifyDateSegmentValue(-c,u,a),p!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:p}),d=!0,this.switchedPartOnPreviousKeyAction=!1;break;case o.KeyCode.ENTER:break;case o.KeyCode.HOME:this.selectNearestSegment(0),d=!0,this.switchedPartOnPreviousKeyAction=!1,this.resetSegmentValue=!0;break;case o.KeyCode.END:this.selectNearestSegment(this.elementValue.length),d=!0,this.switchedPartOnPreviousKeyAction=!1,this.resetSegmentValue=!0;break;default:return}d&&t.preventDefault()}}},e.prototype.onElementPaste=function(){this.isPasteInProgress=!0},e.prototype.onElementMouseWheel=function(t){var e=this.elementValue;if(this.options.enableMouseWheel&&!this.triggerMouseWheel({event:t})&&this.isActive){var i=t;i.shiftKey?this.switchDateSegment((i.wheelDelta||-i.detail)>0?-1:1):this.modifyDateSegmentValue((i.wheelDelta||-i.detail)>0?1:-1),i.returnValue=!1,i.preventDefault&&i.preventDefault(),e!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:e})}},e.prototype.updateOnPaste=function(t){var e=this.intl.parseDate(this.elementValue,this.inputFormat)||this.value;(0,h.isPresent)(e)&&this.dateObject.shouldNormalizeCentury()&&(e=this.dateObject.normalizeCentury(e));var i=this.dateObject&&this.dateObject.getValue();this.writeValue(e),this.tryTriggerValueChange({oldValue:i,event:t})},Object.defineProperty(e.prototype,"elementValue",{get:function(){return(this.element||{}).value||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.inputFormat:p.Constants.defaultDateFormat},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.displayFormat:p.Constants.defaultDateFormat},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){var t={start:0,end:0};return null!==this.element&&void 0!==this.element.selectionStart&&(t={start:this.element.selectionStart,end:this.element.selectionEnd}),t},enumerable:!1,configurable:!0}),e.prototype.setSelection=function(t){this.element&&document.activeElement===this.element&&(this.element.setSelectionRange(t.start,t.end),(0,h.isDocumentAvailable)()&&(0,h.isIOS)()&&this.element.scrollIntoView({block:"nearest",inline:"nearest"}),t.start!==t.end&&(this.interactionMode=c.DateInputInteractionMode.Selection))},e.prototype.selectionBySymbol=function(t){for(var e=-1,i=0,n=0;n<this.currentFormat.length;n++)this.currentFormat[n]===t&&(i=n+1,-1===e&&(e=n));return e<0&&(e=0),this.options.autoCorrectParts||this.currentFormat.length===this.currentText.length||(this.currentFormat.length<this.currentText.length?i+=this.currentText.length-this.currentFormat.length:i=Math.max(0,i-(this.currentFormat.length-this.currentText.length))),{start:e,end:i}},e.prototype.selectionByIndex=function(t){for(var e={start:t,end:t},i=t,n=t-1;i<this.currentFormat.length||n>=0;i++,n--){if(i<this.currentFormat.length&&this.currentFormat[i]!==p.Constants.formatSeparator){e=this.selectionBySymbol(this.currentFormat[i]);break}if(n>=0&&this.currentFormat[n]!==p.Constants.formatSeparator){e=this.selectionBySymbol(this.currentFormat[n]);break}}return e},e.prototype.switchDateSegment=function(t){var e=this.selection;if(this.isInCaretMode()){var i=e.start,n=this.currentFormat[i-1],a="",s="";if(t<0){for(var r=i+t;r>=0;r--)if((s=this.currentFormat[r])!==p.Constants.formatSeparator&&s!==n){i=r,a=s;break}}else for(r=i+t;r<this.currentFormat.length;r++)if((s=this.currentFormat[r])!==p.Constants.formatSeparator&&s!==n){i=r,a=s;break}if(a)return this.forceUpdate(),this.setSelection(this.selectionBySymbol(a)),void(this.interactionMode=c.DateInputInteractionMode.Selection)}this.interactionMode=c.DateInputInteractionMode.None;var o=this.selection,l=o.start,h=o.end;if(l<h&&this.currentFormat[l]!==this.currentFormat[h-1])return this.setSelection(this.selectionByIndex(t>0?l:h-1)),this.resetSegmentValue=!0,void(this.interactionMode=c.DateInputInteractionMode.None);for(var u=this.currentFormat[l],d=l+t;d>0&&d<this.currentFormat.length&&(this.currentFormat[d]===u||this.currentFormat[d]===p.Constants.formatSeparator);)d+=t;if(this.currentFormat[d]!==p.Constants.formatSeparator){for(var m=d;m>=0&&m<this.currentFormat.length&&this.currentFormat[m]===this.currentFormat[d];)m+=t;d>m&&(m+1!==l||d+1!==h)?(this.setSelection({start:m+1,end:d+1}),this.resetSegmentValue=!0):d<m&&(d!==l||m!==h)&&(this.setSelection({start:d,end:m}),this.resetSegmentValue=!0),this.interactionMode=c.DateInputInteractionMode.None}},e.prototype.modifyDateSegmentValue=function(t,e,i){if(void 0===e&&(e=""),void 0===i&&(i={}),this.dateObject&&!this.options.readonly){var n=this.value,a=1,s=this.caret();if("S"===(e=e||this.currentFormat[s[0]])&&(!this.options.steps.millisecond||1===this.options.steps.millisecond)){var r=(0,h.millisecondDigitsInFormat)(this.inputFormat);a=(0,h.millisecondStepFor)(r)}this.dateObject.modifyPart(e,a*t),this.tryTriggerValueChange({oldValue:n,event:i}),this.forceUpdate(),this.setSelection(this.selectionBySymbol(e))}},e.prototype.tryTriggerValueChange=function(t){if(void 0===t&&(t={oldValue:null,event:{}}),!(0,d.isEqual)(this.value,t.oldValue))return this.triggerValueChange(t)},e.prototype.triggerValueChange=function(t){return void 0===t&&(t={oldValue:null,event:{}}),this.trigger(O,(0,h.extend)(t,{value:this.value}))},e.prototype.triggerInput=function(t){return void 0===t&&(t={event:{}}),this.trigger(E,(0,h.extend)(t,{value:this.value}))},e.prototype.triggerInputEnd=function(t){return void 0===t&&(t={event:{},error:null,oldElementValue:"",newElementValue:""}),this.trigger(w,(0,h.extend)(t,{value:this.value}))},e.prototype.triggerFocus=function(t){return void 0===t&&(t={event:{}}),this.trigger(b,(0,h.extend)({},t))},e.prototype.triggerFocusEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger(F,(0,h.extend)({},t))},e.prototype.triggerBlur=function(t){return void 0===t&&(t={event:{}}),this.trigger(S,(0,h.extend)({},t))},e.prototype.triggerBlurEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger(C,(0,h.extend)({},t))},e.prototype.triggerChange=function(t){return void 0===t&&(t={event:{}}),this.trigger(V,(0,h.extend)(t,{value:this.value}))},e.prototype.triggerKeyDown=function(t){return void 0===t&&(t={event:{}}),this.trigger(P,(0,h.extend)({},t))},e.prototype.triggerMouseWheel=function(t){return void 0===t&&(t={event:{}}),this.trigger(x,(0,h.extend)({},t))},e.prototype.forceUpdate=function(){this.setTextAndFormat(),this.refreshElementValue()},e.prototype.forceUpdateWithSelection=function(){var t=this.selection,e=t.start,i=t.end,n=this.elementValue.length;this.forceUpdate();var a=this.elementValue.length-n;this.setSelection({start:e+a,end:i+a})},e.prototype.setTextAndFormat=function(){var t=this.dateObject.getTextAndFormat(),e=t.text,i=t.format;this.currentFormat=i,this.currentText=e},e.prototype.setElementValue=function(t){this.element.value=t},e.prototype.getStepFromSymbol=function(t){switch(t){case"S":return Number(this.options.steps.millisecond);case"s":return Number(this.options.steps.second);case"m":return Number(this.options.steps.minute);case"h":case"H":return Number(this.options.steps.hour);case"M":return Number(this.options.steps.month);case"d":case"E":return Number(this.options.steps.day);case"y":return Number(this.options.steps.year);default:return 1}},e.prototype.restorePreviousInputEventState=function(){this.restorePreviousElementValue(),this.restorePreviousElementSelection()},e.prototype.restorePreviousElementValue=function(){this.setElementValue(this.previousElementValue||"")},e.prototype.restorePreviousElementSelection=function(){var t=this.previousElementSelection,e=t.start,i=t.end;this.setSelection({start:e||0,end:i||0})},e.prototype.writeValue=function(t){this.verifyValue(t),this.dateObject=this.getDateObject(t),this.refreshElementValue()},e.prototype.verifyValue=function(t){if(t&&!(0,h.isValidDate)(t))throw new Error("The 'value' should be a valid JavaScript Date instance.")},e.prototype.refreshElementValue=function(){var t=this.element,e=this.isActive?this.inputFormat:this.displayFormat,i=this.dateObject.getTextAndFormat(e),n=i.text,a=i.format;this.currentFormat=a,this.currentText=n;var s=this.options.hasPlaceholder||(0,h.isPresent)(this.options.placeholder),r=!this.isActive&&s&&!this.dateObject.hasValue();s&&(0,h.isPresent)(this.options.placeholder)&&(t.placeholder=this.options.placeholder);var o=r?"":n;this.previousElementValue=this.elementValue,this.setElementValue(o)},e.prototype.caret=function(t,e){void 0===e&&(e=t);var i=void 0!==t,n=[t,t],a=this.element;if(!i||!this.options.disabled&&!this.options.readonly){try{void 0!==a.selectionStart&&(i&&((0,h.isDocumentAvailable)()&&document.activeElement!==a&&a.focus(),a.setSelectionRange(t,e)),n=[a.selectionStart,a.selectionEnd])}catch(t){n=[]}return n}},e.prototype.selectNearestSegment=function(t){for(var e=t,i=t-1;e<this.currentFormat.length||i>=0;e++,i--){if(e<this.currentFormat.length&&"_"!==this.currentFormat[e])return void this.selectDateSegment(this.currentFormat[e]);if(i>=0&&"_"!==this.currentFormat[i])return void this.selectDateSegment(this.currentFormat[i])}},e.prototype.selectDateSegment=function(t){for(var e=-1,i=0,n=0;n<this.currentFormat.length;n++)this.currentFormat[n]===t&&(i=n+1,-1===e&&(e=n));e<0&&(e=0),this.caret(0,0),this.caret(e,i)},e.prototype.getDateObject=function(t){var e=(this.dateObject||{}||null).leadingZero;this.options.value=t;var i=this.createDateObject();return i.setLeadingZero(this.isActive?e:null),i},e.prototype.createDateObject=function(){var t=this.getDateObjectOptions();return new s.DateObject((0,h.extend)({},t))},e.prototype.getDateObjectOptions=function(){return{intlService:this.options.intlService,formatPlaceholder:this.options.formatPlaceholder?this.options.formatPlaceholder:"formatPattern",format:this.inputFormat,cycleTime:this.options.cycleTime,twoDigitYearMax:this.options.twoDigitYearMax,autoCorrectParts:this.options.autoCorrectParts,value:this.options.value,toggleDayPeriod:this.options.toggleDayPeriod}},e.prototype.keyEventMatchesAutoSwitchKeys=function(t){var e=(this.options.autoSwitchKeys||[]).map((function(t){return t.toString().toLowerCase().trim()}));return e.indexOf(t.keyCode.toString())>=0||e.indexOf(t.keyCode)>=0||e.indexOf(t.key.toLowerCase().trim())>=0},e.prototype.autoFill=function(){var t,e,i,n,a,s,r=this.dateObject,o=new Date;(r.date||r.month||r.year||r.hours||r.minutes||r.seconds)&&(i=r.year?r.value.getFullYear():o.getFullYear(),e=r.month?r.value.getMonth():o.getMonth(),t=r.date?r.value.getDate():o.getDate(),n=r.hours?r.value.getHours():o.getHours(),a=r.minutes?r.value.getMinutes():o.getMinutes(),s=r.seconds?r.value.getSeconds():o.getSeconds(),r.setValue(new Date(i,e,t,n,a,s)),this.refreshElementValue(),this.triggerValueChange())},e}(u.Observable);e.DateInput=T},655:(t,e)=>{var i;Object.defineProperty(e,"__esModule",{value:!0}),e.DateInputInteractionMode=void 0,function(t){t.None="none",t.Caret="caret",t.Selection="selection"}(i||(e.DateInputInteractionMode=i={}))},506:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isInRange=e.dateSymbolMap=e.approximateStringMatching=e.unpadZero=e.padZero=void 0;var n=i(761),a=i(503);e.padZero=function(t){return new Array(Math.max(t,0)).fill("0").join("")},e.unpadZero=function(t){return t.replace(/^0*/,"")},e.approximateStringMatching=function(t){var e=t.oldText,i=t.newText,s=t.formatPattern,r=t.selectionStart,o=t.isInCaretMode,l=t.keyEvent,h=r+e.length-i.length,u=e[h],c=e.substring(0,h),d=i.substring(0,r),p=[];if(c===d&&r>0)return p.push([s[r-1],d[r-1]]),p;if(0===c.indexOf(d)&&o&&(l.key===a.Key.DELETE||l.key===a.Key.BACKSPACE)||0===c.indexOf(d)&&!o&&(0===d.length||s[d.length-1]!==s[d.length])){var m="";o||1!==d.length||p.push([s[0],d[0]]);for(var v=d.length;v<c.length;v++)s[v]!==m&&s[v]!==n.Constants.formatSeparator&&(m=s[v],p.push([m,""]));return p}if(o&&(0===d.indexOf(c)||s[r-1]===n.Constants.formatSeparator)||!o&&(0===d.indexOf(c)||s[r-1]===n.Constants.formatSeparator)){var g=s[0];for(v=Math.max(0,c.length-1);v<s.length;v++)if(s[v]!==n.Constants.formatSeparator){g=s[v];break}return[[g,d[r-1]]]}return" "===d[d.length-1]||d[d.length-1]===u&&"_"===s[h]?[[s[r-1],n.Constants.formatSeparator]]:[[s[r-1],d[r-1]]]},e.dateSymbolMap=function(t,e){return t[e.pattern[0]]=e.type,t},e.isInRange=function(t,e,i){return null===t||!(e&&e>t||i&&i<t)}},231:e=>{e.exports=t},426:t=>{t.exports=e}},n={};function a(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={exports:{}};return i[t](s,s.exports,a),s.exports}var s={};return(()=>{var t=s;Object.defineProperty(t,"__esModule",{value:!0}),t.DateInput=void 0;var e=a(415);Object.defineProperty(t,"DateInput",{enumerable:!0,get:function(){return e.DateInput}})})(),s})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@progress/kendo-date-math"),require("tslib")):"function"==typeof define&&define.amd?define([,],e):"object"==typeof exports?exports.KendoDateinputsCommon=e(require("@progress/kendo-date-math"),require("tslib")):t.KendoDateinputsCommon=e(t.KendoDateMath,t.self)}(self,((t,e)=>(()=>{"use strict";var i={761:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Constants=void 0,e.Constants={formatSeparator:"_",twoDigitYearMax:68,defaultDateFormat:"d",defaultLocaleId:"en"}},953:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DateObject=void 0;var n=i(231),a=i(930),s=i(506),r=i(849),o=i(761),l=/d|M|H|h|m|s/,h=function(){function t(t){var e=t.intlService,i=t.formatPlaceholder,a=t.format,s=t.cycleTime,r=void 0!==s&&s,l=t.twoDigitYearMax,h=void 0===l?o.Constants.twoDigitYearMax:l,u=t.value,c=void 0===u?null:u,d=t.autoCorrectParts,p=void 0===d||d,m=t.toggleDayPeriod,v=void 0!==m&&m;if(this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.dayperiod=!0,this.leadingZero=null,this.typedMonthPart="",this.knownParts="adHhmMsEyS",this.symbols={E:"E",H:"H",M:"M",a:"a",d:"d",h:"h",m:"m",s:"s",y:"y",S:"S"},this._value=this.getDefaultDate(),this.cycleTime=!1,this._partiallyInvalidDate={startDate:null,invalidDateParts:{E:{value:null,date:null,startDateOffset:0},H:{value:null,date:null,startDateOffset:0},M:{value:null,date:null,startDateOffset:0},a:{value:null,date:null,startDateOffset:0},d:{value:null,date:null,startDateOffset:0},h:{value:null,date:null,startDateOffset:0},m:{value:null,date:null,startDateOffset:0},s:{value:null,date:null,startDateOffset:0},y:{value:null,date:null,startDateOffset:0},S:{value:null,date:null,startDateOffset:0}}},this.setOptions({intlService:e,formatPlaceholder:i,format:a,cycleTime:r,twoDigitYearMax:h,value:c,autoCorrectParts:p,toggleDayPeriod:v}),c)this._value=(0,n.cloneDate)(c);else{this._value=this.getDefaultDate();for(var g=this.dateFormatString(this.value,this.format).symbols,f=0;f<g.length;f++)this.setExisting(g[f],!1)}}return Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){(!t||t instanceof Date)&&(this._value=t,this.resetInvalidDate())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localeId",{get:function(){for(var t=o.Constants.defaultLocaleId,e=Object.keys(this.intl.cldr),i=0;i<e.length;i++){var n=e[i],a=this.intl.cldr[n];if(a.name&&a.calendar&&a.numbers&&a.name!==o.Constants.defaultLocaleId){t=a.name;break}}return t},enumerable:!1,configurable:!0}),t.prototype.setOptions=function(t){this.intl=t.intlService,this.formatPlaceholder=t.formatPlaceholder||"wide",this.format=t.format,this.cycleTime=t.cycleTime,this.monthNames=this.allFormattedMonths(this.localeId),this.dayPeriods=this.allDayPeriods(this.localeId),this.twoDigitYearMax=t.twoDigitYearMax,this.autoCorrectParts=t.autoCorrectParts,this.toggleDayPeriod=t.toggleDayPeriod},t.prototype.setValue=function(t){t?(0,n.isEqual)(t,this._value)||(this._value=(0,n.cloneDate)(t),this.modifyExisting(!0)):(this._value=this.getDefaultDate(),this.modifyExisting(!1)),this.resetInvalidDate()},t.prototype.hasValue=function(){var t=this;return this.intl.splitDateFormat(this.format,this.localeId).reduce((function(e,i){return e||"literal"!==i.type&&"dayperiod"!==i.type&&t.getExisting(i.pattern[0])}),!1)},t.prototype.getValue=function(){for(var t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return(0,n.cloneDate)(this.value)},t.prototype.createDefaultDate=function(){return(0,n.createDate)(2e3,0,31)},t.prototype.getDefaultDate=function(){return(0,n.getDate)(this.createDefaultDate())},t.prototype.getFormattedDate=function(t){return this.intl.formatDate(this.getValue(),t,this.localeId)},t.prototype.getTextAndFormat=function(t){void 0===t&&(t="");var e=t||this.format,i=this.intl.formatDate(this.value,e,this.localeId),n=this.dateFormatString(this.value,e);if(!this.autoCorrectParts&&this._partiallyInvalidDate.startDate){for(var a="",o=this.intl.formatDate(this.value,e,this.localeId),l=this.getFormattedInvalidDates(e),h=0;h<o.length;h++){var u=n.symbols[h];if("literal"===n.partMap[h].type)a+=i[h];else if(this.getInvalidDatePartValue(u)){var c=this.getPartsForSegment(n,h);if("M"===u){var d=((0,r.parseToInt)(this.getInvalidDatePartValue(u))+1).toString();c.length>2?a+=l[u][h]:this.getInvalidDatePartValue(u)?(a+=(0,s.padZero)(c.length-d.length)+d,h+=c.length-1):a+=l[u][h]}else this.getInvalidDatePartValue(u)?(d=this.getInvalidDatePartValue(u).toString(),a+=(0,s.padZero)(c.length-d.length)+d,h+=c.length-1):a+=l[u][h]}else a+=i[h]}i=a}return this.merge(i,n)},t.prototype.getFormattedInvalidDates=function(t){var e=this;void 0===t&&(t="");var i=t||this.format,n={E:"",H:"",M:"",a:"",d:"",h:"",m:"",s:"",y:"",S:""};return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(t){var a=e.getInvalidDatePart(t).date;if(a){var s=e.intl.formatDate(a,i,e.localeId);n[t]=s}})),n},t.prototype.modifyExisting=function(t){for(var e=this.dateFormatString(this.value,this.format).symbols,i=0;i<e.length;i++)this.setExisting(e[i],t)},t.prototype.getExisting=function(t){switch(t){case"y":return this.year;case"M":case"L":return this.month;case"d":return this.date;case"E":return this.date&&this.month&&this.year;case"h":case"H":return this.hours;case"t":case"a":return this.dayperiod;case"m":return this.minutes;case"s":return this.seconds;case"S":return this.milliseconds;default:return!0}},t.prototype.setExisting=function(t,e){switch(t){case"y":this.year=e,!1===e&&this._value.setFullYear(2e3);break;case"M":this.month=e,!1===e&&this.autoCorrectParts&&this._value.setMonth(0);break;case"d":this.date=e;break;case"h":case"H":this.hours=e;break;case"t":case"a":this.dayperiod=e;break;case"m":this.minutes=e;break;case"s":this.seconds=e;break;case"S":this.milliseconds=e}this.getValue()&&this.resetInvalidDate()},t.prototype.modifyPart=function(t,e){if((0,r.isPresent)(t)&&(0,r.isPresent)(e)&&0!==e){var i,a=(0,n.cloneDate)(this.value),s=!1,o="M"===t,l="d"===t||"E"===t,h=this.getExisting(t);if(this.autoCorrectParts||!l&&!o){var u=a.getHours();switch(t){case"y":a.setFullYear(a.getFullYear()+e);break;case"M":a=(0,n.addMonths)(this.value,e);break;case"d":case"E":a.setDate(a.getDate()+e);break;case"h":case"H":a.setHours(a.getHours()+e),s=!0;break;case"m":a.setMinutes(a.getMinutes()+e),s=!0;break;case"s":a.setSeconds(a.getSeconds()+e),s=!0;break;case"S":a.setMilliseconds(a.getMilliseconds()+e);break;case"a":this.toggleDayPeriod?a.setHours(u>=12?u-12:u+12):a.setHours(a.getHours()+12*e),s=!0}}else{var c=this._partiallyInvalidDate.invalidDateParts||{},d=this.getInvalidDatePartValue(t),p=c.y.value||a.getFullYear(),m=c.M.value||a.getMonth(),v=c.d.value||c.E.value||a.getDate(),g=c.h.value||c.H.value||a.getHours(),f=c.m.value||a.getMinutes(),y=c.s.value||a.getSeconds(),D=c.S.value||a.getMilliseconds();switch(t){case"y":p+=e;break;case"M":m+=e;break;case"d":case"E":v+=e}if("M"===t){if((m<0||m>11)&&h)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(!h){if(m<0)m=(0,r.clamp)(m%11+1+11,0,11);else{var E=(0,r.isPresent)(d)?m:(e-1)%12;m=(0,r.clamp)(E,0,11)}m=(0,r.clamp)(m,0,11)}m=(0,r.clamp)(m,0,11)}else if("d"===t)if(h){if(v<=0||v>31)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t)}else if(!h){if((0,r.isPresent)(d)&&(v<=0||v>31))return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(e<0){var P=(0,r.isPresent)(d)?v:31-Math.abs(e%31)+1;v=(0,r.clamp)(P,1,31)}else P=(0,r.isPresent)(d)?v:e%31,v=(0,r.clamp)(P,1,31);v=(0,r.clamp)(v,1,31)}var b=(0,n.createDate)(p,m,v,g,f,y,D),S=o||l?this.modifyDateSymbolWithValue(a,t,o?m:v):null,M=(0,r.areDatePartsEqualTo)(b,p,m,v,g,f,y,D);this.getValue()&&(0,r.areDatePartsEqualTo)(b,p,m,v,g,f,y,D)?(a=(0,n.cloneDate)(b),this.markDatePartsAsExisting()):o&&S?S.getMonth()===m?this.getExisting("d")?M?(a=(0,n.cloneDate)(b),this.resetInvalidDateSymbol(t)):(i=!0,this.setInvalidDatePart(t,{value:m,date:(0,n.cloneDate)(S),startDateOffset:e,startDate:(0,n.cloneDate)(this.value)}),this.setExisting(t,!1)):M?(this.resetInvalidDateSymbol(t),a=(0,n.cloneDate)(b),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(t),a=(0,n.cloneDate)(S)):(i=!0,this.setInvalidDatePart(t,{value:m,date:(0,n.cloneDate)(S),startDateOffset:e,startDate:(0,n.cloneDate)(this.value)}),this.setExisting(t,!1)):l&&S&&(S.getDate()===v?this.getExisting("M")?M?(a=(0,n.cloneDate)(b),this.resetInvalidDateSymbol(t)):(i=!0,this.setInvalidDatePart(t,{value:v,date:(0,n.cloneDate)(S),startDateOffset:e,startDate:(0,n.cloneDate)(this.value)}),this.setExisting(t,!1)):M?(a=(0,n.cloneDate)(b),this.resetInvalidDateSymbol(t),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(t),a=(0,n.cloneDate)(S)):(i=!0,this.setInvalidDatePart(t,{value:v,date:(0,n.cloneDate)(this.value),startDateOffset:e,startDate:(0,n.cloneDate)(this.value)}),this.setExisting(t,!1)))}this.shouldNormalizeCentury()&&(a=this.normalizeCentury(a)),s&&!this.cycleTime&&(a.getDate(),this._value.getDate()),i||(this.setExisting(t,!0),this._value=a,this.getValue()&&this.resetInvalidDate())}},t.prototype.parsePart=function(t){for(var e=t.symbol,i=t.currentChar,a=t.resetSegmentValue,o=t.cycleSegmentValue,l=t.rawTextValue,h=t.isDeleting,u=t.originalFormat,c=!o,d=this.dateFormatString(this.value,this.format),p=d.partMap.filter((function(t){return"literal"===t.type})).map((function(t,e){return{datePartIndex:e,type:t.type,pattern:t.pattern,literal:""}})),m=d.partMap.map((function(t){return{type:t.type,pattern:t.pattern,text:""}})),v=0;v<p.length;v++){for(var g=p[v],f=0;f<g.pattern.length;f++)p[v+f]&&(p[v+f].literal=g.pattern[f]);v+=g.pattern.length-1}for(v=0;v<m.length;v++){for(g=m[v],f=0;f<g.pattern.length;f++)m[v+f]&&(m[v+f].text=g.pattern[f]);v+=g.pattern.length-1}var y={value:null,switchToNext:!1,resetPart:c&&"M"===e&&d.partMap.filter((function(t){return"month"===t.type})).some((function(t){return t.pattern.length>2})),hasInvalidDatePart:!1};if(!i){if(!c)return this.resetLeadingZero(),this.setExisting(e,!1),this.resetInvalidDateSymbol(e),(0,r.extend)(y,{value:null,switchToNext:!1});for(v=0;v<p.length;v++){var D=p[v].literal,E=l.startsWith(D),P=l.endsWith(D),b=l.indexOf(D+D)>=0;if(E||P||b)return this.resetLeadingZero(),this.setExisting(e,!1),this.resetInvalidDateSymbol(e),(0,r.extend)(y,{value:null,switchToNext:!1})}}var S=this.intl.formatDate(this.value,this.format,this.localeId),M=d.symbols,I=!1,x="",O="",w="",C="",F="",V="",k="";for(v=0;v<m.length;v++)k+=m[v].text;var T=this.format===M||this.format===k||this.format===u||this.format.length===u.length,_=(T?k:u).indexOf(e),A=(T?k:u).lastIndexOf(e)-_+1,N=u.length-l.length;if(c||!c&&!this.autoCorrectParts){var j=0;for(v=0;v<S.length;v++)if(M[v]===e){var L=this.getExisting(e);if("y"===e)if(!this.hasInvalidDatePart()&&this.getExisting("y"))O+=S[v];else{var K=this.getInvalidDatePartValue(e);(0,r.isPresent)(K)?(O+=(K||"").toString()[j]||"",j++):O+=L?S[v]:"0"}else O+=L?S[v]:"0";N>0?w.length+N<A&&(w+=l[v]||""):w+=l[v]||"",I=!0}else I?(V+=S[v],F+=S[v]):(x+=S[v],C+=S[v]);if(T&&(k.length<l.length?w+=i:!h&&(u.length,l.length),w.length>A))return(0,r.extend)(y,{value:null,switchToNext:!1});if(!T||T&&!this.autoCorrectParts){O="",w="",x="",V="",I=!1;var W=0;for(v=0;v<u.length;v++)u[v]===e?(L=this.getExisting(e),"y"===e?!this.hasInvalidDatePart()&&this.getExisting("y")?O+=S[v]:(K=this.getInvalidDatePartValue(e),(0,r.isPresent)(K)?(O+=(K||"").toString()[W]||"",W++):O+=L?S[v]:"0"):O+=L?S[v]||"":"0",N>0?w.length+N<A&&(w+=l[v]||""):w+=l[v]||"",I=!0):I?V+=l[v-N]||"":x+=l[v]||"";u.length<l.length&&(w+=i)}}if(!c)if(this.autoCorrectParts)for(O="",w="",x="",V="",I=!1,v=0;v<S.length;v++)M[v]===e?(O+=(L=this.getExisting(e))?S[v]:"0",I=!0):I?V+=S[v]:x+=S[v];else O=a?w:O;var H=null,B=this.matchMonth(i),Z=this.matchDayPeriod(i,e),R="0"===i,Y=this.leadingZero||{};R?("0"===w&&(w=O),0!==(0,r.parseToInt)(a?i:(c?w:O)+i)||this.isAbbrMonth(d.partMap,e)||"a"===e||this.incrementLeadingZero(e)):this.resetLeadingZero();var U=this.partPattern(d.partMap,e),q=U?U.pattern:null,z=this.patternLength(q)||q.length;if(c&&h&&!w)return this.setExisting(e,!1),(0,r.extend)(y,{value:null,switchToNext:!1});var G=O.length-3,J=!0,$=c?w:O;for(v=Math.max(0,G);v<=O.length&&J;v++){$=a?i:c?w:O.substring(v)+i,!c&&this.autoCorrectParts||(J=!1,$=(0,s.unpadZero)($),$=(0,s.padZero)(z-$.length)+$);var Q=parseInt($,10),X=x+$+V;(H=this.intl.parseDate(X,this.format,this.localeId))&&this.value&&d.partMap.every((function(t){return"year"!==t.type&&"month"!==t.type&&"day"!=t.type}))&&(H.setFullYear(this.value.getFullYear()),H.setMonth(this.value.getMonth()),H.setDate(this.value.getDate()));var tt=!1;c&&!(0,r.isValidDate)(H)&&this.autoCorrectParts&&(H=this.intl.parseDate(C+$+F,this.format,this.localeId),tt=!0);var et=!isNaN(parseInt(i,10))||c&&h&&""===i;if(!H&&!isNaN(Q)&&et&&this.autoCorrectParts){if("M"===e&&!B){var it=Q-1;it>-1&&it<12&&((H=(0,n.cloneDate)(this.value)).setMonth(it),H.getMonth()!==it&&(H=(0,n.lastDayOfMonth)((0,n.addMonths)(H,-1))))}"y"===e&&(H=(0,n.createDate)(parseInt($,10),this.month?this.value.getMonth():0,this.date?this.value.getDate():1,this.hours?this.value.getHours():0,this.minutes?this.value.getMinutes():0,this.seconds?this.value.getSeconds():0,this.milliseconds?this.value.getMilliseconds():0),(c&&(0,r.isValidDate)(H)||!c&&H)&&this.date&&H.getDate()!==this.value.getDate()&&(H=(0,n.lastDayOfMonth)((0,n.addMonths)(H,-1))))}if(c&&(0,r.isValidDate)(H)||!c&&H){var nt=this.isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:tt,middle:$,patternValue:q,basePrefix:C,baseSuffix:F,prefix:x,suffix:V,symbol:e,patternLength:z,leadingZero:Y}),at=nt.switchToNext;return this.shouldNormalizeCentury()&&(H=this.normalizeCentury(H)),"H"===e&&H.getHours()>=12&&this.setExisting("a",!0),this._value=H,this.setExisting(e,!0),this.resetInvalidDateSymbol(e),this.autoCorrectParts||("M"===e?this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d")):"d"===e?this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M")):"y"===e&&this.markDatePartsAsExisting(),this.hasInvalidDatePart()||(this.markDatePartsAsExisting(),nt.peekedDate||!nt.switchToNext||this.autoCorrectParts||"M"===e||"d"===e&&30===nt.parsedPeekedValue&&1===this.value.getMonth()&&(at=!1))),(0,r.extend)(y,{value:this.value,switchToNext:at})}}if(B&&(H=this.intl.parseDate(x+B+V,this.format,this.localeId)))return this._value=H,this.setExisting(e,!0),(0,r.extend)(y,{value:this.value,switchToNext:!1});if(Z&&(H=this.intl.parseDate(x+Z+V,this.format)||this.intl.parseDate(C+Z+F,this.format)))return this._value=H,this.setExisting(e,!0),(0,r.extend)(y,{value:this.value,switchToNext:!0});if(R&&"a"!==e&&this.setExisting(e,!1),!this.autoCorrectParts){var st=void 0,rt=c?w:$,ot=(0,r.parseToInt)(rt);if((0,r.isNumber)(ot)&&(0,r.isParseableToInt)(rt)){if("d"===e&&(ot<=0||ot>31)||"M"===e&&(ot<=0||ot>11)){if(c)return(0,r.extend)(y,{value:null,switchToNext:!1});rt=i,ot=(0,r.parseToInt)(rt)}if(!(0,r.isNumber)(ot)||!(0,r.isParseableToInt)(rt))return(0,r.extend)(y,{value:null,switchToNext:!1});st="M"===e?ot-1:ot;var lt="y"===e,ht="M"===e,ut="d"===e,ct=(0,n.cloneDate)(this._value),dt=this._partiallyInvalidDate.invalidDateParts||{},pt=lt?st:dt.y.value||ct.getFullYear(),mt=ht?st:dt.M.value||ct.getMonth(),vt=ut?st:dt.d.value||dt.E.value||ct.getDate(),gt=dt.h.value||dt.H.value||ct.getHours(),ft=dt.m.value||ct.getMinutes(),yt=dt.s.value||ct.getSeconds(),Dt=dt.S.value||ct.getMilliseconds(),Et=(0,n.createDate)(pt,mt,vt,gt,ft,yt,Dt),Pt=(0,r.areDatePartsEqualTo)(Et,pt,mt,vt,gt,ft,yt,Dt),bt=lt||ht||ut?this.modifyDateSymbolWithValue(ct,e,lt?pt:ht?mt:vt):null,St=!1;if(ht&&bt?bt.getMonth()===mt?this.getExisting("d")?Pt?(ct=(0,n.cloneDate)(Et),this.resetInvalidDateSymbol(e)):(St=!0,this.setInvalidDatePart(e,{value:mt,date:(0,n.cloneDate)(bt),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1)):Pt?(this.resetInvalidDateSymbol(e),ct=(0,n.cloneDate)(Et),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(e),ct=(0,n.cloneDate)(bt)):(St=!0,this.setInvalidDatePart(e,{value:mt,date:(0,n.cloneDate)(bt),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1)):ut&&bt?bt.getDate()===vt?this.getExisting("M")?Pt?(ct=(0,n.cloneDate)(Et),this.resetInvalidDateSymbol(e)):(St=!0,this.setInvalidDatePart(e,{value:vt,date:(0,n.cloneDate)(bt),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1)):Pt?(ct=(0,n.cloneDate)(Et),this.resetInvalidDateSymbol(e),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(e),ct=(0,n.cloneDate)(bt)):(St=!0,this.setInvalidDatePart(e,{value:vt,date:(0,n.cloneDate)(this.value),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1)):lt&&bt&&(bt.getFullYear()===pt?this.getExisting("d")&&this.getExisting("M")?Pt?(ct=(0,n.cloneDate)(Et),this.resetInvalidDateSymbol(e)):(St=!0,this.setInvalidDatePart(e,{value:pt,date:(0,n.cloneDate)(bt),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1)):Pt?(this.resetInvalidDateSymbol(e),ct=(0,n.cloneDate)(Et),this.getExisting("M")&&this.getExisting("d")&&(this.setExisting("y",!0),this.resetInvalidDateSymbol("y"))):(this.resetInvalidDateSymbol(e),ct=(0,n.cloneDate)(bt)):(St=!0,this.setInvalidDatePart(e,{value:pt,date:(0,n.cloneDate)(bt),startDate:(0,n.cloneDate)(this.value)}),this.setExisting(e,!1))),!St){if(this.setExisting(e,!0),c&&!(0,r.isValidDate)(H)){var Mt=this.intl.parseDate(C+$+F,this.format,this.localeId);(0,r.isValidDate)(Mt)&&(this._value=Mt)}else this._value=ct;this.getValue()&&this.resetInvalidDate()}return at=!1,at="M"===e?ot>=2||rt.length>=2:T?this.isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:!this.autoCorrectParts,middle:$,patternValue:q,basePrefix:C,baseSuffix:F,prefix:x,suffix:V,symbol:e,patternLength:z,leadingZero:Y}).switchToNext:rt.length>A,(0,r.extend)(y,{value:null,switchToNext:at,hasInvalidDatePart:St})}}return(0,r.extend)(y,{value:null,switchToNext:!1})},t.prototype.symbolMap=function(t){return this.intl.splitDateFormat(this.format,this.localeId).reduce(s.dateSymbolMap,{})[t]},t.prototype.resetLeadingZero=function(){var t=null!==this.leadingZero;return this.setLeadingZero(null),t},t.prototype.setLeadingZero=function(t){this.leadingZero=t},t.prototype.getLeadingZero=function(){return this.leadingZero||{}},t.prototype.normalizeCentury=function(t){if(!(0,r.isPresent)(t))return t;var e=(0,r.cropTwoDigitYear)(t),i=this.getNormalizedCenturyBase(e);return(0,r.setYears)(t,i+e)},t.prototype.incrementLeadingZero=function(t){var e=this.leadingZero||{};e[t]=(e[t]||0)+1,this.leadingZero=e},t.prototype.isAbbrMonth=function(t,e){var i=this.partPattern(t,e);return"month"===i.type&&i.names},t.prototype.partPattern=function(t,e){return t.filter((function(t){return-1!==t.pattern.indexOf(e)}))[0]},t.prototype.peek=function(t,e){var i=t.replace(/^0*/,"")+"0";return(0,s.padZero)(e.length-i.length)+i},t.prototype.matchMonth=function(t){if(this.typedMonthPart+=t.toLowerCase(),0===this.monthNames.length)return"";for(;this.typedMonthPart.length>0;){for(var e=0;e<this.monthNames.length;e++)if(0===this.monthNames[e].toLowerCase().indexOf(this.typedMonthPart))return this.monthNames[e];var i=parseInt(this.typedMonthPart,10);if(i>=1&&i<=12&&i.toString()===this.typedMonthPart)return this.monthNames[i-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""},t.prototype.matchDayPeriod=function(t,e){var i=t.toLowerCase();if("a"===e&&this.dayPeriods){if(this.dayPeriods.am.toLowerCase().startsWith(i))return this.dayPeriods.am;if(this.dayPeriods.pm.toLowerCase().startsWith(i))return this.dayPeriods.pm}return""},t.prototype.allFormattedMonths=function(t){void 0===t&&(t="en");for(var e=this.intl.splitDateFormat(this.format,this.localeId),i=0;i<e.length;i++)if("month"===e[i].type&&e[i].names)return this.intl.dateFormatNames(t,e[i].names);return[]},t.prototype.allDayPeriods=function(t){void 0===t&&(t="en");for(var e=this.intl.splitDateFormat(this.format),i=0;i<e.length;i++)if("dayperiod"===e[i].type&&e[i].names)return this.intl.dateFormatNames(t,e[i].names);return null},t.prototype.patternLength=function(t){return"y"===t[0]?4:l.test(t)?2:0},t.prototype.dateFormatString=function(t,e){for(var i=this.intl.splitDateFormat(e,this.localeId),n=[],s=[],r=0;r<i.length;r++)for(var l=this.intl.formatDate(t,{pattern:i[r].pattern},this.localeId).length;l>0;)n.push(this.symbols[i[r].pattern[0]]||o.Constants.formatSeparator),s.push(i[r]),l--;var h=new a.Mask;return h.symbols=n.join(""),h.partMap=s,h},t.prototype.merge=function(t,e){for(var i="",n="",a=e.symbols,o=!1,l=0,h=this.getFormattedInvalidDates(a),u=a.length-1;u>=0;u--){var c=this.getPartsForSegment(e,u);if(-1===this.knownParts.indexOf(a[u])||this.getExisting(a[u]))this.autoCorrectParts?i=t[u]+i:t.length!==a.length?o?i=t[u]+i:l>0?(i=t[u]+i,--l<=0&&(o=!0)):i=(t[u+t.length-a.length]||"")+i:i=t[u]+i,n=a[u]+n;else{var d=a[u],p=0;if(this.autoCorrectParts||!this.autoCorrectParts&&!this.getInvalidDatePartValue(d)){for(;u>=0&&d===a[u];)u--;u++}if(this.leadingZero&&this.leadingZero[d])i="0"+i;else if(!this.autoCorrectParts&&this.getInvalidDatePartValue(d)){var m=this.getInvalidDatePartValue(d).toString();"M"===d?(m=((0,r.parseToInt)(this.getInvalidDatePartValue(d))+1).toString(),c.length>2?i=h[d][u]+i:(m=((0,r.parseToInt)(this.getInvalidDatePartValue(d))+1).toString(),i=(0,s.padZero)(c.length-m.length)+m+i,p=c.length-1,l=m.length-c.length)):(i=(0,s.padZero)(c.length-m.length)+m+i,p=c.length-1,l=m.length-c.length)}else i=this.dateFieldName(e.partMap[u])+i;for(;n.length<i.length;)n=a[u]+n;0!==p&&(u=u-p+(t.length-a.length))}}return{text:i,format:n}},t.prototype.dateFieldName=function(t){var e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:"formatPattern"===e?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))},t.prototype.getNormalizedCenturyBase=function(t){return t>this.twoDigitYearMax?1900:2e3},t.prototype.shouldNormalizeCentury=function(){return this.intl.splitDateFormat(this.format).some((function(t){return"yy"===t.pattern}))},t.prototype.resetInvalidDate=function(){var t=this;this._partiallyInvalidDate.startDate=null,Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(e){t.resetInvalidDatePart(e)}))},t.prototype.resetInvalidDateSymbol=function(t){var e=this;this.resetInvalidDatePart(t);var i=!0;Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(t){e._partiallyInvalidDate.invalidDateParts[t]&&(0,r.isPresent)(e._partiallyInvalidDate.invalidDateParts[t].value)&&(i=!1)})),i&&this.resetInvalidDate()},t.prototype.resetInvalidDatePart=function(t){this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t]={value:null,date:null,startDateOffset:0})},t.prototype.getInvalidDatePart=function(t){return this._partiallyInvalidDate.invalidDateParts[t]||{}},t.prototype.getInvalidDatePartValue=function(t){return(this._partiallyInvalidDate.invalidDateParts[t]||{}).value},t.prototype.setInvalidDatePart=function(t,e){var i=e.value,n=void 0===i?null:i,a=e.date,s=void 0===a?null:a,r=e.startDateOffset,o=void 0===r?0:r,l=e.startDate,h=void 0===l?null:l;this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t].value=n,this._partiallyInvalidDate.invalidDateParts[t].date=s,this._partiallyInvalidDate.invalidDateParts[t].startDateOffset=o,this._partiallyInvalidDate.startDate=h)},t.prototype.hasInvalidDatePart=function(){var t=this,e=!1;return Object.keys(this._partiallyInvalidDate.invalidDateParts).forEach((function(i){t._partiallyInvalidDate.invalidDateParts[i]&&(0,r.isPresent)(t._partiallyInvalidDate.invalidDateParts[i].value)&&(e=!0)})),e},t.prototype.modifyDateSymbolWithOffset=function(t,e,i){var a=(0,n.cloneDate)(t),s=!1;switch(e){case"y":a.setFullYear(a.getFullYear()+i);break;case"M":a=(0,n.addMonths)(this.value,i);break;case"d":case"E":a.setDate(a.getDate()+i);break;case"h":case"H":a.setHours(a.getHours()+i),s=!0;break;case"m":a.setMinutes(a.getMinutes()+i),s=!0;break;case"s":a.setSeconds(a.getSeconds()+i),s=!0;break;case"S":a.setMilliseconds(a.getMilliseconds()+i);break;case"a":a.setHours(a.getHours()+12*i),s=!0}return{date:a,timeModified:s}},t.prototype.modifyDateSymbolWithValue=function(t,e,i){var a=(0,n.cloneDate)(t);switch(e){case"y":a.setFullYear(i);break;case"M":a=(0,n.addMonths)(t,i-t.getMonth());break;case"d":case"E":a.setDate(i);break;case"h":case"H":case"a":a.setHours(i);break;case"m":a.setMinutes(i);break;case"s":a.setSeconds(i);break;case"S":a.setMilliseconds(i)}return a},t.prototype.markDatePartsAsExisting=function(){this.modifyExisting(!0)},t.prototype.getPartsForSegment=function(t,e){for(var i=t.partMap[e],n=[],a=e;a<t.partMap.length;a++){var s=t.partMap[a];if(i.type!==s.type||i.pattern!==s.pattern)break;n.push(s)}for(a=e-1;a>=0&&(s=t.partMap[a],i.type===s.type&&i.pattern===s.pattern);a--)n.unshift(s);return n},t.prototype.isPeekDateOverflowingDatePart=function(t){var e=t.useBasePrefixAndSuffix,i=t.middle,n=t.patternValue,a=t.basePrefix,o=t.baseSuffix,l=t.prefix,h=t.suffix,u=t.symbol,c=t.patternLength,d=t.leadingZero,p=this.peek(i,n),m=e?"".concat(a).concat(p).concat(o):"".concat(l).concat(p).concat(h),v=this.intl.parseDate(m,this.format,this.localeId),g=((this.leadingZero||{})[u]||0)+(0,s.unpadZero)(i).length>=c;return{peekedDate:v,peekedDateString:m,peekedValue:p,parsedPeekedValue:(0,r.parseToInt)(p),switchToNext:null===v||(d[u]?n.length<=i.length:g)}},t}();e.DateObject=h},503:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Key=void 0,e.Key={DELETE:"Delete",BACKSPACE:"Backspace",TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",SPACE:" ",END:"End",HOME:"Home",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown"}},874:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.KeyCode=void 0,e.KeyCode={BACKSPACE:8,DELETE:46,TAB:9,ENTER:13,ESCAPE:27,ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40,SPACE:32,END:35,HOME:36,PAGE_UP:33,PAGE_DOWN:34}},930:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Mask=void 0;e.Mask=function(){this.symbols="",this.partMap=[]}},179:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Observable=void 0;var n=i(849),a={events:{}},s=function(){function t(t){this.options=(0,n.extend)({},a,t)}return t.prototype.destroy=function(){this.options={}},t.prototype.trigger=function(t,e){void 0===e&&(e={});var i={defaultPrevented:!1,preventDefault:function(){i.defaultPrevented=!0}};return!!(0,n.isFunction)(this.options.events[t])&&(this.options.events[t]((0,n.extend)(i,e,{sender:this})),i.defaultPrevented)},t}();e.Observable=s},849:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isIOS=e.isValidDate=e.areDatePartsEqualTo=e.millisecondStepFor=e.millisecondDigitsInFormat=e.setYears=e.cropTwoDigitYear=e.isFunction=e.noop=e.deepExtend=e.extend=e.clamp=e.isParseableToInt=e.parseToInt=e.isNumber=e.isDocumentAvailable=e.isPresent=void 0;var n=i(426),a=i(231),s=function(t){return t&&"object"==typeof t&&!Array.isArray(t)};e.isPresent=function(t){return null!=t},e.isDocumentAvailable=function(){return!!document},e.isNumber=function(t){return(0,e.isPresent)(t)&&"number"==typeof t&&!Number.isNaN(t)},e.parseToInt=function(t){return parseInt(t,10)},e.isParseableToInt=function(t){return(0,e.isNumber)((0,e.parseToInt)(t))&&/^[0-9]+$/.test(t)},e.clamp=function(t,e,i){return Math.min(i,Math.max(e,t))},e.extend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Object.assign.apply(Object,t)},e.deepExtend=function(t){for(var i,a,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];if(!r.length)return t;var l=r.shift();if(s(t)&&s(l))for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&"__proto__"!==h&&"constructor"!==h&&"prototype"!==h&&(l[h]instanceof HTMLElement?t[h]=l[h]:!s(l[h])||l[h]instanceof Date?(0,e.extend)(t,((a={})[h]=l[h],a)):(t[h]&&s(t[h])||(0,e.extend)(t,((i={})[h]={},i)),(0,e.deepExtend)(t[h],l[h])));return e.deepExtend.apply(void 0,n.__spreadArray([t],r,!1))},e.noop=function(){},e.isFunction=function(t){return"function"==typeof t},e.cropTwoDigitYear=function(t){return!(0,e.isPresent)(t)||isNaN(t.getTime())?0:Number(t.getFullYear().toString().slice(-2))},e.setYears=function(t,e){var i=(0,a.cloneDate)(t);return i.setFullYear(e),i},e.millisecondDigitsInFormat=function(t){var e=t&&t.match(/S+(\1)/);return e?e[0].length:0},e.millisecondStepFor=function(t){return Math.pow(10,3-t)},e.areDatePartsEqualTo=function(t,e,i,n,a,s,r,o){return!(!t||t.getFullYear()!==e||t.getMonth()!==i||t.getDate()!==n||t.getHours()!==a||t.getMinutes()!==s||t.getSeconds()!==r||t.getMilliseconds()!==o)},e.isValidDate=function(t){return(0,e.isPresent)(t)&&t.getTime&&(0,e.isNumber)(t.getTime())},e.isIOS=function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/Macintosh/i.test(navigator.userAgent)}},415:(t,e,i)=>{var n;Object.defineProperty(e,"__esModule",{value:!0}),e.DateInput=void 0;var a=i(426),s=i(953),r=i(506),o=i(874),l=i(503),h=i(849),u=i(179),c=i(655),d=i(231),p=i(761),m="dragStart",v="drop",g="touchstart",f="mousedown",y="mouseup",D="click",E="input",P="keydown",b="focus",S="blur",M="paste",I="DOMMouseScroll",x="mousewheel",O="valueChange",w="inputEnd",C="blurEnd",F="focusEnd",V="change",k={format:"d",hasPlaceholder:!1,placeholder:null,cycleTime:!0,locale:null,steps:{millisecond:1,second:1,minute:1,hour:1,day:1,month:1,year:1},formatPlaceholder:null,events:(n={},n[O]=null,n[E]=null,n[w]=null,n[b]=null,n[F]=null,n[S]=null,n[C]=null,n[P]=null,n[x]=null,n[V]=null,n),selectNearestSegmentOnFocus:!1,selectPreviousSegmentOnBackspace:!1,enableMouseWheel:!1,allowCaretMode:!1,autoSwitchParts:!0,autoSwitchKeys:[],twoDigitYearMax:p.Constants.twoDigitYearMax,autoCorrectParts:!0,autoFill:!1,toggleDayPeriod:!1},T=function(t){function e(e,i){var n=t.call(this,i)||this;return n.dateObject=null,n.currentText="",n.currentFormat="",n.interactionMode=c.DateInputInteractionMode.None,n.previousElementSelection={start:0,end:0},n.init(e,i),n}return a.__extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.dateObject&&this.dateObject.getValue()},enumerable:!1,configurable:!0}),e.prototype.init=function(t,e){var i=(0,h.isValidDate)(this.options.value)?(0,d.cloneDate)(this.options.value):new Date(e.formattedValue);(0,h.isValidDate)(i)||(i=null),this.element=t,this.options=(0,h.extend)({},k,e,{steps:a.__assign(a.__assign({},k.steps),e.steps)}),this.intl=this.options.intlService,this.dateObject=this.createDateObject(),this.dateObject.setValue(i),this.setTextAndFormat(),this.bindEvents(),this.resetSegmentValue=!0,this.interactionMode=c.DateInputInteractionMode.None,this.forceUpdate()},e.prototype.destroy=function(){this.unbindEvents(),this.dateObject=null,t.prototype.destroy.call(this)},e.prototype.bindEvents=function(){this.onElementDragStart=this.onElementDragStart.bind(this),this.element.addEventListener(m,this.onElementDragStart),this.onElementDrop=this.onElementDrop.bind(this),this.element.addEventListener(v,this.onElementDrop),this.onElementClick=this.onElementClick.bind(this),this.element.addEventListener(D,this.onElementClick),this.onElementMouseDown=this.onElementMouseDown.bind(this),this.element.addEventListener(f,this.onElementMouseDown),this.element.addEventListener(g,this.onElementMouseDown),this.onElementMouseUp=this.onElementMouseUp.bind(this),this.element.addEventListener(y,this.onElementMouseUp),this.onElementInput=this.onElementInput.bind(this),this.element.addEventListener(E,this.onElementInput),this.onElementKeyDown=this.onElementKeyDown.bind(this),this.element.addEventListener(P,this.onElementKeyDown),this.onElementFocus=this.onElementFocus.bind(this),this.element.addEventListener(b,this.onElementFocus),this.onElementBlur=this.onElementBlur.bind(this),this.element.addEventListener(S,this.onElementBlur),this.onElementChange=this.onElementChange.bind(this),this.element.addEventListener(V,this.onElementChange),this.onElementPaste=this.onElementPaste.bind(this),this.element.addEventListener(M,this.onElementPaste),this.onElementMouseWheel=this.onElementMouseWheel.bind(this),this.element.addEventListener(I,this.onElementMouseWheel),this.element.addEventListener(x,this.onElementMouseWheel)},e.prototype.unbindEvents=function(){this.element.removeEventListener(m,this.onElementDragStart),this.element.removeEventListener(v,this.onElementDrop),this.element.removeEventListener(g,this.onElementMouseDown),this.element.removeEventListener(f,this.onElementMouseDown),this.element.removeEventListener(y,this.onElementMouseUp),this.element.removeEventListener(D,this.onElementClick),this.element.removeEventListener(E,this.onElementInput),this.element.removeEventListener(P,this.onElementKeyDown),this.element.removeEventListener(b,this.onElementFocus),this.element.removeEventListener(S,this.onElementBlur),this.element.removeEventListener(V,this.onElementChange),this.element.removeEventListener(M,this.onElementPaste),this.element.removeEventListener(I,this.onElementMouseWheel),this.element.removeEventListener(x,this.onElementMouseWheel)},e.prototype.setOptions=function(t,e){void 0===e&&(e=!1),this.options=(0,h.extend)({},this.options,t,{steps:a.__assign(a.__assign({},k.steps),t.steps)}),this.setDateObjectOptions(),e&&(this.unbindEvents(),this.init(this.element,this.options))},e.prototype.setDateObjectOptions=function(){if(this.dateObject){var t=this.getDateObjectOptions();this.dateObject.setOptions(t)}},e.prototype.resetLocale=function(){this.unbindEvents(),this.init(this.element,this.options)},e.prototype.isInCaretMode=function(){return this.interactionMode===c.DateInputInteractionMode.Caret},e.prototype.focus=function(){this.element.focus(),this.options.selectNearestSegmentOnFocus&&this.selectNearestSegment(0)},e.prototype.onElementDragStart=function(t){t.preventDefault()},e.prototype.onElementDrop=function(t){t.preventDefault()},e.prototype.onElementMouseDown=function(){this.mouseDownStarted=!0,this.focusedPriorToMouseDown=this.isActive},e.prototype.onElementMouseUp=function(t){this.mouseDownStarted=!1,t.preventDefault()},e.prototype.onElementClick=function(t){this.mouseDownStarted=!1,this.switchedPartOnPreviousKeyAction=!1;var e=this.selection;if(this.isInCaretMode()&&this.forceUpdate(),3===t.detail);else if(this.isActive&&this.options.selectNearestSegmentOnFocus){var i=this.element.selectionStart!==this.element.selectionEnd,n=(0,h.isPresent)(this.options.placeholder)&&!this.dateObject.hasValue()&&!this.focusedPriorToMouseDown,a=!i&&n?0:this.caret()[0];this.selectNearestSegment(a)}else this.setSelection(this.selectionByIndex(e.start))},e.prototype.onElementInput=function(t){this.triggerInput({event:t});var e=this.elementValue;if(this.element&&this.dateObject){var i=this.switchedPartOnPreviousKeyAction;if(this.isPasteInProgress)return this.options.allowCaretMode&&(this.resetSegmentValue=!1),this.updateOnPaste(t),void(this.isPasteInProgress=!1);var n=this.keyDownEvent||{},a=n.keyCode===o.KeyCode.BACKSPACE||n.key===l.Key.BACKSPACE,s=n.keyCode===o.KeyCode.DELETE||n.key===l.Key.DELETE,u=this.interactionMode;!this.options.allowCaretMode||u===c.DateInputInteractionMode.Caret||s||a||(this.resetSegmentValue=!0),this.options.allowCaretMode?this.interactionMode=c.DateInputInteractionMode.Caret:this.interactionMode=c.DateInputInteractionMode.Selection;var m=this.isInCaretMode();if(m&&this.keyDownEvent.key===l.Key.SPACE)this.restorePreviousInputEventState();else{var v=this.dateObject&&this.dateObject.getValue(),g=this.dateObject?this.dateObject.value:null,f=this.dateObject.getTextAndFormat(),y=f.text,D=f.format;this.currentFormat=D;var E;E=m&&(a||s||u===c.DateInputInteractionMode.Caret)?this.previousElementValue:y;var P=this.elementValue,b=(0,r.approximateStringMatching)({oldText:E,newText:P,formatPattern:this.currentFormat,selectionStart:this.selection.start,isInCaretMode:m,keyEvent:this.keyDownEvent});if(b&&b.length&&b[0]&&b[0][1]!==p.Constants.formatSeparator&&(this.switchedPartOnPreviousKeyAction=!1),!m||b&&0!==b.length){if(m&&1===b.length){if(!b[0]||!b[0][0])return void this.restorePreviousInputEventState();if(m&&b[0]&&(b[0][0]===p.Constants.formatSeparator||b[0][1]===p.Constants.formatSeparator))return void this.restorePreviousInputEventState()}var S=1===b.length&&b[0][1]===p.Constants.formatSeparator,M=[],I=!1,x=null;if(!S)for(var O=0;O<b.length;O++){var w=this.dateObject.parsePart({symbol:b[O][0],currentChar:b[O][1],resetSegmentValue:this.resetSegmentValue,cycleSegmentValue:!this.isInCaretMode(),rawTextValue:this.element.value,isDeleting:a||s,originalFormat:this.currentFormat});M.push(w),w.value||(x={type:"parse"}),I=w.switchToNext}this.options.autoSwitchParts||(I=!1),this.resetSegmentValue=!1;var C,F=this.options.format===this.currentFormat||(0,h.isPresent)(this.options.format)&&this.options.format.length>1,V=M[M.length-1],k=V&&!(0,h.isPresent)(V.value),T=m&&(a||s)&&k,_=!!V&&V.resetPart,A=this.dateObject.getValue(),N=!(0,d.isEqual)(v,A),j=this.dateObject.value,L=this.selection;if(m){var K=b&&b.length>0?b[0][0]:null,W=this.dateObject.getLeadingZero()[K];b.length&&b[0][0]!==p.Constants.formatSeparator?I?(this.forceUpdateWithSelection(),this.switchDateSegment(1)):_?(C=this.currentFormat[L.start])?(this.forceUpdate(),this.setSelection(this.selectionBySymbol(C))):this.restorePreviousInputEventState():T?(this.forceUpdate(),b.length&&b[0][0]!==p.Constants.formatSeparator&&this.setSelection(this.selectionBySymbol(b[0][0]))):k?"0"===t.data&&W||((0,h.isPresent)(v)&&!(0,h.isPresent)(A)?this.restorePreviousInputEventState():!(0,h.isPresent)(v)&&(0,h.isPresent)(A)?this.forceUpdateWithSelection():(0,h.isPresent)(v)&&(0,h.isPresent)(A)?N?this.forceUpdateWithSelection():this.restorePreviousInputEventState():(0,h.isPresent)(v)||(0,h.isPresent)(A)?g!==j||this.restorePreviousInputEventState():this.forceUpdateWithSelection()):k||F||this.forceUpdateWithSelection():(this.options.autoSwitchParts||b[0][1]!==p.Constants.formatSeparator)&&this.setSelection(this.selectionBySymbol(b[0][0]))}else m||(this.forceUpdate(),b.length&&b[0][0]!==p.Constants.formatSeparator&&this.setSelection(this.selectionBySymbol(b[0][0])),this.options.autoSwitchParts?S?(this.resetSegmentValue=!0,i||this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0):I&&(this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0):V&&V.switchToNext?this.resetSegmentValue=!0:S&&(this.resetSegmentValue=!0,i||this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0),a&&this.options.selectPreviousSegmentOnBackspace&&this.switchDateSegment(-1));this.tryTriggerValueChange({oldValue:v,event:t}),this.triggerInputEnd({event:t,error:x,oldElementValue:e,newElementValue:this.elementValue}),m&&this.setTextAndFormat()}else this.restorePreviousInputEventState()}}},e.prototype.onElementFocus=function(t){this.triggerFocus({event:t})||(this.isActive=!0,this.interactionMode=c.DateInputInteractionMode.None,this.switchedPartOnPreviousKeyAction=!1,this.refreshElementValue(),this.mouseDownStarted||this.caret(0,this.elementValue.length),this.mouseDownStarted=!1,this.triggerFocusEnd({event:t}))},e.prototype.onElementBlur=function(t){this.resetSegmentValue=!0,this.isActive=!1,this.triggerBlur({event:t})||(this.options.autoFill&&this.autoFill(),this.interactionMode=c.DateInputInteractionMode.None,this.switchedPartOnPreviousKeyAction=!1,this.refreshElementValue(),this.triggerBlurEnd({event:t}))},e.prototype.onElementChange=function(t){this.triggerChange({event:t})},e.prototype.onElementKeyDown=function(t){if(!this.triggerKeyDown({event:t})){var e=this.selection,i=e.start,n=e.end,a=t;if(this.keyDownEvent=t,this.previousElementValue=this.element.value,this.previousElementSelection={start:i,end:n},this.keyEventMatchesAutoSwitchKeys(t)){var s=t.keyCode===o.KeyCode.TAB;if(!s)return t.preventDefault(),void this.switchDateSegment(1);var r=this.selection,l=r.start,h=r.end;if(t.shiftKey&&s?this.switchDateSegment(-1):this.switchDateSegment(1),l!==this.selection.start||h!==this.selection.end)return void t.preventDefault()}var u=this.currentFormat[this.selection.start],c=this.getStepFromSymbol(u),d=!1,p=this.elementValue;if(!(t.altKey||t.ctrlKey||t.metaKey||t.keyCode===o.KeyCode.TAB)){switch(t.keyCode){case o.KeyCode.ARROW_LEFT:this.switchDateSegment(-1),d=!0,this.switchedPartOnPreviousKeyAction=!1;break;case o.KeyCode.ARROW_UP:this.modifyDateSegmentValue(c,u,a),p!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:p}),d=!0,this.switchedPartOnPreviousKeyAction=!1;break;case o.KeyCode.ARROW_RIGHT:this.switchDateSegment(1),d=!0,this.switchedPartOnPreviousKeyAction=!1;break;case o.KeyCode.ARROW_DOWN:this.modifyDateSegmentValue(-c,u,a),p!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:p}),d=!0,this.switchedPartOnPreviousKeyAction=!1;break;case o.KeyCode.ENTER:break;case o.KeyCode.HOME:this.selectNearestSegment(0),d=!0,this.switchedPartOnPreviousKeyAction=!1,this.resetSegmentValue=!0;break;case o.KeyCode.END:this.selectNearestSegment(this.elementValue.length),d=!0,this.switchedPartOnPreviousKeyAction=!1,this.resetSegmentValue=!0;break;default:return}d&&t.preventDefault()}}},e.prototype.onElementPaste=function(){this.isPasteInProgress=!0},e.prototype.onElementMouseWheel=function(t){var e=this.elementValue;if(this.options.enableMouseWheel&&!this.triggerMouseWheel({event:t})&&this.isActive){var i=t;i.shiftKey?this.switchDateSegment((i.wheelDelta||-i.detail)>0?-1:1):this.modifyDateSegmentValue((i.wheelDelta||-i.detail)>0?1:-1),i.returnValue=!1,i.preventDefault&&i.preventDefault(),e!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:e})}},e.prototype.updateOnPaste=function(t){var e=this.intl.parseDate(this.elementValue,this.inputFormat)||this.value;(0,h.isPresent)(e)&&this.dateObject.shouldNormalizeCentury()&&(e=this.dateObject.normalizeCentury(e));var i=this.dateObject&&this.dateObject.getValue();this.writeValue(e),this.tryTriggerValueChange({oldValue:i,event:t})},Object.defineProperty(e.prototype,"elementValue",{get:function(){return(this.element||{}).value||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.inputFormat:p.Constants.defaultDateFormat},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"displayFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.displayFormat:p.Constants.defaultDateFormat},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){var t={start:0,end:0};return null!==this.element&&void 0!==this.element.selectionStart&&(t={start:this.element.selectionStart,end:this.element.selectionEnd}),t},enumerable:!1,configurable:!0}),e.prototype.setSelection=function(t){this.element&&document.activeElement===this.element&&(this.element.setSelectionRange(t.start,t.end),(0,h.isDocumentAvailable)()&&(0,h.isIOS)()&&this.element.scrollIntoView({block:"nearest",inline:"nearest"}),t.start!==t.end&&(this.interactionMode=c.DateInputInteractionMode.Selection))},e.prototype.selectionBySymbol=function(t){for(var e=-1,i=0,n=0;n<this.currentFormat.length;n++)this.currentFormat[n]===t&&(i=n+1,-1===e&&(e=n));return e<0&&(e=0),this.options.autoCorrectParts||this.currentFormat.length===this.currentText.length||(this.currentFormat.length<this.currentText.length?i+=this.currentText.length-this.currentFormat.length:i=Math.max(0,i-(this.currentFormat.length-this.currentText.length))),{start:e,end:i}},e.prototype.selectionByIndex=function(t){for(var e={start:t,end:t},i=t,n=t-1;i<this.currentFormat.length||n>=0;i++,n--){if(i<this.currentFormat.length&&this.currentFormat[i]!==p.Constants.formatSeparator){e=this.selectionBySymbol(this.currentFormat[i]);break}if(n>=0&&this.currentFormat[n]!==p.Constants.formatSeparator){e=this.selectionBySymbol(this.currentFormat[n]);break}}return e},e.prototype.switchDateSegment=function(t){var e=this.selection;if(this.isInCaretMode()){var i=e.start,n=this.currentFormat[i-1],a="",s="";if(t<0){for(var r=i+t;r>=0;r--)if((s=this.currentFormat[r])!==p.Constants.formatSeparator&&s!==n){i=r,a=s;break}}else for(r=i+t;r<this.currentFormat.length;r++)if((s=this.currentFormat[r])!==p.Constants.formatSeparator&&s!==n){i=r,a=s;break}if(a)return this.forceUpdate(),this.setSelection(this.selectionBySymbol(a)),void(this.interactionMode=c.DateInputInteractionMode.Selection)}this.interactionMode=c.DateInputInteractionMode.None;var o=this.selection,l=o.start,h=o.end;if(l<h&&this.currentFormat[l]!==this.currentFormat[h-1])return this.setSelection(this.selectionByIndex(t>0?l:h-1)),this.resetSegmentValue=!0,void(this.interactionMode=c.DateInputInteractionMode.None);for(var u=this.currentFormat[l],d=l+t;d>0&&d<this.currentFormat.length&&(this.currentFormat[d]===u||this.currentFormat[d]===p.Constants.formatSeparator);)d+=t;if(this.currentFormat[d]!==p.Constants.formatSeparator){for(var m=d;m>=0&&m<this.currentFormat.length&&this.currentFormat[m]===this.currentFormat[d];)m+=t;d>m&&(m+1!==l||d+1!==h)?(this.setSelection({start:m+1,end:d+1}),this.resetSegmentValue=!0):d<m&&(d!==l||m!==h)&&(this.setSelection({start:d,end:m}),this.resetSegmentValue=!0),this.interactionMode=c.DateInputInteractionMode.None}},e.prototype.modifyDateSegmentValue=function(t,e,i){if(void 0===e&&(e=""),void 0===i&&(i={}),this.dateObject&&!this.options.readonly){var n=this.value,a=1,s=this.caret();if("S"===(e=e||this.currentFormat[s[0]])&&(!this.options.steps.millisecond||1===this.options.steps.millisecond)){var r=(0,h.millisecondDigitsInFormat)(this.inputFormat);a=(0,h.millisecondStepFor)(r)}this.dateObject.modifyPart(e,a*t),this.tryTriggerValueChange({oldValue:n,event:i}),this.forceUpdate(),this.setSelection(this.selectionBySymbol(e))}},e.prototype.tryTriggerValueChange=function(t){if(void 0===t&&(t={oldValue:null,event:{}}),!(0,d.isEqual)(this.value,t.oldValue))return this.triggerValueChange(t)},e.prototype.triggerValueChange=function(t){return void 0===t&&(t={oldValue:null,event:{}}),this.trigger(O,(0,h.extend)(t,{value:this.value}))},e.prototype.triggerInput=function(t){return void 0===t&&(t={event:{}}),this.trigger(E,(0,h.extend)(t,{value:this.value}))},e.prototype.triggerInputEnd=function(t){return void 0===t&&(t={event:{},error:null,oldElementValue:"",newElementValue:""}),this.trigger(w,(0,h.extend)(t,{value:this.value}))},e.prototype.triggerFocus=function(t){return void 0===t&&(t={event:{}}),this.trigger(b,(0,h.extend)({},t))},e.prototype.triggerFocusEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger(F,(0,h.extend)({},t))},e.prototype.triggerBlur=function(t){return void 0===t&&(t={event:{}}),this.trigger(S,(0,h.extend)({},t))},e.prototype.triggerBlurEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger(C,(0,h.extend)({},t))},e.prototype.triggerChange=function(t){return void 0===t&&(t={event:{}}),this.trigger(V,(0,h.extend)(t,{value:this.value}))},e.prototype.triggerKeyDown=function(t){return void 0===t&&(t={event:{}}),this.trigger(P,(0,h.extend)({},t))},e.prototype.triggerMouseWheel=function(t){return void 0===t&&(t={event:{}}),this.trigger(x,(0,h.extend)({},t))},e.prototype.forceUpdate=function(){this.setTextAndFormat(),this.refreshElementValue()},e.prototype.forceUpdateWithSelection=function(){var t=this.selection,e=t.start,i=t.end,n=this.elementValue.length;this.forceUpdate();var a=this.elementValue.length-n;this.setSelection({start:e+a,end:i+a})},e.prototype.setTextAndFormat=function(){var t=this.dateObject.getTextAndFormat(),e=t.text,i=t.format;this.currentFormat=i,this.currentText=e},e.prototype.setElementValue=function(t){this.element.value=t},e.prototype.getStepFromSymbol=function(t){switch(t){case"S":return Number(this.options.steps.millisecond);case"s":return Number(this.options.steps.second);case"m":return Number(this.options.steps.minute);case"h":case"H":return Number(this.options.steps.hour);case"M":return Number(this.options.steps.month);case"d":case"E":return Number(this.options.steps.day);case"y":return Number(this.options.steps.year);default:return 1}},e.prototype.restorePreviousInputEventState=function(){this.restorePreviousElementValue(),this.restorePreviousElementSelection()},e.prototype.restorePreviousElementValue=function(){this.setElementValue(this.previousElementValue||"")},e.prototype.restorePreviousElementSelection=function(){var t=this.previousElementSelection,e=t.start,i=t.end;this.setSelection({start:e||0,end:i||0})},e.prototype.writeValue=function(t){this.verifyValue(t),this.dateObject=this.getDateObject(t),this.refreshElementValue()},e.prototype.verifyValue=function(t){if(t&&!(0,h.isValidDate)(t))throw new Error("The 'value' should be a valid JavaScript Date instance.")},e.prototype.refreshElementValue=function(){var t=this.element,e=this.isActive?this.inputFormat:this.displayFormat,i=this.dateObject.getTextAndFormat(e),n=i.text,a=i.format;this.currentFormat=a,this.currentText=n;var s=this.options.hasPlaceholder||(0,h.isPresent)(this.options.placeholder),r=!this.isActive&&s&&!this.dateObject.hasValue();s&&(0,h.isPresent)(this.options.placeholder)&&(t.placeholder=this.options.placeholder);var o=r?"":n;this.previousElementValue=this.elementValue,this.setElementValue(o)},e.prototype.caret=function(t,e){void 0===e&&(e=t);var i=void 0!==t,n=[t,t],a=this.element;if(!i||!this.options.disabled&&!this.options.readonly){try{void 0!==a.selectionStart&&(i&&((0,h.isDocumentAvailable)()&&document.activeElement!==a&&a.focus(),a.setSelectionRange(t,e)),n=[a.selectionStart,a.selectionEnd])}catch(t){n=[]}return n}},e.prototype.selectNearestSegment=function(t){for(var e=t,i=t-1;e<this.currentFormat.length||i>=0;e++,i--){if(e<this.currentFormat.length&&"_"!==this.currentFormat[e])return void this.selectDateSegment(this.currentFormat[e]);if(i>=0&&"_"!==this.currentFormat[i])return void this.selectDateSegment(this.currentFormat[i])}},e.prototype.selectDateSegment=function(t){for(var e=-1,i=0,n=0;n<this.currentFormat.length;n++)this.currentFormat[n]===t&&(i=n+1,-1===e&&(e=n));e<0&&(e=0),this.caret(0,0),this.caret(e,i)},e.prototype.getDateObject=function(t){var e=(this.dateObject||{}||null).leadingZero;this.options.value=t;var i=this.createDateObject();return i.setLeadingZero(this.isActive?e:null),i},e.prototype.createDateObject=function(){var t=this.getDateObjectOptions();return new s.DateObject((0,h.extend)({},t))},e.prototype.getDateObjectOptions=function(){return{intlService:this.options.intlService,formatPlaceholder:this.options.formatPlaceholder?this.options.formatPlaceholder:"formatPattern",format:this.inputFormat,cycleTime:this.options.cycleTime,twoDigitYearMax:this.options.twoDigitYearMax,autoCorrectParts:this.options.autoCorrectParts,value:this.options.value,toggleDayPeriod:this.options.toggleDayPeriod}},e.prototype.keyEventMatchesAutoSwitchKeys=function(t){var e=(this.options.autoSwitchKeys||[]).map((function(t){return t.toString().toLowerCase().trim()}));return e.indexOf(t.keyCode.toString())>=0||e.indexOf(t.keyCode)>=0||e.indexOf(t.key.toLowerCase().trim())>=0},e.prototype.autoFill=function(){var t,e,i,n,a,s,r=this.dateObject,o=new Date;(r.date||r.month||r.year||r.hours||r.minutes||r.seconds)&&(i=r.year?r.value.getFullYear():o.getFullYear(),e=r.month?r.value.getMonth():o.getMonth(),t=r.date?r.value.getDate():o.getDate(),n=r.hours?r.value.getHours():o.getHours(),a=r.minutes?r.value.getMinutes():o.getMinutes(),s=r.seconds?r.value.getSeconds():o.getSeconds(),r.setValue(new Date(i,e,t,n,a,s)),this.refreshElementValue(),this.triggerValueChange())},e}(u.Observable);e.DateInput=T},655:(t,e)=>{var i;Object.defineProperty(e,"__esModule",{value:!0}),e.DateInputInteractionMode=void 0,function(t){t.None="none",t.Caret="caret",t.Selection="selection"}(i||(e.DateInputInteractionMode=i={}))},506:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isInRange=e.dateSymbolMap=e.approximateStringMatching=e.unpadZero=e.padZero=void 0;var n=i(761),a=i(503);e.padZero=function(t){return new Array(Math.max(t,0)).fill("0").join("")},e.unpadZero=function(t){return t.replace(/^0*/,"")},e.approximateStringMatching=function(t){var e=t.oldText,i=t.newText,s=t.formatPattern,r=t.selectionStart,o=t.isInCaretMode,l=t.keyEvent,h=r+e.length-i.length,u=e[h],c=e.substring(0,h),d=i.substring(0,r),p=[];if(c===d&&r>0)return p.push([s[r-1],d[r-1]]),p;if(0===c.indexOf(d)&&o&&(l.key===a.Key.DELETE||l.key===a.Key.BACKSPACE)||0===c.indexOf(d)&&!o&&(0===d.length||s[d.length-1]!==s[d.length])){var m="";o||1!==d.length||p.push([s[0],d[0]]);for(var v=d.length;v<c.length;v++)s[v]!==m&&s[v]!==n.Constants.formatSeparator&&(m=s[v],p.push([m,""]));return p}if(o&&(0===d.indexOf(c)||s[r-1]===n.Constants.formatSeparator)||!o&&(0===d.indexOf(c)||s[r-1]===n.Constants.formatSeparator)){var g=s[0];for(v=Math.max(0,c.length-1);v<s.length;v++)if(s[v]!==n.Constants.formatSeparator){g=s[v];break}return[[g,d[r-1]]]}return" "===d[d.length-1]||d[d.length-1]===u&&"_"===s[h]?[[s[r-1],n.Constants.formatSeparator]]:[[s[r-1],d[r-1]]]},e.dateSymbolMap=function(t,e){return t[e.pattern[0]]=e.type,t},e.isInRange=function(t,e,i){return null===t||!(e&&e>t||i&&i<t)}},231:e=>{e.exports=t},426:t=>{t.exports=e}},n={};function a(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={exports:{}};return i[t](s,s.exports,a),s.exports}var s={};return(()=>{var t=s;Object.defineProperty(t,"__esModule",{value:!0}),t.DateInput=void 0;var e=a(415);Object.defineProperty(t,"DateInput",{enumerable:!0,get:function(){return e.DateInput}})})(),s})()));
@@ -161,7 +161,6 @@ var DateObject = /** @class */ (function () {
161
161
  // and a month that has 31 days
162
162
  // so that the default date can accommodate maximum date values
163
163
  // it is better to use a fixed date instead of new Date()
164
- // as otherwise the
165
164
  return createDate(DEFAULT_LEAP_YEAR, 0, 31);
166
165
  };
167
166
  /**
@@ -671,10 +670,28 @@ var DateObject = /** @class */ (function () {
671
670
  var segmentLength = datePartEndIndex - datePartStartIndex + 1;
672
671
  var formatToTextLengthDiff = originalFormat.length - rawInputValue.length;
673
672
  if (isInCaretMode || (!isInCaretMode && !this.autoCorrectParts)) {
673
+ var segmentCharIndex = 0;
674
674
  for (var i = 0; i < baseDate.length; i++) {
675
675
  if (baseFormat[i] === symbol) {
676
676
  var existing = this.getExisting(symbol);
677
- current += existing ? baseDate[i] : '0';
677
+ if (symbol === "y") {
678
+ if (!this.hasInvalidDatePart() && this.getExisting("y")) {
679
+ current += baseDate[i];
680
+ }
681
+ else {
682
+ var invalidDatePartValue = this.getInvalidDatePartValue(symbol);
683
+ if (isPresent(invalidDatePartValue)) {
684
+ current += (invalidDatePartValue || "").toString()[segmentCharIndex] || "";
685
+ segmentCharIndex++;
686
+ }
687
+ else {
688
+ current += existing ? baseDate[i] : '0';
689
+ }
690
+ }
691
+ }
692
+ else {
693
+ current += existing ? baseDate[i] : '0';
694
+ }
678
695
  if (formatToTextLengthDiff > 0) {
679
696
  if (datePartText.length + formatToTextLengthDiff < segmentLength) {
680
697
  datePartText += rawInputValue[i] || "";
@@ -711,10 +728,28 @@ var DateObject = /** @class */ (function () {
711
728
  prefix = "";
712
729
  suffix = "";
713
730
  replaced = false;
731
+ var segmentCharIndex_1 = 0;
714
732
  for (var i = 0; i < originalFormat.length; i++) {
715
733
  if (originalFormat[i] === symbol) {
716
734
  var existing = this.getExisting(symbol);
717
- current += existing ? baseDate[i] || "" : '0';
735
+ if (symbol === "y") {
736
+ if (!this.hasInvalidDatePart() && this.getExisting("y")) {
737
+ current += baseDate[i];
738
+ }
739
+ else {
740
+ var invalidDatePartValue = this.getInvalidDatePartValue(symbol);
741
+ if (isPresent(invalidDatePartValue)) {
742
+ current += (invalidDatePartValue || "").toString()[segmentCharIndex_1] || "";
743
+ segmentCharIndex_1++;
744
+ }
745
+ else {
746
+ current += existing ? baseDate[i] : '0';
747
+ }
748
+ }
749
+ }
750
+ else {
751
+ current += existing ? baseDate[i] || "" : '0';
752
+ }
718
753
  if (formatToTextLengthDiff > 0) {
719
754
  if (datePartText.length + formatToTextLengthDiff < segmentLength) {
720
755
  datePartText += rawInputValue[i] || "";
@@ -763,7 +798,7 @@ var DateObject = /** @class */ (function () {
763
798
  }
764
799
  }
765
800
  var parsedDate = null;
766
- var month = this.matchMonth(currentChar);
801
+ var monthByChar = this.matchMonth(currentChar);
767
802
  var dayPeriod = this.matchDayPeriod(currentChar, symbol);
768
803
  var isZeroCurrentChar = currentChar === '0';
769
804
  var leadingZero = this.leadingZero || {};
@@ -837,7 +872,7 @@ var DateObject = /** @class */ (function () {
837
872
  }
838
873
  var isCurrentCharParsable = !isNaN(parseInt(currentChar, 10)) || (isInCaretMode && isDeleting && currentChar === "");
839
874
  if (!parsedDate && !isNaN(middleNumber) && isCurrentCharParsable && this.autoCorrectParts) {
840
- if (symbol === MONTH_SYMBOL && !month) {
875
+ if (symbol === MONTH_SYMBOL && !monthByChar) {
841
876
  // JS months start from 0 (January) instead of 1 (January)
842
877
  var monthNumber = middleNumber - JS_MONTH_OFFSET;
843
878
  if (monthNumber > -1 && monthNumber < 12) {
@@ -896,6 +931,10 @@ var DateObject = /** @class */ (function () {
896
931
  this.resetInvalidDateSymbol("M");
897
932
  }
898
933
  }
934
+ else if (symbol === "y") {
935
+ // if the parsed date is valid, make the whole value valid
936
+ this.markDatePartsAsExisting();
937
+ }
899
938
  if (!this.hasInvalidDatePart()) {
900
939
  this.markDatePartsAsExisting();
901
940
  if (!peekResult.peekedDate && peekResult.switchToNext && !this.autoCorrectParts) {
@@ -918,8 +957,8 @@ var DateObject = /** @class */ (function () {
918
957
  return extend(parseResult, { value: this.value, switchToNext: switchToNext });
919
958
  }
920
959
  }
921
- if (month) {
922
- parsedDate = this.intl.parseDate(prefix + month + suffix, this.format, this.localeId);
960
+ if (monthByChar) {
961
+ parsedDate = this.intl.parseDate(prefix + monthByChar + suffix, this.format, this.localeId);
923
962
  if (parsedDate) {
924
963
  this._value = parsedDate;
925
964
  this.setExisting(symbol, true);
@@ -966,27 +1005,28 @@ var DateObject = /** @class */ (function () {
966
1005
  datePartValue = symbol === "M" ?
967
1006
  parsedValue - JS_MONTH_OFFSET :
968
1007
  parsedValue;
1008
+ var isYear = symbol === "y";
969
1009
  var isMonth = symbol === "M";
970
1010
  var isDay = symbol === "d";
971
1011
  var newValue = cloneDate(this._value);
972
1012
  var invalidDateParts = this._partiallyInvalidDate.invalidDateParts || {};
973
- var year = invalidDateParts.y.value || newValue.getFullYear();
1013
+ var year = isYear ? datePartValue : invalidDateParts.y.value || newValue.getFullYear();
974
1014
  /* tslint:disable:no-shadowed-variable */
975
- var month_1 = isMonth ? datePartValue : invalidDateParts.M.value || newValue.getMonth();
1015
+ var month = isMonth ? datePartValue : invalidDateParts.M.value || newValue.getMonth();
976
1016
  /* tslint:enable:no-shadowed-variable */
977
1017
  var day = isDay ? datePartValue : invalidDateParts.d.value || invalidDateParts.E.value || newValue.getDate();
978
1018
  var hour = invalidDateParts.h.value || invalidDateParts.H.value || newValue.getHours();
979
1019
  var minutes = invalidDateParts.m.value || newValue.getMinutes();
980
1020
  var seconds = invalidDateParts.s.value || newValue.getSeconds();
981
1021
  var milliseconds = invalidDateParts.S.value || newValue.getMilliseconds();
982
- var dateCandidate = createDate(year, month_1, day, hour, minutes, seconds, milliseconds);
983
- var dateCandidateExists = areDatePartsEqualTo(dateCandidate, year, month_1, day, hour, minutes, seconds, milliseconds);
984
- var newValueCandidate = isMonth || isDay ?
985
- this.modifyDateSymbolWithValue(newValue, symbol, isMonth ? month_1 : day) :
1022
+ var dateCandidate = createDate(year, month, day, hour, minutes, seconds, milliseconds);
1023
+ var dateCandidateExists = areDatePartsEqualTo(dateCandidate, year, month, day, hour, minutes, seconds, milliseconds);
1024
+ var newValueCandidate = isYear || isMonth || isDay ?
1025
+ this.modifyDateSymbolWithValue(newValue, symbol, isYear ? year : isMonth ? month : day) :
986
1026
  null;
987
1027
  var invalidDateFound = false;
988
1028
  if (isMonth && newValueCandidate) {
989
- if (newValueCandidate.getMonth() === month_1) {
1029
+ if (newValueCandidate.getMonth() === month) {
990
1030
  if (this.getExisting("d")) {
991
1031
  if (dateCandidateExists) {
992
1032
  newValue = cloneDate(dateCandidate);
@@ -995,7 +1035,7 @@ var DateObject = /** @class */ (function () {
995
1035
  else {
996
1036
  invalidDateFound = true;
997
1037
  this.setInvalidDatePart(symbol, {
998
- value: month_1,
1038
+ value: month,
999
1039
  date: cloneDate(newValueCandidate),
1000
1040
  startDate: cloneDate(this.value)
1001
1041
  });
@@ -1019,7 +1059,7 @@ var DateObject = /** @class */ (function () {
1019
1059
  else {
1020
1060
  invalidDateFound = true;
1021
1061
  this.setInvalidDatePart(symbol, {
1022
- value: month_1,
1062
+ value: month,
1023
1063
  date: cloneDate(newValueCandidate),
1024
1064
  startDate: cloneDate(this.value)
1025
1065
  });
@@ -1067,6 +1107,46 @@ var DateObject = /** @class */ (function () {
1067
1107
  this.setExisting(symbol, false);
1068
1108
  }
1069
1109
  }
1110
+ else if (isYear && newValueCandidate) {
1111
+ if (newValueCandidate.getFullYear() === year) {
1112
+ if (this.getExisting("d") && this.getExisting("M")) {
1113
+ if (dateCandidateExists) {
1114
+ newValue = cloneDate(dateCandidate);
1115
+ this.resetInvalidDateSymbol(symbol);
1116
+ }
1117
+ else {
1118
+ invalidDateFound = true;
1119
+ this.setInvalidDatePart(symbol, {
1120
+ value: year,
1121
+ date: cloneDate(newValueCandidate),
1122
+ startDate: cloneDate(this.value)
1123
+ });
1124
+ this.setExisting(symbol, false);
1125
+ }
1126
+ }
1127
+ else if (dateCandidateExists) {
1128
+ this.resetInvalidDateSymbol(symbol);
1129
+ newValue = cloneDate(dateCandidate);
1130
+ if (this.getExisting("M") && this.getExisting("d")) {
1131
+ this.setExisting("y", true);
1132
+ this.resetInvalidDateSymbol("y");
1133
+ }
1134
+ }
1135
+ else {
1136
+ this.resetInvalidDateSymbol(symbol);
1137
+ newValue = cloneDate(newValueCandidate);
1138
+ }
1139
+ }
1140
+ else {
1141
+ invalidDateFound = true;
1142
+ this.setInvalidDatePart(symbol, {
1143
+ value: year,
1144
+ date: cloneDate(newValueCandidate),
1145
+ startDate: cloneDate(this.value)
1146
+ });
1147
+ this.setExisting(symbol, false);
1148
+ }
1149
+ }
1070
1150
  if (!invalidDateFound) {
1071
1151
  this.setExisting(symbol, true);
1072
1152
  if (isInCaretMode && !isValidDate(parsedDate)) {