tiseza_oss_live/obj/Release/Package/PackageTmp/Scripts/globalize/date.min.js

6 lines
24 KiB
JavaScript

/*!
* Globalize v1.4.2 2019-03-07T13:47Z Released under the MIT license
* http://git.io/TrdQbw
*/
!function(e,a){"function"==typeof define&&define.amd?define(["cldr","../globalize","./number","cldr/event","cldr/supplemental"],a):"object"==typeof exports?module.exports=a(require("cldrjs"),require("../globalize")):a(e.Cldr,e.Globalize)}(this,function(e,a){function t(e,a){var t,r,n,s,i,o,u,m,c=S;for(m=e.match(A),n=a.match(A),t=0;t<n.length;t++)for(s=n[t].charAt(0),i=n[t].length,r=0;r<m.length;r++)o=m[r].charAt(0),u=m[r].length,c(s)===c(o)&&i<u&&(n[t]=_(s,u));return n.join("")}function r(e){return void 0!==e.skeleton||void 0!==e.date||void 0!==e.time||void 0!==e.datetime||void 0!==e.raw}function n(e,a){D(e,a,{skip:[/dates\/calendars\/gregorian\/dateTimeFormats\/availableFormats/,/dates\/calendars\/gregorian\/days\/.*\/short/,/dates\/timeZoneNames\/zone/,/dates\/timeZoneNames\/metazone/,/globalize-iana/,/supplemental\/metaZones/,/supplemental\/timeData\/(?!001)/,/supplemental\/weekData\/(?!001)/]})}function s(e){i("date",e),i("time",e),i("datetime",e)}function i(e,a){var t=a[e];k("E_INVALID_OPTIONS",'Invalid `{{type}: "{value}"}`.',void 0===t||["short","medium","long","full"].indexOf(t)!==-1,{type:e,value:t})}function o(e,a){k("E_INVALID_OPTIONS",'Invalid `{skeleton: "{value}"}` based on provided CLDR.',void 0===a||"string"==typeof e&&e,{type:"skeleton",value:a})}function u(e){return function(a,t){/globalize-iana/.test(a)&&k("E_MISSING_IANA_TZ","Missing required IANA timezone content for `{timeZone}`: `{path}`.",t,{path:a.replace(/globalize-iana\//,""),timeZone:e})}}var m=a._createError,c=a._createErrorUnsupportedFeature,l=a._formatMessage,f=a._isPlainObject,d=a._looseMatching,g=a._numberNumberingSystemDigitsMap,p=a._numberSymbol,h=a._regexpEscape,v=a._removeLiteralQuotes,b=a._runtimeBind,y=a._stringPad,k=a._validate,D=a._validateCldr,w=a._validateDefaultLocale,H=a._validateParameterPresence,Z=a._validateParameterType,z=a._validateParameterTypePlainObject,M=a._validateParameterTypeString,N=function(e,a){Z(e,a,void 0===e||e instanceof Date,"Date")},F=function(e,a){return m("E_INVALID_PAR_VALUE","Invalid `{name}` value ({value}).",{name:e,value:a})},T="GyYuUrQqMLlwWEecdDFghHKkmsSAzZOvVXx".split("").reduce(function(e,a,t){return e[a]=t,e},{}),O=function(e){var a,t=T;e.replace(/[^GyYuUrQqMLlwWEecdDFghHKkmsSAzZOvVXx]/,function(a){throw m("E_INVALID_OPTIONS","Invalid field `{invalidField}` of skeleton `{value}`",{invalidField:a,type:"skeleton",value:e})}),e.split("").every(function(r){if(t[r]<a)throw m("E_INVALID_OPTIONS","Invalid order `{invalidField}` of skeleton `{value}`",{invalidField:r,type:"skeleton",value:e});return a=t[r],!0})},E=function(e,a){return a=a||function(e,a,t){return e[t]=a,e},Object.keys(e).reduce(function(t,r){return a(t,r,e[r])},{})},x=E({e:"eEc",L:"ML"},function(e,a,t){return t.split("").forEach(function(t){e[t]=a}),e}),S=function(e){return x[e]||e},A=/([a-z])\1*|'([^']|'')+'|''|./gi,_=function(e,a){var t,r="";for(t=0;t<a;t++)r+=e;return r},L=function(e,a,r){var n,s,i,o;return s=e.match(/S/g),n=s?s.length:0,o=e.replace(/S/g,""),a=t(o,a),i=a.lastIndexOf("s"),i!==-1&&0!==n&&(a=a.slice(0,i+1)+r+_("S",n)+a.slice(i+1)),a},P=function(e,a){var t,r,n,s,i,o,u,m,c,l=S;if(e===a)return 0;if(e=e.match(A),a=a.match(A),e.length!==a.length)return-1;for(n=1,m=0;m<e.length;m++){for(t=e[m].charAt(0),o=l(t),u=null,c=0;c<a.length&&(r=a[c].charAt(0),u=l(r),o!==u);c++)u=null;if(null===u)return-1;s=e[m].length,i=a[c].length,n+=Math.abs(s-i),t!==r&&(n+=1),(s<3&&i>=3||s>=3&&i<3)&&(n+=20)}return n},I=function(e,a){var t,r,n,s,i,o="dates/calendars/gregorian/dateTimeFormats/availableFormats",u=L,m=P;if(n=e.main([o,a]),a&&!n){t=e.main([o]),s=[];for(i in t)s.push({skeleton:i,pattern:t[i],rate:m(a,i)});s=s.filter(function(e){return e.rate>-1}).sort(function(e,a){return e.rate-a.rate}),s.length&&(r=p("decimal",e),n=u(a,s[0].pattern,r))}return n},R=function(e,a){function t(e,t,r){return l(a.main(["dates/calendars/gregorian/dateTimeFormats",e]),[r,t])}var r,n,s,i,o,u=I;switch(!0){case"skeleton"in e:if(s=e.skeleton,s=s.replace(/j/g,function(){return a.supplemental.timeData.preferred()}),O(s),n=u(a,s))break;i=s.split(/[^hHKkmsSAzZOvVXx]/).slice(-1)[0],r=s.split(/[^GyYuUrQqMLlwWdDFgEec]/)[0],r=u(a,r),i=u(a,i),o=/(MMMM|LLLL).*[Ec]/.test(r)?"full":/MMMM|LLLL/.test(r)?"long":/MMM|LLL/.test(r)?"medium":"short",n=r&&i?t(o,r,i):r||i;break;case"date"in e:case"time"in e:n=a.main(["dates/calendars/gregorian","date"in e?"dateFormats":"timeFormats",e.date||e.time]);break;case"datetime"in e:n=t(e.datetime,a.main(["dates/calendars/gregorian/dateFormats",e.datetime]),a.main(["dates/calendars/gregorian/timeFormats",e.datetime]));break;case"raw"in e:n=e.raw;break;default:throw F({name:"options",value:e})}return n},q=["sun","mon","tue","wed","thu","fri","sat"],j=function(e){return q.indexOf(e.supplemental.weekData.firstDay())},Y=function(e,a,t,r){var n,s;if(t)return(s=r.main(["dates/timeZoneNames/zone",t,e<4?"short":"long",a]))?s:(n=r.supplemental(["metaZones/metazoneInfo/timezone",t,0,"usesMetazone/_mzone"]),r.main(["dates/timeZoneNames/metazone",n,e<4?"short":"long",a]))},V=function(e){return e.split(";").map(function(e){return e.slice(0,e.indexOf("H")+1)}).join(";")},Q=function(e,a){return e.split(";").map(function(e){var t=e.split(/H+/);return t.splice(1,0,a),t.join("")}).join(";")},U=function(e,a){var t=function(){return a};return t.dataCacheKey=e,t},X=function(e,a,t){function r(e){n.numberFormatters[e]=y("",e)}var n={numberFormatters:{},pattern:e,timeSeparator:p("timeSeparator",a)},s=["abbreviated","wide","narrow"];return t&&(n.timeZoneData=U("iana/"+t,{offsets:a.get(["globalize-iana/zoneData",t,"offsets"]),untils:a.get(["globalize-iana/zoneData",t,"untils"]),isdsts:a.get(["globalize-iana/zoneData",t,"isdsts"])})),e.replace(A,function(i){var o,u,m,f,d,g,p;switch(u=i.charAt(0),g=i.length,"j"===u&&(n.preferredTime=u=a.supplemental.timeData.preferred()),"Z"===u&&4===g&&(u="O",g=4),"z"===u&&(p=Y(g,"standard",t,a),m=Y(g,"daylight",t,a),p&&(n.standardTzName=p),m&&(n.daylightTzName=m),p&&m||(u="O",g<4&&(g=1))),"v"===u&&(d=Y(g,"generic",t,a),d||(u="V",g=4)),u){case"G":n.eras=a.main(["dates/calendars/gregorian/eras",g<=3?"eraAbbr":4===g?"eraNames":"eraNarrow"]);break;case"y":f=!0;break;case"Y":n.firstDay=j(a),n.minDays=a.supplemental.weekData.minDays(),f=!0;break;case"u":case"U":throw c({feature:"year pattern `"+u+"`"});case"Q":case"q":g>2?(n.quarters||(n.quarters={}),n.quarters[u]||(n.quarters[u]={}),n.quarters[u][g]=a.main(["dates/calendars/gregorian/quarters","Q"===u?"format":"stand-alone",s[g-3]])):f=!0;break;case"M":case"L":g>2?(n.months||(n.months={}),n.months[u]||(n.months[u]={}),n.months[u][g]=a.main(["dates/calendars/gregorian/months","M"===u?"format":"stand-alone",s[g-3]])):f=!0;break;case"w":case"W":n.firstDay=j(a),n.minDays=a.supplemental.weekData.minDays(),f=!0;break;case"d":case"D":case"F":f=!0;break;case"g":throw c({feature:"Julian day pattern `g`"});case"e":case"c":if(g<=2){n.firstDay=j(a),f=!0;break}case"E":n.days||(n.days={}),n.days[u]||(n.days[u]={}),6===g?n.days[u][g]=a.main(["dates/calendars/gregorian/days","c"===u?"stand-alone":"format","short"])||a.main(["dates/calendars/gregorian/days","c"===u?"stand-alone":"format","abbreviated"]):n.days[u][g]=a.main(["dates/calendars/gregorian/days","c"===u?"stand-alone":"format",s[g<3?0:g-3]]);break;case"a":n.dayPeriods={am:a.main("dates/calendars/gregorian/dayPeriods/format/wide/am"),pm:a.main("dates/calendars/gregorian/dayPeriods/format/wide/pm")};break;case"h":case"H":case"K":case"k":case"m":case"s":case"S":case"A":f=!0;break;case"v":if(1!==g&&4!==g)throw c({feature:"timezone pattern `"+e+"`"});n.genericTzName=d;break;case"V":if(1===g)throw c({feature:"timezone pattern `"+e+"`"});if(t){if(2===g){n.timeZoneName=t;break}var h,v=a.main(["dates/timeZoneNames/zone",t,"exemplarCity"]);if(3===g&&(v||(v=a.main(["dates/timeZoneNames/zone/Etc/Unknown/exemplarCity"])),h=v),v&&4===g&&(h=l(a.main("dates/timeZoneNames/regionFormat"),[v])),h){n.timeZoneName=h;break}}"v"===i&&(g=1);case"O":n.gmtFormat=a.main("dates/timeZoneNames/gmtFormat"),n.gmtZeroFormat=a.main("dates/timeZoneNames/gmtZeroFormat"),o=a.main("dates/timeZoneNames/hourFormat"),n.hourFormat=g<4?[V(o),Q(o,"H")]:Q(o,"HH");case"Z":case"X":case"x":r(1),r(2)}f&&r(g)}),n},C=function(e){return function(a){return e(a).map(function(e){return e.value}).join("")}},G=function(e,a){var t={preferredTimeData:e.supplemental.timeData.preferred()};return a&&(t.timeZoneData=U("iana/"+a,{offsets:e.get(["globalize-iana/zoneData",a,"offsets"]),untils:e.get(["globalize-iana/zoneData",a,"untils"]),isdsts:e.get(["globalize-iana/zoneData",a,"isdsts"])})),t},W=function(){function e(e,a,t){Object.defineProperty(e,a,{value:t})}function a(e,a){for(var t=0,r=e.getTime();t<a.length-1&&r>=a[t];)t++;return t}function t(e){var a=this.getTimezoneOffset(),t=e();this.original.setTime(new Date(this.getTime()));var r=this.getTimezoneOffset();return r-a&&this.original.setMinutes(this.original.getMinutes()+r-a),t}var r=function(a,r){if(e(this,"original",new Date(a.getTime())),e(this,"local",new Date(a.getTime())),e(this,"timeZoneData",r),e(this,"setWrap",t),!(r.untils&&r.offsets&&r.isdsts))throw new Error("Invalid IANA data");this.setTime(this.local.getTime()-60*this.getTimezoneOffset()*1e3)};return r.prototype.clone=function(){return new r(this.original,this.timeZoneData)},["getFullYear","getMonth","getDate","getDay","getHours","getMinutes","getSeconds","getMilliseconds"].forEach(function(e){var a="getUTC"+e.substr(3);r.prototype[e]=function(){return this.local[a]()}}),r.prototype.valueOf=r.prototype.getTime=function(){return this.local.getTime()+60*this.getTimezoneOffset()*1e3},r.prototype.getTimezoneOffset=function(){var e=a(this.original,this.timeZoneData.untils);return this.timeZoneData.offsets[e]},["setFullYear","setMonth","setDate","setHours","setMinutes","setSeconds","setMilliseconds"].forEach(function(e){var a="setUTC"+e.substr(3);r.prototype[e]=function(e){var t=this.local;return this.setWrap(function(){return t[a](e)})}}),r.prototype.setTime=function(e){return this.local.setTime(e)},r.prototype.isDST=function(){var e=a(this.original,this.timeZoneData.untils);return Boolean(this.timeZoneData.isdsts[e])},r.prototype.inspect=function(){var e=a(this.original,this.timeZoneData.untils),t=this.timeZoneData.abbrs;return this.local.toISOString().replace(/Z$/,"")+" "+(t&&t[e]+" "||this.getTimezoneOffset()*-1+" ")+(this.isDST()?"(daylight savings)":"")},r.prototype.toDate=function(){return new Date(this.getTime())},["toISOString","toJSON","toUTCString"].forEach(function(e){r.prototype[e]=function(){return this.toDate()[e]()}}),r}(),K=function(e){return 1===new Date(e,1,29).getMonth()},J=function(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()},B=function(e,a){switch(e=e instanceof W?e.clone():new Date(e.getTime()),a){case"year":e.setMonth(0);case"month":e.setDate(1);case"day":e.setHours(0);case"hour":e.setMinutes(0);case"minute":e.setSeconds(0);case"second":e.setMilliseconds(0)}return e},$=function(e,a){var t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();e.setDate(a<1?1:a<t?a:t)},ee=function(e,a){var t=e.getDate();e.setDate(1),e.setMonth(a),$(e,t)},ae=function(e,a,t){return e<a||e>t},te=function(e,a,t){var r,n,s,i,o,u,m,l,f,d=0,g=1,p=2,h=3,v=4,b=5,y=6,k=new Date,D=[],w=["year","month","day","hour","minute","second","milliseconds"];if(t.timeZoneData&&(k=new W(k,t.timeZoneData())),!a.length)return null;if(f=a.every(function(e){var a,f,w,H;if("literal"===e.type)return!0;switch(f=e.type.charAt(0),H=e.type.length,"j"===f&&(f=t.preferredTimeData),f){case"G":D.push(d),o=+e.value;break;case"y":if(w=e.value,2===H){if(ae(w,0,99))return!1;a=100*Math.floor(k.getFullYear()/100),w+=a,w>k.getFullYear()+20&&(w-=100)}k.setFullYear(w),D.push(d);break;case"Y":throw c({feature:"year pattern `"+f+"`"});case"Q":case"q":break;case"M":case"L":if(w=H<=2?e.value:+e.value,ae(w,1,12))return!1;i=w,D.push(g);break;case"w":case"W":break;case"d":n=e.value,D.push(p);break;case"D":s=e.value,D.push(p);break;case"F":break;case"e":case"c":case"E":break;case"a":r=e.value;break;case"h":if(w=e.value,ae(w,1,12))return!1;u=m=!0,k.setHours(12===w?0:w),D.push(h);break;case"K":if(w=e.value,ae(w,0,11))return!1;u=m=!0,k.setHours(w),D.push(h);break;case"k":if(w=e.value,ae(w,1,24))return!1;u=!0,k.setHours(24===w?0:w),D.push(h);break;case"H":if(w=e.value,ae(w,0,23))return!1;u=!0,k.setHours(w),D.push(h);break;case"m":if(w=e.value,ae(w,0,59))return!1;k.setMinutes(w),D.push(v);break;case"s":if(w=e.value,ae(w,0,59))return!1;k.setSeconds(w),D.push(b);break;case"A":k.setHours(0),k.setMinutes(0),k.setSeconds(0);case"S":w=Math.round(e.value*Math.pow(10,3-H)),k.setMilliseconds(w),D.push(y);break;case"z":case"Z":case"O":case"v":case"V":case"X":case"x":"number"==typeof e.value&&(l=e.value)}return!0}),!f)return null;if(u&&!(!r^m))return null;if(0===o&&k.setFullYear(k.getFullYear()*-1+1),void 0!==i&&ee(k,i-1),void 0!==n){if(ae(n,1,J(k)))return null;k.setDate(n)}else if(void 0!==s){if(ae(s,1,K(k.getFullYear())?366:365))return null;k.setMonth(0),k.setDate(s)}return m&&"pm"===r&&k.setHours(k.getHours()+12),void 0!==l&&k.setMinutes(k.getMinutes()+l-k.getTimezoneOffset()),D=Math.max.apply(null,D),k=B(k,w[D]),k instanceof W&&(k=k.toDate()),k},re=function(e,a,t){var r,n,s=[],i=["abbreviated","wide","narrow"];return r=t.digitsRe,e=d(e),n=t.pattern.match(A).every(function(n){function o(a,t){var r,n,s=e.match(a);return t=t||function(e){return+e},!!s&&(n=s[1],s.length<6?(r=n?1:3,k.value=60*t(s[r])):s.length<10?(r=n?[1,3]:[5,7],k.value=60*t(s[r[0]])+t(s[r[1]])):(r=n?[1,3,5]:[7,9,11],k.value=60*t(s[r[0]])+t(s[r[1]])+t(s[r[2]])/60),n&&(k.value*=-1),!0)}function u(){if(1===p)return b=!0,y=r}function m(){if(1===p)return b=!0,y=new RegExp("^("+r.source+"){1,2}")}function c(){if(1===p||2===p)return b=!0,y=new RegExp("^("+r.source+"){1,2}")}function l(){if(2===p)return b=!0,y=new RegExp("^("+r.source+"){2}")}function f(a){var r=t[a.join("/")];return r?(r.some(function(a){var t=a[1];if(t.test(e))return k.value=a[0],y=a[1],!0}),null):null}var d,g,p,b,y,k={};switch(k.type=n,g=n.charAt(0),p=n.length,"Z"===g&&(p<4?(g="x",p=4):p<5?(g="O",p=4):(g="X",p=5)),"z"===g&&t.standardOrDaylightTzName&&(k.value=null,y=t.standardOrDaylightTzName),"v"===g&&(t.genericTzName?(k.value=null,y=t.genericTzName):(g="V",p=4)),"V"===g&&t.timeZoneName&&(k.value=2===p?t.timeZoneName:null,y=t.timeZoneNameRe),g){case"G":f(["gregorian/eras",p<=3?"eraAbbr":4===p?"eraNames":"eraNarrow"]);break;case"y":case"Y":b=!0,y=1===p?new RegExp("^("+r.source+")+"):2===p?new RegExp("^("+r.source+"){1,2}"):new RegExp("^("+r.source+"){"+p+",}");break;case"Q":case"q":u()||l()||f(["gregorian/quarters","Q"===g?"format":"stand-alone",i[p-3]]);break;case"M":case"L":c()||f(["gregorian/months","M"===g?"format":"stand-alone",i[p-3]]);break;case"D":p<=3&&(b=!0,y=new RegExp("^("+r.source+"){"+p+",3}"));break;case"W":case"F":u();break;case"e":case"c":if(p<=2){u()||l();break}case"E":6===p?f(["gregorian/days",["c"===g?"stand-alone":"format"],"short"])||f(["gregorian/days",["c"===g?"stand-alone":"format"],"abbreviated"]):f(["gregorian/days",["c"===g?"stand-alone":"format"],i[p<3?0:p-3]]);break;case"a":f(["gregorian/dayPeriods/format/wide"]);break;case"w":m()||l();break;case"d":case"h":case"H":case"K":case"k":case"j":case"m":case"s":c();break;case"S":b=!0,y=new RegExp("^("+r.source+"){"+p+"}");break;case"A":b=!0,y=new RegExp("^("+r.source+"){"+(p+5)+"}");break;case"v":case"V":case"z":if(y&&y.test(e))break;if("V"===g&&2===p)break;case"O":if(e===t["timeZoneNames/gmtZeroFormat"])k.value=0,y=t["timeZoneNames/gmtZeroFormatRe"];else if(d=t["timeZoneNames/hourFormat"].some(function(e){if(o(e,a))return y=e,!0}),!d)return null;break;case"X":if("Z"===e){k.value=0,y=/^Z/;break}case"x":if(d=t.x.some(function(e){if(o(e))return y=e,!0}),!d)return null;break;case"'":k.type="literal",y=new RegExp("^"+h(v(n)));break;default:k.type="literal",y=new RegExp("^"+h(n))}return!!y&&(e=e.replace(y,function(e){return k.lexeme=e,b&&(k.value=a(e)),""}),!!k.lexeme&&((!b||!isNaN(k.value))&&(s.push(k),!0)))}),""!==e&&(n=!1),n?s:[]},ne=function(e,a,t){return function(r){var n;return H(r,"value"),M(r,"value"),n=re(r,e,t),te(r,n,a)||null}},se=function(e,a){var t,r={};for(t in e)a.test(t)&&(r[t]=e[t]);return r},ie=function(e,a,t){function r(e,a,t,r){var n;return t||(t="\\d"),a||(a="{0}"),n=e.replace("+","\\+").replace(/HH|mm|ss/g,"(("+t+"){2})").replace(/H|m/g,"(("+t+"){1,2})"),r&&(n=n.replace(/:/g,r)),n=n.split(";").map(function(e){return a.replace("{0}",e)}).join("|"),new RegExp("^"+n)}function n(e,a){var t=/(timeZoneNames\/zone|supplemental\/metaZones|timeZoneNames\/metazone|timeZoneNames\/regionFormat|timeZoneNames\/gmtFormat)/;t.test(e)||a&&(e=e.replace(/^.*\/dates\//,"").replace(/calendars\//,""),"gregorian/dayPeriods/format/wide"===e&&(a=se(a,/^am|^pm/)),a=f(a)?Object.keys(a).map(function(e){return[e,new RegExp("^"+h(d(a[e])))]}).sort(function(e,a){return a[1].source.length-e[1].source.length}):d(a),o[e]=a)}function s(e){return"("+e.filter(function(e){return e}).reduce(function(e,a){return e+"|"+a})+")"}var i,o={pattern:d(e)},u=p("timeSeparator",a),m=["abbreviated","wide","narrow"];return i=g(a),i=i?"["+i+"]":"\\d",o.digitsRe=new RegExp(i),a.on("get",n),e.match(A).forEach(function(n){var f,g,p,v,b,y;if(g=n.charAt(0),b=n.length,"Z"===g&&(b<5?(g="O",b=4):(g="X",b=5)),"z"===g&&(y=Y(b,"standard",t,a),p=Y(b,"daylight",t,a),y&&(y=h(d(y))),p&&(p=h(d(p))),(y||p)&&(o.standardOrDaylightTzName=new RegExp("^"+s([y,p]))),y&&p||(g="O",b<4&&(b=1))),"v"===g){if(1!==b&&4!==b)throw c({feature:"timezone pattern `"+e+"`"});var k=Y(b,"generic",t,a);k?(o.genericTzName=new RegExp("^"+h(d(k))),g="O"):(g="V",b=4)}switch(g){case"G":a.main(["dates/calendars/gregorian/eras",b<=3?"eraAbbr":4===b?"eraNames":"eraNarrow"]);break;case"u":case"U":throw c({feature:"year pattern `"+g+"`"});case"Q":case"q":b>2&&a.main(["dates/calendars/gregorian/quarters","Q"===g?"format":"stand-alone",m[b-3]]);break;case"M":case"L":b>2&&a.main(["dates/calendars/gregorian/months","M"===g?"format":"stand-alone",m[b-3]]);break;case"g":throw c({feature:"Julian day pattern `g`"});case"e":case"c":if(b<=2)break;case"E":6===b?a.main(["dates/calendars/gregorian/days",["c"===g?"stand-alone":"format"],"short"])||a.main(["dates/calendars/gregorian/days",["c"===g?"stand-alone":"format"],"abbreviated"]):a.main(["dates/calendars/gregorian/days",["c"===g?"stand-alone":"format"],m[b<3?0:b-3]]);break;case"a":a.main("dates/calendars/gregorian/dayPeriods/format/wide");break;case"V":if(1===b)throw c({feature:"timezone pattern `"+e+"`"});if(t){if(2===b){o.timeZoneName=t,o.timeZoneNameRe=new RegExp("^"+h(t));break}var D,w=a.main(["dates/timeZoneNames/zone",t,"exemplarCity"]);3===b&&(w||(w=a.main(["dates/timeZoneNames/zone/Etc/Unknown/exemplarCity"])),D=w),w&&4===b&&(D=l(a.main("dates/timeZoneNames/regionFormat"),[w])),D&&(D=d(D),o.timeZoneName=D,o.timeZoneNameRe=new RegExp("^"+h(D)))}"v"===n&&(b=1);case"z":case"O":v=a.main("dates/timeZoneNames/gmtFormat"),a.main("dates/timeZoneNames/gmtZeroFormat"),a.main("dates/timeZoneNames/hourFormat"),o["timeZoneNames/gmtZeroFormatRe"]=new RegExp("^"+h(o["timeZoneNames/gmtZeroFormat"])),f=o["timeZoneNames/hourFormat"],o["timeZoneNames/hourFormat"]=(b<4?[Q(f,"H"),V(f)]:[Q(f,"HH")]).map(function(e){return r(e,v,i,u)});case"X":case"x":o.x=[["+HHmm;-HHmm","+HH;-HH"],["+HHmm;-HHmm"],["+HH:mm;-HH:mm"],["+HHmmss;-HHmmss","+HHmm;-HHmm"],["+HH:mm:ss;-HH:mm:ss","+HH:mm;-HH:mm"]][b-1].map(function(e){return r(e)})}}),a.off("get",n),o},oe=function(e,a){return(e.getDay()-a+7)%7},ue=function(e,a){var t=864e5;return(a.getTime()-e.getTime())/t},me=function(e){return Math.floor(ue(B(e,"year"),e))},ce=E({era:"G",year:"yY",quarter:"qQ",month:"ML",week:"wW",day:"dDF",weekday:"ecE",dayperiod:"a",hour:"hHkK",minute:"m",second:"sSA",zone:"zvVOxX"},function(e,a,t){return t.split("").forEach(function(t){e[t]=a}),e}),le=function(e){return e-B(e,"day")},fe=function(e,a,t,r){var n,s=e.getTimezoneOffset();return n=Math.abs(s),r=r||{1:function(e){return y(e,1)},2:function(e){return y(e,2)}},a.split(";")[s>0?1:0].replace(":",t).replace(/HH?/,function(e){return r[e.length](Math.floor(n/60))}).replace(/mm/,function(){return r[2](Math.floor(n%60))}).replace(/ss/,function(){return r[2](Math.floor(n%1*60))})},de=function(e,a,t){var r=[],n=t.timeSeparator;return t.timeZoneData&&(e=new W(e,t.timeZoneData())),t.pattern.replace(A,function(s){var i,o,u,m,c=s.charAt(0),l=s.length;switch("j"===c&&(c=t.preferredTime),"Z"===c&&(l<4?(c="x",l=4):l<5?(c="O",l=4):(c="X",l=5)),"z"===c&&(e.isDST&&(m=e.isDST()?t.daylightTzName:t.standardTzName),m||(c="O",l<4&&(l=1))),c){case"G":m=t.eras[e.getFullYear()<0?0:1];break;case"y":m=e.getFullYear(),2===l&&(m=String(m),m=+m.substr(m.length-2));break;case"Y":m=new Date(e.getTime()),m.setDate(m.getDate()+7-oe(e,t.firstDay)-t.firstDay-t.minDays),m=m.getFullYear(),2===l&&(m=String(m),m=+m.substr(m.length-2));break;case"Q":case"q":m=Math.ceil((e.getMonth()+1)/3),l>2&&(m=t.quarters[c][l][m]);break;case"M":case"L":m=e.getMonth()+1,l>2&&(m=t.months[c][l][m]);break;case"w":m=oe(B(e,"year"),t.firstDay),m=Math.ceil((me(e)+m)/7)-(7-m>=t.minDays?0:1);break;case"W":m=oe(B(e,"month"),t.firstDay),m=Math.ceil((e.getDate()+m)/7)-(7-m>=t.minDays?0:1);break;case"d":m=e.getDate();break;case"D":m=me(e)+1;break;case"F":m=Math.floor(e.getDate()/7)+1;break;case"e":case"c":if(l<=2){m=oe(e,t.firstDay)+1;break}case"E":m=q[e.getDay()],m=t.days[c][l][m];break;case"a":m=t.dayPeriods[e.getHours()<12?"am":"pm"];break;case"h":m=e.getHours()%12||12;break;case"H":m=e.getHours();break;case"K":m=e.getHours()%12;break;case"k":m=e.getHours()||24;break;case"m":m=e.getMinutes();break;case"s":m=e.getSeconds();break;case"S":m=Math.round(e.getMilliseconds()*Math.pow(10,l-3));break;case"A":m=Math.round(le(e)*Math.pow(10,l-3));break;case"z":break;case"v":if(t.genericTzName){m=t.genericTzName;break}case"V":if(t.timeZoneName){m=t.timeZoneName;break}"v"===s&&(l=1);case"O":0===e.getTimezoneOffset()?m=t.gmtZeroFormat:(l<4?(i=e.getTimezoneOffset(),i=t.hourFormat[i%60-i%1===0?0:1]):i=t.hourFormat,m=fe(e,i,n,a),m=t.gmtFormat.replace(/\{0\}/,m));break;case"X":if(0===e.getTimezoneOffset()){m="Z";break}case"x":i=e.getTimezoneOffset(),1===l&&i%60-i%1!==0&&(l+=1),4!==l&&5!==l||i%1!==0||(l-=2),m=["+HH;-HH","+HHmm;-HHmm","+HH:mm;-HH:mm","+HHmmss;-HHmmss","+HH:mm:ss;-HH:mm:ss"][l-1],m=fe(e,m,":");break;case":":m=n;break;case"'":m=v(s);break;default:m=s}return"number"==typeof m&&(m=a[l](m)),o=ce[c],u=o?o:"literal","literal"===u&&r.length&&"literal"===r[r.length-1].type?void(r[r.length-1].value+=m):void r.push({type:u,value:m})}),r},ge=function(e,a){return function(t){return H(t,"value"),N(t,"value"),de(t,e,a)}};return a.loadTimeZone=function(a){var t={"globalize-iana":a};H(a,"json"),z(a,"json"),e.load(t)},a.dateFormatter=a.prototype.dateFormatter=function(e){var a,t,n;return z(e,"options"),e=e||{},r(e)||(e.skeleton="yMd"),a=[e],t=this.dateToPartsFormatter(e),n=C(t),b(a,this.cldr,n,[t]),n},a.dateToPartsFormatter=a.prototype.dateToPartsFormatter=function(e){var a,t,i,m,c,l,f,d,g;z(e,"options"),t=this.cldr,e=e||{},r(e)||(e.skeleton="yMd"),s(e),w(t),d=e.timeZone,M(d,"options.timeZone"),a=[e],t.on("get",n),d&&(g=u(d),t.on("get",g)),c=R(e,t),o(c,e.skeleton),l=X(c,t,d),t.off("get",n),g&&t.off("get",g),i=l.numberFormatters,delete l.numberFormatters;for(m in i)i[m]=this.numberFormatter({raw:i[m]});return f=ge(i,l),b(a,t,f,[i,l]),f},a.dateParser=a.prototype.dateParser=function(e){var a,t,i,m,c,l,f,d;return z(e,"options"),t=this.cldr,e=e||{},r(e)||(e.skeleton="yMd"),s(e),w(t),f=e.timeZone,M(f,"options.timeZone"),a=[e],t.on("get",n),f&&t.on("get",u(f)),c=R(e,t),o(c,e.skeleton),d=ie(c,t,f),m=G(t,f),t.off("get",n),f&&t.off("get",u(f)),i=this.numberParser({raw:"0"}),l=ne(i,m,d),b(a,t,l,[i,m,d]),l},a.formatDate=a.prototype.formatDate=function(e,a){return H(e,"value"),N(e,"value"),this.dateFormatter(a)(e)},a.formatDateToParts=a.prototype.formatDateToParts=function(e,a){return H(e,"value"),N(e,"value"),this.dateToPartsFormatter(a)(e)},a.parseDate=a.prototype.parseDate=function(e,a){return H(e,"value"),M(e,"value"),this.dateParser(a)(e)},a});