UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines (2 loc) 48 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("kendo.date-math.cmn.chunk.js")):"function"==typeof define&&define.amd?define(["exports","kendo.date-math.cmn.chunk"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).kendo=t.kendo||{},t.kendo._globals=t.kendo._globals||{},t.kendo._globals.DateinputsCommonCmnChunk={}),t.kendo._globals.DateMathCmnChunk)}(this,(function(t,e){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},i(t,e)};function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s=function(){return s=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},s.apply(this,arguments)};function r(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))}Object.create;Object.create;function a(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)}function o(t,e,i,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(t,i):s?s.value=i:e.set(t,i),i}"function"==typeof SuppressedError&&SuppressedError;var l,h,u,c=function(){this.symbols="",this.partMap=[]},d="_",p=68,m="d",v="en",f="Delete",g="Backspace",y=" ",D=function(t){return new Array(Math.max(t,0)).fill("0").join("")},E=function(t){return t.replace(/^0*/,"")},b=function(t,e){return t[e.pattern[0]]=e.type,t},P=function(t){return null!=t},S=function(t){return P(t)&&"number"==typeof t&&!Number.isNaN(t)},M=function(t){return parseInt(t,10)},w=function(t){return S(M(t))&&/^[0-9]+$/.test(t)},x=function(t,e,i){return Math.min(i,Math.max(e,t))},I=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Object.assign.apply(Object,t)},O=(l="setFullYear",function(t,i){var n=e.c(t);return n[l](i),n}),V=function(t,e,i,n,s,r,a,o){return!(!t||t.getFullYear()!==e||t.getMonth()!==i||t.getDate()!==n||t.getHours()!==s||t.getMinutes()!==r||t.getSeconds()!==a||t.getMilliseconds()!==o)},F=function(t){return P(t)&&t.getTime&&S(t.getTime())},k=/d|M|H|h|m|s/,C=function(){function t(t){var i=t.intlService,n=t.formatPlaceholder,s=t.format,r=t.cycleTime,a=void 0!==r&&r,o=t.twoDigitYearMax,l=void 0===o?p:o,h=t.value,u=void 0===h?null:h,c=t.autoCorrectParts,d=void 0===c||c;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:i,formatPlaceholder:n,format:s,cycleTime:a,twoDigitYearMax:l,value:u,autoCorrectParts:d}),u)this._value=e.c(u);else{this._value=this.getDefaultDate();for(var m=this.dateFormatString(this.value,this.format).symbols,v=0;v<m.length;v++)this.setExisting(m[v],!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:!0,configurable:!0}),Object.defineProperty(t.prototype,"localeId",{get:function(){for(var t=v,e=Object.keys(this.intl.cldr),i=0;i<e.length;i++){var n=e[i],s=this.intl.cldr[n];if(s.name&&s.calendar&&s.numbers&&s.name!==v){t=s.name;break}}return t},enumerable:!0,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},t.prototype.setValue=function(t){t?e.i(t,this._value)||(this._value=e.c(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 e.c(this.value)},t.prototype.createDefaultDate=function(){return e.a(2e3,0,31)},t.prototype.getDefaultDate=function(){return e.g(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 s="",r=this.intl.formatDate(this.value,e,this.localeId),a=this.getFormattedInvalidDates(e),o=0;o<r.length;o++){var l=n.symbols[o];if("literal"===n.partMap[o].type)s+=i[o];else if(this.getInvalidDatePartValue(l)){var h=this.getPartsForSegment(n,o);if("M"===l){var u=(M(this.getInvalidDatePartValue(l))+1).toString();if(h.length>2)s+=a[l][o];else if(this.getInvalidDatePartValue(l))s+=D(h.length-u.length)+u,o+=h.length-1;else s+=a[l][o]}else if(this.getInvalidDatePartValue(l)){u=this.getInvalidDatePartValue(l).toString();s+=D(h.length-u.length)+u,o+=h.length-1}else s+=a[l][o]}else s+=i[o]}i=s}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 s=e.getInvalidDatePart(t).date;if(s){var r=e.intl.formatDate(s,i,e.localeId);n[t]=r}})),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,i){if(P(t)&&P(i)&&0!==i){var n,s=e.c(this.value),r=!1,a="M"===t,o="d"===t||"E"===t,l=this.getExisting(t);if(this.autoCorrectParts||!o&&!a)switch(t){case"y":s.setFullYear(s.getFullYear()+i);break;case"M":s=e.b(this.value,i);break;case"d":case"E":s.setDate(s.getDate()+i);break;case"h":case"H":s.setHours(s.getHours()+i),r=!0;break;case"m":s.setMinutes(s.getMinutes()+i),r=!0;break;case"s":s.setSeconds(s.getSeconds()+i),r=!0;break;case"S":s.setMilliseconds(s.getMilliseconds()+i);break;case"a":s.setHours(s.getHours()+12*i),r=!0}else{var h=this._partiallyInvalidDate.invalidDateParts||{},u=this.getInvalidDatePartValue(t),c=h.y.value||s.getFullYear(),d=h.M.value||s.getMonth(),p=h.d.value||h.E.value||s.getDate(),m=h.h.value||h.H.value||s.getHours(),v=h.m.value||s.getMinutes(),f=h.s.value||s.getSeconds(),g=h.S.value||s.getMilliseconds();switch(t){case"y":c+=i;break;case"M":d+=i;break;case"d":case"E":p+=i}if("M"===t){if((d<0||d>11)&&l)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(!l){if(d<0)d=x(d%11+1+11,0,11);else{var y=P(u)?d:(i-1)%12;d=x(y,0,11)}d=x(d,0,11)}d=x(d,0,11)}else if("d"===t)if(l){if(p<=0||p>31)return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t)}else if(!l){if(P(u)&&(p<=0||p>31))return this.setExisting(t,!1),void this.resetInvalidDateSymbol(t);if(i<0){var D=P(u)?p:31-Math.abs(i%31)+1;p=x(D,1,31)}else{D=P(u)?p:i%31;p=x(D,1,31)}p=x(p,1,31)}var E=e.a(c,d,p,m,v,f,g),b=a||o?this.modifyDateSymbolWithValue(s,t,a?d:p):null,S=V(E,c,d,p,m,v,f,g);this.getValue()&&V(E,c,d,p,m,v,f,g)?(s=e.c(E),this.markDatePartsAsExisting()):a&&b?b.getMonth()===d?this.getExisting("d")?S?(s=e.c(E),this.resetInvalidDateSymbol(t)):(n=!0,this.setInvalidDatePart(t,{value:d,date:e.c(b),startDateOffset:i,startDate:e.c(this.value)}),this.setExisting(t,!1)):S?(this.resetInvalidDateSymbol(t),s=e.c(E),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(t),s=e.c(b)):(n=!0,this.setInvalidDatePart(t,{value:d,date:e.c(b),startDateOffset:i,startDate:e.c(this.value)}),this.setExisting(t,!1)):o&&b&&(b.getDate()===p?this.getExisting("M")?S?(s=e.c(E),this.resetInvalidDateSymbol(t)):(n=!0,this.setInvalidDatePart(t,{value:p,date:e.c(b),startDateOffset:i,startDate:e.c(this.value)}),this.setExisting(t,!1)):S?(s=e.c(E),this.resetInvalidDateSymbol(t),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(t),s=e.c(b)):(n=!0,this.setInvalidDatePart(t,{value:p,date:e.c(this.value),startDateOffset:i,startDate:e.c(this.value)}),this.setExisting(t,!1)))}this.shouldNormalizeCentury()&&(s=this.normalizeCentury(s)),r&&!this.cycleTime&&(s.getDate(),this._value.getDate()),n||(this.setExisting(t,!0),this._value=s,this.getValue()&&this.resetInvalidDate())}},t.prototype.parsePart=function(t){for(var i=t.symbol,n=t.currentChar,s=t.resetSegmentValue,r=t.cycleSegmentValue,a=t.rawTextValue,o=t.isDeleting,l=t.originalFormat,h=!r,u=this.dateFormatString(this.value,this.format),c=u.partMap.filter((function(t){return"literal"===t.type})).map((function(t,e){return{datePartIndex:e,type:t.type,pattern:t.pattern,literal:""}})),d=u.partMap.map((function(t){return{type:t.type,pattern:t.pattern,text:""}})),p=0;p<c.length;p++){for(var m=c[p],v=0;v<m.pattern.length;v++)c[p+v]&&(c[p+v].literal=m.pattern[v]);p+=m.pattern.length-1}for(p=0;p<d.length;p++){for(m=d[p],v=0;v<m.pattern.length;v++)d[p+v]&&(d[p+v].text=m.pattern[v]);p+=m.pattern.length-1}var f={value:null,switchToNext:!1,resetPart:h&&"M"===i&&u.partMap.filter((function(t){return"month"===t.type})).some((function(t){return t.pattern.length>2})),hasInvalidDatePart:!1};if(!n){if(!h)return this.resetLeadingZero(),this.setExisting(i,!1),this.resetInvalidDateSymbol(i),I(f,{value:null,switchToNext:!1});for(p=0;p<c.length;p++){var g=c[p].literal,y=a.startsWith(g),b=a.endsWith(g),P=a.indexOf(g+g)>=0;if(y||b||P)return this.resetLeadingZero(),this.setExisting(i,!1),this.resetInvalidDateSymbol(i),I(f,{value:null,switchToNext:!1})}}var x=this.intl.formatDate(this.value,this.format,this.localeId),O=u.symbols,k=!1,C="",j="",N="",T="",_="",L="",A="";for(p=0;p<d.length;p++)A+=d[p].text;var H=this.format===O||this.format===A||this.format===l||this.format.length===l.length,K=(H?A:l).indexOf(i),B=(H?A:l).lastIndexOf(i)-K+1,W=l.length-a.length;if(h||!h&&!this.autoCorrectParts){for(p=0;p<x.length;p++){if(O[p]===i)j+=this.getExisting(i)?x[p]:"0",W>0?N.length+W<B&&(N+=a[p]||""):N+=a[p]||"",k=!0;else k?(L+=x[p],_+=x[p]):(C+=x[p],T+=x[p])}if(H&&(A.length<a.length?N+=n:!o&&(l.length,a.length),N.length>B))return I(f,{value:null,switchToNext:!1});if(!H||H&&!this.autoCorrectParts){j="",N="",C="",L="",k=!1;for(p=0;p<l.length;p++){if(l[p]===i)j+=this.getExisting(i)?x[p]||"":"0",W>0?N.length+W<B&&(N+=a[p]||""):N+=a[p]||"",k=!0;else k?L+=a[p-W]||"":C+=a[p]||""}l.length<a.length&&(N+=n)}}if(!h)if(this.autoCorrectParts){j="",N="",C="",L="",k=!1;for(p=0;p<x.length;p++){if(O[p]===i)j+=this.getExisting(i)?x[p]:"0",k=!0;else k?L+=x[p]:C+=x[p]}}else j=s?N:j;var Z=null,Y=this.matchMonth(n),U=this.matchDayPeriod(n,i),z="0"===n,R=this.leadingZero||{};z?("0"===N&&(N=j),0!==M(s?n:(h?N:j)+n)||this.isAbbrMonth(u.partMap,i)||this.incrementLeadingZero(i)):this.resetLeadingZero();var q=this.partPattern(u.partMap,i),J=q?q.pattern:null,$=this.patternLength(J)||J.length;if(h&&o&&!N)return this.setExisting(i,!1),I(f,{value:null,switchToNext:!1});var G=j.length-3,Q=!0,X=h?N:j;for(p=Math.max(0,G);p<=j.length&&Q;p++){X=s?n:h?N:j.substring(p)+n,!h&&this.autoCorrectParts||(Q=!1,X=E(X),X=D($-X.length)+X);var tt=parseInt(X,10),et=C+X+L;Z=this.intl.parseDate(et,this.format,this.localeId);var it=!1;h&&!F(Z)&&this.autoCorrectParts&&(Z=this.intl.parseDate(T+X+_,this.format,this.localeId),it=!0);var nt=!isNaN(parseInt(n,10))||h&&o&&""===n;if(!Z&&!isNaN(tt)&&nt&&this.autoCorrectParts){if("M"===i&&!Y){var st=tt-1;st>-1&&st<12&&((Z=e.c(this.value)).setMonth(st),Z.getMonth()!==st&&(Z=e.l(e.b(Z,-1))))}"y"===i&&(Z=e.a(parseInt(X,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),(h&&F(Z)||!h&&Z)&&this.date&&Z.getDate()!==this.value.getDate()&&(Z=e.l(e.b(Z,-1))))}if(h&&F(Z)||!h&&Z){var rt=this.isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:it,middle:X,patternValue:J,basePrefix:T,baseSuffix:_,prefix:C,suffix:L,symbol:i,patternLength:$,leadingZero:R}),at=rt.switchToNext;return this.shouldNormalizeCentury()&&(Z=this.normalizeCentury(Z)),"H"===i&&Z.getHours()>=12&&this.setExisting("a",!0),this._value=Z,this.setExisting(i,!0),this.resetInvalidDateSymbol(i),this.autoCorrectParts||("M"===i?this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d")):"d"===i&&this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M")),this.hasInvalidDatePart()||(this.markDatePartsAsExisting(),rt.peekedDate||!rt.switchToNext||this.autoCorrectParts||"M"===i||"d"===i&&30===rt.parsedPeekedValue&&1===this.value.getMonth()&&(at=!1))),I(f,{value:this.value,switchToNext:at})}}if(Y&&(Z=this.intl.parseDate(C+Y+L,this.format,this.localeId)))return this._value=Z,this.setExisting(i,!0),I(f,{value:this.value,switchToNext:!1});if(U&&(Z=this.intl.parseDate(C+U+L,this.format)||this.intl.parseDate(T+U+_,this.format)))return this._value=Z,this.setExisting(i,!0),I(f,{value:this.value,switchToNext:!0});if(z&&this.setExisting(i,!1),!this.autoCorrectParts){var ot=void 0,lt=h?N:X,ht=M(lt);if(S(ht)&&w(lt)){if("d"===i&&(ht<=0||ht>31)||"M"===i&&(ht<=0||ht>11)){if(h)return I(f,{value:null,switchToNext:!1});ht=M(lt=n)}if(!S(ht)||!w(lt))return I(f,{value:null,switchToNext:!1});ot="M"===i?ht-1:ht;var ut="M"===i,ct="d"===i,dt=e.c(this._value),pt=this._partiallyInvalidDate.invalidDateParts||{},mt=pt.y.value||dt.getFullYear(),vt=ut?ot:pt.M.value||dt.getMonth(),ft=ct?ot:pt.d.value||pt.E.value||dt.getDate(),gt=pt.h.value||pt.H.value||dt.getHours(),yt=pt.m.value||dt.getMinutes(),Dt=pt.s.value||dt.getSeconds(),Et=pt.S.value||dt.getMilliseconds(),bt=e.a(mt,vt,ft,gt,yt,Dt,Et),Pt=V(bt,mt,vt,ft,gt,yt,Dt,Et),St=ut||ct?this.modifyDateSymbolWithValue(dt,i,ut?vt:ft):null,Mt=!1;if(ut&&St?St.getMonth()===vt?this.getExisting("d")?Pt?(dt=e.c(bt),this.resetInvalidDateSymbol(i)):(Mt=!0,this.setInvalidDatePart(i,{value:vt,date:e.c(St),startDate:e.c(this.value)}),this.setExisting(i,!1)):Pt?(this.resetInvalidDateSymbol(i),dt=e.c(bt),this.getExisting("M")&&this.getExisting("y")&&(this.setExisting("d",!0),this.resetInvalidDateSymbol("d"))):(this.resetInvalidDateSymbol(i),dt=e.c(St)):(Mt=!0,this.setInvalidDatePart(i,{value:vt,date:e.c(St),startDate:e.c(this.value)}),this.setExisting(i,!1)):ct&&St&&(St.getDate()===ft?this.getExisting("M")?Pt?(dt=e.c(bt),this.resetInvalidDateSymbol(i)):(Mt=!0,this.setInvalidDatePart(i,{value:ft,date:e.c(St),startDate:e.c(this.value)}),this.setExisting(i,!1)):Pt?(dt=e.c(bt),this.resetInvalidDateSymbol(i),this.getExisting("d")&&this.getExisting("y")&&(this.setExisting("M",!0),this.resetInvalidDateSymbol("M"))):(this.resetInvalidDateSymbol(i),dt=e.c(St)):(Mt=!0,this.setInvalidDatePart(i,{value:ft,date:e.c(this.value),startDate:e.c(this.value)}),this.setExisting(i,!1))),!Mt){if(this.setExisting(i,!0),h&&!F(Z)){var wt=this.intl.parseDate(T+X+_,this.format,this.localeId);F(wt)&&(this._value=wt)}else this._value=dt;this.getValue()&&this.resetInvalidDate()}at=!1;if("M"===i)at=ht>=2||lt.length>=2;else if(H)at=this.isPeekDateOverflowingDatePart({useBasePrefixAndSuffix:!this.autoCorrectParts,middle:X,patternValue:J,basePrefix:T,baseSuffix:_,prefix:C,suffix:L,symbol:i,patternLength:$,leadingZero:R}).switchToNext;else at=lt.length>B;return I(f,{value:null,switchToNext:at,hasInvalidDatePart:Mt})}}return I(f,{value:null,switchToNext:!1})},t.prototype.symbolMap=function(t){return this.intl.splitDateFormat(this.format,this.localeId).reduce(b,{})[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(!P(t))return t;var e=function(t){return!P(t)||isNaN(t.getTime())?0:Number(t.getFullYear().toString().slice(-2))}(t),i=this.getNormalizedCenturyBase(e);return O(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 D(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:k.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 a=this.intl.formatDate(t,{pattern:i[r].pattern},this.localeId).length;a>0;)n.push(this.symbols[i[r].pattern[0]]||d),s.push(i[r]),a--;var o=new c;return o.symbols=n.join(""),o.partMap=s,o},t.prototype.merge=function(t,e){for(var i="",n="",s=e.symbols,r=!1,a=0,o=this.getFormattedInvalidDates(s),l=s.length-1;l>=0;l--){var h=this.getPartsForSegment(e,l);if(-1===this.knownParts.indexOf(s[l])||this.getExisting(s[l]))this.autoCorrectParts?i=t[l]+i:t.length!==s.length?r?i=t[l]+i:a>0?(i=t[l]+i,--a<=0&&(r=!0)):i=(t[l+t.length-s.length]||"")+i:i=t[l]+i,n=s[l]+n;else{var u=s[l],c=0;if(this.autoCorrectParts||!this.autoCorrectParts&&!this.getInvalidDatePartValue(u)){for(;l>=0&&u===s[l];)l--;l++}if(this.leadingZero&&this.leadingZero[u])i="0"+i;else if(!this.autoCorrectParts&&this.getInvalidDatePartValue(u)){var d=this.getInvalidDatePartValue(u).toString();if("M"===u)if(d=(M(this.getInvalidDatePartValue(u))+1).toString(),h.length>2)i=o[u][l]+i;else d=(M(this.getInvalidDatePartValue(u))+1).toString(),i=D(h.length-d.length)+d+i,c=h.length-1,a=d.length-h.length;else i=D(h.length-d.length)+d+i,c=h.length-1,a=d.length-h.length}else i=this.dateFieldName(e.partMap[l])+i;for(;n.length<i.length;)n=s[l]+n;0!==c&&(l=l-c+(t.length-s.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]&&P(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,s=e.date,r=void 0===s?null:s,a=e.startDateOffset,o=void 0===a?0:a,l=e.startDate,h=void 0===l?null:l;this._partiallyInvalidDate.invalidDateParts[t]&&(this._partiallyInvalidDate.invalidDateParts[t].value=n,this._partiallyInvalidDate.invalidDateParts[t].date=r,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]&&P(t._partiallyInvalidDate.invalidDateParts[i].value)&&(e=!0)})),e},t.prototype.modifyDateSymbolWithOffset=function(t,i,n){var s=e.c(t),r=!1;switch(i){case"y":s.setFullYear(s.getFullYear()+n);break;case"M":s=e.b(this.value,n);break;case"d":case"E":s.setDate(s.getDate()+n);break;case"h":case"H":s.setHours(s.getHours()+n),r=!0;break;case"m":s.setMinutes(s.getMinutes()+n),r=!0;break;case"s":s.setSeconds(s.getSeconds()+n),r=!0;break;case"S":s.setMilliseconds(s.getMilliseconds()+n);break;case"a":s.setHours(s.getHours()+12*n),r=!0}return{date:s,timeModified:r}},t.prototype.modifyDateSymbolWithValue=function(t,i,n){var s=e.c(t);switch(i){case"y":s.setFullYear(n);break;case"M":s=e.b(t,n-t.getMonth());break;case"d":case"E":s.setDate(n);break;case"h":case"H":case"a":s.setHours(n);break;case"m":s.setMinutes(n);break;case"s":s.setSeconds(n);break;case"S":s.setMilliseconds(n)}return s},t.prototype.markDatePartsAsExisting=function(){this.modifyExisting(!0)},t.prototype.getPartsForSegment=function(t,e){for(var i=t.partMap[e],n=[],s=e;s<t.partMap.length;s++){var r=t.partMap[s];if(i.type!==r.type||i.pattern!==r.pattern)break;n.push(r)}for(s=e-1;s>=0;s--){r=t.partMap[s];if(i.type!==r.type||i.pattern!==r.pattern)break;n.unshift(r)}return n},t.prototype.isPeekDateOverflowingDatePart=function(t){var e=t.useBasePrefixAndSuffix,i=t.middle,n=t.patternValue,s=t.basePrefix,r=t.baseSuffix,a=t.prefix,o=t.suffix,l=t.symbol,h=t.patternLength,u=t.leadingZero,c=this.peek(i,n),d=e?""+s+c+r:""+a+c+o,p=this.intl.parseDate(d,this.format,this.localeId),m=((this.leadingZero||{})[l]||0)+E(i).length>=h;return{peekedDate:p,peekedDateString:d,peekedValue:c,parsedPeekedValue:M(c),switchToNext:null===p||(u[l]?n.length<=i.length:m)}},t}(),j=8,N=46,T=9,_=13,L=37,A=38,H=39,K=40,B=35,W=36,Z={events:{}},Y=function(){function t(t){this.options=I({},Z,t)}return t.prototype.destroy=function(){},t.prototype.trigger=function(t,e){void 0===e&&(e={});var i={defaultPrevented:!1,preventDefault:function(){i.defaultPrevented=!0}};return"function"==typeof this.options.events[t]&&(this.options.events[t](I(i,e,{sender:this})),i.defaultPrevented)},t}();!function(t){t.None="none",t.Caret="caret",t.Selection="selection"}(h||(h={}));var U="dragStart",z="drop",R="touchstart",q="mousedown",J="mouseup",$="click",G="input",Q="keydown",X="focus",tt="blur",et="paste",it="DOMMouseScroll",nt="mousewheel",st="valueChange",rt="inputEnd",at="blurEnd",ot="focusEnd",lt="change",ht={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:(u={},u[st]=null,u[G]=null,u[rt]=null,u[X]=null,u[ot]=null,u[tt]=null,u[at]=null,u[Q]=null,u[nt]=null,u[lt]=null,u),selectNearestSegmentOnFocus:!1,selectPreviousSegmentOnBackspace:!1,enableMouseWheel:!1,allowCaretMode:!1,autoSwitchParts:!0,autoSwitchKeys:[],twoDigitYearMax:p,autoCorrectParts:!0,autoFill:!1},ut=function(t){function i(e,i){var n=t.call(this,i)||this;return n.dateObject=null,n.currentText="",n.currentFormat="",n.interactionMode=h.None,n.previousElementSelection={start:0,end:0},n.init(e,i),n}return n(i,t),Object.defineProperty(i.prototype,"value",{get:function(){return this.dateObject&&this.dateObject.getValue()},enumerable:!0,configurable:!0}),i.prototype.init=function(t,i){var n=F(this.options.value)?e.c(this.options.value):new Date(i.formattedValue);F(n)||(n=null),this.element=t,this.options=I({},ht,i,{steps:s({},ht.steps,i.steps)}),this.intl=this.options.intlService,this.dateObject=this.createDateObject(),this.dateObject.setValue(n),this.setTextAndFormat(),this.bindEvents(),this.resetSegmentValue=!0,this.interactionMode=h.None,this.forceUpdate()},i.prototype.destroy=function(){this.unbindEvents(),this.dateObject=null,t.prototype.destroy.call(this)},i.prototype.bindEvents=function(){this.onElementDragStart=this.onElementDragStart.bind(this),this.element.addEventListener(U,this.onElementDragStart),this.onElementDrop=this.onElementDrop.bind(this),this.element.addEventListener(z,this.onElementDrop),this.onElementClick=this.onElementClick.bind(this),this.element.addEventListener($,this.onElementClick),this.onElementMouseDown=this.onElementMouseDown.bind(this),this.element.addEventListener(q,this.onElementMouseDown),this.element.addEventListener(R,this.onElementMouseDown),this.onElementMouseUp=this.onElementMouseUp.bind(this),this.element.addEventListener(J,this.onElementMouseUp),this.onElementInput=this.onElementInput.bind(this),this.element.addEventListener(G,this.onElementInput),this.onElementKeyDown=this.onElementKeyDown.bind(this),this.element.addEventListener(Q,this.onElementKeyDown),this.onElementFocus=this.onElementFocus.bind(this),this.element.addEventListener(X,this.onElementFocus),this.onElementBlur=this.onElementBlur.bind(this),this.element.addEventListener(tt,this.onElementBlur),this.onElementChange=this.onElementChange.bind(this),this.element.addEventListener(lt,this.onElementChange),this.onElementPaste=this.onElementPaste.bind(this),this.element.addEventListener(et,this.onElementPaste),this.onElementMouseWheel=this.onElementMouseWheel.bind(this),this.element.addEventListener(it,this.onElementMouseWheel),this.element.addEventListener(nt,this.onElementMouseWheel)},i.prototype.unbindEvents=function(){this.element.removeEventListener(U,this.onElementDragStart),this.element.removeEventListener(z,this.onElementDrop),this.element.removeEventListener(R,this.onElementMouseDown),this.element.removeEventListener(q,this.onElementMouseDown),this.element.removeEventListener(J,this.onElementMouseUp),this.element.removeEventListener($,this.onElementClick),this.element.removeEventListener(G,this.onElementInput),this.element.removeEventListener(Q,this.onElementKeyDown),this.element.removeEventListener(X,this.onElementFocus),this.element.removeEventListener(tt,this.onElementBlur),this.element.removeEventListener(lt,this.onElementChange),this.element.removeEventListener(et,this.onElementPaste),this.element.removeEventListener(it,this.onElementMouseWheel),this.element.removeEventListener(nt,this.onElementMouseWheel)},i.prototype.setOptions=function(t,e){void 0===e&&(e=!1),this.options=I({},this.options,t,{steps:s({},ht.steps,t.steps)}),this.setDateObjectOptions(),e&&(this.unbindEvents(),this.init(this.element,this.options))},i.prototype.setDateObjectOptions=function(){if(this.dateObject){var t=this.getDateObjectOptions();this.dateObject.setOptions(t)}},i.prototype.resetLocale=function(){this.unbindEvents(),this.init(this.element,this.options)},i.prototype.isInCaretMode=function(){return this.interactionMode===h.Caret},i.prototype.focus=function(){this.element.focus(),this.options.selectNearestSegmentOnFocus&&this.selectNearestSegment(0)},i.prototype.onElementDragStart=function(t){t.preventDefault()},i.prototype.onElementDrop=function(t){t.preventDefault()},i.prototype.onElementMouseDown=function(){this.mouseDownStarted=!0,this.focusedPriorToMouseDown=this.isActive},i.prototype.onElementMouseUp=function(t){this.mouseDownStarted=!1,t.preventDefault()},i.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=P(this.options.placeholder)&&!this.dateObject.hasValue()&&!this.focusedPriorToMouseDown,s=!i&&n?0:this.caret()[0];this.selectNearestSegment(s)}else this.setSelection(this.selectionByIndex(e.start))},i.prototype.onElementInput=function(t){this.triggerInput({event:t});var i=this.elementValue;if(this.element&&this.dateObject){var n=this.switchedPartOnPreviousKeyAction;if(this.isPasteInProgress)return this.options.allowCaretMode&&(this.resetSegmentValue=!1),this.updateOnPaste(t),void(this.isPasteInProgress=!1);var s=this.keyDownEvent||{},r=s.keyCode===j||s.key===g,a=s.keyCode===N||s.key===f,o=this.interactionMode;!this.options.allowCaretMode||o===h.Caret||a||r||(this.resetSegmentValue=!0),this.options.allowCaretMode?this.interactionMode=h.Caret:this.interactionMode=h.Selection;var l=this.isInCaretMode();if(l&&this.keyDownEvent.key===y)this.restorePreviousInputEventState();else{var u=this.dateObject&&this.dateObject.getValue(),c=this.dateObject?this.dateObject.value:null,p=this.dateObject.getTextAndFormat(),m=p.text,v=p.format;this.currentFormat=v;var D=function(t){var e=t.oldText,i=t.newText,n=t.formatPattern,s=t.selectionStart,r=t.isInCaretMode,a=t.keyEvent,o=s+e.length-i.length,l=e[o],h=e.substring(0,o),u=i.substring(0,s),c=[];if(h===u&&s>0)return c.push([n[s-1],u[s-1]]),c;if(0===h.indexOf(u)&&r&&(a.key===f||a.key===g)||0===h.indexOf(u)&&!r&&(0===u.length||n[u.length-1]!==n[u.length])){var p="";r||1!==u.length||c.push([n[0],u[0]]);for(var m=u.length;m<h.length;m++)n[m]!==p&&n[m]!==d&&(p=n[m],c.push([p,""]));return c}if(r&&(0===u.indexOf(h)||n[s-1]===d)||!r&&(0===u.indexOf(h)||n[s-1]===d)){var v=n[0];for(m=Math.max(0,h.length-1);m<n.length;m++)if(n[m]!==d){v=n[m];break}return[[v,u[s-1]]]}return" "===u[u.length-1]||u[u.length-1]===l&&"_"===n[o]?[[n[s-1],d]]:[[n[s-1],u[s-1]]]}({oldText:l&&(r||a||o===h.Caret)?this.previousElementValue:m,newText:this.elementValue,formatPattern:this.currentFormat,selectionStart:this.selection.start,isInCaretMode:l,keyEvent:this.keyDownEvent});if(D&&D.length&&D[0]&&D[0][1]!==d&&(this.switchedPartOnPreviousKeyAction=!1),!l||D&&0!==D.length){if(l&&1===D.length){if(!D[0]||!D[0][0])return void this.restorePreviousInputEventState();if(l&&D[0]&&(D[0][0]===d||D[0][1]===d))return void this.restorePreviousInputEventState()}var E=1===D.length&&D[0][1]===d,b=[],S=!1,M=null;if(!E)for(var w=0;w<D.length;w++){var x=this.dateObject.parsePart({symbol:D[w][0],currentChar:D[w][1],resetSegmentValue:this.resetSegmentValue,cycleSegmentValue:!this.isInCaretMode(),rawTextValue:this.element.value,isDeleting:r||a,originalFormat:this.currentFormat});b.push(x),x.value||(M={type:"parse"}),S=x.switchToNext}this.options.autoSwitchParts||(S=!1),this.resetSegmentValue=!1;var I,O=this.options.format===this.currentFormat||P(this.options.format)&&this.options.format.length>1,V=b[b.length-1],F=V&&!P(V.value),k=l&&(r||a)&&F,C=!!V&&V.resetPart,T=this.dateObject.getValue(),_=!e.i(u,T),L=this.dateObject.value,A=this.selection;if(l){var H=D&&D.length>0?D[0][0]:null,K=this.dateObject.getLeadingZero()[H];D.length&&D[0][0]!==d?S?(this.forceUpdateWithSelection(),this.switchDateSegment(1)):C?(I=this.currentFormat[A.start])?(this.forceUpdate(),this.setSelection(this.selectionBySymbol(I))):this.restorePreviousInputEventState():k?(this.forceUpdate(),D.length&&D[0][0]!==d&&this.setSelection(this.selectionBySymbol(D[0][0]))):F?"0"===t.data&&K||(P(u)&&!P(T)?this.restorePreviousInputEventState():!P(u)&&P(T)?this.forceUpdateWithSelection():P(u)&&P(T)?_?this.forceUpdateWithSelection():this.restorePreviousInputEventState():P(u)||P(T)?c!==L||this.restorePreviousInputEventState():this.forceUpdateWithSelection()):F||O||this.forceUpdateWithSelection():(this.options.autoSwitchParts||D[0][1]!==d)&&this.setSelection(this.selectionBySymbol(D[0][0]))}else l||(this.forceUpdate(),D.length&&D[0][0]!==d&&this.setSelection(this.selectionBySymbol(D[0][0])),this.options.autoSwitchParts?E?(this.resetSegmentValue=!0,n||this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0):S&&(this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0):V&&V.switchToNext?this.resetSegmentValue=!0:E&&(this.resetSegmentValue=!0,n||this.switchDateSegment(1),this.switchedPartOnPreviousKeyAction=!0),r&&this.options.selectPreviousSegmentOnBackspace&&this.switchDateSegment(-1));this.tryTriggerValueChange({oldValue:u,event:t}),this.triggerInputEnd({event:t,error:M,oldElementValue:i,newElementValue:this.elementValue}),l&&this.setTextAndFormat()}else this.restorePreviousInputEventState()}}},i.prototype.onElementFocus=function(t){this.triggerFocus({event:t})||(this.isActive=!0,this.interactionMode=h.None,this.switchedPartOnPreviousKeyAction=!1,this.refreshElementValue(),this.mouseDownStarted||this.caret(0,this.elementValue.length),this.mouseDownStarted=!1,this.triggerFocusEnd({event:t}))},i.prototype.onElementBlur=function(t){this.resetSegmentValue=!0,this.isActive=!1,this.triggerBlur({event:t})||(this.options.autoFill&&this.autoFill(),this.interactionMode=h.None,this.switchedPartOnPreviousKeyAction=!1,this.refreshElementValue(),this.triggerBlurEnd({event:t}))},i.prototype.onElementChange=function(t){this.triggerChange({event:t})},i.prototype.onElementKeyDown=function(t){if(!this.triggerKeyDown({event:t})){var e=this.selection,i=e.start,n=e.end,s=t;if(this.keyDownEvent=t,this.previousElementValue=this.element.value,this.previousElementSelection={start:i,end:n},this.keyEventMatchesAutoSwitchKeys(t)){var r=t.keyCode===T;if(!r)return t.preventDefault(),void this.switchDateSegment(1);var a=this.selection,o=a.start,l=a.end;if(t.shiftKey&&r?this.switchDateSegment(-1):this.switchDateSegment(1),o!==this.selection.start||l!==this.selection.end)return void t.preventDefault()}var h=this.currentFormat[this.selection.start],u=this.getStepFromSymbol(h),c=!1,d=this.elementValue;if(!(t.altKey||t.ctrlKey||t.metaKey||t.keyCode===T)){switch(t.keyCode){case L:this.switchDateSegment(-1),c=!0,this.switchedPartOnPreviousKeyAction=!1;break;case A:this.modifyDateSegmentValue(u,h,s),d!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:d}),c=!0,this.switchedPartOnPreviousKeyAction=!1;break;case H:this.switchDateSegment(1),c=!0,this.switchedPartOnPreviousKeyAction=!1;break;case K:this.modifyDateSegmentValue(-u,h,s),d!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:d}),c=!0,this.switchedPartOnPreviousKeyAction=!1;break;case _:break;case W:this.selectNearestSegment(0),c=!0,this.switchedPartOnPreviousKeyAction=!1,this.resetSegmentValue=!0;break;case B:this.selectNearestSegment(this.elementValue.length),c=!0,this.switchedPartOnPreviousKeyAction=!1,this.resetSegmentValue=!0;break;default:return}c&&t.preventDefault()}}},i.prototype.onElementPaste=function(){this.isPasteInProgress=!0},i.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(),i.stopPropagation&&i.stopPropagation(),e!==this.elementValue&&this.triggerInputEnd({event:t,error:null,newElementValue:this.elementValue,oldElementValue:e})}},i.prototype.updateOnPaste=function(t){var e=this.intl.parseDate(this.elementValue,this.inputFormat)||this.value;P(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(i.prototype,"elementValue",{get:function(){return(this.element||{}).value||""},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"inputFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.inputFormat:m},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayFormat",{get:function(){return this.options.format?"string"==typeof this.options.format?this.options.format:this.options.format.displayFormat:m},enumerable:!0,configurable:!0}),Object.defineProperty(i.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:!0,configurable:!0}),i.prototype.setSelection=function(t){this.element&&document.activeElement===this.element&&(this.element.setSelectionRange(t.start,t.end),t.start!==t.end&&(this.interactionMode=h.Selection))},i.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}},i.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]!==d){e=this.selectionBySymbol(this.currentFormat[i]);break}if(n>=0&&this.currentFormat[n]!==d){e=this.selectionBySymbol(this.currentFormat[n]);break}}return e},i.prototype.switchDateSegment=function(t){var e=this.selection;if(this.isInCaretMode()){var i=e.start,n=this.currentFormat[i-1],s="",r="";if(t<0){for(var a=i+t;a>=0;a--)if((r=this.currentFormat[a])!==d&&r!==n){i=a,s=r;break}}else for(a=i+t;a<this.currentFormat.length;a++)if((r=this.currentFormat[a])!==d&&r!==n){i=a,s=r;break}if(s)return this.forceUpdate(),this.setSelection(this.selectionBySymbol(s)),void(this.interactionMode=h.Selection)}this.interactionMode=h.None;var o=this.selection,l=o.start,u=o.end;if(l<u&&this.currentFormat[l]!==this.currentFormat[u-1])return this.setSelection(this.selectionByIndex(t>0?l:u-1)),this.resetSegmentValue=!0,void(this.interactionMode=h.None);for(var c=this.currentFormat[l],p=l+t;p>0&&p<this.currentFormat.length&&(this.currentFormat[p]===c||this.currentFormat[p]===d);)p+=t;if(this.currentFormat[p]!==d){for(var m=p;m>=0&&m<this.currentFormat.length&&this.currentFormat[m]===this.currentFormat[p];)m+=t;p>m&&(m+1!==l||p+1!==u)?(this.setSelection({start:m+1,end:p+1}),this.resetSegmentValue=!0):p<m&&(p!==l||m!==u)&&(this.setSelection({start:p,end:m}),this.resetSegmentValue=!0),this.interactionMode=h.None}},i.prototype.modifyDateSegmentValue=function(t,e,i){if(void 0===e&&(e=""),void 0===i&&(i={}),this.dateObject&&!this.options.readonly){var n,s,r,a=this.value,o=1,l=this.caret();if("S"===(e=e||this.currentFormat[l[0]])&&(!this.options.steps.millisecond||1===this.options.steps.millisecond)){var h=(s=this.inputFormat,(r=s&&s.match(/S+(\1)/))?r[0].length:0);n=h,o=Math.pow(10,3-n)}this.dateObject.modifyPart(e,o*t),this.tryTriggerValueChange({oldValue:a,event:i}),this.forceUpdate(),this.setSelection(this.selectionBySymbol(e))}},i.prototype.tryTriggerValueChange=function(t){if(void 0===t&&(t={oldValue:null,event:{}}),!e.i(this.value,t.oldValue))return this.triggerValueChange(t)},i.prototype.triggerValueChange=function(t){return void 0===t&&(t={oldValue:null,event:{}}),this.trigger(st,I(t,{value:this.value}))},i.prototype.triggerInput=function(t){return void 0===t&&(t={event:{}}),this.trigger(G,I(t,{value:this.value}))},i.prototype.triggerInputEnd=function(t){return void 0===t&&(t={event:{},error:null,oldElementValue:"",newElementValue:""}),this.trigger(rt,I(t,{value:this.value}))},i.prototype.triggerFocus=function(t){return void 0===t&&(t={event:{}}),this.trigger(X,I({},t))},i.prototype.triggerFocusEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger(ot,I({},t))},i.prototype.triggerBlur=function(t){return void 0===t&&(t={event:{}}),this.trigger(tt,I({},t))},i.prototype.triggerBlurEnd=function(t){return void 0===t&&(t={event:{}}),this.trigger(at,I({},t))},i.prototype.triggerChange=function(t){return void 0===t&&(t={event:{}}),this.trigger(lt,I(t,{value:this.value}))},i.prototype.triggerKeyDown=function(t){return void 0===t&&(t={event:{}}),this.trigger(Q,I({},t))},i.prototype.triggerMouseWheel=function(t){return void 0===t&&(t={event:{}}),this.trigger(nt,I({},t))},i.prototype.forceUpdate=function(){this.setTextAndFormat(),this.refreshElementValue()},i.prototype.forceUpdateWithSelection=function(){var t=this.selection,e=t.start,i=t.end,n=this.elementValue.length;this.forceUpdate();var s=this.elementValue.length-n;this.setSelection({start:e+s,end:i+s})},i.prototype.setTextAndFormat=function(){var t=this.dateObject.getTextAndFormat(),e=t.text,i=t.format;this.currentFormat=i,this.currentText=e},i.prototype.setElementValue=function(t){this.element.value=t},i.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}},i.prototype.restorePreviousInputEventState=function(){this.restorePreviousElementValue(),this.restorePreviousElementSelection()},i.prototype.restorePreviousElementValue=function(){this.setElementValue(this.previousElementValue||"")},i.prototype.restorePreviousElementSelection=function(){var t=this.previousElementSelection,e=t.start,i=t.end;this.setSelection({start:e||0,end:i||0})},i.prototype.writeValue=function(t){this.verifyValue(t),this.dateObject=this.getDateObject(t),this.refreshElementValue()},i.prototype.verifyValue=function(t){if(t&&!F(t))throw new Error("The 'value' should be a valid JavaScript Date instance.")},i.prototype.refreshElementValue=function(){var t=this.element,e=this.isActive?this.inputFormat:this.displayFormat,i=this.dateObject.getTextAndFormat(e),n=i.text,s=i.format;this.currentFormat=s,this.currentText=n;var r=this.options.hasPlaceholder||P(this.options.placeholder),a=!this.isActive&&r&&!this.dateObject.hasValue();r&&P(this.options.placeholder)&&(t.placeholder=this.options.placeholder);var o=a?"":n;this.previousElementValue=this.elementValue,this.setElementValue(o)},i.prototype.caret=function(t,e){void 0===e&&(e=t);var i=void 0!==t,n=[t,t],s=this.element;if(!i||!this.options.disabled&&!this.options.readonly){try{void 0!==s.selectionStart&&(i&&(document&&document.activeElement!==s&&s.focus(),s.setSelectionRange(t,e)),n=[s.selectionStart,s.selectionEnd])}catch(t){n=[]}return n}},i.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])}},i.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)},i.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},i.prototype.createDateObject=function(){var t=this.getDateObjectOptions();return new C(I({},t))},i.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}},i.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},i.prototype.autoFill=function(){var t,e,i,n,s,r,a=this.dateObject,o=new Date;(a.date||a.month||a.year||a.hours||a.minutes||a.seconds)&&(i=a.year?a.value.getFullYear():o.getFullYear(),e=a.month?a.value.getMonth():o.getMonth(),t=a.date?a.value.getDate():o.getDate(),n=a.hours?a.value.getHours():o.getHours(),s=a.minutes?a.value.getMinutes():o.getMinutes(),r=a.seconds?a.value.getSeconds():o.getSeconds(),a.setValue(new Date(i,e,t,n,s,r)),this.refreshElementValue(),this.triggerValueChange())},i}(Y);t.D=ut,t._=o,t.__meta__={id:"dateinputs-common.cmn.chunk",name:"DateinputsCommonCmnChunk",category:"web",description:"A reusable outputed chunk of code",depends:["date-math.cmn.chunk"],hidden:!0,chunk:!0},t.a=a,t.b=r})); //# sourceMappingURL=kendo.dateinputs-common.cmn.chunk.min.js.map