diff --git a/.eslintignore b/.eslintignore index 2df38e10..eeb61753 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,7 +1,4 @@ -dist/ -lib/ locale-data/ tasks/ tests/ tmp/ -t.js diff --git a/dist/Intl.complete.js b/dist/Intl.complete.js deleted file mode 100644 index adecacc1..00000000 --- a/dist/Intl.complete.js +++ /dev/null @@ -1,733 +0,0 @@ -!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.IntlPolyfill=r()}(this,function(){"use strict";function e(e){if("function"==typeof Math.log10)return Math.floor(Math.log10(e));var r=Math.round(Math.log(e)*Math.LOG10E);return r-(Number("1e"+r)>e)}function r(e){for(var n in e)(e instanceof r||ue.call(e,n))&&ge(this,n,{value:e[n],enumerable:!0,writable:!0,configurable:!0})}function n(){ge(this,"length",{writable:!0,value:0}),arguments.length&&de.apply(this,ve.call(arguments))}function t(){if(we.disableRegExpRestore)return function(){};for(var e={lastMatch:RegExp.lastMatch||"",leftContext:RegExp.leftContext,multiline:RegExp.multiline,input:RegExp.input},r=!1,n=1;n<=9;n++)r=(e["$"+n]=RegExp["$"+n])||r;return function(){var n=/[.?*+^$[\]\\(){}|-]/g,t=e.lastMatch.replace(n,"\\$&"),a="";if(r)for(var i=1;i<=9;i++){var o=e["$"+i];o?(o=o.replace(n,"\\$&"),a+=t.substring(0,t.indexOf(o))+"(",t=o+")"+t.substring(t.indexOf(o)+o.length)):(a+="(",t=")"+t)}a+=t,a=a.replace(/((^|[^\\])((\\\\)*\\[()])+|[^()])+/g,function(e){return"[\\s\\S]{"+e.replace(/\\(.)/g,"$1").length+"}"});var s=new RegExp(a,e.multiline?"gm":"g");s.lastIndex=e.leftContext.length,s.exec(e.input)}}function a(e){if(null===e)throw new TypeError("Cannot convert null or undefined to object");return"object"===("undefined"==typeof e?"undefined":oe(e))?e:Object(e)}function i(e){return"number"==typeof e?e:Number(e)}function o(e){var r=i(e);return isNaN(r)?0:0===r||r===-0||r===+(1/0)||r===-(1/0)?r:r<0?Math.floor(Math.abs(r))*-1:Math.floor(Math.abs(r))}function s(e){var r=o(e);return r<=0?0:r===1/0?Math.pow(2,53)-1:Math.min(r,Math.pow(2,53)-1)}function l(e){return ue.call(e,"__getInternalProperties")?e.__getInternalProperties(xe):fe(null)}function c(e){qe=e}function u(e){for(var r=e.length;r--;){var n=e.charAt(r);n>="a"&&n<="z"&&(e=e.slice(0,r)+n.toUpperCase()+e.slice(r+1))}return e}function g(e){return!!Me.test(e)&&(!Te.test(e)&&!Ie.test(e))}function m(e){var r=void 0,n=void 0;e=e.toLowerCase(),n=e.split("-");for(var t=1,a=n.length;t1&&(r.sort(),e=e.replace(RegExp("(?:"+Re.source+")+","i"),pe.call(r,""))),ue.call(Ae.tags,e)&&(e=Ae.tags[e]),n=e.split("-");for(var i=1,o=n.length;i-1)return n;var t=n.lastIndexOf("-");if(t<0)return;t>=2&&"-"===n.charAt(t-2)&&(t-=2),n=n.substring(0,t)}}function p(e,n){for(var t=0,a=n.length,i=void 0,o=void 0,s=void 0;t1){var l=e.substring(o,i-1);n.push(l)}var c=e.substring(i,a);n.push(c),o=a+1,t=!1}else if(t===!0){var u=e.substring(i,a);n.push(u),o=a+1}i=a+1}a+=1}if(r-i===2){if(i-o>1){var g=e.substring(o,i-1);n.push(g)}o=i}var m=e.substring(o,r);return n.push(m),n}function w(e,n,t,a,i){if(0===e.length)throw new ReferenceError("No locale data has been provided for this object yet.");var o=t["[[localeMatcher]]"],s=void 0;s="lookup"===o?p(e,n):b(e,n);var l=s["[[locale]]"],c=void 0,u=void 0;if(ue.call(s,"[[extension]]")){var g=s["[[extension]]"];c=y(g),u=c.length}var f=new r;f["[[dataLocale]]"]=l;for(var v="-u",h=0,d=a.length;h2){var S=c[j+1],L=F.call(D,S);L!==-1&&(z=S,k="-"+w+"-"+z)}else{var N=F(D,"true");N!==-1&&(z="true")}}if(ue.call(t,"[["+w+"]]")){var E=t["[["+w+"]]"];F.call(D,E)!==-1&&E!==z&&(z=E,k="")}f["[["+w+"]]"]=z,v+=k,h++}if(v.length>2){var O=l.indexOf("-x-");if(O===-1)l+=v;else{var P=l.substring(0,O),_=l.substring(O);l=P+v+_}l=m(l)}return f["[[locale]]"]=l,f}function x(e,r){for(var t=r.length,a=new n,i=0;it)throw new RangeError("Value is not a number or outside accepted range");return Math.floor(i)}return a}function j(e){for(var r=h(e),n=[],t=r.length,a=0;a0&&void 0!==arguments[0]?arguments[0]:void 0,r=null!==this&&"object"===oe(this)&&l(this);if(!r||!r["[[initializedNumberFormat]]"])throw new TypeError("`this` value for formatToParts() is not an initialized Intl.NumberFormat object.");var n=Number(e);return P(this,n)}function P(e,r){for(var n=M(e,r),t=[],a=0,i=0;n.length>i;i++){var o=n[i],s={};s.type=o["[[type]]"],s.value=o["[[value]]"],t[a]=s,a+=1}return t}function _(e,r){var n=l(e),t=void 0;return t=ue.call(n,"[[minimumSignificantDigits]]")&&ue.call(n,"[[maximumSignificantDigits]]")?I(r,n["[[minimumSignificantDigits]]"],n["[[maximumSignificantDigits]]"]):R(r,n["[[minimumIntegerDigits]]"],n["[[minimumFractionDigits]]"],n["[[maximumFractionDigits]]"])}function M(e,r){var t=l(e),a=t["[[dataLocale]]"],i=t["[[numberingSystem]]"],o=we.NumberFormat["[[localeData]]"][a],s=o.symbols[i]||o.symbols.latn,c=void 0;!isNaN(r)&&r<0?(r=-r,c=t["[[negativePattern]]"]):c=t["[[positivePattern]]"];for(var u=new n,g=c.indexOf("{",0),m=0,f=0,v=c.length;g>-1&&gf){var h=c.substring(f,g);de.call(u,{"[[type]]":"literal","[[value]]":h})}var d=c.substring(g+1,m);if("number"===d)if(isNaN(r)){var p=s.nan;de.call(u,{"[[type]]":"nan","[[value]]":p})}else if(isFinite(r)){"percent"===t["[[style]]"]&&(r*=100);var b=_(e,r);Ue[i]?!function(){var e=Ue[i];b=String(b).replace(/\d/g,function(r){return e[r]})}():b=String(b);var y=void 0,w=void 0,x=b.indexOf(".",0);if(x>0?(y=b.substring(0,x),w=b.substring(x+1,x.length)):(y=b,w=void 0),t["[[useGrouping]]"]===!0){var D=s.group,z=[],k=o.patterns.primaryGroupSize||3,F=o.patterns.secondaryGroupSize||k;if(y.length>k){var j=y.length-k,S=j%F,L=y.slice(0,S);for(L.length&&de.call(z,L);Sa;a++){var i=n[a];t+=i["[[value]]"]}return t}function I(r,n,t){var a=t,i=void 0,o=void 0;if(0===r)i=pe.call(Array(a+1),"0"),o=0;else{o=e(Math.abs(r));var s=Math.round(Math.exp(Math.abs(o-a+1)*Math.LN10));i=String(Math.round(o-a+1<0?r*s:r/s))}if(o>=a)return i+pe.call(Array(o-a+1+1),"0");if(o===a-1)return i;if(o>=0?i=i.slice(0,o+1)+"."+i.slice(o+1):o<0&&(i="0."+pe.call(Array(-(o+1)+1),"0")+i),i.indexOf(".")>=0&&t>n){for(var l=t-n;l>0&&"0"===i.charAt(i.length-1);)i=i.slice(0,-1),l--;"."===i.charAt(i.length-1)&&(i=i.slice(0,-1))}return i}function R(e,r,n,t){var a=t,i=Math.pow(10,a)*e,o=0===i?"0":i.toFixed(0),s=void 0,l=(s=o.indexOf("e"))>-1?o.slice(s+1):0;l&&(o=o.slice(0,s).replace(".",""),o+=pe.call(Array(l-(o.length-1)+1),"0"));var c=void 0;if(0!==a){var u=o.length;if(u<=a){var g=pe.call(Array(a+1-u+1),"0");o=g+o,u=a+1}var m=o.substring(0,u-a),f=o.substring(u-a,o.length);o=m+"."+f,c=m.length}else c=o.length;for(var v=t-n;v>0&&"0"===o.slice(-1);)o=o.slice(0,-1),v--;if("."===o.slice(-1)&&(o=o.slice(0,-1)),cl&&(l=f,c=m),u++}return c}function J(e,r){var n=[];for(var t in Je)ue.call(Je,t)&&void 0!==e["[["+t+"]]"]&&n.push(t);if(1===n.length){var a=$(n[0],e["[["+n[0]+"]]"]);if(a)return a}for(var i=120,o=20,s=8,l=6,c=6,u=3,g=2,m=1,f=-(1/0),v=void 0,h=0,d=r.length;h=2||F>=2&&k<=1?j>0?b-=l:j<0&&(b-=s):j>1?b-=u:j<-1&&(b-=c)}}p._.hour12!==e.hour12&&(b-=m),b>f&&(f=b,v=p),h++}return v}function Q(){var e=null!==this&&"object"===oe(this)&&l(this);if(!e||!e["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for format() is not an initialized Intl.DateTimeFormat object.");if(void 0===e["[[boundFormat]]"]){var r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=void 0===e?Date.now():i(e);return ne(this,r)},n=ye.call(r,this);e["[[boundFormat]]"]=n}return e["[[boundFormat]]"]}function ee(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=null!==this&&"object"===oe(this)&&l(this);if(!r||!r["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.");var n=void 0===e?Date.now():i(e);return te(this,n)}function re(e,r){if(!isFinite(r))throw new RangeError("Invalid valid date passed to format");var a=e.__getInternalProperties(xe);t();for(var i=a["[[locale]]"],o=new Ze.NumberFormat([i],{useGrouping:!1}),s=new Ze.NumberFormat([i],{minimumIntegerDigits:2,useGrouping:!1}),l=ae(r,a["[[calendar]]"],a["[[timeZone]]"]),c=a["[[pattern]]"],u=new n,g=0,m=c.indexOf("{"),f=0,v=a["[[dataLocale]]"],h=we.DateTimeFormat["[[localeData]]"][v].calendars,d=a["[[calendar]]"];m!==-1;){var p=void 0;if(f=c.indexOf("}",m),f===-1)throw new Error("Unclosed pattern");m>g&&de.call(u,{type:"literal",value:c.substring(g,m)});var b=c.substring(m+1,f);if(Je.hasOwnProperty(b)){var y=a["[["+b+"]]"],w=l["[["+b+"]]"];if("year"===b&&w<=0?w=1-w:"month"===b?w++:"hour"===b&&a["[[hour12]]"]===!0&&(w%=12,0===w&&a["[[hourNo0]]"]===!0&&(w=12)),"numeric"===y)p=T(o,w);else if("2-digit"===y)p=T(s,w),p.length>2&&(p=p.slice(-2));else if(y in We)switch(b){case"month":p=K(h,d,"months",y,l["[["+b+"]]"]);break;case"weekday":try{p=K(h,d,"days",y,l["[["+b+"]]"])}catch(e){throw new Error("Could not find weekday data for locale "+i)}break;case"timeZoneName":p="";break;case"era":try{p=K(h,d,"eras",y,l["[["+b+"]]"])}catch(e){throw new Error("Could not find era data for locale "+i)}break;default:p=l["[["+b+"]]"]}de.call(u,{type:b,value:p})}else if("ampm"===b){var x=l["[[hour]]"];p=K(h,d,"dayPeriods",x>11?"pm":"am",null),de.call(u,{type:"dayPeriod",value:p})}else de.call(u,{type:"literal",value:c.substring(m,f+1)});g=f+1,m=c.indexOf("{",g)}return fa;a++){var i=n[a];t+=i.value}return t}function te(e,r){for(var n=re(e,r),t=[],a=0;n.length>a;a++){var i=n[a];t.push({type:i.type,value:i.value})}return t}function ae(e,n,t){var a=new Date(e),i="get"+(t||"");return new r({"[[weekday]]":a[i+"Day"](),"[[era]]":+(a[i+"FullYear"]()>=0),"[[year]]":a[i+"FullYear"](),"[[month]]":a[i+"Month"](),"[[day]]":a[i+"Date"](),"[[hour]]":a[i+"Hours"](),"[[minute]]":a[i+"Minutes"](),"[[second]]":a[i+"Seconds"](),"[[inDST]]":!1})}function ie(e,r){if(!e.number)throw new Error("Object passed doesn't contain locale data for Intl.NumberFormat");var n=void 0,t=[r],a=r.split("-");for(a.length>2&&4===a[1].length&&de.call(t,a[0]+"-"+a[2]);n=be.call(t);)de.call(we.NumberFormat["[[availableLocales]]"],n),we.NumberFormat["[[localeData]]"][n]=e.number,e.date&&(e.date.nu=e.number.nu,de.call(we.DateTimeFormat["[[availableLocales]]"],n),we.DateTimeFormat["[[localeData]]"][n]=e.date);void 0===qe&&c(r)}var oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},se=function(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e},le=function(){var e=function(){};try{return Object.defineProperty(e,"a",{get:function(){return 1}}),Object.defineProperty(e,"prototype",{writable:!1}),1===e.a&&e.prototype instanceof Object}catch(e){return!1}}(),ce=!le&&!Object.prototype.__defineGetter__,ue=Object.prototype.hasOwnProperty,ge=le?Object.defineProperty:function(e,r,n){"get"in n&&e.__defineGetter__?e.__defineGetter__(r,n.get):(!ue.call(e,r)||"value"in n)&&(e[r]=n.value)},me=Array.prototype.indexOf||function(e){var r=this;if(!r.length)return-1;for(var n=arguments[1]||0,t=r.length;n n); -} - -/** - * A map that doesn't contain Object in its prototype chain - */ -function Record(obj) { - // Copy only own properties over unless this object is already a Record instance - for (var k in obj) { - if (obj instanceof Record || hop.call(obj, k)) defineProperty$$1(this, k, { value: obj[k], enumerable: true, writable: true, configurable: true }); - } -} -Record.prototype = objCreate(null); - -/** - * An ordered list - */ -function List() { - defineProperty$$1(this, 'length', { writable: true, value: 0 }); - - if (arguments.length) arrPush.apply(this, arrSlice.call(arguments)); -} -List.prototype = objCreate(null); - -/** - * Constructs a regular expression to restore tainted RegExp properties - */ -function createRegExpRestore() { - if (internals.disableRegExpRestore) { - return function () {/* no-op */}; - } - - var regExpCache = { - lastMatch: RegExp.lastMatch || '', - leftContext: RegExp.leftContext, - multiline: RegExp.multiline, - input: RegExp.input - }, - has = false; - - // Create a snapshot of all the 'captured' properties - for (var i = 1; i <= 9; i++) { - has = (regExpCache['$' + i] = RegExp['$' + i]) || has; - }return function () { - // Now we've snapshotted some properties, escape the lastMatch string - var esc = /[.?*+^$[\]\\(){}|-]/g, - lastMatch = regExpCache.lastMatch.replace(esc, '\\$&'), - exprStr = ''; - - // If any of the captured strings were non-empty, iterate over them all - if (has) { - for (var _i = 1; _i <= 9; _i++) { - var m = regExpCache['$' + _i]; - - // If it's empty, add an empty capturing group - if (!m) { - exprStr += '('; - lastMatch = ')' + lastMatch; - } - // Else find the string in lm and escape & wrap it to capture it - else { - m = m.replace(esc, '\\$&'); - exprStr += lastMatch.substring(0, lastMatch.indexOf(m)) + '('; - lastMatch = m + ')' + lastMatch.substring(lastMatch.indexOf(m) + m.length); - } - } - } - - exprStr += lastMatch; - - // Shorten the regex by replacing each part of the expression with a match - // for a string of that exact length. This is safe for the type of - // expressions generated above, because the expression matches the whole - // match string, so we know each group and each segment between capturing - // groups can be matched by its length alone. - // - // The purpose of the regex is to match sequences of characters other - // than unescaped parentheses. This is a more complicated requirement - // than it seems at first glance, because it's necessary to match a - // parenthesis which appears immediately after a backslash ("\("), but - // not a parenthesis which appears immediately after an escaped backslash - // ("\\("). We can't simply match [^\\]\\(, because the previous - // backslash could itself have a backslash preceding (and escaping) it. - // - // Any attempts to simplify this regex are encouraged! A replacement - // regex should match the strings "a\\\(\\\)\\" and "a\\\)\\\(" in the - // test string "a\\\(\\\)\\(a\\\)\\\()". - exprStr = exprStr.replace(/((^|[^\\])((\\\\)*\\[()])+|[^()])+/g, function (match) { - return '[\\s\\S]{' + match.replace(/\\(.)/g, '$1').length + '}'; - }); - - // Create the regular expression that will reconstruct the RegExp properties - var expr = new RegExp(exprStr, regExpCache.multiline ? 'gm' : 'g'); - - // Set the lastIndex of the generated expression to ensure that the match - // is found in the correct index. - expr.lastIndex = regExpCache.leftContext.length; - - expr.exec(regExpCache.input); - }; -} - -/** - * Mimics ES5's abstract ToObject() function - */ -function toObject(arg) { - if (arg === null) throw new TypeError('Cannot convert null or undefined to object'); - - if ((typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object') return arg; - return Object(arg); -} - -function toNumber(arg) { - if (typeof arg === 'number') return arg; - return Number(arg); -} - -function toInteger(arg) { - var number = toNumber(arg); - if (isNaN(number)) return 0; - if (number === +0 || number === -0 || number === +Infinity || number === -Infinity) return number; - if (number < 0) return Math.floor(Math.abs(number)) * -1; - return Math.floor(Math.abs(number)); -} - -function toLength(arg) { - var len = toInteger(arg); - if (len <= 0) return 0; - if (len === Infinity) return Math.pow(2, 53) - 1; - return Math.min(len, Math.pow(2, 53) - 1); -} - -/** - * Returns "internal" properties for an object - */ -function getInternalProperties(obj) { - if (hop.call(obj, '__getInternalProperties')) return obj.__getInternalProperties(secret); - - return objCreate(null); -} - -/** -* Defines regular expressions for various operations related to the BCP 47 syntax, -* as defined at http://tools.ietf.org/html/bcp47#section-2.1 -*/ - -// extlang = 3ALPHA ; selected ISO 639 codes -// *2("-" 3ALPHA) ; permanently reserved -var extlang = '[a-z]{3}(?:-[a-z]{3}){0,2}'; - -// language = 2*3ALPHA ; shortest ISO 639 code -// ["-" extlang] ; sometimes followed by -// ; extended language subtags -// / 4ALPHA ; or reserved for future use -// / 5*8ALPHA ; or registered language subtag -var language = '(?:[a-z]{2,3}(?:-' + extlang + ')?|[a-z]{4}|[a-z]{5,8})'; - -// script = 4ALPHA ; ISO 15924 code -var script = '[a-z]{4}'; - -// region = 2ALPHA ; ISO 3166-1 code -// / 3DIGIT ; UN M.49 code -var region = '(?:[a-z]{2}|\\d{3})'; - -// variant = 5*8alphanum ; registered variants -// / (DIGIT 3alphanum) -var variant = '(?:[a-z0-9]{5,8}|\\d[a-z0-9]{3})'; - -// ; Single alphanumerics -// ; "x" reserved for private use -// singleton = DIGIT ; 0 - 9 -// / %x41-57 ; A - W -// / %x59-5A ; Y - Z -// / %x61-77 ; a - w -// / %x79-7A ; y - z -var singleton = '[0-9a-wy-z]'; - -// extension = singleton 1*("-" (2*8alphanum)) -var extension = singleton + '(?:-[a-z0-9]{2,8})+'; - -// privateuse = "x" 1*("-" (1*8alphanum)) -var privateuse = 'x(?:-[a-z0-9]{1,8})+'; - -// irregular = "en-GB-oed" ; irregular tags do not match -// / "i-ami" ; the 'langtag' production and -// / "i-bnn" ; would not otherwise be -// / "i-default" ; considered 'well-formed' -// / "i-enochian" ; These tags are all valid, -// / "i-hak" ; but most are deprecated -// / "i-klingon" ; in favor of more modern -// / "i-lux" ; subtags or subtag -// / "i-mingo" ; combination -// / "i-navajo" -// / "i-pwn" -// / "i-tao" -// / "i-tay" -// / "i-tsu" -// / "sgn-BE-FR" -// / "sgn-BE-NL" -// / "sgn-CH-DE" -var irregular = '(?:en-GB-oed' + '|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)' + '|sgn-(?:BE-FR|BE-NL|CH-DE))'; - -// regular = "art-lojban" ; these tags match the 'langtag' -// / "cel-gaulish" ; production, but their subtags -// / "no-bok" ; are not extended language -// / "no-nyn" ; or variant subtags: their meaning -// / "zh-guoyu" ; is defined by their registration -// / "zh-hakka" ; and all of these are deprecated -// / "zh-min" ; in favor of a more modern -// / "zh-min-nan" ; subtag or sequence of subtags -// / "zh-xiang" -var regular = '(?:art-lojban|cel-gaulish|no-bok|no-nyn' + '|zh-(?:guoyu|hakka|min|min-nan|xiang))'; - -// grandfathered = irregular ; non-redundant tags registered -// / regular ; during the RFC 3066 era -var grandfathered = '(?:' + irregular + '|' + regular + ')'; - -// langtag = language -// ["-" script] -// ["-" region] -// *("-" variant) -// *("-" extension) -// ["-" privateuse] -var langtag = language + '(?:-' + script + ')?(?:-' + region + ')?(?:-' + variant + ')*(?:-' + extension + ')*(?:-' + privateuse + ')?'; - -// Language-Tag = langtag ; normal language tags -// / privateuse ; private use tag -// / grandfathered ; grandfathered tags -var expBCP47Syntax = RegExp('^(?:' + langtag + '|' + privateuse + '|' + grandfathered + ')$', 'i'); - -// Match duplicate variants in a language tag -var expVariantDupes = RegExp('^(?!x).*?-(' + variant + ')-(?:\\w{4,8}-(?!x-))*\\1\\b', 'i'); - -// Match duplicate singletons in a language tag (except in private use) -var expSingletonDupes = RegExp('^(?!x).*?-(' + singleton + ')-(?:\\w+-(?!x-))*\\1\\b', 'i'); - -// Match all extension sequences -var expExtSequences = RegExp('-' + extension, 'ig'); - -// Sect 6.2 Language Tags -// ====================== - -// Default locale is the first-added locale data for us -var defaultLocale = void 0; -function setDefaultLocale(locale) { - defaultLocale = locale; -} - -// IANA Subtag Registry redundant tag and subtag maps -var redundantTags = { - tags: { - "art-lojban": "jbo", - "i-ami": "ami", - "i-bnn": "bnn", - "i-hak": "hak", - "i-klingon": "tlh", - "i-lux": "lb", - "i-navajo": "nv", - "i-pwn": "pwn", - "i-tao": "tao", - "i-tay": "tay", - "i-tsu": "tsu", - "no-bok": "nb", - "no-nyn": "nn", - "sgn-BE-FR": "sfb", - "sgn-BE-NL": "vgt", - "sgn-CH-DE": "sgg", - "zh-guoyu": "cmn", - "zh-hakka": "hak", - "zh-min-nan": "nan", - "zh-xiang": "hsn", - "sgn-BR": "bzs", - "sgn-CO": "csn", - "sgn-DE": "gsg", - "sgn-DK": "dsl", - "sgn-ES": "ssp", - "sgn-FR": "fsl", - "sgn-GB": "bfi", - "sgn-GR": "gss", - "sgn-IE": "isg", - "sgn-IT": "ise", - "sgn-JP": "jsl", - "sgn-MX": "mfs", - "sgn-NI": "ncs", - "sgn-NL": "dse", - "sgn-NO": "nsl", - "sgn-PT": "psr", - "sgn-SE": "swl", - "sgn-US": "ase", - "sgn-ZA": "sfs", - "zh-cmn": "cmn", - "zh-cmn-Hans": "cmn-Hans", - "zh-cmn-Hant": "cmn-Hant", - "zh-gan": "gan", - "zh-wuu": "wuu", - "zh-yue": "yue" - }, - subtags: { - BU: "MM", - DD: "DE", - FX: "FR", - TP: "TL", - YD: "YE", - ZR: "CD", - heploc: "alalc97", - 'in': "id", - iw: "he", - ji: "yi", - jw: "jv", - mo: "ro", - ayx: "nun", - bjd: "drl", - ccq: "rki", - cjr: "mom", - cka: "cmr", - cmk: "xch", - drh: "khk", - drw: "prs", - gav: "dev", - hrr: "jal", - ibi: "opa", - kgh: "kml", - lcq: "ppr", - mst: "mry", - myt: "mry", - sca: "hle", - tie: "ras", - tkk: "twm", - tlw: "weo", - tnf: "prs", - ybd: "rki", - yma: "lrr" - }, - extLang: { - aao: ["aao", "ar"], - abh: ["abh", "ar"], - abv: ["abv", "ar"], - acm: ["acm", "ar"], - acq: ["acq", "ar"], - acw: ["acw", "ar"], - acx: ["acx", "ar"], - acy: ["acy", "ar"], - adf: ["adf", "ar"], - ads: ["ads", "sgn"], - aeb: ["aeb", "ar"], - aec: ["aec", "ar"], - aed: ["aed", "sgn"], - aen: ["aen", "sgn"], - afb: ["afb", "ar"], - afg: ["afg", "sgn"], - ajp: ["ajp", "ar"], - apc: ["apc", "ar"], - apd: ["apd", "ar"], - arb: ["arb", "ar"], - arq: ["arq", "ar"], - ars: ["ars", "ar"], - ary: ["ary", "ar"], - arz: ["arz", "ar"], - ase: ["ase", "sgn"], - asf: ["asf", "sgn"], - asp: ["asp", "sgn"], - asq: ["asq", "sgn"], - asw: ["asw", "sgn"], - auz: ["auz", "ar"], - avl: ["avl", "ar"], - ayh: ["ayh", "ar"], - ayl: ["ayl", "ar"], - ayn: ["ayn", "ar"], - ayp: ["ayp", "ar"], - bbz: ["bbz", "ar"], - bfi: ["bfi", "sgn"], - bfk: ["bfk", "sgn"], - bjn: ["bjn", "ms"], - bog: ["bog", "sgn"], - bqn: ["bqn", "sgn"], - bqy: ["bqy", "sgn"], - btj: ["btj", "ms"], - bve: ["bve", "ms"], - bvl: ["bvl", "sgn"], - bvu: ["bvu", "ms"], - bzs: ["bzs", "sgn"], - cdo: ["cdo", "zh"], - cds: ["cds", "sgn"], - cjy: ["cjy", "zh"], - cmn: ["cmn", "zh"], - coa: ["coa", "ms"], - cpx: ["cpx", "zh"], - csc: ["csc", "sgn"], - csd: ["csd", "sgn"], - cse: ["cse", "sgn"], - csf: ["csf", "sgn"], - csg: ["csg", "sgn"], - csl: ["csl", "sgn"], - csn: ["csn", "sgn"], - csq: ["csq", "sgn"], - csr: ["csr", "sgn"], - czh: ["czh", "zh"], - czo: ["czo", "zh"], - doq: ["doq", "sgn"], - dse: ["dse", "sgn"], - dsl: ["dsl", "sgn"], - dup: ["dup", "ms"], - ecs: ["ecs", "sgn"], - esl: ["esl", "sgn"], - esn: ["esn", "sgn"], - eso: ["eso", "sgn"], - eth: ["eth", "sgn"], - fcs: ["fcs", "sgn"], - fse: ["fse", "sgn"], - fsl: ["fsl", "sgn"], - fss: ["fss", "sgn"], - gan: ["gan", "zh"], - gds: ["gds", "sgn"], - gom: ["gom", "kok"], - gse: ["gse", "sgn"], - gsg: ["gsg", "sgn"], - gsm: ["gsm", "sgn"], - gss: ["gss", "sgn"], - gus: ["gus", "sgn"], - hab: ["hab", "sgn"], - haf: ["haf", "sgn"], - hak: ["hak", "zh"], - hds: ["hds", "sgn"], - hji: ["hji", "ms"], - hks: ["hks", "sgn"], - hos: ["hos", "sgn"], - hps: ["hps", "sgn"], - hsh: ["hsh", "sgn"], - hsl: ["hsl", "sgn"], - hsn: ["hsn", "zh"], - icl: ["icl", "sgn"], - ils: ["ils", "sgn"], - inl: ["inl", "sgn"], - ins: ["ins", "sgn"], - ise: ["ise", "sgn"], - isg: ["isg", "sgn"], - isr: ["isr", "sgn"], - jak: ["jak", "ms"], - jax: ["jax", "ms"], - jcs: ["jcs", "sgn"], - jhs: ["jhs", "sgn"], - jls: ["jls", "sgn"], - jos: ["jos", "sgn"], - jsl: ["jsl", "sgn"], - jus: ["jus", "sgn"], - kgi: ["kgi", "sgn"], - knn: ["knn", "kok"], - kvb: ["kvb", "ms"], - kvk: ["kvk", "sgn"], - kvr: ["kvr", "ms"], - kxd: ["kxd", "ms"], - lbs: ["lbs", "sgn"], - lce: ["lce", "ms"], - lcf: ["lcf", "ms"], - liw: ["liw", "ms"], - lls: ["lls", "sgn"], - lsg: ["lsg", "sgn"], - lsl: ["lsl", "sgn"], - lso: ["lso", "sgn"], - lsp: ["lsp", "sgn"], - lst: ["lst", "sgn"], - lsy: ["lsy", "sgn"], - ltg: ["ltg", "lv"], - lvs: ["lvs", "lv"], - lzh: ["lzh", "zh"], - max: ["max", "ms"], - mdl: ["mdl", "sgn"], - meo: ["meo", "ms"], - mfa: ["mfa", "ms"], - mfb: ["mfb", "ms"], - mfs: ["mfs", "sgn"], - min: ["min", "ms"], - mnp: ["mnp", "zh"], - mqg: ["mqg", "ms"], - mre: ["mre", "sgn"], - msd: ["msd", "sgn"], - msi: ["msi", "ms"], - msr: ["msr", "sgn"], - mui: ["mui", "ms"], - mzc: ["mzc", "sgn"], - mzg: ["mzg", "sgn"], - mzy: ["mzy", "sgn"], - nan: ["nan", "zh"], - nbs: ["nbs", "sgn"], - ncs: ["ncs", "sgn"], - nsi: ["nsi", "sgn"], - nsl: ["nsl", "sgn"], - nsp: ["nsp", "sgn"], - nsr: ["nsr", "sgn"], - nzs: ["nzs", "sgn"], - okl: ["okl", "sgn"], - orn: ["orn", "ms"], - ors: ["ors", "ms"], - pel: ["pel", "ms"], - pga: ["pga", "ar"], - pks: ["pks", "sgn"], - prl: ["prl", "sgn"], - prz: ["prz", "sgn"], - psc: ["psc", "sgn"], - psd: ["psd", "sgn"], - pse: ["pse", "ms"], - psg: ["psg", "sgn"], - psl: ["psl", "sgn"], - pso: ["pso", "sgn"], - psp: ["psp", "sgn"], - psr: ["psr", "sgn"], - pys: ["pys", "sgn"], - rms: ["rms", "sgn"], - rsi: ["rsi", "sgn"], - rsl: ["rsl", "sgn"], - sdl: ["sdl", "sgn"], - sfb: ["sfb", "sgn"], - sfs: ["sfs", "sgn"], - sgg: ["sgg", "sgn"], - sgx: ["sgx", "sgn"], - shu: ["shu", "ar"], - slf: ["slf", "sgn"], - sls: ["sls", "sgn"], - sqk: ["sqk", "sgn"], - sqs: ["sqs", "sgn"], - ssh: ["ssh", "ar"], - ssp: ["ssp", "sgn"], - ssr: ["ssr", "sgn"], - svk: ["svk", "sgn"], - swc: ["swc", "sw"], - swh: ["swh", "sw"], - swl: ["swl", "sgn"], - syy: ["syy", "sgn"], - tmw: ["tmw", "ms"], - tse: ["tse", "sgn"], - tsm: ["tsm", "sgn"], - tsq: ["tsq", "sgn"], - tss: ["tss", "sgn"], - tsy: ["tsy", "sgn"], - tza: ["tza", "sgn"], - ugn: ["ugn", "sgn"], - ugy: ["ugy", "sgn"], - ukl: ["ukl", "sgn"], - uks: ["uks", "sgn"], - urk: ["urk", "ms"], - uzn: ["uzn", "uz"], - uzs: ["uzs", "uz"], - vgt: ["vgt", "sgn"], - vkk: ["vkk", "ms"], - vkt: ["vkt", "ms"], - vsi: ["vsi", "sgn"], - vsl: ["vsl", "sgn"], - vsv: ["vsv", "sgn"], - wuu: ["wuu", "zh"], - xki: ["xki", "sgn"], - xml: ["xml", "sgn"], - xmm: ["xmm", "ms"], - xms: ["xms", "sgn"], - yds: ["yds", "sgn"], - ysl: ["ysl", "sgn"], - yue: ["yue", "zh"], - zib: ["zib", "sgn"], - zlm: ["zlm", "ms"], - zmi: ["zmi", "ms"], - zsl: ["zsl", "sgn"], - zsm: ["zsm", "ms"] - } -}; - -/** - * Convert only a-z to uppercase as per section 6.1 of the spec - */ -function toLatinUpperCase(str) { - var i = str.length; - - while (i--) { - var ch = str.charAt(i); - - if (ch >= "a" && ch <= "z") str = str.slice(0, i) + ch.toUpperCase() + str.slice(i + 1); - } - - return str; -} - -/** - * The IsStructurallyValidLanguageTag abstract operation verifies that the locale - * argument (which must be a String value) - * - * - represents a well-formed BCP 47 language tag as specified in RFC 5646 section - * 2.1, or successor, - * - does not include duplicate variant subtags, and - * - does not include duplicate singleton subtags. - * - * The abstract operation returns true if locale can be generated from the ABNF - * grammar in section 2.1 of the RFC, starting with Language-Tag, and does not - * contain duplicate variant or singleton subtags (other than as a private use - * subtag). It returns false otherwise. Terminal value characters in the grammar are - * interpreted as the Unicode equivalents of the ASCII octet values given. - */ -function /* 6.2.2 */IsStructurallyValidLanguageTag(locale) { - // represents a well-formed BCP 47 language tag as specified in RFC 5646 - if (!expBCP47Syntax.test(locale)) return false; - - // does not include duplicate variant subtags, and - if (expVariantDupes.test(locale)) return false; - - // does not include duplicate singleton subtags. - if (expSingletonDupes.test(locale)) return false; - - return true; -} - -/** - * The CanonicalizeLanguageTag abstract operation returns the canonical and case- - * regularized form of the locale argument (which must be a String value that is - * a structurally valid BCP 47 language tag as verified by the - * IsStructurallyValidLanguageTag abstract operation). It takes the steps - * specified in RFC 5646 section 4.5, or successor, to bring the language tag - * into canonical form, and to regularize the case of the subtags, but does not - * take the steps to bring a language tag into “extlang form” and to reorder - * variant subtags. - - * The specifications for extensions to BCP 47 language tags, such as RFC 6067, - * may include canonicalization rules for the extension subtag sequences they - * define that go beyond the canonicalization rules of RFC 5646 section 4.5. - * Implementations are allowed, but not required, to apply these additional rules. - */ -function /* 6.2.3 */CanonicalizeLanguageTag(locale) { - var match = void 0, - parts = void 0; - - // A language tag is in 'canonical form' when the tag is well-formed - // according to the rules in Sections 2.1 and 2.2 - - // Section 2.1 says all subtags use lowercase... - locale = locale.toLowerCase(); - - // ...with 2 exceptions: 'two-letter and four-letter subtags that neither - // appear at the start of the tag nor occur after singletons. Such two-letter - // subtags are all uppercase (as in the tags "en-CA-x-ca" or "sgn-BE-FR") and - // four-letter subtags are titlecase (as in the tag "az-Latn-x-latn"). - parts = locale.split('-'); - for (var i = 1, max = parts.length; i < max; i++) { - // Two-letter subtags are all uppercase - if (parts[i].length === 2) parts[i] = parts[i].toUpperCase(); - - // Four-letter subtags are titlecase - else if (parts[i].length === 4) parts[i] = parts[i].charAt(0).toUpperCase() + parts[i].slice(1); - - // Is it a singleton? - else if (parts[i].length === 1 && parts[i] !== 'x') break; - } - locale = arrJoin.call(parts, '-'); - - // The steps laid out in RFC 5646 section 4.5 are as follows: - - // 1. Extension sequences are ordered into case-insensitive ASCII order - // by singleton subtag. - if ((match = locale.match(expExtSequences)) && match.length > 1) { - // The built-in sort() sorts by ASCII order, so use that - match.sort(); - - // Replace all extensions with the joined, sorted array - locale = locale.replace(RegExp('(?:' + expExtSequences.source + ')+', 'i'), arrJoin.call(match, '')); - } - - // 2. Redundant or grandfathered tags are replaced by their 'Preferred- - // Value', if there is one. - if (hop.call(redundantTags.tags, locale)) locale = redundantTags.tags[locale]; - - // 3. Subtags are replaced by their 'Preferred-Value', if there is one. - // For extlangs, the original primary language subtag is also - // replaced if there is a primary language subtag in the 'Preferred- - // Value'. - parts = locale.split('-'); - - for (var _i = 1, _max = parts.length; _i < _max; _i++) { - if (hop.call(redundantTags.subtags, parts[_i])) parts[_i] = redundantTags.subtags[parts[_i]];else if (hop.call(redundantTags.extLang, parts[_i])) { - parts[_i] = redundantTags.extLang[parts[_i]][0]; - - // For extlang tags, the prefix needs to be removed if it is redundant - if (_i === 1 && redundantTags.extLang[parts[1]][1] === parts[0]) { - parts = arrSlice.call(parts, _i++); - _max -= 1; - } - } - } - - return arrJoin.call(parts, '-'); -} - -/** - * The DefaultLocale abstract operation returns a String value representing the - * structurally valid (6.2.2) and canonicalized (6.2.3) BCP 47 language tag for the - * host environment’s current locale. - */ -function /* 6.2.4 */DefaultLocale() { - return defaultLocale; -} - -// Sect 6.3 Currency Codes -// ======================= - -var expCurrencyCode = /^[A-Z]{3}$/; - -/** - * The IsWellFormedCurrencyCode abstract operation verifies that the currency argument - * (after conversion to a String value) represents a well-formed 3-letter ISO currency - * code. The following steps are taken: - */ -function /* 6.3.1 */IsWellFormedCurrencyCode(currency) { - // 1. Let `c` be ToString(currency) - var c = String(currency); - - // 2. Let `normalized` be the result of mapping c to upper case as described - // in 6.1. - var normalized = toLatinUpperCase(c); - - // 3. If the string length of normalized is not 3, return false. - // 4. If normalized contains any character that is not in the range "A" to "Z" - // (U+0041 to U+005A), return false. - if (expCurrencyCode.test(normalized) === false) return false; - - // 5. Return true - return true; -} - -// Sect 9.2 Abstract Operations -// ============================ - -var expUnicodeExSeq = /-u(?:-[0-9a-z]{2,8})+/gi; // See `extension` below - -function /* 9.2.1 */CanonicalizeLocaleList(locales) { - // The abstract operation CanonicalizeLocaleList takes the following steps: - - // 1. If locales is undefined, then a. Return a new empty List - if (locales === undefined) return new List(); - - // 2. Let seen be a new empty List. - var seen = new List(); - - // 3. If locales is a String value, then - // a. Let locales be a new array created as if by the expression new - // Array(locales) where Array is the standard built-in constructor with - // that name and locales is the value of locales. - locales = typeof locales === 'string' ? [locales] : locales; - - // 4. Let O be ToObject(locales). - var O = toObject(locales); - - // 5. Let lenValue be the result of calling the [[Get]] internal method of - // O with the argument "length". - // 6. Let len be ToUint32(lenValue). - var len = toLength(O.length); - - // 7. Let k be 0. - var k = 0; - - // 8. Repeat, while k < len - while (k < len) { - // a. Let Pk be ToString(k). - var Pk = String(k); - - // b. Let kPresent be the result of calling the [[HasProperty]] internal - // method of O with argument Pk. - var kPresent = Pk in O; - - // c. If kPresent is true, then - if (kPresent) { - // i. Let kValue be the result of calling the [[Get]] internal - // method of O with argument Pk. - var kValue = O[Pk]; - - // ii. If the type of kValue is not String or Object, then throw a - // TypeError exception. - if (kValue === null || typeof kValue !== 'string' && (typeof kValue === "undefined" ? "undefined" : _typeof(kValue)) !== 'object') throw new TypeError('String or Object type expected'); - - // iii. Let tag be ToString(kValue). - var tag = String(kValue); - - // iv. If the result of calling the abstract operation - // IsStructurallyValidLanguageTag (defined in 6.2.2), passing tag as - // the argument, is false, then throw a RangeError exception. - if (!IsStructurallyValidLanguageTag(tag)) throw new RangeError("'" + tag + "' is not a structurally valid language tag"); - - // v. Let tag be the result of calling the abstract operation - // CanonicalizeLanguageTag (defined in 6.2.3), passing tag as the - // argument. - tag = CanonicalizeLanguageTag(tag); - - // vi. If tag is not an element of seen, then append tag as the last - // element of seen. - if (arrIndexOf.call(seen, tag) === -1) arrPush.call(seen, tag); - } - - // d. Increase k by 1. - k++; - } - - // 9. Return seen. - return seen; -} - -/** - * The BestAvailableLocale abstract operation compares the provided argument - * locale, which must be a String value with a structurally valid and - * canonicalized BCP 47 language tag, against the locales in availableLocales and - * returns either the longest non-empty prefix of locale that is an element of - * availableLocales, or undefined if there is no such element. It uses the - * fallback mechanism of RFC 4647, section 3.4. The following steps are taken: - */ -function /* 9.2.2 */BestAvailableLocale(availableLocales, locale) { - // 1. Let candidate be locale - var candidate = locale; - - // 2. Repeat - while (candidate) { - // a. If availableLocales contains an element equal to candidate, then return - // candidate. - if (arrIndexOf.call(availableLocales, candidate) > -1) return candidate; - - // b. Let pos be the character index of the last occurrence of "-" - // (U+002D) within candidate. If that character does not occur, return - // undefined. - var pos = candidate.lastIndexOf('-'); - - if (pos < 0) return; - - // c. If pos ≥ 2 and the character "-" occurs at index pos-2 of candidate, - // then decrease pos by 2. - if (pos >= 2 && candidate.charAt(pos - 2) === '-') pos -= 2; - - // d. Let candidate be the substring of candidate from position 0, inclusive, - // to position pos, exclusive. - candidate = candidate.substring(0, pos); - } -} - -/** - * The LookupMatcher abstract operation compares requestedLocales, which must be - * a List as returned by CanonicalizeLocaleList, against the locales in - * availableLocales and determines the best available language to meet the - * request. The following steps are taken: - */ -function /* 9.2.3 */LookupMatcher(availableLocales, requestedLocales) { - // 1. Let i be 0. - var i = 0; - - // 2. Let len be the number of elements in requestedLocales. - var len = requestedLocales.length; - - // 3. Let availableLocale be undefined. - var availableLocale = void 0; - - var locale = void 0, - noExtensionsLocale = void 0; - - // 4. Repeat while i < len and availableLocale is undefined: - while (i < len && !availableLocale) { - // a. Let locale be the element of requestedLocales at 0-origined list - // position i. - locale = requestedLocales[i]; - - // b. Let noExtensionsLocale be the String value that is locale with all - // Unicode locale extension sequences removed. - noExtensionsLocale = String(locale).replace(expUnicodeExSeq, ''); - - // c. Let availableLocale be the result of calling the - // BestAvailableLocale abstract operation (defined in 9.2.2) with - // arguments availableLocales and noExtensionsLocale. - availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale); - - // d. Increase i by 1. - i++; - } - - // 5. Let result be a new Record. - var result = new Record(); - - // 6. If availableLocale is not undefined, then - if (availableLocale !== undefined) { - // a. Set result.[[locale]] to availableLocale. - result['[[locale]]'] = availableLocale; - - // b. If locale and noExtensionsLocale are not the same String value, then - if (String(locale) !== String(noExtensionsLocale)) { - // i. Let extension be the String value consisting of the first - // substring of locale that is a Unicode locale extension sequence. - var extension = locale.match(expUnicodeExSeq)[0]; - - // ii. Let extensionIndex be the character position of the initial - // "-" of the first Unicode locale extension sequence within locale. - var extensionIndex = locale.indexOf('-u-'); - - // iii. Set result.[[extension]] to extension. - result['[[extension]]'] = extension; - - // iv. Set result.[[extensionIndex]] to extensionIndex. - result['[[extensionIndex]]'] = extensionIndex; - } - } - // 7. Else - else - // a. Set result.[[locale]] to the value returned by the DefaultLocale abstract - // operation (defined in 6.2.4). - result['[[locale]]'] = DefaultLocale(); - - // 8. Return result - return result; -} - -/** - * The BestFitMatcher abstract operation compares requestedLocales, which must be - * a List as returned by CanonicalizeLocaleList, against the locales in - * availableLocales and determines the best available language to meet the - * request. The algorithm is implementation dependent, but should produce results - * that a typical user of the requested locales would perceive as at least as - * good as those produced by the LookupMatcher abstract operation. Options - * specified through Unicode locale extension sequences must be ignored by the - * algorithm. Information about such subsequences is returned separately. - * The abstract operation returns a record with a [[locale]] field, whose value - * is the language tag of the selected locale, which must be an element of - * availableLocales. If the language tag of the request locale that led to the - * selected locale contained a Unicode locale extension sequence, then the - * returned record also contains an [[extension]] field whose value is the first - * Unicode locale extension sequence, and an [[extensionIndex]] field whose value - * is the index of the first Unicode locale extension sequence within the request - * locale language tag. - */ -function /* 9.2.4 */BestFitMatcher(availableLocales, requestedLocales) { - return LookupMatcher(availableLocales, requestedLocales); -} - -// @spec[tc39/ecma402/master/spec/negotiation.html] -// @clause[sec-unicodeextensionsubtags] -function UnicodeExtensionSubtags(extension) { - // 1. Let size be the number of elements in extension. - var size = extension.length; - // 2. If size = 0, then - if (size === 0) { - // a. Return « ». - return []; - } - // 3. Let extensionSubtags be « ». - var extensionSubtags = []; - // 4. Let attribute be true. - var attribute = true; - // 5. Let q be 3. - var q = 3; - // 6. Let p be q. - var p = q; - // 7. Let t be q. - var t = q; - // 8. Repeat, while q < size - while (q < size) { - // a. Let c be the code unit value of the element at index q in the String extension. - var c = extension.codePointAt(q); - // a. If c is 0x002D (HYPHEN-MINUS), then - if (c === 0x002D) { - // i. If q - p = 2, then - if (q - p === 2) { - // 1. If p - t > 1, then - if (p - t > 1) { - // a. Let type be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through p - 1 (exclusive). - var type = extension.substring(t, p - 1); - // a. Append type as the last element of extensionSubtags. - extensionSubtags.push(type); - } - // 2. Let key be a String value equal to the substring of extension consisting of the code units at indices p (inclusive) through q (exclusive). - var key = extension.substring(p, q); - // 3. Append key as the last element of extensionSubtags. - extensionSubtags.push(key); - // 4. Let t be q + 1. - t = q + 1; - // 5. Let attribute be false. - attribute = false; - // ii. Else if attribute is true, then - } else if (attribute === true) { - // 1. Let attr be a String value equal to the substring of extension consisting of the code units at indices p (inclusive) through q (exclusive). - var attr = extension.substring(p, q); - // 2. Append attr as the last element of extensionSubtags. - extensionSubtags.push(attr); - // 3. Let t be q + 1. - t = q + 1; - } - // iii. Let p be q + 1. - p = q + 1; - } - // a. Let q be q + 1. - q = q + 1; - } - // 9. If size - p = 2, then - if (size - p === 2) { - // a. If p - t > 1, then - if (p - t > 1) { - // i. Let type be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through p - 1 (exclusive). - var _type = extension.substring(t, p - 1); - // ii. Append type as the last element of extensionSubtags. - extensionSubtags.push(_type); - } - // a. Let t be p. - t = p; - } - // 10. Let tail be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through size (exclusive). - var tail = extension.substring(t, size); - // 11. Append tail as the last element of extensionSubtags. - extensionSubtags.push(tail); - // 12. Return extensionSubtags. - return extensionSubtags; -} - -/** - * The ResolveLocale abstract operation compares a BCP 47 language priority list - * requestedLocales against the locales in availableLocales and determines the - * best available language to meet the request. availableLocales and - * requestedLocales must be provided as List values, options as a Record. - */ -function /* 9.2.5 */ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData) { - if (availableLocales.length === 0) { - throw new ReferenceError('No locale data has been provided for this object yet.'); - } - - // The following steps are taken: - // 1. Let matcher be the value of options.[[localeMatcher]]. - var matcher = options['[[localeMatcher]]']; - - var r = void 0; - - // 2. If matcher is "lookup", then - if (matcher === 'lookup') - // a. Let r be the result of calling the LookupMatcher abstract operation - // (defined in 9.2.3) with arguments availableLocales and - // requestedLocales. - r = LookupMatcher(availableLocales, requestedLocales); - - // 3. Else - else - // a. Let r be the result of calling the BestFitMatcher abstract - // operation (defined in 9.2.4) with arguments availableLocales and - // requestedLocales. - r = BestFitMatcher(availableLocales, requestedLocales); - - // 4. Let foundLocale be the value of r.[[locale]]. - var foundLocale = r['[[locale]]']; - - var extensionSubtags = void 0, - extensionSubtagsLength = void 0; - - // 5. If r has an [[extension]] field, then - if (hop.call(r, '[[extension]]')) { - // a. Let extension be the value of r.[[extension]]. - var extension = r['[[extension]]']; - // b. Let _extensionSubtags_ be - // CreateArrayFromList(UnicodeExtensionSubtags(_extension_)). - extensionSubtags = UnicodeExtensionSubtags(extension); - // c. Let _extensionSubtagsLength_ be Get(_extensionSubtags_, *"length"*) - extensionSubtagsLength = extensionSubtags.length; - } - - // 6. Let result be a new Record. - var result = new Record(); - - // 7. Set result.[[dataLocale]] to foundLocale. - result['[[dataLocale]]'] = foundLocale; - - // 8. Let supportedExtension be "-u". - var supportedExtension = '-u'; - // 9. Let i be 0. - var i = 0; - // 10. Let len be the result of calling the [[Get]] internal method of - // relevantExtensionKeys with argument "length". - var len = relevantExtensionKeys.length; - - // 11 Repeat while i < len: - while (i < len) { - // a. Let key be the result of calling the [[Get]] internal method of - // relevantExtensionKeys with argument ToString(i). - var key = relevantExtensionKeys[i]; - // b. Let foundLocaleData be the result of calling the [[Get]] internal - // method of localeData with the argument foundLocale. - var foundLocaleData = localeData[foundLocale]; - // c. Let keyLocaleData be the result of calling the [[Get]] internal - // method of foundLocaleData with the argument key. - var keyLocaleData = foundLocaleData[key]; - // d. Let value be the result of calling the [[Get]] internal method of - // keyLocaleData with argument "0". - var value = keyLocaleData['0']; - // e. Let supportedExtensionAddition be "". - var supportedExtensionAddition = ''; - // f. Let indexOf be the standard built-in function object defined in - // ES5, 15.4.4.14. - var indexOf = arrIndexOf; - - // g. If extensionSubtags is not undefined, then - if (extensionSubtags !== undefined) { - // i. Let keyPos be the result of calling the [[Call]] internal - // method of indexOf with extensionSubtags as the this value and - // an argument list containing the single item key. - var keyPos = indexOf.call(extensionSubtags, key); - - // ii. If keyPos ≠ -1, then - if (keyPos !== -1) { - // 1. If keyPos + 1 < extensionSubtagsLength and the length of the - // result of calling the [[Get]] internal method of - // extensionSubtags with argument ToString(keyPos +1) is greater - // than 2, then - if (keyPos + 1 < extensionSubtagsLength && extensionSubtags[keyPos + 1].length > 2) { - // a. Let requestedValue be the result of calling the [[Get]] - // internal method of extensionSubtags with argument - // ToString(keyPos + 1). - var requestedValue = extensionSubtags[keyPos + 1]; - // b. Let valuePos be the result of calling the [[Call]] - // internal method of indexOf with keyLocaleData as the - // this value and an argument list containing the single - // item requestedValue. - var valuePos = indexOf.call(keyLocaleData, requestedValue); - - // c. If valuePos ≠ -1, then - if (valuePos !== -1) { - // i. Let value be requestedValue. - value = requestedValue, - // ii. Let supportedExtensionAddition be the - // concatenation of "-", key, "-", and value. - supportedExtensionAddition = '-' + key + '-' + value; - } - } - // 2. Else - else { - // a. Let valuePos be the result of calling the [[Call]] - // internal method of indexOf with keyLocaleData as the this - // value and an argument list containing the single item - // "true". - var _valuePos = indexOf(keyLocaleData, 'true'); - - // b. If valuePos ≠ -1, then - if (_valuePos !== -1) - // i. Let value be "true". - value = 'true'; - } - } - } - // h. If options has a field [[]], then - if (hop.call(options, '[[' + key + ']]')) { - // i. Let optionsValue be the value of options.[[]]. - var optionsValue = options['[[' + key + ']]']; - - // ii. If the result of calling the [[Call]] internal method of indexOf - // with keyLocaleData as the this value and an argument list - // containing the single item optionsValue is not -1, then - if (indexOf.call(keyLocaleData, optionsValue) !== -1) { - // 1. If optionsValue is not equal to value, then - if (optionsValue !== value) { - // a. Let value be optionsValue. - value = optionsValue; - // b. Let supportedExtensionAddition be "". - supportedExtensionAddition = ''; - } - } - } - // i. Set result.[[]] to value. - result['[[' + key + ']]'] = value; - - // j. Append supportedExtensionAddition to supportedExtension. - supportedExtension += supportedExtensionAddition; - - // k. Increase i by 1. - i++; - } - // 12. If the length of supportedExtension is greater than 2, then - if (supportedExtension.length > 2) { - // a. - var privateIndex = foundLocale.indexOf("-x-"); - // b. - if (privateIndex === -1) { - // i. - foundLocale = foundLocale + supportedExtension; - } - // c. - else { - // i. - var preExtension = foundLocale.substring(0, privateIndex); - // ii. - var postExtension = foundLocale.substring(privateIndex); - // iii. - foundLocale = preExtension + supportedExtension + postExtension; - } - // d. asserting - skipping - // e. - foundLocale = CanonicalizeLanguageTag(foundLocale); - } - // 13. Set result.[[locale]] to foundLocale. - result['[[locale]]'] = foundLocale; - - // 14. Return result. - return result; -} - -/** - * The LookupSupportedLocales abstract operation returns the subset of the - * provided BCP 47 language priority list requestedLocales for which - * availableLocales has a matching locale when using the BCP 47 Lookup algorithm. - * Locales appear in the same order in the returned list as in requestedLocales. - * The following steps are taken: - */ -function /* 9.2.6 */LookupSupportedLocales(availableLocales, requestedLocales) { - // 1. Let len be the number of elements in requestedLocales. - var len = requestedLocales.length; - // 2. Let subset be a new empty List. - var subset = new List(); - // 3. Let k be 0. - var k = 0; - - // 4. Repeat while k < len - while (k < len) { - // a. Let locale be the element of requestedLocales at 0-origined list - // position k. - var locale = requestedLocales[k]; - // b. Let noExtensionsLocale be the String value that is locale with all - // Unicode locale extension sequences removed. - var noExtensionsLocale = String(locale).replace(expUnicodeExSeq, ''); - // c. Let availableLocale be the result of calling the - // BestAvailableLocale abstract operation (defined in 9.2.2) with - // arguments availableLocales and noExtensionsLocale. - var availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale); - - // d. If availableLocale is not undefined, then append locale to the end of - // subset. - if (availableLocale !== undefined) arrPush.call(subset, locale); - - // e. Increment k by 1. - k++; - } - - // 5. Let subsetArray be a new Array object whose elements are the same - // values in the same order as the elements of subset. - var subsetArray = arrSlice.call(subset); - - // 6. Return subsetArray. - return subsetArray; -} - -/** - * The BestFitSupportedLocales abstract operation returns the subset of the - * provided BCP 47 language priority list requestedLocales for which - * availableLocales has a matching locale when using the Best Fit Matcher - * algorithm. Locales appear in the same order in the returned list as in - * requestedLocales. The steps taken are implementation dependent. - */ -function /*9.2.7 */BestFitSupportedLocales(availableLocales, requestedLocales) { - // ###TODO: implement this function as described by the specification### - return LookupSupportedLocales(availableLocales, requestedLocales); -} - -/** - * The SupportedLocales abstract operation returns the subset of the provided BCP - * 47 language priority list requestedLocales for which availableLocales has a - * matching locale. Two algorithms are available to match the locales: the Lookup - * algorithm described in RFC 4647 section 3.4, and an implementation dependent - * best-fit algorithm. Locales appear in the same order in the returned list as - * in requestedLocales. The following steps are taken: - */ -function /*9.2.8 */SupportedLocales(availableLocales, requestedLocales, options) { - var matcher = void 0, - subset = void 0; - - // 1. If options is not undefined, then - if (options !== undefined) { - // a. Let options be ToObject(options). - options = new Record(toObject(options)); - // b. Let matcher be the result of calling the [[Get]] internal method of - // options with argument "localeMatcher". - matcher = options.localeMatcher; - - // c. If matcher is not undefined, then - if (matcher !== undefined) { - // i. Let matcher be ToString(matcher). - matcher = String(matcher); - - // ii. If matcher is not "lookup" or "best fit", then throw a RangeError - // exception. - if (matcher !== 'lookup' && matcher !== 'best fit') throw new RangeError('matcher should be "lookup" or "best fit"'); - } - } - // 2. If matcher is undefined or "best fit", then - if (matcher === undefined || matcher === 'best fit') - // a. Let subset be the result of calling the BestFitSupportedLocales - // abstract operation (defined in 9.2.7) with arguments - // availableLocales and requestedLocales. - subset = BestFitSupportedLocales(availableLocales, requestedLocales); - // 3. Else - else - // a. Let subset be the result of calling the LookupSupportedLocales - // abstract operation (defined in 9.2.6) with arguments - // availableLocales and requestedLocales. - subset = LookupSupportedLocales(availableLocales, requestedLocales); - - // 4. For each named own property name P of subset, - for (var P in subset) { - if (!hop.call(subset, P)) continue; - - // a. Let desc be the result of calling the [[GetOwnProperty]] internal - // method of subset with P. - // b. Set desc.[[Writable]] to false. - // c. Set desc.[[Configurable]] to false. - // d. Call the [[DefineOwnProperty]] internal method of subset with P, desc, - // and true as arguments. - defineProperty$$1(subset, P, { - writable: false, configurable: false, value: subset[P] - }); - } - // "Freeze" the array so no new elements can be added - defineProperty$$1(subset, 'length', { writable: false }); - - // 5. Return subset - return subset; -} - -/** - * The GetOption abstract operation extracts the value of the property named - * property from the provided options object, converts it to the required type, - * checks whether it is one of a List of allowed values, and fills in a fallback - * value if necessary. - */ -function /*9.2.9 */GetOption(options, property, type, values, fallback) { - // 1. Let value be the result of calling the [[Get]] internal method of - // options with argument property. - var value = options[property]; - - // 2. If value is not undefined, then - if (value !== undefined) { - // a. Assert: type is "boolean" or "string". - // b. If type is "boolean", then let value be ToBoolean(value). - // c. If type is "string", then let value be ToString(value). - value = type === 'boolean' ? Boolean(value) : type === 'string' ? String(value) : value; - - // d. If values is not undefined, then - if (values !== undefined) { - // i. If values does not contain an element equal to value, then throw a - // RangeError exception. - if (arrIndexOf.call(values, value) === -1) throw new RangeError("'" + value + "' is not an allowed value for `" + property + '`'); - } - - // e. Return value. - return value; - } - // Else return fallback. - return fallback; -} - -/** - * The GetNumberOption abstract operation extracts a property value from the - * provided options object, converts it to a Number value, checks whether it is - * in the allowed range, and fills in a fallback value if necessary. - */ -function /* 9.2.10 */GetNumberOption(options, property, minimum, maximum, fallback) { - // 1. Let value be the result of calling the [[Get]] internal method of - // options with argument property. - var value = options[property]; - - // 2. If value is not undefined, then - if (value !== undefined) { - // a. Let value be ToNumber(value). - value = Number(value); - - // b. If value is NaN or less than minimum or greater than maximum, throw a - // RangeError exception. - if (isNaN(value) || value < minimum || value > maximum) throw new RangeError('Value is not a number or outside accepted range'); - - // c. Return floor(value). - return Math.floor(value); - } - // 3. Else return fallback. - return fallback; -} - -// 8 The Intl Object -var Intl$1 = {}; - -// 8.2 Function Properties of the Intl Object - -// 8.2.1 -// @spec[tc39/ecma402/master/spec/intl.html] -// @clause[sec-intl.getcanonicallocales] -function getCanonicalLocales(locales) { - // 1. Let ll be ? CanonicalizeLocaleList(locales). - var ll = CanonicalizeLocaleList(locales); - // 2. Return CreateArrayFromList(ll). - { - var result = []; - - var len = ll.length; - var k = 0; - - while (k < len) { - result[k] = ll[k]; - k++; - } - return result; - } -} - -Object.defineProperty(Intl$1, 'getCanonicalLocales', { - enumerable: false, - configurable: true, - writable: true, - value: getCanonicalLocales -}); - -// 11.1 The Intl.NumberFormat constructor -// ====================================== - -// Currency minor units output from get-4217 grunt task, formatted -var currencyMinorUnits = { - BHD: 3, BYR: 0, XOF: 0, BIF: 0, XAF: 0, CLF: 4, CLP: 0, KMF: 0, DJF: 0, - XPF: 0, GNF: 0, ISK: 0, IQD: 3, JPY: 0, JOD: 3, KRW: 0, KWD: 3, LYD: 3, - OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0 -}; - -// Define the NumberFormat constructor internally so it cannot be tainted -function NumberFormatConstructor() { - var locales = arguments[0]; - var options = arguments[1]; - - if (!this || this === Intl$1) { - return new Intl$1.NumberFormat(locales, options); - } - - return InitializeNumberFormat(toObject(this), locales, options); -} - -defineProperty$$1(Intl$1, 'NumberFormat', { - configurable: true, - writable: true, - value: NumberFormatConstructor -}); - -// Must explicitly set prototypes as unwritable -defineProperty$$1(Intl$1.NumberFormat, 'prototype', { - writable: false -}); - -/** - * The abstract operation InitializeNumberFormat accepts the arguments - * numberFormat (which must be an object), locales, and options. It initializes - * numberFormat as a NumberFormat object. - */ -function /*11.1.1.1 */InitializeNumberFormat(numberFormat, locales, options) { - // This will be a internal properties object if we're not already initialized - var internal = getInternalProperties(numberFormat); - - // Create an object whose props can be used to restore the values of RegExp props - var regexpRestore = createRegExpRestore(); - - // 1. If numberFormat has an [[initializedIntlObject]] internal property with - // value true, throw a TypeError exception. - if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object'); - - // Need this to access the `internal` object - defineProperty$$1(numberFormat, '__getInternalProperties', { - value: function value() { - // NOTE: Non-standard, for internal use only - if (arguments[0] === secret) return internal; - } - }); - - // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true. - internal['[[initializedIntlObject]]'] = true; - - // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList - // abstract operation (defined in 9.2.1) with argument locales. - var requestedLocales = CanonicalizeLocaleList(locales); - - // 4. If options is undefined, then - if (options === undefined) - // a. Let options be the result of creating a new object as if by the - // expression new Object() where Object is the standard built-in constructor - // with that name. - options = {}; - - // 5. Else - else - // a. Let options be ToObject(options). - options = toObject(options); - - // 6. Let opt be a new Record. - var opt = new Record(), - - - // 7. Let matcher be the result of calling the GetOption abstract operation - // (defined in 9.2.9) with the arguments options, "localeMatcher", "string", - // a List containing the two String values "lookup" and "best fit", and - // "best fit". - matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit'); - - // 8. Set opt.[[localeMatcher]] to matcher. - opt['[[localeMatcher]]'] = matcher; - - // 9. Let NumberFormat be the standard built-in object that is the initial value - // of Intl.NumberFormat. - // 10. Let localeData be the value of the [[localeData]] internal property of - // NumberFormat. - var localeData = internals.NumberFormat['[[localeData]]']; - - // 11. Let r be the result of calling the ResolveLocale abstract operation - // (defined in 9.2.5) with the [[availableLocales]] internal property of - // NumberFormat, requestedLocales, opt, the [[relevantExtensionKeys]] - // internal property of NumberFormat, and localeData. - var r = ResolveLocale(internals.NumberFormat['[[availableLocales]]'], requestedLocales, opt, internals.NumberFormat['[[relevantExtensionKeys]]'], localeData); - - // 12. Set the [[locale]] internal property of numberFormat to the value of - // r.[[locale]]. - internal['[[locale]]'] = r['[[locale]]']; - - // 13. Set the [[numberingSystem]] internal property of numberFormat to the value - // of r.[[nu]]. - internal['[[numberingSystem]]'] = r['[[nu]]']; - - // The specification doesn't tell us to do this, but it's helpful later on - internal['[[dataLocale]]'] = r['[[dataLocale]]']; - - // 14. Let dataLocale be the value of r.[[dataLocale]]. - var dataLocale = r['[[dataLocale]]']; - - // 15. Let s be the result of calling the GetOption abstract operation with the - // arguments options, "style", "string", a List containing the three String - // values "decimal", "percent", and "currency", and "decimal". - var s = GetOption(options, 'style', 'string', new List('decimal', 'percent', 'currency'), 'decimal'); - - // 16. Set the [[style]] internal property of numberFormat to s. - internal['[[style]]'] = s; - - // 17. Let c be the result of calling the GetOption abstract operation with the - // arguments options, "currency", "string", undefined, and undefined. - var c = GetOption(options, 'currency', 'string'); - - // 18. If c is not undefined and the result of calling the - // IsWellFormedCurrencyCode abstract operation (defined in 6.3.1) with - // argument c is false, then throw a RangeError exception. - if (c !== undefined && !IsWellFormedCurrencyCode(c)) throw new RangeError("'" + c + "' is not a valid currency code"); - - // 19. If s is "currency" and c is undefined, throw a TypeError exception. - if (s === 'currency' && c === undefined) throw new TypeError('Currency code is required when style is currency'); - - var cDigits = void 0; - - // 20. If s is "currency", then - if (s === 'currency') { - // a. Let c be the result of converting c to upper case as specified in 6.1. - c = c.toUpperCase(); - - // b. Set the [[currency]] internal property of numberFormat to c. - internal['[[currency]]'] = c; - - // c. Let cDigits be the result of calling the CurrencyDigits abstract - // operation (defined below) with argument c. - cDigits = CurrencyDigits(c); - } - - // 21. Let cd be the result of calling the GetOption abstract operation with the - // arguments options, "currencyDisplay", "string", a List containing the - // three String values "code", "symbol", and "name", and "symbol". - var cd = GetOption(options, 'currencyDisplay', 'string', new List('code', 'symbol', 'name'), 'symbol'); - - // 22. If s is "currency", then set the [[currencyDisplay]] internal property of - // numberFormat to cd. - if (s === 'currency') internal['[[currencyDisplay]]'] = cd; - - // 23. Let mnid be the result of calling the GetNumberOption abstract operation - // (defined in 9.2.10) with arguments options, "minimumIntegerDigits", 1, 21, - // and 1. - var mnid = GetNumberOption(options, 'minimumIntegerDigits', 1, 21, 1); - - // 24. Set the [[minimumIntegerDigits]] internal property of numberFormat to mnid. - internal['[[minimumIntegerDigits]]'] = mnid; - - // 25. If s is "currency", then let mnfdDefault be cDigits; else let mnfdDefault - // be 0. - var mnfdDefault = s === 'currency' ? cDigits : 0; - - // 26. Let mnfd be the result of calling the GetNumberOption abstract operation - // with arguments options, "minimumFractionDigits", 0, 20, and mnfdDefault. - var mnfd = GetNumberOption(options, 'minimumFractionDigits', 0, 20, mnfdDefault); - - // 27. Set the [[minimumFractionDigits]] internal property of numberFormat to mnfd. - internal['[[minimumFractionDigits]]'] = mnfd; - - // 28. If s is "currency", then let mxfdDefault be max(mnfd, cDigits); else if s - // is "percent", then let mxfdDefault be max(mnfd, 0); else let mxfdDefault - // be max(mnfd, 3). - var mxfdDefault = s === 'currency' ? Math.max(mnfd, cDigits) : s === 'percent' ? Math.max(mnfd, 0) : Math.max(mnfd, 3); - - // 29. Let mxfd be the result of calling the GetNumberOption abstract operation - // with arguments options, "maximumFractionDigits", mnfd, 20, and mxfdDefault. - var mxfd = GetNumberOption(options, 'maximumFractionDigits', mnfd, 20, mxfdDefault); - - // 30. Set the [[maximumFractionDigits]] internal property of numberFormat to mxfd. - internal['[[maximumFractionDigits]]'] = mxfd; - - // 31. Let mnsd be the result of calling the [[Get]] internal method of options - // with argument "minimumSignificantDigits". - var mnsd = options.minimumSignificantDigits; - - // 32. Let mxsd be the result of calling the [[Get]] internal method of options - // with argument "maximumSignificantDigits". - var mxsd = options.maximumSignificantDigits; - - // 33. If mnsd is not undefined or mxsd is not undefined, then: - if (mnsd !== undefined || mxsd !== undefined) { - // a. Let mnsd be the result of calling the GetNumberOption abstract - // operation with arguments options, "minimumSignificantDigits", 1, 21, - // and 1. - mnsd = GetNumberOption(options, 'minimumSignificantDigits', 1, 21, 1); - - // b. Let mxsd be the result of calling the GetNumberOption abstract - // operation with arguments options, "maximumSignificantDigits", mnsd, - // 21, and 21. - mxsd = GetNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21); - - // c. Set the [[minimumSignificantDigits]] internal property of numberFormat - // to mnsd, and the [[maximumSignificantDigits]] internal property of - // numberFormat to mxsd. - internal['[[minimumSignificantDigits]]'] = mnsd; - internal['[[maximumSignificantDigits]]'] = mxsd; - } - // 34. Let g be the result of calling the GetOption abstract operation with the - // arguments options, "useGrouping", "boolean", undefined, and true. - var g = GetOption(options, 'useGrouping', 'boolean', undefined, true); - - // 35. Set the [[useGrouping]] internal property of numberFormat to g. - internal['[[useGrouping]]'] = g; - - // 36. Let dataLocaleData be the result of calling the [[Get]] internal method of - // localeData with argument dataLocale. - var dataLocaleData = localeData[dataLocale]; - - // 37. Let patterns be the result of calling the [[Get]] internal method of - // dataLocaleData with argument "patterns". - var patterns = dataLocaleData.patterns; - - // 38. Assert: patterns is an object (see 11.2.3) - - // 39. Let stylePatterns be the result of calling the [[Get]] internal method of - // patterns with argument s. - var stylePatterns = patterns[s]; - - // 40. Set the [[positivePattern]] internal property of numberFormat to the - // result of calling the [[Get]] internal method of stylePatterns with the - // argument "positivePattern". - internal['[[positivePattern]]'] = stylePatterns.positivePattern; - - // 41. Set the [[negativePattern]] internal property of numberFormat to the - // result of calling the [[Get]] internal method of stylePatterns with the - // argument "negativePattern". - internal['[[negativePattern]]'] = stylePatterns.negativePattern; - - // 42. Set the [[boundFormat]] internal property of numberFormat to undefined. - internal['[[boundFormat]]'] = undefined; - - // 43. Set the [[initializedNumberFormat]] internal property of numberFormat to - // true. - internal['[[initializedNumberFormat]]'] = true; - - // In ES3, we need to pre-bind the format() function - if (es3) numberFormat.format = GetFormatNumber.call(numberFormat); - - // Restore the RegExp properties - regexpRestore(); - - // Return the newly initialised object - return numberFormat; -} - -function CurrencyDigits(currency) { - // When the CurrencyDigits abstract operation is called with an argument currency - // (which must be an upper case String value), the following steps are taken: - - // 1. If the ISO 4217 currency and funds code list contains currency as an - // alphabetic code, then return the minor unit value corresponding to the - // currency from the list; else return 2. - return currencyMinorUnits[currency] !== undefined ? currencyMinorUnits[currency] : 2; -} - -/* 11.2.3 */internals.NumberFormat = { - '[[availableLocales]]': [], - '[[relevantExtensionKeys]]': ['nu'], - '[[localeData]]': {} -}; - -/** - * When the supportedLocalesOf method of Intl.NumberFormat is called, the - * following steps are taken: - */ -/* 11.2.2 */ -defineProperty$$1(Intl$1.NumberFormat, 'supportedLocalesOf', { - configurable: true, - writable: true, - value: fnBind.call(function (locales) { - // Bound functions only have the `this` value altered if being used as a constructor, - // this lets us imitate a native function that has no constructor - if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor'); - - // Create an object whose props can be used to restore the values of RegExp props - var regexpRestore = createRegExpRestore(), - - - // 1. If options is not provided, then let options be undefined. - options = arguments[1], - - - // 2. Let availableLocales be the value of the [[availableLocales]] internal - // property of the standard built-in object that is the initial value of - // Intl.NumberFormat. - - availableLocales = this['[[availableLocales]]'], - - - // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList - // abstract operation (defined in 9.2.1) with argument locales. - requestedLocales = CanonicalizeLocaleList(locales); - - // Restore the RegExp properties - regexpRestore(); - - // 4. Return the result of calling the SupportedLocales abstract operation - // (defined in 9.2.8) with arguments availableLocales, requestedLocales, - // and options. - return SupportedLocales(availableLocales, requestedLocales, options); - }, internals.NumberFormat) -}); - -/** - * This named accessor property returns a function that formats a number - * according to the effective locale and the formatting options of this - * NumberFormat object. - */ -/* 11.3.2 */defineProperty$$1(Intl$1.NumberFormat.prototype, 'format', { - configurable: true, - get: GetFormatNumber -}); - -function GetFormatNumber() { - var internal = this !== null && _typeof(this) === 'object' && getInternalProperties(this); - - // Satisfy test 11.3_b - if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.NumberFormat object.'); - - // The value of the [[Get]] attribute is a function that takes the following - // steps: - - // 1. If the [[boundFormat]] internal property of this NumberFormat object - // is undefined, then: - if (internal['[[boundFormat]]'] === undefined) { - // a. Let F be a Function object, with internal properties set as - // specified for built-in functions in ES5, 15, or successor, and the - // length property set to 1, that takes the argument value and - // performs the following steps: - var F = function F(value) { - // i. If value is not provided, then let value be undefined. - // ii. Let x be ToNumber(value). - // iii. Return the result of calling the FormatNumber abstract - // operation (defined below) with arguments this and x. - return FormatNumber(this, /* x = */Number(value)); - }; - - // b. Let bind be the standard built-in function object defined in ES5, - // 15.3.4.5. - // c. Let bf be the result of calling the [[Call]] internal method of - // bind with F as the this value and an argument list containing - // the single item this. - var bf = fnBind.call(F, this); - - // d. Set the [[boundFormat]] internal property of this NumberFormat - // object to bf. - internal['[[boundFormat]]'] = bf; - } - // Return the value of the [[boundFormat]] internal property of this - // NumberFormat object. - return internal['[[boundFormat]]']; -} - -function formatToParts() { - var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - var internal = this !== null && _typeof(this) === 'object' && getInternalProperties(this); - if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.NumberFormat object.'); - - var x = Number(value); - return FormatNumberToParts(this, x); -} - -Object.defineProperty(Intl$1.NumberFormat.prototype, 'formatToParts', { - configurable: true, - enumerable: false, - writable: true, - value: formatToParts -}); - -/* - * @spec[tc39/ecma402/master/spec/numberformat.html] - * @clause[sec-formatnumbertoparts] - */ -function FormatNumberToParts(numberFormat, x) { - // 1. Let parts be ? PartitionNumberPattern(numberFormat, x). - var parts = PartitionNumberPattern(numberFormat, x); - // 2. Let result be ArrayCreate(0). - var result = []; - // 3. Let n be 0. - var n = 0; - // 4. For each part in parts, do: - for (var i = 0; parts.length > i; i++) { - var part = parts[i]; - // a. Let O be ObjectCreate(%ObjectPrototype%). - var O = {}; - // a. Perform ? CreateDataPropertyOrThrow(O, "type", part.[[type]]). - O.type = part['[[type]]']; - // a. Perform ? CreateDataPropertyOrThrow(O, "value", part.[[value]]). - O.value = part['[[value]]']; - // a. Perform ? CreateDataPropertyOrThrow(result, ? ToString(n), O). - result[n] = O; - // a. Increment n by 1. - n += 1; - } - // 5. Return result. - return result; -} - -/* - * @spec[tc39/ecma402/master/spec/numberformat.html] - * @clause[sec-formatnumberstring] - */ -function FormatNumberToString(numberFormat, x) { - var internal = getInternalProperties(numberFormat); - var result = void 0; - - // 1. Assert: numberFormat.[[initializedIntlObject]] is true. - - // 2. If the numberFormat.[[minimumSignificantDigits]] and numberFormat.[[maximumSignificantDigits]] are present, then - if (hop.call(internal, '[[minimumSignificantDigits]]') && hop.call(internal, '[[maximumSignificantDigits]]')) { - // a. Let result be ToRawPrecision(x, numberFormat.[[minimumSignificantDigits]], numberFormat.[[maximumSignificantDigits]]). - result = ToRawPrecision(x, internal['[[minimumSignificantDigits]]'], internal['[[maximumSignificantDigits]]']); - } - // 3. Else, - else { - // a. Let result be ToRawFixed(x, numberFormat.[[minimumIntegerDigits]], numberFormat.[[minimumFractionDigits]], numberFormat.[[maximumFractionDigits]]). - result = ToRawFixed(x, internal['[[minimumIntegerDigits]]'], internal['[[minimumFractionDigits]]'], internal['[[maximumFractionDigits]]']); - } - // 4. Return result. - return result; -} - -/* - * @spec[tc39/ecma402/master/spec/numberformat.html] - * @clause[sec-partitionnumberpattern] - */ -function PartitionNumberPattern(numberFormat, x) { - - var internal = getInternalProperties(numberFormat), - locale = internal['[[dataLocale]]'], - nums = internal['[[numberingSystem]]'], - data = internals.NumberFormat['[[localeData]]'][locale], - ild = data.symbols[nums] || data.symbols.latn, - pattern = void 0; - - // 1. If x is not NaN and x < 0, then: - if (!isNaN(x) && x < 0) { - // a. Let x be -x. - x = -x; - // b. Let pattern be the value of numberFormat.[[negativePattern]]. - pattern = internal['[[negativePattern]]']; - } - // 2. Else, - else { - // a. Let pattern be the value of numberFormat.[[positivePattern]]. - pattern = internal['[[positivePattern]]']; - } - // 3. Let result be a new empty List. - var result = new List(); - // 4. Let beginIndex be Call(%StringProto_indexOf%, pattern, "{", 0). - var beginIndex = pattern.indexOf('{', 0); - // 5. Let endIndex be 0. - var endIndex = 0; - // 6. Let nextIndex be 0. - var nextIndex = 0; - // 7. Let length be the number of code units in pattern. - var length = pattern.length; - // 8. Repeat while beginIndex is an integer index into pattern: - while (beginIndex > -1 && beginIndex < length) { - // a. Set endIndex to Call(%StringProto_indexOf%, pattern, "}", beginIndex) - endIndex = pattern.indexOf('}', beginIndex); - // b. If endIndex = -1, throw new Error exception. - if (endIndex === -1) throw new Error(); - // c. If beginIndex is greater than nextIndex, then: - if (beginIndex > nextIndex) { - // i. Let literal be a substring of pattern from position nextIndex, inclusive, to position beginIndex, exclusive. - var literal = pattern.substring(nextIndex, beginIndex); - // ii. Add new part record { [[type]]: "literal", [[value]]: literal } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal }); - } - // d. Let p be the substring of pattern from position beginIndex, exclusive, to position endIndex, exclusive. - var p = pattern.substring(beginIndex + 1, endIndex); - // e. If p is equal "number", then: - if (p === "number") { - // i. If x is NaN, - if (isNaN(x)) { - // 1. Let n be an ILD String value indicating the NaN value. - var n = ild.nan; - // 2. Add new part record { [[type]]: "nan", [[value]]: n } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'nan', '[[value]]': n }); - } - // ii. Else if isFinite(x) is false, - else if (!isFinite(x)) { - // 1. Let n be an ILD String value indicating infinity. - var _n = ild.infinity; - // 2. Add new part record { [[type]]: "infinity", [[value]]: n } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'infinity', '[[value]]': _n }); - } - // iii. Else, - else { - // 1. If numberFormat.[[style]] is "percent", let x be 100 × x. - if (internal['[[style]]'] === 'percent') x *= 100; - - // 2. Let n be FormatNumberToString(numberFormat, x). - var _n2 = FormatNumberToString(numberFormat, x); - - // 3. If the numberFormat.[[numberingSystem]] matches one of the values in the "Numbering System" column of Table 3 below, then - if (numSys[nums]) { - (function () { - // a. Let digits be an array whose 10 String valued elements are the UTF-16 string representations of the 10 digits specified in the "Digits" column of the matching row in Table 2. - var digits = numSys[nums]; - // a. Replace each digit in n with the value of digits[digit]. - _n2 = String(_n2).replace(/\d/g, function (digit) { - return digits[digit]; - }); - })(); - } - // 4. Else use an implementation dependent algorithm to map n to the appropriate representation of n in the given numbering system. - else _n2 = String(_n2); // ###TODO### - - var integer = void 0; - var fraction = void 0; - // 5. Let decimalSepIndex be Call(%StringProto_indexOf%, n, ".", 0). - var decimalSepIndex = _n2.indexOf('.', 0); - // 6. If decimalSepIndex > 0, then: - if (decimalSepIndex > 0) { - // a. Let integer be the substring of n from position 0, inclusive, to position decimalSepIndex, exclusive. - integer = _n2.substring(0, decimalSepIndex); - // b. Let fraction be the substring of n from position decimalSepIndex, exclusive, to the end of n. - fraction = _n2.substring(decimalSepIndex + 1, decimalSepIndex.length); - } - // 7. Else: - else { - // a. Let integer be n. - integer = _n2; - // b. Let fraction be undefined. - fraction = undefined; - } - // 8. If the value of the numberFormat.[[useGrouping]] is true, - if (internal['[[useGrouping]]'] === true) { - // a. Let groupSepSymbol be the ILND String representing the grouping separator. - var groupSepSymbol = ild.group; - // b. Let groups be a List whose elements are, in left to right order, the substrings defined by ILND set of locations within the integer. - var groups = []; - // ----> implementation: - // Primary group represents the group closest to the decimal - var pgSize = data.patterns.primaryGroupSize || 3; - // Secondary group is every other group - var sgSize = data.patterns.secondaryGroupSize || pgSize; - // Group only if necessary - if (integer.length > pgSize) { - // Index of the primary grouping separator - var end = integer.length - pgSize; - // Starting index for our loop - var idx = end % sgSize; - var start = integer.slice(0, idx); - if (start.length) arrPush.call(groups, start); - // Loop to separate into secondary grouping digits - while (idx < end) { - arrPush.call(groups, integer.slice(idx, idx + sgSize)); - idx += sgSize; - } - // Add the primary grouping digits - arrPush.call(groups, integer.slice(end)); - } else { - arrPush.call(groups, integer); - } - // c. Assert: The number of elements in groups List is greater than 0. - if (groups.length === 0) throw new Error(); - // d. Repeat, while groups List is not empty: - while (groups.length) { - // i. Remove the first element from groups and let integerGroup be the value of that element. - var integerGroup = arrShift.call(groups); - // ii. Add new part record { [[type]]: "integer", [[value]]: integerGroup } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integerGroup }); - // iii. If groups List is not empty, then: - if (groups.length) { - // 1. Add new part record { [[type]]: "group", [[value]]: groupSepSymbol } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'group', '[[value]]': groupSepSymbol }); - } - } - } - // 9. Else, - else { - // a. Add new part record { [[type]]: "integer", [[value]]: integer } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integer }); - } - // 10. If fraction is not undefined, then: - if (fraction !== undefined) { - // a. Let decimalSepSymbol be the ILND String representing the decimal separator. - var decimalSepSymbol = ild.decimal; - // b. Add new part record { [[type]]: "decimal", [[value]]: decimalSepSymbol } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'decimal', '[[value]]': decimalSepSymbol }); - // c. Add new part record { [[type]]: "fraction", [[value]]: fraction } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'fraction', '[[value]]': fraction }); - } - } - } - // f. Else if p is equal "plusSign", then: - else if (p === "plusSign") { - // i. Let plusSignSymbol be the ILND String representing the plus sign. - var plusSignSymbol = ild.plusSign; - // ii. Add new part record { [[type]]: "plusSign", [[value]]: plusSignSymbol } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'plusSign', '[[value]]': plusSignSymbol }); - } - // g. Else if p is equal "minusSign", then: - else if (p === "minusSign") { - // i. Let minusSignSymbol be the ILND String representing the minus sign. - var minusSignSymbol = ild.minusSign; - // ii. Add new part record { [[type]]: "minusSign", [[value]]: minusSignSymbol } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'minusSign', '[[value]]': minusSignSymbol }); - } - // h. Else if p is equal "percentSign" and numberFormat.[[style]] is "percent", then: - else if (p === "percentSign" && internal['[[style]]'] === "percent") { - // i. Let percentSignSymbol be the ILND String representing the percent sign. - var percentSignSymbol = ild.percentSign; - // ii. Add new part record { [[type]]: "percentSign", [[value]]: percentSignSymbol } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'literal', '[[value]]': percentSignSymbol }); - } - // i. Else if p is equal "currency" and numberFormat.[[style]] is "currency", then: - else if (p === "currency" && internal['[[style]]'] === "currency") { - // i. Let currency be the value of numberFormat.[[currency]]. - var currency = internal['[[currency]]']; - - var cd = void 0; - - // iii. If numberFormat.[[currencyDisplay]] is "code", then - if (internal['[[currencyDisplay]]'] === "code") { - // 1. Let cd be currency. - cd = currency; - } - // iv. Else if numberFormat.[[currencyDisplay]] is "symbol", then - else if (internal['[[currencyDisplay]]'] === "symbol") { - // 1. Let cd be an ILD string representing currency in short form. If the implementation does not have such a representation of currency, use currency itself. - cd = data.currencies[currency] || currency; - } - // v. Else if numberFormat.[[currencyDisplay]] is "name", then - else if (internal['[[currencyDisplay]]'] === "name") { - // 1. Let cd be an ILD string representing currency in long form. If the implementation does not have such a representation of currency, then use currency itself. - cd = currency; - } - // vi. Add new part record { [[type]]: "currency", [[value]]: cd } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'currency', '[[value]]': cd }); - } - // j. Else, - else { - // i. Let literal be the substring of pattern from position beginIndex, inclusive, to position endIndex, inclusive. - var _literal = pattern.substring(beginIndex, endIndex); - // ii. Add new part record { [[type]]: "literal", [[value]]: literal } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal }); - } - // k. Set nextIndex to endIndex + 1. - nextIndex = endIndex + 1; - // l. Set beginIndex to Call(%StringProto_indexOf%, pattern, "{", nextIndex) - beginIndex = pattern.indexOf('{', nextIndex); - } - // 9. If nextIndex is less than length, then: - if (nextIndex < length) { - // a. Let literal be the substring of pattern from position nextIndex, inclusive, to position length, exclusive. - var _literal2 = pattern.substring(nextIndex, length); - // b. Add new part record { [[type]]: "literal", [[value]]: literal } as a new element of the list result. - arrPush.call(result, { '[[type]]': 'literal', '[[value]]': _literal2 }); - } - // 10. Return result. - return result; -} - -/* - * @spec[tc39/ecma402/master/spec/numberformat.html] - * @clause[sec-formatnumber] - */ -function FormatNumber(numberFormat, x) { - // 1. Let parts be ? PartitionNumberPattern(numberFormat, x). - var parts = PartitionNumberPattern(numberFormat, x); - // 2. Let result be an empty String. - var result = ''; - // 3. For each part in parts, do: - for (var i = 0; parts.length > i; i++) { - var part = parts[i]; - // a. Set result to a String value produced by concatenating result and part.[[value]]. - result += part['[[value]]']; - } - // 4. Return result. - return result; -} - -/** - * When the ToRawPrecision abstract operation is called with arguments x (which - * must be a finite non-negative number), minPrecision, and maxPrecision (both - * must be integers between 1 and 21) the following steps are taken: - */ -function ToRawPrecision(x, minPrecision, maxPrecision) { - // 1. Let p be maxPrecision. - var p = maxPrecision; - - var m = void 0, - e = void 0; - - // 2. If x = 0, then - if (x === 0) { - // a. Let m be the String consisting of p occurrences of the character "0". - m = arrJoin.call(Array(p + 1), '0'); - // b. Let e be 0. - e = 0; - } - // 3. Else - else { - // a. Let e and n be integers such that 10ᵖ⁻¹ ≤ n < 10ᵖ and for which the - // exact mathematical value of n × 10ᵉ⁻ᵖ⁺¹ – x is as close to zero as - // possible. If there are two such sets of e and n, pick the e and n for - // which n × 10ᵉ⁻ᵖ⁺¹ is larger. - e = log10Floor(Math.abs(x)); - - // Easier to get to m from here - var f = Math.round(Math.exp(Math.abs(e - p + 1) * Math.LN10)); - - // b. Let m be the String consisting of the digits of the decimal - // representation of n (in order, with no leading zeroes) - m = String(Math.round(e - p + 1 < 0 ? x * f : x / f)); - } - - // 4. If e ≥ p, then - if (e >= p) - // a. Return the concatenation of m and e-p+1 occurrences of the character "0". - return m + arrJoin.call(Array(e - p + 1 + 1), '0'); - - // 5. If e = p-1, then - else if (e === p - 1) - // a. Return m. - return m; - - // 6. If e ≥ 0, then - else if (e >= 0) - // a. Let m be the concatenation of the first e+1 characters of m, the character - // ".", and the remaining p–(e+1) characters of m. - m = m.slice(0, e + 1) + '.' + m.slice(e + 1); - - // 7. If e < 0, then - else if (e < 0) - // a. Let m be the concatenation of the String "0.", –(e+1) occurrences of the - // character "0", and the string m. - m = '0.' + arrJoin.call(Array(-(e + 1) + 1), '0') + m; - - // 8. If m contains the character ".", and maxPrecision > minPrecision, then - if (m.indexOf(".") >= 0 && maxPrecision > minPrecision) { - // a. Let cut be maxPrecision – minPrecision. - var cut = maxPrecision - minPrecision; - - // b. Repeat while cut > 0 and the last character of m is "0": - while (cut > 0 && m.charAt(m.length - 1) === '0') { - // i. Remove the last character from m. - m = m.slice(0, -1); - - // ii. Decrease cut by 1. - cut--; - } - - // c. If the last character of m is ".", then - if (m.charAt(m.length - 1) === '.') - // i. Remove the last character from m. - m = m.slice(0, -1); - } - // 9. Return m. - return m; -} - -/** - * @spec[tc39/ecma402/master/spec/numberformat.html] - * @clause[sec-torawfixed] - * When the ToRawFixed abstract operation is called with arguments x (which must - * be a finite non-negative number), minInteger (which must be an integer between - * 1 and 21), minFraction, and maxFraction (which must be integers between 0 and - * 20) the following steps are taken: - */ -function ToRawFixed(x, minInteger, minFraction, maxFraction) { - // 1. Let f be maxFraction. - var f = maxFraction; - // 2. Let n be an integer for which the exact mathematical value of n ÷ 10f – x is as close to zero as possible. If there are two such n, pick the larger n. - var n = Math.pow(10, f) * x; // diverging... - // 3. If n = 0, let m be the String "0". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes). - var m = n === 0 ? "0" : n.toFixed(0); // divering... - - { - // this diversion is needed to take into consideration big numbers, e.g.: - // 1.2344501e+37 -> 12344501000000000000000000000000000000 - var idx = void 0; - var exp = (idx = m.indexOf('e')) > -1 ? m.slice(idx + 1) : 0; - if (exp) { - m = m.slice(0, idx).replace('.', ''); - m += arrJoin.call(Array(exp - (m.length - 1) + 1), '0'); - } - } - - var int = void 0; - // 4. If f ≠ 0, then - if (f !== 0) { - // a. Let k be the number of characters in m. - var k = m.length; - // a. If k ≤ f, then - if (k <= f) { - // i. Let z be the String consisting of f+1–k occurrences of the character "0". - var z = arrJoin.call(Array(f + 1 - k + 1), '0'); - // ii. Let m be the concatenation of Strings z and m. - m = z + m; - // iii. Let k be f+1. - k = f + 1; - } - // a. Let a be the first k–f characters of m, and let b be the remaining f characters of m. - var a = m.substring(0, k - f), - b = m.substring(k - f, m.length); - // a. Let m be the concatenation of the three Strings a, ".", and b. - m = a + "." + b; - // a. Let int be the number of characters in a. - int = a.length; - } - // 5. Else, let int be the number of characters in m. - else int = m.length; - // 6. Let cut be maxFraction – minFraction. - var cut = maxFraction - minFraction; - // 7. Repeat while cut > 0 and the last character of m is "0": - while (cut > 0 && m.slice(-1) === "0") { - // a. Remove the last character from m. - m = m.slice(0, -1); - // a. Decrease cut by 1. - cut--; - } - // 8. If the last character of m is ".", then - if (m.slice(-1) === ".") { - // a. Remove the last character from m. - m = m.slice(0, -1); - } - // 9. If int < minInteger, then - if (int < minInteger) { - // a. Let z be the String consisting of minInteger–int occurrences of the character "0". - var _z = arrJoin.call(Array(minInteger - int + 1), '0'); - // a. Let m be the concatenation of Strings z and m. - m = _z + m; - } - // 10. Return m. - return m; -} - -// Sect 11.3.2 Table 2, Numbering systems -// ====================================== -var numSys = { - arab: ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"], - arabext: ["\u06F0", "\u06F1", "\u06F2", "\u06F3", "\u06F4", "\u06F5", "\u06F6", "\u06F7", "\u06F8", "\u06F9"], - bali: ["\u1B50", "\u1B51", "\u1B52", "\u1B53", "\u1B54", "\u1B55", "\u1B56", "\u1B57", "\u1B58", "\u1B59"], - beng: ["\u09E6", "\u09E7", "\u09E8", "\u09E9", "\u09EA", "\u09EB", "\u09EC", "\u09ED", "\u09EE", "\u09EF"], - deva: ["\u0966", "\u0967", "\u0968", "\u0969", "\u096A", "\u096B", "\u096C", "\u096D", "\u096E", "\u096F"], - fullwide: ["\uFF10", "\uFF11", "\uFF12", "\uFF13", "\uFF14", "\uFF15", "\uFF16", "\uFF17", "\uFF18", "\uFF19"], - gujr: ["\u0AE6", "\u0AE7", "\u0AE8", "\u0AE9", "\u0AEA", "\u0AEB", "\u0AEC", "\u0AED", "\u0AEE", "\u0AEF"], - guru: ["\u0A66", "\u0A67", "\u0A68", "\u0A69", "\u0A6A", "\u0A6B", "\u0A6C", "\u0A6D", "\u0A6E", "\u0A6F"], - hanidec: ["\u3007", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u4E03", "\u516B", "\u4E5D"], - khmr: ["\u17E0", "\u17E1", "\u17E2", "\u17E3", "\u17E4", "\u17E5", "\u17E6", "\u17E7", "\u17E8", "\u17E9"], - knda: ["\u0CE6", "\u0CE7", "\u0CE8", "\u0CE9", "\u0CEA", "\u0CEB", "\u0CEC", "\u0CED", "\u0CEE", "\u0CEF"], - laoo: ["\u0ED0", "\u0ED1", "\u0ED2", "\u0ED3", "\u0ED4", "\u0ED5", "\u0ED6", "\u0ED7", "\u0ED8", "\u0ED9"], - latn: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - limb: ["\u1946", "\u1947", "\u1948", "\u1949", "\u194A", "\u194B", "\u194C", "\u194D", "\u194E", "\u194F"], - mlym: ["\u0D66", "\u0D67", "\u0D68", "\u0D69", "\u0D6A", "\u0D6B", "\u0D6C", "\u0D6D", "\u0D6E", "\u0D6F"], - mong: ["\u1810", "\u1811", "\u1812", "\u1813", "\u1814", "\u1815", "\u1816", "\u1817", "\u1818", "\u1819"], - mymr: ["\u1040", "\u1041", "\u1042", "\u1043", "\u1044", "\u1045", "\u1046", "\u1047", "\u1048", "\u1049"], - orya: ["\u0B66", "\u0B67", "\u0B68", "\u0B69", "\u0B6A", "\u0B6B", "\u0B6C", "\u0B6D", "\u0B6E", "\u0B6F"], - tamldec: ["\u0BE6", "\u0BE7", "\u0BE8", "\u0BE9", "\u0BEA", "\u0BEB", "\u0BEC", "\u0BED", "\u0BEE", "\u0BEF"], - telu: ["\u0C66", "\u0C67", "\u0C68", "\u0C69", "\u0C6A", "\u0C6B", "\u0C6C", "\u0C6D", "\u0C6E", "\u0C6F"], - thai: ["\u0E50", "\u0E51", "\u0E52", "\u0E53", "\u0E54", "\u0E55", "\u0E56", "\u0E57", "\u0E58", "\u0E59"], - tibt: ["\u0F20", "\u0F21", "\u0F22", "\u0F23", "\u0F24", "\u0F25", "\u0F26", "\u0F27", "\u0F28", "\u0F29"] -}; - -/** - * This function provides access to the locale and formatting options computed - * during initialization of the object. - * - * The function returns a new object whose properties and attributes are set as - * if constructed by an object literal assigning to each of the following - * properties the value of the corresponding internal property of this - * NumberFormat object (see 11.4): locale, numberingSystem, style, currency, - * currencyDisplay, minimumIntegerDigits, minimumFractionDigits, - * maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, and - * useGrouping. Properties whose corresponding internal properties are not present - * are not assigned. - */ -/* 11.3.3 */defineProperty$$1(Intl$1.NumberFormat.prototype, 'resolvedOptions', { - configurable: true, - writable: true, - value: function value() { - var prop = void 0, - descs = new Record(), - props = ['locale', 'numberingSystem', 'style', 'currency', 'currencyDisplay', 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits', 'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping'], - internal = this !== null && _typeof(this) === 'object' && getInternalProperties(this); - - // Satisfy test 11.3_b - if (!internal || !internal['[[initializedNumberFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.NumberFormat object.'); - - for (var i = 0, max = props.length; i < max; i++) { - if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true }; - } - - return objCreate({}, descs); - } -}); - -/* jslint esnext: true */ - -// Match these datetime components in a CLDR pattern, except those in single quotes -var expDTComponents = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g; -// trim patterns after transformations -var expPatternTrimmer = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; -// Skip over patterns with these datetime components because we don't have data -// to back them up: -// timezone, weekday, amoung others -var unwantedDTCs = /[rqQASjJgwWIQq]/; // xXVO were removed from this list in favor of computing matches with timeZoneName values but printing as empty string - -var dtKeys = ["era", "year", "month", "day", "weekday", "quarter"]; -var tmKeys = ["hour", "minute", "second", "hour12", "timeZoneName"]; - -function isDateFormatOnly(obj) { - for (var i = 0; i < tmKeys.length; i += 1) { - if (obj.hasOwnProperty(tmKeys[i])) { - return false; - } - } - return true; -} - -function isTimeFormatOnly(obj) { - for (var i = 0; i < dtKeys.length; i += 1) { - if (obj.hasOwnProperty(dtKeys[i])) { - return false; - } - } - return true; -} - -function joinDateAndTimeFormats(dateFormatObj, timeFormatObj) { - var o = { _: {} }; - for (var i = 0; i < dtKeys.length; i += 1) { - if (dateFormatObj[dtKeys[i]]) { - o[dtKeys[i]] = dateFormatObj[dtKeys[i]]; - } - if (dateFormatObj._[dtKeys[i]]) { - o._[dtKeys[i]] = dateFormatObj._[dtKeys[i]]; - } - } - for (var j = 0; j < tmKeys.length; j += 1) { - if (timeFormatObj[tmKeys[j]]) { - o[tmKeys[j]] = timeFormatObj[tmKeys[j]]; - } - if (timeFormatObj._[tmKeys[j]]) { - o._[tmKeys[j]] = timeFormatObj._[tmKeys[j]]; - } - } - return o; -} - -function computeFinalPatterns(formatObj) { - // From http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns: - // 'In patterns, two single quotes represents a literal single quote, either - // inside or outside single quotes. Text within single quotes is not - // interpreted in any way (except for two adjacent single quotes).' - formatObj.pattern12 = formatObj.extendedPattern.replace(/'([^']*)'/g, function ($0, literal) { - return literal ? literal : "'"; - }); - - // pattern 12 is always the default. we can produce the 24 by removing {ampm} - formatObj.pattern = formatObj.pattern12.replace('{ampm}', '').replace(expPatternTrimmer, ''); - return formatObj; -} - -function expDTComponentsMeta($0, formatObj) { - switch ($0.charAt(0)) { - // --- Era - case 'G': - formatObj.era = ['short', 'short', 'short', 'long', 'narrow'][$0.length - 1]; - return '{era}'; - - // --- Year - case 'y': - case 'Y': - case 'u': - case 'U': - case 'r': - formatObj.year = $0.length === 2 ? '2-digit' : 'numeric'; - return '{year}'; - - // --- Quarter (not supported in this polyfill) - case 'Q': - case 'q': - formatObj.quarter = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1]; - return '{quarter}'; - - // --- Month - case 'M': - case 'L': - formatObj.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][$0.length - 1]; - return '{month}'; - - // --- Week (not supported in this polyfill) - case 'w': - // week of the year - formatObj.week = $0.length === 2 ? '2-digit' : 'numeric'; - return '{weekday}'; - case 'W': - // week of the month - formatObj.week = 'numeric'; - return '{weekday}'; - - // --- Day - case 'd': - // day of the month - formatObj.day = $0.length === 2 ? '2-digit' : 'numeric'; - return '{day}'; - case 'D': // day of the year - case 'F': // day of the week - case 'g': - // 1..n: Modified Julian day - formatObj.day = 'numeric'; - return '{day}'; - - // --- Week Day - case 'E': - // day of the week - formatObj.weekday = ['short', 'short', 'short', 'long', 'narrow', 'short'][$0.length - 1]; - return '{weekday}'; - case 'e': - // local day of the week - formatObj.weekday = ['numeric', '2-digit', 'short', 'long', 'narrow', 'short'][$0.length - 1]; - return '{weekday}'; - case 'c': - // stand alone local day of the week - formatObj.weekday = ['numeric', undefined, 'short', 'long', 'narrow', 'short'][$0.length - 1]; - return '{weekday}'; - - // --- Period - case 'a': // AM, PM - case 'b': // am, pm, noon, midnight - case 'B': - // flexible day periods - formatObj.hour12 = true; - return '{ampm}'; - - // --- Hour - case 'h': - case 'H': - formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric'; - return '{hour}'; - case 'k': - case 'K': - formatObj.hour12 = true; // 12-hour-cycle time formats (using h or K) - formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric'; - return '{hour}'; - - // --- Minute - case 'm': - formatObj.minute = $0.length === 2 ? '2-digit' : 'numeric'; - return '{minute}'; - - // --- Second - case 's': - formatObj.second = $0.length === 2 ? '2-digit' : 'numeric'; - return '{second}'; - case 'S': - case 'A': - formatObj.second = 'numeric'; - return '{second}'; - - // --- Timezone - case 'z': // 1..3, 4: specific non-location format - case 'Z': // 1..3, 4, 5: The ISO8601 varios formats - case 'O': // 1, 4: miliseconds in day short, long - case 'v': // 1, 4: generic non-location format - case 'V': // 1, 2, 3, 4: time zone ID or city - case 'X': // 1, 2, 3, 4: The ISO8601 varios formats - case 'x': - // 1, 2, 3, 4: The ISO8601 varios formats - // this polyfill only supports much, for now, we are just doing something dummy - formatObj.timeZoneName = $0.length < 4 ? 'short' : 'long'; - return '{timeZoneName}'; - } -} - -/** - * Converts the CLDR availableFormats into the objects and patterns required by - * the ECMAScript Internationalization API specification. - */ -function createDateTimeFormat(skeleton, pattern) { - // we ignore certain patterns that are unsupported to avoid this expensive op. - if (unwantedDTCs.test(pattern)) return undefined; - - var formatObj = { - originalPattern: pattern, - _: {} - }; - - // Replace the pattern string with the one required by the specification, whilst - // at the same time evaluating it for the subsets and formats - formatObj.extendedPattern = pattern.replace(expDTComponents, function ($0) { - // See which symbol we're dealing with - return expDTComponentsMeta($0, formatObj._); - }); - - // Match the skeleton string with the one required by the specification - // this implementation is based on the Date Field Symbol Table: - // http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table - // Note: we are adding extra data to the formatObject even though this polyfill - // might not support it. - skeleton.replace(expDTComponents, function ($0) { - // See which symbol we're dealing with - return expDTComponentsMeta($0, formatObj); - }); - - return computeFinalPatterns(formatObj); -} - -/** - * Processes DateTime formats from CLDR to an easier-to-parse format. - * the result of this operation should be cached the first time a particular - * calendar is analyzed. - * - * The specification requires we support at least the following subsets of - * date/time components: - * - * - 'weekday', 'year', 'month', 'day', 'hour', 'minute', 'second' - * - 'weekday', 'year', 'month', 'day' - * - 'year', 'month', 'day' - * - 'year', 'month' - * - 'month', 'day' - * - 'hour', 'minute', 'second' - * - 'hour', 'minute' - * - * We need to cherry pick at least these subsets from the CLDR data and convert - * them into the pattern objects used in the ECMA-402 API. - */ -function createDateTimeFormats(formats) { - var availableFormats = formats.availableFormats; - var timeFormats = formats.timeFormats; - var dateFormats = formats.dateFormats; - var result = []; - var skeleton = void 0, - pattern = void 0, - computed = void 0, - i = void 0, - j = void 0; - var timeRelatedFormats = []; - var dateRelatedFormats = []; - - // Map available (custom) formats into a pattern for createDateTimeFormats - for (skeleton in availableFormats) { - if (availableFormats.hasOwnProperty(skeleton)) { - pattern = availableFormats[skeleton]; - computed = createDateTimeFormat(skeleton, pattern); - if (computed) { - result.push(computed); - // in some cases, the format is only displaying date specific props - // or time specific props, in which case we need to also produce the - // combined formats. - if (isDateFormatOnly(computed)) { - dateRelatedFormats.push(computed); - } else if (isTimeFormatOnly(computed)) { - timeRelatedFormats.push(computed); - } - } - } - } - - // Map time formats into a pattern for createDateTimeFormats - for (skeleton in timeFormats) { - if (timeFormats.hasOwnProperty(skeleton)) { - pattern = timeFormats[skeleton]; - computed = createDateTimeFormat(skeleton, pattern); - if (computed) { - result.push(computed); - timeRelatedFormats.push(computed); - } - } - } - - // Map date formats into a pattern for createDateTimeFormats - for (skeleton in dateFormats) { - if (dateFormats.hasOwnProperty(skeleton)) { - pattern = dateFormats[skeleton]; - computed = createDateTimeFormat(skeleton, pattern); - if (computed) { - result.push(computed); - dateRelatedFormats.push(computed); - } - } - } - - // combine custom time and custom date formats when they are orthogonals to complete the - // formats supported by CLDR. - // This Algo is based on section "Missing Skeleton Fields" from: - // http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems - for (i = 0; i < timeRelatedFormats.length; i += 1) { - for (j = 0; j < dateRelatedFormats.length; j += 1) { - if (dateRelatedFormats[j].month === 'long') { - pattern = dateRelatedFormats[j].weekday ? formats.full : formats.long; - } else if (dateRelatedFormats[j].month === 'short') { - pattern = formats.medium; - } else { - pattern = formats.short; - } - computed = joinDateAndTimeFormats(dateRelatedFormats[j], timeRelatedFormats[i]); - computed.originalPattern = pattern; - computed.extendedPattern = pattern.replace('{0}', timeRelatedFormats[i].extendedPattern).replace('{1}', dateRelatedFormats[j].extendedPattern).replace(/^[,\s]+|[,\s]+$/gi, ''); - result.push(computeFinalPatterns(computed)); - } - } - - return result; -} - -// this represents the exceptions of the rule that are not covered by CLDR availableFormats -// for single property configurations, they play no role when using multiple properties, and -// those that are not in this table, are not exceptions or are not covered by the data we -// provide. -var validSyntheticProps = { - second: { - numeric: 's', - '2-digit': 'ss' - }, - minute: { - numeric: 'm', - '2-digit': 'mm' - }, - year: { - numeric: 'y', - '2-digit': 'yy' - }, - day: { - numeric: 'd', - '2-digit': 'dd' - }, - month: { - numeric: 'L', - '2-digit': 'LL', - narrow: 'LLLLL', - short: 'LLL', - long: 'LLLL' - }, - weekday: { - narrow: 'ccccc', - short: 'ccc', - long: 'cccc' - } -}; - -function generateSyntheticFormat(propName, propValue) { - if (validSyntheticProps[propName] && validSyntheticProps[propName][propValue]) { - var _ref2; - - return _ref2 = { - originalPattern: validSyntheticProps[propName][propValue], - _: defineProperty$1({}, propName, propValue), - extendedPattern: "{" + propName + "}" - }, defineProperty$1(_ref2, propName, propValue), defineProperty$1(_ref2, "pattern12", "{" + propName + "}"), defineProperty$1(_ref2, "pattern", "{" + propName + "}"), _ref2; - } -} - -// 12.1 The Intl.DateTimeFormat constructor -// ================================== - -// An object map of date component keys, saves using a regex later -var dateWidths = objCreate(null, { narrow: {}, short: {}, long: {} }); - -/** - * Returns a string for a date component, resolved using multiple inheritance as specified - * as specified in the Unicode Technical Standard 35. - */ -function resolveDateString(data, ca, component, width, key) { - // From http://www.unicode.org/reports/tr35/tr35.html#Multiple_Inheritance: - // 'In clearly specified instances, resources may inherit from within the same locale. - // For example, ... the Buddhist calendar inherits from the Gregorian calendar.' - var obj = data[ca] && data[ca][component] ? data[ca][component] : data.gregory[component], - - - // "sideways" inheritance resolves strings when a key doesn't exist - alts = { - narrow: ['short', 'long'], - short: ['long', 'narrow'], - long: ['short', 'narrow'] - }, - - - // - resolved = hop.call(obj, width) ? obj[width] : hop.call(obj, alts[width][0]) ? obj[alts[width][0]] : obj[alts[width][1]]; - - // `key` wouldn't be specified for components 'dayPeriods' - return key !== null ? resolved[key] : resolved; -} - -// Define the DateTimeFormat constructor internally so it cannot be tainted -function DateTimeFormatConstructor() { - var locales = arguments[0]; - var options = arguments[1]; - - if (!this || this === Intl$1) { - return new Intl$1.DateTimeFormat(locales, options); - } - return InitializeDateTimeFormat(toObject(this), locales, options); -} - -defineProperty$$1(Intl$1, 'DateTimeFormat', { - configurable: true, - writable: true, - value: DateTimeFormatConstructor -}); - -// Must explicitly set prototypes as unwritable -defineProperty$$1(DateTimeFormatConstructor, 'prototype', { - writable: false -}); - -/** - * The abstract operation InitializeDateTimeFormat accepts the arguments dateTimeFormat - * (which must be an object), locales, and options. It initializes dateTimeFormat as a - * DateTimeFormat object. - */ -function /* 12.1.1.1 */InitializeDateTimeFormat(dateTimeFormat, locales, options) { - // This will be a internal properties object if we're not already initialized - var internal = getInternalProperties(dateTimeFormat); - - // Create an object whose props can be used to restore the values of RegExp props - var regexpRestore = createRegExpRestore(); - - // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with - // value true, throw a TypeError exception. - if (internal['[[initializedIntlObject]]'] === true) throw new TypeError('`this` object has already been initialized as an Intl object'); - - // Need this to access the `internal` object - defineProperty$$1(dateTimeFormat, '__getInternalProperties', { - value: function value() { - // NOTE: Non-standard, for internal use only - if (arguments[0] === secret) return internal; - } - }); - - // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true. - internal['[[initializedIntlObject]]'] = true; - - // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList - // abstract operation (defined in 9.2.1) with argument locales. - var requestedLocales = CanonicalizeLocaleList(locales); - - // 4. Let options be the result of calling the ToDateTimeOptions abstract - // operation (defined below) with arguments options, "any", and "date". - options = ToDateTimeOptions(options, 'any', 'date'); - - // 5. Let opt be a new Record. - var opt = new Record(); - - // 6. Let matcher be the result of calling the GetOption abstract operation - // (defined in 9.2.9) with arguments options, "localeMatcher", "string", a List - // containing the two String values "lookup" and "best fit", and "best fit". - var matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit'); - - // 7. Set opt.[[localeMatcher]] to matcher. - opt['[[localeMatcher]]'] = matcher; - - // 8. Let DateTimeFormat be the standard built-in object that is the initial - // value of Intl.DateTimeFormat. - var DateTimeFormat = internals.DateTimeFormat; // This is what we *really* need - - // 9. Let localeData be the value of the [[localeData]] internal property of - // DateTimeFormat. - var localeData = DateTimeFormat['[[localeData]]']; - - // 10. Let r be the result of calling the ResolveLocale abstract operation - // (defined in 9.2.5) with the [[availableLocales]] internal property of - // DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]] - // internal property of DateTimeFormat, and localeData. - var r = ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales, opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData); - - // 11. Set the [[locale]] internal property of dateTimeFormat to the value of - // r.[[locale]]. - internal['[[locale]]'] = r['[[locale]]']; - - // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of - // r.[[ca]]. - internal['[[calendar]]'] = r['[[ca]]']; - - // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of - // r.[[nu]]. - internal['[[numberingSystem]]'] = r['[[nu]]']; - - // The specification doesn't tell us to do this, but it's helpful later on - internal['[[dataLocale]]'] = r['[[dataLocale]]']; - - // 14. Let dataLocale be the value of r.[[dataLocale]]. - var dataLocale = r['[[dataLocale]]']; - - // 15. Let tz be the result of calling the [[Get]] internal method of options with - // argument "timeZone". - var tz = options.timeZone; - - // 16. If tz is not undefined, then - if (tz !== undefined) { - // a. Let tz be ToString(tz). - // b. Convert tz to upper case as described in 6.1. - // NOTE: If an implementation accepts additional time zone values, as permitted - // under certain conditions by the Conformance clause, different casing - // rules apply. - tz = toLatinUpperCase(tz); - - // c. If tz is not "UTC", then throw a RangeError exception. - // ###TODO: accept more time zones### - if (tz !== 'UTC') throw new RangeError('timeZone is not supported.'); - } - - // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz. - internal['[[timeZone]]'] = tz; - - // 18. Let opt be a new Record. - opt = new Record(); - - // 19. For each row of Table 3, except the header row, do: - for (var prop in dateTimeComponents) { - if (!hop.call(dateTimeComponents, prop)) continue; - - // 20. Let prop be the name given in the Property column of the row. - // 21. Let value be the result of calling the GetOption abstract operation, - // passing as argument options, the name given in the Property column of the - // row, "string", a List containing the strings given in the Values column of - // the row, and undefined. - var value = GetOption(options, prop, 'string', dateTimeComponents[prop]); - - // 22. Set opt.[[]] to value. - opt['[[' + prop + ']]'] = value; - } - - // Assigned a value below - var bestFormat = void 0; - - // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of - // localeData with argument dataLocale. - var dataLocaleData = localeData[dataLocale]; - - // 24. Let formats be the result of calling the [[Get]] internal method of - // dataLocaleData with argument "formats". - // Note: we process the CLDR formats into the spec'd structure - var formats = ToDateTimeFormats(dataLocaleData.formats); - - // 25. Let matcher be the result of calling the GetOption abstract operation with - // arguments options, "formatMatcher", "string", a List containing the two String - // values "basic" and "best fit", and "best fit". - matcher = GetOption(options, 'formatMatcher', 'string', new List('basic', 'best fit'), 'best fit'); - - // Optimization: caching the processed formats as a one time operation by - // replacing the initial structure from localeData - dataLocaleData.formats = formats; - - // 26. If matcher is "basic", then - if (matcher === 'basic') { - // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract - // operation (defined below) with opt and formats. - bestFormat = BasicFormatMatcher(opt, formats); - - // 28. Else - } else { - { - // diverging - var _hr = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/); - opt.hour12 = _hr === undefined ? dataLocaleData.hour12 : _hr; - } - // 29. Let bestFormat be the result of calling the BestFitFormatMatcher - // abstract operation (defined below) with opt and formats. - bestFormat = BestFitFormatMatcher(opt, formats); - } - - // 30. For each row in Table 3, except the header row, do - for (var _prop in dateTimeComponents) { - if (!hop.call(dateTimeComponents, _prop)) continue; - - // a. Let prop be the name given in the Property column of the row. - // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of - // bestFormat with argument prop. - // c. If pDesc is not undefined, then - if (hop.call(bestFormat, _prop)) { - // i. Let p be the result of calling the [[Get]] internal method of bestFormat - // with argument prop. - var p = bestFormat[_prop]; - { - // diverging - p = bestFormat._ && hop.call(bestFormat._, _prop) ? bestFormat._[_prop] : p; - } - - // ii. Set the [[]] internal property of dateTimeFormat to p. - internal['[[' + _prop + ']]'] = p; - } - } - - var pattern = void 0; // Assigned a value below - - // 31. Let hr12 be the result of calling the GetOption abstract operation with - // arguments options, "hour12", "boolean", undefined, and undefined. - var hr12 = GetOption(options, 'hour12', 'boolean' /*, undefined, undefined*/); - - // 32. If dateTimeFormat has an internal property [[hour]], then - if (internal['[[hour]]']) { - // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]] - // internal method of dataLocaleData with argument "hour12". - hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12; - - // b. Set the [[hour12]] internal property of dateTimeFormat to hr12. - internal['[[hour12]]'] = hr12; - - // c. If hr12 is true, then - if (hr12 === true) { - // i. Let hourNo0 be the result of calling the [[Get]] internal method of - // dataLocaleData with argument "hourNo0". - var hourNo0 = dataLocaleData.hourNo0; - - // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0. - internal['[[hourNo0]]'] = hourNo0; - - // iii. Let pattern be the result of calling the [[Get]] internal method of - // bestFormat with argument "pattern12". - pattern = bestFormat.pattern12; - } - - // d. Else - else - // i. Let pattern be the result of calling the [[Get]] internal method of - // bestFormat with argument "pattern". - pattern = bestFormat.pattern; - } - - // 33. Else - else - // a. Let pattern be the result of calling the [[Get]] internal method of - // bestFormat with argument "pattern". - pattern = bestFormat.pattern; - - // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern. - internal['[[pattern]]'] = pattern; - - // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined. - internal['[[boundFormat]]'] = undefined; - - // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to - // true. - internal['[[initializedDateTimeFormat]]'] = true; - - // In ES3, we need to pre-bind the format() function - if (es3) dateTimeFormat.format = GetFormatDateTime.call(dateTimeFormat); - - // Restore the RegExp properties - regexpRestore(); - - // Return the newly initialised object - return dateTimeFormat; -} - -/** - * Several DateTimeFormat algorithms use values from the following table, which provides - * property names and allowable values for the components of date and time formats: - */ -var dateTimeComponents = { - weekday: ["narrow", "short", "long"], - era: ["narrow", "short", "long"], - year: ["2-digit", "numeric"], - month: ["2-digit", "numeric", "narrow", "short", "long"], - day: ["2-digit", "numeric"], - hour: ["2-digit", "numeric"], - minute: ["2-digit", "numeric"], - second: ["2-digit", "numeric"], - timeZoneName: ["short", "long"] -}; - -/** - * When the ToDateTimeOptions abstract operation is called with arguments options, - * required, and defaults, the following steps are taken: - */ -function ToDateTimeFormats(formats) { - if (Object.prototype.toString.call(formats) === '[object Array]') { - return formats; - } - return createDateTimeFormats(formats); -} - -/** - * When the ToDateTimeOptions abstract operation is called with arguments options, - * required, and defaults, the following steps are taken: - */ -function ToDateTimeOptions(options, required, defaults$$1) { - // 1. If options is undefined, then let options be null, else let options be - // ToObject(options). - if (options === undefined) options = null;else { - // (#12) options needs to be a Record, but it also needs to inherit properties - var opt2 = toObject(options); - options = new Record(); - - for (var k in opt2) { - options[k] = opt2[k]; - } - } - - // 2. Let create be the standard built-in function object defined in ES5, 15.2.3.5. - var create = objCreate; - - // 3. Let options be the result of calling the [[Call]] internal method of create with - // undefined as the this value and an argument list containing the single item - // options. - options = create(options); - - // 4. Let needDefaults be true. - var needDefaults = true; - - // 5. If required is "date" or "any", then - if (required === 'date' || required === 'any') { - // a. For each of the property names "weekday", "year", "month", "day": - // i. If the result of calling the [[Get]] internal method of options with the - // property name is not undefined, then let needDefaults be false. - if (options.weekday !== undefined || options.year !== undefined || options.month !== undefined || options.day !== undefined) needDefaults = false; - } - - // 6. If required is "time" or "any", then - if (required === 'time' || required === 'any') { - // a. For each of the property names "hour", "minute", "second": - // i. If the result of calling the [[Get]] internal method of options with the - // property name is not undefined, then let needDefaults be false. - if (options.hour !== undefined || options.minute !== undefined || options.second !== undefined) needDefaults = false; - } - - // 7. If needDefaults is true and defaults is either "date" or "all", then - if (needDefaults && (defaults$$1 === 'date' || defaults$$1 === 'all')) - // a. For each of the property names "year", "month", "day": - // i. Call the [[DefineOwnProperty]] internal method of options with the - // property name, Property Descriptor {[[Value]]: "numeric", [[Writable]]: - // true, [[Enumerable]]: true, [[Configurable]]: true}, and false. - options.year = options.month = options.day = 'numeric'; - - // 8. If needDefaults is true and defaults is either "time" or "all", then - if (needDefaults && (defaults$$1 === 'time' || defaults$$1 === 'all')) - // a. For each of the property names "hour", "minute", "second": - // i. Call the [[DefineOwnProperty]] internal method of options with the - // property name, Property Descriptor {[[Value]]: "numeric", [[Writable]]: - // true, [[Enumerable]]: true, [[Configurable]]: true}, and false. - options.hour = options.minute = options.second = 'numeric'; - - // 9. Return options. - return options; -} - -/** - * When the BasicFormatMatcher abstract operation is called with two arguments options and - * formats, the following steps are taken: - */ -function BasicFormatMatcher(options, formats) { - // 1. Let removalPenalty be 120. - var removalPenalty = 120; - - // 2. Let additionPenalty be 20. - var additionPenalty = 20; - - // 3. Let longLessPenalty be 8. - var longLessPenalty = 8; - - // 4. Let longMorePenalty be 6. - var longMorePenalty = 6; - - // 5. Let shortLessPenalty be 6. - var shortLessPenalty = 6; - - // 6. Let shortMorePenalty be 3. - var shortMorePenalty = 3; - - // 7. Let bestScore be -Infinity. - var bestScore = -Infinity; - - // 8. Let bestFormat be undefined. - var bestFormat = void 0; - - // 9. Let i be 0. - var i = 0; - - // 10. Assert: formats is an Array object. - - // 11. Let len be the result of calling the [[Get]] internal method of formats with argument "length". - var len = formats.length; - - // 12. Repeat while i < len: - while (i < len) { - // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i). - var format = formats[i]; - - // b. Let score be 0. - var score = 0; - - // c. For each property shown in Table 3: - for (var property in dateTimeComponents) { - if (!hop.call(dateTimeComponents, property)) continue; - - // i. Let optionsProp be options.[[]]. - var optionsProp = options['[[' + property + ']]']; - - // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format - // with argument property. - // iii. If formatPropDesc is not undefined, then - // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property. - var formatProp = hop.call(format, property) ? format[property] : undefined; - - // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by - // additionPenalty. - if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty; - - // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by - // removalPenalty. - else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty; - - // vi. Else - else { - // 1. Let values be the array ["2-digit", "numeric", "narrow", "short", - // "long"]. - var values = ['2-digit', 'numeric', 'narrow', 'short', 'long']; - - // 2. Let optionsPropIndex be the index of optionsProp within values. - var optionsPropIndex = arrIndexOf.call(values, optionsProp); - - // 3. Let formatPropIndex be the index of formatProp within values. - var formatPropIndex = arrIndexOf.call(values, formatProp); - - // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2). - var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2); - - // 5. If delta = 2, decrease score by longMorePenalty. - if (delta === 2) score -= longMorePenalty; - - // 6. Else if delta = 1, decrease score by shortMorePenalty. - else if (delta === 1) score -= shortMorePenalty; - - // 7. Else if delta = -1, decrease score by shortLessPenalty. - else if (delta === -1) score -= shortLessPenalty; - - // 8. Else if delta = -2, decrease score by longLessPenalty. - else if (delta === -2) score -= longLessPenalty; - } - } - - // d. If score > bestScore, then - if (score > bestScore) { - // i. Let bestScore be score. - bestScore = score; - - // ii. Let bestFormat be format. - bestFormat = format; - } - - // e. Increase i by 1. - i++; - } - - // 13. Return bestFormat. - return bestFormat; -} - -/** - * When the BestFitFormatMatcher abstract operation is called with two arguments options - * and formats, it performs implementation dependent steps, which should return a set of - * component representations that a typical user of the selected locale would perceive as - * at least as good as the one returned by BasicFormatMatcher. - * - * This polyfill defines the algorithm to be the same as BasicFormatMatcher, - * with the addition of bonus points awarded where the requested format is of - * the same data type as the potentially matching format. - * - * This algo relies on the concept of closest distance matching described here: - * http://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons - * Typically a “best match” is found using a closest distance match, such as: - * - * Symbols requesting a best choice for the locale are replaced. - * j → one of {H, k, h, K}; C → one of {a, b, B} - * -> Covered by cldr.js matching process - * - * For fields with symbols representing the same type (year, month, day, etc): - * Most symbols have a small distance from each other. - * M ≅ L; E ≅ c; a ≅ b ≅ B; H ≅ k ≅ h ≅ K; ... - * -> Covered by cldr.js matching process - * - * Width differences among fields, other than those marking text vs numeric, are given small distance from each other. - * MMM ≅ MMMM - * MM ≅ M - * Numeric and text fields are given a larger distance from each other. - * MMM ≈ MM - * Symbols representing substantial differences (week of year vs week of month) are given much larger a distances from each other. - * d ≋ D; ... - * Missing or extra fields cause a match to fail. (But see Missing Skeleton Fields). - * - * - * For example, - * - * { month: 'numeric', day: 'numeric' } - * - * should match - * - * { month: '2-digit', day: '2-digit' } - * - * rather than - * - * { month: 'short', day: 'numeric' } - * - * This makes sense because a user requesting a formatted date with numeric parts would - * not expect to see the returned format containing narrow, short or long part names - */ -function BestFitFormatMatcher(options, formats) { - /** Diverging: this block implements the hack for single property configuration, eg.: - * - * `new Intl.DateTimeFormat('en', {day: 'numeric'})` - * - * should produce a single digit with the day of the month. This is needed because - * CLDR `availableFormats` data structure doesn't cover these cases. - */ - { - var optionsPropNames = []; - for (var property in dateTimeComponents) { - if (!hop.call(dateTimeComponents, property)) continue; - - if (options['[[' + property + ']]'] !== undefined) { - optionsPropNames.push(property); - } - } - if (optionsPropNames.length === 1) { - var _bestFormat = generateSyntheticFormat(optionsPropNames[0], options['[[' + optionsPropNames[0] + ']]']); - if (_bestFormat) { - return _bestFormat; - } - } - } - - // 1. Let removalPenalty be 120. - var removalPenalty = 120; - - // 2. Let additionPenalty be 20. - var additionPenalty = 20; - - // 3. Let longLessPenalty be 8. - var longLessPenalty = 8; - - // 4. Let longMorePenalty be 6. - var longMorePenalty = 6; - - // 5. Let shortLessPenalty be 6. - var shortLessPenalty = 6; - - // 6. Let shortMorePenalty be 3. - var shortMorePenalty = 3; - - var patternPenalty = 2; - - var hour12Penalty = 1; - - // 7. Let bestScore be -Infinity. - var bestScore = -Infinity; - - // 8. Let bestFormat be undefined. - var bestFormat = void 0; - - // 9. Let i be 0. - var i = 0; - - // 10. Assert: formats is an Array object. - - // 11. Let len be the result of calling the [[Get]] internal method of formats with argument "length". - var len = formats.length; - - // 12. Repeat while i < len: - while (i < len) { - // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i). - var format = formats[i]; - - // b. Let score be 0. - var score = 0; - - // c. For each property shown in Table 3: - for (var _property in dateTimeComponents) { - if (!hop.call(dateTimeComponents, _property)) continue; - - // i. Let optionsProp be options.[[]]. - var optionsProp = options['[[' + _property + ']]']; - - // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format - // with argument property. - // iii. If formatPropDesc is not undefined, then - // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property. - var formatProp = hop.call(format, _property) ? format[_property] : undefined; - - // Diverging: using the default properties produced by the pattern/skeleton - // to match it with user options, and apply a penalty - var patternProp = hop.call(format._, _property) ? format._[_property] : undefined; - if (optionsProp !== patternProp) { - score -= patternPenalty; - } - - // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by - // additionPenalty. - if (optionsProp === undefined && formatProp !== undefined) score -= additionPenalty; - - // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by - // removalPenalty. - else if (optionsProp !== undefined && formatProp === undefined) score -= removalPenalty; - - // vi. Else - else { - // 1. Let values be the array ["2-digit", "numeric", "narrow", "short", - // "long"]. - var values = ['2-digit', 'numeric', 'narrow', 'short', 'long']; - - // 2. Let optionsPropIndex be the index of optionsProp within values. - var optionsPropIndex = arrIndexOf.call(values, optionsProp); - - // 3. Let formatPropIndex be the index of formatProp within values. - var formatPropIndex = arrIndexOf.call(values, formatProp); - - // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2). - var delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2); - - { - // diverging from spec - // When the bestFit argument is true, subtract additional penalty where data types are not the same - if (formatPropIndex <= 1 && optionsPropIndex >= 2 || formatPropIndex >= 2 && optionsPropIndex <= 1) { - // 5. If delta = 2, decrease score by longMorePenalty. - if (delta > 0) score -= longMorePenalty;else if (delta < 0) score -= longLessPenalty; - } else { - // 5. If delta = 2, decrease score by longMorePenalty. - if (delta > 1) score -= shortMorePenalty;else if (delta < -1) score -= shortLessPenalty; - } - } - } - } - - { - // diverging to also take into consideration differences between 12 or 24 hours - // which is special for the best fit only. - if (format._.hour12 !== options.hour12) { - score -= hour12Penalty; - } - } - - // d. If score > bestScore, then - if (score > bestScore) { - // i. Let bestScore be score. - bestScore = score; - // ii. Let bestFormat be format. - bestFormat = format; - } - - // e. Increase i by 1. - i++; - } - - // 13. Return bestFormat. - return bestFormat; -} - -/* 12.2.3 */internals.DateTimeFormat = { - '[[availableLocales]]': [], - '[[relevantExtensionKeys]]': ['ca', 'nu'], - '[[localeData]]': {} -}; - -/** - * When the supportedLocalesOf method of Intl.DateTimeFormat is called, the - * following steps are taken: - */ -/* 12.2.2 */ -defineProperty$$1(Intl$1.DateTimeFormat, 'supportedLocalesOf', { - configurable: true, - writable: true, - value: fnBind.call(function (locales) { - // Bound functions only have the `this` value altered if being used as a constructor, - // this lets us imitate a native function that has no constructor - if (!hop.call(this, '[[availableLocales]]')) throw new TypeError('supportedLocalesOf() is not a constructor'); - - // Create an object whose props can be used to restore the values of RegExp props - var regexpRestore = createRegExpRestore(), - - - // 1. If options is not provided, then let options be undefined. - options = arguments[1], - - - // 2. Let availableLocales be the value of the [[availableLocales]] internal - // property of the standard built-in object that is the initial value of - // Intl.NumberFormat. - - availableLocales = this['[[availableLocales]]'], - - - // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList - // abstract operation (defined in 9.2.1) with argument locales. - requestedLocales = CanonicalizeLocaleList(locales); - - // Restore the RegExp properties - regexpRestore(); - - // 4. Return the result of calling the SupportedLocales abstract operation - // (defined in 9.2.8) with arguments availableLocales, requestedLocales, - // and options. - return SupportedLocales(availableLocales, requestedLocales, options); - }, internals.NumberFormat) -}); - -/** - * This named accessor property returns a function that formats a number - * according to the effective locale and the formatting options of this - * DateTimeFormat object. - */ -/* 12.3.2 */defineProperty$$1(Intl$1.DateTimeFormat.prototype, 'format', { - configurable: true, - get: GetFormatDateTime -}); - -function GetFormatDateTime() { - var internal = this !== null && _typeof(this) === 'object' && getInternalProperties(this); - - // Satisfy test 12.3_b - if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for format() is not an initialized Intl.DateTimeFormat object.'); - - // The value of the [[Get]] attribute is a function that takes the following - // steps: - - // 1. If the [[boundFormat]] internal property of this DateTimeFormat object - // is undefined, then: - if (internal['[[boundFormat]]'] === undefined) { - // a. Let F be a Function object, with internal properties set as - // specified for built-in functions in ES5, 15, or successor, and the - // length property set to 0, that takes the argument date and - // performs the following steps: - var F = function F() { - var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - // i. If date is not provided or is undefined, then let x be the - // result as if by the expression Date.now() where Date.now is - // the standard built-in function defined in ES5, 15.9.4.4. - // ii. Else let x be ToNumber(date). - // iii. Return the result of calling the FormatDateTime abstract - // operation (defined below) with arguments this and x. - var x = date === undefined ? Date.now() : toNumber(date); - return FormatDateTime(this, x); - }; - // b. Let bind be the standard built-in function object defined in ES5, - // 15.3.4.5. - // c. Let bf be the result of calling the [[Call]] internal method of - // bind with F as the this value and an argument list containing - // the single item this. - var bf = fnBind.call(F, this); - // d. Set the [[boundFormat]] internal property of this NumberFormat - // object to bf. - internal['[[boundFormat]]'] = bf; - } - // Return the value of the [[boundFormat]] internal property of this - // NumberFormat object. - return internal['[[boundFormat]]']; -} - -function formatToParts$1() { - var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; - - var internal = this !== null && _typeof(this) === 'object' && getInternalProperties(this); - - if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.'); - - var x = date === undefined ? Date.now() : toNumber(date); - return FormatToPartsDateTime(this, x); -} - -Object.defineProperty(Intl$1.DateTimeFormat.prototype, 'formatToParts', { - enumerable: false, - writable: true, - configurable: true, - value: formatToParts$1 -}); - -function CreateDateTimeParts(dateTimeFormat, x) { - // 1. If x is not a finite Number, then throw a RangeError exception. - if (!isFinite(x)) throw new RangeError('Invalid valid date passed to format'); - - var internal = dateTimeFormat.__getInternalProperties(secret); - - // Creating restore point for properties on the RegExp object... please wait - /* let regexpRestore = */createRegExpRestore(); // ###TODO: review this - - // 2. Let locale be the value of the [[locale]] internal property of dateTimeFormat. - var locale = internal['[[locale]]']; - - // 3. Let nf be the result of creating a new NumberFormat object as if by the - // expression new Intl.NumberFormat([locale], {useGrouping: false}) where - // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3. - var nf = new Intl$1.NumberFormat([locale], { useGrouping: false }); - - // 4. Let nf2 be the result of creating a new NumberFormat object as if by the - // expression new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping: - // false}) where Intl.NumberFormat is the standard built-in constructor defined in - // 11.1.3. - var nf2 = new Intl$1.NumberFormat([locale], { minimumIntegerDigits: 2, useGrouping: false }); - - // 5. Let tm be the result of calling the ToLocalTime abstract operation (defined - // below) with x, the value of the [[calendar]] internal property of dateTimeFormat, - // and the value of the [[timeZone]] internal property of dateTimeFormat. - var tm = ToLocalTime(x, internal['[[calendar]]'], internal['[[timeZone]]']); - - // 6. Let result be the value of the [[pattern]] internal property of dateTimeFormat. - var pattern = internal['[[pattern]]']; - - // 7. - var result = new List(); - - // 8. - var index = 0; - - // 9. - var beginIndex = pattern.indexOf('{'); - - // 10. - var endIndex = 0; - - // Need the locale minus any extensions - var dataLocale = internal['[[dataLocale]]']; - - // Need the calendar data from CLDR - var localeData = internals.DateTimeFormat['[[localeData]]'][dataLocale].calendars; - var ca = internal['[[calendar]]']; - - // 11. - while (beginIndex !== -1) { - var fv = void 0; - // a. - endIndex = pattern.indexOf('}', beginIndex); - // b. - if (endIndex === -1) { - throw new Error('Unclosed pattern'); - } - // c. - if (beginIndex > index) { - arrPush.call(result, { - type: 'literal', - value: pattern.substring(index, beginIndex) - }); - } - // d. - var p = pattern.substring(beginIndex + 1, endIndex); - // e. - if (dateTimeComponents.hasOwnProperty(p)) { - // i. Let f be the value of the [[

]] internal property of dateTimeFormat. - var f = internal['[[' + p + ']]']; - // ii. Let v be the value of tm.[[

]]. - var v = tm['[[' + p + ']]']; - // iii. If p is "year" and v ≤ 0, then let v be 1 - v. - if (p === 'year' && v <= 0) { - v = 1 - v; - } - // iv. If p is "month", then increase v by 1. - else if (p === 'month') { - v++; - } - // v. If p is "hour" and the value of the [[hour12]] internal property of - // dateTimeFormat is true, then - else if (p === 'hour' && internal['[[hour12]]'] === true) { - // 1. Let v be v modulo 12. - v = v % 12; - // 2. If v is 0 and the value of the [[hourNo0]] internal property of - // dateTimeFormat is true, then let v be 12. - if (v === 0 && internal['[[hourNo0]]'] === true) { - v = 12; - } - } - - // vi. If f is "numeric", then - if (f === 'numeric') { - // 1. Let fv be the result of calling the FormatNumber abstract operation - // (defined in 11.3.2) with arguments nf and v. - fv = FormatNumber(nf, v); - } - // vii. Else if f is "2-digit", then - else if (f === '2-digit') { - // 1. Let fv be the result of calling the FormatNumber abstract operation - // with arguments nf2 and v. - fv = FormatNumber(nf2, v); - // 2. If the length of fv is greater than 2, let fv be the substring of fv - // containing the last two characters. - if (fv.length > 2) { - fv = fv.slice(-2); - } - } - // viii. Else if f is "narrow", "short", or "long", then let fv be a String - // value representing f in the desired form; the String value depends upon - // the implementation and the effective locale and calendar of - // dateTimeFormat. If p is "month", then the String value may also depend - // on whether dateTimeFormat has a [[day]] internal property. If p is - // "timeZoneName", then the String value may also depend on the value of - // the [[inDST]] field of tm. - else if (f in dateWidths) { - switch (p) { - case 'month': - fv = resolveDateString(localeData, ca, 'months', f, tm['[[' + p + ']]']); - break; - - case 'weekday': - try { - fv = resolveDateString(localeData, ca, 'days', f, tm['[[' + p + ']]']); - // fv = resolveDateString(ca.days, f)[tm['[['+ p +']]']]; - } catch (e) { - throw new Error('Could not find weekday data for locale ' + locale); - } - break; - - case 'timeZoneName': - fv = ''; // ###TODO - break; - - case 'era': - try { - fv = resolveDateString(localeData, ca, 'eras', f, tm['[[' + p + ']]']); - } catch (e) { - throw new Error('Could not find era data for locale ' + locale); - } - break; - - default: - fv = tm['[[' + p + ']]']; - } - } - // ix - arrPush.call(result, { - type: p, - value: fv - }); - // f. - } else if (p === 'ampm') { - // i. - var _v = tm['[[hour]]']; - // ii./iii. - fv = resolveDateString(localeData, ca, 'dayPeriods', _v > 11 ? 'pm' : 'am', null); - // iv. - arrPush.call(result, { - type: 'dayPeriod', - value: fv - }); - // g. - } else { - arrPush.call(result, { - type: 'literal', - value: pattern.substring(beginIndex, endIndex + 1) - }); - } - // h. - index = endIndex + 1; - // i. - beginIndex = pattern.indexOf('{', index); - } - // 12. - if (endIndex < pattern.length - 1) { - arrPush.call(result, { - type: 'literal', - value: pattern.substr(endIndex + 1) - }); - } - // 13. - return result; -} - -/** - * When the FormatDateTime abstract operation is called with arguments dateTimeFormat - * (which must be an object initialized as a DateTimeFormat) and x (which must be a Number - * value), it returns a String value representing x (interpreted as a time value as - * specified in ES5, 15.9.1.1) according to the effective locale and the formatting - * options of dateTimeFormat. - */ -function FormatDateTime(dateTimeFormat, x) { - var parts = CreateDateTimeParts(dateTimeFormat, x); - var result = ''; - - for (var i = 0; parts.length > i; i++) { - var part = parts[i]; - result += part.value; - } - return result; -} - -function FormatToPartsDateTime(dateTimeFormat, x) { - var parts = CreateDateTimeParts(dateTimeFormat, x); - var result = []; - for (var i = 0; parts.length > i; i++) { - var part = parts[i]; - result.push({ - type: part.type, - value: part.value - }); - } - return result; -} - -/** - * When the ToLocalTime abstract operation is called with arguments date, calendar, and - * timeZone, the following steps are taken: - */ -function ToLocalTime(date, calendar, timeZone) { - // 1. Apply calendrical calculations on date for the given calendar and time zone to - // produce weekday, era, year, month, day, hour, minute, second, and inDST values. - // The calculations should use best available information about the specified - // calendar and time zone. If the calendar is "gregory", then the calculations must - // match the algorithms specified in ES5, 15.9.1, except that calculations are not - // bound by the restrictions on the use of best available information on time zones - // for local time zone adjustment and daylight saving time adjustment imposed by - // ES5, 15.9.1.7 and 15.9.1.8. - // ###TODO### - var d = new Date(date), - m = 'get' + (timeZone || ''); - - // 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]], - // [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding - // calculated value. - return new Record({ - '[[weekday]]': d[m + 'Day'](), - '[[era]]': +(d[m + 'FullYear']() >= 0), - '[[year]]': d[m + 'FullYear'](), - '[[month]]': d[m + 'Month'](), - '[[day]]': d[m + 'Date'](), - '[[hour]]': d[m + 'Hours'](), - '[[minute]]': d[m + 'Minutes'](), - '[[second]]': d[m + 'Seconds'](), - '[[inDST]]': false // ###TODO### - }); -} - -/** - * The function returns a new object whose properties and attributes are set as if - * constructed by an object literal assigning to each of the following properties the - * value of the corresponding internal property of this DateTimeFormat object (see 12.4): - * locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day, - * hour, minute, second, and timeZoneName. Properties whose corresponding internal - * properties are not present are not assigned. - */ -/* 12.3.3 */defineProperty$$1(Intl$1.DateTimeFormat.prototype, 'resolvedOptions', { - writable: true, - configurable: true, - value: function value() { - var prop = void 0, - descs = new Record(), - props = ['locale', 'calendar', 'numberingSystem', 'timeZone', 'hour12', 'weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName'], - internal = this !== null && _typeof(this) === 'object' && getInternalProperties(this); - - // Satisfy test 12.3_b - if (!internal || !internal['[[initializedDateTimeFormat]]']) throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.'); - - for (var i = 0, max = props.length; i < max; i++) { - if (hop.call(internal, prop = '[[' + props[i] + ']]')) descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true }; - } - - return objCreate({}, descs); - } -}); - -// Sect 13 Locale Sensitive Functions of the ECMAScript Language Specification -// =========================================================================== - -var ls = Intl$1.__localeSensitiveProtos = { - Number: {}, - Date: {} -}; - -/** - * When the toLocaleString method is called with optional arguments locales and options, - * the following steps are taken: - */ -/* 13.2.1 */ls.Number.toLocaleString = function () { - // Satisfy test 13.2.1_1 - if (Object.prototype.toString.call(this) !== '[object Number]') throw new TypeError('`this` value must be a number for Number.prototype.toLocaleString()'); - - // 1. Let x be this Number value (as defined in ES5, 15.7.4). - // 2. If locales is not provided, then let locales be undefined. - // 3. If options is not provided, then let options be undefined. - // 4. Let numberFormat be the result of creating a new object as if by the - // expression new Intl.NumberFormat(locales, options) where - // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3. - // 5. Return the result of calling the FormatNumber abstract operation - // (defined in 11.3.2) with arguments numberFormat and x. - return FormatNumber(new NumberFormatConstructor(arguments[0], arguments[1]), this); -}; - -/** - * When the toLocaleString method is called with optional arguments locales and options, - * the following steps are taken: - */ -/* 13.3.1 */ls.Date.toLocaleString = function () { - // Satisfy test 13.3.0_1 - if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleString()'); - - // 1. Let x be this time value (as defined in ES5, 15.9.5). - var x = +this; - - // 2. If x is NaN, then return "Invalid Date". - if (isNaN(x)) return 'Invalid Date'; - - // 3. If locales is not provided, then let locales be undefined. - var locales = arguments[0]; - - // 4. If options is not provided, then let options be undefined. - var options = arguments[1]; - - // 5. Let options be the result of calling the ToDateTimeOptions abstract - // operation (defined in 12.1.1) with arguments options, "any", and "all". - options = ToDateTimeOptions(options, 'any', 'all'); - - // 6. Let dateTimeFormat be the result of creating a new object as if by the - // expression new Intl.DateTimeFormat(locales, options) where - // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3. - var dateTimeFormat = new DateTimeFormatConstructor(locales, options); - - // 7. Return the result of calling the FormatDateTime abstract operation (defined - // in 12.3.2) with arguments dateTimeFormat and x. - return FormatDateTime(dateTimeFormat, x); -}; - -/** - * When the toLocaleDateString method is called with optional arguments locales and - * options, the following steps are taken: - */ -/* 13.3.2 */ls.Date.toLocaleDateString = function () { - // Satisfy test 13.3.0_1 - if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleDateString()'); - - // 1. Let x be this time value (as defined in ES5, 15.9.5). - var x = +this; - - // 2. If x is NaN, then return "Invalid Date". - if (isNaN(x)) return 'Invalid Date'; - - // 3. If locales is not provided, then let locales be undefined. - var locales = arguments[0], - - - // 4. If options is not provided, then let options be undefined. - options = arguments[1]; - - // 5. Let options be the result of calling the ToDateTimeOptions abstract - // operation (defined in 12.1.1) with arguments options, "date", and "date". - options = ToDateTimeOptions(options, 'date', 'date'); - - // 6. Let dateTimeFormat be the result of creating a new object as if by the - // expression new Intl.DateTimeFormat(locales, options) where - // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3. - var dateTimeFormat = new DateTimeFormatConstructor(locales, options); - - // 7. Return the result of calling the FormatDateTime abstract operation (defined - // in 12.3.2) with arguments dateTimeFormat and x. - return FormatDateTime(dateTimeFormat, x); -}; - -/** - * When the toLocaleTimeString method is called with optional arguments locales and - * options, the following steps are taken: - */ -/* 13.3.3 */ls.Date.toLocaleTimeString = function () { - // Satisfy test 13.3.0_1 - if (Object.prototype.toString.call(this) !== '[object Date]') throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleTimeString()'); - - // 1. Let x be this time value (as defined in ES5, 15.9.5). - var x = +this; - - // 2. If x is NaN, then return "Invalid Date". - if (isNaN(x)) return 'Invalid Date'; - - // 3. If locales is not provided, then let locales be undefined. - var locales = arguments[0]; - - // 4. If options is not provided, then let options be undefined. - var options = arguments[1]; - - // 5. Let options be the result of calling the ToDateTimeOptions abstract - // operation (defined in 12.1.1) with arguments options, "time", and "time". - options = ToDateTimeOptions(options, 'time', 'time'); - - // 6. Let dateTimeFormat be the result of creating a new object as if by the - // expression new Intl.DateTimeFormat(locales, options) where - // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3. - var dateTimeFormat = new DateTimeFormatConstructor(locales, options); - - // 7. Return the result of calling the FormatDateTime abstract operation (defined - // in 12.3.2) with arguments dateTimeFormat and x. - return FormatDateTime(dateTimeFormat, x); -}; - -/** - * @license Copyright 2013 Andy Earnshaw, MIT License - * - * Implements the ECMAScript Internationalization API in ES5-compatible environments, - * following the ECMA-402 specification as closely as possible - * - * ECMA-402: http://ecma-international.org/ecma-402/1.0/ - * - * CLDR format locale data should be provided using IntlPolyfill.__addLocaleData(). - */ - -defineProperty$$1(Intl$1, '__applyLocaleSensitivePrototypes', { - writable: true, - configurable: true, - value: function value() { - defineProperty$$1(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString }); - // Need this here for IE 8, to avoid the _DontEnum_ bug - defineProperty$$1(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString }); - - for (var k in ls.Date) { - if (hop.call(ls.Date, k)) defineProperty$$1(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] }); - } - } -}); - -/** - * Can't really ship a single script with data for hundreds of locales, so we provide - * this __addLocaleData method as a means for the developer to add the data on an - * as-needed basis - */ -defineProperty$$1(Intl$1, '__addLocaleData', { - value: function value(data) { - if (!IsStructurallyValidLanguageTag(data.locale)) throw new Error("Invalid language tag \"" + data.locale + "\" when calling __addLocaleData(\"" + data.locale + "\", ...) to register new locale data."); - - addLocaleData(data, data.locale); - } -}); - -function addLocaleData(data, tag) { - // Both NumberFormat and DateTimeFormat require number data, so throw if it isn't present - if (!data.number) throw new Error("Object passed doesn't contain locale data for Intl.NumberFormat"); - - var locale = void 0, - locales = [tag], - parts = tag.split('-'); - - // Create fallbacks for locale data with scripts, e.g. Latn, Hans, Vaii, etc - if (parts.length > 2 && parts[1].length === 4) arrPush.call(locales, parts[0] + '-' + parts[2]); - - while (locale = arrShift.call(locales)) { - // Add to NumberFormat internal properties as per 11.2.3 - arrPush.call(internals.NumberFormat['[[availableLocales]]'], locale); - internals.NumberFormat['[[localeData]]'][locale] = data.number; - - // ...and DateTimeFormat internal properties as per 12.2.3 - if (data.date) { - data.date.nu = data.number.nu; - arrPush.call(internals.DateTimeFormat['[[availableLocales]]'], locale); - internals.DateTimeFormat['[[localeData]]'][locale] = data.date; - } - } - - // If this is the first set of locale data added, make it the default - if (defaultLocale === undefined) setDefaultLocale(tag); -} - -defineProperty$$1(Intl$1, '__disableRegExpRestore', { - value: function value() { - internals.disableRegExpRestore = true; - } -}); - -// hack to export the polyfill as global Intl if needed -if (typeof Intl === 'undefined') { - try { - window.Intl = Intl$1; - Intl$1.__applyLocaleSensitivePrototypes(); - } catch (e) { - // can be read only property - } -} - -return Intl$1; - -}))); -//# sourceMappingURL=Intl.js.map diff --git a/dist/Intl.js.map b/dist/Intl.js.map deleted file mode 100644 index 98980ad7..00000000 --- a/dist/Intl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Intl.js","sources":["../src/util.js","../src/exp.js","../src/6.locales-currencies-tz.js","../src/9.negotiation.js","../src/8.intl.js","../src/11.numberformat.js","../src/cldr.js","../src/12.datetimeformat.js","../src/13.locale-sensitive-functions.js","../src/core.js","../src/browser-main.js"],"sourcesContent":["const realDefineProp = (function () {\n let sentinel = function(){};\n try {\n Object.defineProperty(sentinel, 'a', {\n get: function () {\n return 1;\n }\n });\n Object.defineProperty(sentinel, 'prototype', { writable: false });\n return sentinel.a === 1 && sentinel.prototype instanceof Object;\n } catch (e) {\n return false;\n }\n })();\n\n// Need a workaround for getters in ES3\nexport const es3 = !realDefineProp && !Object.prototype.__defineGetter__;\n\n// We use this a lot (and need it for proto-less objects)\nexport const hop = Object.prototype.hasOwnProperty;\n\n// Naive defineProperty for compatibility\nexport const defineProperty = realDefineProp ? Object.defineProperty : function (obj, name, desc) {\n if ('get' in desc && obj.__defineGetter__)\n obj.__defineGetter__(name, desc.get);\n\n else if (!hop.call(obj, name) || 'value' in desc)\n obj[name] = desc.value;\n};\n\n// Array.prototype.indexOf, as good as we need it to be\nexport const arrIndexOf = Array.prototype.indexOf || function (search) {\n /*jshint validthis:true */\n let t = this;\n if (!t.length)\n return -1;\n\n for (let i = arguments[1] || 0, max = t.length; i < max; i++) {\n if (t[i] === search)\n return i;\n }\n\n return -1;\n};\n\n// Create an object with the specified prototype (2nd arg required for Record)\nexport const objCreate = Object.create || function (proto, props) {\n let obj;\n\n function F() {}\n F.prototype = proto;\n obj = new F();\n\n for (let k in props) {\n if (hop.call(props, k))\n defineProperty(obj, k, props[k]);\n }\n\n return obj;\n};\n\n// Snapshot some (hopefully still) native built-ins\nexport const arrSlice = Array.prototype.slice;\nexport const arrConcat = Array.prototype.concat;\nexport const arrPush = Array.prototype.push;\nexport const arrJoin = Array.prototype.join;\nexport const arrShift = Array.prototype.shift;\n\n// Naive Function.prototype.bind for compatibility\nexport const fnBind = Function.prototype.bind || function (thisObj) {\n let fn = this,\n args = arrSlice.call(arguments, 1);\n\n // All our (presently) bound functions have either 1 or 0 arguments. By returning\n // different function signatures, we can pass some tests in ES3 environments\n if (fn.length === 1) {\n return function () {\n return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));\n };\n }\n return function () {\n return fn.apply(thisObj, arrConcat.call(args, arrSlice.call(arguments)));\n };\n};\n\n// Object housing internal properties for constructors\nexport const internals = objCreate(null);\n\n// Keep internal properties internal\nexport const secret = Math.random();\n\n// Helper functions\n// ================\n\n/**\n * A function to deal with the inaccuracy of calculating log10 in pre-ES6\n * JavaScript environments. Math.log(num) / Math.LN10 was responsible for\n * causing issue #62.\n */\nexport function log10Floor (n) {\n // ES6 provides the more accurate Math.log10\n if (typeof Math.log10 === 'function')\n return Math.floor(Math.log10(n));\n\n let x = Math.round(Math.log(n) * Math.LOG10E);\n return x - (Number('1e' + x) > n);\n}\n\n/**\n * A map that doesn't contain Object in its prototype chain\n */\nexport function Record (obj) {\n // Copy only own properties over unless this object is already a Record instance\n for (let k in obj) {\n if (obj instanceof Record || hop.call(obj, k))\n defineProperty(this, k, { value: obj[k], enumerable: true, writable: true, configurable: true });\n }\n}\nRecord.prototype = objCreate(null);\n\n/**\n * An ordered list\n */\nexport function List() {\n defineProperty(this, 'length', { writable:true, value: 0 });\n\n if (arguments.length)\n arrPush.apply(this, arrSlice.call(arguments));\n}\nList.prototype = objCreate(null);\n\n/**\n * Constructs a regular expression to restore tainted RegExp properties\n */\nexport function createRegExpRestore () {\n if (internals.disableRegExpRestore) {\n return function() { /* no-op */ };\n }\n\n let regExpCache = {\n lastMatch: RegExp.lastMatch || '',\n leftContext: RegExp.leftContext,\n multiline: RegExp.multiline,\n input: RegExp.input\n },\n has = false;\n\n // Create a snapshot of all the 'captured' properties\n for (let i = 1; i <= 9; i++)\n has = (regExpCache['$'+i] = RegExp['$'+i]) || has;\n\n return function() {\n // Now we've snapshotted some properties, escape the lastMatch string\n let esc = /[.?*+^$[\\]\\\\(){}|-]/g,\n lastMatch = regExpCache.lastMatch.replace(esc, '\\\\$&'),\n exprStr = '';\n\n // If any of the captured strings were non-empty, iterate over them all\n if (has) {\n for (let i = 1; i <= 9; i++) {\n let m = regExpCache['$'+i];\n\n // If it's empty, add an empty capturing group\n if (!m) {\n exprStr += '(';\n lastMatch = ')' + lastMatch;\n }\n // Else find the string in lm and escape & wrap it to capture it\n else {\n m = m.replace(esc, '\\\\$&');\n exprStr += lastMatch.substring(0, lastMatch.indexOf(m)) + '(';\n lastMatch = m + ')' + lastMatch.substring(lastMatch.indexOf(m) + m.length);\n }\n }\n }\n\n exprStr += lastMatch;\n\n // Shorten the regex by replacing each part of the expression with a match\n // for a string of that exact length. This is safe for the type of\n // expressions generated above, because the expression matches the whole\n // match string, so we know each group and each segment between capturing\n // groups can be matched by its length alone.\n //\n // The purpose of the regex is to match sequences of characters other\n // than unescaped parentheses. This is a more complicated requirement\n // than it seems at first glance, because it's necessary to match a\n // parenthesis which appears immediately after a backslash (\"\\(\"), but\n // not a parenthesis which appears immediately after an escaped backslash\n // (\"\\\\(\"). We can't simply match [^\\\\]\\\\(, because the previous\n // backslash could itself have a backslash preceding (and escaping) it.\n //\n // Any attempts to simplify this regex are encouraged! A replacement\n // regex should match the strings \"a\\\\\\(\\\\\\)\\\\\" and \"a\\\\\\)\\\\\\(\" in the\n // test string \"a\\\\\\(\\\\\\)\\\\(a\\\\\\)\\\\\\()\".\n exprStr = exprStr.replace(/((^|[^\\\\])((\\\\\\\\)*\\\\[()])+|[^()])+/g, (match) => {\n return `[\\\\s\\\\S]{${match.replace(/\\\\(.)/g, '$1').length}}`;\n });\n\n // Create the regular expression that will reconstruct the RegExp properties\n let expr = new RegExp(exprStr, regExpCache.multiline ? 'gm' : 'g');\n\n // Set the lastIndex of the generated expression to ensure that the match\n // is found in the correct index.\n expr.lastIndex = regExpCache.leftContext.length;\n\n expr.exec(regExpCache.input);\n };\n}\n\n/**\n * Mimics ES5's abstract ToObject() function\n */\nexport function toObject (arg) {\n if (arg === null)\n throw new TypeError('Cannot convert null or undefined to object');\n\n if (typeof arg === 'object')\n return arg;\n return Object(arg);\n}\n\nexport function toNumber (arg) {\n if (typeof arg === 'number')\n return arg;\n return Number(arg);\n}\n\nexport function toInteger (arg) {\n let number = toNumber(arg);\n if (isNaN(number))\n return 0;\n if (number === +0 ||\n number === -0 ||\n number === +Infinity ||\n number === -Infinity)\n return number;\n if (number < 0)\n return Math.floor(Math.abs(number)) * -1;\n return Math.floor(Math.abs(number));\n}\n\nexport function toLength (arg) {\n let len = toInteger(arg);\n if (len <= 0)\n return 0;\n if (len === Infinity)\n return Math.pow(2, 53) - 1;\n return Math.min(len, Math.pow(2, 53) - 1);\n}\n\n/**\n * Returns \"internal\" properties for an object\n */\nexport function getInternalProperties (obj) {\n if (hop.call(obj, '__getInternalProperties'))\n return obj.__getInternalProperties(secret);\n\n return objCreate(null);\n}\n","/**\n* Defines regular expressions for various operations related to the BCP 47 syntax,\n* as defined at http://tools.ietf.org/html/bcp47#section-2.1\n*/\n\n// extlang = 3ALPHA ; selected ISO 639 codes\n// *2(\"-\" 3ALPHA) ; permanently reserved\nconst extlang = '[a-z]{3}(?:-[a-z]{3}){0,2}';\n\n// language = 2*3ALPHA ; shortest ISO 639 code\n// [\"-\" extlang] ; sometimes followed by\n// ; extended language subtags\n// / 4ALPHA ; or reserved for future use\n// / 5*8ALPHA ; or registered language subtag\nconst language = '(?:[a-z]{2,3}(?:-' + extlang + ')?|[a-z]{4}|[a-z]{5,8})';\n\n// script = 4ALPHA ; ISO 15924 code\nconst script = '[a-z]{4}';\n\n// region = 2ALPHA ; ISO 3166-1 code\n// / 3DIGIT ; UN M.49 code\nconst region = '(?:[a-z]{2}|\\\\d{3})';\n\n// variant = 5*8alphanum ; registered variants\n// / (DIGIT 3alphanum)\nconst variant = '(?:[a-z0-9]{5,8}|\\\\d[a-z0-9]{3})';\n\n// ; Single alphanumerics\n// ; \"x\" reserved for private use\n// singleton = DIGIT ; 0 - 9\n// / %x41-57 ; A - W\n// / %x59-5A ; Y - Z\n// / %x61-77 ; a - w\n// / %x79-7A ; y - z\nconst singleton = '[0-9a-wy-z]';\n\n// extension = singleton 1*(\"-\" (2*8alphanum))\nconst extension = singleton + '(?:-[a-z0-9]{2,8})+';\n\n// privateuse = \"x\" 1*(\"-\" (1*8alphanum))\nconst privateuse = 'x(?:-[a-z0-9]{1,8})+';\n\n// irregular = \"en-GB-oed\" ; irregular tags do not match\n// / \"i-ami\" ; the 'langtag' production and\n// / \"i-bnn\" ; would not otherwise be\n// / \"i-default\" ; considered 'well-formed'\n// / \"i-enochian\" ; These tags are all valid,\n// / \"i-hak\" ; but most are deprecated\n// / \"i-klingon\" ; in favor of more modern\n// / \"i-lux\" ; subtags or subtag\n// / \"i-mingo\" ; combination\n// / \"i-navajo\"\n// / \"i-pwn\"\n// / \"i-tao\"\n// / \"i-tay\"\n// / \"i-tsu\"\n// / \"sgn-BE-FR\"\n// / \"sgn-BE-NL\"\n// / \"sgn-CH-DE\"\nconst irregular = '(?:en-GB-oed'\n + '|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)'\n + '|sgn-(?:BE-FR|BE-NL|CH-DE))';\n\n// regular = \"art-lojban\" ; these tags match the 'langtag'\n// / \"cel-gaulish\" ; production, but their subtags\n// / \"no-bok\" ; are not extended language\n// / \"no-nyn\" ; or variant subtags: their meaning\n// / \"zh-guoyu\" ; is defined by their registration\n// / \"zh-hakka\" ; and all of these are deprecated\n// / \"zh-min\" ; in favor of a more modern\n// / \"zh-min-nan\" ; subtag or sequence of subtags\n// / \"zh-xiang\"\nconst regular = '(?:art-lojban|cel-gaulish|no-bok|no-nyn'\n + '|zh-(?:guoyu|hakka|min|min-nan|xiang))';\n\n// grandfathered = irregular ; non-redundant tags registered\n// / regular ; during the RFC 3066 era\nconst grandfathered = '(?:' + irregular + '|' + regular + ')';\n\n// langtag = language\n// [\"-\" script]\n// [\"-\" region]\n// *(\"-\" variant)\n// *(\"-\" extension)\n// [\"-\" privateuse]\nconst langtag = language + '(?:-' + script + ')?(?:-' + region + ')?(?:-'\n + variant + ')*(?:-' + extension + ')*(?:-' + privateuse + ')?';\n\n// Language-Tag = langtag ; normal language tags\n// / privateuse ; private use tag\n// / grandfathered ; grandfathered tags\nexport let expBCP47Syntax = RegExp('^(?:'+langtag+'|'+privateuse+'|'+grandfathered+')$', 'i');\n\n// Match duplicate variants in a language tag\nexport let expVariantDupes = RegExp('^(?!x).*?-('+variant+')-(?:\\\\w{4,8}-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match duplicate singletons in a language tag (except in private use)\nexport let expSingletonDupes = RegExp('^(?!x).*?-('+singleton+')-(?:\\\\w+-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match all extension sequences\nexport let expExtSequences = RegExp('-'+extension, 'ig');\n","// Sect 6.2 Language Tags\n// ======================\n\nimport {\n expBCP47Syntax,\n expExtSequences,\n expVariantDupes,\n expSingletonDupes\n} from './exp';\n\nimport {\n hop,\n arrJoin,\n arrSlice\n} from \"./util.js\";\n\n// Default locale is the first-added locale data for us\nexport let defaultLocale;\nexport function setDefaultLocale(locale) {\n defaultLocale = locale;\n}\n\n// IANA Subtag Registry redundant tag and subtag maps\nconst redundantTags = {\n tags: {\n \"art-lojban\": \"jbo\",\n \"i-ami\": \"ami\",\n \"i-bnn\": \"bnn\",\n \"i-hak\": \"hak\",\n \"i-klingon\": \"tlh\",\n \"i-lux\": \"lb\",\n \"i-navajo\": \"nv\",\n \"i-pwn\": \"pwn\",\n \"i-tao\": \"tao\",\n \"i-tay\": \"tay\",\n \"i-tsu\": \"tsu\",\n \"no-bok\": \"nb\",\n \"no-nyn\": \"nn\",\n \"sgn-BE-FR\": \"sfb\",\n \"sgn-BE-NL\": \"vgt\",\n \"sgn-CH-DE\": \"sgg\",\n \"zh-guoyu\": \"cmn\",\n \"zh-hakka\": \"hak\",\n \"zh-min-nan\": \"nan\",\n \"zh-xiang\": \"hsn\",\n \"sgn-BR\": \"bzs\",\n \"sgn-CO\": \"csn\",\n \"sgn-DE\": \"gsg\",\n \"sgn-DK\": \"dsl\",\n \"sgn-ES\": \"ssp\",\n \"sgn-FR\": \"fsl\",\n \"sgn-GB\": \"bfi\",\n \"sgn-GR\": \"gss\",\n \"sgn-IE\": \"isg\",\n \"sgn-IT\": \"ise\",\n \"sgn-JP\": \"jsl\",\n \"sgn-MX\": \"mfs\",\n \"sgn-NI\": \"ncs\",\n \"sgn-NL\": \"dse\",\n \"sgn-NO\": \"nsl\",\n \"sgn-PT\": \"psr\",\n \"sgn-SE\": \"swl\",\n \"sgn-US\": \"ase\",\n \"sgn-ZA\": \"sfs\",\n \"zh-cmn\": \"cmn\",\n \"zh-cmn-Hans\": \"cmn-Hans\",\n \"zh-cmn-Hant\": \"cmn-Hant\",\n \"zh-gan\": \"gan\",\n \"zh-wuu\": \"wuu\",\n \"zh-yue\": \"yue\"\n },\n subtags: {\n BU: \"MM\",\n DD: \"DE\",\n FX: \"FR\",\n TP: \"TL\",\n YD: \"YE\",\n ZR: \"CD\",\n heploc: \"alalc97\",\n 'in': \"id\",\n iw: \"he\",\n ji: \"yi\",\n jw: \"jv\",\n mo: \"ro\",\n ayx: \"nun\",\n bjd: \"drl\",\n ccq: \"rki\",\n cjr: \"mom\",\n cka: \"cmr\",\n cmk: \"xch\",\n drh: \"khk\",\n drw: \"prs\",\n gav: \"dev\",\n hrr: \"jal\",\n ibi: \"opa\",\n kgh: \"kml\",\n lcq: \"ppr\",\n mst: \"mry\",\n myt: \"mry\",\n sca: \"hle\",\n tie: \"ras\",\n tkk: \"twm\",\n tlw: \"weo\",\n tnf: \"prs\",\n ybd: \"rki\",\n yma: \"lrr\"\n },\n extLang: {\n aao: [\"aao\", \"ar\"],\n abh: [\"abh\", \"ar\"],\n abv: [\"abv\", \"ar\"],\n acm: [\"acm\", \"ar\"],\n acq: [\"acq\", \"ar\"],\n acw: [\"acw\", \"ar\"],\n acx: [\"acx\", \"ar\"],\n acy: [\"acy\", \"ar\"],\n adf: [\"adf\", \"ar\"],\n ads: [\"ads\", \"sgn\"],\n aeb: [\"aeb\", \"ar\"],\n aec: [\"aec\", \"ar\"],\n aed: [\"aed\", \"sgn\"],\n aen: [\"aen\", \"sgn\"],\n afb: [\"afb\", \"ar\"],\n afg: [\"afg\", \"sgn\"],\n ajp: [\"ajp\", \"ar\"],\n apc: [\"apc\", \"ar\"],\n apd: [\"apd\", \"ar\"],\n arb: [\"arb\", \"ar\"],\n arq: [\"arq\", \"ar\"],\n ars: [\"ars\", \"ar\"],\n ary: [\"ary\", \"ar\"],\n arz: [\"arz\", \"ar\"],\n ase: [\"ase\", \"sgn\"],\n asf: [\"asf\", \"sgn\"],\n asp: [\"asp\", \"sgn\"],\n asq: [\"asq\", \"sgn\"],\n asw: [\"asw\", \"sgn\"],\n auz: [\"auz\", \"ar\"],\n avl: [\"avl\", \"ar\"],\n ayh: [\"ayh\", \"ar\"],\n ayl: [\"ayl\", \"ar\"],\n ayn: [\"ayn\", \"ar\"],\n ayp: [\"ayp\", \"ar\"],\n bbz: [\"bbz\", \"ar\"],\n bfi: [\"bfi\", \"sgn\"],\n bfk: [\"bfk\", \"sgn\"],\n bjn: [\"bjn\", \"ms\"],\n bog: [\"bog\", \"sgn\"],\n bqn: [\"bqn\", \"sgn\"],\n bqy: [\"bqy\", \"sgn\"],\n btj: [\"btj\", \"ms\"],\n bve: [\"bve\", \"ms\"],\n bvl: [\"bvl\", \"sgn\"],\n bvu: [\"bvu\", \"ms\"],\n bzs: [\"bzs\", \"sgn\"],\n cdo: [\"cdo\", \"zh\"],\n cds: [\"cds\", \"sgn\"],\n cjy: [\"cjy\", \"zh\"],\n cmn: [\"cmn\", \"zh\"],\n coa: [\"coa\", \"ms\"],\n cpx: [\"cpx\", \"zh\"],\n csc: [\"csc\", \"sgn\"],\n csd: [\"csd\", \"sgn\"],\n cse: [\"cse\", \"sgn\"],\n csf: [\"csf\", \"sgn\"],\n csg: [\"csg\", \"sgn\"],\n csl: [\"csl\", \"sgn\"],\n csn: [\"csn\", \"sgn\"],\n csq: [\"csq\", \"sgn\"],\n csr: [\"csr\", \"sgn\"],\n czh: [\"czh\", \"zh\"],\n czo: [\"czo\", \"zh\"],\n doq: [\"doq\", \"sgn\"],\n dse: [\"dse\", \"sgn\"],\n dsl: [\"dsl\", \"sgn\"],\n dup: [\"dup\", \"ms\"],\n ecs: [\"ecs\", \"sgn\"],\n esl: [\"esl\", \"sgn\"],\n esn: [\"esn\", \"sgn\"],\n eso: [\"eso\", \"sgn\"],\n eth: [\"eth\", \"sgn\"],\n fcs: [\"fcs\", \"sgn\"],\n fse: [\"fse\", \"sgn\"],\n fsl: [\"fsl\", \"sgn\"],\n fss: [\"fss\", \"sgn\"],\n gan: [\"gan\", \"zh\"],\n gds: [\"gds\", \"sgn\"],\n gom: [\"gom\", \"kok\"],\n gse: [\"gse\", \"sgn\"],\n gsg: [\"gsg\", \"sgn\"],\n gsm: [\"gsm\", \"sgn\"],\n gss: [\"gss\", \"sgn\"],\n gus: [\"gus\", \"sgn\"],\n hab: [\"hab\", \"sgn\"],\n haf: [\"haf\", \"sgn\"],\n hak: [\"hak\", \"zh\"],\n hds: [\"hds\", \"sgn\"],\n hji: [\"hji\", \"ms\"],\n hks: [\"hks\", \"sgn\"],\n hos: [\"hos\", \"sgn\"],\n hps: [\"hps\", \"sgn\"],\n hsh: [\"hsh\", \"sgn\"],\n hsl: [\"hsl\", \"sgn\"],\n hsn: [\"hsn\", \"zh\"],\n icl: [\"icl\", \"sgn\"],\n ils: [\"ils\", \"sgn\"],\n inl: [\"inl\", \"sgn\"],\n ins: [\"ins\", \"sgn\"],\n ise: [\"ise\", \"sgn\"],\n isg: [\"isg\", \"sgn\"],\n isr: [\"isr\", \"sgn\"],\n jak: [\"jak\", \"ms\"],\n jax: [\"jax\", \"ms\"],\n jcs: [\"jcs\", \"sgn\"],\n jhs: [\"jhs\", \"sgn\"],\n jls: [\"jls\", \"sgn\"],\n jos: [\"jos\", \"sgn\"],\n jsl: [\"jsl\", \"sgn\"],\n jus: [\"jus\", \"sgn\"],\n kgi: [\"kgi\", \"sgn\"],\n knn: [\"knn\", \"kok\"],\n kvb: [\"kvb\", \"ms\"],\n kvk: [\"kvk\", \"sgn\"],\n kvr: [\"kvr\", \"ms\"],\n kxd: [\"kxd\", \"ms\"],\n lbs: [\"lbs\", \"sgn\"],\n lce: [\"lce\", \"ms\"],\n lcf: [\"lcf\", \"ms\"],\n liw: [\"liw\", \"ms\"],\n lls: [\"lls\", \"sgn\"],\n lsg: [\"lsg\", \"sgn\"],\n lsl: [\"lsl\", \"sgn\"],\n lso: [\"lso\", \"sgn\"],\n lsp: [\"lsp\", \"sgn\"],\n lst: [\"lst\", \"sgn\"],\n lsy: [\"lsy\", \"sgn\"],\n ltg: [\"ltg\", \"lv\"],\n lvs: [\"lvs\", \"lv\"],\n lzh: [\"lzh\", \"zh\"],\n max: [\"max\", \"ms\"],\n mdl: [\"mdl\", \"sgn\"],\n meo: [\"meo\", \"ms\"],\n mfa: [\"mfa\", \"ms\"],\n mfb: [\"mfb\", \"ms\"],\n mfs: [\"mfs\", \"sgn\"],\n min: [\"min\", \"ms\"],\n mnp: [\"mnp\", \"zh\"],\n mqg: [\"mqg\", \"ms\"],\n mre: [\"mre\", \"sgn\"],\n msd: [\"msd\", \"sgn\"],\n msi: [\"msi\", \"ms\"],\n msr: [\"msr\", \"sgn\"],\n mui: [\"mui\", \"ms\"],\n mzc: [\"mzc\", \"sgn\"],\n mzg: [\"mzg\", \"sgn\"],\n mzy: [\"mzy\", \"sgn\"],\n nan: [\"nan\", \"zh\"],\n nbs: [\"nbs\", \"sgn\"],\n ncs: [\"ncs\", \"sgn\"],\n nsi: [\"nsi\", \"sgn\"],\n nsl: [\"nsl\", \"sgn\"],\n nsp: [\"nsp\", \"sgn\"],\n nsr: [\"nsr\", \"sgn\"],\n nzs: [\"nzs\", \"sgn\"],\n okl: [\"okl\", \"sgn\"],\n orn: [\"orn\", \"ms\"],\n ors: [\"ors\", \"ms\"],\n pel: [\"pel\", \"ms\"],\n pga: [\"pga\", \"ar\"],\n pks: [\"pks\", \"sgn\"],\n prl: [\"prl\", \"sgn\"],\n prz: [\"prz\", \"sgn\"],\n psc: [\"psc\", \"sgn\"],\n psd: [\"psd\", \"sgn\"],\n pse: [\"pse\", \"ms\"],\n psg: [\"psg\", \"sgn\"],\n psl: [\"psl\", \"sgn\"],\n pso: [\"pso\", \"sgn\"],\n psp: [\"psp\", \"sgn\"],\n psr: [\"psr\", \"sgn\"],\n pys: [\"pys\", \"sgn\"],\n rms: [\"rms\", \"sgn\"],\n rsi: [\"rsi\", \"sgn\"],\n rsl: [\"rsl\", \"sgn\"],\n sdl: [\"sdl\", \"sgn\"],\n sfb: [\"sfb\", \"sgn\"],\n sfs: [\"sfs\", \"sgn\"],\n sgg: [\"sgg\", \"sgn\"],\n sgx: [\"sgx\", \"sgn\"],\n shu: [\"shu\", \"ar\"],\n slf: [\"slf\", \"sgn\"],\n sls: [\"sls\", \"sgn\"],\n sqk: [\"sqk\", \"sgn\"],\n sqs: [\"sqs\", \"sgn\"],\n ssh: [\"ssh\", \"ar\"],\n ssp: [\"ssp\", \"sgn\"],\n ssr: [\"ssr\", \"sgn\"],\n svk: [\"svk\", \"sgn\"],\n swc: [\"swc\", \"sw\"],\n swh: [\"swh\", \"sw\"],\n swl: [\"swl\", \"sgn\"],\n syy: [\"syy\", \"sgn\"],\n tmw: [\"tmw\", \"ms\"],\n tse: [\"tse\", \"sgn\"],\n tsm: [\"tsm\", \"sgn\"],\n tsq: [\"tsq\", \"sgn\"],\n tss: [\"tss\", \"sgn\"],\n tsy: [\"tsy\", \"sgn\"],\n tza: [\"tza\", \"sgn\"],\n ugn: [\"ugn\", \"sgn\"],\n ugy: [\"ugy\", \"sgn\"],\n ukl: [\"ukl\", \"sgn\"],\n uks: [\"uks\", \"sgn\"],\n urk: [\"urk\", \"ms\"],\n uzn: [\"uzn\", \"uz\"],\n uzs: [\"uzs\", \"uz\"],\n vgt: [\"vgt\", \"sgn\"],\n vkk: [\"vkk\", \"ms\"],\n vkt: [\"vkt\", \"ms\"],\n vsi: [\"vsi\", \"sgn\"],\n vsl: [\"vsl\", \"sgn\"],\n vsv: [\"vsv\", \"sgn\"],\n wuu: [\"wuu\", \"zh\"],\n xki: [\"xki\", \"sgn\"],\n xml: [\"xml\", \"sgn\"],\n xmm: [\"xmm\", \"ms\"],\n xms: [\"xms\", \"sgn\"],\n yds: [\"yds\", \"sgn\"],\n ysl: [\"ysl\", \"sgn\"],\n yue: [\"yue\", \"zh\"],\n zib: [\"zib\", \"sgn\"],\n zlm: [\"zlm\", \"ms\"],\n zmi: [\"zmi\", \"ms\"],\n zsl: [\"zsl\", \"sgn\"],\n zsm: [\"zsm\", \"ms\"]\n }\n};\n\n/**\n * Convert only a-z to uppercase as per section 6.1 of the spec\n */\nexport function toLatinUpperCase (str) {\n let i = str.length;\n\n while (i--) {\n let ch = str.charAt(i);\n\n if (ch >= \"a\" && ch <= \"z\")\n str = str.slice(0, i) + ch.toUpperCase() + str.slice(i+1);\n }\n\n return str;\n}\n\n/**\n * The IsStructurallyValidLanguageTag abstract operation verifies that the locale\n * argument (which must be a String value)\n *\n * - represents a well-formed BCP 47 language tag as specified in RFC 5646 section\n * 2.1, or successor,\n * - does not include duplicate variant subtags, and\n * - does not include duplicate singleton subtags.\n *\n * The abstract operation returns true if locale can be generated from the ABNF\n * grammar in section 2.1 of the RFC, starting with Language-Tag, and does not\n * contain duplicate variant or singleton subtags (other than as a private use\n * subtag). It returns false otherwise. Terminal value characters in the grammar are\n * interpreted as the Unicode equivalents of the ASCII octet values given.\n */\nexport function /* 6.2.2 */IsStructurallyValidLanguageTag(locale) {\n // represents a well-formed BCP 47 language tag as specified in RFC 5646\n if (!expBCP47Syntax.test(locale))\n return false;\n\n // does not include duplicate variant subtags, and\n if (expVariantDupes.test(locale))\n return false;\n\n // does not include duplicate singleton subtags.\n if (expSingletonDupes.test(locale))\n return false;\n\n return true;\n}\n\n/**\n * The CanonicalizeLanguageTag abstract operation returns the canonical and case-\n * regularized form of the locale argument (which must be a String value that is\n * a structurally valid BCP 47 language tag as verified by the\n * IsStructurallyValidLanguageTag abstract operation). It takes the steps\n * specified in RFC 5646 section 4.5, or successor, to bring the language tag\n * into canonical form, and to regularize the case of the subtags, but does not\n * take the steps to bring a language tag into “extlang form” and to reorder\n * variant subtags.\n\n * The specifications for extensions to BCP 47 language tags, such as RFC 6067,\n * may include canonicalization rules for the extension subtag sequences they\n * define that go beyond the canonicalization rules of RFC 5646 section 4.5.\n * Implementations are allowed, but not required, to apply these additional rules.\n */\nexport function /* 6.2.3 */CanonicalizeLanguageTag (locale) {\n let match, parts;\n\n // A language tag is in 'canonical form' when the tag is well-formed\n // according to the rules in Sections 2.1 and 2.2\n\n // Section 2.1 says all subtags use lowercase...\n locale = locale.toLowerCase();\n\n // ...with 2 exceptions: 'two-letter and four-letter subtags that neither\n // appear at the start of the tag nor occur after singletons. Such two-letter\n // subtags are all uppercase (as in the tags \"en-CA-x-ca\" or \"sgn-BE-FR\") and\n // four-letter subtags are titlecase (as in the tag \"az-Latn-x-latn\").\n parts = locale.split('-');\n for (let i = 1, max = parts.length; i < max; i++) {\n // Two-letter subtags are all uppercase\n if (parts[i].length === 2)\n parts[i] = parts[i].toUpperCase();\n\n // Four-letter subtags are titlecase\n else if (parts[i].length === 4)\n parts[i] = parts[i].charAt(0).toUpperCase() + parts[i].slice(1);\n\n // Is it a singleton?\n else if (parts[i].length === 1 && parts[i] !== 'x')\n break;\n }\n locale = arrJoin.call(parts, '-');\n\n // The steps laid out in RFC 5646 section 4.5 are as follows:\n\n // 1. Extension sequences are ordered into case-insensitive ASCII order\n // by singleton subtag.\n if ((match = locale.match(expExtSequences)) && match.length > 1) {\n // The built-in sort() sorts by ASCII order, so use that\n match.sort();\n\n // Replace all extensions with the joined, sorted array\n locale = locale.replace(\n RegExp('(?:' + expExtSequences.source + ')+', 'i'),\n arrJoin.call(match, '')\n );\n }\n\n // 2. Redundant or grandfathered tags are replaced by their 'Preferred-\n // Value', if there is one.\n if (hop.call(redundantTags.tags, locale))\n locale = redundantTags.tags[locale];\n\n // 3. Subtags are replaced by their 'Preferred-Value', if there is one.\n // For extlangs, the original primary language subtag is also\n // replaced if there is a primary language subtag in the 'Preferred-\n // Value'.\n parts = locale.split('-');\n\n for (let i = 1, max = parts.length; i < max; i++) {\n if (hop.call(redundantTags.subtags, parts[i]))\n parts[i] = redundantTags.subtags[parts[i]];\n\n else if (hop.call(redundantTags.extLang, parts[i])) {\n parts[i] = redundantTags.extLang[parts[i]][0];\n\n // For extlang tags, the prefix needs to be removed if it is redundant\n if (i === 1 && redundantTags.extLang[parts[1]][1] === parts[0]) {\n parts = arrSlice.call(parts, i++);\n max -= 1;\n }\n }\n }\n\n return arrJoin.call(parts, '-');\n}\n\n/**\n * The DefaultLocale abstract operation returns a String value representing the\n * structurally valid (6.2.2) and canonicalized (6.2.3) BCP 47 language tag for the\n * host environment’s current locale.\n */\nexport function /* 6.2.4 */DefaultLocale () {\n return defaultLocale;\n}\n\n// Sect 6.3 Currency Codes\n// =======================\n\nconst expCurrencyCode = /^[A-Z]{3}$/;\n\n/**\n * The IsWellFormedCurrencyCode abstract operation verifies that the currency argument\n * (after conversion to a String value) represents a well-formed 3-letter ISO currency\n * code. The following steps are taken:\n */\nexport function /* 6.3.1 */IsWellFormedCurrencyCode(currency) {\n // 1. Let `c` be ToString(currency)\n let c = String(currency);\n\n // 2. Let `normalized` be the result of mapping c to upper case as described\n // in 6.1.\n let normalized = toLatinUpperCase(c);\n\n // 3. If the string length of normalized is not 3, return false.\n // 4. If normalized contains any character that is not in the range \"A\" to \"Z\"\n // (U+0041 to U+005A), return false.\n if (expCurrencyCode.test(normalized) === false)\n return false;\n\n // 5. Return true\n return true;\n}\n","// Sect 9.2 Abstract Operations\n// ============================\n\nimport {\n List,\n toObject,\n toLength,\n arrIndexOf,\n arrPush,\n arrSlice,\n Record,\n hop,\n defineProperty\n} from \"./util.js\";\n\nimport {\n IsStructurallyValidLanguageTag,\n CanonicalizeLanguageTag,\n DefaultLocale\n} from \"./6.locales-currencies-tz.js\";\n\nconst expUnicodeExSeq = /-u(?:-[0-9a-z]{2,8})+/gi; // See `extension` below\n\nexport function /* 9.2.1 */CanonicalizeLocaleList (locales) {\n// The abstract operation CanonicalizeLocaleList takes the following steps:\n\n // 1. If locales is undefined, then a. Return a new empty List\n if (locales === undefined)\n return new List();\n\n // 2. Let seen be a new empty List.\n let seen = new List();\n\n // 3. If locales is a String value, then\n // a. Let locales be a new array created as if by the expression new\n // Array(locales) where Array is the standard built-in constructor with\n // that name and locales is the value of locales.\n locales = typeof locales === 'string' ? [ locales ] : locales;\n\n // 4. Let O be ToObject(locales).\n let O = toObject(locales);\n\n // 5. Let lenValue be the result of calling the [[Get]] internal method of\n // O with the argument \"length\".\n // 6. Let len be ToUint32(lenValue).\n let len = toLength(O.length);\n\n // 7. Let k be 0.\n let k = 0;\n\n // 8. Repeat, while k < len\n while (k < len) {\n // a. Let Pk be ToString(k).\n let Pk = String(k);\n\n // b. Let kPresent be the result of calling the [[HasProperty]] internal\n // method of O with argument Pk.\n let kPresent = Pk in O;\n\n // c. If kPresent is true, then\n if (kPresent) {\n // i. Let kValue be the result of calling the [[Get]] internal\n // method of O with argument Pk.\n let kValue = O[Pk];\n\n // ii. If the type of kValue is not String or Object, then throw a\n // TypeError exception.\n if (kValue === null || (typeof kValue !== 'string' && typeof kValue !== 'object'))\n throw new TypeError('String or Object type expected');\n\n // iii. Let tag be ToString(kValue).\n let tag = String(kValue);\n\n // iv. If the result of calling the abstract operation\n // IsStructurallyValidLanguageTag (defined in 6.2.2), passing tag as\n // the argument, is false, then throw a RangeError exception.\n if (!IsStructurallyValidLanguageTag(tag))\n throw new RangeError(\"'\" + tag + \"' is not a structurally valid language tag\");\n\n // v. Let tag be the result of calling the abstract operation\n // CanonicalizeLanguageTag (defined in 6.2.3), passing tag as the\n // argument.\n tag = CanonicalizeLanguageTag(tag);\n\n // vi. If tag is not an element of seen, then append tag as the last\n // element of seen.\n if (arrIndexOf.call(seen, tag) === -1)\n arrPush.call(seen, tag);\n }\n\n // d. Increase k by 1.\n k++;\n }\n\n // 9. Return seen.\n return seen;\n}\n\n/**\n * The BestAvailableLocale abstract operation compares the provided argument\n * locale, which must be a String value with a structurally valid and\n * canonicalized BCP 47 language tag, against the locales in availableLocales and\n * returns either the longest non-empty prefix of locale that is an element of\n * availableLocales, or undefined if there is no such element. It uses the\n * fallback mechanism of RFC 4647, section 3.4. The following steps are taken:\n */\nexport function /* 9.2.2 */BestAvailableLocale (availableLocales, locale) {\n // 1. Let candidate be locale\n let candidate = locale;\n\n // 2. Repeat\n while (candidate) {\n // a. If availableLocales contains an element equal to candidate, then return\n // candidate.\n if (arrIndexOf.call(availableLocales, candidate) > -1)\n return candidate;\n\n // b. Let pos be the character index of the last occurrence of \"-\"\n // (U+002D) within candidate. If that character does not occur, return\n // undefined.\n let pos = candidate.lastIndexOf('-');\n\n if (pos < 0)\n return;\n\n // c. If pos ≥ 2 and the character \"-\" occurs at index pos-2 of candidate,\n // then decrease pos by 2.\n if (pos >= 2 && candidate.charAt(pos - 2) === '-')\n pos -= 2;\n\n // d. Let candidate be the substring of candidate from position 0, inclusive,\n // to position pos, exclusive.\n candidate = candidate.substring(0, pos);\n }\n}\n\n/**\n * The LookupMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The following steps are taken:\n */\nexport function /* 9.2.3 */LookupMatcher (availableLocales, requestedLocales) {\n // 1. Let i be 0.\n let i = 0;\n\n // 2. Let len be the number of elements in requestedLocales.\n let len = requestedLocales.length;\n\n // 3. Let availableLocale be undefined.\n let availableLocale;\n\n let locale, noExtensionsLocale;\n\n // 4. Repeat while i < len and availableLocale is undefined:\n while (i < len && !availableLocale) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position i.\n locale = requestedLocales[i];\n\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. Increase i by 1.\n i++;\n }\n\n // 5. Let result be a new Record.\n let result = new Record();\n\n // 6. If availableLocale is not undefined, then\n if (availableLocale !== undefined) {\n // a. Set result.[[locale]] to availableLocale.\n result['[[locale]]'] = availableLocale;\n\n // b. If locale and noExtensionsLocale are not the same String value, then\n if (String(locale) !== String(noExtensionsLocale)) {\n // i. Let extension be the String value consisting of the first\n // substring of locale that is a Unicode locale extension sequence.\n let extension = locale.match(expUnicodeExSeq)[0];\n\n // ii. Let extensionIndex be the character position of the initial\n // \"-\" of the first Unicode locale extension sequence within locale.\n let extensionIndex = locale.indexOf('-u-');\n\n // iii. Set result.[[extension]] to extension.\n result['[[extension]]'] = extension;\n\n // iv. Set result.[[extensionIndex]] to extensionIndex.\n result['[[extensionIndex]]'] = extensionIndex;\n }\n }\n // 7. Else\n else\n // a. Set result.[[locale]] to the value returned by the DefaultLocale abstract\n // operation (defined in 6.2.4).\n result['[[locale]]'] = DefaultLocale();\n\n // 8. Return result\n return result;\n}\n\n/**\n * The BestFitMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The algorithm is implementation dependent, but should produce results\n * that a typical user of the requested locales would perceive as at least as\n * good as those produced by the LookupMatcher abstract operation. Options\n * specified through Unicode locale extension sequences must be ignored by the\n * algorithm. Information about such subsequences is returned separately.\n * The abstract operation returns a record with a [[locale]] field, whose value\n * is the language tag of the selected locale, which must be an element of\n * availableLocales. If the language tag of the request locale that led to the\n * selected locale contained a Unicode locale extension sequence, then the\n * returned record also contains an [[extension]] field whose value is the first\n * Unicode locale extension sequence, and an [[extensionIndex]] field whose value\n * is the index of the first Unicode locale extension sequence within the request\n * locale language tag.\n */\nexport function /* 9.2.4 */BestFitMatcher (availableLocales, requestedLocales) {\n return LookupMatcher(availableLocales, requestedLocales);\n}\n\n// @spec[tc39/ecma402/master/spec/negotiation.html]\n// @clause[sec-unicodeextensionsubtags]\nexport function UnicodeExtensionSubtags(extension) {\n // 1. Let size be the number of elements in extension.\n let size = extension.length;\n // 2. If size = 0, then\n if (size === 0) {\n // a. Return « ».\n return [];\n }\n // 3. Let extensionSubtags be « ».\n let extensionSubtags = [];\n // 4. Let attribute be true.\n let attribute = true;\n // 5. Let q be 3.\n let q = 3;\n // 6. Let p be q.\n let p = q;\n // 7. Let t be q.\n let t = q;\n // 8. Repeat, while q < size\n while (q < size) {\n // a. Let c be the code unit value of the element at index q in the String extension.\n let c = extension.codePointAt(q);\n // a. If c is 0x002D (HYPHEN-MINUS), then\n if (c === 0x002D) {\n // i. If q - p = 2, then\n if (q - p === 2) {\n // 1. If p - t > 1, then\n if (p - t > 1) {\n // a. Let type be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through p - 1 (exclusive).\n let type = extension.substring(t, p - 1);\n // a. Append type as the last element of extensionSubtags.\n extensionSubtags.push(type);\n }\n // 2. Let key be a String value equal to the substring of extension consisting of the code units at indices p (inclusive) through q (exclusive).\n let key = extension.substring(p, q);\n // 3. Append key as the last element of extensionSubtags.\n extensionSubtags.push(key);\n // 4. Let t be q + 1.\n t = q + 1;\n // 5. Let attribute be false.\n attribute = false;\n // ii. Else if attribute is true, then\n } else if (attribute === true) {\n // 1. Let attr be a String value equal to the substring of extension consisting of the code units at indices p (inclusive) through q (exclusive).\n let attr = extension.substring(p, q);\n // 2. Append attr as the last element of extensionSubtags.\n extensionSubtags.push(attr);\n // 3. Let t be q + 1.\n t = q + 1;\n }\n // iii. Let p be q + 1.\n p = q + 1;\n }\n // a. Let q be q + 1.\n q = q + 1;\n }\n // 9. If size - p = 2, then\n if (size - p === 2) {\n // a. If p - t > 1, then\n if (p - t > 1) {\n // i. Let type be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through p - 1 (exclusive).\n let type = extension.substring(t, p - 1);\n // ii. Append type as the last element of extensionSubtags.\n extensionSubtags.push(type);\n }\n // a. Let t be p.\n t = p;\n }\n // 10. Let tail be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through size (exclusive).\n let tail = extension.substring(t, size);\n // 11. Append tail as the last element of extensionSubtags.\n extensionSubtags.push(tail);\n // 12. Return extensionSubtags.\n return extensionSubtags;\n}\n\n/**\n * The ResolveLocale abstract operation compares a BCP 47 language priority list\n * requestedLocales against the locales in availableLocales and determines the\n * best available language to meet the request. availableLocales and\n * requestedLocales must be provided as List values, options as a Record.\n */\nexport function /* 9.2.5 */ResolveLocale (availableLocales, requestedLocales, options, relevantExtensionKeys, localeData) {\n if (availableLocales.length === 0) {\n throw new ReferenceError('No locale data has been provided for this object yet.');\n }\n\n // The following steps are taken:\n // 1. Let matcher be the value of options.[[localeMatcher]].\n let matcher = options['[[localeMatcher]]'];\n\n let r;\n\n // 2. If matcher is \"lookup\", then\n if (matcher === 'lookup')\n // a. Let r be the result of calling the LookupMatcher abstract operation\n // (defined in 9.2.3) with arguments availableLocales and\n // requestedLocales.\n r = LookupMatcher(availableLocales, requestedLocales);\n\n // 3. Else\n else\n // a. Let r be the result of calling the BestFitMatcher abstract\n // operation (defined in 9.2.4) with arguments availableLocales and\n // requestedLocales.\n r = BestFitMatcher(availableLocales, requestedLocales);\n\n // 4. Let foundLocale be the value of r.[[locale]].\n let foundLocale = r['[[locale]]'];\n\n let extensionSubtags, extensionSubtagsLength;\n\n // 5. If r has an [[extension]] field, then\n if (hop.call(r, '[[extension]]')) {\n // a. Let extension be the value of r.[[extension]].\n let extension = r['[[extension]]'];\n // b. Let _extensionSubtags_ be\n // CreateArrayFromList(UnicodeExtensionSubtags(_extension_)).\n extensionSubtags = UnicodeExtensionSubtags(extension);\n // c. Let _extensionSubtagsLength_ be Get(_extensionSubtags_, *\"length\"*)\n extensionSubtagsLength = extensionSubtags.length;\n }\n\n // 6. Let result be a new Record.\n let result = new Record();\n\n // 7. Set result.[[dataLocale]] to foundLocale.\n result['[[dataLocale]]'] = foundLocale;\n\n // 8. Let supportedExtension be \"-u\".\n let supportedExtension = '-u';\n // 9. Let i be 0.\n let i = 0;\n // 10. Let len be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument \"length\".\n let len = relevantExtensionKeys.length;\n\n // 11 Repeat while i < len:\n while (i < len) {\n // a. Let key be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument ToString(i).\n let key = relevantExtensionKeys[i];\n // b. Let foundLocaleData be the result of calling the [[Get]] internal\n // method of localeData with the argument foundLocale.\n let foundLocaleData = localeData[foundLocale];\n // c. Let keyLocaleData be the result of calling the [[Get]] internal\n // method of foundLocaleData with the argument key.\n let keyLocaleData = foundLocaleData[key];\n // d. Let value be the result of calling the [[Get]] internal method of\n // keyLocaleData with argument \"0\".\n let value = keyLocaleData['0'];\n // e. Let supportedExtensionAddition be \"\".\n let supportedExtensionAddition = '';\n // f. Let indexOf be the standard built-in function object defined in\n // ES5, 15.4.4.14.\n let indexOf = arrIndexOf;\n\n // g. If extensionSubtags is not undefined, then\n if (extensionSubtags !== undefined) {\n // i. Let keyPos be the result of calling the [[Call]] internal\n // method of indexOf with extensionSubtags as the this value and\n // an argument list containing the single item key.\n let keyPos = indexOf.call(extensionSubtags, key);\n\n // ii. If keyPos ≠ -1, then\n if (keyPos !== -1) {\n // 1. If keyPos + 1 < extensionSubtagsLength and the length of the\n // result of calling the [[Get]] internal method of\n // extensionSubtags with argument ToString(keyPos +1) is greater\n // than 2, then\n if (keyPos + 1 < extensionSubtagsLength\n && extensionSubtags[keyPos + 1].length > 2) {\n // a. Let requestedValue be the result of calling the [[Get]]\n // internal method of extensionSubtags with argument\n // ToString(keyPos + 1).\n let requestedValue = extensionSubtags[keyPos + 1];\n // b. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the\n // this value and an argument list containing the single\n // item requestedValue.\n let valuePos = indexOf.call(keyLocaleData, requestedValue);\n\n // c. If valuePos ≠ -1, then\n if (valuePos !== -1) {\n // i. Let value be requestedValue.\n value = requestedValue,\n // ii. Let supportedExtensionAddition be the\n // concatenation of \"-\", key, \"-\", and value.\n supportedExtensionAddition = '-' + key + '-' + value;\n }\n }\n // 2. Else\n else {\n // a. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the this\n // value and an argument list containing the single item\n // \"true\".\n let valuePos = indexOf(keyLocaleData, 'true');\n\n // b. If valuePos ≠ -1, then\n if (valuePos !== -1)\n // i. Let value be \"true\".\n value = 'true';\n }\n }\n }\n // h. If options has a field [[]], then\n if (hop.call(options, '[[' + key + ']]')) {\n // i. Let optionsValue be the value of options.[[]].\n let optionsValue = options['[[' + key + ']]'];\n\n // ii. If the result of calling the [[Call]] internal method of indexOf\n // with keyLocaleData as the this value and an argument list\n // containing the single item optionsValue is not -1, then\n if (indexOf.call(keyLocaleData, optionsValue) !== -1) {\n // 1. If optionsValue is not equal to value, then\n if (optionsValue !== value) {\n // a. Let value be optionsValue.\n value = optionsValue;\n // b. Let supportedExtensionAddition be \"\".\n supportedExtensionAddition = '';\n }\n }\n }\n // i. Set result.[[]] to value.\n result['[[' + key + ']]'] = value;\n\n // j. Append supportedExtensionAddition to supportedExtension.\n supportedExtension += supportedExtensionAddition;\n\n // k. Increase i by 1.\n i++;\n }\n // 12. If the length of supportedExtension is greater than 2, then\n if (supportedExtension.length > 2) {\n // a.\n let privateIndex = foundLocale.indexOf(\"-x-\");\n // b.\n if (privateIndex === -1) {\n // i.\n foundLocale = foundLocale + supportedExtension;\n }\n // c.\n else {\n // i.\n let preExtension = foundLocale.substring(0, privateIndex);\n // ii.\n let postExtension = foundLocale.substring(privateIndex);\n // iii.\n foundLocale = preExtension + supportedExtension + postExtension;\n }\n // d. asserting - skipping\n // e.\n foundLocale = CanonicalizeLanguageTag(foundLocale);\n }\n // 13. Set result.[[locale]] to foundLocale.\n result['[[locale]]'] = foundLocale;\n\n // 14. Return result.\n return result;\n}\n\n/**\n * The LookupSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the BCP 47 Lookup algorithm.\n * Locales appear in the same order in the returned list as in requestedLocales.\n * The following steps are taken:\n */\nexport function /* 9.2.6 */LookupSupportedLocales (availableLocales, requestedLocales) {\n // 1. Let len be the number of elements in requestedLocales.\n let len = requestedLocales.length;\n // 2. Let subset be a new empty List.\n let subset = new List();\n // 3. Let k be 0.\n let k = 0;\n\n // 4. Repeat while k < len\n while (k < len) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position k.\n let locale = requestedLocales[k];\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n let noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n let availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. If availableLocale is not undefined, then append locale to the end of\n // subset.\n if (availableLocale !== undefined)\n arrPush.call(subset, locale);\n\n // e. Increment k by 1.\n k++;\n }\n\n // 5. Let subsetArray be a new Array object whose elements are the same\n // values in the same order as the elements of subset.\n let subsetArray = arrSlice.call(subset);\n\n // 6. Return subsetArray.\n return subsetArray;\n}\n\n/**\n * The BestFitSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the Best Fit Matcher\n * algorithm. Locales appear in the same order in the returned list as in\n * requestedLocales. The steps taken are implementation dependent.\n */\nexport function /*9.2.7 */BestFitSupportedLocales (availableLocales, requestedLocales) {\n // ###TODO: implement this function as described by the specification###\n return LookupSupportedLocales(availableLocales, requestedLocales);\n}\n\n/**\n * The SupportedLocales abstract operation returns the subset of the provided BCP\n * 47 language priority list requestedLocales for which availableLocales has a\n * matching locale. Two algorithms are available to match the locales: the Lookup\n * algorithm described in RFC 4647 section 3.4, and an implementation dependent\n * best-fit algorithm. Locales appear in the same order in the returned list as\n * in requestedLocales. The following steps are taken:\n */\nexport function /*9.2.8 */SupportedLocales (availableLocales, requestedLocales, options) {\n let matcher, subset;\n\n // 1. If options is not undefined, then\n if (options !== undefined) {\n // a. Let options be ToObject(options).\n options = new Record(toObject(options));\n // b. Let matcher be the result of calling the [[Get]] internal method of\n // options with argument \"localeMatcher\".\n matcher = options.localeMatcher;\n\n // c. If matcher is not undefined, then\n if (matcher !== undefined) {\n // i. Let matcher be ToString(matcher).\n matcher = String(matcher);\n\n // ii. If matcher is not \"lookup\" or \"best fit\", then throw a RangeError\n // exception.\n if (matcher !== 'lookup' && matcher !== 'best fit')\n throw new RangeError('matcher should be \"lookup\" or \"best fit\"');\n }\n }\n // 2. If matcher is undefined or \"best fit\", then\n if (matcher === undefined || matcher === 'best fit')\n // a. Let subset be the result of calling the BestFitSupportedLocales\n // abstract operation (defined in 9.2.7) with arguments\n // availableLocales and requestedLocales.\n subset = BestFitSupportedLocales(availableLocales, requestedLocales);\n // 3. Else\n else\n // a. Let subset be the result of calling the LookupSupportedLocales\n // abstract operation (defined in 9.2.6) with arguments\n // availableLocales and requestedLocales.\n subset = LookupSupportedLocales(availableLocales, requestedLocales);\n\n // 4. For each named own property name P of subset,\n for (let P in subset) {\n if (!hop.call(subset, P))\n continue;\n\n // a. Let desc be the result of calling the [[GetOwnProperty]] internal\n // method of subset with P.\n // b. Set desc.[[Writable]] to false.\n // c. Set desc.[[Configurable]] to false.\n // d. Call the [[DefineOwnProperty]] internal method of subset with P, desc,\n // and true as arguments.\n defineProperty(subset, P, {\n writable: false, configurable: false, value: subset[P]\n });\n }\n // \"Freeze\" the array so no new elements can be added\n defineProperty(subset, 'length', { writable: false });\n\n // 5. Return subset\n return subset;\n}\n\n/**\n * The GetOption abstract operation extracts the value of the property named\n * property from the provided options object, converts it to the required type,\n * checks whether it is one of a List of allowed values, and fills in a fallback\n * value if necessary.\n */\nexport function /*9.2.9 */GetOption (options, property, type, values, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n let value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Assert: type is \"boolean\" or \"string\".\n // b. If type is \"boolean\", then let value be ToBoolean(value).\n // c. If type is \"string\", then let value be ToString(value).\n value = type === 'boolean' ? Boolean(value)\n : (type === 'string' ? String(value) : value);\n\n // d. If values is not undefined, then\n if (values !== undefined) {\n // i. If values does not contain an element equal to value, then throw a\n // RangeError exception.\n if (arrIndexOf.call(values, value) === -1)\n throw new RangeError(\"'\" + value + \"' is not an allowed value for `\" + property +'`');\n }\n\n // e. Return value.\n return value;\n }\n // Else return fallback.\n return fallback;\n}\n\n/**\n * The GetNumberOption abstract operation extracts a property value from the\n * provided options object, converts it to a Number value, checks whether it is\n * in the allowed range, and fills in a fallback value if necessary.\n */\nexport function /* 9.2.10 */GetNumberOption (options, property, minimum, maximum, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n let value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Let value be ToNumber(value).\n value = Number(value);\n\n // b. If value is NaN or less than minimum or greater than maximum, throw a\n // RangeError exception.\n if (isNaN(value) || value < minimum || value > maximum)\n throw new RangeError('Value is not a number or outside accepted range');\n\n // c. Return floor(value).\n return Math.floor(value);\n }\n // 3. Else return fallback.\n return fallback;\n}\n","import {\n CanonicalizeLocaleList\n} from \"./9.negotiation.js\";\n\n// 8 The Intl Object\nexport const Intl = {};\n\n// 8.2 Function Properties of the Intl Object\n\n// 8.2.1\n// @spec[tc39/ecma402/master/spec/intl.html]\n// @clause[sec-intl.getcanonicallocales]\nfunction getCanonicalLocales (locales) {\n // 1. Let ll be ? CanonicalizeLocaleList(locales).\n let ll = CanonicalizeLocaleList(locales);\n // 2. Return CreateArrayFromList(ll).\n {\n let result = [];\n\n let len = ll.length;\n let k = 0;\n\n while (k < len) {\n result[k] = ll[k];\n k++;\n }\n return result;\n }\n}\n\nObject.defineProperty(Intl, 'getCanonicalLocales', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: getCanonicalLocales\n});\n","// 11.1 The Intl.NumberFormat constructor\n// ======================================\n\nimport {\n IsWellFormedCurrencyCode\n} from \"./6.locales-currencies-tz.js\";\n\nimport {\n Intl\n} from \"./8.intl.js\";\n\nimport {\n CanonicalizeLocaleList,\n SupportedLocales,\n ResolveLocale,\n GetNumberOption,\n GetOption\n} from \"./9.negotiation.js\";\n\nimport {\n internals,\n log10Floor,\n List,\n toObject,\n arrPush,\n arrJoin,\n arrShift,\n Record,\n hop,\n defineProperty,\n es3,\n fnBind,\n getInternalProperties,\n createRegExpRestore,\n secret,\n objCreate\n} from \"./util.js\";\n\n// Currency minor units output from get-4217 grunt task, formatted\nconst currencyMinorUnits = {\n BHD: 3, BYR: 0, XOF: 0, BIF: 0, XAF: 0, CLF: 4, CLP: 0, KMF: 0, DJF: 0,\n XPF: 0, GNF: 0, ISK: 0, IQD: 3, JPY: 0, JOD: 3, KRW: 0, KWD: 3, LYD: 3,\n OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0\n};\n\n// Define the NumberFormat constructor internally so it cannot be tainted\nexport function NumberFormatConstructor () {\n let locales = arguments[0];\n let options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.NumberFormat(locales, options);\n }\n\n return InitializeNumberFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'NumberFormat', {\n configurable: true,\n writable: true,\n value: NumberFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(Intl.NumberFormat, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeNumberFormat accepts the arguments\n * numberFormat (which must be an object), locales, and options. It initializes\n * numberFormat as a NumberFormat object.\n */\nexport function /*11.1.1.1 */InitializeNumberFormat (numberFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n let internal = getInternalProperties(numberFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n let regexpRestore = createRegExpRestore();\n\n // 1. If numberFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true)\n throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(numberFormat, '__getInternalProperties', {\n value: function () {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret)\n return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n let requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. If options is undefined, then\n if (options === undefined)\n // a. Let options be the result of creating a new object as if by the\n // expression new Object() where Object is the standard built-in constructor\n // with that name.\n options = {};\n\n // 5. Else\n else\n // a. Let options be ToObject(options).\n options = toObject(options);\n\n // 6. Let opt be a new Record.\n let opt = new Record(),\n\n // 7. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with the arguments options, \"localeMatcher\", \"string\",\n // a List containing the two String values \"lookup\" and \"best fit\", and\n // \"best fit\".\n matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 8. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 9. Let NumberFormat be the standard built-in object that is the initial value\n // of Intl.NumberFormat.\n // 10. Let localeData be the value of the [[localeData]] internal property of\n // NumberFormat.\n let localeData = internals.NumberFormat['[[localeData]]'];\n\n // 11. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // NumberFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of NumberFormat, and localeData.\n let r = ResolveLocale(\n internals.NumberFormat['[[availableLocales]]'], requestedLocales,\n opt, internals.NumberFormat['[[relevantExtensionKeys]]'], localeData\n );\n\n // 12. Set the [[locale]] internal property of numberFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 13. Set the [[numberingSystem]] internal property of numberFormat to the value\n // of r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n let dataLocale = r['[[dataLocale]]'];\n\n // 15. Let s be the result of calling the GetOption abstract operation with the\n // arguments options, \"style\", \"string\", a List containing the three String\n // values \"decimal\", \"percent\", and \"currency\", and \"decimal\".\n let s = GetOption(options, 'style', 'string', new List('decimal', 'percent', 'currency'), 'decimal');\n\n // 16. Set the [[style]] internal property of numberFormat to s.\n internal['[[style]]'] = s;\n\n // 17. Let c be the result of calling the GetOption abstract operation with the\n // arguments options, \"currency\", \"string\", undefined, and undefined.\n let c = GetOption(options, 'currency', 'string');\n\n // 18. If c is not undefined and the result of calling the\n // IsWellFormedCurrencyCode abstract operation (defined in 6.3.1) with\n // argument c is false, then throw a RangeError exception.\n if (c !== undefined && !IsWellFormedCurrencyCode(c))\n throw new RangeError(\"'\" + c + \"' is not a valid currency code\");\n\n // 19. If s is \"currency\" and c is undefined, throw a TypeError exception.\n if (s === 'currency' && c === undefined)\n throw new TypeError('Currency code is required when style is currency');\n\n let cDigits;\n\n // 20. If s is \"currency\", then\n if (s === 'currency') {\n // a. Let c be the result of converting c to upper case as specified in 6.1.\n c = c.toUpperCase();\n\n // b. Set the [[currency]] internal property of numberFormat to c.\n internal['[[currency]]'] = c;\n\n // c. Let cDigits be the result of calling the CurrencyDigits abstract\n // operation (defined below) with argument c.\n cDigits = CurrencyDigits(c);\n }\n\n // 21. Let cd be the result of calling the GetOption abstract operation with the\n // arguments options, \"currencyDisplay\", \"string\", a List containing the\n // three String values \"code\", \"symbol\", and \"name\", and \"symbol\".\n let cd = GetOption(options, 'currencyDisplay', 'string', new List('code', 'symbol', 'name'), 'symbol');\n\n // 22. If s is \"currency\", then set the [[currencyDisplay]] internal property of\n // numberFormat to cd.\n if (s === 'currency')\n internal['[[currencyDisplay]]'] = cd;\n\n // 23. Let mnid be the result of calling the GetNumberOption abstract operation\n // (defined in 9.2.10) with arguments options, \"minimumIntegerDigits\", 1, 21,\n // and 1.\n let mnid = GetNumberOption(options, 'minimumIntegerDigits', 1, 21, 1);\n\n // 24. Set the [[minimumIntegerDigits]] internal property of numberFormat to mnid.\n internal['[[minimumIntegerDigits]]'] = mnid;\n\n // 25. If s is \"currency\", then let mnfdDefault be cDigits; else let mnfdDefault\n // be 0.\n let mnfdDefault = s === 'currency' ? cDigits : 0;\n\n // 26. Let mnfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"minimumFractionDigits\", 0, 20, and mnfdDefault.\n let mnfd = GetNumberOption(options, 'minimumFractionDigits', 0, 20, mnfdDefault);\n\n // 27. Set the [[minimumFractionDigits]] internal property of numberFormat to mnfd.\n internal['[[minimumFractionDigits]]'] = mnfd;\n\n // 28. If s is \"currency\", then let mxfdDefault be max(mnfd, cDigits); else if s\n // is \"percent\", then let mxfdDefault be max(mnfd, 0); else let mxfdDefault\n // be max(mnfd, 3).\n let mxfdDefault = s === 'currency' ? Math.max(mnfd, cDigits)\n : (s === 'percent' ? Math.max(mnfd, 0) : Math.max(mnfd, 3));\n\n // 29. Let mxfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"maximumFractionDigits\", mnfd, 20, and mxfdDefault.\n let mxfd = GetNumberOption(options, 'maximumFractionDigits', mnfd, 20, mxfdDefault);\n\n // 30. Set the [[maximumFractionDigits]] internal property of numberFormat to mxfd.\n internal['[[maximumFractionDigits]]'] = mxfd;\n\n // 31. Let mnsd be the result of calling the [[Get]] internal method of options\n // with argument \"minimumSignificantDigits\".\n let mnsd = options.minimumSignificantDigits;\n\n // 32. Let mxsd be the result of calling the [[Get]] internal method of options\n // with argument \"maximumSignificantDigits\".\n let mxsd = options.maximumSignificantDigits;\n\n // 33. If mnsd is not undefined or mxsd is not undefined, then:\n if (mnsd !== undefined || mxsd !== undefined) {\n // a. Let mnsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"minimumSignificantDigits\", 1, 21,\n // and 1.\n mnsd = GetNumberOption(options, 'minimumSignificantDigits', 1, 21, 1);\n\n // b. Let mxsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"maximumSignificantDigits\", mnsd,\n // 21, and 21.\n mxsd = GetNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21);\n\n // c. Set the [[minimumSignificantDigits]] internal property of numberFormat\n // to mnsd, and the [[maximumSignificantDigits]] internal property of\n // numberFormat to mxsd.\n internal['[[minimumSignificantDigits]]'] = mnsd;\n internal['[[maximumSignificantDigits]]'] = mxsd;\n }\n // 34. Let g be the result of calling the GetOption abstract operation with the\n // arguments options, \"useGrouping\", \"boolean\", undefined, and true.\n let g = GetOption(options, 'useGrouping', 'boolean', undefined, true);\n\n // 35. Set the [[useGrouping]] internal property of numberFormat to g.\n internal['[[useGrouping]]'] = g;\n\n // 36. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n let dataLocaleData = localeData[dataLocale];\n\n // 37. Let patterns be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"patterns\".\n let patterns = dataLocaleData.patterns;\n\n // 38. Assert: patterns is an object (see 11.2.3)\n\n // 39. Let stylePatterns be the result of calling the [[Get]] internal method of\n // patterns with argument s.\n let stylePatterns = patterns[s];\n\n // 40. Set the [[positivePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"positivePattern\".\n internal['[[positivePattern]]'] = stylePatterns.positivePattern;\n\n // 41. Set the [[negativePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"negativePattern\".\n internal['[[negativePattern]]'] = stylePatterns.negativePattern;\n\n // 42. Set the [[boundFormat]] internal property of numberFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 43. Set the [[initializedNumberFormat]] internal property of numberFormat to\n // true.\n internal['[[initializedNumberFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3)\n numberFormat.format = GetFormatNumber.call(numberFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return numberFormat;\n}\n\nfunction CurrencyDigits(currency) {\n // When the CurrencyDigits abstract operation is called with an argument currency\n // (which must be an upper case String value), the following steps are taken:\n\n // 1. If the ISO 4217 currency and funds code list contains currency as an\n // alphabetic code, then return the minor unit value corresponding to the\n // currency from the list; else return 2.\n return currencyMinorUnits[currency] !== undefined\n ? currencyMinorUnits[currency]\n : 2;\n}\n\n/* 11.2.3 */internals.NumberFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.NumberFormat is called, the\n * following steps are taken:\n */\n/* 11.2.2 */\ndefineProperty(Intl.NumberFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]'))\n throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n let regexpRestore = createRegExpRestore(),\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * NumberFormat object.\n */\n/* 11.3.2 */defineProperty(Intl.NumberFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatNumber\n});\n\nfunction GetFormatNumber() {\n let internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]'])\n throw new TypeError('`this` value for format() is not an initialized Intl.NumberFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this NumberFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 1, that takes the argument value and\n // performs the following steps:\n let F = function (value) {\n // i. If value is not provided, then let value be undefined.\n // ii. Let x be ToNumber(value).\n // iii. Return the result of calling the FormatNumber abstract\n // operation (defined below) with arguments this and x.\n return FormatNumber(this, /* x = */Number(value));\n };\n\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n let bf = fnBind.call(F, this);\n\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n }\n\nfunction formatToParts(value = undefined) {\n let internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n if (!internal || !internal['[[initializedNumberFormat]]'])\n throw new TypeError('`this` value for formatToParts() is not an initialized Intl.NumberFormat object.');\n\n let x = Number(value);\n return FormatNumberToParts(this, x);\n}\n\nObject.defineProperty(Intl.NumberFormat.prototype, 'formatToParts', {\n configurable: true,\n enumerable: false,\n writable: true,\n value: formatToParts\n});\n\n/*\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-formatnumbertoparts]\n */\nfunction FormatNumberToParts(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n let parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be ArrayCreate(0).\n let result = [];\n // 3. Let n be 0.\n let n = 0;\n // 4. For each part in parts, do:\n for (let i = 0; parts.length > i; i++) {\n let part = parts[i];\n // a. Let O be ObjectCreate(%ObjectPrototype%).\n let O = {};\n // a. Perform ? CreateDataPropertyOrThrow(O, \"type\", part.[[type]]).\n O.type = part['[[type]]'];\n // a. Perform ? CreateDataPropertyOrThrow(O, \"value\", part.[[value]]).\n O.value = part['[[value]]'];\n // a. Perform ? CreateDataPropertyOrThrow(result, ? ToString(n), O).\n result[n] = O;\n // a. Increment n by 1.\n n += 1;\n }\n // 5. Return result.\n return result;\n}\n\n/*\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-formatnumberstring]\n */\nfunction FormatNumberToString(numberFormat, x) {\n let internal = getInternalProperties(numberFormat);\n let result;\n\n // 1. Assert: numberFormat.[[initializedIntlObject]] is true.\n\n // 2. If the numberFormat.[[minimumSignificantDigits]] and numberFormat.[[maximumSignificantDigits]] are present, then\n if (hop.call(internal, '[[minimumSignificantDigits]]') &&\n hop.call(internal, '[[maximumSignificantDigits]]')) {\n // a. Let result be ToRawPrecision(x, numberFormat.[[minimumSignificantDigits]], numberFormat.[[maximumSignificantDigits]]).\n result = ToRawPrecision(x,\n internal['[[minimumSignificantDigits]]'],\n internal['[[maximumSignificantDigits]]']);\n }\n // 3. Else,\n else {\n // a. Let result be ToRawFixed(x, numberFormat.[[minimumIntegerDigits]], numberFormat.[[minimumFractionDigits]], numberFormat.[[maximumFractionDigits]]).\n result = ToRawFixed(x,\n internal['[[minimumIntegerDigits]]'],\n internal['[[minimumFractionDigits]]'],\n internal['[[maximumFractionDigits]]']);\n }\n // 4. Return result.\n return result;\n}\n\n/*\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-partitionnumberpattern]\n */\nfunction PartitionNumberPattern(numberFormat, x) {\n\n let internal = getInternalProperties(numberFormat),\n locale = internal['[[dataLocale]]'],\n nums = internal['[[numberingSystem]]'],\n data = internals.NumberFormat['[[localeData]]'][locale],\n ild = data.symbols[nums] || data.symbols.latn,\n pattern;\n\n // 1. If x is not NaN and x < 0, then:\n if (!isNaN(x) && x < 0) {\n // a. Let x be -x.\n x = -x;\n // b. Let pattern be the value of numberFormat.[[negativePattern]].\n pattern = internal['[[negativePattern]]'];\n }\n // 2. Else,\n else {\n // a. Let pattern be the value of numberFormat.[[positivePattern]].\n pattern = internal['[[positivePattern]]'];\n }\n // 3. Let result be a new empty List.\n let result = new List();\n // 4. Let beginIndex be Call(%StringProto_indexOf%, pattern, \"{\", 0).\n let beginIndex = pattern.indexOf('{', 0);\n // 5. Let endIndex be 0.\n let endIndex = 0;\n // 6. Let nextIndex be 0.\n let nextIndex = 0;\n // 7. Let length be the number of code units in pattern.\n let length = pattern.length;\n // 8. Repeat while beginIndex is an integer index into pattern:\n while (beginIndex > -1 && beginIndex < length) {\n // a. Set endIndex to Call(%StringProto_indexOf%, pattern, \"}\", beginIndex)\n endIndex = pattern.indexOf('}', beginIndex);\n // b. If endIndex = -1, throw new Error exception.\n if (endIndex === -1) throw new Error();\n // c. If beginIndex is greater than nextIndex, then:\n if (beginIndex > nextIndex) {\n // i. Let literal be a substring of pattern from position nextIndex, inclusive, to position beginIndex, exclusive.\n let literal = pattern.substring(nextIndex, beginIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // d. Let p be the substring of pattern from position beginIndex, exclusive, to position endIndex, exclusive.\n let p = pattern.substring(beginIndex + 1, endIndex);\n // e. If p is equal \"number\", then:\n if (p === \"number\") {\n // i. If x is NaN,\n if (isNaN(x)) {\n // 1. Let n be an ILD String value indicating the NaN value.\n let n = ild.nan;\n // 2. Add new part record { [[type]]: \"nan\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'nan', '[[value]]': n });\n }\n // ii. Else if isFinite(x) is false,\n else if (!isFinite(x)) {\n // 1. Let n be an ILD String value indicating infinity.\n let n = ild.infinity;\n // 2. Add new part record { [[type]]: \"infinity\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'infinity', '[[value]]': n });\n }\n // iii. Else,\n else {\n // 1. If numberFormat.[[style]] is \"percent\", let x be 100 × x.\n if (internal['[[style]]'] === 'percent') x *= 100;\n\n // 2. Let n be FormatNumberToString(numberFormat, x).\n let n = FormatNumberToString(numberFormat, x);\n\n // 3. If the numberFormat.[[numberingSystem]] matches one of the values in the \"Numbering System\" column of Table 3 below, then\n if (numSys[nums]) {\n // a. Let digits be an array whose 10 String valued elements are the UTF-16 string representations of the 10 digits specified in the \"Digits\" column of the matching row in Table 2.\n let digits = numSys[nums];\n // a. Replace each digit in n with the value of digits[digit].\n n = String(n).replace(/\\d/g, (digit) => {\n return digits[digit];\n });\n }\n // 4. Else use an implementation dependent algorithm to map n to the appropriate representation of n in the given numbering system.\n else n = String(n); // ###TODO###\n\n let integer;\n let fraction;\n // 5. Let decimalSepIndex be Call(%StringProto_indexOf%, n, \".\", 0).\n let decimalSepIndex = n.indexOf('.', 0);\n // 6. If decimalSepIndex > 0, then:\n if (decimalSepIndex > 0) {\n // a. Let integer be the substring of n from position 0, inclusive, to position decimalSepIndex, exclusive.\n integer = n.substring(0, decimalSepIndex);\n // b. Let fraction be the substring of n from position decimalSepIndex, exclusive, to the end of n.\n fraction = n.substring(decimalSepIndex + 1, decimalSepIndex.length);\n }\n // 7. Else:\n else {\n // a. Let integer be n.\n integer = n;\n // b. Let fraction be undefined.\n fraction = undefined;\n }\n // 8. If the value of the numberFormat.[[useGrouping]] is true,\n if (internal['[[useGrouping]]'] === true) {\n // a. Let groupSepSymbol be the ILND String representing the grouping separator.\n let groupSepSymbol = ild.group;\n // b. Let groups be a List whose elements are, in left to right order, the substrings defined by ILND set of locations within the integer.\n let groups = [];\n // ----> implementation:\n // Primary group represents the group closest to the decimal\n let pgSize = data.patterns.primaryGroupSize || 3;\n // Secondary group is every other group\n let sgSize = data.patterns.secondaryGroupSize || pgSize;\n // Group only if necessary\n if (integer.length > pgSize) {\n // Index of the primary grouping separator\n let end = integer.length - pgSize;\n // Starting index for our loop\n let idx = end % sgSize;\n let start = integer.slice(0, idx);\n if (start.length) arrPush.call(groups, start);\n // Loop to separate into secondary grouping digits\n while (idx < end) {\n arrPush.call(groups, integer.slice(idx, idx + sgSize));\n idx += sgSize;\n }\n // Add the primary grouping digits\n arrPush.call(groups, integer.slice(end));\n } else {\n arrPush.call(groups, integer);\n }\n // c. Assert: The number of elements in groups List is greater than 0.\n if (groups.length === 0) throw new Error();\n // d. Repeat, while groups List is not empty:\n while (groups.length) {\n // i. Remove the first element from groups and let integerGroup be the value of that element.\n let integerGroup = arrShift.call(groups);\n // ii. Add new part record { [[type]]: \"integer\", [[value]]: integerGroup } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integerGroup });\n // iii. If groups List is not empty, then:\n if (groups.length) {\n // 1. Add new part record { [[type]]: \"group\", [[value]]: groupSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'group', '[[value]]': groupSepSymbol });\n }\n }\n }\n // 9. Else,\n else {\n // a. Add new part record { [[type]]: \"integer\", [[value]]: integer } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integer });\n }\n // 10. If fraction is not undefined, then:\n if (fraction !== undefined) {\n // a. Let decimalSepSymbol be the ILND String representing the decimal separator.\n let decimalSepSymbol = ild.decimal;\n // b. Add new part record { [[type]]: \"decimal\", [[value]]: decimalSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'decimal', '[[value]]': decimalSepSymbol });\n // c. Add new part record { [[type]]: \"fraction\", [[value]]: fraction } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'fraction', '[[value]]': fraction });\n }\n }\n }\n // f. Else if p is equal \"plusSign\", then:\n else if (p === \"plusSign\") {\n // i. Let plusSignSymbol be the ILND String representing the plus sign.\n let plusSignSymbol = ild.plusSign;\n // ii. Add new part record { [[type]]: \"plusSign\", [[value]]: plusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'plusSign', '[[value]]': plusSignSymbol });\n }\n // g. Else if p is equal \"minusSign\", then:\n else if (p === \"minusSign\") {\n // i. Let minusSignSymbol be the ILND String representing the minus sign.\n let minusSignSymbol = ild.minusSign;\n // ii. Add new part record { [[type]]: \"minusSign\", [[value]]: minusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'minusSign', '[[value]]': minusSignSymbol });\n }\n // h. Else if p is equal \"percentSign\" and numberFormat.[[style]] is \"percent\", then:\n else if (p === \"percentSign\" && internal['[[style]]'] === \"percent\") {\n // i. Let percentSignSymbol be the ILND String representing the percent sign.\n let percentSignSymbol = ild.percentSign;\n // ii. Add new part record { [[type]]: \"percentSign\", [[value]]: percentSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': percentSignSymbol });\n }\n // i. Else if p is equal \"currency\" and numberFormat.[[style]] is \"currency\", then:\n else if (p === \"currency\" && internal['[[style]]'] === \"currency\") {\n // i. Let currency be the value of numberFormat.[[currency]].\n let currency = internal['[[currency]]'];\n\n let cd;\n\n // iii. If numberFormat.[[currencyDisplay]] is \"code\", then\n if (internal['[[currencyDisplay]]'] === \"code\") {\n // 1. Let cd be currency.\n cd = currency;\n }\n // iv. Else if numberFormat.[[currencyDisplay]] is \"symbol\", then\n else if (internal['[[currencyDisplay]]'] === \"symbol\") {\n // 1. Let cd be an ILD string representing currency in short form. If the implementation does not have such a representation of currency, use currency itself.\n cd = data.currencies[currency] || currency;\n }\n // v. Else if numberFormat.[[currencyDisplay]] is \"name\", then\n else if (internal['[[currencyDisplay]]'] === \"name\") {\n // 1. Let cd be an ILD string representing currency in long form. If the implementation does not have such a representation of currency, then use currency itself.\n cd = currency;\n }\n // vi. Add new part record { [[type]]: \"currency\", [[value]]: cd } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'currency', '[[value]]': cd });\n }\n // j. Else,\n else {\n // i. Let literal be the substring of pattern from position beginIndex, inclusive, to position endIndex, inclusive.\n let literal = pattern.substring(beginIndex, endIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // k. Set nextIndex to endIndex + 1.\n nextIndex = endIndex + 1;\n // l. Set beginIndex to Call(%StringProto_indexOf%, pattern, \"{\", nextIndex)\n beginIndex = pattern.indexOf('{', nextIndex);\n }\n // 9. If nextIndex is less than length, then:\n if (nextIndex < length) {\n // a. Let literal be the substring of pattern from position nextIndex, inclusive, to position length, exclusive.\n let literal = pattern.substring(nextIndex, length);\n // b. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // 10. Return result.\n return result;\n}\n\n/*\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-formatnumber]\n */\nexport function FormatNumber(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n let parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be an empty String.\n let result = '';\n // 3. For each part in parts, do:\n for (let i = 0; parts.length > i; i++) {\n let part = parts[i];\n // a. Set result to a String value produced by concatenating result and part.[[value]].\n result += part['[[value]]'];\n }\n // 4. Return result.\n return result;\n}\n\n/**\n * When the ToRawPrecision abstract operation is called with arguments x (which\n * must be a finite non-negative number), minPrecision, and maxPrecision (both\n * must be integers between 1 and 21) the following steps are taken:\n */\nfunction ToRawPrecision (x, minPrecision, maxPrecision) {\n // 1. Let p be maxPrecision.\n let p = maxPrecision;\n\n let m, e;\n\n // 2. If x = 0, then\n if (x === 0) {\n // a. Let m be the String consisting of p occurrences of the character \"0\".\n m = arrJoin.call(Array (p + 1), '0');\n // b. Let e be 0.\n e = 0;\n }\n // 3. Else\n else {\n // a. Let e and n be integers such that 10ᵖ⁻¹ ≤ n < 10ᵖ and for which the\n // exact mathematical value of n × 10ᵉ⁻ᵖ⁺¹ – x is as close to zero as\n // possible. If there are two such sets of e and n, pick the e and n for\n // which n × 10ᵉ⁻ᵖ⁺¹ is larger.\n e = log10Floor(Math.abs(x));\n\n // Easier to get to m from here\n let f = Math.round(Math.exp((Math.abs(e - p + 1)) * Math.LN10));\n\n // b. Let m be the String consisting of the digits of the decimal\n // representation of n (in order, with no leading zeroes)\n m = String(Math.round(e - p + 1 < 0 ? x * f : x / f));\n }\n\n // 4. If e ≥ p, then\n if (e >= p)\n // a. Return the concatenation of m and e-p+1 occurrences of the character \"0\".\n return m + arrJoin.call(Array(e-p+1 + 1), '0');\n\n // 5. If e = p-1, then\n else if (e === p - 1)\n // a. Return m.\n return m;\n\n // 6. If e ≥ 0, then\n else if (e >= 0)\n // a. Let m be the concatenation of the first e+1 characters of m, the character\n // \".\", and the remaining p–(e+1) characters of m.\n m = m.slice(0, e + 1) + '.' + m.slice(e + 1);\n\n // 7. If e < 0, then\n else if (e < 0)\n // a. Let m be the concatenation of the String \"0.\", –(e+1) occurrences of the\n // character \"0\", and the string m.\n m = '0.' + arrJoin.call(Array (-(e+1) + 1), '0') + m;\n\n // 8. If m contains the character \".\", and maxPrecision > minPrecision, then\n if (m.indexOf(\".\") >= 0 && maxPrecision > minPrecision) {\n // a. Let cut be maxPrecision – minPrecision.\n let cut = maxPrecision - minPrecision;\n\n // b. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.charAt(m.length-1) === '0') {\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n\n // ii. Decrease cut by 1.\n cut--;\n }\n\n // c. If the last character of m is \".\", then\n if (m.charAt(m.length-1) === '.')\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. Return m.\n return m;\n}\n\n/**\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-torawfixed]\n * When the ToRawFixed abstract operation is called with arguments x (which must\n * be a finite non-negative number), minInteger (which must be an integer between\n * 1 and 21), minFraction, and maxFraction (which must be integers between 0 and\n * 20) the following steps are taken:\n */\nfunction ToRawFixed(x, minInteger, minFraction, maxFraction) {\n // 1. Let f be maxFraction.\n let f = maxFraction;\n // 2. Let n be an integer for which the exact mathematical value of n ÷ 10f – x is as close to zero as possible. If there are two such n, pick the larger n.\n let n = Math.pow(10, f) * x; // diverging...\n // 3. If n = 0, let m be the String \"0\". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).\n let m = (n === 0 ? \"0\" : n.toFixed(0)); // divering...\n\n {\n // this diversion is needed to take into consideration big numbers, e.g.:\n // 1.2344501e+37 -> 12344501000000000000000000000000000000\n let idx;\n let exp = (idx = m.indexOf('e')) > -1 ? m.slice(idx + 1) : 0;\n if (exp) {\n m = m.slice(0, idx).replace('.', '');\n m += arrJoin.call(Array(exp - (m.length - 1) + 1), '0');\n }\n }\n\n let int;\n // 4. If f ≠ 0, then\n if (f !== 0) {\n // a. Let k be the number of characters in m.\n let k = m.length;\n // a. If k ≤ f, then\n if (k <= f) {\n // i. Let z be the String consisting of f+1–k occurrences of the character \"0\".\n let z = arrJoin.call(Array(f + 1 - k + 1), '0');\n // ii. Let m be the concatenation of Strings z and m.\n m = z + m;\n // iii. Let k be f+1.\n k = f + 1;\n }\n // a. Let a be the first k–f characters of m, and let b be the remaining f characters of m.\n let a = m.substring(0, k - f), b = m.substring(k - f, m.length);\n // a. Let m be the concatenation of the three Strings a, \".\", and b.\n m = a + \".\" + b;\n // a. Let int be the number of characters in a.\n int = a.length;\n }\n // 5. Else, let int be the number of characters in m.\n else int = m.length;\n // 6. Let cut be maxFraction – minFraction.\n let cut = maxFraction - minFraction;\n // 7. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.slice(-1) === \"0\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n // a. Decrease cut by 1.\n cut--;\n }\n // 8. If the last character of m is \".\", then\n if (m.slice(-1) === \".\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. If int < minInteger, then\n if (int < minInteger) {\n // a. Let z be the String consisting of minInteger–int occurrences of the character \"0\".\n let z = arrJoin.call(Array(minInteger - int + 1), '0');\n // a. Let m be the concatenation of Strings z and m.\n m = z + m;\n }\n // 10. Return m.\n return m;\n}\n\n// Sect 11.3.2 Table 2, Numbering systems\n// ======================================\nlet numSys = {\n arab: ['\\u0660', '\\u0661', '\\u0662', '\\u0663', '\\u0664', '\\u0665', '\\u0666', '\\u0667', '\\u0668', '\\u0669'],\n arabext: ['\\u06F0', '\\u06F1', '\\u06F2', '\\u06F3', '\\u06F4', '\\u06F5', '\\u06F6', '\\u06F7', '\\u06F8', '\\u06F9'],\n bali: ['\\u1B50', '\\u1B51', '\\u1B52', '\\u1B53', '\\u1B54', '\\u1B55', '\\u1B56', '\\u1B57', '\\u1B58', '\\u1B59'],\n beng: ['\\u09E6', '\\u09E7', '\\u09E8', '\\u09E9', '\\u09EA', '\\u09EB', '\\u09EC', '\\u09ED', '\\u09EE', '\\u09EF'],\n deva: ['\\u0966', '\\u0967', '\\u0968', '\\u0969', '\\u096A', '\\u096B', '\\u096C', '\\u096D', '\\u096E', '\\u096F'],\n fullwide: ['\\uFF10', '\\uFF11', '\\uFF12', '\\uFF13', '\\uFF14', '\\uFF15', '\\uFF16', '\\uFF17', '\\uFF18', '\\uFF19'],\n gujr: ['\\u0AE6', '\\u0AE7', '\\u0AE8', '\\u0AE9', '\\u0AEA', '\\u0AEB', '\\u0AEC', '\\u0AED', '\\u0AEE', '\\u0AEF'],\n guru: ['\\u0A66', '\\u0A67', '\\u0A68', '\\u0A69', '\\u0A6A', '\\u0A6B', '\\u0A6C', '\\u0A6D', '\\u0A6E', '\\u0A6F'],\n hanidec: ['\\u3007', '\\u4E00', '\\u4E8C', '\\u4E09', '\\u56DB', '\\u4E94', '\\u516D', '\\u4E03', '\\u516B', '\\u4E5D'],\n khmr: ['\\u17E0', '\\u17E1', '\\u17E2', '\\u17E3', '\\u17E4', '\\u17E5', '\\u17E6', '\\u17E7', '\\u17E8', '\\u17E9'],\n knda: ['\\u0CE6', '\\u0CE7', '\\u0CE8', '\\u0CE9', '\\u0CEA', '\\u0CEB', '\\u0CEC', '\\u0CED', '\\u0CEE', '\\u0CEF'],\n laoo: ['\\u0ED0', '\\u0ED1', '\\u0ED2', '\\u0ED3', '\\u0ED4', '\\u0ED5', '\\u0ED6', '\\u0ED7', '\\u0ED8', '\\u0ED9'],\n latn: ['\\u0030', '\\u0031', '\\u0032', '\\u0033', '\\u0034', '\\u0035', '\\u0036', '\\u0037', '\\u0038', '\\u0039'],\n limb: ['\\u1946', '\\u1947', '\\u1948', '\\u1949', '\\u194A', '\\u194B', '\\u194C', '\\u194D', '\\u194E', '\\u194F'],\n mlym: ['\\u0D66', '\\u0D67', '\\u0D68', '\\u0D69', '\\u0D6A', '\\u0D6B', '\\u0D6C', '\\u0D6D', '\\u0D6E', '\\u0D6F'],\n mong: ['\\u1810', '\\u1811', '\\u1812', '\\u1813', '\\u1814', '\\u1815', '\\u1816', '\\u1817', '\\u1818', '\\u1819'],\n mymr: ['\\u1040', '\\u1041', '\\u1042', '\\u1043', '\\u1044', '\\u1045', '\\u1046', '\\u1047', '\\u1048', '\\u1049'],\n orya: ['\\u0B66', '\\u0B67', '\\u0B68', '\\u0B69', '\\u0B6A', '\\u0B6B', '\\u0B6C', '\\u0B6D', '\\u0B6E', '\\u0B6F'],\n tamldec: ['\\u0BE6', '\\u0BE7', '\\u0BE8', '\\u0BE9', '\\u0BEA', '\\u0BEB', '\\u0BEC', '\\u0BED', '\\u0BEE', '\\u0BEF'],\n telu: ['\\u0C66', '\\u0C67', '\\u0C68', '\\u0C69', '\\u0C6A', '\\u0C6B', '\\u0C6C', '\\u0C6D', '\\u0C6E', '\\u0C6F'],\n thai: ['\\u0E50', '\\u0E51', '\\u0E52', '\\u0E53', '\\u0E54', '\\u0E55', '\\u0E56', '\\u0E57', '\\u0E58', '\\u0E59'],\n tibt: ['\\u0F20', '\\u0F21', '\\u0F22', '\\u0F23', '\\u0F24', '\\u0F25', '\\u0F26', '\\u0F27', '\\u0F28', '\\u0F29']\n};\n\n/**\n * This function provides access to the locale and formatting options computed\n * during initialization of the object.\n *\n * The function returns a new object whose properties and attributes are set as\n * if constructed by an object literal assigning to each of the following\n * properties the value of the corresponding internal property of this\n * NumberFormat object (see 11.4): locale, numberingSystem, style, currency,\n * currencyDisplay, minimumIntegerDigits, minimumFractionDigits,\n * maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, and\n * useGrouping. Properties whose corresponding internal properties are not present\n * are not assigned.\n */\n/* 11.3.3 */defineProperty(Intl.NumberFormat.prototype, 'resolvedOptions', {\n configurable: true,\n writable: true,\n value: function () {\n let prop,\n descs = new Record(),\n props = [\n 'locale', 'numberingSystem', 'style', 'currency', 'currencyDisplay',\n 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits',\n 'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping'\n ],\n internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]'])\n throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.NumberFormat object.');\n\n for (let i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[['+ props[i] +']]'))\n descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n","/* jslint esnext: true */\n\n// Match these datetime components in a CLDR pattern, except those in single quotes\nlet expDTComponents = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n// trim patterns after transformations\nlet expPatternTrimmer = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\n// Skip over patterns with these datetime components because we don't have data\n// to back them up:\n// timezone, weekday, amoung others\nlet unwantedDTCs = /[rqQASjJgwWIQq]/; // xXVO were removed from this list in favor of computing matches with timeZoneName values but printing as empty string\n\nlet dtKeys = [\"era\", \"year\", \"month\", \"day\", \"weekday\", \"quarter\"];\nlet tmKeys = [\"hour\", \"minute\", \"second\", \"hour12\", \"timeZoneName\"];\n\nfunction isDateFormatOnly(obj) {\n for (let i = 0; i < tmKeys.length; i += 1) {\n if (obj.hasOwnProperty(tmKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction isTimeFormatOnly(obj) {\n for (let i = 0; i < dtKeys.length; i += 1) {\n if (obj.hasOwnProperty(dtKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction joinDateAndTimeFormats(dateFormatObj, timeFormatObj) {\n let o = { _: {} };\n for (let i = 0; i < dtKeys.length; i += 1) {\n if (dateFormatObj[dtKeys[i]]) {\n o[dtKeys[i]] = dateFormatObj[dtKeys[i]];\n }\n if (dateFormatObj._[dtKeys[i]]) {\n o._[dtKeys[i]] = dateFormatObj._[dtKeys[i]];\n }\n }\n for (let j = 0; j < tmKeys.length; j += 1) {\n if (timeFormatObj[tmKeys[j]]) {\n o[tmKeys[j]] = timeFormatObj[tmKeys[j]];\n }\n if (timeFormatObj._[tmKeys[j]]) {\n o._[tmKeys[j]] = timeFormatObj._[tmKeys[j]];\n }\n }\n return o;\n}\n\nfunction computeFinalPatterns(formatObj) {\n // From http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns:\n // 'In patterns, two single quotes represents a literal single quote, either\n // inside or outside single quotes. Text within single quotes is not\n // interpreted in any way (except for two adjacent single quotes).'\n formatObj.pattern12 = formatObj.extendedPattern.replace(/'([^']*)'/g, ($0, literal) => {\n return literal ? literal : \"'\";\n });\n\n // pattern 12 is always the default. we can produce the 24 by removing {ampm}\n formatObj.pattern = formatObj.pattern12.replace('{ampm}', '').replace(expPatternTrimmer, '');\n return formatObj;\n}\n\nfunction expDTComponentsMeta($0, formatObj) {\n switch ($0.charAt(0)) {\n // --- Era\n case 'G':\n formatObj.era = [ 'short', 'short', 'short', 'long', 'narrow' ][$0.length-1];\n return '{era}';\n\n // --- Year\n case 'y':\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n formatObj.year = $0.length === 2 ? '2-digit' : 'numeric';\n return '{year}';\n\n // --- Quarter (not supported in this polyfill)\n case 'Q':\n case 'q':\n formatObj.quarter = [ 'numeric', '2-digit', 'short', 'long', 'narrow' ][$0.length-1];\n return '{quarter}';\n\n // --- Month\n case 'M':\n case 'L':\n formatObj.month = [ 'numeric', '2-digit', 'short', 'long', 'narrow' ][$0.length-1];\n return '{month}';\n\n // --- Week (not supported in this polyfill)\n case 'w':\n // week of the year\n formatObj.week = $0.length === 2 ? '2-digit' : 'numeric';\n return '{weekday}';\n case 'W':\n // week of the month\n formatObj.week = 'numeric';\n return '{weekday}';\n\n // --- Day\n case 'd':\n // day of the month\n formatObj.day = $0.length === 2 ? '2-digit' : 'numeric';\n return '{day}';\n case 'D': // day of the year\n case 'F': // day of the week\n case 'g':\n // 1..n: Modified Julian day\n formatObj.day = 'numeric';\n return '{day}';\n\n // --- Week Day\n case 'E':\n // day of the week\n formatObj.weekday = [ 'short', 'short', 'short', 'long', 'narrow', 'short' ][$0.length-1];\n return '{weekday}';\n case 'e':\n // local day of the week\n formatObj.weekday = [ 'numeric', '2-digit', 'short', 'long', 'narrow', 'short' ][$0.length-1];\n return '{weekday}';\n case 'c':\n // stand alone local day of the week\n formatObj.weekday = [ 'numeric', undefined, 'short', 'long', 'narrow', 'short' ][$0.length-1];\n return '{weekday}';\n\n // --- Period\n case 'a': // AM, PM\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n formatObj.hour12 = true;\n return '{ampm}';\n\n // --- Hour\n case 'h':\n case 'H':\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n case 'k':\n case 'K':\n formatObj.hour12 = true; // 12-hour-cycle time formats (using h or K)\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n\n // --- Minute\n case 'm':\n formatObj.minute = $0.length === 2 ? '2-digit' : 'numeric';\n return '{minute}';\n\n // --- Second\n case 's':\n formatObj.second = $0.length === 2 ? '2-digit' : 'numeric';\n return '{second}';\n case 'S':\n case 'A':\n formatObj.second = 'numeric';\n return '{second}';\n\n // --- Timezone\n case 'z': // 1..3, 4: specific non-location format\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: miliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x': // 1, 2, 3, 4: The ISO8601 varios formats\n // this polyfill only supports much, for now, we are just doing something dummy\n formatObj.timeZoneName = $0.length < 4 ? 'short' : 'long';\n return '{timeZoneName}';\n }\n}\n\n\n/**\n * Converts the CLDR availableFormats into the objects and patterns required by\n * the ECMAScript Internationalization API specification.\n */\nexport function createDateTimeFormat(skeleton, pattern) {\n // we ignore certain patterns that are unsupported to avoid this expensive op.\n if (unwantedDTCs.test(pattern))\n return undefined;\n\n let formatObj = {\n originalPattern: pattern,\n _: {}\n };\n\n // Replace the pattern string with the one required by the specification, whilst\n // at the same time evaluating it for the subsets and formats\n formatObj.extendedPattern = pattern.replace(expDTComponents, ($0) => {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj._);\n });\n\n // Match the skeleton string with the one required by the specification\n // this implementation is based on the Date Field Symbol Table:\n // http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n // Note: we are adding extra data to the formatObject even though this polyfill\n // might not support it.\n skeleton.replace(expDTComponents, ($0) => {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj);\n });\n\n return computeFinalPatterns(formatObj);\n}\n\n/**\n * Processes DateTime formats from CLDR to an easier-to-parse format.\n * the result of this operation should be cached the first time a particular\n * calendar is analyzed.\n *\n * The specification requires we support at least the following subsets of\n * date/time components:\n *\n * - 'weekday', 'year', 'month', 'day', 'hour', 'minute', 'second'\n * - 'weekday', 'year', 'month', 'day'\n * - 'year', 'month', 'day'\n * - 'year', 'month'\n * - 'month', 'day'\n * - 'hour', 'minute', 'second'\n * - 'hour', 'minute'\n *\n * We need to cherry pick at least these subsets from the CLDR data and convert\n * them into the pattern objects used in the ECMA-402 API.\n */\nexport function createDateTimeFormats(formats) {\n let availableFormats = formats.availableFormats;\n let timeFormats = formats.timeFormats;\n let dateFormats = formats.dateFormats;\n let result = [];\n let skeleton, pattern, computed, i, j;\n let timeRelatedFormats = [];\n let dateRelatedFormats = [];\n\n // Map available (custom) formats into a pattern for createDateTimeFormats\n for (skeleton in availableFormats) {\n if (availableFormats.hasOwnProperty(skeleton)) {\n pattern = availableFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n // in some cases, the format is only displaying date specific props\n // or time specific props, in which case we need to also produce the\n // combined formats.\n if (isDateFormatOnly(computed)) {\n dateRelatedFormats.push(computed);\n } else if (isTimeFormatOnly(computed)) {\n timeRelatedFormats.push(computed);\n }\n }\n }\n }\n\n // Map time formats into a pattern for createDateTimeFormats\n for (skeleton in timeFormats) {\n if (timeFormats.hasOwnProperty(skeleton)) {\n pattern = timeFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n timeRelatedFormats.push(computed);\n }\n }\n }\n\n // Map date formats into a pattern for createDateTimeFormats\n for (skeleton in dateFormats) {\n if (dateFormats.hasOwnProperty(skeleton)) {\n pattern = dateFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n dateRelatedFormats.push(computed);\n }\n }\n }\n\n // combine custom time and custom date formats when they are orthogonals to complete the\n // formats supported by CLDR.\n // This Algo is based on section \"Missing Skeleton Fields\" from:\n // http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems\n for (i = 0; i < timeRelatedFormats.length; i += 1) {\n for (j = 0; j < dateRelatedFormats.length; j += 1) {\n if (dateRelatedFormats[j].month === 'long') {\n pattern = dateRelatedFormats[j].weekday ? formats.full : formats.long;\n } else if (dateRelatedFormats[j].month === 'short') {\n pattern = formats.medium;\n } else {\n pattern = formats.short;\n }\n computed = joinDateAndTimeFormats(dateRelatedFormats[j], timeRelatedFormats[i]);\n computed.originalPattern = pattern;\n computed.extendedPattern = pattern\n .replace('{0}', timeRelatedFormats[i].extendedPattern)\n .replace('{1}', dateRelatedFormats[j].extendedPattern)\n .replace(/^[,\\s]+|[,\\s]+$/gi, '');\n result.push(computeFinalPatterns(computed));\n }\n }\n\n return result;\n}\n\n// this represents the exceptions of the rule that are not covered by CLDR availableFormats\n// for single property configurations, they play no role when using multiple properties, and\n// those that are not in this table, are not exceptions or are not covered by the data we\n// provide.\nconst validSyntheticProps = {\n second: {\n numeric: 's',\n '2-digit': 'ss'\n },\n minute: {\n numeric: 'm',\n '2-digit': 'mm'\n },\n year: {\n numeric: 'y',\n '2-digit': 'yy'\n },\n day: {\n numeric: 'd',\n '2-digit': 'dd'\n },\n month: {\n numeric: 'L',\n '2-digit': 'LL',\n narrow: 'LLLLL',\n short: 'LLL',\n long: 'LLLL'\n },\n weekday: {\n narrow: 'ccccc',\n short: 'ccc',\n long: 'cccc'\n }\n};\n\nexport function generateSyntheticFormat(propName, propValue) {\n if (validSyntheticProps[propName] && validSyntheticProps[propName][propValue]) {\n return {\n originalPattern: validSyntheticProps[propName][propValue],\n _: {\n [propName]: propValue\n },\n extendedPattern: `{${propName}}`,\n [propName]: propValue,\n pattern12: `{${propName}}`,\n pattern: `{${propName}}`\n };\n }\n}\n","// 12.1 The Intl.DateTimeFormat constructor\n// ==================================\n\nimport {\n toLatinUpperCase\n} from './6.locales-currencies-tz.js';\n\nimport {\n Intl\n} from \"./8.intl.js\";\n\nimport {\n CanonicalizeLocaleList,\n ResolveLocale,\n GetOption,\n SupportedLocales\n} from \"./9.negotiation.js\";\n\nimport {\n FormatNumber\n} from \"./11.numberformat.js\";\n\nimport {\n generateSyntheticFormat,\n createDateTimeFormats\n} from \"./cldr\";\n\nimport {\n internals,\n es3,\n fnBind,\n defineProperty,\n toObject,\n getInternalProperties,\n createRegExpRestore,\n secret,\n Record,\n List,\n hop,\n objCreate,\n toNumber,\n arrPush,\n arrIndexOf\n} from './util.js';\n\n// An object map of date component keys, saves using a regex later\nconst dateWidths = objCreate(null, { narrow:{}, short:{}, long:{} });\n\n/**\n * Returns a string for a date component, resolved using multiple inheritance as specified\n * as specified in the Unicode Technical Standard 35.\n */\nfunction resolveDateString(data, ca, component, width, key) {\n // From http://www.unicode.org/reports/tr35/tr35.html#Multiple_Inheritance:\n // 'In clearly specified instances, resources may inherit from within the same locale.\n // For example, ... the Buddhist calendar inherits from the Gregorian calendar.'\n let obj = data[ca] && data[ca][component]\n ? data[ca][component]\n : data.gregory[component],\n\n // \"sideways\" inheritance resolves strings when a key doesn't exist\n alts = {\n narrow: ['short', 'long'],\n short: ['long', 'narrow'],\n long: ['short', 'narrow']\n },\n\n //\n resolved = hop.call(obj, width)\n ? obj[width]\n : hop.call(obj, alts[width][0])\n ? obj[alts[width][0]]\n : obj[alts[width][1]];\n\n // `key` wouldn't be specified for components 'dayPeriods'\n return key !== null ? resolved[key] : resolved;\n}\n\n// Define the DateTimeFormat constructor internally so it cannot be tainted\nexport function DateTimeFormatConstructor () {\n let locales = arguments[0];\n let options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.DateTimeFormat(locales, options);\n }\n return InitializeDateTimeFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'DateTimeFormat', {\n configurable: true,\n writable: true,\n value: DateTimeFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(DateTimeFormatConstructor, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeDateTimeFormat accepts the arguments dateTimeFormat\n * (which must be an object), locales, and options. It initializes dateTimeFormat as a\n * DateTimeFormat object.\n */\nexport function/* 12.1.1.1 */InitializeDateTimeFormat (dateTimeFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n let internal = getInternalProperties(dateTimeFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n let regexpRestore = createRegExpRestore();\n\n // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true)\n throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(dateTimeFormat, '__getInternalProperties', {\n value: function () {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret)\n return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n let requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined below) with arguments options, \"any\", and \"date\".\n options = ToDateTimeOptions(options, 'any', 'date');\n\n // 5. Let opt be a new Record.\n let opt = new Record();\n\n // 6. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with arguments options, \"localeMatcher\", \"string\", a List\n // containing the two String values \"lookup\" and \"best fit\", and \"best fit\".\n let matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 7. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 8. Let DateTimeFormat be the standard built-in object that is the initial\n // value of Intl.DateTimeFormat.\n let DateTimeFormat = internals.DateTimeFormat; // This is what we *really* need\n\n // 9. Let localeData be the value of the [[localeData]] internal property of\n // DateTimeFormat.\n let localeData = DateTimeFormat['[[localeData]]'];\n\n // 10. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of DateTimeFormat, and localeData.\n let r = ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales,\n opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData);\n\n // 11. Set the [[locale]] internal property of dateTimeFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of\n // r.[[ca]].\n internal['[[calendar]]'] = r['[[ca]]'];\n\n // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of\n // r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n let dataLocale = r['[[dataLocale]]'];\n\n // 15. Let tz be the result of calling the [[Get]] internal method of options with\n // argument \"timeZone\".\n let tz = options.timeZone;\n\n // 16. If tz is not undefined, then\n if (tz !== undefined) {\n // a. Let tz be ToString(tz).\n // b. Convert tz to upper case as described in 6.1.\n // NOTE: If an implementation accepts additional time zone values, as permitted\n // under certain conditions by the Conformance clause, different casing\n // rules apply.\n tz = toLatinUpperCase(tz);\n\n // c. If tz is not \"UTC\", then throw a RangeError exception.\n // ###TODO: accept more time zones###\n if (tz !== 'UTC')\n throw new RangeError('timeZone is not supported.');\n }\n\n // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz.\n internal['[[timeZone]]'] = tz;\n\n // 18. Let opt be a new Record.\n opt = new Record();\n\n // 19. For each row of Table 3, except the header row, do:\n for (let prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, prop))\n continue;\n\n // 20. Let prop be the name given in the Property column of the row.\n // 21. Let value be the result of calling the GetOption abstract operation,\n // passing as argument options, the name given in the Property column of the\n // row, \"string\", a List containing the strings given in the Values column of\n // the row, and undefined.\n let value = GetOption(options, prop, 'string', dateTimeComponents[prop]);\n\n // 22. Set opt.[[]] to value.\n opt['[['+prop+']]'] = value;\n }\n\n // Assigned a value below\n let bestFormat;\n\n // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n let dataLocaleData = localeData[dataLocale];\n\n // 24. Let formats be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"formats\".\n // Note: we process the CLDR formats into the spec'd structure\n let formats = ToDateTimeFormats(dataLocaleData.formats);\n\n // 25. Let matcher be the result of calling the GetOption abstract operation with\n // arguments options, \"formatMatcher\", \"string\", a List containing the two String\n // values \"basic\" and \"best fit\", and \"best fit\".\n matcher = GetOption(options, 'formatMatcher', 'string', new List('basic', 'best fit'), 'best fit');\n\n // Optimization: caching the processed formats as a one time operation by\n // replacing the initial structure from localeData\n dataLocaleData.formats = formats;\n\n // 26. If matcher is \"basic\", then\n if (matcher === 'basic') {\n // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract\n // operation (defined below) with opt and formats.\n bestFormat = BasicFormatMatcher(opt, formats);\n\n // 28. Else\n } else {\n {\n // diverging\n let hr12 = GetOption(options, 'hour12', 'boolean'/*, undefined, undefined*/);\n opt.hour12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;\n }\n // 29. Let bestFormat be the result of calling the BestFitFormatMatcher\n // abstract operation (defined below) with opt and formats.\n bestFormat = BestFitFormatMatcher(opt, formats);\n }\n\n // 30. For each row in Table 3, except the header row, do\n for (let prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, prop))\n continue;\n\n // a. Let prop be the name given in the Property column of the row.\n // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of\n // bestFormat with argument prop.\n // c. If pDesc is not undefined, then\n if (hop.call(bestFormat, prop)) {\n // i. Let p be the result of calling the [[Get]] internal method of bestFormat\n // with argument prop.\n let p = bestFormat[prop];\n {\n // diverging\n p = bestFormat._ && hop.call(bestFormat._, prop) ? bestFormat._[prop] : p;\n }\n\n // ii. Set the [[]] internal property of dateTimeFormat to p.\n internal['[['+prop+']]'] = p;\n }\n }\n\n let pattern; // Assigned a value below\n\n // 31. Let hr12 be the result of calling the GetOption abstract operation with\n // arguments options, \"hour12\", \"boolean\", undefined, and undefined.\n let hr12 = GetOption(options, 'hour12', 'boolean'/*, undefined, undefined*/);\n\n // 32. If dateTimeFormat has an internal property [[hour]], then\n if (internal['[[hour]]']) {\n // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]]\n // internal method of dataLocaleData with argument \"hour12\".\n hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;\n\n // b. Set the [[hour12]] internal property of dateTimeFormat to hr12.\n internal['[[hour12]]'] = hr12;\n\n // c. If hr12 is true, then\n if (hr12 === true) {\n // i. Let hourNo0 be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"hourNo0\".\n let hourNo0 = dataLocaleData.hourNo0;\n\n // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0.\n internal['[[hourNo0]]'] = hourNo0;\n\n // iii. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern12\".\n pattern = bestFormat.pattern12;\n }\n\n // d. Else\n else\n // i. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n }\n\n // 33. Else\n else\n // a. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n\n // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern.\n internal['[[pattern]]'] = pattern;\n\n // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to\n // true.\n internal['[[initializedDateTimeFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3)\n dateTimeFormat.format = GetFormatDateTime.call(dateTimeFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return dateTimeFormat;\n}\n\n/**\n * Several DateTimeFormat algorithms use values from the following table, which provides\n * property names and allowable values for the components of date and time formats:\n */\nlet dateTimeComponents = {\n weekday: [ \"narrow\", \"short\", \"long\" ],\n era: [ \"narrow\", \"short\", \"long\" ],\n year: [ \"2-digit\", \"numeric\" ],\n month: [ \"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\" ],\n day: [ \"2-digit\", \"numeric\" ],\n hour: [ \"2-digit\", \"numeric\" ],\n minute: [ \"2-digit\", \"numeric\" ],\n second: [ \"2-digit\", \"numeric\" ],\n timeZoneName: [ \"short\", \"long\" ]\n};\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nfunction ToDateTimeFormats(formats) {\n if (Object.prototype.toString.call(formats) === '[object Array]') {\n return formats;\n }\n return createDateTimeFormats(formats);\n}\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nexport function ToDateTimeOptions (options, required, defaults) {\n // 1. If options is undefined, then let options be null, else let options be\n // ToObject(options).\n if (options === undefined)\n options = null;\n\n else {\n // (#12) options needs to be a Record, but it also needs to inherit properties\n let opt2 = toObject(options);\n options = new Record();\n\n for (let k in opt2)\n options[k] = opt2[k];\n }\n\n // 2. Let create be the standard built-in function object defined in ES5, 15.2.3.5.\n let create = objCreate;\n\n // 3. Let options be the result of calling the [[Call]] internal method of create with\n // undefined as the this value and an argument list containing the single item\n // options.\n options = create(options);\n\n // 4. Let needDefaults be true.\n let needDefaults = true;\n\n // 5. If required is \"date\" or \"any\", then\n if (required === 'date' || required === 'any') {\n // a. For each of the property names \"weekday\", \"year\", \"month\", \"day\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.weekday !== undefined || options.year !== undefined\n || options.month !== undefined || options.day !== undefined)\n needDefaults = false;\n }\n\n // 6. If required is \"time\" or \"any\", then\n if (required === 'time' || required === 'any') {\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.hour !== undefined || options.minute !== undefined || options.second !== undefined)\n needDefaults = false;\n }\n\n // 7. If needDefaults is true and defaults is either \"date\" or \"all\", then\n if (needDefaults && (defaults === 'date' || defaults === 'all'))\n // a. For each of the property names \"year\", \"month\", \"day\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.year = options.month = options.day = 'numeric';\n\n // 8. If needDefaults is true and defaults is either \"time\" or \"all\", then\n if (needDefaults && (defaults === 'time' || defaults === 'all'))\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.hour = options.minute = options.second = 'numeric';\n\n // 9. Return options.\n return options;\n}\n\n/**\n * When the BasicFormatMatcher abstract operation is called with two arguments options and\n * formats, the following steps are taken:\n */\nfunction BasicFormatMatcher (options, formats) {\n // 1. Let removalPenalty be 120.\n let removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n let additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n let longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n let longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n let shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n let shortMorePenalty = 3;\n\n // 7. Let bestScore be -Infinity.\n let bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n let bestFormat;\n\n // 9. Let i be 0.\n let i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n let len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n let format = formats[i];\n\n // b. Let score be 0.\n let score = 0;\n\n // c. For each property shown in Table 3:\n for (let property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property))\n continue;\n\n // i. Let optionsProp be options.[[]].\n let optionsProp = options['[['+ property +']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n let formatProp = hop.call(format, property) ? format[property] : undefined;\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined)\n score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined)\n score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n let values = [ '2-digit', 'numeric', 'narrow', 'short', 'long' ];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n let optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n let formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n let delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta === 2)\n score -= longMorePenalty;\n\n // 6. Else if delta = 1, decrease score by shortMorePenalty.\n else if (delta === 1)\n score -= shortMorePenalty;\n\n // 7. Else if delta = -1, decrease score by shortLessPenalty.\n else if (delta === -1)\n score -= shortLessPenalty;\n\n // 8. Else if delta = -2, decrease score by longLessPenalty.\n else if (delta === -2)\n score -= longLessPenalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/**\n * When the BestFitFormatMatcher abstract operation is called with two arguments options\n * and formats, it performs implementation dependent steps, which should return a set of\n * component representations that a typical user of the selected locale would perceive as\n * at least as good as the one returned by BasicFormatMatcher.\n *\n * This polyfill defines the algorithm to be the same as BasicFormatMatcher,\n * with the addition of bonus points awarded where the requested format is of\n * the same data type as the potentially matching format.\n *\n * This algo relies on the concept of closest distance matching described here:\n * http://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons\n * Typically a “best match” is found using a closest distance match, such as:\n *\n * Symbols requesting a best choice for the locale are replaced.\n * j → one of {H, k, h, K}; C → one of {a, b, B}\n * -> Covered by cldr.js matching process\n *\n * For fields with symbols representing the same type (year, month, day, etc):\n * Most symbols have a small distance from each other.\n * M ≅ L; E ≅ c; a ≅ b ≅ B; H ≅ k ≅ h ≅ K; ...\n * -> Covered by cldr.js matching process\n *\n * Width differences among fields, other than those marking text vs numeric, are given small distance from each other.\n * MMM ≅ MMMM\n * MM ≅ M\n * Numeric and text fields are given a larger distance from each other.\n * MMM ≈ MM\n * Symbols representing substantial differences (week of year vs week of month) are given much larger a distances from each other.\n * d ≋ D; ...\n * Missing or extra fields cause a match to fail. (But see Missing Skeleton Fields).\n *\n *\n * For example,\n *\n * { month: 'numeric', day: 'numeric' }\n *\n * should match\n *\n * { month: '2-digit', day: '2-digit' }\n *\n * rather than\n *\n * { month: 'short', day: 'numeric' }\n *\n * This makes sense because a user requesting a formatted date with numeric parts would\n * not expect to see the returned format containing narrow, short or long part names\n */\nfunction BestFitFormatMatcher (options, formats) {\n /** Diverging: this block implements the hack for single property configuration, eg.:\n *\n * `new Intl.DateTimeFormat('en', {day: 'numeric'})`\n *\n * should produce a single digit with the day of the month. This is needed because\n * CLDR `availableFormats` data structure doesn't cover these cases.\n */\n {\n const optionsPropNames = [];\n for (let property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property))\n continue;\n\n if (options['[['+ property +']]'] !== undefined) {\n optionsPropNames.push(property);\n }\n }\n if (optionsPropNames.length === 1) {\n const bestFormat = generateSyntheticFormat(optionsPropNames[0], options['[['+ optionsPropNames[0] +']]']);\n if (bestFormat) {\n return bestFormat;\n }\n }\n }\n\n // 1. Let removalPenalty be 120.\n let removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n let additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n let longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n let longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n let shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n let shortMorePenalty = 3;\n\n let patternPenalty = 2;\n\n let hour12Penalty = 1;\n\n // 7. Let bestScore be -Infinity.\n let bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n let bestFormat;\n\n // 9. Let i be 0.\n let i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n let len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n let format = formats[i];\n\n // b. Let score be 0.\n let score = 0;\n\n // c. For each property shown in Table 3:\n for (let property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property))\n continue;\n\n // i. Let optionsProp be options.[[]].\n let optionsProp = options['[['+ property +']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n let formatProp = hop.call(format, property) ? format[property] : undefined;\n\n // Diverging: using the default properties produced by the pattern/skeleton\n // to match it with user options, and apply a penalty\n let patternProp = hop.call(format._, property) ? format._[property] : undefined;\n if (optionsProp !== patternProp) {\n score -= patternPenalty;\n }\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined)\n score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined)\n score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n let values = [ '2-digit', 'numeric', 'narrow', 'short', 'long' ];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n let optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n let formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n let delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n {\n // diverging from spec\n // When the bestFit argument is true, subtract additional penalty where data types are not the same\n if ((formatPropIndex <= 1 && optionsPropIndex >= 2) || (formatPropIndex >= 2 && optionsPropIndex <= 1)) {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 0)\n score -= longMorePenalty;\n else if (delta < 0)\n score -= longLessPenalty;\n } else {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 1)\n score -= shortMorePenalty;\n else if (delta < -1)\n score -= shortLessPenalty;\n }\n }\n }\n }\n\n {\n // diverging to also take into consideration differences between 12 or 24 hours\n // which is special for the best fit only.\n if (format._.hour12 !== options.hour12) {\n score -= hour12Penalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/* 12.2.3 */internals.DateTimeFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['ca', 'nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.DateTimeFormat is called, the\n * following steps are taken:\n */\n/* 12.2.2 */\ndefineProperty(Intl.DateTimeFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]'))\n throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n let regexpRestore = createRegExpRestore(),\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * DateTimeFormat object.\n */\n/* 12.3.2 */defineProperty(Intl.DateTimeFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatDateTime\n});\n\nfunction GetFormatDateTime() {\n let internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]'])\n throw new TypeError('`this` value for format() is not an initialized Intl.DateTimeFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this DateTimeFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 0, that takes the argument date and\n // performs the following steps:\n let F = function (date = undefined) {\n // i. If date is not provided or is undefined, then let x be the\n // result as if by the expression Date.now() where Date.now is\n // the standard built-in function defined in ES5, 15.9.4.4.\n // ii. Else let x be ToNumber(date).\n // iii. Return the result of calling the FormatDateTime abstract\n // operation (defined below) with arguments this and x.\n let x = date === undefined ? Date.now() : toNumber(date);\n return FormatDateTime(this, x);\n };\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n let bf = fnBind.call(F, this);\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n}\n\nfunction formatToParts(date = undefined) {\n let internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n if (!internal || !internal['[[initializedDateTimeFormat]]'])\n throw new TypeError('`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.');\n\n let x = date === undefined ? Date.now() : toNumber(date);\n return FormatToPartsDateTime(this, x);\n}\n\nObject.defineProperty(Intl.DateTimeFormat.prototype, 'formatToParts', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: formatToParts\n});\n\nfunction CreateDateTimeParts(dateTimeFormat, x) {\n // 1. If x is not a finite Number, then throw a RangeError exception.\n if (!isFinite(x))\n throw new RangeError('Invalid valid date passed to format');\n\n let internal = dateTimeFormat.__getInternalProperties(secret);\n\n // Creating restore point for properties on the RegExp object... please wait\n /* let regexpRestore = */createRegExpRestore(); // ###TODO: review this\n\n // 2. Let locale be the value of the [[locale]] internal property of dateTimeFormat.\n let locale = internal['[[locale]]'];\n\n // 3. Let nf be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {useGrouping: false}) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n let nf = new Intl.NumberFormat([locale], {useGrouping: false});\n\n // 4. Let nf2 be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping:\n // false}) where Intl.NumberFormat is the standard built-in constructor defined in\n // 11.1.3.\n let nf2 = new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping: false});\n\n // 5. Let tm be the result of calling the ToLocalTime abstract operation (defined\n // below) with x, the value of the [[calendar]] internal property of dateTimeFormat,\n // and the value of the [[timeZone]] internal property of dateTimeFormat.\n let tm = ToLocalTime(x, internal['[[calendar]]'], internal['[[timeZone]]']);\n\n // 6. Let result be the value of the [[pattern]] internal property of dateTimeFormat.\n let pattern = internal['[[pattern]]'];\n\n // 7.\n let result = new List();\n\n // 8.\n let index = 0;\n\n // 9.\n let beginIndex = pattern.indexOf('{');\n\n // 10.\n let endIndex = 0;\n\n // Need the locale minus any extensions\n let dataLocale = internal['[[dataLocale]]'];\n\n // Need the calendar data from CLDR\n let localeData = internals.DateTimeFormat['[[localeData]]'][dataLocale].calendars;\n let ca = internal['[[calendar]]'];\n\n // 11.\n while (beginIndex !== -1) {\n let fv;\n // a.\n endIndex = pattern.indexOf('}', beginIndex);\n // b.\n if (endIndex === -1) {\n throw new Error('Unclosed pattern');\n }\n // c.\n if (beginIndex > index) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(index, beginIndex)\n });\n }\n // d.\n let p = pattern.substring(beginIndex + 1, endIndex);\n // e.\n if (dateTimeComponents.hasOwnProperty(p)) {\n // i. Let f be the value of the [[

]] internal property of dateTimeFormat.\n let f = internal['[['+ p +']]'];\n // ii. Let v be the value of tm.[[

]].\n let v = tm['[['+ p +']]'];\n // iii. If p is \"year\" and v ≤ 0, then let v be 1 - v.\n if (p === 'year' && v <= 0) {\n v = 1 - v;\n }\n // iv. If p is \"month\", then increase v by 1.\n else if (p === 'month') {\n v++;\n }\n // v. If p is \"hour\" and the value of the [[hour12]] internal property of\n // dateTimeFormat is true, then\n else if (p === 'hour' && internal['[[hour12]]'] === true) {\n // 1. Let v be v modulo 12.\n v = v % 12;\n // 2. If v is 0 and the value of the [[hourNo0]] internal property of\n // dateTimeFormat is true, then let v be 12.\n if (v === 0 && internal['[[hourNo0]]'] === true) {\n v = 12;\n }\n }\n\n // vi. If f is \"numeric\", then\n if (f === 'numeric') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments nf and v.\n fv = FormatNumber(nf, v);\n }\n // vii. Else if f is \"2-digit\", then\n else if (f === '2-digit') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // with arguments nf2 and v.\n fv = FormatNumber(nf2, v);\n // 2. If the length of fv is greater than 2, let fv be the substring of fv\n // containing the last two characters.\n if (fv.length > 2) {\n fv = fv.slice(-2);\n }\n }\n // viii. Else if f is \"narrow\", \"short\", or \"long\", then let fv be a String\n // value representing f in the desired form; the String value depends upon\n // the implementation and the effective locale and calendar of\n // dateTimeFormat. If p is \"month\", then the String value may also depend\n // on whether dateTimeFormat has a [[day]] internal property. If p is\n // \"timeZoneName\", then the String value may also depend on the value of\n // the [[inDST]] field of tm.\n else if (f in dateWidths) {\n switch (p) {\n case 'month':\n fv = resolveDateString(localeData, ca, 'months', f, tm['[['+ p +']]']);\n break;\n\n case 'weekday':\n try {\n fv = resolveDateString(localeData, ca, 'days', f, tm['[['+ p +']]']);\n // fv = resolveDateString(ca.days, f)[tm['[['+ p +']]']];\n } catch (e) {\n throw new Error('Could not find weekday data for locale '+locale);\n }\n break;\n\n case 'timeZoneName':\n fv = ''; // ###TODO\n break;\n\n case 'era':\n try {\n fv = resolveDateString(localeData, ca, 'eras', f, tm['[['+ p +']]']);\n } catch (e) {\n throw new Error('Could not find era data for locale '+locale);\n }\n break;\n\n default:\n fv = tm['[['+ p +']]'];\n }\n }\n // ix\n arrPush.call(result, {\n type: p,\n value: fv\n });\n // f.\n } else if (p === 'ampm') {\n // i.\n let v = tm['[[hour]]'];\n // ii./iii.\n fv = resolveDateString(localeData, ca, 'dayPeriods', v > 11 ? 'pm' : 'am', null);\n // iv.\n arrPush.call(result, {\n type: 'dayPeriod',\n value: fv\n });\n // g.\n } else {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(beginIndex, endIndex + 1)\n });\n }\n // h.\n index = endIndex + 1;\n // i.\n beginIndex = pattern.indexOf('{', index);\n }\n // 12.\n if (endIndex < pattern.length - 1) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substr(endIndex + 1)\n });\n }\n // 13.\n return result;\n}\n\n/**\n * When the FormatDateTime abstract operation is called with arguments dateTimeFormat\n * (which must be an object initialized as a DateTimeFormat) and x (which must be a Number\n * value), it returns a String value representing x (interpreted as a time value as\n * specified in ES5, 15.9.1.1) according to the effective locale and the formatting\n * options of dateTimeFormat.\n */\nexport function FormatDateTime(dateTimeFormat, x) {\n let parts = CreateDateTimeParts(dateTimeFormat, x);\n let result = '';\n\n for (let i = 0; parts.length > i; i++) {\n let part = parts[i];\n result += part.value;\n }\n return result;\n}\n\nfunction FormatToPartsDateTime(dateTimeFormat, x) {\n let parts = CreateDateTimeParts(dateTimeFormat, x);\n let result = [];\n for (let i = 0; parts.length > i; i++) {\n let part = parts[i];\n result.push({\n type: part.type,\n value: part.value\n });\n }\n return result;\n}\n\n\n/**\n * When the ToLocalTime abstract operation is called with arguments date, calendar, and\n * timeZone, the following steps are taken:\n */\nfunction ToLocalTime(date, calendar, timeZone) {\n // 1. Apply calendrical calculations on date for the given calendar and time zone to\n // produce weekday, era, year, month, day, hour, minute, second, and inDST values.\n // The calculations should use best available information about the specified\n // calendar and time zone. If the calendar is \"gregory\", then the calculations must\n // match the algorithms specified in ES5, 15.9.1, except that calculations are not\n // bound by the restrictions on the use of best available information on time zones\n // for local time zone adjustment and daylight saving time adjustment imposed by\n // ES5, 15.9.1.7 and 15.9.1.8.\n // ###TODO###\n let d = new Date(date),\n m = 'get' + (timeZone || '');\n\n // 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]],\n // [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding\n // calculated value.\n return new Record({\n '[[weekday]]': d[m + 'Day'](),\n '[[era]]' : +(d[m + 'FullYear']() >= 0),\n '[[year]]' : d[m + 'FullYear'](),\n '[[month]]' : d[m + 'Month'](),\n '[[day]]' : d[m + 'Date'](),\n '[[hour]]' : d[m + 'Hours'](),\n '[[minute]]' : d[m + 'Minutes'](),\n '[[second]]' : d[m + 'Seconds'](),\n '[[inDST]]' : false // ###TODO###\n });\n}\n\n/**\n * The function returns a new object whose properties and attributes are set as if\n * constructed by an object literal assigning to each of the following properties the\n * value of the corresponding internal property of this DateTimeFormat object (see 12.4):\n * locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day,\n * hour, minute, second, and timeZoneName. Properties whose corresponding internal\n * properties are not present are not assigned.\n */\n/* 12.3.3 */defineProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', {\n writable: true,\n configurable: true,\n value: function () {\n let prop,\n descs = new Record(),\n props = [\n 'locale', 'calendar', 'numberingSystem', 'timeZone', 'hour12', 'weekday',\n 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName'\n ],\n internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]'])\n throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.');\n\n for (let i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[[' + props[i] + ']]'))\n descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n","// Sect 13 Locale Sensitive Functions of the ECMAScript Language Specification\n// ===========================================================================\n\nimport {\n Intl\n} from \"./8.intl.js\";\n\nimport {\n FormatNumber,\n NumberFormatConstructor\n} from \"./11.numberformat.js\";\n\nimport {\n ToDateTimeOptions,\n DateTimeFormatConstructor,\n FormatDateTime\n} from \"./12.datetimeformat.js\";\n\nlet ls = Intl.__localeSensitiveProtos = {\n Number: {},\n Date: {}\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.2.1 */ls.Number.toLocaleString = function () {\n // Satisfy test 13.2.1_1\n if (Object.prototype.toString.call(this) !== '[object Number]')\n throw new TypeError('`this` value must be a number for Number.prototype.toLocaleString()');\n\n // 1. Let x be this Number value (as defined in ES5, 15.7.4).\n // 2. If locales is not provided, then let locales be undefined.\n // 3. If options is not provided, then let options be undefined.\n // 4. Let numberFormat be the result of creating a new object as if by the\n // expression new Intl.NumberFormat(locales, options) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n // 5. Return the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments numberFormat and x.\n return FormatNumber(new NumberFormatConstructor(arguments[0], arguments[1]), this);\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.3.1 */ls.Date.toLocaleString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]')\n throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n let x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x))\n return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n let locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n let options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"any\", and \"all\".\n options = ToDateTimeOptions(options, 'any', 'all');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n let dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleDateString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.2 */ls.Date.toLocaleDateString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]')\n throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleDateString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n let x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x))\n return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n let locales = arguments[0],\n\n // 4. If options is not provided, then let options be undefined.\n options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"date\", and \"date\".\n options = ToDateTimeOptions(options, 'date', 'date');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n let dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleTimeString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.3 */ls.Date.toLocaleTimeString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]')\n throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleTimeString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n let x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x))\n return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n let locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n let options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"time\", and \"time\".\n options = ToDateTimeOptions(options, 'time', 'time');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n let dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\nexport default ls;\n","/**\n * @license Copyright 2013 Andy Earnshaw, MIT License\n *\n * Implements the ECMAScript Internationalization API in ES5-compatible environments,\n * following the ECMA-402 specification as closely as possible\n *\n * ECMA-402: http://ecma-international.org/ecma-402/1.0/\n *\n * CLDR format locale data should be provided using IntlPolyfill.__addLocaleData().\n */\n\nimport {\n defineProperty,\n hop,\n arrPush,\n arrShift,\n internals\n} from \"./util.js\";\n\nimport {\n IsStructurallyValidLanguageTag,\n defaultLocale,\n setDefaultLocale\n} from \"./6.locales-currencies-tz.js\";\n\nimport {\n Intl\n} from \"./8.intl.js\";\n\nimport \"./11.numberformat.js\";\n\nimport \"./12.datetimeformat.js\";\n\nimport ls from \"./13.locale-sensitive-functions.js\";\n\ndefineProperty(Intl, '__applyLocaleSensitivePrototypes', {\n writable: true,\n configurable: true,\n value: function () {\n defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString });\n // Need this here for IE 8, to avoid the _DontEnum_ bug\n defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString });\n\n for (let k in ls.Date) {\n if (hop.call(ls.Date, k))\n defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] });\n }\n }\n});\n\n/**\n * Can't really ship a single script with data for hundreds of locales, so we provide\n * this __addLocaleData method as a means for the developer to add the data on an\n * as-needed basis\n */\ndefineProperty(Intl, '__addLocaleData', {\n value: function (data) {\n if (!IsStructurallyValidLanguageTag(data.locale))\n throw new Error(`Invalid language tag \"${data.locale}\" when calling __addLocaleData(\"${data.locale}\", ...) to register new locale data.`);\n\n addLocaleData(data, data.locale);\n }\n});\n\nfunction addLocaleData (data, tag) {\n // Both NumberFormat and DateTimeFormat require number data, so throw if it isn't present\n if (!data.number)\n throw new Error(\"Object passed doesn't contain locale data for Intl.NumberFormat\");\n\n let locale,\n locales = [ tag ],\n parts = tag.split('-');\n\n // Create fallbacks for locale data with scripts, e.g. Latn, Hans, Vaii, etc\n if (parts.length > 2 && parts[1].length === 4)\n arrPush.call(locales, parts[0] + '-' + parts[2]);\n\n while ((locale = arrShift.call(locales))) {\n // Add to NumberFormat internal properties as per 11.2.3\n arrPush.call(internals.NumberFormat['[[availableLocales]]'], locale);\n internals.NumberFormat['[[localeData]]'][locale] = data.number;\n\n // ...and DateTimeFormat internal properties as per 12.2.3\n if (data.date) {\n data.date.nu = data.number.nu;\n arrPush.call(internals.DateTimeFormat['[[availableLocales]]'], locale);\n internals.DateTimeFormat['[[localeData]]'][locale] = data.date;\n }\n }\n\n // If this is the first set of locale data added, make it the default\n if (defaultLocale === undefined)\n setDefaultLocale(tag);\n}\n\ndefineProperty(Intl, '__disableRegExpRestore', {\n value: function () {\n internals.disableRegExpRestore = true;\n }\n});\n\nexport default Intl;\n","import IntlPolyfill from \"./core.js\";\n\n// hack to export the polyfill as global Intl if needed\nif (typeof Intl === 'undefined') {\n try {\n window.Intl = IntlPolyfill;\n IntlPolyfill.__applyLocaleSensitivePrototypes();\n } catch (e) {\n // can be read only property\n }\n}\n\nexport default IntlPolyfill;\n"],"names":["realDefineProp","sentinel","defineProperty","writable","a","prototype","Object","e","es3","__defineGetter__","hop","hasOwnProperty","obj","name","desc","get","call","value","arrIndexOf","Array","indexOf","search","t","length","i","arguments","max","objCreate","create","proto","props","F","k","arrSlice","slice","arrConcat","concat","arrPush","push","arrJoin","join","arrShift","shift","fnBind","Function","bind","thisObj","fn","args","apply","internals","secret","Math","random","log10Floor","n","log10","floor","x","round","log","LOG10E","Number","Record","enumerable","configurable","List","createRegExpRestore","disableRegExpRestore","regExpCache","RegExp","lastMatch","leftContext","multiline","input","has","esc","replace","exprStr","m","substring","match","expr","lastIndex","exec","toObject","arg","TypeError","toNumber","toInteger","number","isNaN","Infinity","abs","toLength","len","pow","min","getInternalProperties","__getInternalProperties","extlang","language","script","region","variant","singleton","extension","privateuse","irregular","regular","grandfathered","langtag","expBCP47Syntax","expVariantDupes","expSingletonDupes","expExtSequences","defaultLocale","setDefaultLocale","locale","redundantTags","toLatinUpperCase","str","ch","charAt","toUpperCase","IsStructurallyValidLanguageTag","test","CanonicalizeLanguageTag","parts","toLowerCase","split","sort","source","tags","subtags","extLang","DefaultLocale","expCurrencyCode","IsWellFormedCurrencyCode","currency","c","String","normalized","expUnicodeExSeq","CanonicalizeLocaleList","locales","undefined","seen","O","Pk","kPresent","kValue","tag","RangeError","BestAvailableLocale","availableLocales","candidate","pos","lastIndexOf","LookupMatcher","requestedLocales","availableLocale","noExtensionsLocale","result","extensionIndex","BestFitMatcher","UnicodeExtensionSubtags","size","extensionSubtags","attribute","q","p","codePointAt","type","key","attr","tail","ResolveLocale","options","relevantExtensionKeys","localeData","ReferenceError","matcher","r","foundLocale","extensionSubtagsLength","supportedExtension","foundLocaleData","keyLocaleData","supportedExtensionAddition","keyPos","requestedValue","valuePos","optionsValue","privateIndex","preExtension","postExtension","LookupSupportedLocales","subset","subsetArray","BestFitSupportedLocales","SupportedLocales","localeMatcher","P","GetOption","property","values","fallback","Boolean","GetNumberOption","minimum","maximum","Intl","getCanonicalLocales","ll","currencyMinorUnits","BYR","XOF","BIF","XAF","CLF","CLP","KMF","DJF","GNF","ISK","IQD","JPY","JOD","KRW","KWD","LYD","PYG","RWF","TND","UGX","UYI","VUV","VND","NumberFormatConstructor","NumberFormat","InitializeNumberFormat","numberFormat","internal","regexpRestore","opt","dataLocale","s","cDigits","CurrencyDigits","cd","mnid","mnfdDefault","mnfd","mxfdDefault","mxfd","mnsd","minimumSignificantDigits","mxsd","maximumSignificantDigits","g","dataLocaleData","patterns","stylePatterns","positivePattern","negativePattern","format","GetFormatNumber","babelHelpers[\"typeof\"]","FormatNumber","bf","formatToParts","FormatNumberToParts","PartitionNumberPattern","part","FormatNumberToString","ToRawPrecision","ToRawFixed","nums","data","ild","symbols","latn","pattern","beginIndex","endIndex","nextIndex","Error","literal","nan","isFinite","infinity","numSys","digits","digit","integer","fraction","decimalSepIndex","groupSepSymbol","group","groups","pgSize","primaryGroupSize","sgSize","secondaryGroupSize","end","idx","start","integerGroup","decimalSepSymbol","decimal","plusSignSymbol","plusSign","minusSignSymbol","minusSign","percentSignSymbol","percentSign","currencies","minPrecision","maxPrecision","f","exp","LN10","cut","minInteger","minFraction","maxFraction","toFixed","int","z","b","prop","descs","expDTComponents","expPatternTrimmer","unwantedDTCs","dtKeys","tmKeys","isDateFormatOnly","isTimeFormatOnly","joinDateAndTimeFormats","dateFormatObj","timeFormatObj","o","_","j","computeFinalPatterns","formatObj","pattern12","extendedPattern","$0","expDTComponentsMeta","era","year","quarter","month","week","day","weekday","hour12","hour","minute","second","timeZoneName","createDateTimeFormat","skeleton","createDateTimeFormats","formats","availableFormats","timeFormats","dateFormats","computed","timeRelatedFormats","dateRelatedFormats","full","long","medium","short","originalPattern","validSyntheticProps","generateSyntheticFormat","propName","propValue","dateWidths","narrow","resolveDateString","ca","component","width","gregory","alts","resolved","DateTimeFormatConstructor","DateTimeFormat","InitializeDateTimeFormat","dateTimeFormat","ToDateTimeOptions","tz","timeZone","dateTimeComponents","bestFormat","ToDateTimeFormats","BasicFormatMatcher","hr12","BestFitFormatMatcher","hourNo0","GetFormatDateTime","toString","required","defaults","opt2","needDefaults","removalPenalty","additionPenalty","longLessPenalty","longMorePenalty","shortLessPenalty","shortMorePenalty","bestScore","score","optionsProp","formatProp","optionsPropIndex","formatPropIndex","delta","optionsPropNames","patternPenalty","hour12Penalty","patternProp","date","Date","now","FormatDateTime","FormatToPartsDateTime","CreateDateTimeParts","nf","useGrouping","nf2","minimumIntegerDigits","tm","ToLocalTime","index","calendars","fv","v","substr","calendar","d","ls","__localeSensitiveProtos","toLocaleString","toLocaleDateString","toLocaleTimeString","addLocaleData","nu","IntlPolyfill","__applyLocaleSensitivePrototypes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,iBAAkB,YAAY;QACxBC,WAAW,SAAXA,QAAW,GAAU,EAAzB;QACI;eACOC,cAAP,CAAsBD,QAAtB,EAAgC,GAAhC,EAAqC;iBAC5B,kBAAY;uBACN,CAAP;;SAFR;eAKOC,cAAP,CAAsBD,QAAtB,EAAgC,WAAhC,EAA6C,EAAEE,UAAU,KAAZ,EAA7C;eACOF,SAASG,CAAT,KAAe,CAAf,IAAoBH,SAASI,SAAT,YAA8BC,MAAzD;KAPJ,CAQE,OAAOC,CAAP,EAAU;eACD,KAAP;;CAXW,EAAvB;;;AAgBA,AAAO,IAAMC,MAAM,CAACR,cAAD,IAAmB,CAACM,OAAOD,SAAP,CAAiBI,gBAAjD;;;AAGP,AAAO,IAAMC,MAAMJ,OAAOD,SAAP,CAAiBM,cAA7B;;;AAGP,AAAO,IAAMT,oBAAiBF,iBAAiBM,OAAOJ,cAAxB,GAAyC,UAAUU,GAAV,EAAeC,IAAf,EAAqBC,IAArB,EAA2B;QAC1F,S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;;;;;QAKJzT,kBAAkB8B,SAAtB,EACI7B,iBAAiBmC,GAAjB;;;AAGRtJ,kBAAekN,MAAf,EAAqB,wBAArB,EAA+C;WACpC,iBAAY;kBACLhJ,oBAAV,GAAiC,IAAjC;;CAFR,EAMA;;ACnGA;AACA,IAAI,OAAOgJ,IAAP,KAAgB,WAApB,EAAiC;QACzB;eACOA,IAAP,GAAcmP,MAAd;eACaC,gCAAb;KAFJ,CAGE,OAAOjc,CAAP,EAAU;;;CAKhB;;;;"} \ No newline at end of file diff --git a/dist/Intl.min.js b/dist/Intl.min.js deleted file mode 100644 index 7e36d3ce..00000000 --- a/dist/Intl.min.js +++ /dev/null @@ -1,3 +0,0 @@ -!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.IntlPolyfill=r()}(this,function(){"use strict";function e(e){if("function"==typeof Math.log10)return Math.floor(Math.log10(e));var r=Math.round(Math.log(e)*Math.LOG10E);return r-(Number("1e"+r)>e)}function r(e){for(var n in e)(e instanceof r||ue.call(e,n))&&ge(this,n,{value:e[n],enumerable:!0,writable:!0,configurable:!0})}function n(){ge(this,"length",{writable:!0,value:0}),arguments.length&&de.apply(this,ve.call(arguments))}function t(){if(we.disableRegExpRestore)return function(){};for(var e={lastMatch:RegExp.lastMatch||"",leftContext:RegExp.leftContext,multiline:RegExp.multiline,input:RegExp.input},r=!1,n=1;n<=9;n++)r=(e["$"+n]=RegExp["$"+n])||r;return function(){var n=/[.?*+^$[\]\\(){}|-]/g,t=e.lastMatch.replace(n,"\\$&"),a="";if(r)for(var i=1;i<=9;i++){var o=e["$"+i];o?(o=o.replace(n,"\\$&"),a+=t.substring(0,t.indexOf(o))+"(",t=o+")"+t.substring(t.indexOf(o)+o.length)):(a+="(",t=")"+t)}a+=t,a=a.replace(/((^|[^\\])((\\\\)*\\[()])+|[^()])+/g,function(e){return"[\\s\\S]{"+e.replace(/\\(.)/g,"$1").length+"}"});var s=new RegExp(a,e.multiline?"gm":"g");s.lastIndex=e.leftContext.length,s.exec(e.input)}}function a(e){if(null===e)throw new TypeError("Cannot convert null or undefined to object");return"object"===("undefined"==typeof e?"undefined":oe(e))?e:Object(e)}function i(e){return"number"==typeof e?e:Number(e)}function o(e){var r=i(e);return isNaN(r)?0:0===r||r===-0||r===+(1/0)||r===-(1/0)?r:r<0?Math.floor(Math.abs(r))*-1:Math.floor(Math.abs(r))}function s(e){var r=o(e);return r<=0?0:r===1/0?Math.pow(2,53)-1:Math.min(r,Math.pow(2,53)-1)}function l(e){return ue.call(e,"__getInternalProperties")?e.__getInternalProperties(xe):fe(null)}function c(e){qe=e}function u(e){for(var r=e.length;r--;){var n=e.charAt(r);n>="a"&&n<="z"&&(e=e.slice(0,r)+n.toUpperCase()+e.slice(r+1))}return e}function g(e){return!!Me.test(e)&&(!Te.test(e)&&!Ie.test(e))}function m(e){var r=void 0,n=void 0;e=e.toLowerCase(),n=e.split("-");for(var t=1,a=n.length;t1&&(r.sort(),e=e.replace(RegExp("(?:"+Re.source+")+","i"),pe.call(r,""))),ue.call(Ae.tags,e)&&(e=Ae.tags[e]),n=e.split("-");for(var i=1,o=n.length;i-1)return n;var t=n.lastIndexOf("-");if(t<0)return;t>=2&&"-"===n.charAt(t-2)&&(t-=2),n=n.substring(0,t)}}function p(e,n){for(var t=0,a=n.length,i=void 0,o=void 0,s=void 0;t1){var l=e.substring(o,i-1);n.push(l)}var c=e.substring(i,a);n.push(c),o=a+1,t=!1}else if(t===!0){var u=e.substring(i,a);n.push(u),o=a+1}i=a+1}a+=1}if(r-i===2){if(i-o>1){var g=e.substring(o,i-1);n.push(g)}o=i}var m=e.substring(o,r);return n.push(m),n}function w(e,n,t,a,i){if(0===e.length)throw new ReferenceError("No locale data has been provided for this object yet.");var o=t["[[localeMatcher]]"],s=void 0;s="lookup"===o?p(e,n):b(e,n);var l=s["[[locale]]"],c=void 0,u=void 0;if(ue.call(s,"[[extension]]")){var g=s["[[extension]]"];c=y(g),u=c.length}var f=new r;f["[[dataLocale]]"]=l;for(var v="-u",h=0,d=a.length;h2){var S=c[j+1],L=F.call(D,S);L!==-1&&(z=S,k="-"+w+"-"+z)}else{var N=F(D,"true");N!==-1&&(z="true")}}if(ue.call(t,"[["+w+"]]")){var E=t["[["+w+"]]"];F.call(D,E)!==-1&&E!==z&&(z=E,k="")}f["[["+w+"]]"]=z,v+=k,h++}if(v.length>2){var O=l.indexOf("-x-");if(O===-1)l+=v;else{var P=l.substring(0,O),_=l.substring(O);l=P+v+_}l=m(l)}return f["[[locale]]"]=l,f}function x(e,r){for(var t=r.length,a=new n,i=0;it)throw new RangeError("Value is not a number or outside accepted range");return Math.floor(i)}return a}function j(e){for(var r=h(e),n=[],t=r.length,a=0;a0&&void 0!==arguments[0]?arguments[0]:void 0,r=null!==this&&"object"===oe(this)&&l(this);if(!r||!r["[[initializedNumberFormat]]"])throw new TypeError("`this` value for formatToParts() is not an initialized Intl.NumberFormat object.");var n=Number(e);return P(this,n)}function P(e,r){for(var n=M(e,r),t=[],a=0,i=0;n.length>i;i++){var o=n[i],s={};s.type=o["[[type]]"],s.value=o["[[value]]"],t[a]=s,a+=1}return t}function _(e,r){var n=l(e),t=void 0;return t=ue.call(n,"[[minimumSignificantDigits]]")&&ue.call(n,"[[maximumSignificantDigits]]")?I(r,n["[[minimumSignificantDigits]]"],n["[[maximumSignificantDigits]]"]):R(r,n["[[minimumIntegerDigits]]"],n["[[minimumFractionDigits]]"],n["[[maximumFractionDigits]]"])}function M(e,r){var t=l(e),a=t["[[dataLocale]]"],i=t["[[numberingSystem]]"],o=we.NumberFormat["[[localeData]]"][a],s=o.symbols[i]||o.symbols.latn,c=void 0;!isNaN(r)&&r<0?(r=-r,c=t["[[negativePattern]]"]):c=t["[[positivePattern]]"];for(var u=new n,g=c.indexOf("{",0),m=0,f=0,v=c.length;g>-1&&gf){var h=c.substring(f,g);de.call(u,{"[[type]]":"literal","[[value]]":h})}var d=c.substring(g+1,m);if("number"===d)if(isNaN(r)){var p=s.nan;de.call(u,{"[[type]]":"nan","[[value]]":p})}else if(isFinite(r)){"percent"===t["[[style]]"]&&(r*=100);var b=_(e,r);Ue[i]?!function(){var e=Ue[i];b=String(b).replace(/\d/g,function(r){return e[r]})}():b=String(b);var y=void 0,w=void 0,x=b.indexOf(".",0);if(x>0?(y=b.substring(0,x),w=b.substring(x+1,x.length)):(y=b,w=void 0),t["[[useGrouping]]"]===!0){var D=s.group,z=[],k=o.patterns.primaryGroupSize||3,F=o.patterns.secondaryGroupSize||k;if(y.length>k){var j=y.length-k,S=j%F,L=y.slice(0,S);for(L.length&&de.call(z,L);Sa;a++){var i=n[a];t+=i["[[value]]"]}return t}function I(r,n,t){var a=t,i=void 0,o=void 0;if(0===r)i=pe.call(Array(a+1),"0"),o=0;else{o=e(Math.abs(r));var s=Math.round(Math.exp(Math.abs(o-a+1)*Math.LN10));i=String(Math.round(o-a+1<0?r*s:r/s))}if(o>=a)return i+pe.call(Array(o-a+1+1),"0");if(o===a-1)return i;if(o>=0?i=i.slice(0,o+1)+"."+i.slice(o+1):o<0&&(i="0."+pe.call(Array(-(o+1)+1),"0")+i),i.indexOf(".")>=0&&t>n){for(var l=t-n;l>0&&"0"===i.charAt(i.length-1);)i=i.slice(0,-1),l--;"."===i.charAt(i.length-1)&&(i=i.slice(0,-1))}return i}function R(e,r,n,t){var a=t,i=Math.pow(10,a)*e,o=0===i?"0":i.toFixed(0),s=void 0,l=(s=o.indexOf("e"))>-1?o.slice(s+1):0;l&&(o=o.slice(0,s).replace(".",""),o+=pe.call(Array(l-(o.length-1)+1),"0"));var c=void 0;if(0!==a){var u=o.length;if(u<=a){var g=pe.call(Array(a+1-u+1),"0");o=g+o,u=a+1}var m=o.substring(0,u-a),f=o.substring(u-a,o.length);o=m+"."+f,c=m.length}else c=o.length;for(var v=t-n;v>0&&"0"===o.slice(-1);)o=o.slice(0,-1),v--;if("."===o.slice(-1)&&(o=o.slice(0,-1)),cl&&(l=f,c=m),u++}return c}function J(e,r){var n=[];for(var t in Je)ue.call(Je,t)&&void 0!==e["[["+t+"]]"]&&n.push(t);if(1===n.length){var a=$(n[0],e["[["+n[0]+"]]"]);if(a)return a}for(var i=120,o=20,s=8,l=6,c=6,u=3,g=2,m=1,f=-(1/0),v=void 0,h=0,d=r.length;h=2||F>=2&&k<=1?j>0?b-=l:j<0&&(b-=s):j>1?b-=u:j<-1&&(b-=c)}}p._.hour12!==e.hour12&&(b-=m),b>f&&(f=b,v=p),h++}return v}function Q(){var e=null!==this&&"object"===oe(this)&&l(this);if(!e||!e["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for format() is not an initialized Intl.DateTimeFormat object.");if(void 0===e["[[boundFormat]]"]){var r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=void 0===e?Date.now():i(e);return ne(this,r)},n=ye.call(r,this);e["[[boundFormat]]"]=n}return e["[[boundFormat]]"]}function ee(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=null!==this&&"object"===oe(this)&&l(this);if(!r||!r["[[initializedDateTimeFormat]]"])throw new TypeError("`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.");var n=void 0===e?Date.now():i(e);return te(this,n)}function re(e,r){if(!isFinite(r))throw new RangeError("Invalid valid date passed to format");var a=e.__getInternalProperties(xe);t();for(var i=a["[[locale]]"],o=new Ze.NumberFormat([i],{useGrouping:!1}),s=new Ze.NumberFormat([i],{minimumIntegerDigits:2,useGrouping:!1}),l=ae(r,a["[[calendar]]"],a["[[timeZone]]"]),c=a["[[pattern]]"],u=new n,g=0,m=c.indexOf("{"),f=0,v=a["[[dataLocale]]"],h=we.DateTimeFormat["[[localeData]]"][v].calendars,d=a["[[calendar]]"];m!==-1;){var p=void 0;if(f=c.indexOf("}",m),f===-1)throw new Error("Unclosed pattern");m>g&&de.call(u,{type:"literal",value:c.substring(g,m)});var b=c.substring(m+1,f);if(Je.hasOwnProperty(b)){var y=a["[["+b+"]]"],w=l["[["+b+"]]"];if("year"===b&&w<=0?w=1-w:"month"===b?w++:"hour"===b&&a["[[hour12]]"]===!0&&(w%=12,0===w&&a["[[hourNo0]]"]===!0&&(w=12)),"numeric"===y)p=T(o,w);else if("2-digit"===y)p=T(s,w),p.length>2&&(p=p.slice(-2));else if(y in We)switch(b){case"month":p=K(h,d,"months",y,l["[["+b+"]]"]);break;case"weekday":try{p=K(h,d,"days",y,l["[["+b+"]]"])}catch(e){throw new Error("Could not find weekday data for locale "+i)}break;case"timeZoneName":p="";break;case"era":try{p=K(h,d,"eras",y,l["[["+b+"]]"])}catch(e){throw new Error("Could not find era data for locale "+i)}break;default:p=l["[["+b+"]]"]}de.call(u,{type:b,value:p})}else if("ampm"===b){var x=l["[[hour]]"];p=K(h,d,"dayPeriods",x>11?"pm":"am",null),de.call(u,{type:"dayPeriod",value:p})}else de.call(u,{type:"literal",value:c.substring(m,f+1)});g=f+1,m=c.indexOf("{",g)}return fa;a++){var i=n[a];t+=i.value}return t}function te(e,r){for(var n=re(e,r),t=[],a=0;n.length>a;a++){var i=n[a];t.push({type:i.type,value:i.value})}return t}function ae(e,n,t){var a=new Date(e),i="get"+(t||"");return new r({"[[weekday]]":a[i+"Day"](),"[[era]]":+(a[i+"FullYear"]()>=0),"[[year]]":a[i+"FullYear"](),"[[month]]":a[i+"Month"](),"[[day]]":a[i+"Date"](),"[[hour]]":a[i+"Hours"](),"[[minute]]":a[i+"Minutes"](),"[[second]]":a[i+"Seconds"](),"[[inDST]]":!1})}function ie(e,r){if(!e.number)throw new Error("Object passed doesn't contain locale data for Intl.NumberFormat");var n=void 0,t=[r],a=r.split("-");for(a.length>2&&4===a[1].length&&de.call(t,a[0]+"-"+a[2]);n=be.call(t);)de.call(we.NumberFormat["[[availableLocales]]"],n),we.NumberFormat["[[localeData]]"][n]=e.number,e.date&&(e.date.nu=e.number.nu,de.call(we.DateTimeFormat["[[availableLocales]]"],n),we.DateTimeFormat["[[localeData]]"][n]=e.date);void 0===qe&&c(r)}var oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},se=function(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e},le=function(){var e=function(){};try{return Object.defineProperty(e,"a",{get:function(){return 1}}),Object.defineProperty(e,"prototype",{writable:!1}),1===e.a&&e.prototype instanceof Object}catch(e){return!1}}(),ce=!le&&!Object.prototype.__defineGetter__,ue=Object.prototype.hasOwnProperty,ge=le?Object.defineProperty:function(e,r,n){"get"in n&&e.__defineGetter__?e.__defineGetter__(r,n.get):(!ue.call(e,r)||"value"in n)&&(e[r]=n.value)},me=Array.prototype.indexOf||function(e){var r=this;if(!r.length)return-1;for(var n=arguments[1]||0,t=r.length;n n);\n}\n\n/**\n * A map that doesn't contain Object in its prototype chain\n */\nexport function Record (obj) {\n // Copy only own properties over unless this object is already a Record instance\n for (let k in obj) {\n if (obj instanceof Record || hop.call(obj, k))\n defineProperty(this, k, { value: obj[k], enumerable: true, writable: true, configurable: true });\n }\n}\nRecord.prototype = objCreate(null);\n\n/**\n * An ordered list\n */\nexport function List() {\n defineProperty(this, 'length', { writable:true, value: 0 });\n\n if (arguments.length)\n arrPush.apply(this, arrSlice.call(arguments));\n}\nList.prototype = objCreate(null);\n\n/**\n * Constructs a regular expression to restore tainted RegExp properties\n */\nexport function createRegExpRestore () {\n if (internals.disableRegExpRestore) {\n return function() { /* no-op */ };\n }\n\n let regExpCache = {\n lastMatch: RegExp.lastMatch || '',\n leftContext: RegExp.leftContext,\n multiline: RegExp.multiline,\n input: RegExp.input\n },\n has = false;\n\n // Create a snapshot of all the 'captured' properties\n for (let i = 1; i <= 9; i++)\n has = (regExpCache['$'+i] = RegExp['$'+i]) || has;\n\n return function() {\n // Now we've snapshotted some properties, escape the lastMatch string\n let esc = /[.?*+^$[\\]\\\\(){}|-]/g,\n lastMatch = regExpCache.lastMatch.replace(esc, '\\\\$&'),\n exprStr = '';\n\n // If any of the captured strings were non-empty, iterate over them all\n if (has) {\n for (let i = 1; i <= 9; i++) {\n let m = regExpCache['$'+i];\n\n // If it's empty, add an empty capturing group\n if (!m) {\n exprStr += '(';\n lastMatch = ')' + lastMatch;\n }\n // Else find the string in lm and escape & wrap it to capture it\n else {\n m = m.replace(esc, '\\\\$&');\n exprStr += lastMatch.substring(0, lastMatch.indexOf(m)) + '(';\n lastMatch = m + ')' + lastMatch.substring(lastMatch.indexOf(m) + m.length);\n }\n }\n }\n\n exprStr += lastMatch;\n\n // Shorten the regex by replacing each part of the expression with a match\n // for a string of that exact length. This is safe for the type of\n // expressions generated above, because the expression matches the whole\n // match string, so we know each group and each segment between capturing\n // groups can be matched by its length alone.\n //\n // The purpose of the regex is to match sequences of characters other\n // than unescaped parentheses. This is a more complicated requirement\n // than it seems at first glance, because it's necessary to match a\n // parenthesis which appears immediately after a backslash (\"\\(\"), but\n // not a parenthesis which appears immediately after an escaped backslash\n // (\"\\\\(\"). We can't simply match [^\\\\]\\\\(, because the previous\n // backslash could itself have a backslash preceding (and escaping) it.\n //\n // Any attempts to simplify this regex are encouraged! A replacement\n // regex should match the strings \"a\\\\\\(\\\\\\)\\\\\" and \"a\\\\\\)\\\\\\(\" in the\n // test string \"a\\\\\\(\\\\\\)\\\\(a\\\\\\)\\\\\\()\".\n exprStr = exprStr.replace(/((^|[^\\\\])((\\\\\\\\)*\\\\[()])+|[^()])+/g, (match) => {\n return `[\\\\s\\\\S]{${match.replace(/\\\\(.)/g, '$1').length}}`;\n });\n\n // Create the regular expression that will reconstruct the RegExp properties\n let expr = new RegExp(exprStr, regExpCache.multiline ? 'gm' : 'g');\n\n // Set the lastIndex of the generated expression to ensure that the match\n // is found in the correct index.\n expr.lastIndex = regExpCache.leftContext.length;\n\n expr.exec(regExpCache.input);\n };\n}\n\n/**\n * Mimics ES5's abstract ToObject() function\n */\nexport function toObject (arg) {\n if (arg === null)\n throw new TypeError('Cannot convert null or undefined to object');\n\n if (typeof arg === 'object')\n return arg;\n return Object(arg);\n}\n\nexport function toNumber (arg) {\n if (typeof arg === 'number')\n return arg;\n return Number(arg);\n}\n\nexport function toInteger (arg) {\n let number = toNumber(arg);\n if (isNaN(number))\n return 0;\n if (number === +0 ||\n number === -0 ||\n number === +Infinity ||\n number === -Infinity)\n return number;\n if (number < 0)\n return Math.floor(Math.abs(number)) * -1;\n return Math.floor(Math.abs(number));\n}\n\nexport function toLength (arg) {\n let len = toInteger(arg);\n if (len <= 0)\n return 0;\n if (len === Infinity)\n return Math.pow(2, 53) - 1;\n return Math.min(len, Math.pow(2, 53) - 1);\n}\n\n/**\n * Returns \"internal\" properties for an object\n */\nexport function getInternalProperties (obj) {\n if (hop.call(obj, '__getInternalProperties'))\n return obj.__getInternalProperties(secret);\n\n return objCreate(null);\n}\n","// Sect 6.2 Language Tags\n// ======================\n\nimport {\n expBCP47Syntax,\n expExtSequences,\n expVariantDupes,\n expSingletonDupes\n} from './exp';\n\nimport {\n hop,\n arrJoin,\n arrSlice\n} from \"./util.js\";\n\n// Default locale is the first-added locale data for us\nexport let defaultLocale;\nexport function setDefaultLocale(locale) {\n defaultLocale = locale;\n}\n\n// IANA Subtag Registry redundant tag and subtag maps\nconst redundantTags = {\n tags: {\n \"art-lojban\": \"jbo\",\n \"i-ami\": \"ami\",\n \"i-bnn\": \"bnn\",\n \"i-hak\": \"hak\",\n \"i-klingon\": \"tlh\",\n \"i-lux\": \"lb\",\n \"i-navajo\": \"nv\",\n \"i-pwn\": \"pwn\",\n \"i-tao\": \"tao\",\n \"i-tay\": \"tay\",\n \"i-tsu\": \"tsu\",\n \"no-bok\": \"nb\",\n \"no-nyn\": \"nn\",\n \"sgn-BE-FR\": \"sfb\",\n \"sgn-BE-NL\": \"vgt\",\n \"sgn-CH-DE\": \"sgg\",\n \"zh-guoyu\": \"cmn\",\n \"zh-hakka\": \"hak\",\n \"zh-min-nan\": \"nan\",\n \"zh-xiang\": \"hsn\",\n \"sgn-BR\": \"bzs\",\n \"sgn-CO\": \"csn\",\n \"sgn-DE\": \"gsg\",\n \"sgn-DK\": \"dsl\",\n \"sgn-ES\": \"ssp\",\n \"sgn-FR\": \"fsl\",\n \"sgn-GB\": \"bfi\",\n \"sgn-GR\": \"gss\",\n \"sgn-IE\": \"isg\",\n \"sgn-IT\": \"ise\",\n \"sgn-JP\": \"jsl\",\n \"sgn-MX\": \"mfs\",\n \"sgn-NI\": \"ncs\",\n \"sgn-NL\": \"dse\",\n \"sgn-NO\": \"nsl\",\n \"sgn-PT\": \"psr\",\n \"sgn-SE\": \"swl\",\n \"sgn-US\": \"ase\",\n \"sgn-ZA\": \"sfs\",\n \"zh-cmn\": \"cmn\",\n \"zh-cmn-Hans\": \"cmn-Hans\",\n \"zh-cmn-Hant\": \"cmn-Hant\",\n \"zh-gan\": \"gan\",\n \"zh-wuu\": \"wuu\",\n \"zh-yue\": \"yue\"\n },\n subtags: {\n BU: \"MM\",\n DD: \"DE\",\n FX: \"FR\",\n TP: \"TL\",\n YD: \"YE\",\n ZR: \"CD\",\n heploc: \"alalc97\",\n 'in': \"id\",\n iw: \"he\",\n ji: \"yi\",\n jw: \"jv\",\n mo: \"ro\",\n ayx: \"nun\",\n bjd: \"drl\",\n ccq: \"rki\",\n cjr: \"mom\",\n cka: \"cmr\",\n cmk: \"xch\",\n drh: \"khk\",\n drw: \"prs\",\n gav: \"dev\",\n hrr: \"jal\",\n ibi: \"opa\",\n kgh: \"kml\",\n lcq: \"ppr\",\n mst: \"mry\",\n myt: \"mry\",\n sca: \"hle\",\n tie: \"ras\",\n tkk: \"twm\",\n tlw: \"weo\",\n tnf: \"prs\",\n ybd: \"rki\",\n yma: \"lrr\"\n },\n extLang: {\n aao: [\"aao\", \"ar\"],\n abh: [\"abh\", \"ar\"],\n abv: [\"abv\", \"ar\"],\n acm: [\"acm\", \"ar\"],\n acq: [\"acq\", \"ar\"],\n acw: [\"acw\", \"ar\"],\n acx: [\"acx\", \"ar\"],\n acy: [\"acy\", \"ar\"],\n adf: [\"adf\", \"ar\"],\n ads: [\"ads\", \"sgn\"],\n aeb: [\"aeb\", \"ar\"],\n aec: [\"aec\", \"ar\"],\n aed: [\"aed\", \"sgn\"],\n aen: [\"aen\", \"sgn\"],\n afb: [\"afb\", \"ar\"],\n afg: [\"afg\", \"sgn\"],\n ajp: [\"ajp\", \"ar\"],\n apc: [\"apc\", \"ar\"],\n apd: [\"apd\", \"ar\"],\n arb: [\"arb\", \"ar\"],\n arq: [\"arq\", \"ar\"],\n ars: [\"ars\", \"ar\"],\n ary: [\"ary\", \"ar\"],\n arz: [\"arz\", \"ar\"],\n ase: [\"ase\", \"sgn\"],\n asf: [\"asf\", \"sgn\"],\n asp: [\"asp\", \"sgn\"],\n asq: [\"asq\", \"sgn\"],\n asw: [\"asw\", \"sgn\"],\n auz: [\"auz\", \"ar\"],\n avl: [\"avl\", \"ar\"],\n ayh: [\"ayh\", \"ar\"],\n ayl: [\"ayl\", \"ar\"],\n ayn: [\"ayn\", \"ar\"],\n ayp: [\"ayp\", \"ar\"],\n bbz: [\"bbz\", \"ar\"],\n bfi: [\"bfi\", \"sgn\"],\n bfk: [\"bfk\", \"sgn\"],\n bjn: [\"bjn\", \"ms\"],\n bog: [\"bog\", \"sgn\"],\n bqn: [\"bqn\", \"sgn\"],\n bqy: [\"bqy\", \"sgn\"],\n btj: [\"btj\", \"ms\"],\n bve: [\"bve\", \"ms\"],\n bvl: [\"bvl\", \"sgn\"],\n bvu: [\"bvu\", \"ms\"],\n bzs: [\"bzs\", \"sgn\"],\n cdo: [\"cdo\", \"zh\"],\n cds: [\"cds\", \"sgn\"],\n cjy: [\"cjy\", \"zh\"],\n cmn: [\"cmn\", \"zh\"],\n coa: [\"coa\", \"ms\"],\n cpx: [\"cpx\", \"zh\"],\n csc: [\"csc\", \"sgn\"],\n csd: [\"csd\", \"sgn\"],\n cse: [\"cse\", \"sgn\"],\n csf: [\"csf\", \"sgn\"],\n csg: [\"csg\", \"sgn\"],\n csl: [\"csl\", \"sgn\"],\n csn: [\"csn\", \"sgn\"],\n csq: [\"csq\", \"sgn\"],\n csr: [\"csr\", \"sgn\"],\n czh: [\"czh\", \"zh\"],\n czo: [\"czo\", \"zh\"],\n doq: [\"doq\", \"sgn\"],\n dse: [\"dse\", \"sgn\"],\n dsl: [\"dsl\", \"sgn\"],\n dup: [\"dup\", \"ms\"],\n ecs: [\"ecs\", \"sgn\"],\n esl: [\"esl\", \"sgn\"],\n esn: [\"esn\", \"sgn\"],\n eso: [\"eso\", \"sgn\"],\n eth: [\"eth\", \"sgn\"],\n fcs: [\"fcs\", \"sgn\"],\n fse: [\"fse\", \"sgn\"],\n fsl: [\"fsl\", \"sgn\"],\n fss: [\"fss\", \"sgn\"],\n gan: [\"gan\", \"zh\"],\n gds: [\"gds\", \"sgn\"],\n gom: [\"gom\", \"kok\"],\n gse: [\"gse\", \"sgn\"],\n gsg: [\"gsg\", \"sgn\"],\n gsm: [\"gsm\", \"sgn\"],\n gss: [\"gss\", \"sgn\"],\n gus: [\"gus\", \"sgn\"],\n hab: [\"hab\", \"sgn\"],\n haf: [\"haf\", \"sgn\"],\n hak: [\"hak\", \"zh\"],\n hds: [\"hds\", \"sgn\"],\n hji: [\"hji\", \"ms\"],\n hks: [\"hks\", \"sgn\"],\n hos: [\"hos\", \"sgn\"],\n hps: [\"hps\", \"sgn\"],\n hsh: [\"hsh\", \"sgn\"],\n hsl: [\"hsl\", \"sgn\"],\n hsn: [\"hsn\", \"zh\"],\n icl: [\"icl\", \"sgn\"],\n ils: [\"ils\", \"sgn\"],\n inl: [\"inl\", \"sgn\"],\n ins: [\"ins\", \"sgn\"],\n ise: [\"ise\", \"sgn\"],\n isg: [\"isg\", \"sgn\"],\n isr: [\"isr\", \"sgn\"],\n jak: [\"jak\", \"ms\"],\n jax: [\"jax\", \"ms\"],\n jcs: [\"jcs\", \"sgn\"],\n jhs: [\"jhs\", \"sgn\"],\n jls: [\"jls\", \"sgn\"],\n jos: [\"jos\", \"sgn\"],\n jsl: [\"jsl\", \"sgn\"],\n jus: [\"jus\", \"sgn\"],\n kgi: [\"kgi\", \"sgn\"],\n knn: [\"knn\", \"kok\"],\n kvb: [\"kvb\", \"ms\"],\n kvk: [\"kvk\", \"sgn\"],\n kvr: [\"kvr\", \"ms\"],\n kxd: [\"kxd\", \"ms\"],\n lbs: [\"lbs\", \"sgn\"],\n lce: [\"lce\", \"ms\"],\n lcf: [\"lcf\", \"ms\"],\n liw: [\"liw\", \"ms\"],\n lls: [\"lls\", \"sgn\"],\n lsg: [\"lsg\", \"sgn\"],\n lsl: [\"lsl\", \"sgn\"],\n lso: [\"lso\", \"sgn\"],\n lsp: [\"lsp\", \"sgn\"],\n lst: [\"lst\", \"sgn\"],\n lsy: [\"lsy\", \"sgn\"],\n ltg: [\"ltg\", \"lv\"],\n lvs: [\"lvs\", \"lv\"],\n lzh: [\"lzh\", \"zh\"],\n max: [\"max\", \"ms\"],\n mdl: [\"mdl\", \"sgn\"],\n meo: [\"meo\", \"ms\"],\n mfa: [\"mfa\", \"ms\"],\n mfb: [\"mfb\", \"ms\"],\n mfs: [\"mfs\", \"sgn\"],\n min: [\"min\", \"ms\"],\n mnp: [\"mnp\", \"zh\"],\n mqg: [\"mqg\", \"ms\"],\n mre: [\"mre\", \"sgn\"],\n msd: [\"msd\", \"sgn\"],\n msi: [\"msi\", \"ms\"],\n msr: [\"msr\", \"sgn\"],\n mui: [\"mui\", \"ms\"],\n mzc: [\"mzc\", \"sgn\"],\n mzg: [\"mzg\", \"sgn\"],\n mzy: [\"mzy\", \"sgn\"],\n nan: [\"nan\", \"zh\"],\n nbs: [\"nbs\", \"sgn\"],\n ncs: [\"ncs\", \"sgn\"],\n nsi: [\"nsi\", \"sgn\"],\n nsl: [\"nsl\", \"sgn\"],\n nsp: [\"nsp\", \"sgn\"],\n nsr: [\"nsr\", \"sgn\"],\n nzs: [\"nzs\", \"sgn\"],\n okl: [\"okl\", \"sgn\"],\n orn: [\"orn\", \"ms\"],\n ors: [\"ors\", \"ms\"],\n pel: [\"pel\", \"ms\"],\n pga: [\"pga\", \"ar\"],\n pks: [\"pks\", \"sgn\"],\n prl: [\"prl\", \"sgn\"],\n prz: [\"prz\", \"sgn\"],\n psc: [\"psc\", \"sgn\"],\n psd: [\"psd\", \"sgn\"],\n pse: [\"pse\", \"ms\"],\n psg: [\"psg\", \"sgn\"],\n psl: [\"psl\", \"sgn\"],\n pso: [\"pso\", \"sgn\"],\n psp: [\"psp\", \"sgn\"],\n psr: [\"psr\", \"sgn\"],\n pys: [\"pys\", \"sgn\"],\n rms: [\"rms\", \"sgn\"],\n rsi: [\"rsi\", \"sgn\"],\n rsl: [\"rsl\", \"sgn\"],\n sdl: [\"sdl\", \"sgn\"],\n sfb: [\"sfb\", \"sgn\"],\n sfs: [\"sfs\", \"sgn\"],\n sgg: [\"sgg\", \"sgn\"],\n sgx: [\"sgx\", \"sgn\"],\n shu: [\"shu\", \"ar\"],\n slf: [\"slf\", \"sgn\"],\n sls: [\"sls\", \"sgn\"],\n sqk: [\"sqk\", \"sgn\"],\n sqs: [\"sqs\", \"sgn\"],\n ssh: [\"ssh\", \"ar\"],\n ssp: [\"ssp\", \"sgn\"],\n ssr: [\"ssr\", \"sgn\"],\n svk: [\"svk\", \"sgn\"],\n swc: [\"swc\", \"sw\"],\n swh: [\"swh\", \"sw\"],\n swl: [\"swl\", \"sgn\"],\n syy: [\"syy\", \"sgn\"],\n tmw: [\"tmw\", \"ms\"],\n tse: [\"tse\", \"sgn\"],\n tsm: [\"tsm\", \"sgn\"],\n tsq: [\"tsq\", \"sgn\"],\n tss: [\"tss\", \"sgn\"],\n tsy: [\"tsy\", \"sgn\"],\n tza: [\"tza\", \"sgn\"],\n ugn: [\"ugn\", \"sgn\"],\n ugy: [\"ugy\", \"sgn\"],\n ukl: [\"ukl\", \"sgn\"],\n uks: [\"uks\", \"sgn\"],\n urk: [\"urk\", \"ms\"],\n uzn: [\"uzn\", \"uz\"],\n uzs: [\"uzs\", \"uz\"],\n vgt: [\"vgt\", \"sgn\"],\n vkk: [\"vkk\", \"ms\"],\n vkt: [\"vkt\", \"ms\"],\n vsi: [\"vsi\", \"sgn\"],\n vsl: [\"vsl\", \"sgn\"],\n vsv: [\"vsv\", \"sgn\"],\n wuu: [\"wuu\", \"zh\"],\n xki: [\"xki\", \"sgn\"],\n xml: [\"xml\", \"sgn\"],\n xmm: [\"xmm\", \"ms\"],\n xms: [\"xms\", \"sgn\"],\n yds: [\"yds\", \"sgn\"],\n ysl: [\"ysl\", \"sgn\"],\n yue: [\"yue\", \"zh\"],\n zib: [\"zib\", \"sgn\"],\n zlm: [\"zlm\", \"ms\"],\n zmi: [\"zmi\", \"ms\"],\n zsl: [\"zsl\", \"sgn\"],\n zsm: [\"zsm\", \"ms\"]\n }\n};\n\n/**\n * Convert only a-z to uppercase as per section 6.1 of the spec\n */\nexport function toLatinUpperCase (str) {\n let i = str.length;\n\n while (i--) {\n let ch = str.charAt(i);\n\n if (ch >= \"a\" && ch <= \"z\")\n str = str.slice(0, i) + ch.toUpperCase() + str.slice(i+1);\n }\n\n return str;\n}\n\n/**\n * The IsStructurallyValidLanguageTag abstract operation verifies that the locale\n * argument (which must be a String value)\n *\n * - represents a well-formed BCP 47 language tag as specified in RFC 5646 section\n * 2.1, or successor,\n * - does not include duplicate variant subtags, and\n * - does not include duplicate singleton subtags.\n *\n * The abstract operation returns true if locale can be generated from the ABNF\n * grammar in section 2.1 of the RFC, starting with Language-Tag, and does not\n * contain duplicate variant or singleton subtags (other than as a private use\n * subtag). It returns false otherwise. Terminal value characters in the grammar are\n * interpreted as the Unicode equivalents of the ASCII octet values given.\n */\nexport function /* 6.2.2 */IsStructurallyValidLanguageTag(locale) {\n // represents a well-formed BCP 47 language tag as specified in RFC 5646\n if (!expBCP47Syntax.test(locale))\n return false;\n\n // does not include duplicate variant subtags, and\n if (expVariantDupes.test(locale))\n return false;\n\n // does not include duplicate singleton subtags.\n if (expSingletonDupes.test(locale))\n return false;\n\n return true;\n}\n\n/**\n * The CanonicalizeLanguageTag abstract operation returns the canonical and case-\n * regularized form of the locale argument (which must be a String value that is\n * a structurally valid BCP 47 language tag as verified by the\n * IsStructurallyValidLanguageTag abstract operation). It takes the steps\n * specified in RFC 5646 section 4.5, or successor, to bring the language tag\n * into canonical form, and to regularize the case of the subtags, but does not\n * take the steps to bring a language tag into “extlang form” and to reorder\n * variant subtags.\n\n * The specifications for extensions to BCP 47 language tags, such as RFC 6067,\n * may include canonicalization rules for the extension subtag sequences they\n * define that go beyond the canonicalization rules of RFC 5646 section 4.5.\n * Implementations are allowed, but not required, to apply these additional rules.\n */\nexport function /* 6.2.3 */CanonicalizeLanguageTag (locale) {\n let match, parts;\n\n // A language tag is in 'canonical form' when the tag is well-formed\n // according to the rules in Sections 2.1 and 2.2\n\n // Section 2.1 says all subtags use lowercase...\n locale = locale.toLowerCase();\n\n // ...with 2 exceptions: 'two-letter and four-letter subtags that neither\n // appear at the start of the tag nor occur after singletons. Such two-letter\n // subtags are all uppercase (as in the tags \"en-CA-x-ca\" or \"sgn-BE-FR\") and\n // four-letter subtags are titlecase (as in the tag \"az-Latn-x-latn\").\n parts = locale.split('-');\n for (let i = 1, max = parts.length; i < max; i++) {\n // Two-letter subtags are all uppercase\n if (parts[i].length === 2)\n parts[i] = parts[i].toUpperCase();\n\n // Four-letter subtags are titlecase\n else if (parts[i].length === 4)\n parts[i] = parts[i].charAt(0).toUpperCase() + parts[i].slice(1);\n\n // Is it a singleton?\n else if (parts[i].length === 1 && parts[i] !== 'x')\n break;\n }\n locale = arrJoin.call(parts, '-');\n\n // The steps laid out in RFC 5646 section 4.5 are as follows:\n\n // 1. Extension sequences are ordered into case-insensitive ASCII order\n // by singleton subtag.\n if ((match = locale.match(expExtSequences)) && match.length > 1) {\n // The built-in sort() sorts by ASCII order, so use that\n match.sort();\n\n // Replace all extensions with the joined, sorted array\n locale = locale.replace(\n RegExp('(?:' + expExtSequences.source + ')+', 'i'),\n arrJoin.call(match, '')\n );\n }\n\n // 2. Redundant or grandfathered tags are replaced by their 'Preferred-\n // Value', if there is one.\n if (hop.call(redundantTags.tags, locale))\n locale = redundantTags.tags[locale];\n\n // 3. Subtags are replaced by their 'Preferred-Value', if there is one.\n // For extlangs, the original primary language subtag is also\n // replaced if there is a primary language subtag in the 'Preferred-\n // Value'.\n parts = locale.split('-');\n\n for (let i = 1, max = parts.length; i < max; i++) {\n if (hop.call(redundantTags.subtags, parts[i]))\n parts[i] = redundantTags.subtags[parts[i]];\n\n else if (hop.call(redundantTags.extLang, parts[i])) {\n parts[i] = redundantTags.extLang[parts[i]][0];\n\n // For extlang tags, the prefix needs to be removed if it is redundant\n if (i === 1 && redundantTags.extLang[parts[1]][1] === parts[0]) {\n parts = arrSlice.call(parts, i++);\n max -= 1;\n }\n }\n }\n\n return arrJoin.call(parts, '-');\n}\n\n/**\n * The DefaultLocale abstract operation returns a String value representing the\n * structurally valid (6.2.2) and canonicalized (6.2.3) BCP 47 language tag for the\n * host environment’s current locale.\n */\nexport function /* 6.2.4 */DefaultLocale () {\n return defaultLocale;\n}\n\n// Sect 6.3 Currency Codes\n// =======================\n\nconst expCurrencyCode = /^[A-Z]{3}$/;\n\n/**\n * The IsWellFormedCurrencyCode abstract operation verifies that the currency argument\n * (after conversion to a String value) represents a well-formed 3-letter ISO currency\n * code. The following steps are taken:\n */\nexport function /* 6.3.1 */IsWellFormedCurrencyCode(currency) {\n // 1. Let `c` be ToString(currency)\n let c = String(currency);\n\n // 2. Let `normalized` be the result of mapping c to upper case as described\n // in 6.1.\n let normalized = toLatinUpperCase(c);\n\n // 3. If the string length of normalized is not 3, return false.\n // 4. If normalized contains any character that is not in the range \"A\" to \"Z\"\n // (U+0041 to U+005A), return false.\n if (expCurrencyCode.test(normalized) === false)\n return false;\n\n // 5. Return true\n return true;\n}\n","// Sect 9.2 Abstract Operations\n// ============================\n\nimport {\n List,\n toObject,\n toLength,\n arrIndexOf,\n arrPush,\n arrSlice,\n Record,\n hop,\n defineProperty\n} from \"./util.js\";\n\nimport {\n IsStructurallyValidLanguageTag,\n CanonicalizeLanguageTag,\n DefaultLocale\n} from \"./6.locales-currencies-tz.js\";\n\nconst expUnicodeExSeq = /-u(?:-[0-9a-z]{2,8})+/gi; // See `extension` below\n\nexport function /* 9.2.1 */CanonicalizeLocaleList (locales) {\n// The abstract operation CanonicalizeLocaleList takes the following steps:\n\n // 1. If locales is undefined, then a. Return a new empty List\n if (locales === undefined)\n return new List();\n\n // 2. Let seen be a new empty List.\n let seen = new List();\n\n // 3. If locales is a String value, then\n // a. Let locales be a new array created as if by the expression new\n // Array(locales) where Array is the standard built-in constructor with\n // that name and locales is the value of locales.\n locales = typeof locales === 'string' ? [ locales ] : locales;\n\n // 4. Let O be ToObject(locales).\n let O = toObject(locales);\n\n // 5. Let lenValue be the result of calling the [[Get]] internal method of\n // O with the argument \"length\".\n // 6. Let len be ToUint32(lenValue).\n let len = toLength(O.length);\n\n // 7. Let k be 0.\n let k = 0;\n\n // 8. Repeat, while k < len\n while (k < len) {\n // a. Let Pk be ToString(k).\n let Pk = String(k);\n\n // b. Let kPresent be the result of calling the [[HasProperty]] internal\n // method of O with argument Pk.\n let kPresent = Pk in O;\n\n // c. If kPresent is true, then\n if (kPresent) {\n // i. Let kValue be the result of calling the [[Get]] internal\n // method of O with argument Pk.\n let kValue = O[Pk];\n\n // ii. If the type of kValue is not String or Object, then throw a\n // TypeError exception.\n if (kValue === null || (typeof kValue !== 'string' && typeof kValue !== 'object'))\n throw new TypeError('String or Object type expected');\n\n // iii. Let tag be ToString(kValue).\n let tag = String(kValue);\n\n // iv. If the result of calling the abstract operation\n // IsStructurallyValidLanguageTag (defined in 6.2.2), passing tag as\n // the argument, is false, then throw a RangeError exception.\n if (!IsStructurallyValidLanguageTag(tag))\n throw new RangeError(\"'\" + tag + \"' is not a structurally valid language tag\");\n\n // v. Let tag be the result of calling the abstract operation\n // CanonicalizeLanguageTag (defined in 6.2.3), passing tag as the\n // argument.\n tag = CanonicalizeLanguageTag(tag);\n\n // vi. If tag is not an element of seen, then append tag as the last\n // element of seen.\n if (arrIndexOf.call(seen, tag) === -1)\n arrPush.call(seen, tag);\n }\n\n // d. Increase k by 1.\n k++;\n }\n\n // 9. Return seen.\n return seen;\n}\n\n/**\n * The BestAvailableLocale abstract operation compares the provided argument\n * locale, which must be a String value with a structurally valid and\n * canonicalized BCP 47 language tag, against the locales in availableLocales and\n * returns either the longest non-empty prefix of locale that is an element of\n * availableLocales, or undefined if there is no such element. It uses the\n * fallback mechanism of RFC 4647, section 3.4. The following steps are taken:\n */\nexport function /* 9.2.2 */BestAvailableLocale (availableLocales, locale) {\n // 1. Let candidate be locale\n let candidate = locale;\n\n // 2. Repeat\n while (candidate) {\n // a. If availableLocales contains an element equal to candidate, then return\n // candidate.\n if (arrIndexOf.call(availableLocales, candidate) > -1)\n return candidate;\n\n // b. Let pos be the character index of the last occurrence of \"-\"\n // (U+002D) within candidate. If that character does not occur, return\n // undefined.\n let pos = candidate.lastIndexOf('-');\n\n if (pos < 0)\n return;\n\n // c. If pos ≥ 2 and the character \"-\" occurs at index pos-2 of candidate,\n // then decrease pos by 2.\n if (pos >= 2 && candidate.charAt(pos - 2) === '-')\n pos -= 2;\n\n // d. Let candidate be the substring of candidate from position 0, inclusive,\n // to position pos, exclusive.\n candidate = candidate.substring(0, pos);\n }\n}\n\n/**\n * The LookupMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The following steps are taken:\n */\nexport function /* 9.2.3 */LookupMatcher (availableLocales, requestedLocales) {\n // 1. Let i be 0.\n let i = 0;\n\n // 2. Let len be the number of elements in requestedLocales.\n let len = requestedLocales.length;\n\n // 3. Let availableLocale be undefined.\n let availableLocale;\n\n let locale, noExtensionsLocale;\n\n // 4. Repeat while i < len and availableLocale is undefined:\n while (i < len && !availableLocale) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position i.\n locale = requestedLocales[i];\n\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. Increase i by 1.\n i++;\n }\n\n // 5. Let result be a new Record.\n let result = new Record();\n\n // 6. If availableLocale is not undefined, then\n if (availableLocale !== undefined) {\n // a. Set result.[[locale]] to availableLocale.\n result['[[locale]]'] = availableLocale;\n\n // b. If locale and noExtensionsLocale are not the same String value, then\n if (String(locale) !== String(noExtensionsLocale)) {\n // i. Let extension be the String value consisting of the first\n // substring of locale that is a Unicode locale extension sequence.\n let extension = locale.match(expUnicodeExSeq)[0];\n\n // ii. Let extensionIndex be the character position of the initial\n // \"-\" of the first Unicode locale extension sequence within locale.\n let extensionIndex = locale.indexOf('-u-');\n\n // iii. Set result.[[extension]] to extension.\n result['[[extension]]'] = extension;\n\n // iv. Set result.[[extensionIndex]] to extensionIndex.\n result['[[extensionIndex]]'] = extensionIndex;\n }\n }\n // 7. Else\n else\n // a. Set result.[[locale]] to the value returned by the DefaultLocale abstract\n // operation (defined in 6.2.4).\n result['[[locale]]'] = DefaultLocale();\n\n // 8. Return result\n return result;\n}\n\n/**\n * The BestFitMatcher abstract operation compares requestedLocales, which must be\n * a List as returned by CanonicalizeLocaleList, against the locales in\n * availableLocales and determines the best available language to meet the\n * request. The algorithm is implementation dependent, but should produce results\n * that a typical user of the requested locales would perceive as at least as\n * good as those produced by the LookupMatcher abstract operation. Options\n * specified through Unicode locale extension sequences must be ignored by the\n * algorithm. Information about such subsequences is returned separately.\n * The abstract operation returns a record with a [[locale]] field, whose value\n * is the language tag of the selected locale, which must be an element of\n * availableLocales. If the language tag of the request locale that led to the\n * selected locale contained a Unicode locale extension sequence, then the\n * returned record also contains an [[extension]] field whose value is the first\n * Unicode locale extension sequence, and an [[extensionIndex]] field whose value\n * is the index of the first Unicode locale extension sequence within the request\n * locale language tag.\n */\nexport function /* 9.2.4 */BestFitMatcher (availableLocales, requestedLocales) {\n return LookupMatcher(availableLocales, requestedLocales);\n}\n\n// @spec[tc39/ecma402/master/spec/negotiation.html]\n// @clause[sec-unicodeextensionsubtags]\nexport function UnicodeExtensionSubtags(extension) {\n // 1. Let size be the number of elements in extension.\n let size = extension.length;\n // 2. If size = 0, then\n if (size === 0) {\n // a. Return « ».\n return [];\n }\n // 3. Let extensionSubtags be « ».\n let extensionSubtags = [];\n // 4. Let attribute be true.\n let attribute = true;\n // 5. Let q be 3.\n let q = 3;\n // 6. Let p be q.\n let p = q;\n // 7. Let t be q.\n let t = q;\n // 8. Repeat, while q < size\n while (q < size) {\n // a. Let c be the code unit value of the element at index q in the String extension.\n let c = extension.codePointAt(q);\n // a. If c is 0x002D (HYPHEN-MINUS), then\n if (c === 0x002D) {\n // i. If q - p = 2, then\n if (q - p === 2) {\n // 1. If p - t > 1, then\n if (p - t > 1) {\n // a. Let type be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through p - 1 (exclusive).\n let type = extension.substring(t, p - 1);\n // a. Append type as the last element of extensionSubtags.\n extensionSubtags.push(type);\n }\n // 2. Let key be a String value equal to the substring of extension consisting of the code units at indices p (inclusive) through q (exclusive).\n let key = extension.substring(p, q);\n // 3. Append key as the last element of extensionSubtags.\n extensionSubtags.push(key);\n // 4. Let t be q + 1.\n t = q + 1;\n // 5. Let attribute be false.\n attribute = false;\n // ii. Else if attribute is true, then\n } else if (attribute === true) {\n // 1. Let attr be a String value equal to the substring of extension consisting of the code units at indices p (inclusive) through q (exclusive).\n let attr = extension.substring(p, q);\n // 2. Append attr as the last element of extensionSubtags.\n extensionSubtags.push(attr);\n // 3. Let t be q + 1.\n t = q + 1;\n }\n // iii. Let p be q + 1.\n p = q + 1;\n }\n // a. Let q be q + 1.\n q = q + 1;\n }\n // 9. If size - p = 2, then\n if (size - p === 2) {\n // a. If p - t > 1, then\n if (p - t > 1) {\n // i. Let type be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through p - 1 (exclusive).\n let type = extension.substring(t, p - 1);\n // ii. Append type as the last element of extensionSubtags.\n extensionSubtags.push(type);\n }\n // a. Let t be p.\n t = p;\n }\n // 10. Let tail be a String value equal to the substring of extension consisting of the code units at indices t (inclusive) through size (exclusive).\n let tail = extension.substring(t, size);\n // 11. Append tail as the last element of extensionSubtags.\n extensionSubtags.push(tail);\n // 12. Return extensionSubtags.\n return extensionSubtags;\n}\n\n/**\n * The ResolveLocale abstract operation compares a BCP 47 language priority list\n * requestedLocales against the locales in availableLocales and determines the\n * best available language to meet the request. availableLocales and\n * requestedLocales must be provided as List values, options as a Record.\n */\nexport function /* 9.2.5 */ResolveLocale (availableLocales, requestedLocales, options, relevantExtensionKeys, localeData) {\n if (availableLocales.length === 0) {\n throw new ReferenceError('No locale data has been provided for this object yet.');\n }\n\n // The following steps are taken:\n // 1. Let matcher be the value of options.[[localeMatcher]].\n let matcher = options['[[localeMatcher]]'];\n\n let r;\n\n // 2. If matcher is \"lookup\", then\n if (matcher === 'lookup')\n // a. Let r be the result of calling the LookupMatcher abstract operation\n // (defined in 9.2.3) with arguments availableLocales and\n // requestedLocales.\n r = LookupMatcher(availableLocales, requestedLocales);\n\n // 3. Else\n else\n // a. Let r be the result of calling the BestFitMatcher abstract\n // operation (defined in 9.2.4) with arguments availableLocales and\n // requestedLocales.\n r = BestFitMatcher(availableLocales, requestedLocales);\n\n // 4. Let foundLocale be the value of r.[[locale]].\n let foundLocale = r['[[locale]]'];\n\n let extensionSubtags, extensionSubtagsLength;\n\n // 5. If r has an [[extension]] field, then\n if (hop.call(r, '[[extension]]')) {\n // a. Let extension be the value of r.[[extension]].\n let extension = r['[[extension]]'];\n // b. Let _extensionSubtags_ be\n // CreateArrayFromList(UnicodeExtensionSubtags(_extension_)).\n extensionSubtags = UnicodeExtensionSubtags(extension);\n // c. Let _extensionSubtagsLength_ be Get(_extensionSubtags_, *\"length\"*)\n extensionSubtagsLength = extensionSubtags.length;\n }\n\n // 6. Let result be a new Record.\n let result = new Record();\n\n // 7. Set result.[[dataLocale]] to foundLocale.\n result['[[dataLocale]]'] = foundLocale;\n\n // 8. Let supportedExtension be \"-u\".\n let supportedExtension = '-u';\n // 9. Let i be 0.\n let i = 0;\n // 10. Let len be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument \"length\".\n let len = relevantExtensionKeys.length;\n\n // 11 Repeat while i < len:\n while (i < len) {\n // a. Let key be the result of calling the [[Get]] internal method of\n // relevantExtensionKeys with argument ToString(i).\n let key = relevantExtensionKeys[i];\n // b. Let foundLocaleData be the result of calling the [[Get]] internal\n // method of localeData with the argument foundLocale.\n let foundLocaleData = localeData[foundLocale];\n // c. Let keyLocaleData be the result of calling the [[Get]] internal\n // method of foundLocaleData with the argument key.\n let keyLocaleData = foundLocaleData[key];\n // d. Let value be the result of calling the [[Get]] internal method of\n // keyLocaleData with argument \"0\".\n let value = keyLocaleData['0'];\n // e. Let supportedExtensionAddition be \"\".\n let supportedExtensionAddition = '';\n // f. Let indexOf be the standard built-in function object defined in\n // ES5, 15.4.4.14.\n let indexOf = arrIndexOf;\n\n // g. If extensionSubtags is not undefined, then\n if (extensionSubtags !== undefined) {\n // i. Let keyPos be the result of calling the [[Call]] internal\n // method of indexOf with extensionSubtags as the this value and\n // an argument list containing the single item key.\n let keyPos = indexOf.call(extensionSubtags, key);\n\n // ii. If keyPos ≠ -1, then\n if (keyPos !== -1) {\n // 1. If keyPos + 1 < extensionSubtagsLength and the length of the\n // result of calling the [[Get]] internal method of\n // extensionSubtags with argument ToString(keyPos +1) is greater\n // than 2, then\n if (keyPos + 1 < extensionSubtagsLength\n && extensionSubtags[keyPos + 1].length > 2) {\n // a. Let requestedValue be the result of calling the [[Get]]\n // internal method of extensionSubtags with argument\n // ToString(keyPos + 1).\n let requestedValue = extensionSubtags[keyPos + 1];\n // b. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the\n // this value and an argument list containing the single\n // item requestedValue.\n let valuePos = indexOf.call(keyLocaleData, requestedValue);\n\n // c. If valuePos ≠ -1, then\n if (valuePos !== -1) {\n // i. Let value be requestedValue.\n value = requestedValue,\n // ii. Let supportedExtensionAddition be the\n // concatenation of \"-\", key, \"-\", and value.\n supportedExtensionAddition = '-' + key + '-' + value;\n }\n }\n // 2. Else\n else {\n // a. Let valuePos be the result of calling the [[Call]]\n // internal method of indexOf with keyLocaleData as the this\n // value and an argument list containing the single item\n // \"true\".\n let valuePos = indexOf(keyLocaleData, 'true');\n\n // b. If valuePos ≠ -1, then\n if (valuePos !== -1)\n // i. Let value be \"true\".\n value = 'true';\n }\n }\n }\n // h. If options has a field [[]], then\n if (hop.call(options, '[[' + key + ']]')) {\n // i. Let optionsValue be the value of options.[[]].\n let optionsValue = options['[[' + key + ']]'];\n\n // ii. If the result of calling the [[Call]] internal method of indexOf\n // with keyLocaleData as the this value and an argument list\n // containing the single item optionsValue is not -1, then\n if (indexOf.call(keyLocaleData, optionsValue) !== -1) {\n // 1. If optionsValue is not equal to value, then\n if (optionsValue !== value) {\n // a. Let value be optionsValue.\n value = optionsValue;\n // b. Let supportedExtensionAddition be \"\".\n supportedExtensionAddition = '';\n }\n }\n }\n // i. Set result.[[]] to value.\n result['[[' + key + ']]'] = value;\n\n // j. Append supportedExtensionAddition to supportedExtension.\n supportedExtension += supportedExtensionAddition;\n\n // k. Increase i by 1.\n i++;\n }\n // 12. If the length of supportedExtension is greater than 2, then\n if (supportedExtension.length > 2) {\n // a.\n let privateIndex = foundLocale.indexOf(\"-x-\");\n // b.\n if (privateIndex === -1) {\n // i.\n foundLocale = foundLocale + supportedExtension;\n }\n // c.\n else {\n // i.\n let preExtension = foundLocale.substring(0, privateIndex);\n // ii.\n let postExtension = foundLocale.substring(privateIndex);\n // iii.\n foundLocale = preExtension + supportedExtension + postExtension;\n }\n // d. asserting - skipping\n // e.\n foundLocale = CanonicalizeLanguageTag(foundLocale);\n }\n // 13. Set result.[[locale]] to foundLocale.\n result['[[locale]]'] = foundLocale;\n\n // 14. Return result.\n return result;\n}\n\n/**\n * The LookupSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the BCP 47 Lookup algorithm.\n * Locales appear in the same order in the returned list as in requestedLocales.\n * The following steps are taken:\n */\nexport function /* 9.2.6 */LookupSupportedLocales (availableLocales, requestedLocales) {\n // 1. Let len be the number of elements in requestedLocales.\n let len = requestedLocales.length;\n // 2. Let subset be a new empty List.\n let subset = new List();\n // 3. Let k be 0.\n let k = 0;\n\n // 4. Repeat while k < len\n while (k < len) {\n // a. Let locale be the element of requestedLocales at 0-origined list\n // position k.\n let locale = requestedLocales[k];\n // b. Let noExtensionsLocale be the String value that is locale with all\n // Unicode locale extension sequences removed.\n let noExtensionsLocale = String(locale).replace(expUnicodeExSeq, '');\n // c. Let availableLocale be the result of calling the\n // BestAvailableLocale abstract operation (defined in 9.2.2) with\n // arguments availableLocales and noExtensionsLocale.\n let availableLocale = BestAvailableLocale(availableLocales, noExtensionsLocale);\n\n // d. If availableLocale is not undefined, then append locale to the end of\n // subset.\n if (availableLocale !== undefined)\n arrPush.call(subset, locale);\n\n // e. Increment k by 1.\n k++;\n }\n\n // 5. Let subsetArray be a new Array object whose elements are the same\n // values in the same order as the elements of subset.\n let subsetArray = arrSlice.call(subset);\n\n // 6. Return subsetArray.\n return subsetArray;\n}\n\n/**\n * The BestFitSupportedLocales abstract operation returns the subset of the\n * provided BCP 47 language priority list requestedLocales for which\n * availableLocales has a matching locale when using the Best Fit Matcher\n * algorithm. Locales appear in the same order in the returned list as in\n * requestedLocales. The steps taken are implementation dependent.\n */\nexport function /*9.2.7 */BestFitSupportedLocales (availableLocales, requestedLocales) {\n // ###TODO: implement this function as described by the specification###\n return LookupSupportedLocales(availableLocales, requestedLocales);\n}\n\n/**\n * The SupportedLocales abstract operation returns the subset of the provided BCP\n * 47 language priority list requestedLocales for which availableLocales has a\n * matching locale. Two algorithms are available to match the locales: the Lookup\n * algorithm described in RFC 4647 section 3.4, and an implementation dependent\n * best-fit algorithm. Locales appear in the same order in the returned list as\n * in requestedLocales. The following steps are taken:\n */\nexport function /*9.2.8 */SupportedLocales (availableLocales, requestedLocales, options) {\n let matcher, subset;\n\n // 1. If options is not undefined, then\n if (options !== undefined) {\n // a. Let options be ToObject(options).\n options = new Record(toObject(options));\n // b. Let matcher be the result of calling the [[Get]] internal method of\n // options with argument \"localeMatcher\".\n matcher = options.localeMatcher;\n\n // c. If matcher is not undefined, then\n if (matcher !== undefined) {\n // i. Let matcher be ToString(matcher).\n matcher = String(matcher);\n\n // ii. If matcher is not \"lookup\" or \"best fit\", then throw a RangeError\n // exception.\n if (matcher !== 'lookup' && matcher !== 'best fit')\n throw new RangeError('matcher should be \"lookup\" or \"best fit\"');\n }\n }\n // 2. If matcher is undefined or \"best fit\", then\n if (matcher === undefined || matcher === 'best fit')\n // a. Let subset be the result of calling the BestFitSupportedLocales\n // abstract operation (defined in 9.2.7) with arguments\n // availableLocales and requestedLocales.\n subset = BestFitSupportedLocales(availableLocales, requestedLocales);\n // 3. Else\n else\n // a. Let subset be the result of calling the LookupSupportedLocales\n // abstract operation (defined in 9.2.6) with arguments\n // availableLocales and requestedLocales.\n subset = LookupSupportedLocales(availableLocales, requestedLocales);\n\n // 4. For each named own property name P of subset,\n for (let P in subset) {\n if (!hop.call(subset, P))\n continue;\n\n // a. Let desc be the result of calling the [[GetOwnProperty]] internal\n // method of subset with P.\n // b. Set desc.[[Writable]] to false.\n // c. Set desc.[[Configurable]] to false.\n // d. Call the [[DefineOwnProperty]] internal method of subset with P, desc,\n // and true as arguments.\n defineProperty(subset, P, {\n writable: false, configurable: false, value: subset[P]\n });\n }\n // \"Freeze\" the array so no new elements can be added\n defineProperty(subset, 'length', { writable: false });\n\n // 5. Return subset\n return subset;\n}\n\n/**\n * The GetOption abstract operation extracts the value of the property named\n * property from the provided options object, converts it to the required type,\n * checks whether it is one of a List of allowed values, and fills in a fallback\n * value if necessary.\n */\nexport function /*9.2.9 */GetOption (options, property, type, values, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n let value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Assert: type is \"boolean\" or \"string\".\n // b. If type is \"boolean\", then let value be ToBoolean(value).\n // c. If type is \"string\", then let value be ToString(value).\n value = type === 'boolean' ? Boolean(value)\n : (type === 'string' ? String(value) : value);\n\n // d. If values is not undefined, then\n if (values !== undefined) {\n // i. If values does not contain an element equal to value, then throw a\n // RangeError exception.\n if (arrIndexOf.call(values, value) === -1)\n throw new RangeError(\"'\" + value + \"' is not an allowed value for `\" + property +'`');\n }\n\n // e. Return value.\n return value;\n }\n // Else return fallback.\n return fallback;\n}\n\n/**\n * The GetNumberOption abstract operation extracts a property value from the\n * provided options object, converts it to a Number value, checks whether it is\n * in the allowed range, and fills in a fallback value if necessary.\n */\nexport function /* 9.2.10 */GetNumberOption (options, property, minimum, maximum, fallback) {\n // 1. Let value be the result of calling the [[Get]] internal method of\n // options with argument property.\n let value = options[property];\n\n // 2. If value is not undefined, then\n if (value !== undefined) {\n // a. Let value be ToNumber(value).\n value = Number(value);\n\n // b. If value is NaN or less than minimum or greater than maximum, throw a\n // RangeError exception.\n if (isNaN(value) || value < minimum || value > maximum)\n throw new RangeError('Value is not a number or outside accepted range');\n\n // c. Return floor(value).\n return Math.floor(value);\n }\n // 3. Else return fallback.\n return fallback;\n}\n","import {\n CanonicalizeLocaleList\n} from \"./9.negotiation.js\";\n\n// 8 The Intl Object\nexport const Intl = {};\n\n// 8.2 Function Properties of the Intl Object\n\n// 8.2.1\n// @spec[tc39/ecma402/master/spec/intl.html]\n// @clause[sec-intl.getcanonicallocales]\nfunction getCanonicalLocales (locales) {\n // 1. Let ll be ? CanonicalizeLocaleList(locales).\n let ll = CanonicalizeLocaleList(locales);\n // 2. Return CreateArrayFromList(ll).\n {\n let result = [];\n\n let len = ll.length;\n let k = 0;\n\n while (k < len) {\n result[k] = ll[k];\n k++;\n }\n return result;\n }\n}\n\nObject.defineProperty(Intl, 'getCanonicalLocales', {\n enumerable: false,\n configurable: true,\n writable: true,\n value: getCanonicalLocales\n});\n","// 11.1 The Intl.NumberFormat constructor\n// ======================================\n\nimport {\n IsWellFormedCurrencyCode\n} from \"./6.locales-currencies-tz.js\";\n\nimport {\n Intl\n} from \"./8.intl.js\";\n\nimport {\n CanonicalizeLocaleList,\n SupportedLocales,\n ResolveLocale,\n GetNumberOption,\n GetOption\n} from \"./9.negotiation.js\";\n\nimport {\n internals,\n log10Floor,\n List,\n toObject,\n arrPush,\n arrJoin,\n arrShift,\n Record,\n hop,\n defineProperty,\n es3,\n fnBind,\n getInternalProperties,\n createRegExpRestore,\n secret,\n objCreate\n} from \"./util.js\";\n\n// Currency minor units output from get-4217 grunt task, formatted\nconst currencyMinorUnits = {\n BHD: 3, BYR: 0, XOF: 0, BIF: 0, XAF: 0, CLF: 4, CLP: 0, KMF: 0, DJF: 0,\n XPF: 0, GNF: 0, ISK: 0, IQD: 3, JPY: 0, JOD: 3, KRW: 0, KWD: 3, LYD: 3,\n OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0\n};\n\n// Define the NumberFormat constructor internally so it cannot be tainted\nexport function NumberFormatConstructor () {\n let locales = arguments[0];\n let options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.NumberFormat(locales, options);\n }\n\n return InitializeNumberFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'NumberFormat', {\n configurable: true,\n writable: true,\n value: NumberFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(Intl.NumberFormat, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeNumberFormat accepts the arguments\n * numberFormat (which must be an object), locales, and options. It initializes\n * numberFormat as a NumberFormat object.\n */\nexport function /*11.1.1.1 */InitializeNumberFormat (numberFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n let internal = getInternalProperties(numberFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n let regexpRestore = createRegExpRestore();\n\n // 1. If numberFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true)\n throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(numberFormat, '__getInternalProperties', {\n value: function () {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret)\n return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n let requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. If options is undefined, then\n if (options === undefined)\n // a. Let options be the result of creating a new object as if by the\n // expression new Object() where Object is the standard built-in constructor\n // with that name.\n options = {};\n\n // 5. Else\n else\n // a. Let options be ToObject(options).\n options = toObject(options);\n\n // 6. Let opt be a new Record.\n let opt = new Record(),\n\n // 7. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with the arguments options, \"localeMatcher\", \"string\",\n // a List containing the two String values \"lookup\" and \"best fit\", and\n // \"best fit\".\n matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 8. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 9. Let NumberFormat be the standard built-in object that is the initial value\n // of Intl.NumberFormat.\n // 10. Let localeData be the value of the [[localeData]] internal property of\n // NumberFormat.\n let localeData = internals.NumberFormat['[[localeData]]'];\n\n // 11. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // NumberFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of NumberFormat, and localeData.\n let r = ResolveLocale(\n internals.NumberFormat['[[availableLocales]]'], requestedLocales,\n opt, internals.NumberFormat['[[relevantExtensionKeys]]'], localeData\n );\n\n // 12. Set the [[locale]] internal property of numberFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 13. Set the [[numberingSystem]] internal property of numberFormat to the value\n // of r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n let dataLocale = r['[[dataLocale]]'];\n\n // 15. Let s be the result of calling the GetOption abstract operation with the\n // arguments options, \"style\", \"string\", a List containing the three String\n // values \"decimal\", \"percent\", and \"currency\", and \"decimal\".\n let s = GetOption(options, 'style', 'string', new List('decimal', 'percent', 'currency'), 'decimal');\n\n // 16. Set the [[style]] internal property of numberFormat to s.\n internal['[[style]]'] = s;\n\n // 17. Let c be the result of calling the GetOption abstract operation with the\n // arguments options, \"currency\", \"string\", undefined, and undefined.\n let c = GetOption(options, 'currency', 'string');\n\n // 18. If c is not undefined and the result of calling the\n // IsWellFormedCurrencyCode abstract operation (defined in 6.3.1) with\n // argument c is false, then throw a RangeError exception.\n if (c !== undefined && !IsWellFormedCurrencyCode(c))\n throw new RangeError(\"'\" + c + \"' is not a valid currency code\");\n\n // 19. If s is \"currency\" and c is undefined, throw a TypeError exception.\n if (s === 'currency' && c === undefined)\n throw new TypeError('Currency code is required when style is currency');\n\n let cDigits;\n\n // 20. If s is \"currency\", then\n if (s === 'currency') {\n // a. Let c be the result of converting c to upper case as specified in 6.1.\n c = c.toUpperCase();\n\n // b. Set the [[currency]] internal property of numberFormat to c.\n internal['[[currency]]'] = c;\n\n // c. Let cDigits be the result of calling the CurrencyDigits abstract\n // operation (defined below) with argument c.\n cDigits = CurrencyDigits(c);\n }\n\n // 21. Let cd be the result of calling the GetOption abstract operation with the\n // arguments options, \"currencyDisplay\", \"string\", a List containing the\n // three String values \"code\", \"symbol\", and \"name\", and \"symbol\".\n let cd = GetOption(options, 'currencyDisplay', 'string', new List('code', 'symbol', 'name'), 'symbol');\n\n // 22. If s is \"currency\", then set the [[currencyDisplay]] internal property of\n // numberFormat to cd.\n if (s === 'currency')\n internal['[[currencyDisplay]]'] = cd;\n\n // 23. Let mnid be the result of calling the GetNumberOption abstract operation\n // (defined in 9.2.10) with arguments options, \"minimumIntegerDigits\", 1, 21,\n // and 1.\n let mnid = GetNumberOption(options, 'minimumIntegerDigits', 1, 21, 1);\n\n // 24. Set the [[minimumIntegerDigits]] internal property of numberFormat to mnid.\n internal['[[minimumIntegerDigits]]'] = mnid;\n\n // 25. If s is \"currency\", then let mnfdDefault be cDigits; else let mnfdDefault\n // be 0.\n let mnfdDefault = s === 'currency' ? cDigits : 0;\n\n // 26. Let mnfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"minimumFractionDigits\", 0, 20, and mnfdDefault.\n let mnfd = GetNumberOption(options, 'minimumFractionDigits', 0, 20, mnfdDefault);\n\n // 27. Set the [[minimumFractionDigits]] internal property of numberFormat to mnfd.\n internal['[[minimumFractionDigits]]'] = mnfd;\n\n // 28. If s is \"currency\", then let mxfdDefault be max(mnfd, cDigits); else if s\n // is \"percent\", then let mxfdDefault be max(mnfd, 0); else let mxfdDefault\n // be max(mnfd, 3).\n let mxfdDefault = s === 'currency' ? Math.max(mnfd, cDigits)\n : (s === 'percent' ? Math.max(mnfd, 0) : Math.max(mnfd, 3));\n\n // 29. Let mxfd be the result of calling the GetNumberOption abstract operation\n // with arguments options, \"maximumFractionDigits\", mnfd, 20, and mxfdDefault.\n let mxfd = GetNumberOption(options, 'maximumFractionDigits', mnfd, 20, mxfdDefault);\n\n // 30. Set the [[maximumFractionDigits]] internal property of numberFormat to mxfd.\n internal['[[maximumFractionDigits]]'] = mxfd;\n\n // 31. Let mnsd be the result of calling the [[Get]] internal method of options\n // with argument \"minimumSignificantDigits\".\n let mnsd = options.minimumSignificantDigits;\n\n // 32. Let mxsd be the result of calling the [[Get]] internal method of options\n // with argument \"maximumSignificantDigits\".\n let mxsd = options.maximumSignificantDigits;\n\n // 33. If mnsd is not undefined or mxsd is not undefined, then:\n if (mnsd !== undefined || mxsd !== undefined) {\n // a. Let mnsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"minimumSignificantDigits\", 1, 21,\n // and 1.\n mnsd = GetNumberOption(options, 'minimumSignificantDigits', 1, 21, 1);\n\n // b. Let mxsd be the result of calling the GetNumberOption abstract\n // operation with arguments options, \"maximumSignificantDigits\", mnsd,\n // 21, and 21.\n mxsd = GetNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21);\n\n // c. Set the [[minimumSignificantDigits]] internal property of numberFormat\n // to mnsd, and the [[maximumSignificantDigits]] internal property of\n // numberFormat to mxsd.\n internal['[[minimumSignificantDigits]]'] = mnsd;\n internal['[[maximumSignificantDigits]]'] = mxsd;\n }\n // 34. Let g be the result of calling the GetOption abstract operation with the\n // arguments options, \"useGrouping\", \"boolean\", undefined, and true.\n let g = GetOption(options, 'useGrouping', 'boolean', undefined, true);\n\n // 35. Set the [[useGrouping]] internal property of numberFormat to g.\n internal['[[useGrouping]]'] = g;\n\n // 36. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n let dataLocaleData = localeData[dataLocale];\n\n // 37. Let patterns be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"patterns\".\n let patterns = dataLocaleData.patterns;\n\n // 38. Assert: patterns is an object (see 11.2.3)\n\n // 39. Let stylePatterns be the result of calling the [[Get]] internal method of\n // patterns with argument s.\n let stylePatterns = patterns[s];\n\n // 40. Set the [[positivePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"positivePattern\".\n internal['[[positivePattern]]'] = stylePatterns.positivePattern;\n\n // 41. Set the [[negativePattern]] internal property of numberFormat to the\n // result of calling the [[Get]] internal method of stylePatterns with the\n // argument \"negativePattern\".\n internal['[[negativePattern]]'] = stylePatterns.negativePattern;\n\n // 42. Set the [[boundFormat]] internal property of numberFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 43. Set the [[initializedNumberFormat]] internal property of numberFormat to\n // true.\n internal['[[initializedNumberFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3)\n numberFormat.format = GetFormatNumber.call(numberFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return numberFormat;\n}\n\nfunction CurrencyDigits(currency) {\n // When the CurrencyDigits abstract operation is called with an argument currency\n // (which must be an upper case String value), the following steps are taken:\n\n // 1. If the ISO 4217 currency and funds code list contains currency as an\n // alphabetic code, then return the minor unit value corresponding to the\n // currency from the list; else return 2.\n return currencyMinorUnits[currency] !== undefined\n ? currencyMinorUnits[currency]\n : 2;\n}\n\n/* 11.2.3 */internals.NumberFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.NumberFormat is called, the\n * following steps are taken:\n */\n/* 11.2.2 */\ndefineProperty(Intl.NumberFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]'))\n throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n let regexpRestore = createRegExpRestore(),\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * NumberFormat object.\n */\n/* 11.3.2 */defineProperty(Intl.NumberFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatNumber\n});\n\nfunction GetFormatNumber() {\n let internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]'])\n throw new TypeError('`this` value for format() is not an initialized Intl.NumberFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this NumberFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 1, that takes the argument value and\n // performs the following steps:\n let F = function (value) {\n // i. If value is not provided, then let value be undefined.\n // ii. Let x be ToNumber(value).\n // iii. Return the result of calling the FormatNumber abstract\n // operation (defined below) with arguments this and x.\n return FormatNumber(this, /* x = */Number(value));\n };\n\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n let bf = fnBind.call(F, this);\n\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n }\n\nfunction formatToParts(value = undefined) {\n let internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n if (!internal || !internal['[[initializedNumberFormat]]'])\n throw new TypeError('`this` value for formatToParts() is not an initialized Intl.NumberFormat object.');\n\n let x = Number(value);\n return FormatNumberToParts(this, x);\n}\n\nObject.defineProperty(Intl.NumberFormat.prototype, 'formatToParts', {\n configurable: true,\n enumerable: false,\n writable: true,\n value: formatToParts\n});\n\n/*\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-formatnumbertoparts]\n */\nfunction FormatNumberToParts(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n let parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be ArrayCreate(0).\n let result = [];\n // 3. Let n be 0.\n let n = 0;\n // 4. For each part in parts, do:\n for (let i = 0; parts.length > i; i++) {\n let part = parts[i];\n // a. Let O be ObjectCreate(%ObjectPrototype%).\n let O = {};\n // a. Perform ? CreateDataPropertyOrThrow(O, \"type\", part.[[type]]).\n O.type = part['[[type]]'];\n // a. Perform ? CreateDataPropertyOrThrow(O, \"value\", part.[[value]]).\n O.value = part['[[value]]'];\n // a. Perform ? CreateDataPropertyOrThrow(result, ? ToString(n), O).\n result[n] = O;\n // a. Increment n by 1.\n n += 1;\n }\n // 5. Return result.\n return result;\n}\n\n/*\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-formatnumberstring]\n */\nfunction FormatNumberToString(numberFormat, x) {\n let internal = getInternalProperties(numberFormat);\n let result;\n\n // 1. Assert: numberFormat.[[initializedIntlObject]] is true.\n\n // 2. If the numberFormat.[[minimumSignificantDigits]] and numberFormat.[[maximumSignificantDigits]] are present, then\n if (hop.call(internal, '[[minimumSignificantDigits]]') &&\n hop.call(internal, '[[maximumSignificantDigits]]')) {\n // a. Let result be ToRawPrecision(x, numberFormat.[[minimumSignificantDigits]], numberFormat.[[maximumSignificantDigits]]).\n result = ToRawPrecision(x,\n internal['[[minimumSignificantDigits]]'],\n internal['[[maximumSignificantDigits]]']);\n }\n // 3. Else,\n else {\n // a. Let result be ToRawFixed(x, numberFormat.[[minimumIntegerDigits]], numberFormat.[[minimumFractionDigits]], numberFormat.[[maximumFractionDigits]]).\n result = ToRawFixed(x,\n internal['[[minimumIntegerDigits]]'],\n internal['[[minimumFractionDigits]]'],\n internal['[[maximumFractionDigits]]']);\n }\n // 4. Return result.\n return result;\n}\n\n/*\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-partitionnumberpattern]\n */\nfunction PartitionNumberPattern(numberFormat, x) {\n\n let internal = getInternalProperties(numberFormat),\n locale = internal['[[dataLocale]]'],\n nums = internal['[[numberingSystem]]'],\n data = internals.NumberFormat['[[localeData]]'][locale],\n ild = data.symbols[nums] || data.symbols.latn,\n pattern;\n\n // 1. If x is not NaN and x < 0, then:\n if (!isNaN(x) && x < 0) {\n // a. Let x be -x.\n x = -x;\n // b. Let pattern be the value of numberFormat.[[negativePattern]].\n pattern = internal['[[negativePattern]]'];\n }\n // 2. Else,\n else {\n // a. Let pattern be the value of numberFormat.[[positivePattern]].\n pattern = internal['[[positivePattern]]'];\n }\n // 3. Let result be a new empty List.\n let result = new List();\n // 4. Let beginIndex be Call(%StringProto_indexOf%, pattern, \"{\", 0).\n let beginIndex = pattern.indexOf('{', 0);\n // 5. Let endIndex be 0.\n let endIndex = 0;\n // 6. Let nextIndex be 0.\n let nextIndex = 0;\n // 7. Let length be the number of code units in pattern.\n let length = pattern.length;\n // 8. Repeat while beginIndex is an integer index into pattern:\n while (beginIndex > -1 && beginIndex < length) {\n // a. Set endIndex to Call(%StringProto_indexOf%, pattern, \"}\", beginIndex)\n endIndex = pattern.indexOf('}', beginIndex);\n // b. If endIndex = -1, throw new Error exception.\n if (endIndex === -1) throw new Error();\n // c. If beginIndex is greater than nextIndex, then:\n if (beginIndex > nextIndex) {\n // i. Let literal be a substring of pattern from position nextIndex, inclusive, to position beginIndex, exclusive.\n let literal = pattern.substring(nextIndex, beginIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // d. Let p be the substring of pattern from position beginIndex, exclusive, to position endIndex, exclusive.\n let p = pattern.substring(beginIndex + 1, endIndex);\n // e. If p is equal \"number\", then:\n if (p === \"number\") {\n // i. If x is NaN,\n if (isNaN(x)) {\n // 1. Let n be an ILD String value indicating the NaN value.\n let n = ild.nan;\n // 2. Add new part record { [[type]]: \"nan\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'nan', '[[value]]': n });\n }\n // ii. Else if isFinite(x) is false,\n else if (!isFinite(x)) {\n // 1. Let n be an ILD String value indicating infinity.\n let n = ild.infinity;\n // 2. Add new part record { [[type]]: \"infinity\", [[value]]: n } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'infinity', '[[value]]': n });\n }\n // iii. Else,\n else {\n // 1. If numberFormat.[[style]] is \"percent\", let x be 100 × x.\n if (internal['[[style]]'] === 'percent') x *= 100;\n\n // 2. Let n be FormatNumberToString(numberFormat, x).\n let n = FormatNumberToString(numberFormat, x);\n\n // 3. If the numberFormat.[[numberingSystem]] matches one of the values in the \"Numbering System\" column of Table 3 below, then\n if (numSys[nums]) {\n // a. Let digits be an array whose 10 String valued elements are the UTF-16 string representations of the 10 digits specified in the \"Digits\" column of the matching row in Table 2.\n let digits = numSys[nums];\n // a. Replace each digit in n with the value of digits[digit].\n n = String(n).replace(/\\d/g, (digit) => {\n return digits[digit];\n });\n }\n // 4. Else use an implementation dependent algorithm to map n to the appropriate representation of n in the given numbering system.\n else n = String(n); // ###TODO###\n\n let integer;\n let fraction;\n // 5. Let decimalSepIndex be Call(%StringProto_indexOf%, n, \".\", 0).\n let decimalSepIndex = n.indexOf('.', 0);\n // 6. If decimalSepIndex > 0, then:\n if (decimalSepIndex > 0) {\n // a. Let integer be the substring of n from position 0, inclusive, to position decimalSepIndex, exclusive.\n integer = n.substring(0, decimalSepIndex);\n // b. Let fraction be the substring of n from position decimalSepIndex, exclusive, to the end of n.\n fraction = n.substring(decimalSepIndex + 1, decimalSepIndex.length);\n }\n // 7. Else:\n else {\n // a. Let integer be n.\n integer = n;\n // b. Let fraction be undefined.\n fraction = undefined;\n }\n // 8. If the value of the numberFormat.[[useGrouping]] is true,\n if (internal['[[useGrouping]]'] === true) {\n // a. Let groupSepSymbol be the ILND String representing the grouping separator.\n let groupSepSymbol = ild.group;\n // b. Let groups be a List whose elements are, in left to right order, the substrings defined by ILND set of locations within the integer.\n let groups = [];\n // ----> implementation:\n // Primary group represents the group closest to the decimal\n let pgSize = data.patterns.primaryGroupSize || 3;\n // Secondary group is every other group\n let sgSize = data.patterns.secondaryGroupSize || pgSize;\n // Group only if necessary\n if (integer.length > pgSize) {\n // Index of the primary grouping separator\n let end = integer.length - pgSize;\n // Starting index for our loop\n let idx = end % sgSize;\n let start = integer.slice(0, idx);\n if (start.length) arrPush.call(groups, start);\n // Loop to separate into secondary grouping digits\n while (idx < end) {\n arrPush.call(groups, integer.slice(idx, idx + sgSize));\n idx += sgSize;\n }\n // Add the primary grouping digits\n arrPush.call(groups, integer.slice(end));\n } else {\n arrPush.call(groups, integer);\n }\n // c. Assert: The number of elements in groups List is greater than 0.\n if (groups.length === 0) throw new Error();\n // d. Repeat, while groups List is not empty:\n while (groups.length) {\n // i. Remove the first element from groups and let integerGroup be the value of that element.\n let integerGroup = arrShift.call(groups);\n // ii. Add new part record { [[type]]: \"integer\", [[value]]: integerGroup } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integerGroup });\n // iii. If groups List is not empty, then:\n if (groups.length) {\n // 1. Add new part record { [[type]]: \"group\", [[value]]: groupSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'group', '[[value]]': groupSepSymbol });\n }\n }\n }\n // 9. Else,\n else {\n // a. Add new part record { [[type]]: \"integer\", [[value]]: integer } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'integer', '[[value]]': integer });\n }\n // 10. If fraction is not undefined, then:\n if (fraction !== undefined) {\n // a. Let decimalSepSymbol be the ILND String representing the decimal separator.\n let decimalSepSymbol = ild.decimal;\n // b. Add new part record { [[type]]: \"decimal\", [[value]]: decimalSepSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'decimal', '[[value]]': decimalSepSymbol });\n // c. Add new part record { [[type]]: \"fraction\", [[value]]: fraction } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'fraction', '[[value]]': fraction });\n }\n }\n }\n // f. Else if p is equal \"plusSign\", then:\n else if (p === \"plusSign\") {\n // i. Let plusSignSymbol be the ILND String representing the plus sign.\n let plusSignSymbol = ild.plusSign;\n // ii. Add new part record { [[type]]: \"plusSign\", [[value]]: plusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'plusSign', '[[value]]': plusSignSymbol });\n }\n // g. Else if p is equal \"minusSign\", then:\n else if (p === \"minusSign\") {\n // i. Let minusSignSymbol be the ILND String representing the minus sign.\n let minusSignSymbol = ild.minusSign;\n // ii. Add new part record { [[type]]: \"minusSign\", [[value]]: minusSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'minusSign', '[[value]]': minusSignSymbol });\n }\n // h. Else if p is equal \"percentSign\" and numberFormat.[[style]] is \"percent\", then:\n else if (p === \"percentSign\" && internal['[[style]]'] === \"percent\") {\n // i. Let percentSignSymbol be the ILND String representing the percent sign.\n let percentSignSymbol = ild.percentSign;\n // ii. Add new part record { [[type]]: \"percentSign\", [[value]]: percentSignSymbol } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': percentSignSymbol });\n }\n // i. Else if p is equal \"currency\" and numberFormat.[[style]] is \"currency\", then:\n else if (p === \"currency\" && internal['[[style]]'] === \"currency\") {\n // i. Let currency be the value of numberFormat.[[currency]].\n let currency = internal['[[currency]]'];\n\n let cd;\n\n // iii. If numberFormat.[[currencyDisplay]] is \"code\", then\n if (internal['[[currencyDisplay]]'] === \"code\") {\n // 1. Let cd be currency.\n cd = currency;\n }\n // iv. Else if numberFormat.[[currencyDisplay]] is \"symbol\", then\n else if (internal['[[currencyDisplay]]'] === \"symbol\") {\n // 1. Let cd be an ILD string representing currency in short form. If the implementation does not have such a representation of currency, use currency itself.\n cd = data.currencies[currency] || currency;\n }\n // v. Else if numberFormat.[[currencyDisplay]] is \"name\", then\n else if (internal['[[currencyDisplay]]'] === \"name\") {\n // 1. Let cd be an ILD string representing currency in long form. If the implementation does not have such a representation of currency, then use currency itself.\n cd = currency;\n }\n // vi. Add new part record { [[type]]: \"currency\", [[value]]: cd } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'currency', '[[value]]': cd });\n }\n // j. Else,\n else {\n // i. Let literal be the substring of pattern from position beginIndex, inclusive, to position endIndex, inclusive.\n let literal = pattern.substring(beginIndex, endIndex);\n // ii. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // k. Set nextIndex to endIndex + 1.\n nextIndex = endIndex + 1;\n // l. Set beginIndex to Call(%StringProto_indexOf%, pattern, \"{\", nextIndex)\n beginIndex = pattern.indexOf('{', nextIndex);\n }\n // 9. If nextIndex is less than length, then:\n if (nextIndex < length) {\n // a. Let literal be the substring of pattern from position nextIndex, inclusive, to position length, exclusive.\n let literal = pattern.substring(nextIndex, length);\n // b. Add new part record { [[type]]: \"literal\", [[value]]: literal } as a new element of the list result.\n arrPush.call(result, { '[[type]]': 'literal', '[[value]]': literal });\n }\n // 10. Return result.\n return result;\n}\n\n/*\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-formatnumber]\n */\nexport function FormatNumber(numberFormat, x) {\n // 1. Let parts be ? PartitionNumberPattern(numberFormat, x).\n let parts = PartitionNumberPattern(numberFormat, x);\n // 2. Let result be an empty String.\n let result = '';\n // 3. For each part in parts, do:\n for (let i = 0; parts.length > i; i++) {\n let part = parts[i];\n // a. Set result to a String value produced by concatenating result and part.[[value]].\n result += part['[[value]]'];\n }\n // 4. Return result.\n return result;\n}\n\n/**\n * When the ToRawPrecision abstract operation is called with arguments x (which\n * must be a finite non-negative number), minPrecision, and maxPrecision (both\n * must be integers between 1 and 21) the following steps are taken:\n */\nfunction ToRawPrecision (x, minPrecision, maxPrecision) {\n // 1. Let p be maxPrecision.\n let p = maxPrecision;\n\n let m, e;\n\n // 2. If x = 0, then\n if (x === 0) {\n // a. Let m be the String consisting of p occurrences of the character \"0\".\n m = arrJoin.call(Array (p + 1), '0');\n // b. Let e be 0.\n e = 0;\n }\n // 3. Else\n else {\n // a. Let e and n be integers such that 10ᵖ⁻¹ ≤ n < 10ᵖ and for which the\n // exact mathematical value of n × 10ᵉ⁻ᵖ⁺¹ – x is as close to zero as\n // possible. If there are two such sets of e and n, pick the e and n for\n // which n × 10ᵉ⁻ᵖ⁺¹ is larger.\n e = log10Floor(Math.abs(x));\n\n // Easier to get to m from here\n let f = Math.round(Math.exp((Math.abs(e - p + 1)) * Math.LN10));\n\n // b. Let m be the String consisting of the digits of the decimal\n // representation of n (in order, with no leading zeroes)\n m = String(Math.round(e - p + 1 < 0 ? x * f : x / f));\n }\n\n // 4. If e ≥ p, then\n if (e >= p)\n // a. Return the concatenation of m and e-p+1 occurrences of the character \"0\".\n return m + arrJoin.call(Array(e-p+1 + 1), '0');\n\n // 5. If e = p-1, then\n else if (e === p - 1)\n // a. Return m.\n return m;\n\n // 6. If e ≥ 0, then\n else if (e >= 0)\n // a. Let m be the concatenation of the first e+1 characters of m, the character\n // \".\", and the remaining p–(e+1) characters of m.\n m = m.slice(0, e + 1) + '.' + m.slice(e + 1);\n\n // 7. If e < 0, then\n else if (e < 0)\n // a. Let m be the concatenation of the String \"0.\", –(e+1) occurrences of the\n // character \"0\", and the string m.\n m = '0.' + arrJoin.call(Array (-(e+1) + 1), '0') + m;\n\n // 8. If m contains the character \".\", and maxPrecision > minPrecision, then\n if (m.indexOf(\".\") >= 0 && maxPrecision > minPrecision) {\n // a. Let cut be maxPrecision – minPrecision.\n let cut = maxPrecision - minPrecision;\n\n // b. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.charAt(m.length-1) === '0') {\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n\n // ii. Decrease cut by 1.\n cut--;\n }\n\n // c. If the last character of m is \".\", then\n if (m.charAt(m.length-1) === '.')\n // i. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. Return m.\n return m;\n}\n\n/**\n * @spec[tc39/ecma402/master/spec/numberformat.html]\n * @clause[sec-torawfixed]\n * When the ToRawFixed abstract operation is called with arguments x (which must\n * be a finite non-negative number), minInteger (which must be an integer between\n * 1 and 21), minFraction, and maxFraction (which must be integers between 0 and\n * 20) the following steps are taken:\n */\nfunction ToRawFixed(x, minInteger, minFraction, maxFraction) {\n // 1. Let f be maxFraction.\n let f = maxFraction;\n // 2. Let n be an integer for which the exact mathematical value of n ÷ 10f – x is as close to zero as possible. If there are two such n, pick the larger n.\n let n = Math.pow(10, f) * x; // diverging...\n // 3. If n = 0, let m be the String \"0\". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).\n let m = (n === 0 ? \"0\" : n.toFixed(0)); // divering...\n\n {\n // this diversion is needed to take into consideration big numbers, e.g.:\n // 1.2344501e+37 -> 12344501000000000000000000000000000000\n let idx;\n let exp = (idx = m.indexOf('e')) > -1 ? m.slice(idx + 1) : 0;\n if (exp) {\n m = m.slice(0, idx).replace('.', '');\n m += arrJoin.call(Array(exp - (m.length - 1) + 1), '0');\n }\n }\n\n let int;\n // 4. If f ≠ 0, then\n if (f !== 0) {\n // a. Let k be the number of characters in m.\n let k = m.length;\n // a. If k ≤ f, then\n if (k <= f) {\n // i. Let z be the String consisting of f+1–k occurrences of the character \"0\".\n let z = arrJoin.call(Array(f + 1 - k + 1), '0');\n // ii. Let m be the concatenation of Strings z and m.\n m = z + m;\n // iii. Let k be f+1.\n k = f + 1;\n }\n // a. Let a be the first k–f characters of m, and let b be the remaining f characters of m.\n let a = m.substring(0, k - f), b = m.substring(k - f, m.length);\n // a. Let m be the concatenation of the three Strings a, \".\", and b.\n m = a + \".\" + b;\n // a. Let int be the number of characters in a.\n int = a.length;\n }\n // 5. Else, let int be the number of characters in m.\n else int = m.length;\n // 6. Let cut be maxFraction – minFraction.\n let cut = maxFraction - minFraction;\n // 7. Repeat while cut > 0 and the last character of m is \"0\":\n while (cut > 0 && m.slice(-1) === \"0\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n // a. Decrease cut by 1.\n cut--;\n }\n // 8. If the last character of m is \".\", then\n if (m.slice(-1) === \".\") {\n // a. Remove the last character from m.\n m = m.slice(0, -1);\n }\n // 9. If int < minInteger, then\n if (int < minInteger) {\n // a. Let z be the String consisting of minInteger–int occurrences of the character \"0\".\n let z = arrJoin.call(Array(minInteger - int + 1), '0');\n // a. Let m be the concatenation of Strings z and m.\n m = z + m;\n }\n // 10. Return m.\n return m;\n}\n\n// Sect 11.3.2 Table 2, Numbering systems\n// ======================================\nlet numSys = {\n arab: ['\\u0660', '\\u0661', '\\u0662', '\\u0663', '\\u0664', '\\u0665', '\\u0666', '\\u0667', '\\u0668', '\\u0669'],\n arabext: ['\\u06F0', '\\u06F1', '\\u06F2', '\\u06F3', '\\u06F4', '\\u06F5', '\\u06F6', '\\u06F7', '\\u06F8', '\\u06F9'],\n bali: ['\\u1B50', '\\u1B51', '\\u1B52', '\\u1B53', '\\u1B54', '\\u1B55', '\\u1B56', '\\u1B57', '\\u1B58', '\\u1B59'],\n beng: ['\\u09E6', '\\u09E7', '\\u09E8', '\\u09E9', '\\u09EA', '\\u09EB', '\\u09EC', '\\u09ED', '\\u09EE', '\\u09EF'],\n deva: ['\\u0966', '\\u0967', '\\u0968', '\\u0969', '\\u096A', '\\u096B', '\\u096C', '\\u096D', '\\u096E', '\\u096F'],\n fullwide: ['\\uFF10', '\\uFF11', '\\uFF12', '\\uFF13', '\\uFF14', '\\uFF15', '\\uFF16', '\\uFF17', '\\uFF18', '\\uFF19'],\n gujr: ['\\u0AE6', '\\u0AE7', '\\u0AE8', '\\u0AE9', '\\u0AEA', '\\u0AEB', '\\u0AEC', '\\u0AED', '\\u0AEE', '\\u0AEF'],\n guru: ['\\u0A66', '\\u0A67', '\\u0A68', '\\u0A69', '\\u0A6A', '\\u0A6B', '\\u0A6C', '\\u0A6D', '\\u0A6E', '\\u0A6F'],\n hanidec: ['\\u3007', '\\u4E00', '\\u4E8C', '\\u4E09', '\\u56DB', '\\u4E94', '\\u516D', '\\u4E03', '\\u516B', '\\u4E5D'],\n khmr: ['\\u17E0', '\\u17E1', '\\u17E2', '\\u17E3', '\\u17E4', '\\u17E5', '\\u17E6', '\\u17E7', '\\u17E8', '\\u17E9'],\n knda: ['\\u0CE6', '\\u0CE7', '\\u0CE8', '\\u0CE9', '\\u0CEA', '\\u0CEB', '\\u0CEC', '\\u0CED', '\\u0CEE', '\\u0CEF'],\n laoo: ['\\u0ED0', '\\u0ED1', '\\u0ED2', '\\u0ED3', '\\u0ED4', '\\u0ED5', '\\u0ED6', '\\u0ED7', '\\u0ED8', '\\u0ED9'],\n latn: ['\\u0030', '\\u0031', '\\u0032', '\\u0033', '\\u0034', '\\u0035', '\\u0036', '\\u0037', '\\u0038', '\\u0039'],\n limb: ['\\u1946', '\\u1947', '\\u1948', '\\u1949', '\\u194A', '\\u194B', '\\u194C', '\\u194D', '\\u194E', '\\u194F'],\n mlym: ['\\u0D66', '\\u0D67', '\\u0D68', '\\u0D69', '\\u0D6A', '\\u0D6B', '\\u0D6C', '\\u0D6D', '\\u0D6E', '\\u0D6F'],\n mong: ['\\u1810', '\\u1811', '\\u1812', '\\u1813', '\\u1814', '\\u1815', '\\u1816', '\\u1817', '\\u1818', '\\u1819'],\n mymr: ['\\u1040', '\\u1041', '\\u1042', '\\u1043', '\\u1044', '\\u1045', '\\u1046', '\\u1047', '\\u1048', '\\u1049'],\n orya: ['\\u0B66', '\\u0B67', '\\u0B68', '\\u0B69', '\\u0B6A', '\\u0B6B', '\\u0B6C', '\\u0B6D', '\\u0B6E', '\\u0B6F'],\n tamldec: ['\\u0BE6', '\\u0BE7', '\\u0BE8', '\\u0BE9', '\\u0BEA', '\\u0BEB', '\\u0BEC', '\\u0BED', '\\u0BEE', '\\u0BEF'],\n telu: ['\\u0C66', '\\u0C67', '\\u0C68', '\\u0C69', '\\u0C6A', '\\u0C6B', '\\u0C6C', '\\u0C6D', '\\u0C6E', '\\u0C6F'],\n thai: ['\\u0E50', '\\u0E51', '\\u0E52', '\\u0E53', '\\u0E54', '\\u0E55', '\\u0E56', '\\u0E57', '\\u0E58', '\\u0E59'],\n tibt: ['\\u0F20', '\\u0F21', '\\u0F22', '\\u0F23', '\\u0F24', '\\u0F25', '\\u0F26', '\\u0F27', '\\u0F28', '\\u0F29']\n};\n\n/**\n * This function provides access to the locale and formatting options computed\n * during initialization of the object.\n *\n * The function returns a new object whose properties and attributes are set as\n * if constructed by an object literal assigning to each of the following\n * properties the value of the corresponding internal property of this\n * NumberFormat object (see 11.4): locale, numberingSystem, style, currency,\n * currencyDisplay, minimumIntegerDigits, minimumFractionDigits,\n * maximumFractionDigits, minimumSignificantDigits, maximumSignificantDigits, and\n * useGrouping. Properties whose corresponding internal properties are not present\n * are not assigned.\n */\n/* 11.3.3 */defineProperty(Intl.NumberFormat.prototype, 'resolvedOptions', {\n configurable: true,\n writable: true,\n value: function () {\n let prop,\n descs = new Record(),\n props = [\n 'locale', 'numberingSystem', 'style', 'currency', 'currencyDisplay',\n 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits',\n 'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping'\n ],\n internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n // Satisfy test 11.3_b\n if (!internal || !internal['[[initializedNumberFormat]]'])\n throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.NumberFormat object.');\n\n for (let i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[['+ props[i] +']]'))\n descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n","/* jslint esnext: true */\n\n// Match these datetime components in a CLDR pattern, except those in single quotes\nlet expDTComponents = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n// trim patterns after transformations\nlet expPatternTrimmer = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\n// Skip over patterns with these datetime components because we don't have data\n// to back them up:\n// timezone, weekday, amoung others\nlet unwantedDTCs = /[rqQASjJgwWIQq]/; // xXVO were removed from this list in favor of computing matches with timeZoneName values but printing as empty string\n\nlet dtKeys = [\"era\", \"year\", \"month\", \"day\", \"weekday\", \"quarter\"];\nlet tmKeys = [\"hour\", \"minute\", \"second\", \"hour12\", \"timeZoneName\"];\n\nfunction isDateFormatOnly(obj) {\n for (let i = 0; i < tmKeys.length; i += 1) {\n if (obj.hasOwnProperty(tmKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction isTimeFormatOnly(obj) {\n for (let i = 0; i < dtKeys.length; i += 1) {\n if (obj.hasOwnProperty(dtKeys[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction joinDateAndTimeFormats(dateFormatObj, timeFormatObj) {\n let o = { _: {} };\n for (let i = 0; i < dtKeys.length; i += 1) {\n if (dateFormatObj[dtKeys[i]]) {\n o[dtKeys[i]] = dateFormatObj[dtKeys[i]];\n }\n if (dateFormatObj._[dtKeys[i]]) {\n o._[dtKeys[i]] = dateFormatObj._[dtKeys[i]];\n }\n }\n for (let j = 0; j < tmKeys.length; j += 1) {\n if (timeFormatObj[tmKeys[j]]) {\n o[tmKeys[j]] = timeFormatObj[tmKeys[j]];\n }\n if (timeFormatObj._[tmKeys[j]]) {\n o._[tmKeys[j]] = timeFormatObj._[tmKeys[j]];\n }\n }\n return o;\n}\n\nfunction computeFinalPatterns(formatObj) {\n // From http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns:\n // 'In patterns, two single quotes represents a literal single quote, either\n // inside or outside single quotes. Text within single quotes is not\n // interpreted in any way (except for two adjacent single quotes).'\n formatObj.pattern12 = formatObj.extendedPattern.replace(/'([^']*)'/g, ($0, literal) => {\n return literal ? literal : \"'\";\n });\n\n // pattern 12 is always the default. we can produce the 24 by removing {ampm}\n formatObj.pattern = formatObj.pattern12.replace('{ampm}', '').replace(expPatternTrimmer, '');\n return formatObj;\n}\n\nfunction expDTComponentsMeta($0, formatObj) {\n switch ($0.charAt(0)) {\n // --- Era\n case 'G':\n formatObj.era = [ 'short', 'short', 'short', 'long', 'narrow' ][$0.length-1];\n return '{era}';\n\n // --- Year\n case 'y':\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n formatObj.year = $0.length === 2 ? '2-digit' : 'numeric';\n return '{year}';\n\n // --- Quarter (not supported in this polyfill)\n case 'Q':\n case 'q':\n formatObj.quarter = [ 'numeric', '2-digit', 'short', 'long', 'narrow' ][$0.length-1];\n return '{quarter}';\n\n // --- Month\n case 'M':\n case 'L':\n formatObj.month = [ 'numeric', '2-digit', 'short', 'long', 'narrow' ][$0.length-1];\n return '{month}';\n\n // --- Week (not supported in this polyfill)\n case 'w':\n // week of the year\n formatObj.week = $0.length === 2 ? '2-digit' : 'numeric';\n return '{weekday}';\n case 'W':\n // week of the month\n formatObj.week = 'numeric';\n return '{weekday}';\n\n // --- Day\n case 'd':\n // day of the month\n formatObj.day = $0.length === 2 ? '2-digit' : 'numeric';\n return '{day}';\n case 'D': // day of the year\n case 'F': // day of the week\n case 'g':\n // 1..n: Modified Julian day\n formatObj.day = 'numeric';\n return '{day}';\n\n // --- Week Day\n case 'E':\n // day of the week\n formatObj.weekday = [ 'short', 'short', 'short', 'long', 'narrow', 'short' ][$0.length-1];\n return '{weekday}';\n case 'e':\n // local day of the week\n formatObj.weekday = [ 'numeric', '2-digit', 'short', 'long', 'narrow', 'short' ][$0.length-1];\n return '{weekday}';\n case 'c':\n // stand alone local day of the week\n formatObj.weekday = [ 'numeric', undefined, 'short', 'long', 'narrow', 'short' ][$0.length-1];\n return '{weekday}';\n\n // --- Period\n case 'a': // AM, PM\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n formatObj.hour12 = true;\n return '{ampm}';\n\n // --- Hour\n case 'h':\n case 'H':\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n case 'k':\n case 'K':\n formatObj.hour12 = true; // 12-hour-cycle time formats (using h or K)\n formatObj.hour = $0.length === 2 ? '2-digit' : 'numeric';\n return '{hour}';\n\n // --- Minute\n case 'm':\n formatObj.minute = $0.length === 2 ? '2-digit' : 'numeric';\n return '{minute}';\n\n // --- Second\n case 's':\n formatObj.second = $0.length === 2 ? '2-digit' : 'numeric';\n return '{second}';\n case 'S':\n case 'A':\n formatObj.second = 'numeric';\n return '{second}';\n\n // --- Timezone\n case 'z': // 1..3, 4: specific non-location format\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: miliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x': // 1, 2, 3, 4: The ISO8601 varios formats\n // this polyfill only supports much, for now, we are just doing something dummy\n formatObj.timeZoneName = $0.length < 4 ? 'short' : 'long';\n return '{timeZoneName}';\n }\n}\n\n\n/**\n * Converts the CLDR availableFormats into the objects and patterns required by\n * the ECMAScript Internationalization API specification.\n */\nexport function createDateTimeFormat(skeleton, pattern) {\n // we ignore certain patterns that are unsupported to avoid this expensive op.\n if (unwantedDTCs.test(pattern))\n return undefined;\n\n let formatObj = {\n originalPattern: pattern,\n _: {}\n };\n\n // Replace the pattern string with the one required by the specification, whilst\n // at the same time evaluating it for the subsets and formats\n formatObj.extendedPattern = pattern.replace(expDTComponents, ($0) => {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj._);\n });\n\n // Match the skeleton string with the one required by the specification\n // this implementation is based on the Date Field Symbol Table:\n // http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n // Note: we are adding extra data to the formatObject even though this polyfill\n // might not support it.\n skeleton.replace(expDTComponents, ($0) => {\n // See which symbol we're dealing with\n return expDTComponentsMeta($0, formatObj);\n });\n\n return computeFinalPatterns(formatObj);\n}\n\n/**\n * Processes DateTime formats from CLDR to an easier-to-parse format.\n * the result of this operation should be cached the first time a particular\n * calendar is analyzed.\n *\n * The specification requires we support at least the following subsets of\n * date/time components:\n *\n * - 'weekday', 'year', 'month', 'day', 'hour', 'minute', 'second'\n * - 'weekday', 'year', 'month', 'day'\n * - 'year', 'month', 'day'\n * - 'year', 'month'\n * - 'month', 'day'\n * - 'hour', 'minute', 'second'\n * - 'hour', 'minute'\n *\n * We need to cherry pick at least these subsets from the CLDR data and convert\n * them into the pattern objects used in the ECMA-402 API.\n */\nexport function createDateTimeFormats(formats) {\n let availableFormats = formats.availableFormats;\n let timeFormats = formats.timeFormats;\n let dateFormats = formats.dateFormats;\n let result = [];\n let skeleton, pattern, computed, i, j;\n let timeRelatedFormats = [];\n let dateRelatedFormats = [];\n\n // Map available (custom) formats into a pattern for createDateTimeFormats\n for (skeleton in availableFormats) {\n if (availableFormats.hasOwnProperty(skeleton)) {\n pattern = availableFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n // in some cases, the format is only displaying date specific props\n // or time specific props, in which case we need to also produce the\n // combined formats.\n if (isDateFormatOnly(computed)) {\n dateRelatedFormats.push(computed);\n } else if (isTimeFormatOnly(computed)) {\n timeRelatedFormats.push(computed);\n }\n }\n }\n }\n\n // Map time formats into a pattern for createDateTimeFormats\n for (skeleton in timeFormats) {\n if (timeFormats.hasOwnProperty(skeleton)) {\n pattern = timeFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n timeRelatedFormats.push(computed);\n }\n }\n }\n\n // Map date formats into a pattern for createDateTimeFormats\n for (skeleton in dateFormats) {\n if (dateFormats.hasOwnProperty(skeleton)) {\n pattern = dateFormats[skeleton];\n computed = createDateTimeFormat(skeleton, pattern);\n if (computed) {\n result.push(computed);\n dateRelatedFormats.push(computed);\n }\n }\n }\n\n // combine custom time and custom date formats when they are orthogonals to complete the\n // formats supported by CLDR.\n // This Algo is based on section \"Missing Skeleton Fields\" from:\n // http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems\n for (i = 0; i < timeRelatedFormats.length; i += 1) {\n for (j = 0; j < dateRelatedFormats.length; j += 1) {\n if (dateRelatedFormats[j].month === 'long') {\n pattern = dateRelatedFormats[j].weekday ? formats.full : formats.long;\n } else if (dateRelatedFormats[j].month === 'short') {\n pattern = formats.medium;\n } else {\n pattern = formats.short;\n }\n computed = joinDateAndTimeFormats(dateRelatedFormats[j], timeRelatedFormats[i]);\n computed.originalPattern = pattern;\n computed.extendedPattern = pattern\n .replace('{0}', timeRelatedFormats[i].extendedPattern)\n .replace('{1}', dateRelatedFormats[j].extendedPattern)\n .replace(/^[,\\s]+|[,\\s]+$/gi, '');\n result.push(computeFinalPatterns(computed));\n }\n }\n\n return result;\n}\n\n// this represents the exceptions of the rule that are not covered by CLDR availableFormats\n// for single property configurations, they play no role when using multiple properties, and\n// those that are not in this table, are not exceptions or are not covered by the data we\n// provide.\nconst validSyntheticProps = {\n second: {\n numeric: 's',\n '2-digit': 'ss'\n },\n minute: {\n numeric: 'm',\n '2-digit': 'mm'\n },\n year: {\n numeric: 'y',\n '2-digit': 'yy'\n },\n day: {\n numeric: 'd',\n '2-digit': 'dd'\n },\n month: {\n numeric: 'L',\n '2-digit': 'LL',\n narrow: 'LLLLL',\n short: 'LLL',\n long: 'LLLL'\n },\n weekday: {\n narrow: 'ccccc',\n short: 'ccc',\n long: 'cccc'\n }\n};\n\nexport function generateSyntheticFormat(propName, propValue) {\n if (validSyntheticProps[propName] && validSyntheticProps[propName][propValue]) {\n return {\n originalPattern: validSyntheticProps[propName][propValue],\n _: {\n [propName]: propValue\n },\n extendedPattern: `{${propName}}`,\n [propName]: propValue,\n pattern12: `{${propName}}`,\n pattern: `{${propName}}`\n };\n }\n}\n","// 12.1 The Intl.DateTimeFormat constructor\n// ==================================\n\nimport {\n toLatinUpperCase\n} from './6.locales-currencies-tz.js';\n\nimport {\n Intl\n} from \"./8.intl.js\";\n\nimport {\n CanonicalizeLocaleList,\n ResolveLocale,\n GetOption,\n SupportedLocales\n} from \"./9.negotiation.js\";\n\nimport {\n FormatNumber\n} from \"./11.numberformat.js\";\n\nimport {\n generateSyntheticFormat,\n createDateTimeFormats\n} from \"./cldr\";\n\nimport {\n internals,\n es3,\n fnBind,\n defineProperty,\n toObject,\n getInternalProperties,\n createRegExpRestore,\n secret,\n Record,\n List,\n hop,\n objCreate,\n toNumber,\n arrPush,\n arrIndexOf\n} from './util.js';\n\n// An object map of date component keys, saves using a regex later\nconst dateWidths = objCreate(null, { narrow:{}, short:{}, long:{} });\n\n/**\n * Returns a string for a date component, resolved using multiple inheritance as specified\n * as specified in the Unicode Technical Standard 35.\n */\nfunction resolveDateString(data, ca, component, width, key) {\n // From http://www.unicode.org/reports/tr35/tr35.html#Multiple_Inheritance:\n // 'In clearly specified instances, resources may inherit from within the same locale.\n // For example, ... the Buddhist calendar inherits from the Gregorian calendar.'\n let obj = data[ca] && data[ca][component]\n ? data[ca][component]\n : data.gregory[component],\n\n // \"sideways\" inheritance resolves strings when a key doesn't exist\n alts = {\n narrow: ['short', 'long'],\n short: ['long', 'narrow'],\n long: ['short', 'narrow']\n },\n\n //\n resolved = hop.call(obj, width)\n ? obj[width]\n : hop.call(obj, alts[width][0])\n ? obj[alts[width][0]]\n : obj[alts[width][1]];\n\n // `key` wouldn't be specified for components 'dayPeriods'\n return key !== null ? resolved[key] : resolved;\n}\n\n// Define the DateTimeFormat constructor internally so it cannot be tainted\nexport function DateTimeFormatConstructor () {\n let locales = arguments[0];\n let options = arguments[1];\n\n if (!this || this === Intl) {\n return new Intl.DateTimeFormat(locales, options);\n }\n return InitializeDateTimeFormat(toObject(this), locales, options);\n}\n\ndefineProperty(Intl, 'DateTimeFormat', {\n configurable: true,\n writable: true,\n value: DateTimeFormatConstructor\n});\n\n// Must explicitly set prototypes as unwritable\ndefineProperty(DateTimeFormatConstructor, 'prototype', {\n writable: false\n});\n\n/**\n * The abstract operation InitializeDateTimeFormat accepts the arguments dateTimeFormat\n * (which must be an object), locales, and options. It initializes dateTimeFormat as a\n * DateTimeFormat object.\n */\nexport function/* 12.1.1.1 */InitializeDateTimeFormat (dateTimeFormat, locales, options) {\n // This will be a internal properties object if we're not already initialized\n let internal = getInternalProperties(dateTimeFormat);\n\n // Create an object whose props can be used to restore the values of RegExp props\n let regexpRestore = createRegExpRestore();\n\n // 1. If dateTimeFormat has an [[initializedIntlObject]] internal property with\n // value true, throw a TypeError exception.\n if (internal['[[initializedIntlObject]]'] === true)\n throw new TypeError('`this` object has already been initialized as an Intl object');\n\n // Need this to access the `internal` object\n defineProperty(dateTimeFormat, '__getInternalProperties', {\n value: function () {\n // NOTE: Non-standard, for internal use only\n if (arguments[0] === secret)\n return internal;\n }\n });\n\n // 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.\n internal['[[initializedIntlObject]]'] = true;\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n let requestedLocales = CanonicalizeLocaleList(locales);\n\n // 4. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined below) with arguments options, \"any\", and \"date\".\n options = ToDateTimeOptions(options, 'any', 'date');\n\n // 5. Let opt be a new Record.\n let opt = new Record();\n\n // 6. Let matcher be the result of calling the GetOption abstract operation\n // (defined in 9.2.9) with arguments options, \"localeMatcher\", \"string\", a List\n // containing the two String values \"lookup\" and \"best fit\", and \"best fit\".\n let matcher = GetOption(options, 'localeMatcher', 'string', new List('lookup', 'best fit'), 'best fit');\n\n // 7. Set opt.[[localeMatcher]] to matcher.\n opt['[[localeMatcher]]'] = matcher;\n\n // 8. Let DateTimeFormat be the standard built-in object that is the initial\n // value of Intl.DateTimeFormat.\n let DateTimeFormat = internals.DateTimeFormat; // This is what we *really* need\n\n // 9. Let localeData be the value of the [[localeData]] internal property of\n // DateTimeFormat.\n let localeData = DateTimeFormat['[[localeData]]'];\n\n // 10. Let r be the result of calling the ResolveLocale abstract operation\n // (defined in 9.2.5) with the [[availableLocales]] internal property of\n // DateTimeFormat, requestedLocales, opt, the [[relevantExtensionKeys]]\n // internal property of DateTimeFormat, and localeData.\n let r = ResolveLocale(DateTimeFormat['[[availableLocales]]'], requestedLocales,\n opt, DateTimeFormat['[[relevantExtensionKeys]]'], localeData);\n\n // 11. Set the [[locale]] internal property of dateTimeFormat to the value of\n // r.[[locale]].\n internal['[[locale]]'] = r['[[locale]]'];\n\n // 12. Set the [[calendar]] internal property of dateTimeFormat to the value of\n // r.[[ca]].\n internal['[[calendar]]'] = r['[[ca]]'];\n\n // 13. Set the [[numberingSystem]] internal property of dateTimeFormat to the value of\n // r.[[nu]].\n internal['[[numberingSystem]]'] = r['[[nu]]'];\n\n // The specification doesn't tell us to do this, but it's helpful later on\n internal['[[dataLocale]]'] = r['[[dataLocale]]'];\n\n // 14. Let dataLocale be the value of r.[[dataLocale]].\n let dataLocale = r['[[dataLocale]]'];\n\n // 15. Let tz be the result of calling the [[Get]] internal method of options with\n // argument \"timeZone\".\n let tz = options.timeZone;\n\n // 16. If tz is not undefined, then\n if (tz !== undefined) {\n // a. Let tz be ToString(tz).\n // b. Convert tz to upper case as described in 6.1.\n // NOTE: If an implementation accepts additional time zone values, as permitted\n // under certain conditions by the Conformance clause, different casing\n // rules apply.\n tz = toLatinUpperCase(tz);\n\n // c. If tz is not \"UTC\", then throw a RangeError exception.\n // ###TODO: accept more time zones###\n if (tz !== 'UTC')\n throw new RangeError('timeZone is not supported.');\n }\n\n // 17. Set the [[timeZone]] internal property of dateTimeFormat to tz.\n internal['[[timeZone]]'] = tz;\n\n // 18. Let opt be a new Record.\n opt = new Record();\n\n // 19. For each row of Table 3, except the header row, do:\n for (let prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, prop))\n continue;\n\n // 20. Let prop be the name given in the Property column of the row.\n // 21. Let value be the result of calling the GetOption abstract operation,\n // passing as argument options, the name given in the Property column of the\n // row, \"string\", a List containing the strings given in the Values column of\n // the row, and undefined.\n let value = GetOption(options, prop, 'string', dateTimeComponents[prop]);\n\n // 22. Set opt.[[]] to value.\n opt['[['+prop+']]'] = value;\n }\n\n // Assigned a value below\n let bestFormat;\n\n // 23. Let dataLocaleData be the result of calling the [[Get]] internal method of\n // localeData with argument dataLocale.\n let dataLocaleData = localeData[dataLocale];\n\n // 24. Let formats be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"formats\".\n // Note: we process the CLDR formats into the spec'd structure\n let formats = ToDateTimeFormats(dataLocaleData.formats);\n\n // 25. Let matcher be the result of calling the GetOption abstract operation with\n // arguments options, \"formatMatcher\", \"string\", a List containing the two String\n // values \"basic\" and \"best fit\", and \"best fit\".\n matcher = GetOption(options, 'formatMatcher', 'string', new List('basic', 'best fit'), 'best fit');\n\n // Optimization: caching the processed formats as a one time operation by\n // replacing the initial structure from localeData\n dataLocaleData.formats = formats;\n\n // 26. If matcher is \"basic\", then\n if (matcher === 'basic') {\n // 27. Let bestFormat be the result of calling the BasicFormatMatcher abstract\n // operation (defined below) with opt and formats.\n bestFormat = BasicFormatMatcher(opt, formats);\n\n // 28. Else\n } else {\n {\n // diverging\n let hr12 = GetOption(options, 'hour12', 'boolean'/*, undefined, undefined*/);\n opt.hour12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;\n }\n // 29. Let bestFormat be the result of calling the BestFitFormatMatcher\n // abstract operation (defined below) with opt and formats.\n bestFormat = BestFitFormatMatcher(opt, formats);\n }\n\n // 30. For each row in Table 3, except the header row, do\n for (let prop in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, prop))\n continue;\n\n // a. Let prop be the name given in the Property column of the row.\n // b. Let pDesc be the result of calling the [[GetOwnProperty]] internal method of\n // bestFormat with argument prop.\n // c. If pDesc is not undefined, then\n if (hop.call(bestFormat, prop)) {\n // i. Let p be the result of calling the [[Get]] internal method of bestFormat\n // with argument prop.\n let p = bestFormat[prop];\n {\n // diverging\n p = bestFormat._ && hop.call(bestFormat._, prop) ? bestFormat._[prop] : p;\n }\n\n // ii. Set the [[]] internal property of dateTimeFormat to p.\n internal['[['+prop+']]'] = p;\n }\n }\n\n let pattern; // Assigned a value below\n\n // 31. Let hr12 be the result of calling the GetOption abstract operation with\n // arguments options, \"hour12\", \"boolean\", undefined, and undefined.\n let hr12 = GetOption(options, 'hour12', 'boolean'/*, undefined, undefined*/);\n\n // 32. If dateTimeFormat has an internal property [[hour]], then\n if (internal['[[hour]]']) {\n // a. If hr12 is undefined, then let hr12 be the result of calling the [[Get]]\n // internal method of dataLocaleData with argument \"hour12\".\n hr12 = hr12 === undefined ? dataLocaleData.hour12 : hr12;\n\n // b. Set the [[hour12]] internal property of dateTimeFormat to hr12.\n internal['[[hour12]]'] = hr12;\n\n // c. If hr12 is true, then\n if (hr12 === true) {\n // i. Let hourNo0 be the result of calling the [[Get]] internal method of\n // dataLocaleData with argument \"hourNo0\".\n let hourNo0 = dataLocaleData.hourNo0;\n\n // ii. Set the [[hourNo0]] internal property of dateTimeFormat to hourNo0.\n internal['[[hourNo0]]'] = hourNo0;\n\n // iii. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern12\".\n pattern = bestFormat.pattern12;\n }\n\n // d. Else\n else\n // i. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n }\n\n // 33. Else\n else\n // a. Let pattern be the result of calling the [[Get]] internal method of\n // bestFormat with argument \"pattern\".\n pattern = bestFormat.pattern;\n\n // 34. Set the [[pattern]] internal property of dateTimeFormat to pattern.\n internal['[[pattern]]'] = pattern;\n\n // 35. Set the [[boundFormat]] internal property of dateTimeFormat to undefined.\n internal['[[boundFormat]]'] = undefined;\n\n // 36. Set the [[initializedDateTimeFormat]] internal property of dateTimeFormat to\n // true.\n internal['[[initializedDateTimeFormat]]'] = true;\n\n // In ES3, we need to pre-bind the format() function\n if (es3)\n dateTimeFormat.format = GetFormatDateTime.call(dateTimeFormat);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // Return the newly initialised object\n return dateTimeFormat;\n}\n\n/**\n * Several DateTimeFormat algorithms use values from the following table, which provides\n * property names and allowable values for the components of date and time formats:\n */\nlet dateTimeComponents = {\n weekday: [ \"narrow\", \"short\", \"long\" ],\n era: [ \"narrow\", \"short\", \"long\" ],\n year: [ \"2-digit\", \"numeric\" ],\n month: [ \"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\" ],\n day: [ \"2-digit\", \"numeric\" ],\n hour: [ \"2-digit\", \"numeric\" ],\n minute: [ \"2-digit\", \"numeric\" ],\n second: [ \"2-digit\", \"numeric\" ],\n timeZoneName: [ \"short\", \"long\" ]\n};\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nfunction ToDateTimeFormats(formats) {\n if (Object.prototype.toString.call(formats) === '[object Array]') {\n return formats;\n }\n return createDateTimeFormats(formats);\n}\n\n/**\n * When the ToDateTimeOptions abstract operation is called with arguments options,\n * required, and defaults, the following steps are taken:\n */\nexport function ToDateTimeOptions (options, required, defaults) {\n // 1. If options is undefined, then let options be null, else let options be\n // ToObject(options).\n if (options === undefined)\n options = null;\n\n else {\n // (#12) options needs to be a Record, but it also needs to inherit properties\n let opt2 = toObject(options);\n options = new Record();\n\n for (let k in opt2)\n options[k] = opt2[k];\n }\n\n // 2. Let create be the standard built-in function object defined in ES5, 15.2.3.5.\n let create = objCreate;\n\n // 3. Let options be the result of calling the [[Call]] internal method of create with\n // undefined as the this value and an argument list containing the single item\n // options.\n options = create(options);\n\n // 4. Let needDefaults be true.\n let needDefaults = true;\n\n // 5. If required is \"date\" or \"any\", then\n if (required === 'date' || required === 'any') {\n // a. For each of the property names \"weekday\", \"year\", \"month\", \"day\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.weekday !== undefined || options.year !== undefined\n || options.month !== undefined || options.day !== undefined)\n needDefaults = false;\n }\n\n // 6. If required is \"time\" or \"any\", then\n if (required === 'time' || required === 'any') {\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. If the result of calling the [[Get]] internal method of options with the\n // property name is not undefined, then let needDefaults be false.\n if (options.hour !== undefined || options.minute !== undefined || options.second !== undefined)\n needDefaults = false;\n }\n\n // 7. If needDefaults is true and defaults is either \"date\" or \"all\", then\n if (needDefaults && (defaults === 'date' || defaults === 'all'))\n // a. For each of the property names \"year\", \"month\", \"day\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.year = options.month = options.day = 'numeric';\n\n // 8. If needDefaults is true and defaults is either \"time\" or \"all\", then\n if (needDefaults && (defaults === 'time' || defaults === 'all'))\n // a. For each of the property names \"hour\", \"minute\", \"second\":\n // i. Call the [[DefineOwnProperty]] internal method of options with the\n // property name, Property Descriptor {[[Value]]: \"numeric\", [[Writable]]:\n // true, [[Enumerable]]: true, [[Configurable]]: true}, and false.\n options.hour = options.minute = options.second = 'numeric';\n\n // 9. Return options.\n return options;\n}\n\n/**\n * When the BasicFormatMatcher abstract operation is called with two arguments options and\n * formats, the following steps are taken:\n */\nfunction BasicFormatMatcher (options, formats) {\n // 1. Let removalPenalty be 120.\n let removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n let additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n let longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n let longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n let shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n let shortMorePenalty = 3;\n\n // 7. Let bestScore be -Infinity.\n let bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n let bestFormat;\n\n // 9. Let i be 0.\n let i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n let len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n let format = formats[i];\n\n // b. Let score be 0.\n let score = 0;\n\n // c. For each property shown in Table 3:\n for (let property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property))\n continue;\n\n // i. Let optionsProp be options.[[]].\n let optionsProp = options['[['+ property +']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n let formatProp = hop.call(format, property) ? format[property] : undefined;\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined)\n score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined)\n score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n let values = [ '2-digit', 'numeric', 'narrow', 'short', 'long' ];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n let optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n let formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n let delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta === 2)\n score -= longMorePenalty;\n\n // 6. Else if delta = 1, decrease score by shortMorePenalty.\n else if (delta === 1)\n score -= shortMorePenalty;\n\n // 7. Else if delta = -1, decrease score by shortLessPenalty.\n else if (delta === -1)\n score -= shortLessPenalty;\n\n // 8. Else if delta = -2, decrease score by longLessPenalty.\n else if (delta === -2)\n score -= longLessPenalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/**\n * When the BestFitFormatMatcher abstract operation is called with two arguments options\n * and formats, it performs implementation dependent steps, which should return a set of\n * component representations that a typical user of the selected locale would perceive as\n * at least as good as the one returned by BasicFormatMatcher.\n *\n * This polyfill defines the algorithm to be the same as BasicFormatMatcher,\n * with the addition of bonus points awarded where the requested format is of\n * the same data type as the potentially matching format.\n *\n * This algo relies on the concept of closest distance matching described here:\n * http://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons\n * Typically a “best match” is found using a closest distance match, such as:\n *\n * Symbols requesting a best choice for the locale are replaced.\n * j → one of {H, k, h, K}; C → one of {a, b, B}\n * -> Covered by cldr.js matching process\n *\n * For fields with symbols representing the same type (year, month, day, etc):\n * Most symbols have a small distance from each other.\n * M ≅ L; E ≅ c; a ≅ b ≅ B; H ≅ k ≅ h ≅ K; ...\n * -> Covered by cldr.js matching process\n *\n * Width differences among fields, other than those marking text vs numeric, are given small distance from each other.\n * MMM ≅ MMMM\n * MM ≅ M\n * Numeric and text fields are given a larger distance from each other.\n * MMM ≈ MM\n * Symbols representing substantial differences (week of year vs week of month) are given much larger a distances from each other.\n * d ≋ D; ...\n * Missing or extra fields cause a match to fail. (But see Missing Skeleton Fields).\n *\n *\n * For example,\n *\n * { month: 'numeric', day: 'numeric' }\n *\n * should match\n *\n * { month: '2-digit', day: '2-digit' }\n *\n * rather than\n *\n * { month: 'short', day: 'numeric' }\n *\n * This makes sense because a user requesting a formatted date with numeric parts would\n * not expect to see the returned format containing narrow, short or long part names\n */\nfunction BestFitFormatMatcher (options, formats) {\n /** Diverging: this block implements the hack for single property configuration, eg.:\n *\n * `new Intl.DateTimeFormat('en', {day: 'numeric'})`\n *\n * should produce a single digit with the day of the month. This is needed because\n * CLDR `availableFormats` data structure doesn't cover these cases.\n */\n {\n const optionsPropNames = [];\n for (let property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property))\n continue;\n\n if (options['[['+ property +']]'] !== undefined) {\n optionsPropNames.push(property);\n }\n }\n if (optionsPropNames.length === 1) {\n const bestFormat = generateSyntheticFormat(optionsPropNames[0], options['[['+ optionsPropNames[0] +']]']);\n if (bestFormat) {\n return bestFormat;\n }\n }\n }\n\n // 1. Let removalPenalty be 120.\n let removalPenalty = 120;\n\n // 2. Let additionPenalty be 20.\n let additionPenalty = 20;\n\n // 3. Let longLessPenalty be 8.\n let longLessPenalty = 8;\n\n // 4. Let longMorePenalty be 6.\n let longMorePenalty = 6;\n\n // 5. Let shortLessPenalty be 6.\n let shortLessPenalty = 6;\n\n // 6. Let shortMorePenalty be 3.\n let shortMorePenalty = 3;\n\n let patternPenalty = 2;\n\n let hour12Penalty = 1;\n\n // 7. Let bestScore be -Infinity.\n let bestScore = -Infinity;\n\n // 8. Let bestFormat be undefined.\n let bestFormat;\n\n // 9. Let i be 0.\n let i = 0;\n\n // 10. Assert: formats is an Array object.\n\n // 11. Let len be the result of calling the [[Get]] internal method of formats with argument \"length\".\n let len = formats.length;\n\n // 12. Repeat while i < len:\n while (i < len) {\n // a. Let format be the result of calling the [[Get]] internal method of formats with argument ToString(i).\n let format = formats[i];\n\n // b. Let score be 0.\n let score = 0;\n\n // c. For each property shown in Table 3:\n for (let property in dateTimeComponents) {\n if (!hop.call(dateTimeComponents, property))\n continue;\n\n // i. Let optionsProp be options.[[]].\n let optionsProp = options['[['+ property +']]'];\n\n // ii. Let formatPropDesc be the result of calling the [[GetOwnProperty]] internal method of format\n // with argument property.\n // iii. If formatPropDesc is not undefined, then\n // 1. Let formatProp be the result of calling the [[Get]] internal method of format with argument property.\n let formatProp = hop.call(format, property) ? format[property] : undefined;\n\n // Diverging: using the default properties produced by the pattern/skeleton\n // to match it with user options, and apply a penalty\n let patternProp = hop.call(format._, property) ? format._[property] : undefined;\n if (optionsProp !== patternProp) {\n score -= patternPenalty;\n }\n\n // iv. If optionsProp is undefined and formatProp is not undefined, then decrease score by\n // additionPenalty.\n if (optionsProp === undefined && formatProp !== undefined)\n score -= additionPenalty;\n\n // v. Else if optionsProp is not undefined and formatProp is undefined, then decrease score by\n // removalPenalty.\n else if (optionsProp !== undefined && formatProp === undefined)\n score -= removalPenalty;\n\n // vi. Else\n else {\n // 1. Let values be the array [\"2-digit\", \"numeric\", \"narrow\", \"short\",\n // \"long\"].\n let values = [ '2-digit', 'numeric', 'narrow', 'short', 'long' ];\n\n // 2. Let optionsPropIndex be the index of optionsProp within values.\n let optionsPropIndex = arrIndexOf.call(values, optionsProp);\n\n // 3. Let formatPropIndex be the index of formatProp within values.\n let formatPropIndex = arrIndexOf.call(values, formatProp);\n\n // 4. Let delta be max(min(formatPropIndex - optionsPropIndex, 2), -2).\n let delta = Math.max(Math.min(formatPropIndex - optionsPropIndex, 2), -2);\n\n {\n // diverging from spec\n // When the bestFit argument is true, subtract additional penalty where data types are not the same\n if ((formatPropIndex <= 1 && optionsPropIndex >= 2) || (formatPropIndex >= 2 && optionsPropIndex <= 1)) {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 0)\n score -= longMorePenalty;\n else if (delta < 0)\n score -= longLessPenalty;\n } else {\n // 5. If delta = 2, decrease score by longMorePenalty.\n if (delta > 1)\n score -= shortMorePenalty;\n else if (delta < -1)\n score -= shortLessPenalty;\n }\n }\n }\n }\n\n {\n // diverging to also take into consideration differences between 12 or 24 hours\n // which is special for the best fit only.\n if (format._.hour12 !== options.hour12) {\n score -= hour12Penalty;\n }\n }\n\n // d. If score > bestScore, then\n if (score > bestScore) {\n // i. Let bestScore be score.\n bestScore = score;\n // ii. Let bestFormat be format.\n bestFormat = format;\n }\n\n // e. Increase i by 1.\n i++;\n }\n\n // 13. Return bestFormat.\n return bestFormat;\n}\n\n/* 12.2.3 */internals.DateTimeFormat = {\n '[[availableLocales]]': [],\n '[[relevantExtensionKeys]]': ['ca', 'nu'],\n '[[localeData]]': {}\n};\n\n/**\n * When the supportedLocalesOf method of Intl.DateTimeFormat is called, the\n * following steps are taken:\n */\n/* 12.2.2 */\ndefineProperty(Intl.DateTimeFormat, 'supportedLocalesOf', {\n configurable: true,\n writable: true,\n value: fnBind.call(function (locales) {\n // Bound functions only have the `this` value altered if being used as a constructor,\n // this lets us imitate a native function that has no constructor\n if (!hop.call(this, '[[availableLocales]]'))\n throw new TypeError('supportedLocalesOf() is not a constructor');\n\n // Create an object whose props can be used to restore the values of RegExp props\n let regexpRestore = createRegExpRestore(),\n\n // 1. If options is not provided, then let options be undefined.\n options = arguments[1],\n\n // 2. Let availableLocales be the value of the [[availableLocales]] internal\n // property of the standard built-in object that is the initial value of\n // Intl.NumberFormat.\n\n availableLocales = this['[[availableLocales]]'],\n\n // 3. Let requestedLocales be the result of calling the CanonicalizeLocaleList\n // abstract operation (defined in 9.2.1) with argument locales.\n requestedLocales = CanonicalizeLocaleList(locales);\n\n // Restore the RegExp properties\n regexpRestore();\n\n // 4. Return the result of calling the SupportedLocales abstract operation\n // (defined in 9.2.8) with arguments availableLocales, requestedLocales,\n // and options.\n return SupportedLocales(availableLocales, requestedLocales, options);\n }, internals.NumberFormat)\n});\n\n/**\n * This named accessor property returns a function that formats a number\n * according to the effective locale and the formatting options of this\n * DateTimeFormat object.\n */\n/* 12.3.2 */defineProperty(Intl.DateTimeFormat.prototype, 'format', {\n configurable: true,\n get: GetFormatDateTime\n});\n\nfunction GetFormatDateTime() {\n let internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]'])\n throw new TypeError('`this` value for format() is not an initialized Intl.DateTimeFormat object.');\n\n // The value of the [[Get]] attribute is a function that takes the following\n // steps:\n\n // 1. If the [[boundFormat]] internal property of this DateTimeFormat object\n // is undefined, then:\n if (internal['[[boundFormat]]'] === undefined) {\n // a. Let F be a Function object, with internal properties set as\n // specified for built-in functions in ES5, 15, or successor, and the\n // length property set to 0, that takes the argument date and\n // performs the following steps:\n let F = function (date = undefined) {\n // i. If date is not provided or is undefined, then let x be the\n // result as if by the expression Date.now() where Date.now is\n // the standard built-in function defined in ES5, 15.9.4.4.\n // ii. Else let x be ToNumber(date).\n // iii. Return the result of calling the FormatDateTime abstract\n // operation (defined below) with arguments this and x.\n let x = date === undefined ? Date.now() : toNumber(date);\n return FormatDateTime(this, x);\n };\n // b. Let bind be the standard built-in function object defined in ES5,\n // 15.3.4.5.\n // c. Let bf be the result of calling the [[Call]] internal method of\n // bind with F as the this value and an argument list containing\n // the single item this.\n let bf = fnBind.call(F, this);\n // d. Set the [[boundFormat]] internal property of this NumberFormat\n // object to bf.\n internal['[[boundFormat]]'] = bf;\n }\n // Return the value of the [[boundFormat]] internal property of this\n // NumberFormat object.\n return internal['[[boundFormat]]'];\n}\n\nfunction formatToParts(date = undefined) {\n let internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n if (!internal || !internal['[[initializedDateTimeFormat]]'])\n throw new TypeError('`this` value for formatToParts() is not an initialized Intl.DateTimeFormat object.');\n\n let x = date === undefined ? Date.now() : toNumber(date);\n return FormatToPartsDateTime(this, x);\n}\n\nObject.defineProperty(Intl.DateTimeFormat.prototype, 'formatToParts', {\n enumerable: false,\n writable: true,\n configurable: true,\n value: formatToParts\n});\n\nfunction CreateDateTimeParts(dateTimeFormat, x) {\n // 1. If x is not a finite Number, then throw a RangeError exception.\n if (!isFinite(x))\n throw new RangeError('Invalid valid date passed to format');\n\n let internal = dateTimeFormat.__getInternalProperties(secret);\n\n // Creating restore point for properties on the RegExp object... please wait\n /* let regexpRestore = */createRegExpRestore(); // ###TODO: review this\n\n // 2. Let locale be the value of the [[locale]] internal property of dateTimeFormat.\n let locale = internal['[[locale]]'];\n\n // 3. Let nf be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {useGrouping: false}) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n let nf = new Intl.NumberFormat([locale], {useGrouping: false});\n\n // 4. Let nf2 be the result of creating a new NumberFormat object as if by the\n // expression new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping:\n // false}) where Intl.NumberFormat is the standard built-in constructor defined in\n // 11.1.3.\n let nf2 = new Intl.NumberFormat([locale], {minimumIntegerDigits: 2, useGrouping: false});\n\n // 5. Let tm be the result of calling the ToLocalTime abstract operation (defined\n // below) with x, the value of the [[calendar]] internal property of dateTimeFormat,\n // and the value of the [[timeZone]] internal property of dateTimeFormat.\n let tm = ToLocalTime(x, internal['[[calendar]]'], internal['[[timeZone]]']);\n\n // 6. Let result be the value of the [[pattern]] internal property of dateTimeFormat.\n let pattern = internal['[[pattern]]'];\n\n // 7.\n let result = new List();\n\n // 8.\n let index = 0;\n\n // 9.\n let beginIndex = pattern.indexOf('{');\n\n // 10.\n let endIndex = 0;\n\n // Need the locale minus any extensions\n let dataLocale = internal['[[dataLocale]]'];\n\n // Need the calendar data from CLDR\n let localeData = internals.DateTimeFormat['[[localeData]]'][dataLocale].calendars;\n let ca = internal['[[calendar]]'];\n\n // 11.\n while (beginIndex !== -1) {\n let fv;\n // a.\n endIndex = pattern.indexOf('}', beginIndex);\n // b.\n if (endIndex === -1) {\n throw new Error('Unclosed pattern');\n }\n // c.\n if (beginIndex > index) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(index, beginIndex)\n });\n }\n // d.\n let p = pattern.substring(beginIndex + 1, endIndex);\n // e.\n if (dateTimeComponents.hasOwnProperty(p)) {\n // i. Let f be the value of the [[

]] internal property of dateTimeFormat.\n let f = internal['[['+ p +']]'];\n // ii. Let v be the value of tm.[[

]].\n let v = tm['[['+ p +']]'];\n // iii. If p is \"year\" and v ≤ 0, then let v be 1 - v.\n if (p === 'year' && v <= 0) {\n v = 1 - v;\n }\n // iv. If p is \"month\", then increase v by 1.\n else if (p === 'month') {\n v++;\n }\n // v. If p is \"hour\" and the value of the [[hour12]] internal property of\n // dateTimeFormat is true, then\n else if (p === 'hour' && internal['[[hour12]]'] === true) {\n // 1. Let v be v modulo 12.\n v = v % 12;\n // 2. If v is 0 and the value of the [[hourNo0]] internal property of\n // dateTimeFormat is true, then let v be 12.\n if (v === 0 && internal['[[hourNo0]]'] === true) {\n v = 12;\n }\n }\n\n // vi. If f is \"numeric\", then\n if (f === 'numeric') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments nf and v.\n fv = FormatNumber(nf, v);\n }\n // vii. Else if f is \"2-digit\", then\n else if (f === '2-digit') {\n // 1. Let fv be the result of calling the FormatNumber abstract operation\n // with arguments nf2 and v.\n fv = FormatNumber(nf2, v);\n // 2. If the length of fv is greater than 2, let fv be the substring of fv\n // containing the last two characters.\n if (fv.length > 2) {\n fv = fv.slice(-2);\n }\n }\n // viii. Else if f is \"narrow\", \"short\", or \"long\", then let fv be a String\n // value representing f in the desired form; the String value depends upon\n // the implementation and the effective locale and calendar of\n // dateTimeFormat. If p is \"month\", then the String value may also depend\n // on whether dateTimeFormat has a [[day]] internal property. If p is\n // \"timeZoneName\", then the String value may also depend on the value of\n // the [[inDST]] field of tm.\n else if (f in dateWidths) {\n switch (p) {\n case 'month':\n fv = resolveDateString(localeData, ca, 'months', f, tm['[['+ p +']]']);\n break;\n\n case 'weekday':\n try {\n fv = resolveDateString(localeData, ca, 'days', f, tm['[['+ p +']]']);\n // fv = resolveDateString(ca.days, f)[tm['[['+ p +']]']];\n } catch (e) {\n throw new Error('Could not find weekday data for locale '+locale);\n }\n break;\n\n case 'timeZoneName':\n fv = ''; // ###TODO\n break;\n\n case 'era':\n try {\n fv = resolveDateString(localeData, ca, 'eras', f, tm['[['+ p +']]']);\n } catch (e) {\n throw new Error('Could not find era data for locale '+locale);\n }\n break;\n\n default:\n fv = tm['[['+ p +']]'];\n }\n }\n // ix\n arrPush.call(result, {\n type: p,\n value: fv\n });\n // f.\n } else if (p === 'ampm') {\n // i.\n let v = tm['[[hour]]'];\n // ii./iii.\n fv = resolveDateString(localeData, ca, 'dayPeriods', v > 11 ? 'pm' : 'am', null);\n // iv.\n arrPush.call(result, {\n type: 'dayPeriod',\n value: fv\n });\n // g.\n } else {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substring(beginIndex, endIndex + 1)\n });\n }\n // h.\n index = endIndex + 1;\n // i.\n beginIndex = pattern.indexOf('{', index);\n }\n // 12.\n if (endIndex < pattern.length - 1) {\n arrPush.call(result, {\n type: 'literal',\n value: pattern.substr(endIndex + 1)\n });\n }\n // 13.\n return result;\n}\n\n/**\n * When the FormatDateTime abstract operation is called with arguments dateTimeFormat\n * (which must be an object initialized as a DateTimeFormat) and x (which must be a Number\n * value), it returns a String value representing x (interpreted as a time value as\n * specified in ES5, 15.9.1.1) according to the effective locale and the formatting\n * options of dateTimeFormat.\n */\nexport function FormatDateTime(dateTimeFormat, x) {\n let parts = CreateDateTimeParts(dateTimeFormat, x);\n let result = '';\n\n for (let i = 0; parts.length > i; i++) {\n let part = parts[i];\n result += part.value;\n }\n return result;\n}\n\nfunction FormatToPartsDateTime(dateTimeFormat, x) {\n let parts = CreateDateTimeParts(dateTimeFormat, x);\n let result = [];\n for (let i = 0; parts.length > i; i++) {\n let part = parts[i];\n result.push({\n type: part.type,\n value: part.value\n });\n }\n return result;\n}\n\n\n/**\n * When the ToLocalTime abstract operation is called with arguments date, calendar, and\n * timeZone, the following steps are taken:\n */\nfunction ToLocalTime(date, calendar, timeZone) {\n // 1. Apply calendrical calculations on date for the given calendar and time zone to\n // produce weekday, era, year, month, day, hour, minute, second, and inDST values.\n // The calculations should use best available information about the specified\n // calendar and time zone. If the calendar is \"gregory\", then the calculations must\n // match the algorithms specified in ES5, 15.9.1, except that calculations are not\n // bound by the restrictions on the use of best available information on time zones\n // for local time zone adjustment and daylight saving time adjustment imposed by\n // ES5, 15.9.1.7 and 15.9.1.8.\n // ###TODO###\n let d = new Date(date),\n m = 'get' + (timeZone || '');\n\n // 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]],\n // [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding\n // calculated value.\n return new Record({\n '[[weekday]]': d[m + 'Day'](),\n '[[era]]' : +(d[m + 'FullYear']() >= 0),\n '[[year]]' : d[m + 'FullYear'](),\n '[[month]]' : d[m + 'Month'](),\n '[[day]]' : d[m + 'Date'](),\n '[[hour]]' : d[m + 'Hours'](),\n '[[minute]]' : d[m + 'Minutes'](),\n '[[second]]' : d[m + 'Seconds'](),\n '[[inDST]]' : false // ###TODO###\n });\n}\n\n/**\n * The function returns a new object whose properties and attributes are set as if\n * constructed by an object literal assigning to each of the following properties the\n * value of the corresponding internal property of this DateTimeFormat object (see 12.4):\n * locale, calendar, numberingSystem, timeZone, hour12, weekday, era, year, month, day,\n * hour, minute, second, and timeZoneName. Properties whose corresponding internal\n * properties are not present are not assigned.\n */\n/* 12.3.3 */defineProperty(Intl.DateTimeFormat.prototype, 'resolvedOptions', {\n writable: true,\n configurable: true,\n value: function () {\n let prop,\n descs = new Record(),\n props = [\n 'locale', 'calendar', 'numberingSystem', 'timeZone', 'hour12', 'weekday',\n 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName'\n ],\n internal = this !== null && typeof this === 'object' && getInternalProperties(this);\n\n // Satisfy test 12.3_b\n if (!internal || !internal['[[initializedDateTimeFormat]]'])\n throw new TypeError('`this` value for resolvedOptions() is not an initialized Intl.DateTimeFormat object.');\n\n for (let i = 0, max = props.length; i < max; i++) {\n if (hop.call(internal, prop = '[[' + props[i] + ']]'))\n descs[props[i]] = { value: internal[prop], writable: true, configurable: true, enumerable: true };\n }\n\n return objCreate({}, descs);\n }\n});\n","/**\n * @license Copyright 2013 Andy Earnshaw, MIT License\n *\n * Implements the ECMAScript Internationalization API in ES5-compatible environments,\n * following the ECMA-402 specification as closely as possible\n *\n * ECMA-402: http://ecma-international.org/ecma-402/1.0/\n *\n * CLDR format locale data should be provided using IntlPolyfill.__addLocaleData().\n */\n\nimport {\n defineProperty,\n hop,\n arrPush,\n arrShift,\n internals\n} from \"./util.js\";\n\nimport {\n IsStructurallyValidLanguageTag,\n defaultLocale,\n setDefaultLocale\n} from \"./6.locales-currencies-tz.js\";\n\nimport {\n Intl\n} from \"./8.intl.js\";\n\nimport \"./11.numberformat.js\";\n\nimport \"./12.datetimeformat.js\";\n\nimport ls from \"./13.locale-sensitive-functions.js\";\n\ndefineProperty(Intl, '__applyLocaleSensitivePrototypes', {\n writable: true,\n configurable: true,\n value: function () {\n defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString });\n // Need this here for IE 8, to avoid the _DontEnum_ bug\n defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString });\n\n for (let k in ls.Date) {\n if (hop.call(ls.Date, k))\n defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] });\n }\n }\n});\n\n/**\n * Can't really ship a single script with data for hundreds of locales, so we provide\n * this __addLocaleData method as a means for the developer to add the data on an\n * as-needed basis\n */\ndefineProperty(Intl, '__addLocaleData', {\n value: function (data) {\n if (!IsStructurallyValidLanguageTag(data.locale))\n throw new Error(`Invalid language tag \"${data.locale}\" when calling __addLocaleData(\"${data.locale}\", ...) to register new locale data.`);\n\n addLocaleData(data, data.locale);\n }\n});\n\nfunction addLocaleData (data, tag) {\n // Both NumberFormat and DateTimeFormat require number data, so throw if it isn't present\n if (!data.number)\n throw new Error(\"Object passed doesn't contain locale data for Intl.NumberFormat\");\n\n let locale,\n locales = [ tag ],\n parts = tag.split('-');\n\n // Create fallbacks for locale data with scripts, e.g. Latn, Hans, Vaii, etc\n if (parts.length > 2 && parts[1].length === 4)\n arrPush.call(locales, parts[0] + '-' + parts[2]);\n\n while ((locale = arrShift.call(locales))) {\n // Add to NumberFormat internal properties as per 11.2.3\n arrPush.call(internals.NumberFormat['[[availableLocales]]'], locale);\n internals.NumberFormat['[[localeData]]'][locale] = data.number;\n\n // ...and DateTimeFormat internal properties as per 12.2.3\n if (data.date) {\n data.date.nu = data.number.nu;\n arrPush.call(internals.DateTimeFormat['[[availableLocales]]'], locale);\n internals.DateTimeFormat['[[localeData]]'][locale] = data.date;\n }\n }\n\n // If this is the first set of locale data added, make it the default\n if (defaultLocale === undefined)\n setDefaultLocale(tag);\n}\n\ndefineProperty(Intl, '__disableRegExpRestore', {\n value: function () {\n internals.disableRegExpRestore = true;\n }\n});\n\nexport default Intl;\n","/**\n* Defines regular expressions for various operations related to the BCP 47 syntax,\n* as defined at http://tools.ietf.org/html/bcp47#section-2.1\n*/\n\n// extlang = 3ALPHA ; selected ISO 639 codes\n// *2(\"-\" 3ALPHA) ; permanently reserved\nconst extlang = '[a-z]{3}(?:-[a-z]{3}){0,2}';\n\n// language = 2*3ALPHA ; shortest ISO 639 code\n// [\"-\" extlang] ; sometimes followed by\n// ; extended language subtags\n// / 4ALPHA ; or reserved for future use\n// / 5*8ALPHA ; or registered language subtag\nconst language = '(?:[a-z]{2,3}(?:-' + extlang + ')?|[a-z]{4}|[a-z]{5,8})';\n\n// script = 4ALPHA ; ISO 15924 code\nconst script = '[a-z]{4}';\n\n// region = 2ALPHA ; ISO 3166-1 code\n// / 3DIGIT ; UN M.49 code\nconst region = '(?:[a-z]{2}|\\\\d{3})';\n\n// variant = 5*8alphanum ; registered variants\n// / (DIGIT 3alphanum)\nconst variant = '(?:[a-z0-9]{5,8}|\\\\d[a-z0-9]{3})';\n\n// ; Single alphanumerics\n// ; \"x\" reserved for private use\n// singleton = DIGIT ; 0 - 9\n// / %x41-57 ; A - W\n// / %x59-5A ; Y - Z\n// / %x61-77 ; a - w\n// / %x79-7A ; y - z\nconst singleton = '[0-9a-wy-z]';\n\n// extension = singleton 1*(\"-\" (2*8alphanum))\nconst extension = singleton + '(?:-[a-z0-9]{2,8})+';\n\n// privateuse = \"x\" 1*(\"-\" (1*8alphanum))\nconst privateuse = 'x(?:-[a-z0-9]{1,8})+';\n\n// irregular = \"en-GB-oed\" ; irregular tags do not match\n// / \"i-ami\" ; the 'langtag' production and\n// / \"i-bnn\" ; would not otherwise be\n// / \"i-default\" ; considered 'well-formed'\n// / \"i-enochian\" ; These tags are all valid,\n// / \"i-hak\" ; but most are deprecated\n// / \"i-klingon\" ; in favor of more modern\n// / \"i-lux\" ; subtags or subtag\n// / \"i-mingo\" ; combination\n// / \"i-navajo\"\n// / \"i-pwn\"\n// / \"i-tao\"\n// / \"i-tay\"\n// / \"i-tsu\"\n// / \"sgn-BE-FR\"\n// / \"sgn-BE-NL\"\n// / \"sgn-CH-DE\"\nconst irregular = '(?:en-GB-oed'\n + '|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)'\n + '|sgn-(?:BE-FR|BE-NL|CH-DE))';\n\n// regular = \"art-lojban\" ; these tags match the 'langtag'\n// / \"cel-gaulish\" ; production, but their subtags\n// / \"no-bok\" ; are not extended language\n// / \"no-nyn\" ; or variant subtags: their meaning\n// / \"zh-guoyu\" ; is defined by their registration\n// / \"zh-hakka\" ; and all of these are deprecated\n// / \"zh-min\" ; in favor of a more modern\n// / \"zh-min-nan\" ; subtag or sequence of subtags\n// / \"zh-xiang\"\nconst regular = '(?:art-lojban|cel-gaulish|no-bok|no-nyn'\n + '|zh-(?:guoyu|hakka|min|min-nan|xiang))';\n\n// grandfathered = irregular ; non-redundant tags registered\n// / regular ; during the RFC 3066 era\nconst grandfathered = '(?:' + irregular + '|' + regular + ')';\n\n// langtag = language\n// [\"-\" script]\n// [\"-\" region]\n// *(\"-\" variant)\n// *(\"-\" extension)\n// [\"-\" privateuse]\nconst langtag = language + '(?:-' + script + ')?(?:-' + region + ')?(?:-'\n + variant + ')*(?:-' + extension + ')*(?:-' + privateuse + ')?';\n\n// Language-Tag = langtag ; normal language tags\n// / privateuse ; private use tag\n// / grandfathered ; grandfathered tags\nexport let expBCP47Syntax = RegExp('^(?:'+langtag+'|'+privateuse+'|'+grandfathered+')$', 'i');\n\n// Match duplicate variants in a language tag\nexport let expVariantDupes = RegExp('^(?!x).*?-('+variant+')-(?:\\\\w{4,8}-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match duplicate singletons in a language tag (except in private use)\nexport let expSingletonDupes = RegExp('^(?!x).*?-('+singleton+')-(?:\\\\w+-(?!x-))*\\\\1\\\\b', 'i');\n\n// Match all extension sequences\nexport let expExtSequences = RegExp('-'+extension, 'ig');\n","// Sect 13 Locale Sensitive Functions of the ECMAScript Language Specification\n// ===========================================================================\n\nimport {\n Intl\n} from \"./8.intl.js\";\n\nimport {\n FormatNumber,\n NumberFormatConstructor\n} from \"./11.numberformat.js\";\n\nimport {\n ToDateTimeOptions,\n DateTimeFormatConstructor,\n FormatDateTime\n} from \"./12.datetimeformat.js\";\n\nlet ls = Intl.__localeSensitiveProtos = {\n Number: {},\n Date: {}\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.2.1 */ls.Number.toLocaleString = function () {\n // Satisfy test 13.2.1_1\n if (Object.prototype.toString.call(this) !== '[object Number]')\n throw new TypeError('`this` value must be a number for Number.prototype.toLocaleString()');\n\n // 1. Let x be this Number value (as defined in ES5, 15.7.4).\n // 2. If locales is not provided, then let locales be undefined.\n // 3. If options is not provided, then let options be undefined.\n // 4. Let numberFormat be the result of creating a new object as if by the\n // expression new Intl.NumberFormat(locales, options) where\n // Intl.NumberFormat is the standard built-in constructor defined in 11.1.3.\n // 5. Return the result of calling the FormatNumber abstract operation\n // (defined in 11.3.2) with arguments numberFormat and x.\n return FormatNumber(new NumberFormatConstructor(arguments[0], arguments[1]), this);\n};\n\n/**\n * When the toLocaleString method is called with optional arguments locales and options,\n * the following steps are taken:\n */\n/* 13.3.1 */ls.Date.toLocaleString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]')\n throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n let x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x))\n return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n let locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n let options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"any\", and \"all\".\n options = ToDateTimeOptions(options, 'any', 'all');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n let dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleDateString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.2 */ls.Date.toLocaleDateString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]')\n throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleDateString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n let x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x))\n return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n let locales = arguments[0],\n\n // 4. If options is not provided, then let options be undefined.\n options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"date\", and \"date\".\n options = ToDateTimeOptions(options, 'date', 'date');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n let dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\n/**\n * When the toLocaleTimeString method is called with optional arguments locales and\n * options, the following steps are taken:\n */\n/* 13.3.3 */ls.Date.toLocaleTimeString = function () {\n // Satisfy test 13.3.0_1\n if (Object.prototype.toString.call(this) !== '[object Date]')\n throw new TypeError('`this` value must be a Date instance for Date.prototype.toLocaleTimeString()');\n\n // 1. Let x be this time value (as defined in ES5, 15.9.5).\n let x = +this;\n\n // 2. If x is NaN, then return \"Invalid Date\".\n if (isNaN(x))\n return 'Invalid Date';\n\n // 3. If locales is not provided, then let locales be undefined.\n let locales = arguments[0];\n\n // 4. If options is not provided, then let options be undefined.\n let options = arguments[1];\n\n // 5. Let options be the result of calling the ToDateTimeOptions abstract\n // operation (defined in 12.1.1) with arguments options, \"time\", and \"time\".\n options = ToDateTimeOptions(options, 'time', 'time');\n\n // 6. Let dateTimeFormat be the result of creating a new object as if by the\n // expression new Intl.DateTimeFormat(locales, options) where\n // Intl.DateTimeFormat is the standard built-in constructor defined in 12.1.3.\n let dateTimeFormat = new DateTimeFormatConstructor(locales, options);\n\n // 7. Return the result of calling the FormatDateTime abstract operation (defined\n // in 12.3.2) with arguments dateTimeFormat and x.\n return FormatDateTime(dateTimeFormat, x);\n};\n\nexport default ls;\n","import IntlPolyfill from \"./core.js\";\n\n// hack to export the polyfill as global Intl if needed\nif (typeof Intl === 'undefined') {\n try {\n window.Intl = IntlPolyfill;\n IntlPolyfill.__applyLocaleSensitivePrototypes();\n } catch (e) {\n // can be read only property\n }\n}\n\nexport default IntlPolyfill;\n"],"names":["log10Floor","n","Math","log10","floor","x","round","log","LOG10E","Number","Record","obj","k","hop","call","defineProperty","this","value","enumerable","writable","configurable","List","arguments","length","arrPush","apply","arrSlice","createRegExpRestore","internals","disableRegExpRestore","regExpCache","RegExp","lastMatch","leftContext","multiline","input","has","i","esc","replace","exprStr","m","substring","indexOf","match","expr","lastIndex","exec","toObject","arg","TypeError","Object","toNumber","toInteger","number","isNaN","Infinity","abs","toLength","len","pow","min","getInternalProperties","__getInternalProperties","secret","objCreate","setDefaultLocale","locale","toLatinUpperCase","str","ch","charAt","slice","toUpperCase","IsStructurallyValidLanguageTag","expBCP47Syntax","test","expVariantDupes","expSingletonDupes","CanonicalizeLanguageTag","parts","toLowerCase","split","max","arrJoin","expExtSequences","sort","source","redundantTags","tags","subtags","extLang","DefaultLocale","defaultLocale","IsWellFormedCurrencyCode","currency","c","String","normalized","expCurrencyCode","CanonicalizeLocaleList","locales","undefined","seen","O","Pk","kPresent","kValue","tag","RangeError","arrIndexOf","BestAvailableLocale","availableLocales","candidate","pos","lastIndexOf","LookupMatcher","requestedLocales","availableLocale","noExtensionsLocale","expUnicodeExSeq","result","extension","extensionIndex","BestFitMatcher","UnicodeExtensionSubtags","size","extensionSubtags","attribute","q","p","t","codePointAt","type","push","key","attr","tail","ResolveLocale","options","relevantExtensionKeys","localeData","ReferenceError","matcher","r","foundLocale","extensionSubtagsLength","supportedExtension","foundLocaleData","keyLocaleData","supportedExtensionAddition","keyPos","requestedValue","valuePos","optionsValue","privateIndex","preExtension","postExtension","LookupSupportedLocales","subset","subsetArray","BestFitSupportedLocales","SupportedLocales","localeMatcher","P","GetOption","property","values","fallback","Boolean","GetNumberOption","minimum","maximum","getCanonicalLocales","ll","NumberFormatConstructor","Intl","InitializeNumberFormat","NumberFormat","numberFormat","internal","regexpRestore","opt","dataLocale","s","cDigits","CurrencyDigits","cd","mnid","mnfdDefault","mnfd","mxfdDefault","mxfd","mnsd","minimumSignificantDigits","mxsd","maximumSignificantDigits","g","dataLocaleData","patterns","stylePatterns","positivePattern","negativePattern","es3","format","GetFormatNumber","currencyMinorUnits","babelHelpers[\"typeof\"]","F","FormatNumber","bf","fnBind","formatToParts","FormatNumberToParts","PartitionNumberPattern","part","FormatNumberToString","ToRawPrecision","ToRawFixed","nums","data","ild","symbols","latn","pattern","beginIndex","endIndex","nextIndex","Error","literal","[[type]]","[[value]]","nan","isFinite","numSys","digits","digit","integer","fraction","decimalSepIndex","groupSepSymbol","group","groups","pgSize","primaryGroupSize","sgSize","secondaryGroupSize","end","idx","start","integerGroup","arrShift","decimalSepSymbol","decimal","infinity","plusSignSymbol","plusSign","minusSignSymbol","minusSign","percentSignSymbol","percentSign","currencies","minPrecision","maxPrecision","e","Array","f","exp","LN10","cut","minInteger","minFraction","maxFraction","toFixed","int","z","a","b","isDateFormatOnly","tmKeys","hasOwnProperty","isTimeFormatOnly","dtKeys","joinDateAndTimeFormats","dateFormatObj","timeFormatObj","o","_","j","computeFinalPatterns","formatObj","pattern12","extendedPattern","$0","expPatternTrimmer","expDTComponentsMeta","era","year","quarter","month","week","day","weekday","hour12","hour","minute","second","timeZoneName","createDateTimeFormat","skeleton","unwantedDTCs","expDTComponents","createDateTimeFormats","formats","availableFormats","timeFormats","dateFormats","computed","timeRelatedFormats","dateRelatedFormats","full","long","medium","short","originalPattern","generateSyntheticFormat","propName","propValue","validSyntheticProps","resolveDateString","ca","component","width","gregory","alts","resolved","DateTimeFormatConstructor","InitializeDateTimeFormat","DateTimeFormat","dateTimeFormat","ToDateTimeOptions","tz","timeZone","prop","dateTimeComponents","bestFormat","ToDateTimeFormats","BasicFormatMatcher","hr12","BestFitFormatMatcher","hourNo0","GetFormatDateTime","prototype","toString","required","defaults","opt2","create","needDefaults","removalPenalty","additionPenalty","longLessPenalty","longMorePenalty","shortLessPenalty","shortMorePenalty","bestScore","score","optionsProp","formatProp","optionsPropIndex","formatPropIndex","delta","optionsPropNames","patternPenalty","hour12Penalty","patternProp","date","Date","now","FormatDateTime","FormatToPartsDateTime","CreateDateTimeParts","nf","useGrouping","nf2","minimumIntegerDigits","tm","ToLocalTime","index","calendars","fv","v","dateWidths","substr","calendar","d","addLocaleData","nu","realDefineProp","sentinel","__defineGetter__","name","desc","get","search","proto","props","arrConcat","concat","join","shift","Function","bind","thisObj","fn","args","random","extlang","language","script","region","variant","singleton","privateuse","irregular","regular","grandfathered","langtag","BYR","XOF","BIF","XAF","CLF","CLP","KMF","DJF","GNF","ISK","IQD","JPY","JOD","KRW","KWD","LYD","PYG","RWF","TND","UGX","UYI","VUV","VND","descs","narrow","ls","__localeSensitiveProtos","toLocaleString","toLocaleDateString","toLocaleTimeString","defineProperty$$1","IntlPolyfill","__applyLocaleSensitivePrototypes"],"mappings":"uLAmGA,SAAgBA,GAAYC,MAEE,kBAAfC,MAAKC,MACZ,MAAOD,MAAKE,MAAMF,KAAKC,MAAMF,OAE7BI,GAAIH,KAAKI,MAAMJ,KAAKK,IAAIN,GAAKC,KAAKM,cAC/BH,IAAKI,OAAO,KAAOJ,GAAKJ,GAMnC,QAAgBS,GAAQC,OAEf,GAAIC,KAAKD,IACNA,YAAeD,IAAUG,GAAIC,KAAKH,EAAKC,KACvCG,GAAeC,KAAMJ,GAAKK,MAAON,EAAIC,GAAIM,YAAY,EAAMC,UAAU,EAAMC,cAAc,IAQrG,QAAgBC,QACGL,KAAM,UAAYG,UAAS,EAAMF,MAAO,IAEnDK,UAAUC,QACVC,GAAQC,MAAMT,KAAMU,GAASZ,KAAKQ,YAO1C,QAAgBK,QACRC,GAAUC,2BACH,kBAYN,GATDC,cACeC,OAAOC,WAAa,eAClBD,OAAOE,sBACTF,OAAOG,gBACXH,OAAOI,OAElBC,GAAM,EAGDC,EAAI,EAAGA,GAAK,EAAGA,OACbP,EAAY,IAAIO,GAAKN,OAAO,IAAIM,KAAOD,CAElD,OAAO,eAECE,GAAM,uBACNN,EAAYF,EAAYE,UAAUO,QAAQD,EAAK,QAC/CE,EAAU,MAGVJ,MACK,GAAIC,GAAI,EAAGA,GAAK,EAAGA,IAAK,IACrBI,GAAIX,EAAY,IAAIO,EAGnBI,MAMGA,EAAEF,QAAQD,EAAK,WACRN,EAAUU,UAAU,EAAGV,EAAUW,QAAQF,IAAM,MAC9CA,EAAI,IAAMT,EAAUU,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AAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,WACP,MAAO,YACP,MAAO,WACP,MAAO,WACP,MAAO,WACP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,mFAGpB7C,IAAKW,QAGLuC,MAAMlD,GACN,MAAO,kBAGPgG,GAAU/E,UAAU,GAGpBqH,EAAUrH,UAAU,KAId8T,EAAkBzM,EAAS,OAAQ,WAKzCwM,GAAiB,GAAIH,GAA0B3O,EAASsC,SAIrDgP,IAAexC,EAAgB9U,IFzI1Cqc,GAwBe1R,GAAM,8CACP,gBACI,QACP,cACYvK,OAAOuV,UAAW,kBAAoB7U,UAAU,EAAMC,cAAc,EAAMH,MAAOob,GAAG5b,OAAO8b,oBAE3F9E,KAAKzB,UAAW,kBAAoB7U,UAAU,EAAMC,cAAc,EAAMH,MAAOob,GAAG5E,KAAK8E,qBAEjG,GAAI3b,KAAKyb,IAAG5E,KACT5W,GAAIC,KAAKub,GAAG5E,KAAM7W,IAClBG,GAAe0W,KAAKzB,UAAWpV,GAAKO,UAAU,EAAMC,cAAc,EAAMH,MAAOob,GAAG5E,KAAK7W,QAUvGG,GAAeiK,GAAM,yBACV,SAAU4C,OACRlJ,EAA+BkJ,EAAKzJ,QACrC,KAAM,IAAIiK,gCAA+BR,EAAKzJ,0CAAyCyJ,EAAKzJ,kDAElFyJ,EAAMA,EAAKzJ,WAmCjCpD,GAAeiK,GAAM,gCACV,cACOnJ,sBAAuB,KG9FrB,mBAATmJ,iBAEIA,KAAO2R,MACDC,mCACf,MAAOpM"} \ No newline at end of file diff --git a/package.json b/package.json index 70494781..a41e11e9 100644 --- a/package.json +++ b/package.json @@ -50,11 +50,7 @@ "scripts": { "clean": "rimraf dist/ lib/ locale-data/", "build:data": "babel-node scripts/build-data", - "build:lib": "babel-node scripts/build-lib", - "build:dist:dev": "NODE_ENV=development babel-node scripts/build-dist", - "build:dist:prod": "NODE_ENV=production babel-node scripts/build-dist", - "build:dist": "npm run build:dist:dev && npm run build:dist:prod", - "build": "npm run build:data && npm run build:lib && npm run build:dist", + "build": "npm run build:data", "lint": "eslint .", "test": "cd tests && node polyfilling.js && node sanity.js && node disableregexprestore.js && node noderunner.js", "pretest": "npm run lint", diff --git a/scripts/.babelrc b/scripts/.babelrc deleted file mode 100644 index 8591b662..00000000 --- a/scripts/.babelrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "presets": [ - "es2015" - ] -} diff --git a/scripts/build-dist.js b/scripts/build-dist.js deleted file mode 100644 index 42f63048..00000000 --- a/scripts/build-dist.js +++ /dev/null @@ -1,54 +0,0 @@ -/*global Promise*/ - -import * as p from 'path'; -import * as fs from 'fs'; -import {rollup} from 'rollup'; -import babel from 'rollup-plugin-babel'; -import commonjs from 'rollup-plugin-commonjs'; -import uglify from 'rollup-plugin-uglify'; - -const isProduction = process.env.NODE_ENV === 'production'; - -const entry = p.resolve('src/browser-main.js'); -const dest = p.resolve(`dist/Intl.${isProduction ? 'min.js' : 'js'}`); - -const bundleConfig = { - dest, - format: 'umd', - moduleName: 'IntlPolyfill', - sourceMap: true, - external: ['Intl'] -}; - -let babelConfig = JSON.parse(fs.readFileSync('src/.babelrc', 'utf8')); -babelConfig.babelrc = false; -babelConfig.presets = babelConfig.presets.map((preset) => { - return preset === 'es2015' ? 'es2015-rollup' : preset; -}); - -let plugins = [ - babel(babelConfig), - commonjs({ - sourceMap: true - }) -]; - -if (isProduction) { - plugins.push( - uglify({ - warnings: false - }) - ); -} - -let bundle = Promise.resolve(rollup({entry, plugins})); -bundle.then(({write}) => write(bundleConfig)).then(() => { - - // special case for locale-data/complete.js - const lib = fs.readFileSync(dest); - const complete = fs.readFileSync(p.resolve('locale-data/complete.js')); - fs.writeFileSync(p.resolve('dist/Intl.complete.js'), `${lib}\n${complete}`); - -}); - -process.on('unhandledRejection', (reason) => {throw reason;}); diff --git a/scripts/build-lib.js b/scripts/build-lib.js deleted file mode 100644 index 6b19d6b6..00000000 --- a/scripts/build-lib.js +++ /dev/null @@ -1,29 +0,0 @@ -/*global Promise*/ - -import * as p from 'path'; -import * as fs from 'fs'; -import {rollup} from 'rollup'; -import babel from 'rollup-plugin-babel'; - -let babelConfig = JSON.parse(fs.readFileSync('src/.babelrc', 'utf8')); -babelConfig.babelrc = false; -babelConfig.presets = babelConfig.presets.map((preset) => { - return preset === 'es2015' ? 'es2015-rollup' : preset; -}); - -let bundle = rollup({ - entry: p.resolve('src/core.js'), - plugins: [ - babel(babelConfig) - ] -}); - -// Cast to native Promise. -bundle = Promise.resolve(bundle); - -bundle.then(({write}) => write({ - dest: p.resolve('lib/core.js'), - format: 'cjs' -})); - -process.on('unhandledRejection', (reason) => {throw reason;});