angular-cn/third_party/shims_for_IE.js

98 lines
69 KiB
JavaScript
Raw Normal View History

// This file is used for internal testing with Karma only, it should not be used in real applications.
2015-08-20 04:02:42 -04:00
// function.name (all IE)
/*! @source https://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/
2015-08-20 04:02:42 -04:00
if (!Object.hasOwnProperty('name')) {
Object.defineProperty(Function.prototype, 'name', {
get: function() {
var matches = this.toString().match(/^\s*function\s*((?![0-9])[a-zA-Z0-9_$]*)\s*\(/);
var name = matches && matches.length > 1 ? matches[1] : "";
2015-08-20 04:02:42 -04:00
// For better performance only parse once, and then cache the
// result through a new accessor for repeated access.
Object.defineProperty(this, 'name', {value: name});
return name;
}
});
}
// URL polyfill for SystemJS (all IE)
/*! @source https://github.com/ModuleLoader/es6-module-loader/blob/master/src/url-polyfill.js*/
// from https://gist.github.com/Yaffle/1088850
(function(global) {
function URLPolyfill(url, baseURL) {
if (typeof url != 'string') {
throw new TypeError('URL must be a string');
}
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
if (!m) {
throw new RangeError();
}
var protocol = m[1] || "";
var username = m[2] || "";
var password = m[3] || "";
var host = m[4] || "";
var hostname = m[5] || "";
var port = m[6] || "";
var pathname = m[7] || "";
var search = m[8] || "";
var hash = m[9] || "";
if (baseURL !== undefined) {
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
var flag = protocol === "" && host === "" && username === "";
if (flag && pathname === "" && search === "") {
search = base.search;
}
if (flag && pathname.charAt(0) !== "/") {
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
}
// dot segments removal
var output = [];
pathname.replace(/^(\.\.?(\/|$))+/, "")
.replace(/\/(\.(\/|$))+/g, "/")
.replace(/\/\.\.$/, "/../")
.replace(/\/?[^\/]*/g, function (p) {
if (p === "/..") {
output.pop();
} else {
output.push(p);
}
});
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : "");
if (flag) {
port = base.port;
hostname = base.hostname;
host = base.host;
password = base.password;
username = base.username;
}
if (protocol === "") {
protocol = base.protocol;
}
}
// convert windows file URLs to use /
if (protocol == 'file:')
pathname = pathname.replace(/\\/g, '/');
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host;
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
this.protocol = protocol;
this.username = username;
this.password = password;
this.host = host;
this.hostname = hostname;
this.port = port;
this.pathname = pathname;
this.search = search;
this.hash = hash;
}
global.URLPolyfill = URLPolyfill;
})(typeof self != 'undefined' ? self : global);
// Intl (IE9, IE10, all Safari, all Android)
/*! @source https://github.com/andyearnshaw/Intl.js */
/*! @licence https://github.com/andyearnshaw/Intl.js/blob/master/LICENSE.txt */
!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 t in e)(e instanceof r||ee.call(e,t))&&re(this,t,{value:e[t],enumerable:!0,writable:!0,configurable:!0})}function t(){re(this,"length",{writable:!0,value:0}),arguments.length&&oe.apply(this,ae.call(arguments))}function n(){if(ue.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,a=e.lastMatch.replace(n,"\\$&"),i=new t;if(r)for(var o=1;o<=9;o++){var s=e["$"+o];s?(s=s.replace(n,"\\$&"),a=a.replace(s,"("+s+")")):a="()"+a,oe.call(i,a.slice(0,a.indexOf("(")+1)),a=a.slice(a.indexOf("(")+1)}var l=se.call(i,"")+a;l=l.replace(/(\\\(|\\\)|[^()])+/g,function(e){return"[\\s\\S]{"+e.replace("\\","").length+"}"});var c=new RegExp(l,e.multiline?"gm":"g");c.lastIndex=e.leftContext.length,c.exec(e.input)}}function a(e){if(null===e)throw new TypeError("Cannot convert null or undefined to object");return Object(e)}function i(e){return ee.call(e,"__getInternalProperties")?e.__getInternalProperties(ge):ne(null)}function o(e){Se=e}function s(e){for(var r=e.length;r--;){var t=e.charAt(r);t>="a"&&t<="z"&&(e=e.slice(0,r)+t.toUpperCase()+e.slice(r+1))}return e}function l(e){return!!ze.test(e)&&(!ke.test(e)&&!Fe.test(e))}function c(e){var r=void 0,t=void 0;e=e.toLowerCase(),t=e.split("-");for(var n=1,a=t.length;n<a;n++)if(2===t[n].length)t[n]=t[n].toUpperCase();else if(4===t[n].length)t[n]=t[n].charAt(0).toUpperCase()+t[n].slice(1);else if(1===t[n].length&&"x"!==t[n])break;e=se.call(t,"-"),(r=e.match(Oe))&&r.length>1&&(r.sort(),e=e.replace(RegExp("(?:"+Oe.source+")+","i"),se.call(r,""))),ee.call(Ee.tags,e)&&(e=Ee.tags[e]),t=e.split("-");for(var i=1,o=t.length;i<o;i++)ee.call(Ee.subtags,t[i])?t[i]=Ee.subtags[t[i]]:ee.call(Ee.extLang,t[i])&&(t[i]=Ee.extLang[t[i]][0],1===i&&Ee.extLang[t[1]][1]===t[0]&&(t=ae.call(t,i++),o-=1));return se.call(t,"-")}function u(){return Se}function g(e){var r=String(e),t=s(r);return Le.test(t)!==!1}function f(e){if(void 0===e)return new t;var r=new t;e="string"==typeof e?[e]:e;for(var n=a(e),i=n.length,o=0;o<i;){var s=String(o),u=s in n;if(u){var g=n[s];if(null===g||"string"!=typeof g&&"object"!==("undefined"==typeof g?"undefined":ir.typeof(g)))throw new TypeError("String or Object type expected");var f=String(g);if(!l(f))throw new RangeError("'"+f+"' is not a structurally valid language tag");f=c(f),te.call(r,f)===-1&&oe.call(r,f)}o++}return r}function m(e,r){for(var t=r;t;){if(te.call(e,t)>-1)return t;var n=t.lastIndexOf("-");if(n<0)return;n>=2&&"-"===t.charAt(n-2)&&(n-=2),t=t.substring(0,n)}}function v(e,t){for(var n=0,a=t.length,i=void 0,o=void 0,s=void 0;n<a&&!i;)o=t[n],s=String(o).replace(or,""),i=m(e,s),n++;var l=new r;if(void 0!==i){if(l["[[locale]]"]=i,String(o)!==String(s)){var c=o.match(or)[0],g=o.indexOf("-u-");l["[[extension]]"]=c,l["[[extensionIndex]]"]=g}}else l["[[locale]]"]=u();return l}function d(e,r){return v(e,r)}function h(e,t,n,a,i){if(0===e.length)throw new ReferenceError("No locale data has been provided for this object yet.");var o=n["[[localeMatcher]]"],s=void 0;s="lookup"===o?v(e,t):d(e,t);var l=s["[[locale]]"],u=void 0,g=void 0;if(ee.call(s,"[[extension]]")){var f=s["[[extension]]"],m=String.prototype.split;u=m.call(f,"-"),g=u.length}var h=new r;h["[[dataLocale]]"]=l;for(var p="-u",y=0,b=a.length;y<b;){var w=a[y],x=i[l],D=x[w],j=D[0],z="",k=te;if(void 0!==u){var F=k.call(u,w);if(F!==-1)if(F+1<g&&u[F+1].length>2){var O=u[F+1],S=k.call(D,O);S!==-1&&(j=O,z="-"+w+"-"+j)}else{var E=k(D,"true");E!==-1&&(j="true")}}if(ee.call(n,"[["+w+"]]")){var L=n["[["+w+"]]"];k.call(D,L)!==-1&&L!==j&&(j=L,z="")}h["[["+w+"]]"]=j,p+=z,y++}if(p.length>2){var P=l.in
!r||n.length!==r););return n}throw new TypeError("Invalid attempt to destructure non-iterable instance")},Qe=function(e,r){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(r)}}))},er=function(e,r){return e.raw=r,e},rr=function(e,r,t){if(e===t)throw new ReferenceError(r+" is not defined - temporal dead zone");return e},tr={},nr=function(e){return Array.isArray(e)?e:Array.from(e)},ar=function(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)},ir=Object.freeze({jsx:Ne,asyncToGenerator:Te,classCallCheck:_e,createClass:Ie,defineEnumerableProperties:Ae,defaults:Me,defineProperty:Re,get:Ce,inherits:Ge,interopRequireDefault:Be,interopRequireWildcard:Ue,newArrowCheck:$e,objectDestructuringEmpty:Ke,objectWithoutProperties:Ye,possibleConstructorReturn:He,selfGlobal:We,set:Xe,slicedToArray:Ve,slicedToArrayLoose:Je,taggedTemplateLiteral:Qe,taggedTemplateLiteralLoose:er,temporalRef:rr,temporalUndefined:tr,toArray:nr,toConsumableArray:ar,typeof:Pe,extends:qe,instanceof:Ze}),or=/-u(?:-[0-9a-z]{2,8})+/gi,sr={};sr.getCanonicalLocales=function(e){var r=f(e),t=[];for(var n in r)t.push(r[n]);return t};var lr={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};re(sr,"NumberFormat",{configurable:!0,writable:!0,value:D}),re(sr.NumberFormat,"prototype",{writable:!1}),ue.NumberFormat={"[[availableLocales]]":[],"[[relevantExtensionKeys]]":["nu"],"[[localeData]]":{}},re(sr.NumberFormat,"supportedLocalesOf",{configurable:!0,writable:!0,value:ce.call(function(e){if(!ee.call(this,"[[availableLocales]]"))throw new TypeError("supportedLocalesOf() is not a constructor");var r=n(),t=arguments[1],a=this["[[availableLocales]]"],i=f(e);return r(),b(a,i,t)},ue.NumberFormat)}),re(sr.NumberFormat.prototype,"format",{configurable:!0,get:k}),sr.NumberFormat.prototype.formatToParts=function(e){var r=null!==this&&"object"===ir.typeof(this)&&i(this);if(!r||!r["[[initializedNumberFormat]]"])throw new TypeError("`this` value for formatToParts() is not an initialized Intl.NumberFormat object.");var t=Number(e);return F(this,t)};var cr={arab:["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],arabext:["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],bali:["᭐","᭑","᭒","᭓","᭔","᭕","᭖","᭗","᭘","᭙"],beng:["","১","২","৩","","৫","৬","","৮","৯"],deva:["","१","२","३","४","५","६","७","८","९"],fullwide:["","","","","","","","","",""],gujr:["","૧","૨","૩","૪","૫","૬","૭","૮","૯"],guru:["","","੨","੩","","੫","੬","੭","੮","੯"],hanidec:["","一","二","三","四","五","六","七","八","九"],khmr:["០","១","២","៣","៤","៥","៦","៧","៨","៩"],knda:["","೧","೨","೩","೪","೫","೬","೭","೮","೯"],laoo:["","໑","໒","໓","໔","໕","໖","໗","໘","໙"],latn:["0","1","2","3","4","5","6","7","8","9"],limb:["᥆","᥇","᥈","᥉","᥊","᥋","᥌","᥍","᥎","᥏"],mlym:["","൧","൨","൩","൪","൫","൬","","൮","൯"],mong:["᠐","᠑","᠒","᠓","᠔","᠕","᠖","᠗","᠘","᠙"],mymr:["","၁","၂","၃","၄","၅","၆","၇","၈","၉"],orya:["","୧","","୩","୪","୫","୬","୭","୮","୯"],tamldec:["","௧","௨","௩","௪","௫","௬","௭","௮","௯"],telu:["","౧","౨","౩","౪","౫","౬","౭","౮","౯"],thai:["","๑","๒","๓","๔","๕","๖","๗","๘","๙"],tibt:["༠","༡","༢","༣","༤","༥","༦","༧","༨","༩"]};re(sr.NumberFormat.prototype,"resolvedOptions",{configurable:!0,writable:!0,value:function(){var e=void 0,t=new r,n=["locale","numberingSystem","style","currency","currencyDisplay","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","useGrouping"],a=null!==this&&"object"===ir.typeof(this)&&i(this);if(!a||!a["[[initializedNumberFormat]]"])throw new TypeError("`
IntlPolyfill.__addLocaleData({locale:"en-US",date:{ca:["gregory","buddhist","chinese","coptic","dangi","ethioaa","ethiopic","generic","hebrew","indian","islamic","islamicc","japanese","persian","roc"],hourNo0:true,hour12:true,formats:{short:"{1}, {0}",medium:"{1}, {0}",full:"{1} 'at' {0}",long:"{1} 'at' {0}",availableFormats:{"d":"d","E":"ccc",Ed:"d E",Ehm:"E h:mm a",EHm:"E HH:mm",Ehms:"E h:mm:ss a",EHms:"E HH:mm:ss",Gy:"y G",GyMMM:"MMM y G",GyMMMd:"MMM d, y G",GyMMMEd:"E, MMM d, y G","h":"h a","H":"HH",hm:"h:mm a",Hm:"HH:mm",hms:"h:mm:ss a",Hms:"HH:mm:ss",hmsv:"h:mm:ss a v",Hmsv:"HH:mm:ss v",hmv:"h:mm a v",Hmv:"HH:mm v","M":"L",Md:"M/d",MEd:"E, M/d",MMM:"LLL",MMMd:"MMM d",MMMEd:"E, MMM d",MMMMd:"MMMM d",ms:"mm:ss","y":"y",yM:"M/y",yMd:"M/d/y",yMEd:"E, M/d/y",yMMM:"MMM y",yMMMd:"MMM d, y",yMMMEd:"E, MMM d, y",yMMMM:"MMMM y",yQQQ:"QQQ y",yQQQQ:"QQQQ y"},dateFormats:{yMMMMEEEEd:"EEEE, MMMM d, y",yMMMMd:"MMMM d, y",yMMMd:"MMM d, y",yMd:"M/d/yy"},timeFormats:{hmmsszzzz:"h:mm:ss a zzzz",hmsz:"h:mm:ss a z",hms:"h:mm:ss a",hm:"h:mm a"}},calendars:{buddhist:{months:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],long:["January","February","March","April","May","June","July","August","September","October","November","December"]},days:{narrow:["S","M","T","W","T","F","S"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eras:{narrow:["BE"],short:["BE"],long:["BE"]},dayPeriods:{am:"AM",pm:"PM"}},chinese:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["Mo1","Mo2","Mo3","Mo4","Mo5","Mo6","Mo7","Mo8","Mo9","Mo10","Mo11","Mo12"],long:["Month1","Month2","Month3","Month4","Month5","Month6","Month7","Month8","Month9","Month10","Month11","Month12"]},days:{narrow:["S","M","T","W","T","F","S"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},dayPeriods:{am:"AM",pm:"PM"}},coptic:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12","13"],short:["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"],long:["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"]},days:{narrow:["S","M","T","W","T","F","S"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eras:{narrow:["ERA0","ERA1"],short:["ERA0","ERA1"],long:["ERA0","ERA1"]},dayPeriods:{am:"AM",pm:"PM"}},dangi:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["Mo1","Mo2","Mo3","Mo4","Mo5","Mo6","Mo7","Mo8","Mo9","Mo10","Mo11","Mo12"],long:["Month1","Month2","Month3","Month4","Month5","Month6","Month7","Month8","Month9","Month10","Month11","Month12"]},days:{narrow:["S","M","T","W","T","F","S"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},dayPeriods:{am:"AM",pm:"PM"}},ethiopic:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12","13"],short:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"],long:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"]},days:{narrow:["S","M","T","W","T","F","S"],short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eras:{narrow:["ERA0","ERA1"],short:["ERA0","ERA1"],long:["ERA0","ERA1"]},dayPeriods:{am:"AM",pm:"PM"}},ethioaa:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12","13"],short:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"],long:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"]},days:{narrow:["S","M","T","W"