index.js 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  3. typeof define === 'function' && define.amd ? define(factory) :
  4. (global['jest-mock'] = factory());
  5. }(this, (function () { 'use strict';
  6. var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  7. function unwrapExports (x) {
  8. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  9. }
  10. function createCommonjsModule(fn, module) {
  11. return module = { exports: {} }, fn(module, module.exports), module.exports;
  12. }
  13. var _global = createCommonjsModule(function (module) {
  14. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  15. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  16. ? window : typeof self != 'undefined' && self.Math == Math ? self
  17. // eslint-disable-next-line no-new-func
  18. : Function('return this')();
  19. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  20. });
  21. var _core = createCommonjsModule(function (module) {
  22. var core = module.exports = { version: '2.5.7' };
  23. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  24. });
  25. var _core_1 = _core.version;
  26. var _aFunction = function (it) {
  27. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  28. return it;
  29. };
  30. // optional / simple context binding
  31. var _ctx = function (fn, that, length) {
  32. _aFunction(fn);
  33. if (that === undefined) return fn;
  34. switch (length) {
  35. case 1: return function (a) {
  36. return fn.call(that, a);
  37. };
  38. case 2: return function (a, b) {
  39. return fn.call(that, a, b);
  40. };
  41. case 3: return function (a, b, c) {
  42. return fn.call(that, a, b, c);
  43. };
  44. }
  45. return function (/* ...args */) {
  46. return fn.apply(that, arguments);
  47. };
  48. };
  49. var _isObject = function (it) {
  50. return typeof it === 'object' ? it !== null : typeof it === 'function';
  51. };
  52. var _anObject = function (it) {
  53. if (!_isObject(it)) throw TypeError(it + ' is not an object!');
  54. return it;
  55. };
  56. var _fails = function (exec) {
  57. try {
  58. return !!exec();
  59. } catch (e) {
  60. return true;
  61. }
  62. };
  63. // Thank's IE8 for his funny defineProperty
  64. var _descriptors = !_fails(function () {
  65. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  66. });
  67. var document$1 = _global.document;
  68. // typeof document.createElement is 'object' in old IE
  69. var is = _isObject(document$1) && _isObject(document$1.createElement);
  70. var _domCreate = function (it) {
  71. return is ? document$1.createElement(it) : {};
  72. };
  73. var _ie8DomDefine = !_descriptors && !_fails(function () {
  74. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  75. });
  76. // 7.1.1 ToPrimitive(input [, PreferredType])
  77. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  78. // and the second argument - flag - preferred type is a string
  79. var _toPrimitive = function (it, S) {
  80. if (!_isObject(it)) return it;
  81. var fn, val;
  82. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  83. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
  84. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  85. throw TypeError("Can't convert object to primitive value");
  86. };
  87. var dP = Object.defineProperty;
  88. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  89. _anObject(O);
  90. P = _toPrimitive(P, true);
  91. _anObject(Attributes);
  92. if (_ie8DomDefine) try {
  93. return dP(O, P, Attributes);
  94. } catch (e) { /* empty */ }
  95. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  96. if ('value' in Attributes) O[P] = Attributes.value;
  97. return O;
  98. };
  99. var _objectDp = {
  100. f: f
  101. };
  102. var _propertyDesc = function (bitmap, value) {
  103. return {
  104. enumerable: !(bitmap & 1),
  105. configurable: !(bitmap & 2),
  106. writable: !(bitmap & 4),
  107. value: value
  108. };
  109. };
  110. var _hide = _descriptors ? function (object, key, value) {
  111. return _objectDp.f(object, key, _propertyDesc(1, value));
  112. } : function (object, key, value) {
  113. object[key] = value;
  114. return object;
  115. };
  116. var hasOwnProperty = {}.hasOwnProperty;
  117. var _has = function (it, key) {
  118. return hasOwnProperty.call(it, key);
  119. };
  120. var PROTOTYPE = 'prototype';
  121. var $export = function (type, name, source) {
  122. var IS_FORCED = type & $export.F;
  123. var IS_GLOBAL = type & $export.G;
  124. var IS_STATIC = type & $export.S;
  125. var IS_PROTO = type & $export.P;
  126. var IS_BIND = type & $export.B;
  127. var IS_WRAP = type & $export.W;
  128. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  129. var expProto = exports[PROTOTYPE];
  130. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE];
  131. var key, own, out;
  132. if (IS_GLOBAL) source = name;
  133. for (key in source) {
  134. // contains in native
  135. own = !IS_FORCED && target && target[key] !== undefined;
  136. if (own && _has(exports, key)) continue;
  137. // export native or passed
  138. out = own ? target[key] : source[key];
  139. // prevent global pollution for namespaces
  140. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  141. // bind timers to global for call from export context
  142. : IS_BIND && own ? _ctx(out, _global)
  143. // wrap global constructors for prevent change them in library
  144. : IS_WRAP && target[key] == out ? (function (C) {
  145. var F = function (a, b, c) {
  146. if (this instanceof C) {
  147. switch (arguments.length) {
  148. case 0: return new C();
  149. case 1: return new C(a);
  150. case 2: return new C(a, b);
  151. } return new C(a, b, c);
  152. } return C.apply(this, arguments);
  153. };
  154. F[PROTOTYPE] = C[PROTOTYPE];
  155. return F;
  156. // make static versions for prototype methods
  157. })(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  158. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  159. if (IS_PROTO) {
  160. (exports.virtual || (exports.virtual = {}))[key] = out;
  161. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  162. if (type & $export.R && expProto && !expProto[key]) _hide(expProto, key, out);
  163. }
  164. }
  165. };
  166. // type bitmap
  167. $export.F = 1; // forced
  168. $export.G = 2; // global
  169. $export.S = 4; // static
  170. $export.P = 8; // proto
  171. $export.B = 16; // bind
  172. $export.W = 32; // wrap
  173. $export.U = 64; // safe
  174. $export.R = 128; // real proto method for `library`
  175. var _export = $export;
  176. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  177. _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperty: _objectDp.f });
  178. var $Object = _core.Object;
  179. var defineProperty = function defineProperty(it, key, desc) {
  180. return $Object.defineProperty(it, key, desc);
  181. };
  182. var defineProperty$1 = createCommonjsModule(function (module) {
  183. module.exports = { "default": defineProperty, __esModule: true };
  184. });
  185. var _Object$defineProperty = unwrapExports(defineProperty$1);
  186. // 7.1.4 ToInteger
  187. var ceil = Math.ceil;
  188. var floor = Math.floor;
  189. var _toInteger = function (it) {
  190. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  191. };
  192. // 7.2.1 RequireObjectCoercible(argument)
  193. var _defined = function (it) {
  194. if (it == undefined) throw TypeError("Can't call method on " + it);
  195. return it;
  196. };
  197. // true -> String#at
  198. // false -> String#codePointAt
  199. var _stringAt = function (TO_STRING) {
  200. return function (that, pos) {
  201. var s = String(_defined(that));
  202. var i = _toInteger(pos);
  203. var l = s.length;
  204. var a, b;
  205. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  206. a = s.charCodeAt(i);
  207. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  208. ? TO_STRING ? s.charAt(i) : a
  209. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  210. };
  211. };
  212. var _library = true;
  213. var _redefine = _hide;
  214. var _iterators = {};
  215. var toString = {}.toString;
  216. var _cof = function (it) {
  217. return toString.call(it).slice(8, -1);
  218. };
  219. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  220. // eslint-disable-next-line no-prototype-builtins
  221. var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  222. return _cof(it) == 'String' ? it.split('') : Object(it);
  223. };
  224. // to indexed object, toObject with fallback for non-array-like ES3 strings
  225. var _toIobject = function (it) {
  226. return _iobject(_defined(it));
  227. };
  228. // 7.1.15 ToLength
  229. var min = Math.min;
  230. var _toLength = function (it) {
  231. return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  232. };
  233. var max = Math.max;
  234. var min$1 = Math.min;
  235. var _toAbsoluteIndex = function (index, length) {
  236. index = _toInteger(index);
  237. return index < 0 ? max(index + length, 0) : min$1(index, length);
  238. };
  239. // false -> Array#indexOf
  240. // true -> Array#includes
  241. var _arrayIncludes = function (IS_INCLUDES) {
  242. return function ($this, el, fromIndex) {
  243. var O = _toIobject($this);
  244. var length = _toLength(O.length);
  245. var index = _toAbsoluteIndex(fromIndex, length);
  246. var value;
  247. // Array#includes uses SameValueZero equality algorithm
  248. // eslint-disable-next-line no-self-compare
  249. if (IS_INCLUDES && el != el) while (length > index) {
  250. value = O[index++];
  251. // eslint-disable-next-line no-self-compare
  252. if (value != value) return true;
  253. // Array#indexOf ignores holes, Array#includes - not
  254. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  255. if (O[index] === el) return IS_INCLUDES || index || 0;
  256. } return !IS_INCLUDES && -1;
  257. };
  258. };
  259. var _shared = createCommonjsModule(function (module) {
  260. var SHARED = '__core-js_shared__';
  261. var store = _global[SHARED] || (_global[SHARED] = {});
  262. (module.exports = function (key, value) {
  263. return store[key] || (store[key] = value !== undefined ? value : {});
  264. })('versions', []).push({
  265. version: _core.version,
  266. mode: _library ? 'pure' : 'global',
  267. copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
  268. });
  269. });
  270. var id = 0;
  271. var px = Math.random();
  272. var _uid = function (key) {
  273. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  274. };
  275. var shared = _shared('keys');
  276. var _sharedKey = function (key) {
  277. return shared[key] || (shared[key] = _uid(key));
  278. };
  279. var arrayIndexOf = _arrayIncludes(false);
  280. var IE_PROTO = _sharedKey('IE_PROTO');
  281. var _objectKeysInternal = function (object, names) {
  282. var O = _toIobject(object);
  283. var i = 0;
  284. var result = [];
  285. var key;
  286. for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
  287. // Don't enum bug & hidden keys
  288. while (names.length > i) if (_has(O, key = names[i++])) {
  289. ~arrayIndexOf(result, key) || result.push(key);
  290. }
  291. return result;
  292. };
  293. // IE 8- don't enum bug keys
  294. var _enumBugKeys = (
  295. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  296. ).split(',');
  297. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  298. var _objectKeys = Object.keys || function keys(O) {
  299. return _objectKeysInternal(O, _enumBugKeys);
  300. };
  301. var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  302. _anObject(O);
  303. var keys = _objectKeys(Properties);
  304. var length = keys.length;
  305. var i = 0;
  306. var P;
  307. while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
  308. return O;
  309. };
  310. var document$2 = _global.document;
  311. var _html = document$2 && document$2.documentElement;
  312. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  313. var IE_PROTO$1 = _sharedKey('IE_PROTO');
  314. var Empty = function () { /* empty */ };
  315. var PROTOTYPE$1 = 'prototype';
  316. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  317. var createDict = function () {
  318. // Thrash, waste and sodomy: IE GC bug
  319. var iframe = _domCreate('iframe');
  320. var i = _enumBugKeys.length;
  321. var lt = '<';
  322. var gt = '>';
  323. var iframeDocument;
  324. iframe.style.display = 'none';
  325. _html.appendChild(iframe);
  326. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  327. // createDict = iframe.contentWindow.Object;
  328. // html.removeChild(iframe);
  329. iframeDocument = iframe.contentWindow.document;
  330. iframeDocument.open();
  331. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  332. iframeDocument.close();
  333. createDict = iframeDocument.F;
  334. while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
  335. return createDict();
  336. };
  337. var _objectCreate = Object.create || function create(O, Properties) {
  338. var result;
  339. if (O !== null) {
  340. Empty[PROTOTYPE$1] = _anObject(O);
  341. result = new Empty();
  342. Empty[PROTOTYPE$1] = null;
  343. // add "__proto__" for Object.getPrototypeOf polyfill
  344. result[IE_PROTO$1] = O;
  345. } else result = createDict();
  346. return Properties === undefined ? result : _objectDps(result, Properties);
  347. };
  348. var _wks = createCommonjsModule(function (module) {
  349. var store = _shared('wks');
  350. var Symbol = _global.Symbol;
  351. var USE_SYMBOL = typeof Symbol == 'function';
  352. var $exports = module.exports = function (name) {
  353. return store[name] || (store[name] =
  354. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
  355. };
  356. $exports.store = store;
  357. });
  358. var def = _objectDp.f;
  359. var TAG = _wks('toStringTag');
  360. var _setToStringTag = function (it, tag, stat) {
  361. if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
  362. };
  363. var IteratorPrototype = {};
  364. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  365. _hide(IteratorPrototype, _wks('iterator'), function () { return this; });
  366. var _iterCreate = function (Constructor, NAME, next) {
  367. Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) });
  368. _setToStringTag(Constructor, NAME + ' Iterator');
  369. };
  370. // 7.1.13 ToObject(argument)
  371. var _toObject = function (it) {
  372. return Object(_defined(it));
  373. };
  374. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  375. var IE_PROTO$2 = _sharedKey('IE_PROTO');
  376. var ObjectProto = Object.prototype;
  377. var _objectGpo = Object.getPrototypeOf || function (O) {
  378. O = _toObject(O);
  379. if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
  380. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  381. return O.constructor.prototype;
  382. } return O instanceof Object ? ObjectProto : null;
  383. };
  384. var ITERATOR = _wks('iterator');
  385. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  386. var FF_ITERATOR = '@@iterator';
  387. var KEYS = 'keys';
  388. var VALUES = 'values';
  389. var returnThis = function () { return this; };
  390. var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  391. _iterCreate(Constructor, NAME, next);
  392. var getMethod = function (kind) {
  393. if (!BUGGY && kind in proto) return proto[kind];
  394. switch (kind) {
  395. case KEYS: return function keys() { return new Constructor(this, kind); };
  396. case VALUES: return function values() { return new Constructor(this, kind); };
  397. } return function entries() { return new Constructor(this, kind); };
  398. };
  399. var TAG = NAME + ' Iterator';
  400. var DEF_VALUES = DEFAULT == VALUES;
  401. var VALUES_BUG = false;
  402. var proto = Base.prototype;
  403. var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  404. var $default = $native || getMethod(DEFAULT);
  405. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  406. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  407. var methods, key, IteratorPrototype;
  408. // Fix native
  409. if ($anyNative) {
  410. IteratorPrototype = _objectGpo($anyNative.call(new Base()));
  411. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  412. // Set @@toStringTag to native iterators
  413. _setToStringTag(IteratorPrototype, TAG, true);
  414. // fix for some old engines
  415. if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis);
  416. }
  417. }
  418. // fix Array#{values, @@iterator}.name in V8 / FF
  419. if (DEF_VALUES && $native && $native.name !== VALUES) {
  420. VALUES_BUG = true;
  421. $default = function values() { return $native.call(this); };
  422. }
  423. // Define iterator
  424. if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
  425. _hide(proto, ITERATOR, $default);
  426. }
  427. // Plug for library
  428. _iterators[NAME] = $default;
  429. _iterators[TAG] = returnThis;
  430. if (DEFAULT) {
  431. methods = {
  432. values: DEF_VALUES ? $default : getMethod(VALUES),
  433. keys: IS_SET ? $default : getMethod(KEYS),
  434. entries: $entries
  435. };
  436. if (FORCED) for (key in methods) {
  437. if (!(key in proto)) _redefine(proto, key, methods[key]);
  438. } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
  439. }
  440. return methods;
  441. };
  442. var $at = _stringAt(true);
  443. // 21.1.3.27 String.prototype[@@iterator]()
  444. _iterDefine(String, 'String', function (iterated) {
  445. this._t = String(iterated); // target
  446. this._i = 0; // next index
  447. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  448. }, function () {
  449. var O = this._t;
  450. var index = this._i;
  451. var point;
  452. if (index >= O.length) return { value: undefined, done: true };
  453. point = $at(O, index);
  454. this._i += point.length;
  455. return { value: point, done: false };
  456. });
  457. var _iterStep = function (done, value) {
  458. return { value: value, done: !!done };
  459. };
  460. // 22.1.3.4 Array.prototype.entries()
  461. // 22.1.3.13 Array.prototype.keys()
  462. // 22.1.3.29 Array.prototype.values()
  463. // 22.1.3.30 Array.prototype[@@iterator]()
  464. var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) {
  465. this._t = _toIobject(iterated); // target
  466. this._i = 0; // next index
  467. this._k = kind; // kind
  468. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  469. }, function () {
  470. var O = this._t;
  471. var kind = this._k;
  472. var index = this._i++;
  473. if (!O || index >= O.length) {
  474. this._t = undefined;
  475. return _iterStep(1);
  476. }
  477. if (kind == 'keys') return _iterStep(0, index);
  478. if (kind == 'values') return _iterStep(0, O[index]);
  479. return _iterStep(0, [index, O[index]]);
  480. }, 'values');
  481. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  482. _iterators.Arguments = _iterators.Array;
  483. var TO_STRING_TAG = _wks('toStringTag');
  484. var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  485. 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  486. 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  487. 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  488. 'TextTrackList,TouchList').split(',');
  489. for (var i = 0; i < DOMIterables.length; i++) {
  490. var NAME = DOMIterables[i];
  491. var Collection = _global[NAME];
  492. var proto = Collection && Collection.prototype;
  493. if (proto && !proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME);
  494. _iterators[NAME] = _iterators.Array;
  495. }
  496. var f$1 = _wks;
  497. var _wksExt = {
  498. f: f$1
  499. };
  500. var iterator = _wksExt.f('iterator');
  501. var iterator$1 = createCommonjsModule(function (module) {
  502. module.exports = { "default": iterator, __esModule: true };
  503. });
  504. unwrapExports(iterator$1);
  505. var _meta = createCommonjsModule(function (module) {
  506. var META = _uid('meta');
  507. var setDesc = _objectDp.f;
  508. var id = 0;
  509. var isExtensible = Object.isExtensible || function () {
  510. return true;
  511. };
  512. var FREEZE = !_fails(function () {
  513. return isExtensible(Object.preventExtensions({}));
  514. });
  515. var setMeta = function (it) {
  516. setDesc(it, META, { value: {
  517. i: 'O' + ++id, // object ID
  518. w: {} // weak collections IDs
  519. } });
  520. };
  521. var fastKey = function (it, create) {
  522. // return primitive with prefix
  523. if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  524. if (!_has(it, META)) {
  525. // can't set metadata to uncaught frozen object
  526. if (!isExtensible(it)) return 'F';
  527. // not necessary to add metadata
  528. if (!create) return 'E';
  529. // add missing metadata
  530. setMeta(it);
  531. // return object ID
  532. } return it[META].i;
  533. };
  534. var getWeak = function (it, create) {
  535. if (!_has(it, META)) {
  536. // can't set metadata to uncaught frozen object
  537. if (!isExtensible(it)) return true;
  538. // not necessary to add metadata
  539. if (!create) return false;
  540. // add missing metadata
  541. setMeta(it);
  542. // return hash weak collections IDs
  543. } return it[META].w;
  544. };
  545. // add metadata on freeze-family methods calling
  546. var onFreeze = function (it) {
  547. if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it);
  548. return it;
  549. };
  550. var meta = module.exports = {
  551. KEY: META,
  552. NEED: false,
  553. fastKey: fastKey,
  554. getWeak: getWeak,
  555. onFreeze: onFreeze
  556. };
  557. });
  558. var _meta_1 = _meta.KEY;
  559. var _meta_2 = _meta.NEED;
  560. var _meta_3 = _meta.fastKey;
  561. var _meta_4 = _meta.getWeak;
  562. var _meta_5 = _meta.onFreeze;
  563. var defineProperty$2 = _objectDp.f;
  564. var _wksDefine = function (name) {
  565. var $Symbol = _core.Symbol || (_core.Symbol = _library ? {} : _global.Symbol || {});
  566. if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty$2($Symbol, name, { value: _wksExt.f(name) });
  567. };
  568. var f$2 = Object.getOwnPropertySymbols;
  569. var _objectGops = {
  570. f: f$2
  571. };
  572. var f$3 = {}.propertyIsEnumerable;
  573. var _objectPie = {
  574. f: f$3
  575. };
  576. // all enumerable object keys, includes symbols
  577. var _enumKeys = function (it) {
  578. var result = _objectKeys(it);
  579. var getSymbols = _objectGops.f;
  580. if (getSymbols) {
  581. var symbols = getSymbols(it);
  582. var isEnum = _objectPie.f;
  583. var i = 0;
  584. var key;
  585. while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
  586. } return result;
  587. };
  588. // 7.2.2 IsArray(argument)
  589. var _isArray = Array.isArray || function isArray(arg) {
  590. return _cof(arg) == 'Array';
  591. };
  592. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  593. var hiddenKeys = _enumBugKeys.concat('length', 'prototype');
  594. var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  595. return _objectKeysInternal(O, hiddenKeys);
  596. };
  597. var _objectGopn = {
  598. f: f$4
  599. };
  600. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  601. var gOPN = _objectGopn.f;
  602. var toString$1 = {}.toString;
  603. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  604. ? Object.getOwnPropertyNames(window) : [];
  605. var getWindowNames = function (it) {
  606. try {
  607. return gOPN(it);
  608. } catch (e) {
  609. return windowNames.slice();
  610. }
  611. };
  612. var f$5 = function getOwnPropertyNames(it) {
  613. return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it));
  614. };
  615. var _objectGopnExt = {
  616. f: f$5
  617. };
  618. var gOPD = Object.getOwnPropertyDescriptor;
  619. var f$6 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) {
  620. O = _toIobject(O);
  621. P = _toPrimitive(P, true);
  622. if (_ie8DomDefine) try {
  623. return gOPD(O, P);
  624. } catch (e) { /* empty */ }
  625. if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]);
  626. };
  627. var _objectGopd = {
  628. f: f$6
  629. };
  630. // ECMAScript 6 symbols shim
  631. var META = _meta.KEY;
  632. var gOPD$1 = _objectGopd.f;
  633. var dP$1 = _objectDp.f;
  634. var gOPN$1 = _objectGopnExt.f;
  635. var $Symbol = _global.Symbol;
  636. var $JSON = _global.JSON;
  637. var _stringify = $JSON && $JSON.stringify;
  638. var PROTOTYPE$2 = 'prototype';
  639. var HIDDEN = _wks('_hidden');
  640. var TO_PRIMITIVE = _wks('toPrimitive');
  641. var isEnum = {}.propertyIsEnumerable;
  642. var SymbolRegistry = _shared('symbol-registry');
  643. var AllSymbols = _shared('symbols');
  644. var OPSymbols = _shared('op-symbols');
  645. var ObjectProto$1 = Object[PROTOTYPE$2];
  646. var USE_NATIVE = typeof $Symbol == 'function';
  647. var QObject = _global.QObject;
  648. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  649. var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild;
  650. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  651. var setSymbolDesc = _descriptors && _fails(function () {
  652. return _objectCreate(dP$1({}, 'a', {
  653. get: function () { return dP$1(this, 'a', { value: 7 }).a; }
  654. })).a != 7;
  655. }) ? function (it, key, D) {
  656. var protoDesc = gOPD$1(ObjectProto$1, key);
  657. if (protoDesc) delete ObjectProto$1[key];
  658. dP$1(it, key, D);
  659. if (protoDesc && it !== ObjectProto$1) dP$1(ObjectProto$1, key, protoDesc);
  660. } : dP$1;
  661. var wrap = function (tag) {
  662. var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]);
  663. sym._k = tag;
  664. return sym;
  665. };
  666. var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
  667. return typeof it == 'symbol';
  668. } : function (it) {
  669. return it instanceof $Symbol;
  670. };
  671. var $defineProperty = function defineProperty(it, key, D) {
  672. if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D);
  673. _anObject(it);
  674. key = _toPrimitive(key, true);
  675. _anObject(D);
  676. if (_has(AllSymbols, key)) {
  677. if (!D.enumerable) {
  678. if (!_has(it, HIDDEN)) dP$1(it, HIDDEN, _propertyDesc(1, {}));
  679. it[HIDDEN][key] = true;
  680. } else {
  681. if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
  682. D = _objectCreate(D, { enumerable: _propertyDesc(0, false) });
  683. } return setSymbolDesc(it, key, D);
  684. } return dP$1(it, key, D);
  685. };
  686. var $defineProperties = function defineProperties(it, P) {
  687. _anObject(it);
  688. var keys = _enumKeys(P = _toIobject(P));
  689. var i = 0;
  690. var l = keys.length;
  691. var key;
  692. while (l > i) $defineProperty(it, key = keys[i++], P[key]);
  693. return it;
  694. };
  695. var $create = function create(it, P) {
  696. return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P);
  697. };
  698. var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  699. var E = isEnum.call(this, key = _toPrimitive(key, true));
  700. if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false;
  701. return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
  702. };
  703. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  704. it = _toIobject(it);
  705. key = _toPrimitive(key, true);
  706. if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return;
  707. var D = gOPD$1(it, key);
  708. if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  709. return D;
  710. };
  711. var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  712. var names = gOPN$1(_toIobject(it));
  713. var result = [];
  714. var i = 0;
  715. var key;
  716. while (names.length > i) {
  717. if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  718. } return result;
  719. };
  720. var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  721. var IS_OP = it === ObjectProto$1;
  722. var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it));
  723. var result = [];
  724. var i = 0;
  725. var key;
  726. while (names.length > i) {
  727. if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]);
  728. } return result;
  729. };
  730. // 19.4.1.1 Symbol([description])
  731. if (!USE_NATIVE) {
  732. $Symbol = function Symbol() {
  733. if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
  734. var tag = _uid(arguments.length > 0 ? arguments[0] : undefined);
  735. var $set = function (value) {
  736. if (this === ObjectProto$1) $set.call(OPSymbols, value);
  737. if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  738. setSymbolDesc(this, tag, _propertyDesc(1, value));
  739. };
  740. if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set });
  741. return wrap(tag);
  742. };
  743. _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() {
  744. return this._k;
  745. });
  746. _objectGopd.f = $getOwnPropertyDescriptor;
  747. _objectDp.f = $defineProperty;
  748. _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames;
  749. _objectPie.f = $propertyIsEnumerable;
  750. _objectGops.f = $getOwnPropertySymbols;
  751. if (_descriptors && !_library) {
  752. _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  753. }
  754. _wksExt.f = function (name) {
  755. return wrap(_wks(name));
  756. };
  757. }
  758. _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Symbol: $Symbol });
  759. for (var es6Symbols = (
  760. // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
  761. 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
  762. ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]);
  763. for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]);
  764. _export(_export.S + _export.F * !USE_NATIVE, 'Symbol', {
  765. // 19.4.2.1 Symbol.for(key)
  766. 'for': function (key) {
  767. return _has(SymbolRegistry, key += '')
  768. ? SymbolRegistry[key]
  769. : SymbolRegistry[key] = $Symbol(key);
  770. },
  771. // 19.4.2.5 Symbol.keyFor(sym)
  772. keyFor: function keyFor(sym) {
  773. if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
  774. for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
  775. },
  776. useSetter: function () { setter = true; },
  777. useSimple: function () { setter = false; }
  778. });
  779. _export(_export.S + _export.F * !USE_NATIVE, 'Object', {
  780. // 19.1.2.2 Object.create(O [, Properties])
  781. create: $create,
  782. // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  783. defineProperty: $defineProperty,
  784. // 19.1.2.3 Object.defineProperties(O, Properties)
  785. defineProperties: $defineProperties,
  786. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  787. getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  788. // 19.1.2.7 Object.getOwnPropertyNames(O)
  789. getOwnPropertyNames: $getOwnPropertyNames,
  790. // 19.1.2.8 Object.getOwnPropertySymbols(O)
  791. getOwnPropertySymbols: $getOwnPropertySymbols
  792. });
  793. // 24.3.2 JSON.stringify(value [, replacer [, space]])
  794. $JSON && _export(_export.S + _export.F * (!USE_NATIVE || _fails(function () {
  795. var S = $Symbol();
  796. // MS Edge converts symbol values to JSON as {}
  797. // WebKit converts symbol values to JSON as null
  798. // V8 throws on boxed symbols
  799. return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
  800. })), 'JSON', {
  801. stringify: function stringify(it) {
  802. var args = [it];
  803. var i = 1;
  804. var replacer, $replacer;
  805. while (arguments.length > i) args.push(arguments[i++]);
  806. $replacer = replacer = args[1];
  807. if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  808. if (!_isArray(replacer)) replacer = function (key, value) {
  809. if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
  810. if (!isSymbol(value)) return value;
  811. };
  812. args[1] = replacer;
  813. return _stringify.apply($JSON, args);
  814. }
  815. });
  816. // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
  817. $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf);
  818. // 19.4.3.5 Symbol.prototype[@@toStringTag]
  819. _setToStringTag($Symbol, 'Symbol');
  820. // 20.2.1.9 Math[@@toStringTag]
  821. _setToStringTag(Math, 'Math', true);
  822. // 24.3.3 JSON[@@toStringTag]
  823. _setToStringTag(_global.JSON, 'JSON', true);
  824. _wksDefine('asyncIterator');
  825. _wksDefine('observable');
  826. var symbol = _core.Symbol;
  827. var symbol$1 = createCommonjsModule(function (module) {
  828. module.exports = { "default": symbol, __esModule: true };
  829. });
  830. unwrapExports(symbol$1);
  831. var _typeof_1 = createCommonjsModule(function (module, exports) {
  832. exports.__esModule = true;
  833. var _iterator2 = _interopRequireDefault(iterator$1);
  834. var _symbol2 = _interopRequireDefault(symbol$1);
  835. var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
  836. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  837. exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
  838. return typeof obj === "undefined" ? "undefined" : _typeof(obj);
  839. } : function (obj) {
  840. return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  841. };
  842. });
  843. var _typeof = unwrapExports(_typeof_1);
  844. var _redefineAll = function (target, src, safe) {
  845. for (var key in src) {
  846. if (safe && target[key]) target[key] = src[key];
  847. else _hide(target, key, src[key]);
  848. } return target;
  849. };
  850. var _anInstance = function (it, Constructor, name, forbiddenField) {
  851. if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
  852. throw TypeError(name + ': incorrect invocation!');
  853. } return it;
  854. };
  855. // call something on iterator step with safe closing on error
  856. var _iterCall = function (iterator, fn, value, entries) {
  857. try {
  858. return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
  859. // 7.4.6 IteratorClose(iterator, completion)
  860. } catch (e) {
  861. var ret = iterator['return'];
  862. if (ret !== undefined) _anObject(ret.call(iterator));
  863. throw e;
  864. }
  865. };
  866. // check on default Array iterator
  867. var ITERATOR$1 = _wks('iterator');
  868. var ArrayProto = Array.prototype;
  869. var _isArrayIter = function (it) {
  870. return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR$1] === it);
  871. };
  872. // getting tag from 19.1.3.6 Object.prototype.toString()
  873. var TAG$1 = _wks('toStringTag');
  874. // ES3 wrong here
  875. var ARG = _cof(function () { return arguments; }()) == 'Arguments';
  876. // fallback for IE11 Script Access Denied error
  877. var tryGet = function (it, key) {
  878. try {
  879. return it[key];
  880. } catch (e) { /* empty */ }
  881. };
  882. var _classof = function (it) {
  883. var O, T, B;
  884. return it === undefined ? 'Undefined' : it === null ? 'Null'
  885. // @@toStringTag case
  886. : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
  887. // builtinTag case
  888. : ARG ? _cof(O)
  889. // ES3 arguments fallback
  890. : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  891. };
  892. var ITERATOR$2 = _wks('iterator');
  893. var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
  894. if (it != undefined) return it[ITERATOR$2]
  895. || it['@@iterator']
  896. || _iterators[_classof(it)];
  897. };
  898. var _forOf = createCommonjsModule(function (module) {
  899. var BREAK = {};
  900. var RETURN = {};
  901. var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  902. var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable);
  903. var f = _ctx(fn, that, entries ? 2 : 1);
  904. var index = 0;
  905. var length, step, iterator, result;
  906. if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  907. // fast case for arrays with default iterator
  908. if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {
  909. result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  910. if (result === BREAK || result === RETURN) return result;
  911. } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
  912. result = _iterCall(iterator, f, step.value, entries);
  913. if (result === BREAK || result === RETURN) return result;
  914. }
  915. };
  916. exports.BREAK = BREAK;
  917. exports.RETURN = RETURN;
  918. });
  919. var SPECIES = _wks('species');
  920. var _setSpecies = function (KEY) {
  921. var C = typeof _core[KEY] == 'function' ? _core[KEY] : _global[KEY];
  922. if (_descriptors && C && !C[SPECIES]) _objectDp.f(C, SPECIES, {
  923. configurable: true,
  924. get: function () { return this; }
  925. });
  926. };
  927. var _validateCollection = function (it, TYPE) {
  928. if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  929. return it;
  930. };
  931. var dP$2 = _objectDp.f;
  932. var fastKey = _meta.fastKey;
  933. var SIZE = _descriptors ? '_s' : 'size';
  934. var getEntry = function (that, key) {
  935. // fast case
  936. var index = fastKey(key);
  937. var entry;
  938. if (index !== 'F') return that._i[index];
  939. // frozen object case
  940. for (entry = that._f; entry; entry = entry.n) {
  941. if (entry.k == key) return entry;
  942. }
  943. };
  944. var _collectionStrong = {
  945. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  946. var C = wrapper(function (that, iterable) {
  947. _anInstance(that, C, NAME, '_i');
  948. that._t = NAME; // collection type
  949. that._i = _objectCreate(null); // index
  950. that._f = undefined; // first entry
  951. that._l = undefined; // last entry
  952. that[SIZE] = 0; // size
  953. if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
  954. });
  955. _redefineAll(C.prototype, {
  956. // 23.1.3.1 Map.prototype.clear()
  957. // 23.2.3.2 Set.prototype.clear()
  958. clear: function clear() {
  959. for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
  960. entry.r = true;
  961. if (entry.p) entry.p = entry.p.n = undefined;
  962. delete data[entry.i];
  963. }
  964. that._f = that._l = undefined;
  965. that[SIZE] = 0;
  966. },
  967. // 23.1.3.3 Map.prototype.delete(key)
  968. // 23.2.3.4 Set.prototype.delete(value)
  969. 'delete': function (key) {
  970. var that = _validateCollection(this, NAME);
  971. var entry = getEntry(that, key);
  972. if (entry) {
  973. var next = entry.n;
  974. var prev = entry.p;
  975. delete that._i[entry.i];
  976. entry.r = true;
  977. if (prev) prev.n = next;
  978. if (next) next.p = prev;
  979. if (that._f == entry) that._f = next;
  980. if (that._l == entry) that._l = prev;
  981. that[SIZE]--;
  982. } return !!entry;
  983. },
  984. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  985. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  986. forEach: function forEach(callbackfn /* , that = undefined */) {
  987. _validateCollection(this, NAME);
  988. var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  989. var entry;
  990. while (entry = entry ? entry.n : this._f) {
  991. f(entry.v, entry.k, this);
  992. // revert to the last existing entry
  993. while (entry && entry.r) entry = entry.p;
  994. }
  995. },
  996. // 23.1.3.7 Map.prototype.has(key)
  997. // 23.2.3.7 Set.prototype.has(value)
  998. has: function has(key) {
  999. return !!getEntry(_validateCollection(this, NAME), key);
  1000. }
  1001. });
  1002. if (_descriptors) dP$2(C.prototype, 'size', {
  1003. get: function () {
  1004. return _validateCollection(this, NAME)[SIZE];
  1005. }
  1006. });
  1007. return C;
  1008. },
  1009. def: function (that, key, value) {
  1010. var entry = getEntry(that, key);
  1011. var prev, index;
  1012. // change existing entry
  1013. if (entry) {
  1014. entry.v = value;
  1015. // create new entry
  1016. } else {
  1017. that._l = entry = {
  1018. i: index = fastKey(key, true), // <- index
  1019. k: key, // <- key
  1020. v: value, // <- value
  1021. p: prev = that._l, // <- previous entry
  1022. n: undefined, // <- next entry
  1023. r: false // <- removed
  1024. };
  1025. if (!that._f) that._f = entry;
  1026. if (prev) prev.n = entry;
  1027. that[SIZE]++;
  1028. // add to index
  1029. if (index !== 'F') that._i[index] = entry;
  1030. } return that;
  1031. },
  1032. getEntry: getEntry,
  1033. setStrong: function (C, NAME, IS_MAP) {
  1034. // add .keys, .values, .entries, [@@iterator]
  1035. // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
  1036. _iterDefine(C, NAME, function (iterated, kind) {
  1037. this._t = _validateCollection(iterated, NAME); // target
  1038. this._k = kind; // kind
  1039. this._l = undefined; // previous
  1040. }, function () {
  1041. var that = this;
  1042. var kind = that._k;
  1043. var entry = that._l;
  1044. // revert to the last existing entry
  1045. while (entry && entry.r) entry = entry.p;
  1046. // get next entry
  1047. if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
  1048. // or finish the iteration
  1049. that._t = undefined;
  1050. return _iterStep(1);
  1051. }
  1052. // return step by kind
  1053. if (kind == 'keys') return _iterStep(0, entry.k);
  1054. if (kind == 'values') return _iterStep(0, entry.v);
  1055. return _iterStep(0, [entry.k, entry.v]);
  1056. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  1057. // add [@@species], 23.1.2.2, 23.2.2.2
  1058. _setSpecies(NAME);
  1059. }
  1060. };
  1061. var SPECIES$1 = _wks('species');
  1062. var _arraySpeciesConstructor = function (original) {
  1063. var C;
  1064. if (_isArray(original)) {
  1065. C = original.constructor;
  1066. // cross-realm fallback
  1067. if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined;
  1068. if (_isObject(C)) {
  1069. C = C[SPECIES$1];
  1070. if (C === null) C = undefined;
  1071. }
  1072. } return C === undefined ? Array : C;
  1073. };
  1074. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  1075. var _arraySpeciesCreate = function (original, length) {
  1076. return new (_arraySpeciesConstructor(original))(length);
  1077. };
  1078. // 0 -> Array#forEach
  1079. // 1 -> Array#map
  1080. // 2 -> Array#filter
  1081. // 3 -> Array#some
  1082. // 4 -> Array#every
  1083. // 5 -> Array#find
  1084. // 6 -> Array#findIndex
  1085. var _arrayMethods = function (TYPE, $create) {
  1086. var IS_MAP = TYPE == 1;
  1087. var IS_FILTER = TYPE == 2;
  1088. var IS_SOME = TYPE == 3;
  1089. var IS_EVERY = TYPE == 4;
  1090. var IS_FIND_INDEX = TYPE == 6;
  1091. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  1092. var create = $create || _arraySpeciesCreate;
  1093. return function ($this, callbackfn, that) {
  1094. var O = _toObject($this);
  1095. var self = _iobject(O);
  1096. var f = _ctx(callbackfn, that, 3);
  1097. var length = _toLength(self.length);
  1098. var index = 0;
  1099. var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  1100. var val, res;
  1101. for (;length > index; index++) if (NO_HOLES || index in self) {
  1102. val = self[index];
  1103. res = f(val, index, O);
  1104. if (TYPE) {
  1105. if (IS_MAP) result[index] = res; // map
  1106. else if (res) switch (TYPE) {
  1107. case 3: return true; // some
  1108. case 5: return val; // find
  1109. case 6: return index; // findIndex
  1110. case 2: result.push(val); // filter
  1111. } else if (IS_EVERY) return false; // every
  1112. }
  1113. }
  1114. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  1115. };
  1116. };
  1117. var dP$3 = _objectDp.f;
  1118. var each = _arrayMethods(0);
  1119. var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  1120. var Base = _global[NAME];
  1121. var C = Base;
  1122. var ADDER = IS_MAP ? 'set' : 'add';
  1123. var proto = C && C.prototype;
  1124. var O = {};
  1125. if (!_descriptors || typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () {
  1126. new C().entries().next();
  1127. }))) {
  1128. // create collection constructor
  1129. C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
  1130. _redefineAll(C.prototype, methods);
  1131. _meta.NEED = true;
  1132. } else {
  1133. C = wrapper(function (target, iterable) {
  1134. _anInstance(target, C, NAME, '_c');
  1135. target._c = new Base();
  1136. if (iterable != undefined) _forOf(iterable, IS_MAP, target[ADDER], target);
  1137. });
  1138. each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
  1139. var IS_ADDER = KEY == 'add' || KEY == 'set';
  1140. if (KEY in proto && !(IS_WEAK && KEY == 'clear')) _hide(C.prototype, KEY, function (a, b) {
  1141. _anInstance(this, C, KEY);
  1142. if (!IS_ADDER && IS_WEAK && !_isObject(a)) return KEY == 'get' ? undefined : false;
  1143. var result = this._c[KEY](a === 0 ? 0 : a, b);
  1144. return IS_ADDER ? this : result;
  1145. });
  1146. });
  1147. IS_WEAK || dP$3(C.prototype, 'size', {
  1148. get: function () {
  1149. return this._c.size;
  1150. }
  1151. });
  1152. }
  1153. _setToStringTag(C, NAME);
  1154. O[NAME] = C;
  1155. _export(_export.G + _export.W + _export.F, O);
  1156. if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
  1157. return C;
  1158. };
  1159. var MAP = 'Map';
  1160. // 23.1 Map Objects
  1161. var es6_map = _collection(MAP, function (get) {
  1162. return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1163. }, {
  1164. // 23.1.3.6 Map.prototype.get(key)
  1165. get: function get(key) {
  1166. var entry = _collectionStrong.getEntry(_validateCollection(this, MAP), key);
  1167. return entry && entry.v;
  1168. },
  1169. // 23.1.3.9 Map.prototype.set(key, value)
  1170. set: function set(key, value) {
  1171. return _collectionStrong.def(_validateCollection(this, MAP), key === 0 ? 0 : key, value);
  1172. }
  1173. }, _collectionStrong, true);
  1174. var _arrayFromIterable = function (iter, ITERATOR) {
  1175. var result = [];
  1176. _forOf(iter, false, result.push, result, ITERATOR);
  1177. return result;
  1178. };
  1179. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1180. var _collectionToJson = function (NAME) {
  1181. return function toJSON() {
  1182. if (_classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
  1183. return _arrayFromIterable(this);
  1184. };
  1185. };
  1186. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1187. _export(_export.P + _export.R, 'Map', { toJSON: _collectionToJson('Map') });
  1188. // https://tc39.github.io/proposal-setmap-offrom/
  1189. var _setCollectionOf = function (COLLECTION) {
  1190. _export(_export.S, COLLECTION, { of: function of() {
  1191. var length = arguments.length;
  1192. var A = new Array(length);
  1193. while (length--) A[length] = arguments[length];
  1194. return new this(A);
  1195. } });
  1196. };
  1197. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
  1198. _setCollectionOf('Map');
  1199. // https://tc39.github.io/proposal-setmap-offrom/
  1200. var _setCollectionFrom = function (COLLECTION) {
  1201. _export(_export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
  1202. var mapFn = arguments[1];
  1203. var mapping, A, n, cb;
  1204. _aFunction(this);
  1205. mapping = mapFn !== undefined;
  1206. if (mapping) _aFunction(mapFn);
  1207. if (source == undefined) return new this();
  1208. A = [];
  1209. if (mapping) {
  1210. n = 0;
  1211. cb = _ctx(mapFn, arguments[2], 2);
  1212. _forOf(source, false, function (nextItem) {
  1213. A.push(cb(nextItem, n++));
  1214. });
  1215. } else {
  1216. _forOf(source, false, A.push, A);
  1217. }
  1218. return new this(A);
  1219. } });
  1220. };
  1221. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
  1222. _setCollectionFrom('Map');
  1223. var map = _core.Map;
  1224. var map$1 = createCommonjsModule(function (module) {
  1225. module.exports = { "default": map, __esModule: true };
  1226. });
  1227. var _Map = unwrapExports(map$1);
  1228. // 7.3.20 SpeciesConstructor(O, defaultConstructor)
  1229. var SPECIES$2 = _wks('species');
  1230. var _speciesConstructor = function (O, D) {
  1231. var C = _anObject(O).constructor;
  1232. var S;
  1233. return C === undefined || (S = _anObject(C)[SPECIES$2]) == undefined ? D : _aFunction(S);
  1234. };
  1235. // fast apply, http://jsperf.lnkit.com/fast-apply/5
  1236. var _invoke = function (fn, args, that) {
  1237. var un = that === undefined;
  1238. switch (args.length) {
  1239. case 0: return un ? fn()
  1240. : fn.call(that);
  1241. case 1: return un ? fn(args[0])
  1242. : fn.call(that, args[0]);
  1243. case 2: return un ? fn(args[0], args[1])
  1244. : fn.call(that, args[0], args[1]);
  1245. case 3: return un ? fn(args[0], args[1], args[2])
  1246. : fn.call(that, args[0], args[1], args[2]);
  1247. case 4: return un ? fn(args[0], args[1], args[2], args[3])
  1248. : fn.call(that, args[0], args[1], args[2], args[3]);
  1249. } return fn.apply(that, args);
  1250. };
  1251. var process = _global.process;
  1252. var setTask = _global.setImmediate;
  1253. var clearTask = _global.clearImmediate;
  1254. var MessageChannel = _global.MessageChannel;
  1255. var Dispatch = _global.Dispatch;
  1256. var counter = 0;
  1257. var queue = {};
  1258. var ONREADYSTATECHANGE = 'onreadystatechange';
  1259. var defer, channel, port;
  1260. var run = function () {
  1261. var id = +this;
  1262. // eslint-disable-next-line no-prototype-builtins
  1263. if (queue.hasOwnProperty(id)) {
  1264. var fn = queue[id];
  1265. delete queue[id];
  1266. fn();
  1267. }
  1268. };
  1269. var listener = function (event) {
  1270. run.call(event.data);
  1271. };
  1272. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  1273. if (!setTask || !clearTask) {
  1274. setTask = function setImmediate(fn) {
  1275. var args = [];
  1276. var i = 1;
  1277. while (arguments.length > i) args.push(arguments[i++]);
  1278. queue[++counter] = function () {
  1279. // eslint-disable-next-line no-new-func
  1280. _invoke(typeof fn == 'function' ? fn : Function(fn), args);
  1281. };
  1282. defer(counter);
  1283. return counter;
  1284. };
  1285. clearTask = function clearImmediate(id) {
  1286. delete queue[id];
  1287. };
  1288. // Node.js 0.8-
  1289. if (_cof(process) == 'process') {
  1290. defer = function (id) {
  1291. process.nextTick(_ctx(run, id, 1));
  1292. };
  1293. // Sphere (JS game engine) Dispatch API
  1294. } else if (Dispatch && Dispatch.now) {
  1295. defer = function (id) {
  1296. Dispatch.now(_ctx(run, id, 1));
  1297. };
  1298. // Browsers with MessageChannel, includes WebWorkers
  1299. } else if (MessageChannel) {
  1300. channel = new MessageChannel();
  1301. port = channel.port2;
  1302. channel.port1.onmessage = listener;
  1303. defer = _ctx(port.postMessage, port, 1);
  1304. // Browsers with postMessage, skip WebWorkers
  1305. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  1306. } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) {
  1307. defer = function (id) {
  1308. _global.postMessage(id + '', '*');
  1309. };
  1310. _global.addEventListener('message', listener, false);
  1311. // IE8-
  1312. } else if (ONREADYSTATECHANGE in _domCreate('script')) {
  1313. defer = function (id) {
  1314. _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () {
  1315. _html.removeChild(this);
  1316. run.call(id);
  1317. };
  1318. };
  1319. // Rest old browsers
  1320. } else {
  1321. defer = function (id) {
  1322. setTimeout(_ctx(run, id, 1), 0);
  1323. };
  1324. }
  1325. }
  1326. var _task = {
  1327. set: setTask,
  1328. clear: clearTask
  1329. };
  1330. var macrotask = _task.set;
  1331. var Observer = _global.MutationObserver || _global.WebKitMutationObserver;
  1332. var process$1 = _global.process;
  1333. var Promise = _global.Promise;
  1334. var isNode = _cof(process$1) == 'process';
  1335. var _microtask = function () {
  1336. var head, last, notify;
  1337. var flush = function () {
  1338. var parent, fn;
  1339. if (isNode && (parent = process$1.domain)) parent.exit();
  1340. while (head) {
  1341. fn = head.fn;
  1342. head = head.next;
  1343. try {
  1344. fn();
  1345. } catch (e) {
  1346. if (head) notify();
  1347. else last = undefined;
  1348. throw e;
  1349. }
  1350. } last = undefined;
  1351. if (parent) parent.enter();
  1352. };
  1353. // Node.js
  1354. if (isNode) {
  1355. notify = function () {
  1356. process$1.nextTick(flush);
  1357. };
  1358. // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
  1359. } else if (Observer && !(_global.navigator && _global.navigator.standalone)) {
  1360. var toggle = true;
  1361. var node = document.createTextNode('');
  1362. new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
  1363. notify = function () {
  1364. node.data = toggle = !toggle;
  1365. };
  1366. // environments with maybe non-completely correct, but existent Promise
  1367. } else if (Promise && Promise.resolve) {
  1368. // Promise.resolve without an argument throws an error in LG WebOS 2
  1369. var promise = Promise.resolve(undefined);
  1370. notify = function () {
  1371. promise.then(flush);
  1372. };
  1373. // for other environments - macrotask based on:
  1374. // - setImmediate
  1375. // - MessageChannel
  1376. // - window.postMessag
  1377. // - onreadystatechange
  1378. // - setTimeout
  1379. } else {
  1380. notify = function () {
  1381. // strange IE + webpack dev server bug - use .call(global)
  1382. macrotask.call(_global, flush);
  1383. };
  1384. }
  1385. return function (fn) {
  1386. var task = { fn: fn, next: undefined };
  1387. if (last) last.next = task;
  1388. if (!head) {
  1389. head = task;
  1390. notify();
  1391. } last = task;
  1392. };
  1393. };
  1394. // 25.4.1.5 NewPromiseCapability(C)
  1395. function PromiseCapability(C) {
  1396. var resolve, reject;
  1397. this.promise = new C(function ($$resolve, $$reject) {
  1398. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  1399. resolve = $$resolve;
  1400. reject = $$reject;
  1401. });
  1402. this.resolve = _aFunction(resolve);
  1403. this.reject = _aFunction(reject);
  1404. }
  1405. var f$7 = function (C) {
  1406. return new PromiseCapability(C);
  1407. };
  1408. var _newPromiseCapability = {
  1409. f: f$7
  1410. };
  1411. var _perform = function (exec) {
  1412. try {
  1413. return { e: false, v: exec() };
  1414. } catch (e) {
  1415. return { e: true, v: e };
  1416. }
  1417. };
  1418. var navigator = _global.navigator;
  1419. var _userAgent = navigator && navigator.userAgent || '';
  1420. var _promiseResolve = function (C, x) {
  1421. _anObject(C);
  1422. if (_isObject(x) && x.constructor === C) return x;
  1423. var promiseCapability = _newPromiseCapability.f(C);
  1424. var resolve = promiseCapability.resolve;
  1425. resolve(x);
  1426. return promiseCapability.promise;
  1427. };
  1428. var ITERATOR$3 = _wks('iterator');
  1429. var SAFE_CLOSING = false;
  1430. try {
  1431. var riter = [7][ITERATOR$3]();
  1432. riter['return'] = function () { SAFE_CLOSING = true; };
  1433. } catch (e) { /* empty */ }
  1434. var _iterDetect = function (exec, skipClosing) {
  1435. if (!skipClosing && !SAFE_CLOSING) return false;
  1436. var safe = false;
  1437. try {
  1438. var arr = [7];
  1439. var iter = arr[ITERATOR$3]();
  1440. iter.next = function () { return { done: safe = true }; };
  1441. arr[ITERATOR$3] = function () { return iter; };
  1442. exec(arr);
  1443. } catch (e) { /* empty */ }
  1444. return safe;
  1445. };
  1446. var task = _task.set;
  1447. var microtask = _microtask();
  1448. var PROMISE = 'Promise';
  1449. var TypeError$1 = _global.TypeError;
  1450. var process$2 = _global.process;
  1451. var versions = process$2 && process$2.versions;
  1452. var v8 = versions && versions.v8 || '';
  1453. var $Promise = _global[PROMISE];
  1454. var isNode$1 = _classof(process$2) == 'process';
  1455. var empty = function () { /* empty */ };
  1456. var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
  1457. var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f;
  1458. var USE_NATIVE$1 = !!function () {
  1459. try {
  1460. // correct subclassing with @@species support
  1461. var promise = $Promise.resolve(1);
  1462. var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) {
  1463. exec(empty, empty);
  1464. };
  1465. // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  1466. return (isNode$1 || typeof PromiseRejectionEvent == 'function')
  1467. && promise.then(empty) instanceof FakePromise
  1468. // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  1469. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  1470. // we can't detect it synchronously, so just check versions
  1471. && v8.indexOf('6.6') !== 0
  1472. && _userAgent.indexOf('Chrome/66') === -1;
  1473. } catch (e) { /* empty */ }
  1474. }();
  1475. // helpers
  1476. var isThenable = function (it) {
  1477. var then;
  1478. return _isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  1479. };
  1480. var notify = function (promise, isReject) {
  1481. if (promise._n) return;
  1482. promise._n = true;
  1483. var chain = promise._c;
  1484. microtask(function () {
  1485. var value = promise._v;
  1486. var ok = promise._s == 1;
  1487. var i = 0;
  1488. var run = function (reaction) {
  1489. var handler = ok ? reaction.ok : reaction.fail;
  1490. var resolve = reaction.resolve;
  1491. var reject = reaction.reject;
  1492. var domain = reaction.domain;
  1493. var result, then, exited;
  1494. try {
  1495. if (handler) {
  1496. if (!ok) {
  1497. if (promise._h == 2) onHandleUnhandled(promise);
  1498. promise._h = 1;
  1499. }
  1500. if (handler === true) result = value;
  1501. else {
  1502. if (domain) domain.enter();
  1503. result = handler(value); // may throw
  1504. if (domain) {
  1505. domain.exit();
  1506. exited = true;
  1507. }
  1508. }
  1509. if (result === reaction.promise) {
  1510. reject(TypeError$1('Promise-chain cycle'));
  1511. } else if (then = isThenable(result)) {
  1512. then.call(result, resolve, reject);
  1513. } else resolve(result);
  1514. } else reject(value);
  1515. } catch (e) {
  1516. if (domain && !exited) domain.exit();
  1517. reject(e);
  1518. }
  1519. };
  1520. while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
  1521. promise._c = [];
  1522. promise._n = false;
  1523. if (isReject && !promise._h) onUnhandled(promise);
  1524. });
  1525. };
  1526. var onUnhandled = function (promise) {
  1527. task.call(_global, function () {
  1528. var value = promise._v;
  1529. var unhandled = isUnhandled(promise);
  1530. var result, handler, console;
  1531. if (unhandled) {
  1532. result = _perform(function () {
  1533. if (isNode$1) {
  1534. process$2.emit('unhandledRejection', value, promise);
  1535. } else if (handler = _global.onunhandledrejection) {
  1536. handler({ promise: promise, reason: value });
  1537. } else if ((console = _global.console) && console.error) {
  1538. console.error('Unhandled promise rejection', value);
  1539. }
  1540. });
  1541. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  1542. promise._h = isNode$1 || isUnhandled(promise) ? 2 : 1;
  1543. } promise._a = undefined;
  1544. if (unhandled && result.e) throw result.v;
  1545. });
  1546. };
  1547. var isUnhandled = function (promise) {
  1548. return promise._h !== 1 && (promise._a || promise._c).length === 0;
  1549. };
  1550. var onHandleUnhandled = function (promise) {
  1551. task.call(_global, function () {
  1552. var handler;
  1553. if (isNode$1) {
  1554. process$2.emit('rejectionHandled', promise);
  1555. } else if (handler = _global.onrejectionhandled) {
  1556. handler({ promise: promise, reason: promise._v });
  1557. }
  1558. });
  1559. };
  1560. var $reject = function (value) {
  1561. var promise = this;
  1562. if (promise._d) return;
  1563. promise._d = true;
  1564. promise = promise._w || promise; // unwrap
  1565. promise._v = value;
  1566. promise._s = 2;
  1567. if (!promise._a) promise._a = promise._c.slice();
  1568. notify(promise, true);
  1569. };
  1570. var $resolve = function (value) {
  1571. var promise = this;
  1572. var then;
  1573. if (promise._d) return;
  1574. promise._d = true;
  1575. promise = promise._w || promise; // unwrap
  1576. try {
  1577. if (promise === value) throw TypeError$1("Promise can't be resolved itself");
  1578. if (then = isThenable(value)) {
  1579. microtask(function () {
  1580. var wrapper = { _w: promise, _d: false }; // wrap
  1581. try {
  1582. then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1));
  1583. } catch (e) {
  1584. $reject.call(wrapper, e);
  1585. }
  1586. });
  1587. } else {
  1588. promise._v = value;
  1589. promise._s = 1;
  1590. notify(promise, false);
  1591. }
  1592. } catch (e) {
  1593. $reject.call({ _w: promise, _d: false }, e); // wrap
  1594. }
  1595. };
  1596. // constructor polyfill
  1597. if (!USE_NATIVE$1) {
  1598. // 25.4.3.1 Promise(executor)
  1599. $Promise = function Promise(executor) {
  1600. _anInstance(this, $Promise, PROMISE, '_h');
  1601. _aFunction(executor);
  1602. Internal.call(this);
  1603. try {
  1604. executor(_ctx($resolve, this, 1), _ctx($reject, this, 1));
  1605. } catch (err) {
  1606. $reject.call(this, err);
  1607. }
  1608. };
  1609. // eslint-disable-next-line no-unused-vars
  1610. Internal = function Promise(executor) {
  1611. this._c = []; // <- awaiting reactions
  1612. this._a = undefined; // <- checked in isUnhandled reactions
  1613. this._s = 0; // <- state
  1614. this._d = false; // <- done
  1615. this._v = undefined; // <- value
  1616. this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
  1617. this._n = false; // <- notify
  1618. };
  1619. Internal.prototype = _redefineAll($Promise.prototype, {
  1620. // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
  1621. then: function then(onFulfilled, onRejected) {
  1622. var reaction = newPromiseCapability(_speciesConstructor(this, $Promise));
  1623. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  1624. reaction.fail = typeof onRejected == 'function' && onRejected;
  1625. reaction.domain = isNode$1 ? process$2.domain : undefined;
  1626. this._c.push(reaction);
  1627. if (this._a) this._a.push(reaction);
  1628. if (this._s) notify(this, false);
  1629. return reaction.promise;
  1630. },
  1631. // 25.4.5.1 Promise.prototype.catch(onRejected)
  1632. 'catch': function (onRejected) {
  1633. return this.then(undefined, onRejected);
  1634. }
  1635. });
  1636. OwnPromiseCapability = function () {
  1637. var promise = new Internal();
  1638. this.promise = promise;
  1639. this.resolve = _ctx($resolve, promise, 1);
  1640. this.reject = _ctx($reject, promise, 1);
  1641. };
  1642. _newPromiseCapability.f = newPromiseCapability = function (C) {
  1643. return C === $Promise || C === Wrapper
  1644. ? new OwnPromiseCapability(C)
  1645. : newGenericPromiseCapability(C);
  1646. };
  1647. }
  1648. _export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Promise: $Promise });
  1649. _setToStringTag($Promise, PROMISE);
  1650. _setSpecies(PROMISE);
  1651. Wrapper = _core[PROMISE];
  1652. // statics
  1653. _export(_export.S + _export.F * !USE_NATIVE$1, PROMISE, {
  1654. // 25.4.4.5 Promise.reject(r)
  1655. reject: function reject(r) {
  1656. var capability = newPromiseCapability(this);
  1657. var $$reject = capability.reject;
  1658. $$reject(r);
  1659. return capability.promise;
  1660. }
  1661. });
  1662. _export(_export.S + _export.F * (_library || !USE_NATIVE$1), PROMISE, {
  1663. // 25.4.4.6 Promise.resolve(x)
  1664. resolve: function resolve(x) {
  1665. return _promiseResolve(_library && this === Wrapper ? $Promise : this, x);
  1666. }
  1667. });
  1668. _export(_export.S + _export.F * !(USE_NATIVE$1 && _iterDetect(function (iter) {
  1669. $Promise.all(iter)['catch'](empty);
  1670. })), PROMISE, {
  1671. // 25.4.4.1 Promise.all(iterable)
  1672. all: function all(iterable) {
  1673. var C = this;
  1674. var capability = newPromiseCapability(C);
  1675. var resolve = capability.resolve;
  1676. var reject = capability.reject;
  1677. var result = _perform(function () {
  1678. var values = [];
  1679. var index = 0;
  1680. var remaining = 1;
  1681. _forOf(iterable, false, function (promise) {
  1682. var $index = index++;
  1683. var alreadyCalled = false;
  1684. values.push(undefined);
  1685. remaining++;
  1686. C.resolve(promise).then(function (value) {
  1687. if (alreadyCalled) return;
  1688. alreadyCalled = true;
  1689. values[$index] = value;
  1690. --remaining || resolve(values);
  1691. }, reject);
  1692. });
  1693. --remaining || resolve(values);
  1694. });
  1695. if (result.e) reject(result.v);
  1696. return capability.promise;
  1697. },
  1698. // 25.4.4.4 Promise.race(iterable)
  1699. race: function race(iterable) {
  1700. var C = this;
  1701. var capability = newPromiseCapability(C);
  1702. var reject = capability.reject;
  1703. var result = _perform(function () {
  1704. _forOf(iterable, false, function (promise) {
  1705. C.resolve(promise).then(capability.resolve, reject);
  1706. });
  1707. });
  1708. if (result.e) reject(result.v);
  1709. return capability.promise;
  1710. }
  1711. });
  1712. _export(_export.P + _export.R, 'Promise', { 'finally': function (onFinally) {
  1713. var C = _speciesConstructor(this, _core.Promise || _global.Promise);
  1714. var isFunction = typeof onFinally == 'function';
  1715. return this.then(
  1716. isFunction ? function (x) {
  1717. return _promiseResolve(C, onFinally()).then(function () { return x; });
  1718. } : onFinally,
  1719. isFunction ? function (e) {
  1720. return _promiseResolve(C, onFinally()).then(function () { throw e; });
  1721. } : onFinally
  1722. );
  1723. } });
  1724. // https://github.com/tc39/proposal-promise-try
  1725. _export(_export.S, 'Promise', { 'try': function (callbackfn) {
  1726. var promiseCapability = _newPromiseCapability.f(this);
  1727. var result = _perform(callbackfn);
  1728. (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
  1729. return promiseCapability.promise;
  1730. } });
  1731. var promise = _core.Promise;
  1732. var promise$1 = createCommonjsModule(function (module) {
  1733. module.exports = { "default": promise, __esModule: true };
  1734. });
  1735. var _Promise = unwrapExports(promise$1);
  1736. var SET = 'Set';
  1737. // 23.2 Set Objects
  1738. var es6_set = _collection(SET, function (get) {
  1739. return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1740. }, {
  1741. // 23.2.3.1 Set.prototype.add(value)
  1742. add: function add(value) {
  1743. return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value);
  1744. }
  1745. }, _collectionStrong);
  1746. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1747. _export(_export.P + _export.R, 'Set', { toJSON: _collectionToJson('Set') });
  1748. // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
  1749. _setCollectionOf('Set');
  1750. // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
  1751. _setCollectionFrom('Set');
  1752. var set = _core.Set;
  1753. var set$1 = createCommonjsModule(function (module) {
  1754. module.exports = { "default": set, __esModule: true };
  1755. });
  1756. var _Set = unwrapExports(set$1);
  1757. // 19.1.2.1 Object.assign(target, source, ...)
  1758. var $assign = Object.assign;
  1759. // should work with symbols and should have deterministic property order (V8 bug)
  1760. var _objectAssign = !$assign || _fails(function () {
  1761. var A = {};
  1762. var B = {};
  1763. // eslint-disable-next-line no-undef
  1764. var S = Symbol();
  1765. var K = 'abcdefghijklmnopqrst';
  1766. A[S] = 7;
  1767. K.split('').forEach(function (k) { B[k] = k; });
  1768. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  1769. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  1770. var T = _toObject(target);
  1771. var aLen = arguments.length;
  1772. var index = 1;
  1773. var getSymbols = _objectGops.f;
  1774. var isEnum = _objectPie.f;
  1775. while (aLen > index) {
  1776. var S = _iobject(arguments[index++]);
  1777. var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
  1778. var length = keys.length;
  1779. var j = 0;
  1780. var key;
  1781. while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
  1782. } return T;
  1783. } : $assign;
  1784. var getWeak = _meta.getWeak;
  1785. var arrayFind = _arrayMethods(5);
  1786. var arrayFindIndex = _arrayMethods(6);
  1787. var id$1 = 0;
  1788. // fallback for uncaught frozen keys
  1789. var uncaughtFrozenStore = function (that) {
  1790. return that._l || (that._l = new UncaughtFrozenStore());
  1791. };
  1792. var UncaughtFrozenStore = function () {
  1793. this.a = [];
  1794. };
  1795. var findUncaughtFrozen = function (store, key) {
  1796. return arrayFind(store.a, function (it) {
  1797. return it[0] === key;
  1798. });
  1799. };
  1800. UncaughtFrozenStore.prototype = {
  1801. get: function (key) {
  1802. var entry = findUncaughtFrozen(this, key);
  1803. if (entry) return entry[1];
  1804. },
  1805. has: function (key) {
  1806. return !!findUncaughtFrozen(this, key);
  1807. },
  1808. set: function (key, value) {
  1809. var entry = findUncaughtFrozen(this, key);
  1810. if (entry) entry[1] = value;
  1811. else this.a.push([key, value]);
  1812. },
  1813. 'delete': function (key) {
  1814. var index = arrayFindIndex(this.a, function (it) {
  1815. return it[0] === key;
  1816. });
  1817. if (~index) this.a.splice(index, 1);
  1818. return !!~index;
  1819. }
  1820. };
  1821. var _collectionWeak = {
  1822. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  1823. var C = wrapper(function (that, iterable) {
  1824. _anInstance(that, C, NAME, '_i');
  1825. that._t = NAME; // collection type
  1826. that._i = id$1++; // collection id
  1827. that._l = undefined; // leak store for uncaught frozen objects
  1828. if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
  1829. });
  1830. _redefineAll(C.prototype, {
  1831. // 23.3.3.2 WeakMap.prototype.delete(key)
  1832. // 23.4.3.3 WeakSet.prototype.delete(value)
  1833. 'delete': function (key) {
  1834. if (!_isObject(key)) return false;
  1835. var data = getWeak(key);
  1836. if (data === true) return uncaughtFrozenStore(_validateCollection(this, NAME))['delete'](key);
  1837. return data && _has(data, this._i) && delete data[this._i];
  1838. },
  1839. // 23.3.3.4 WeakMap.prototype.has(key)
  1840. // 23.4.3.4 WeakSet.prototype.has(value)
  1841. has: function has(key) {
  1842. if (!_isObject(key)) return false;
  1843. var data = getWeak(key);
  1844. if (data === true) return uncaughtFrozenStore(_validateCollection(this, NAME)).has(key);
  1845. return data && _has(data, this._i);
  1846. }
  1847. });
  1848. return C;
  1849. },
  1850. def: function (that, key, value) {
  1851. var data = getWeak(_anObject(key), true);
  1852. if (data === true) uncaughtFrozenStore(that).set(key, value);
  1853. else data[that._i] = value;
  1854. return that;
  1855. },
  1856. ufstore: uncaughtFrozenStore
  1857. };
  1858. var es6_weakMap = createCommonjsModule(function (module) {
  1859. var each = _arrayMethods(0);
  1860. var WEAK_MAP = 'WeakMap';
  1861. var getWeak = _meta.getWeak;
  1862. var isExtensible = Object.isExtensible;
  1863. var uncaughtFrozenStore = _collectionWeak.ufstore;
  1864. var tmp = {};
  1865. var InternalMap;
  1866. var wrapper = function (get) {
  1867. return function WeakMap() {
  1868. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  1869. };
  1870. };
  1871. var methods = {
  1872. // 23.3.3.3 WeakMap.prototype.get(key)
  1873. get: function get(key) {
  1874. if (_isObject(key)) {
  1875. var data = getWeak(key);
  1876. if (data === true) return uncaughtFrozenStore(_validateCollection(this, WEAK_MAP)).get(key);
  1877. return data ? data[this._i] : undefined;
  1878. }
  1879. },
  1880. // 23.3.3.5 WeakMap.prototype.set(key, value)
  1881. set: function set(key, value) {
  1882. return _collectionWeak.def(_validateCollection(this, WEAK_MAP), key, value);
  1883. }
  1884. };
  1885. // 23.3 WeakMap Objects
  1886. var $WeakMap = module.exports = _collection(WEAK_MAP, wrapper, methods, _collectionWeak, true, true);
  1887. // IE11 WeakMap frozen keys fix
  1888. if (_fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) {
  1889. InternalMap = _collectionWeak.getConstructor(wrapper, WEAK_MAP);
  1890. _objectAssign(InternalMap.prototype, methods);
  1891. _meta.NEED = true;
  1892. each(['delete', 'has', 'get', 'set'], function (key) {
  1893. var proto = $WeakMap.prototype;
  1894. var method = proto[key];
  1895. _redefine(proto, key, function (a, b) {
  1896. // store frozen objects on internal weakmap shim
  1897. if (_isObject(a) && !isExtensible(a)) {
  1898. if (!this._f) this._f = new InternalMap();
  1899. var result = this._f[key](a, b);
  1900. return key == 'set' ? this : result;
  1901. // store all the rest on native weakmap
  1902. } return method.call(this, a, b);
  1903. });
  1904. });
  1905. }
  1906. });
  1907. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
  1908. _setCollectionOf('WeakMap');
  1909. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
  1910. _setCollectionFrom('WeakMap');
  1911. var weakMap = _core.WeakMap;
  1912. var weakMap$1 = createCommonjsModule(function (module) {
  1913. module.exports = { "default": weakMap, __esModule: true };
  1914. });
  1915. var _WeakMap = unwrapExports(weakMap$1);
  1916. var classCallCheck = createCommonjsModule(function (module, exports) {
  1917. exports.__esModule = true;
  1918. exports.default = function (instance, Constructor) {
  1919. if (!(instance instanceof Constructor)) {
  1920. throw new TypeError("Cannot call a class as a function");
  1921. }
  1922. };
  1923. });
  1924. var _classCallCheck = unwrapExports(classCallCheck);
  1925. var createClass = createCommonjsModule(function (module, exports) {
  1926. exports.__esModule = true;
  1927. var _defineProperty2 = _interopRequireDefault(defineProperty$1);
  1928. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1929. exports.default = function () {
  1930. function defineProperties(target, props) {
  1931. for (var i = 0; i < props.length; i++) {
  1932. var descriptor = props[i];
  1933. descriptor.enumerable = descriptor.enumerable || false;
  1934. descriptor.configurable = true;
  1935. if ("value" in descriptor) descriptor.writable = true;
  1936. (0, _defineProperty2.default)(target, descriptor.key, descriptor);
  1937. }
  1938. }
  1939. return function (Constructor, protoProps, staticProps) {
  1940. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  1941. if (staticProps) defineProperties(Constructor, staticProps);
  1942. return Constructor;
  1943. };
  1944. }();
  1945. });
  1946. var _createClass = unwrapExports(createClass);
  1947. // most Object methods by ES6 should accept primitives
  1948. var _objectSap = function (KEY, exec) {
  1949. var fn = (_core.Object || {})[KEY] || Object[KEY];
  1950. var exp = {};
  1951. exp[KEY] = exec(fn);
  1952. _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
  1953. };
  1954. // 19.1.2.14 Object.keys(O)
  1955. _objectSap('keys', function () {
  1956. return function keys(it) {
  1957. return _objectKeys(_toObject(it));
  1958. };
  1959. });
  1960. var keys = _core.Object.keys;
  1961. var keys$1 = createCommonjsModule(function (module) {
  1962. module.exports = { "default": keys, __esModule: true };
  1963. });
  1964. var _Object$keys = unwrapExports(keys$1);
  1965. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  1966. var $getOwnPropertyDescriptor$1 = _objectGopd.f;
  1967. _objectSap('getOwnPropertyDescriptor', function () {
  1968. return function getOwnPropertyDescriptor(it, key) {
  1969. return $getOwnPropertyDescriptor$1(_toIobject(it), key);
  1970. };
  1971. });
  1972. var $Object$1 = _core.Object;
  1973. var getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  1974. return $Object$1.getOwnPropertyDescriptor(it, key);
  1975. };
  1976. var getOwnPropertyDescriptor$1 = createCommonjsModule(function (module) {
  1977. module.exports = { "default": getOwnPropertyDescriptor, __esModule: true };
  1978. });
  1979. var _Object$getOwnPropertyDescriptor = unwrapExports(getOwnPropertyDescriptor$1);
  1980. // 19.1.2.7 Object.getOwnPropertyNames(O)
  1981. _objectSap('getOwnPropertyNames', function () {
  1982. return _objectGopnExt.f;
  1983. });
  1984. var $Object$2 = _core.Object;
  1985. var getOwnPropertyNames = function getOwnPropertyNames(it) {
  1986. return $Object$2.getOwnPropertyNames(it);
  1987. };
  1988. var getOwnPropertyNames$1 = createCommonjsModule(function (module) {
  1989. module.exports = { "default": getOwnPropertyNames, __esModule: true };
  1990. });
  1991. var _Object$getOwnPropertyNames = unwrapExports(getOwnPropertyNames$1);
  1992. // 19.1.2.9 Object.getPrototypeOf(O)
  1993. _objectSap('getPrototypeOf', function () {
  1994. return function getPrototypeOf(it) {
  1995. return _objectGpo(_toObject(it));
  1996. };
  1997. });
  1998. var getPrototypeOf = _core.Object.getPrototypeOf;
  1999. var getPrototypeOf$1 = createCommonjsModule(function (module) {
  2000. module.exports = { "default": getPrototypeOf, __esModule: true };
  2001. });
  2002. var _Object$getPrototypeOf = unwrapExports(getPrototypeOf$1);
  2003. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  2004. _export(_export.S, 'Object', { create: _objectCreate });
  2005. var $Object$3 = _core.Object;
  2006. var create = function create(P, D) {
  2007. return $Object$3.create(P, D);
  2008. };
  2009. var create$1 = createCommonjsModule(function (module) {
  2010. module.exports = { "default": create, __esModule: true };
  2011. });
  2012. var _Object$create = unwrapExports(create$1);
  2013. // 19.1.3.1 Object.assign(target, source)
  2014. _export(_export.S + _export.F, 'Object', { assign: _objectAssign });
  2015. var assign = _core.Object.assign;
  2016. var assign$1 = createCommonjsModule(function (module) {
  2017. module.exports = { "default": assign, __esModule: true };
  2018. });
  2019. var _Object$assign = unwrapExports(assign$1);
  2020. var src = createCommonjsModule(function (module) {
  2021. /**
  2022. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  2023. *
  2024. * This source code is licensed under the MIT license found in the
  2025. * LICENSE file in the root directory of this source tree.
  2026. *
  2027. *
  2028. */
  2029. /**
  2030. * Represents the result of a single call to a mock function.
  2031. */
  2032. var MOCK_CONSTRUCTOR_NAME = 'mockConstructor';
  2033. var FUNCTION_NAME_RESERVED_PATTERN = /[\s!-\/:-@\[-`{-~]/;
  2034. var FUNCTION_NAME_RESERVED_REPLACE = new RegExp(FUNCTION_NAME_RESERVED_PATTERN.source, 'g');
  2035. var RESERVED_KEYWORDS = _Object$assign(_Object$create(null), {
  2036. arguments: true,
  2037. await: true,
  2038. break: true,
  2039. case: true,
  2040. catch: true,
  2041. class: true,
  2042. const: true,
  2043. continue: true,
  2044. debugger: true,
  2045. default: true,
  2046. delete: true,
  2047. do: true,
  2048. else: true,
  2049. enum: true,
  2050. eval: true,
  2051. export: true,
  2052. extends: true,
  2053. false: true,
  2054. finally: true,
  2055. for: true,
  2056. function: true,
  2057. if: true,
  2058. implements: true,
  2059. import: true,
  2060. in: true,
  2061. instanceof: true,
  2062. interface: true,
  2063. let: true,
  2064. new: true,
  2065. null: true,
  2066. package: true,
  2067. private: true,
  2068. protected: true,
  2069. public: true,
  2070. return: true,
  2071. static: true,
  2072. super: true,
  2073. switch: true,
  2074. this: true,
  2075. throw: true,
  2076. true: true,
  2077. try: true,
  2078. typeof: true,
  2079. var: true,
  2080. void: true,
  2081. while: true,
  2082. with: true,
  2083. yield: true
  2084. });
  2085. function matchArity(fn, length) {
  2086. var mockConstructor = void 0;
  2087. switch (length) {
  2088. case 1:
  2089. mockConstructor = function mockConstructor(a) {
  2090. return fn.apply(this, arguments);
  2091. };
  2092. break;
  2093. case 2:
  2094. mockConstructor = function mockConstructor(a, b) {
  2095. return fn.apply(this, arguments);
  2096. };
  2097. break;
  2098. case 3:
  2099. mockConstructor = function mockConstructor(a, b, c) {
  2100. return fn.apply(this, arguments);
  2101. };
  2102. break;
  2103. case 4:
  2104. mockConstructor = function mockConstructor(a, b, c, d) {
  2105. return fn.apply(this, arguments);
  2106. };
  2107. break;
  2108. case 5:
  2109. mockConstructor = function mockConstructor(a, b, c, d, e) {
  2110. return fn.apply(this, arguments);
  2111. };
  2112. break;
  2113. case 6:
  2114. mockConstructor = function mockConstructor(a, b, c, d, e, f) {
  2115. return fn.apply(this, arguments);
  2116. };
  2117. break;
  2118. case 7:
  2119. mockConstructor = function mockConstructor(a, b, c, d, e, f, g) {
  2120. return fn.apply(this, arguments);
  2121. };
  2122. break;
  2123. case 8:
  2124. mockConstructor = function mockConstructor(a, b, c, d, e, f, g, h) {
  2125. return fn.apply(this, arguments);
  2126. };
  2127. break;
  2128. case 9:
  2129. mockConstructor = function mockConstructor(a, b, c, d, e, f, g, h, i) {
  2130. return fn.apply(this, arguments);
  2131. };
  2132. break;
  2133. default:
  2134. mockConstructor = function mockConstructor() {
  2135. return fn.apply(this, arguments);
  2136. };
  2137. break;
  2138. }
  2139. return mockConstructor;
  2140. }
  2141. function isA(typeName, value) {
  2142. return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
  2143. }
  2144. function getType(ref) {
  2145. if (isA('Function', ref) || isA('AsyncFunction', ref) || isA('GeneratorFunction', ref)) {
  2146. return 'function';
  2147. } else if (Array.isArray(ref)) {
  2148. return 'array';
  2149. } else if (isA('Object', ref)) {
  2150. return 'object';
  2151. } else if (isA('Number', ref) || isA('String', ref) || isA('Boolean', ref) || isA('Symbol', ref)) {
  2152. return 'constant';
  2153. } else if (isA('Map', ref) || isA('WeakMap', ref) || isA('Set', ref)) {
  2154. return 'collection';
  2155. } else if (isA('RegExp', ref)) {
  2156. return 'regexp';
  2157. } else if (ref === undefined) {
  2158. return 'undefined';
  2159. } else if (ref === null) {
  2160. return 'null';
  2161. } else {
  2162. return null;
  2163. }
  2164. }
  2165. function isReadonlyProp(object, prop) {
  2166. return (prop === 'arguments' || prop === 'caller' || prop === 'callee' || prop === 'name' || prop === 'length') && (isA('Function', object) || isA('AsyncFunction', object) || isA('GeneratorFunction', object)) || (prop === 'source' || prop === 'global' || prop === 'ignoreCase' || prop === 'multiline') && isA('RegExp', object);
  2167. }
  2168. function getSlots(object) {
  2169. var slots = {};
  2170. if (!object) {
  2171. return [];
  2172. }
  2173. var parent = _Object$getPrototypeOf(object);
  2174. do {
  2175. if (object === _Object$getPrototypeOf(Function)) {
  2176. break;
  2177. }
  2178. var ownNames = _Object$getOwnPropertyNames(object);
  2179. for (var i = 0; i < ownNames.length; i++) {
  2180. var prop = ownNames[i];
  2181. if (!isReadonlyProp(object, prop)) {
  2182. var propDesc = _Object$getOwnPropertyDescriptor(object, prop);
  2183. if (propDesc !== undefined && !propDesc.get || object.__esModule) {
  2184. slots[prop] = true;
  2185. }
  2186. }
  2187. }
  2188. object = parent;
  2189. } while (object && (parent = _Object$getPrototypeOf(object)) !== null);
  2190. return _Object$keys(slots);
  2191. }
  2192. var ModuleMockerClass = function () {
  2193. /**
  2194. * @see README.md
  2195. * @param global Global object of the test environment, used to create
  2196. * mocks
  2197. */
  2198. function ModuleMockerClass(global) {
  2199. _classCallCheck(this, ModuleMockerClass);
  2200. this._environmentGlobal = global;
  2201. this._mockState = new _WeakMap();
  2202. this._mockConfigRegistry = new _WeakMap();
  2203. this._spyState = new _Set();
  2204. this.ModuleMocker = ModuleMockerClass;
  2205. this._invocationCallCounter = 1;
  2206. }
  2207. _createClass(ModuleMockerClass, [{
  2208. key: '_ensureMockConfig',
  2209. value: function _ensureMockConfig(f) {
  2210. var config = this._mockConfigRegistry.get(f);
  2211. if (!config) {
  2212. config = this._defaultMockConfig();
  2213. this._mockConfigRegistry.set(f, config);
  2214. }
  2215. return config;
  2216. }
  2217. }, {
  2218. key: '_ensureMockState',
  2219. value: function _ensureMockState(f) {
  2220. var state = this._mockState.get(f);
  2221. if (!state) {
  2222. state = this._defaultMockState();
  2223. this._mockState.set(f, state);
  2224. }
  2225. return state;
  2226. }
  2227. }, {
  2228. key: '_defaultMockConfig',
  2229. value: function _defaultMockConfig() {
  2230. return {
  2231. defaultReturnValue: undefined,
  2232. isReturnValueLastSet: false,
  2233. mockImpl: undefined,
  2234. mockName: 'jest.fn()',
  2235. specificMockImpls: [],
  2236. specificReturnValues: []
  2237. };
  2238. }
  2239. }, {
  2240. key: '_defaultMockState',
  2241. value: function _defaultMockState() {
  2242. return {
  2243. calls: [],
  2244. instances: [],
  2245. invocationCallOrder: [],
  2246. results: []
  2247. };
  2248. }
  2249. }, {
  2250. key: '_makeComponent',
  2251. value: function _makeComponent(metadata, restore) {
  2252. var _this2 = this;
  2253. if (metadata.type === 'object') {
  2254. return new this._environmentGlobal.Object();
  2255. } else if (metadata.type === 'array') {
  2256. return new this._environmentGlobal.Array();
  2257. } else if (metadata.type === 'regexp') {
  2258. return new this._environmentGlobal.RegExp('');
  2259. } else if (metadata.type === 'constant' || metadata.type === 'collection' || metadata.type === 'null' || metadata.type === 'undefined') {
  2260. return metadata.value;
  2261. } else if (metadata.type === 'function') {
  2262. /* eslint-disable prefer-const */
  2263. var f = void 0;
  2264. /* eslint-enable prefer-const */
  2265. var prototype = metadata.members && metadata.members.prototype && metadata.members.prototype.members || {};
  2266. var prototypeSlots = getSlots(prototype);
  2267. var mocker = this;
  2268. var mockConstructor = matchArity(function () {
  2269. var _this = this,
  2270. _arguments = arguments;
  2271. var mockState = mocker._ensureMockState(f);
  2272. var mockConfig = mocker._ensureMockConfig(f);
  2273. mockState.instances.push(this);
  2274. mockState.calls.push(Array.prototype.slice.call(arguments));
  2275. mockState.invocationCallOrder.push(mocker._invocationCallCounter++);
  2276. // Will be set to the return value of the mock if an error is not thrown
  2277. var finalReturnValue = void 0;
  2278. // Will be set to the error that is thrown by the mock (if it throws)
  2279. var thrownError = void 0;
  2280. // Will be set to true if the mock throws an error. The presence of a
  2281. // value in `thrownError` is not a 100% reliable indicator because a
  2282. // function could throw a value of undefined.
  2283. var callDidThrowError = false;
  2284. try {
  2285. // The bulk of the implementation is wrapped in an immediately
  2286. // executed arrow function so the return value of the mock function
  2287. // can be easily captured and recorded, despite the many separate
  2288. // return points within the logic.
  2289. finalReturnValue = function () {
  2290. if (_this instanceof f) {
  2291. // This is probably being called as a constructor
  2292. prototypeSlots.forEach(function (slot) {
  2293. // Copy prototype methods to the instance to make
  2294. // it easier to interact with mock instance call and
  2295. // return values
  2296. if (prototype[slot].type === 'function') {
  2297. var protoImpl = _this[slot];
  2298. _this[slot] = mocker.generateFromMetadata(prototype[slot]);
  2299. _this[slot]._protoImpl = protoImpl;
  2300. }
  2301. });
  2302. // Run the mock constructor implementation
  2303. var mockImpl = mockConfig.specificMockImpls.length ? mockConfig.specificMockImpls.shift() : mockConfig.mockImpl;
  2304. return mockImpl && mockImpl.apply(_this, _arguments);
  2305. }
  2306. var returnValue = mockConfig.defaultReturnValue;
  2307. // If return value is last set, either specific or default, i.e.
  2308. // mockReturnValueOnce()/mockReturnValue() is called and no
  2309. // mockImplementationOnce()/mockImplementation() is called after
  2310. // that.
  2311. // use the set return value.
  2312. if (mockConfig.specificReturnValues.length) {
  2313. return mockConfig.specificReturnValues.shift();
  2314. }
  2315. if (mockConfig.isReturnValueLastSet) {
  2316. return mockConfig.defaultReturnValue;
  2317. }
  2318. // If mockImplementationOnce()/mockImplementation() is last set,
  2319. // or specific return values are used up, use the mock
  2320. // implementation.
  2321. var specificMockImpl = void 0;
  2322. if (returnValue === undefined) {
  2323. specificMockImpl = mockConfig.specificMockImpls.shift();
  2324. if (specificMockImpl === undefined) {
  2325. specificMockImpl = mockConfig.mockImpl;
  2326. }
  2327. if (specificMockImpl) {
  2328. return specificMockImpl.apply(_this, _arguments);
  2329. }
  2330. }
  2331. // Otherwise use prototype implementation
  2332. if (returnValue === undefined && f._protoImpl) {
  2333. return f._protoImpl.apply(_this, _arguments);
  2334. }
  2335. return returnValue;
  2336. }();
  2337. } catch (error) {
  2338. // Store the thrown error so we can record it, then re-throw it.
  2339. thrownError = error;
  2340. callDidThrowError = true;
  2341. throw error;
  2342. } finally {
  2343. // Record the result of the function
  2344. mockState.results.push({
  2345. isThrow: callDidThrowError,
  2346. value: callDidThrowError ? thrownError : finalReturnValue
  2347. });
  2348. }
  2349. return finalReturnValue;
  2350. }, metadata.length || 0);
  2351. f = this._createMockFunction(metadata, mockConstructor);
  2352. f._isMockFunction = true;
  2353. f.getMockImplementation = function () {
  2354. return _this2._ensureMockConfig(f).mockImpl;
  2355. };
  2356. if (typeof restore === 'function') {
  2357. this._spyState.add(restore);
  2358. }
  2359. this._mockState.set(f, this._defaultMockState());
  2360. this._mockConfigRegistry.set(f, this._defaultMockConfig());
  2361. // $FlowFixMe - defineProperty getters not supported
  2362. Object.defineProperty(f, 'mock', {
  2363. configurable: false,
  2364. enumerable: true,
  2365. get: function get() {
  2366. return _this2._ensureMockState(f);
  2367. },
  2368. set: function set(val) {
  2369. return _this2._mockState.set(f, val);
  2370. }
  2371. });
  2372. f.mockClear = function () {
  2373. _this2._mockState.delete(f);
  2374. return f;
  2375. };
  2376. f.mockReset = function () {
  2377. f.mockClear();
  2378. _this2._mockConfigRegistry.delete(f);
  2379. return f;
  2380. };
  2381. f.mockRestore = function () {
  2382. f.mockReset();
  2383. return restore ? restore() : undefined;
  2384. };
  2385. f.mockReturnValueOnce = function (value) {
  2386. // next function call will return this value or default return value
  2387. var mockConfig = _this2._ensureMockConfig(f);
  2388. mockConfig.specificReturnValues.push(value);
  2389. return f;
  2390. };
  2391. f.mockResolvedValueOnce = function (value) {
  2392. return f.mockImplementationOnce(function () {
  2393. return _Promise.resolve(value);
  2394. });
  2395. };
  2396. f.mockRejectedValueOnce = function (value) {
  2397. return f.mockImplementationOnce(function () {
  2398. return _Promise.reject(value);
  2399. });
  2400. };
  2401. f.mockReturnValue = function (value) {
  2402. // next function call will return specified return value or this one
  2403. var mockConfig = _this2._ensureMockConfig(f);
  2404. mockConfig.isReturnValueLastSet = true;
  2405. mockConfig.defaultReturnValue = value;
  2406. return f;
  2407. };
  2408. f.mockResolvedValue = function (value) {
  2409. return f.mockImplementation(function () {
  2410. return _Promise.resolve(value);
  2411. });
  2412. };
  2413. f.mockRejectedValue = function (value) {
  2414. return f.mockImplementation(function () {
  2415. return _Promise.reject(value);
  2416. });
  2417. };
  2418. f.mockImplementationOnce = function (fn) {
  2419. // next function call will use this mock implementation return value
  2420. // or default mock implementation return value
  2421. var mockConfig = _this2._ensureMockConfig(f);
  2422. mockConfig.isReturnValueLastSet = false;
  2423. mockConfig.specificMockImpls.push(fn);
  2424. return f;
  2425. };
  2426. f.mockImplementation = function (fn) {
  2427. // next function call will use mock implementation return value
  2428. var mockConfig = _this2._ensureMockConfig(f);
  2429. mockConfig.isReturnValueLastSet = false;
  2430. mockConfig.defaultReturnValue = undefined;
  2431. mockConfig.mockImpl = fn;
  2432. return f;
  2433. };
  2434. f.mockReturnThis = function () {
  2435. return f.mockImplementation(function () {
  2436. return this;
  2437. });
  2438. };
  2439. f.mockName = function (name) {
  2440. if (name) {
  2441. var mockConfig = _this2._ensureMockConfig(f);
  2442. mockConfig.mockName = name;
  2443. }
  2444. return f;
  2445. };
  2446. f.getMockName = function () {
  2447. var mockConfig = _this2._ensureMockConfig(f);
  2448. return mockConfig.mockName || 'jest.fn()';
  2449. };
  2450. if (metadata.mockImpl) {
  2451. f.mockImplementation(metadata.mockImpl);
  2452. }
  2453. return f;
  2454. } else {
  2455. var unknownType = metadata.type || 'undefined type';
  2456. throw new Error('Unrecognized type ' + unknownType);
  2457. }
  2458. }
  2459. }, {
  2460. key: '_createMockFunction',
  2461. value: function _createMockFunction(metadata, mockConstructor) {
  2462. var name = metadata.name;
  2463. if (!name) {
  2464. return mockConstructor;
  2465. }
  2466. // Preserve `name` property of mocked function.
  2467. var boundFunctionPrefix = 'bound ';
  2468. var bindCall = '';
  2469. // if-do-while for perf reasons. The common case is for the if to fail.
  2470. if (name && name.startsWith(boundFunctionPrefix)) {
  2471. do {
  2472. name = name.substring(boundFunctionPrefix.length);
  2473. // Call bind() just to alter the function name.
  2474. bindCall = '.bind(null)';
  2475. } while (name && name.startsWith(boundFunctionPrefix));
  2476. }
  2477. // Special case functions named `mockConstructor` to guard for infinite
  2478. // loops.
  2479. if (name === MOCK_CONSTRUCTOR_NAME) {
  2480. return mockConstructor;
  2481. }
  2482. // It's a syntax error to define functions with a reserved keyword
  2483. // as name.
  2484. if (RESERVED_KEYWORDS[name]) {
  2485. name = '$' + name;
  2486. }
  2487. // It's also a syntax error to define a function with a reserved character
  2488. // as part of it's name.
  2489. if (FUNCTION_NAME_RESERVED_PATTERN.test(name)) {
  2490. name = name.replace(FUNCTION_NAME_RESERVED_REPLACE, '$');
  2491. }
  2492. var body = 'return function ' + name + '() {' + 'return ' + MOCK_CONSTRUCTOR_NAME + '.apply(this,arguments);' + '}' + bindCall;
  2493. var createConstructor = new this._environmentGlobal.Function(MOCK_CONSTRUCTOR_NAME, body);
  2494. return createConstructor(mockConstructor);
  2495. }
  2496. }, {
  2497. key: '_generateMock',
  2498. value: function _generateMock(metadata, callbacks, refs) {
  2499. var _this3 = this;
  2500. var mock = this._makeComponent(metadata);
  2501. if (metadata.refID != null) {
  2502. refs[metadata.refID] = mock;
  2503. }
  2504. getSlots(metadata.members).forEach(function (slot) {
  2505. var slotMetadata = metadata.members && metadata.members[slot] || {};
  2506. if (slotMetadata.ref != null) {
  2507. callbacks.push(function () {
  2508. return mock[slot] = refs[slotMetadata.ref];
  2509. });
  2510. } else {
  2511. mock[slot] = _this3._generateMock(slotMetadata, callbacks, refs);
  2512. }
  2513. });
  2514. if (metadata.type !== 'undefined' && metadata.type !== 'null' && mock.prototype) {
  2515. mock.prototype.constructor = mock;
  2516. }
  2517. return mock;
  2518. }
  2519. /**
  2520. * @see README.md
  2521. * @param metadata Metadata for the mock in the schema returned by the
  2522. * getMetadata method of this module.
  2523. */
  2524. }, {
  2525. key: 'generateFromMetadata',
  2526. value: function generateFromMetadata(_metadata) {
  2527. var callbacks = [];
  2528. var refs = {};
  2529. var mock = this._generateMock(_metadata, callbacks, refs);
  2530. callbacks.forEach(function (setter) {
  2531. return setter();
  2532. });
  2533. return mock;
  2534. }
  2535. /**
  2536. * @see README.md
  2537. * @param component The component for which to retrieve metadata.
  2538. */
  2539. }, {
  2540. key: 'getMetadata',
  2541. value: function getMetadata(component, _refs) {
  2542. var _this4 = this;
  2543. var refs = _refs || new _Map();
  2544. var ref = refs.get(component);
  2545. if (ref != null) {
  2546. return { ref: ref };
  2547. }
  2548. var type = getType(component);
  2549. if (!type) {
  2550. return null;
  2551. }
  2552. var metadata = { type: type };
  2553. if (type === 'constant' || type === 'collection' || type === 'undefined' || type === 'null') {
  2554. metadata.value = component;
  2555. return metadata;
  2556. } else if (type === 'function') {
  2557. metadata.name = component.name;
  2558. if (component._isMockFunction) {
  2559. metadata.mockImpl = component.getMockImplementation();
  2560. }
  2561. }
  2562. metadata.refID = refs.size;
  2563. refs.set(component, metadata.refID);
  2564. var members = null;
  2565. // Leave arrays alone
  2566. if (type !== 'array') {
  2567. if (type !== 'undefined') {
  2568. getSlots(component).forEach(function (slot) {
  2569. if (type === 'function' && component._isMockFunction && slot.match(/^mock/)) {
  2570. return;
  2571. }
  2572. if (!component.hasOwnProperty && component[slot] !== undefined || component.hasOwnProperty && component.hasOwnProperty(slot) || type === 'object' && component[slot] != Object.prototype[slot]) {
  2573. var slotMetadata = _this4.getMetadata(component[slot], refs);
  2574. if (slotMetadata) {
  2575. if (!members) {
  2576. members = {};
  2577. }
  2578. members[slot] = slotMetadata;
  2579. }
  2580. }
  2581. });
  2582. }
  2583. // If component is native code function, prototype might be undefined
  2584. if (type === 'function' && component.prototype) {
  2585. var prototype = this.getMetadata(component.prototype, refs);
  2586. if (prototype && prototype.members) {
  2587. if (!members) {
  2588. members = {};
  2589. }
  2590. members.prototype = prototype;
  2591. }
  2592. }
  2593. }
  2594. if (members) {
  2595. metadata.members = members;
  2596. }
  2597. return metadata;
  2598. }
  2599. }, {
  2600. key: 'isMockFunction',
  2601. value: function isMockFunction(fn) {
  2602. return !!(fn && fn._isMockFunction);
  2603. }
  2604. }, {
  2605. key: 'fn',
  2606. value: function fn(implementation) {
  2607. var length = implementation ? implementation.length : 0;
  2608. var fn = this._makeComponent({ length: length, type: 'function' });
  2609. if (implementation) {
  2610. fn.mockImplementation(implementation);
  2611. }
  2612. return fn;
  2613. }
  2614. }, {
  2615. key: 'spyOn',
  2616. value: function spyOn(object, methodName, accessType) {
  2617. if (accessType) {
  2618. return this._spyOnProperty(object, methodName, accessType);
  2619. }
  2620. if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) !== 'object' && typeof object !== 'function') {
  2621. throw new Error('Cannot spyOn on a primitive value; ' + this._typeOf(object) + ' given');
  2622. }
  2623. var original = object[methodName];
  2624. if (!this.isMockFunction(original)) {
  2625. if (typeof original !== 'function') {
  2626. throw new Error('Cannot spy the ' + methodName + ' property because it is not a function; ' + this._typeOf(original) + ' given instead');
  2627. }
  2628. object[methodName] = this._makeComponent({ type: 'function' }, function () {
  2629. object[methodName] = original;
  2630. });
  2631. object[methodName].mockImplementation(function () {
  2632. return original.apply(this, arguments);
  2633. });
  2634. }
  2635. return object[methodName];
  2636. }
  2637. }, {
  2638. key: '_spyOnProperty',
  2639. value: function _spyOnProperty(obj, propertyName) {
  2640. var accessType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'get';
  2641. if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' && typeof obj !== 'function') {
  2642. throw new Error('Cannot spyOn on a primitive value; ' + this._typeOf(obj) + ' given');
  2643. }
  2644. if (!obj) {
  2645. throw new Error('spyOn could not find an object to spy upon for ' + propertyName + '');
  2646. }
  2647. if (!propertyName) {
  2648. throw new Error('No property name supplied');
  2649. }
  2650. var descriptor = _Object$getOwnPropertyDescriptor(obj, propertyName);
  2651. var proto = _Object$getPrototypeOf(obj);
  2652. while (!descriptor && proto !== null) {
  2653. descriptor = _Object$getOwnPropertyDescriptor(proto, propertyName);
  2654. proto = _Object$getPrototypeOf(proto);
  2655. }
  2656. if (!descriptor) {
  2657. throw new Error(propertyName + ' property does not exist');
  2658. }
  2659. if (!descriptor.configurable) {
  2660. throw new Error(propertyName + ' is not declared configurable');
  2661. }
  2662. if (!descriptor[accessType]) {
  2663. throw new Error('Property ' + propertyName + ' does not have access type ' + accessType);
  2664. }
  2665. var original = descriptor[accessType];
  2666. if (!this.isMockFunction(original)) {
  2667. if (typeof original !== 'function') {
  2668. throw new Error('Cannot spy the ' + propertyName + ' property because it is not a function; ' + this._typeOf(original) + ' given instead');
  2669. }
  2670. descriptor[accessType] = this._makeComponent({ type: 'function' }, function () {
  2671. // $FlowFixMe
  2672. descriptor[accessType] = original;
  2673. // $FlowFixMe
  2674. _Object$defineProperty(obj, propertyName, descriptor);
  2675. });
  2676. descriptor[accessType].mockImplementation(function () {
  2677. return original.apply(this, arguments);
  2678. });
  2679. }
  2680. _Object$defineProperty(obj, propertyName, descriptor);
  2681. return descriptor[accessType];
  2682. }
  2683. }, {
  2684. key: 'clearAllMocks',
  2685. value: function clearAllMocks() {
  2686. this._mockState = new _WeakMap();
  2687. }
  2688. }, {
  2689. key: 'resetAllMocks',
  2690. value: function resetAllMocks() {
  2691. this._mockConfigRegistry = new _WeakMap();
  2692. this._mockState = new _WeakMap();
  2693. }
  2694. }, {
  2695. key: 'restoreAllMocks',
  2696. value: function restoreAllMocks() {
  2697. this._spyState.forEach(function (restore) {
  2698. return restore();
  2699. });
  2700. this._spyState = new _Set();
  2701. }
  2702. }, {
  2703. key: '_typeOf',
  2704. value: function _typeOf(value) {
  2705. return value == null ? '' + value : typeof value === 'undefined' ? 'undefined' : _typeof(value);
  2706. }
  2707. }]);
  2708. return ModuleMockerClass;
  2709. }();
  2710. module.exports = new ModuleMockerClass(commonjsGlobal);
  2711. });
  2712. var index = unwrapExports(src);
  2713. return index;
  2714. })));