deepcopy.legacy.js 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411
  1. /*!
  2. * @license deepcopy.js Copyright(c) 2013 sasa+1
  3. * https://github.com/sasaplus1/deepcopy.js
  4. * Released under the MIT license.
  5. *
  6. * type-detect
  7. * Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
  8. * MIT Licensed
  9. */
  10. (function (global, factory) {
  11. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  12. typeof define === 'function' && define.amd ? define(factory) :
  13. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.deepcopy = factory());
  14. }(this, (function () { 'use strict';
  15. function _typeof(obj) {
  16. "@babel/helpers - typeof";
  17. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  18. _typeof = function (obj) {
  19. return typeof obj;
  20. };
  21. } else {
  22. _typeof = function (obj) {
  23. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  24. };
  25. }
  26. return _typeof(obj);
  27. }
  28. function _toConsumableArray(arr) {
  29. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  30. }
  31. function _arrayWithoutHoles(arr) {
  32. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  33. }
  34. function _iterableToArray(iter) {
  35. if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
  36. }
  37. function _unsupportedIterableToArray(o, minLen) {
  38. if (!o) return;
  39. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  40. var n = Object.prototype.toString.call(o).slice(8, -1);
  41. if (n === "Object" && o.constructor) n = o.constructor.name;
  42. if (n === "Map" || n === "Set") return Array.from(o);
  43. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  44. }
  45. function _arrayLikeToArray(arr, len) {
  46. if (len == null || len > arr.length) len = arr.length;
  47. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  48. return arr2;
  49. }
  50. function _nonIterableSpread() {
  51. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  52. }
  53. function _createForOfIteratorHelper(o, allowArrayLike) {
  54. var it;
  55. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  56. if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  57. if (it) o = it;
  58. var i = 0;
  59. var F = function () {};
  60. return {
  61. s: F,
  62. n: function () {
  63. if (i >= o.length) return {
  64. done: true
  65. };
  66. return {
  67. done: false,
  68. value: o[i++]
  69. };
  70. },
  71. e: function (e) {
  72. throw e;
  73. },
  74. f: F
  75. };
  76. }
  77. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  78. }
  79. var normalCompletion = true,
  80. didErr = false,
  81. err;
  82. return {
  83. s: function () {
  84. it = o[Symbol.iterator]();
  85. },
  86. n: function () {
  87. var step = it.next();
  88. normalCompletion = step.done;
  89. return step;
  90. },
  91. e: function (e) {
  92. didErr = true;
  93. err = e;
  94. },
  95. f: function () {
  96. try {
  97. if (!normalCompletion && it.return != null) it.return();
  98. } finally {
  99. if (didErr) throw err;
  100. }
  101. }
  102. };
  103. }
  104. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  105. function createCommonjsModule(fn, module) {
  106. return module = { exports: {} }, fn(module, module.exports), module.exports;
  107. }
  108. var _global = createCommonjsModule(function (module) {
  109. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  110. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  111. ? window : typeof self != 'undefined' && self.Math == Math ? self
  112. // eslint-disable-next-line no-new-func
  113. : Function('return this')();
  114. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  115. });
  116. var hasOwnProperty = {}.hasOwnProperty;
  117. var _has = function (it, key) {
  118. return hasOwnProperty.call(it, key);
  119. };
  120. var _fails = function (exec) {
  121. try {
  122. return !!exec();
  123. } catch (e) {
  124. return true;
  125. }
  126. };
  127. // Thank's IE8 for his funny defineProperty
  128. var _descriptors = !_fails(function () {
  129. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  130. });
  131. var _core = createCommonjsModule(function (module) {
  132. var core = module.exports = { version: '2.6.11' };
  133. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  134. });
  135. var _core_1 = _core.version;
  136. var _isObject = function (it) {
  137. return typeof it === 'object' ? it !== null : typeof it === 'function';
  138. };
  139. var _anObject = function (it) {
  140. if (!_isObject(it)) throw TypeError(it + ' is not an object!');
  141. return it;
  142. };
  143. var document$1 = _global.document;
  144. // typeof document.createElement is 'object' in old IE
  145. var is = _isObject(document$1) && _isObject(document$1.createElement);
  146. var _domCreate = function (it) {
  147. return is ? document$1.createElement(it) : {};
  148. };
  149. var _ie8DomDefine = !_descriptors && !_fails(function () {
  150. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  151. });
  152. // 7.1.1 ToPrimitive(input [, PreferredType])
  153. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  154. // and the second argument - flag - preferred type is a string
  155. var _toPrimitive = function (it, S) {
  156. if (!_isObject(it)) return it;
  157. var fn, val;
  158. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  159. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
  160. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
  161. throw TypeError("Can't convert object to primitive value");
  162. };
  163. var dP = Object.defineProperty;
  164. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  165. _anObject(O);
  166. P = _toPrimitive(P, true);
  167. _anObject(Attributes);
  168. if (_ie8DomDefine) try {
  169. return dP(O, P, Attributes);
  170. } catch (e) { /* empty */ }
  171. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  172. if ('value' in Attributes) O[P] = Attributes.value;
  173. return O;
  174. };
  175. var _objectDp = {
  176. f: f
  177. };
  178. var _propertyDesc = function (bitmap, value) {
  179. return {
  180. enumerable: !(bitmap & 1),
  181. configurable: !(bitmap & 2),
  182. writable: !(bitmap & 4),
  183. value: value
  184. };
  185. };
  186. var _hide = _descriptors ? function (object, key, value) {
  187. return _objectDp.f(object, key, _propertyDesc(1, value));
  188. } : function (object, key, value) {
  189. object[key] = value;
  190. return object;
  191. };
  192. var id = 0;
  193. var px = Math.random();
  194. var _uid = function (key) {
  195. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  196. };
  197. var _library = false;
  198. var _shared = createCommonjsModule(function (module) {
  199. var SHARED = '__core-js_shared__';
  200. var store = _global[SHARED] || (_global[SHARED] = {});
  201. (module.exports = function (key, value) {
  202. return store[key] || (store[key] = value !== undefined ? value : {});
  203. })('versions', []).push({
  204. version: _core.version,
  205. mode: 'global',
  206. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  207. });
  208. });
  209. var _functionToString = _shared('native-function-to-string', Function.toString);
  210. var _redefine = createCommonjsModule(function (module) {
  211. var SRC = _uid('src');
  212. var TO_STRING = 'toString';
  213. var TPL = ('' + _functionToString).split(TO_STRING);
  214. _core.inspectSource = function (it) {
  215. return _functionToString.call(it);
  216. };
  217. (module.exports = function (O, key, val, safe) {
  218. var isFunction = typeof val == 'function';
  219. if (isFunction) _has(val, 'name') || _hide(val, 'name', key);
  220. if (O[key] === val) return;
  221. if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
  222. if (O === _global) {
  223. O[key] = val;
  224. } else if (!safe) {
  225. delete O[key];
  226. _hide(O, key, val);
  227. } else if (O[key]) {
  228. O[key] = val;
  229. } else {
  230. _hide(O, key, val);
  231. }
  232. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  233. })(Function.prototype, TO_STRING, function toString() {
  234. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  235. });
  236. });
  237. var _aFunction = function (it) {
  238. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  239. return it;
  240. };
  241. // optional / simple context binding
  242. var _ctx = function (fn, that, length) {
  243. _aFunction(fn);
  244. if (that === undefined) return fn;
  245. switch (length) {
  246. case 1: return function (a) {
  247. return fn.call(that, a);
  248. };
  249. case 2: return function (a, b) {
  250. return fn.call(that, a, b);
  251. };
  252. case 3: return function (a, b, c) {
  253. return fn.call(that, a, b, c);
  254. };
  255. }
  256. return function (/* ...args */) {
  257. return fn.apply(that, arguments);
  258. };
  259. };
  260. var PROTOTYPE = 'prototype';
  261. var $export = function (type, name, source) {
  262. var IS_FORCED = type & $export.F;
  263. var IS_GLOBAL = type & $export.G;
  264. var IS_STATIC = type & $export.S;
  265. var IS_PROTO = type & $export.P;
  266. var IS_BIND = type & $export.B;
  267. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  268. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  269. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  270. var key, own, out, exp;
  271. if (IS_GLOBAL) source = name;
  272. for (key in source) {
  273. // contains in native
  274. own = !IS_FORCED && target && target[key] !== undefined;
  275. // export native or passed
  276. out = (own ? target : source)[key];
  277. // bind timers to global for call from export context
  278. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  279. // extend global
  280. if (target) _redefine(target, key, out, type & $export.U);
  281. // export
  282. if (exports[key] != out) _hide(exports, key, exp);
  283. if (IS_PROTO && expProto[key] != out) expProto[key] = out;
  284. }
  285. };
  286. _global.core = _core;
  287. // type bitmap
  288. $export.F = 1; // forced
  289. $export.G = 2; // global
  290. $export.S = 4; // static
  291. $export.P = 8; // proto
  292. $export.B = 16; // bind
  293. $export.W = 32; // wrap
  294. $export.U = 64; // safe
  295. $export.R = 128; // real proto method for `library`
  296. var _export = $export;
  297. var _meta = createCommonjsModule(function (module) {
  298. var META = _uid('meta');
  299. var setDesc = _objectDp.f;
  300. var id = 0;
  301. var isExtensible = Object.isExtensible || function () {
  302. return true;
  303. };
  304. var FREEZE = !_fails(function () {
  305. return isExtensible(Object.preventExtensions({}));
  306. });
  307. var setMeta = function (it) {
  308. setDesc(it, META, { value: {
  309. i: 'O' + ++id, // object ID
  310. w: {} // weak collections IDs
  311. } });
  312. };
  313. var fastKey = function (it, create) {
  314. // return primitive with prefix
  315. if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  316. if (!_has(it, META)) {
  317. // can't set metadata to uncaught frozen object
  318. if (!isExtensible(it)) return 'F';
  319. // not necessary to add metadata
  320. if (!create) return 'E';
  321. // add missing metadata
  322. setMeta(it);
  323. // return object ID
  324. } return it[META].i;
  325. };
  326. var getWeak = function (it, create) {
  327. if (!_has(it, META)) {
  328. // can't set metadata to uncaught frozen object
  329. if (!isExtensible(it)) return true;
  330. // not necessary to add metadata
  331. if (!create) return false;
  332. // add missing metadata
  333. setMeta(it);
  334. // return hash weak collections IDs
  335. } return it[META].w;
  336. };
  337. // add metadata on freeze-family methods calling
  338. var onFreeze = function (it) {
  339. if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it);
  340. return it;
  341. };
  342. var meta = module.exports = {
  343. KEY: META,
  344. NEED: false,
  345. fastKey: fastKey,
  346. getWeak: getWeak,
  347. onFreeze: onFreeze
  348. };
  349. });
  350. var _meta_1 = _meta.KEY;
  351. var _meta_2 = _meta.NEED;
  352. var _meta_3 = _meta.fastKey;
  353. var _meta_4 = _meta.getWeak;
  354. var _meta_5 = _meta.onFreeze;
  355. var _wks = createCommonjsModule(function (module) {
  356. var store = _shared('wks');
  357. var Symbol = _global.Symbol;
  358. var USE_SYMBOL = typeof Symbol == 'function';
  359. var $exports = module.exports = function (name) {
  360. return store[name] || (store[name] =
  361. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
  362. };
  363. $exports.store = store;
  364. });
  365. var def = _objectDp.f;
  366. var TAG = _wks('toStringTag');
  367. var _setToStringTag = function (it, tag, stat) {
  368. if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
  369. };
  370. var f$1 = _wks;
  371. var _wksExt = {
  372. f: f$1
  373. };
  374. var defineProperty = _objectDp.f;
  375. var _wksDefine = function (name) {
  376. var $Symbol = _core.Symbol || (_core.Symbol = _global.Symbol || {});
  377. if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) });
  378. };
  379. var toString = {}.toString;
  380. var _cof = function (it) {
  381. return toString.call(it).slice(8, -1);
  382. };
  383. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  384. // eslint-disable-next-line no-prototype-builtins
  385. var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  386. return _cof(it) == 'String' ? it.split('') : Object(it);
  387. };
  388. // 7.2.1 RequireObjectCoercible(argument)
  389. var _defined = function (it) {
  390. if (it == undefined) throw TypeError("Can't call method on " + it);
  391. return it;
  392. };
  393. // to indexed object, toObject with fallback for non-array-like ES3 strings
  394. var _toIobject = function (it) {
  395. return _iobject(_defined(it));
  396. };
  397. // 7.1.4 ToInteger
  398. var ceil = Math.ceil;
  399. var floor = Math.floor;
  400. var _toInteger = function (it) {
  401. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  402. };
  403. // 7.1.15 ToLength
  404. var min = Math.min;
  405. var _toLength = function (it) {
  406. return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  407. };
  408. var max = Math.max;
  409. var min$1 = Math.min;
  410. var _toAbsoluteIndex = function (index, length) {
  411. index = _toInteger(index);
  412. return index < 0 ? max(index + length, 0) : min$1(index, length);
  413. };
  414. // false -> Array#indexOf
  415. // true -> Array#includes
  416. var _arrayIncludes = function (IS_INCLUDES) {
  417. return function ($this, el, fromIndex) {
  418. var O = _toIobject($this);
  419. var length = _toLength(O.length);
  420. var index = _toAbsoluteIndex(fromIndex, length);
  421. var value;
  422. // Array#includes uses SameValueZero equality algorithm
  423. // eslint-disable-next-line no-self-compare
  424. if (IS_INCLUDES && el != el) while (length > index) {
  425. value = O[index++];
  426. // eslint-disable-next-line no-self-compare
  427. if (value != value) return true;
  428. // Array#indexOf ignores holes, Array#includes - not
  429. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  430. if (O[index] === el) return IS_INCLUDES || index || 0;
  431. } return !IS_INCLUDES && -1;
  432. };
  433. };
  434. var shared = _shared('keys');
  435. var _sharedKey = function (key) {
  436. return shared[key] || (shared[key] = _uid(key));
  437. };
  438. var arrayIndexOf = _arrayIncludes(false);
  439. var IE_PROTO = _sharedKey('IE_PROTO');
  440. var _objectKeysInternal = function (object, names) {
  441. var O = _toIobject(object);
  442. var i = 0;
  443. var result = [];
  444. var key;
  445. for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
  446. // Don't enum bug & hidden keys
  447. while (names.length > i) if (_has(O, key = names[i++])) {
  448. ~arrayIndexOf(result, key) || result.push(key);
  449. }
  450. return result;
  451. };
  452. // IE 8- don't enum bug keys
  453. var _enumBugKeys = (
  454. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  455. ).split(',');
  456. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  457. var _objectKeys = Object.keys || function keys(O) {
  458. return _objectKeysInternal(O, _enumBugKeys);
  459. };
  460. var f$2 = Object.getOwnPropertySymbols;
  461. var _objectGops = {
  462. f: f$2
  463. };
  464. var f$3 = {}.propertyIsEnumerable;
  465. var _objectPie = {
  466. f: f$3
  467. };
  468. // all enumerable object keys, includes symbols
  469. var _enumKeys = function (it) {
  470. var result = _objectKeys(it);
  471. var getSymbols = _objectGops.f;
  472. if (getSymbols) {
  473. var symbols = getSymbols(it);
  474. var isEnum = _objectPie.f;
  475. var i = 0;
  476. var key;
  477. while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
  478. } return result;
  479. };
  480. // 7.2.2 IsArray(argument)
  481. var _isArray = Array.isArray || function isArray(arg) {
  482. return _cof(arg) == 'Array';
  483. };
  484. // 7.1.13 ToObject(argument)
  485. var _toObject = function (it) {
  486. return Object(_defined(it));
  487. };
  488. var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  489. _anObject(O);
  490. var keys = _objectKeys(Properties);
  491. var length = keys.length;
  492. var i = 0;
  493. var P;
  494. while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
  495. return O;
  496. };
  497. var document$2 = _global.document;
  498. var _html = document$2 && document$2.documentElement;
  499. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  500. var IE_PROTO$1 = _sharedKey('IE_PROTO');
  501. var Empty = function () { /* empty */ };
  502. var PROTOTYPE$1 = 'prototype';
  503. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  504. var createDict = function () {
  505. // Thrash, waste and sodomy: IE GC bug
  506. var iframe = _domCreate('iframe');
  507. var i = _enumBugKeys.length;
  508. var lt = '<';
  509. var gt = '>';
  510. var iframeDocument;
  511. iframe.style.display = 'none';
  512. _html.appendChild(iframe);
  513. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  514. // createDict = iframe.contentWindow.Object;
  515. // html.removeChild(iframe);
  516. iframeDocument = iframe.contentWindow.document;
  517. iframeDocument.open();
  518. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  519. iframeDocument.close();
  520. createDict = iframeDocument.F;
  521. while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
  522. return createDict();
  523. };
  524. var _objectCreate = Object.create || function create(O, Properties) {
  525. var result;
  526. if (O !== null) {
  527. Empty[PROTOTYPE$1] = _anObject(O);
  528. result = new Empty();
  529. Empty[PROTOTYPE$1] = null;
  530. // add "__proto__" for Object.getPrototypeOf polyfill
  531. result[IE_PROTO$1] = O;
  532. } else result = createDict();
  533. return Properties === undefined ? result : _objectDps(result, Properties);
  534. };
  535. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  536. var hiddenKeys = _enumBugKeys.concat('length', 'prototype');
  537. var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  538. return _objectKeysInternal(O, hiddenKeys);
  539. };
  540. var _objectGopn = {
  541. f: f$4
  542. };
  543. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  544. var gOPN = _objectGopn.f;
  545. var toString$1 = {}.toString;
  546. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  547. ? Object.getOwnPropertyNames(window) : [];
  548. var getWindowNames = function (it) {
  549. try {
  550. return gOPN(it);
  551. } catch (e) {
  552. return windowNames.slice();
  553. }
  554. };
  555. var f$5 = function getOwnPropertyNames(it) {
  556. return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it));
  557. };
  558. var _objectGopnExt = {
  559. f: f$5
  560. };
  561. var gOPD = Object.getOwnPropertyDescriptor;
  562. var f$6 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) {
  563. O = _toIobject(O);
  564. P = _toPrimitive(P, true);
  565. if (_ie8DomDefine) try {
  566. return gOPD(O, P);
  567. } catch (e) { /* empty */ }
  568. if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]);
  569. };
  570. var _objectGopd = {
  571. f: f$6
  572. };
  573. // ECMAScript 6 symbols shim
  574. var META = _meta.KEY;
  575. var gOPD$1 = _objectGopd.f;
  576. var dP$1 = _objectDp.f;
  577. var gOPN$1 = _objectGopnExt.f;
  578. var $Symbol = _global.Symbol;
  579. var $JSON = _global.JSON;
  580. var _stringify = $JSON && $JSON.stringify;
  581. var PROTOTYPE$2 = 'prototype';
  582. var HIDDEN = _wks('_hidden');
  583. var TO_PRIMITIVE = _wks('toPrimitive');
  584. var isEnum = {}.propertyIsEnumerable;
  585. var SymbolRegistry = _shared('symbol-registry');
  586. var AllSymbols = _shared('symbols');
  587. var OPSymbols = _shared('op-symbols');
  588. var ObjectProto = Object[PROTOTYPE$2];
  589. var USE_NATIVE = typeof $Symbol == 'function' && !!_objectGops.f;
  590. var QObject = _global.QObject;
  591. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  592. var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild;
  593. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  594. var setSymbolDesc = _descriptors && _fails(function () {
  595. return _objectCreate(dP$1({}, 'a', {
  596. get: function () { return dP$1(this, 'a', { value: 7 }).a; }
  597. })).a != 7;
  598. }) ? function (it, key, D) {
  599. var protoDesc = gOPD$1(ObjectProto, key);
  600. if (protoDesc) delete ObjectProto[key];
  601. dP$1(it, key, D);
  602. if (protoDesc && it !== ObjectProto) dP$1(ObjectProto, key, protoDesc);
  603. } : dP$1;
  604. var wrap = function (tag) {
  605. var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]);
  606. sym._k = tag;
  607. return sym;
  608. };
  609. var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
  610. return typeof it == 'symbol';
  611. } : function (it) {
  612. return it instanceof $Symbol;
  613. };
  614. var $defineProperty = function defineProperty(it, key, D) {
  615. if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
  616. _anObject(it);
  617. key = _toPrimitive(key, true);
  618. _anObject(D);
  619. if (_has(AllSymbols, key)) {
  620. if (!D.enumerable) {
  621. if (!_has(it, HIDDEN)) dP$1(it, HIDDEN, _propertyDesc(1, {}));
  622. it[HIDDEN][key] = true;
  623. } else {
  624. if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
  625. D = _objectCreate(D, { enumerable: _propertyDesc(0, false) });
  626. } return setSymbolDesc(it, key, D);
  627. } return dP$1(it, key, D);
  628. };
  629. var $defineProperties = function defineProperties(it, P) {
  630. _anObject(it);
  631. var keys = _enumKeys(P = _toIobject(P));
  632. var i = 0;
  633. var l = keys.length;
  634. var key;
  635. while (l > i) $defineProperty(it, key = keys[i++], P[key]);
  636. return it;
  637. };
  638. var $create = function create(it, P) {
  639. return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P);
  640. };
  641. var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  642. var E = isEnum.call(this, key = _toPrimitive(key, true));
  643. if (this === ObjectProto && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false;
  644. return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
  645. };
  646. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  647. it = _toIobject(it);
  648. key = _toPrimitive(key, true);
  649. if (it === ObjectProto && _has(AllSymbols, key) && !_has(OPSymbols, key)) return;
  650. var D = gOPD$1(it, key);
  651. if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  652. return D;
  653. };
  654. var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  655. var names = gOPN$1(_toIobject(it));
  656. var result = [];
  657. var i = 0;
  658. var key;
  659. while (names.length > i) {
  660. if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  661. } return result;
  662. };
  663. var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  664. var IS_OP = it === ObjectProto;
  665. var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it));
  666. var result = [];
  667. var i = 0;
  668. var key;
  669. while (names.length > i) {
  670. if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
  671. } return result;
  672. };
  673. // 19.4.1.1 Symbol([description])
  674. if (!USE_NATIVE) {
  675. $Symbol = function Symbol() {
  676. if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
  677. var tag = _uid(arguments.length > 0 ? arguments[0] : undefined);
  678. var $set = function (value) {
  679. if (this === ObjectProto) $set.call(OPSymbols, value);
  680. if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  681. setSymbolDesc(this, tag, _propertyDesc(1, value));
  682. };
  683. if (_descriptors && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
  684. return wrap(tag);
  685. };
  686. _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() {
  687. return this._k;
  688. });
  689. _objectGopd.f = $getOwnPropertyDescriptor;
  690. _objectDp.f = $defineProperty;
  691. _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames;
  692. _objectPie.f = $propertyIsEnumerable;
  693. _objectGops.f = $getOwnPropertySymbols;
  694. if (_descriptors && !_library) {
  695. _redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  696. }
  697. _wksExt.f = function (name) {
  698. return wrap(_wks(name));
  699. };
  700. }
  701. _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Symbol: $Symbol });
  702. for (var es6Symbols = (
  703. // 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
  704. 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
  705. ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]);
  706. for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]);
  707. _export(_export.S + _export.F * !USE_NATIVE, 'Symbol', {
  708. // 19.4.2.1 Symbol.for(key)
  709. 'for': function (key) {
  710. return _has(SymbolRegistry, key += '')
  711. ? SymbolRegistry[key]
  712. : SymbolRegistry[key] = $Symbol(key);
  713. },
  714. // 19.4.2.5 Symbol.keyFor(sym)
  715. keyFor: function keyFor(sym) {
  716. if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
  717. for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
  718. },
  719. useSetter: function () { setter = true; },
  720. useSimple: function () { setter = false; }
  721. });
  722. _export(_export.S + _export.F * !USE_NATIVE, 'Object', {
  723. // 19.1.2.2 Object.create(O [, Properties])
  724. create: $create,
  725. // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  726. defineProperty: $defineProperty,
  727. // 19.1.2.3 Object.defineProperties(O, Properties)
  728. defineProperties: $defineProperties,
  729. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  730. getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  731. // 19.1.2.7 Object.getOwnPropertyNames(O)
  732. getOwnPropertyNames: $getOwnPropertyNames,
  733. // 19.1.2.8 Object.getOwnPropertySymbols(O)
  734. getOwnPropertySymbols: $getOwnPropertySymbols
  735. });
  736. // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
  737. // https://bugs.chromium.org/p/v8/issues/detail?id=3443
  738. var FAILS_ON_PRIMITIVES = _fails(function () { _objectGops.f(1); });
  739. _export(_export.S + _export.F * FAILS_ON_PRIMITIVES, 'Object', {
  740. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  741. return _objectGops.f(_toObject(it));
  742. }
  743. });
  744. // 24.3.2 JSON.stringify(value [, replacer [, space]])
  745. $JSON && _export(_export.S + _export.F * (!USE_NATIVE || _fails(function () {
  746. var S = $Symbol();
  747. // MS Edge converts symbol values to JSON as {}
  748. // WebKit converts symbol values to JSON as null
  749. // V8 throws on boxed symbols
  750. return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
  751. })), 'JSON', {
  752. stringify: function stringify(it) {
  753. var args = [it];
  754. var i = 1;
  755. var replacer, $replacer;
  756. while (arguments.length > i) args.push(arguments[i++]);
  757. $replacer = replacer = args[1];
  758. if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  759. if (!_isArray(replacer)) replacer = function (key, value) {
  760. if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
  761. if (!isSymbol(value)) return value;
  762. };
  763. args[1] = replacer;
  764. return _stringify.apply($JSON, args);
  765. }
  766. });
  767. // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
  768. $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf);
  769. // 19.4.3.5 Symbol.prototype[@@toStringTag]
  770. _setToStringTag($Symbol, 'Symbol');
  771. // 20.2.1.9 Math[@@toStringTag]
  772. _setToStringTag(Math, 'Math', true);
  773. // 24.3.3 JSON[@@toStringTag]
  774. _setToStringTag(_global.JSON, 'JSON', true);
  775. // most Object methods by ES6 should accept primitives
  776. var _objectSap = function (KEY, exec) {
  777. var fn = (_core.Object || {})[KEY] || Object[KEY];
  778. var exp = {};
  779. exp[KEY] = exec(fn);
  780. _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
  781. };
  782. // 19.1.2.14 Object.keys(O)
  783. _objectSap('keys', function () {
  784. return function keys(it) {
  785. return _objectKeys(_toObject(it));
  786. };
  787. });
  788. var _redefineAll = function (target, src, safe) {
  789. for (var key in src) _redefine(target, key, src[key], safe);
  790. return target;
  791. };
  792. var _anInstance = function (it, Constructor, name, forbiddenField) {
  793. if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
  794. throw TypeError(name + ': incorrect invocation!');
  795. } return it;
  796. };
  797. // call something on iterator step with safe closing on error
  798. var _iterCall = function (iterator, fn, value, entries) {
  799. try {
  800. return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
  801. // 7.4.6 IteratorClose(iterator, completion)
  802. } catch (e) {
  803. var ret = iterator['return'];
  804. if (ret !== undefined) _anObject(ret.call(iterator));
  805. throw e;
  806. }
  807. };
  808. var _iterators = {};
  809. // check on default Array iterator
  810. var ITERATOR = _wks('iterator');
  811. var ArrayProto = Array.prototype;
  812. var _isArrayIter = function (it) {
  813. return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR] === it);
  814. };
  815. // getting tag from 19.1.3.6 Object.prototype.toString()
  816. var TAG$1 = _wks('toStringTag');
  817. // ES3 wrong here
  818. var ARG = _cof(function () { return arguments; }()) == 'Arguments';
  819. // fallback for IE11 Script Access Denied error
  820. var tryGet = function (it, key) {
  821. try {
  822. return it[key];
  823. } catch (e) { /* empty */ }
  824. };
  825. var _classof = function (it) {
  826. var O, T, B;
  827. return it === undefined ? 'Undefined' : it === null ? 'Null'
  828. // @@toStringTag case
  829. : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
  830. // builtinTag case
  831. : ARG ? _cof(O)
  832. // ES3 arguments fallback
  833. : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  834. };
  835. var ITERATOR$1 = _wks('iterator');
  836. var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
  837. if (it != undefined) return it[ITERATOR$1]
  838. || it['@@iterator']
  839. || _iterators[_classof(it)];
  840. };
  841. var _forOf = createCommonjsModule(function (module) {
  842. var BREAK = {};
  843. var RETURN = {};
  844. var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  845. var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable);
  846. var f = _ctx(fn, that, entries ? 2 : 1);
  847. var index = 0;
  848. var length, step, iterator, result;
  849. if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  850. // fast case for arrays with default iterator
  851. if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {
  852. result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  853. if (result === BREAK || result === RETURN) return result;
  854. } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
  855. result = _iterCall(iterator, f, step.value, entries);
  856. if (result === BREAK || result === RETURN) return result;
  857. }
  858. };
  859. exports.BREAK = BREAK;
  860. exports.RETURN = RETURN;
  861. });
  862. var SPECIES = _wks('species');
  863. var _arraySpeciesConstructor = function (original) {
  864. var C;
  865. if (_isArray(original)) {
  866. C = original.constructor;
  867. // cross-realm fallback
  868. if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined;
  869. if (_isObject(C)) {
  870. C = C[SPECIES];
  871. if (C === null) C = undefined;
  872. }
  873. } return C === undefined ? Array : C;
  874. };
  875. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  876. var _arraySpeciesCreate = function (original, length) {
  877. return new (_arraySpeciesConstructor(original))(length);
  878. };
  879. // 0 -> Array#forEach
  880. // 1 -> Array#map
  881. // 2 -> Array#filter
  882. // 3 -> Array#some
  883. // 4 -> Array#every
  884. // 5 -> Array#find
  885. // 6 -> Array#findIndex
  886. var _arrayMethods = function (TYPE, $create) {
  887. var IS_MAP = TYPE == 1;
  888. var IS_FILTER = TYPE == 2;
  889. var IS_SOME = TYPE == 3;
  890. var IS_EVERY = TYPE == 4;
  891. var IS_FIND_INDEX = TYPE == 6;
  892. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  893. var create = $create || _arraySpeciesCreate;
  894. return function ($this, callbackfn, that) {
  895. var O = _toObject($this);
  896. var self = _iobject(O);
  897. var f = _ctx(callbackfn, that, 3);
  898. var length = _toLength(self.length);
  899. var index = 0;
  900. var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  901. var val, res;
  902. for (;length > index; index++) if (NO_HOLES || index in self) {
  903. val = self[index];
  904. res = f(val, index, O);
  905. if (TYPE) {
  906. if (IS_MAP) result[index] = res; // map
  907. else if (res) switch (TYPE) {
  908. case 3: return true; // some
  909. case 5: return val; // find
  910. case 6: return index; // findIndex
  911. case 2: result.push(val); // filter
  912. } else if (IS_EVERY) return false; // every
  913. }
  914. }
  915. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  916. };
  917. };
  918. var _validateCollection = function (it, TYPE) {
  919. if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  920. return it;
  921. };
  922. var getWeak = _meta.getWeak;
  923. var arrayFind = _arrayMethods(5);
  924. var arrayFindIndex = _arrayMethods(6);
  925. var id$1 = 0;
  926. // fallback for uncaught frozen keys
  927. var uncaughtFrozenStore = function (that) {
  928. return that._l || (that._l = new UncaughtFrozenStore());
  929. };
  930. var UncaughtFrozenStore = function () {
  931. this.a = [];
  932. };
  933. var findUncaughtFrozen = function (store, key) {
  934. return arrayFind(store.a, function (it) {
  935. return it[0] === key;
  936. });
  937. };
  938. UncaughtFrozenStore.prototype = {
  939. get: function (key) {
  940. var entry = findUncaughtFrozen(this, key);
  941. if (entry) return entry[1];
  942. },
  943. has: function (key) {
  944. return !!findUncaughtFrozen(this, key);
  945. },
  946. set: function (key, value) {
  947. var entry = findUncaughtFrozen(this, key);
  948. if (entry) entry[1] = value;
  949. else this.a.push([key, value]);
  950. },
  951. 'delete': function (key) {
  952. var index = arrayFindIndex(this.a, function (it) {
  953. return it[0] === key;
  954. });
  955. if (~index) this.a.splice(index, 1);
  956. return !!~index;
  957. }
  958. };
  959. var _collectionWeak = {
  960. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  961. var C = wrapper(function (that, iterable) {
  962. _anInstance(that, C, NAME, '_i');
  963. that._t = NAME; // collection type
  964. that._i = id$1++; // collection id
  965. that._l = undefined; // leak store for uncaught frozen objects
  966. if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
  967. });
  968. _redefineAll(C.prototype, {
  969. // 23.3.3.2 WeakMap.prototype.delete(key)
  970. // 23.4.3.3 WeakSet.prototype.delete(value)
  971. 'delete': function (key) {
  972. if (!_isObject(key)) return false;
  973. var data = getWeak(key);
  974. if (data === true) return uncaughtFrozenStore(_validateCollection(this, NAME))['delete'](key);
  975. return data && _has(data, this._i) && delete data[this._i];
  976. },
  977. // 23.3.3.4 WeakMap.prototype.has(key)
  978. // 23.4.3.4 WeakSet.prototype.has(value)
  979. has: function has(key) {
  980. if (!_isObject(key)) return false;
  981. var data = getWeak(key);
  982. if (data === true) return uncaughtFrozenStore(_validateCollection(this, NAME)).has(key);
  983. return data && _has(data, this._i);
  984. }
  985. });
  986. return C;
  987. },
  988. def: function (that, key, value) {
  989. var data = getWeak(_anObject(key), true);
  990. if (data === true) uncaughtFrozenStore(that).set(key, value);
  991. else data[that._i] = value;
  992. return that;
  993. },
  994. ufstore: uncaughtFrozenStore
  995. };
  996. var ITERATOR$2 = _wks('iterator');
  997. var SAFE_CLOSING = false;
  998. try {
  999. var riter = [7][ITERATOR$2]();
  1000. riter['return'] = function () { SAFE_CLOSING = true; };
  1001. // eslint-disable-next-line no-throw-literal
  1002. Array.from(riter, function () { throw 2; });
  1003. } catch (e) { /* empty */ }
  1004. var _iterDetect = function (exec, skipClosing) {
  1005. if (!skipClosing && !SAFE_CLOSING) return false;
  1006. var safe = false;
  1007. try {
  1008. var arr = [7];
  1009. var iter = arr[ITERATOR$2]();
  1010. iter.next = function () { return { done: safe = true }; };
  1011. arr[ITERATOR$2] = function () { return iter; };
  1012. exec(arr);
  1013. } catch (e) { /* empty */ }
  1014. return safe;
  1015. };
  1016. // Works with __proto__ only. Old v8 can't work with null proto objects.
  1017. /* eslint-disable no-proto */
  1018. var check = function (O, proto) {
  1019. _anObject(O);
  1020. if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
  1021. };
  1022. var _setProto = {
  1023. set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
  1024. function (test, buggy, set) {
  1025. try {
  1026. set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2);
  1027. set(test, []);
  1028. buggy = !(test instanceof Array);
  1029. } catch (e) { buggy = true; }
  1030. return function setPrototypeOf(O, proto) {
  1031. check(O, proto);
  1032. if (buggy) O.__proto__ = proto;
  1033. else set(O, proto);
  1034. return O;
  1035. };
  1036. }({}, false) : undefined),
  1037. check: check
  1038. };
  1039. var setPrototypeOf = _setProto.set;
  1040. var _inheritIfRequired = function (that, target, C) {
  1041. var S = target.constructor;
  1042. var P;
  1043. if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && _isObject(P) && setPrototypeOf) {
  1044. setPrototypeOf(that, P);
  1045. } return that;
  1046. };
  1047. var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  1048. var Base = _global[NAME];
  1049. var C = Base;
  1050. var ADDER = IS_MAP ? 'set' : 'add';
  1051. var proto = C && C.prototype;
  1052. var O = {};
  1053. var fixMethod = function (KEY) {
  1054. var fn = proto[KEY];
  1055. _redefine(proto, KEY,
  1056. KEY == 'delete' ? function (a) {
  1057. return IS_WEAK && !_isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
  1058. } : KEY == 'has' ? function has(a) {
  1059. return IS_WEAK && !_isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
  1060. } : KEY == 'get' ? function get(a) {
  1061. return IS_WEAK && !_isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
  1062. } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; }
  1063. : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; }
  1064. );
  1065. };
  1066. if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () {
  1067. new C().entries().next();
  1068. }))) {
  1069. // create collection constructor
  1070. C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
  1071. _redefineAll(C.prototype, methods);
  1072. _meta.NEED = true;
  1073. } else {
  1074. var instance = new C();
  1075. // early implementations not supports chaining
  1076. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  1077. // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
  1078. var THROWS_ON_PRIMITIVES = _fails(function () { instance.has(1); });
  1079. // most early implementations doesn't supports iterables, most modern - not close it correctly
  1080. var ACCEPT_ITERABLES = _iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new
  1081. // for early implementations -0 and +0 not the same
  1082. var BUGGY_ZERO = !IS_WEAK && _fails(function () {
  1083. // V8 ~ Chromium 42- fails only with 5+ elements
  1084. var $instance = new C();
  1085. var index = 5;
  1086. while (index--) $instance[ADDER](index, index);
  1087. return !$instance.has(-0);
  1088. });
  1089. if (!ACCEPT_ITERABLES) {
  1090. C = wrapper(function (target, iterable) {
  1091. _anInstance(target, C, NAME);
  1092. var that = _inheritIfRequired(new Base(), target, C);
  1093. if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
  1094. return that;
  1095. });
  1096. C.prototype = proto;
  1097. proto.constructor = C;
  1098. }
  1099. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  1100. fixMethod('delete');
  1101. fixMethod('has');
  1102. IS_MAP && fixMethod('get');
  1103. }
  1104. if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
  1105. // weak collections should not contains .clear method
  1106. if (IS_WEAK && proto.clear) delete proto.clear;
  1107. }
  1108. _setToStringTag(C, NAME);
  1109. O[NAME] = C;
  1110. _export(_export.G + _export.W + _export.F * (C != Base), O);
  1111. if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
  1112. return C;
  1113. };
  1114. var WEAK_SET = 'WeakSet';
  1115. // 23.4 WeakSet Objects
  1116. _collection(WEAK_SET, function (get) {
  1117. return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1118. }, {
  1119. // 23.4.3.1 WeakSet.prototype.add(value)
  1120. add: function add(value) {
  1121. return _collectionWeak.def(_validateCollection(this, WEAK_SET), value, true);
  1122. }
  1123. }, _collectionWeak, false, true);
  1124. // 22.1.3.31 Array.prototype[@@unscopables]
  1125. var UNSCOPABLES = _wks('unscopables');
  1126. var ArrayProto$1 = Array.prototype;
  1127. if (ArrayProto$1[UNSCOPABLES] == undefined) _hide(ArrayProto$1, UNSCOPABLES, {});
  1128. var _addToUnscopables = function (key) {
  1129. ArrayProto$1[UNSCOPABLES][key] = true;
  1130. };
  1131. var _iterStep = function (done, value) {
  1132. return { value: value, done: !!done };
  1133. };
  1134. var IteratorPrototype = {};
  1135. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  1136. _hide(IteratorPrototype, _wks('iterator'), function () { return this; });
  1137. var _iterCreate = function (Constructor, NAME, next) {
  1138. Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) });
  1139. _setToStringTag(Constructor, NAME + ' Iterator');
  1140. };
  1141. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  1142. var IE_PROTO$2 = _sharedKey('IE_PROTO');
  1143. var ObjectProto$1 = Object.prototype;
  1144. var _objectGpo = Object.getPrototypeOf || function (O) {
  1145. O = _toObject(O);
  1146. if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
  1147. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  1148. return O.constructor.prototype;
  1149. } return O instanceof Object ? ObjectProto$1 : null;
  1150. };
  1151. var ITERATOR$3 = _wks('iterator');
  1152. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  1153. var FF_ITERATOR = '@@iterator';
  1154. var KEYS = 'keys';
  1155. var VALUES = 'values';
  1156. var returnThis = function () { return this; };
  1157. var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  1158. _iterCreate(Constructor, NAME, next);
  1159. var getMethod = function (kind) {
  1160. if (!BUGGY && kind in proto) return proto[kind];
  1161. switch (kind) {
  1162. case KEYS: return function keys() { return new Constructor(this, kind); };
  1163. case VALUES: return function values() { return new Constructor(this, kind); };
  1164. } return function entries() { return new Constructor(this, kind); };
  1165. };
  1166. var TAG = NAME + ' Iterator';
  1167. var DEF_VALUES = DEFAULT == VALUES;
  1168. var VALUES_BUG = false;
  1169. var proto = Base.prototype;
  1170. var $native = proto[ITERATOR$3] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  1171. var $default = $native || getMethod(DEFAULT);
  1172. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  1173. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  1174. var methods, key, IteratorPrototype;
  1175. // Fix native
  1176. if ($anyNative) {
  1177. IteratorPrototype = _objectGpo($anyNative.call(new Base()));
  1178. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  1179. // Set @@toStringTag to native iterators
  1180. _setToStringTag(IteratorPrototype, TAG, true);
  1181. // fix for some old engines
  1182. if ( typeof IteratorPrototype[ITERATOR$3] != 'function') _hide(IteratorPrototype, ITERATOR$3, returnThis);
  1183. }
  1184. }
  1185. // fix Array#{values, @@iterator}.name in V8 / FF
  1186. if (DEF_VALUES && $native && $native.name !== VALUES) {
  1187. VALUES_BUG = true;
  1188. $default = function values() { return $native.call(this); };
  1189. }
  1190. // Define iterator
  1191. if ( (BUGGY || VALUES_BUG || !proto[ITERATOR$3])) {
  1192. _hide(proto, ITERATOR$3, $default);
  1193. }
  1194. // Plug for library
  1195. _iterators[NAME] = $default;
  1196. _iterators[TAG] = returnThis;
  1197. if (DEFAULT) {
  1198. methods = {
  1199. values: DEF_VALUES ? $default : getMethod(VALUES),
  1200. keys: IS_SET ? $default : getMethod(KEYS),
  1201. entries: $entries
  1202. };
  1203. if (FORCED) for (key in methods) {
  1204. if (!(key in proto)) _redefine(proto, key, methods[key]);
  1205. } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
  1206. }
  1207. return methods;
  1208. };
  1209. // 22.1.3.4 Array.prototype.entries()
  1210. // 22.1.3.13 Array.prototype.keys()
  1211. // 22.1.3.29 Array.prototype.values()
  1212. // 22.1.3.30 Array.prototype[@@iterator]()
  1213. var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) {
  1214. this._t = _toIobject(iterated); // target
  1215. this._i = 0; // next index
  1216. this._k = kind; // kind
  1217. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  1218. }, function () {
  1219. var O = this._t;
  1220. var kind = this._k;
  1221. var index = this._i++;
  1222. if (!O || index >= O.length) {
  1223. this._t = undefined;
  1224. return _iterStep(1);
  1225. }
  1226. if (kind == 'keys') return _iterStep(0, index);
  1227. if (kind == 'values') return _iterStep(0, O[index]);
  1228. return _iterStep(0, [index, O[index]]);
  1229. }, 'values');
  1230. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  1231. _iterators.Arguments = _iterators.Array;
  1232. _addToUnscopables('keys');
  1233. _addToUnscopables('values');
  1234. _addToUnscopables('entries');
  1235. var ITERATOR$4 = _wks('iterator');
  1236. var TO_STRING_TAG = _wks('toStringTag');
  1237. var ArrayValues = _iterators.Array;
  1238. var DOMIterables = {
  1239. CSSRuleList: true, // TODO: Not spec compliant, should be false.
  1240. CSSStyleDeclaration: false,
  1241. CSSValueList: false,
  1242. ClientRectList: false,
  1243. DOMRectList: false,
  1244. DOMStringList: false,
  1245. DOMTokenList: true,
  1246. DataTransferItemList: false,
  1247. FileList: false,
  1248. HTMLAllCollection: false,
  1249. HTMLCollection: false,
  1250. HTMLFormElement: false,
  1251. HTMLSelectElement: false,
  1252. MediaList: true, // TODO: Not spec compliant, should be false.
  1253. MimeTypeArray: false,
  1254. NamedNodeMap: false,
  1255. NodeList: true,
  1256. PaintRequestList: false,
  1257. Plugin: false,
  1258. PluginArray: false,
  1259. SVGLengthList: false,
  1260. SVGNumberList: false,
  1261. SVGPathSegList: false,
  1262. SVGPointList: false,
  1263. SVGStringList: false,
  1264. SVGTransformList: false,
  1265. SourceBufferList: false,
  1266. StyleSheetList: true, // TODO: Not spec compliant, should be false.
  1267. TextTrackCueList: false,
  1268. TextTrackList: false,
  1269. TouchList: false
  1270. };
  1271. for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; i++) {
  1272. var NAME = collections[i];
  1273. var explicit = DOMIterables[NAME];
  1274. var Collection = _global[NAME];
  1275. var proto = Collection && Collection.prototype;
  1276. var key;
  1277. if (proto) {
  1278. if (!proto[ITERATOR$4]) _hide(proto, ITERATOR$4, ArrayValues);
  1279. if (!proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME);
  1280. _iterators[NAME] = ArrayValues;
  1281. if (explicit) for (key in es6_array_iterator) if (!proto[key]) _redefine(proto, key, es6_array_iterator[key], true);
  1282. }
  1283. }
  1284. // 19.1.3.6 Object.prototype.toString()
  1285. var test = {};
  1286. test[_wks('toStringTag')] = 'z';
  1287. if (test + '' != '[object z]') {
  1288. _redefine(Object.prototype, 'toString', function toString() {
  1289. return '[object ' + _classof(this) + ']';
  1290. }, true);
  1291. }
  1292. // true -> String#at
  1293. // false -> String#codePointAt
  1294. var _stringAt = function (TO_STRING) {
  1295. return function (that, pos) {
  1296. var s = String(_defined(that));
  1297. var i = _toInteger(pos);
  1298. var l = s.length;
  1299. var a, b;
  1300. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  1301. a = s.charCodeAt(i);
  1302. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  1303. ? TO_STRING ? s.charAt(i) : a
  1304. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  1305. };
  1306. };
  1307. var $at = _stringAt(true);
  1308. // 21.1.3.27 String.prototype[@@iterator]()
  1309. _iterDefine(String, 'String', function (iterated) {
  1310. this._t = String(iterated); // target
  1311. this._i = 0; // next index
  1312. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  1313. }, function () {
  1314. var O = this._t;
  1315. var index = this._i;
  1316. var point;
  1317. if (index >= O.length) return { value: undefined, done: true };
  1318. point = $at(O, index);
  1319. this._i += point.length;
  1320. return { value: point, done: false };
  1321. });
  1322. // 19.1.2.1 Object.assign(target, source, ...)
  1323. var $assign = Object.assign;
  1324. // should work with symbols and should have deterministic property order (V8 bug)
  1325. var _objectAssign = !$assign || _fails(function () {
  1326. var A = {};
  1327. var B = {};
  1328. // eslint-disable-next-line no-undef
  1329. var S = Symbol();
  1330. var K = 'abcdefghijklmnopqrst';
  1331. A[S] = 7;
  1332. K.split('').forEach(function (k) { B[k] = k; });
  1333. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  1334. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  1335. var T = _toObject(target);
  1336. var aLen = arguments.length;
  1337. var index = 1;
  1338. var getSymbols = _objectGops.f;
  1339. var isEnum = _objectPie.f;
  1340. while (aLen > index) {
  1341. var S = _iobject(arguments[index++]);
  1342. var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
  1343. var length = keys.length;
  1344. var j = 0;
  1345. var key;
  1346. while (length > j) {
  1347. key = keys[j++];
  1348. if (!_descriptors || isEnum.call(S, key)) T[key] = S[key];
  1349. }
  1350. } return T;
  1351. } : $assign;
  1352. var es6_weakMap = createCommonjsModule(function (module) {
  1353. var each = _arrayMethods(0);
  1354. var NATIVE_WEAK_MAP = _validateCollection;
  1355. var IS_IE11 = !_global.ActiveXObject && 'ActiveXObject' in _global;
  1356. var WEAK_MAP = 'WeakMap';
  1357. var getWeak = _meta.getWeak;
  1358. var isExtensible = Object.isExtensible;
  1359. var uncaughtFrozenStore = _collectionWeak.ufstore;
  1360. var InternalMap;
  1361. var wrapper = function (get) {
  1362. return function WeakMap() {
  1363. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  1364. };
  1365. };
  1366. var methods = {
  1367. // 23.3.3.3 WeakMap.prototype.get(key)
  1368. get: function get(key) {
  1369. if (_isObject(key)) {
  1370. var data = getWeak(key);
  1371. if (data === true) return uncaughtFrozenStore(_validateCollection(this, WEAK_MAP)).get(key);
  1372. return data ? data[this._i] : undefined;
  1373. }
  1374. },
  1375. // 23.3.3.5 WeakMap.prototype.set(key, value)
  1376. set: function set(key, value) {
  1377. return _collectionWeak.def(_validateCollection(this, WEAK_MAP), key, value);
  1378. }
  1379. };
  1380. // 23.3 WeakMap Objects
  1381. var $WeakMap = module.exports = _collection(WEAK_MAP, wrapper, methods, _collectionWeak, true, true);
  1382. // IE11 WeakMap frozen keys fix
  1383. if (NATIVE_WEAK_MAP && IS_IE11) {
  1384. InternalMap = _collectionWeak.getConstructor(wrapper, WEAK_MAP);
  1385. _objectAssign(InternalMap.prototype, methods);
  1386. _meta.NEED = true;
  1387. each(['delete', 'has', 'get', 'set'], function (key) {
  1388. var proto = $WeakMap.prototype;
  1389. var method = proto[key];
  1390. _redefine(proto, key, function (a, b) {
  1391. // store frozen objects on internal weakmap shim
  1392. if (_isObject(a) && !isExtensible(a)) {
  1393. if (!this._f) this._f = new InternalMap();
  1394. var result = this._f[key](a, b);
  1395. return key == 'set' ? this : result;
  1396. // store all the rest on native weakmap
  1397. } return method.call(this, a, b);
  1398. });
  1399. });
  1400. }
  1401. });
  1402. // 21.2.5.3 get RegExp.prototype.flags
  1403. var _flags = function () {
  1404. var that = _anObject(this);
  1405. var result = '';
  1406. if (that.global) result += 'g';
  1407. if (that.ignoreCase) result += 'i';
  1408. if (that.multiline) result += 'm';
  1409. if (that.unicode) result += 'u';
  1410. if (that.sticky) result += 'y';
  1411. return result;
  1412. };
  1413. // 21.2.5.3 get RegExp.prototype.flags()
  1414. if (_descriptors && /./g.flags != 'g') _objectDp.f(RegExp.prototype, 'flags', {
  1415. configurable: true,
  1416. get: _flags
  1417. });
  1418. var TO_STRING = 'toString';
  1419. var $toString = /./[TO_STRING];
  1420. var define = function (fn) {
  1421. _redefine(RegExp.prototype, TO_STRING, fn, true);
  1422. };
  1423. // 21.2.5.14 RegExp.prototype.toString()
  1424. if (_fails(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {
  1425. define(function toString() {
  1426. var R = _anObject(this);
  1427. return '/'.concat(R.source, '/',
  1428. 'flags' in R ? R.flags : !_descriptors && R instanceof RegExp ? _flags.call(R) : undefined);
  1429. });
  1430. // FF44- RegExp#toString has a wrong name
  1431. } else if ($toString.name != TO_STRING) {
  1432. define(function toString() {
  1433. return $toString.call(this);
  1434. });
  1435. }
  1436. // 7.2.8 IsRegExp(argument)
  1437. var MATCH = _wks('match');
  1438. var _isRegexp = function (it) {
  1439. var isRegExp;
  1440. return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp');
  1441. };
  1442. var SPECIES$1 = _wks('species');
  1443. var _setSpecies = function (KEY) {
  1444. var C = _global[KEY];
  1445. if (_descriptors && C && !C[SPECIES$1]) _objectDp.f(C, SPECIES$1, {
  1446. configurable: true,
  1447. get: function () { return this; }
  1448. });
  1449. };
  1450. var dP$2 = _objectDp.f;
  1451. var gOPN$2 = _objectGopn.f;
  1452. var $RegExp = _global.RegExp;
  1453. var Base = $RegExp;
  1454. var proto$1 = $RegExp.prototype;
  1455. var re1 = /a/g;
  1456. var re2 = /a/g;
  1457. // "new" creates a new object, old webkit buggy here
  1458. var CORRECT_NEW = new $RegExp(re1) !== re1;
  1459. if (_descriptors && (!CORRECT_NEW || _fails(function () {
  1460. re2[_wks('match')] = false;
  1461. // RegExp constructor can alter flags and IsRegExp works correct with @@match
  1462. return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
  1463. }))) {
  1464. $RegExp = function RegExp(p, f) {
  1465. var tiRE = this instanceof $RegExp;
  1466. var piRE = _isRegexp(p);
  1467. var fiU = f === undefined;
  1468. return !tiRE && piRE && p.constructor === $RegExp && fiU ? p
  1469. : _inheritIfRequired(CORRECT_NEW
  1470. ? new Base(piRE && !fiU ? p.source : p, f)
  1471. : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? _flags.call(p) : f)
  1472. , tiRE ? this : proto$1, $RegExp);
  1473. };
  1474. var proxy = function (key) {
  1475. key in $RegExp || dP$2($RegExp, key, {
  1476. configurable: true,
  1477. get: function () { return Base[key]; },
  1478. set: function (it) { Base[key] = it; }
  1479. });
  1480. };
  1481. for (var keys = gOPN$2(Base), i$1 = 0; keys.length > i$1;) proxy(keys[i$1++]);
  1482. proto$1.constructor = $RegExp;
  1483. $RegExp.prototype = proto$1;
  1484. _redefine(_global, 'RegExp', $RegExp);
  1485. }
  1486. _setSpecies('RegExp');
  1487. var dP$3 = _objectDp.f;
  1488. var fastKey = _meta.fastKey;
  1489. var SIZE = _descriptors ? '_s' : 'size';
  1490. var getEntry = function (that, key) {
  1491. // fast case
  1492. var index = fastKey(key);
  1493. var entry;
  1494. if (index !== 'F') return that._i[index];
  1495. // frozen object case
  1496. for (entry = that._f; entry; entry = entry.n) {
  1497. if (entry.k == key) return entry;
  1498. }
  1499. };
  1500. var _collectionStrong = {
  1501. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  1502. var C = wrapper(function (that, iterable) {
  1503. _anInstance(that, C, NAME, '_i');
  1504. that._t = NAME; // collection type
  1505. that._i = _objectCreate(null); // index
  1506. that._f = undefined; // first entry
  1507. that._l = undefined; // last entry
  1508. that[SIZE] = 0; // size
  1509. if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
  1510. });
  1511. _redefineAll(C.prototype, {
  1512. // 23.1.3.1 Map.prototype.clear()
  1513. // 23.2.3.2 Set.prototype.clear()
  1514. clear: function clear() {
  1515. for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
  1516. entry.r = true;
  1517. if (entry.p) entry.p = entry.p.n = undefined;
  1518. delete data[entry.i];
  1519. }
  1520. that._f = that._l = undefined;
  1521. that[SIZE] = 0;
  1522. },
  1523. // 23.1.3.3 Map.prototype.delete(key)
  1524. // 23.2.3.4 Set.prototype.delete(value)
  1525. 'delete': function (key) {
  1526. var that = _validateCollection(this, NAME);
  1527. var entry = getEntry(that, key);
  1528. if (entry) {
  1529. var next = entry.n;
  1530. var prev = entry.p;
  1531. delete that._i[entry.i];
  1532. entry.r = true;
  1533. if (prev) prev.n = next;
  1534. if (next) next.p = prev;
  1535. if (that._f == entry) that._f = next;
  1536. if (that._l == entry) that._l = prev;
  1537. that[SIZE]--;
  1538. } return !!entry;
  1539. },
  1540. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  1541. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  1542. forEach: function forEach(callbackfn /* , that = undefined */) {
  1543. _validateCollection(this, NAME);
  1544. var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  1545. var entry;
  1546. while (entry = entry ? entry.n : this._f) {
  1547. f(entry.v, entry.k, this);
  1548. // revert to the last existing entry
  1549. while (entry && entry.r) entry = entry.p;
  1550. }
  1551. },
  1552. // 23.1.3.7 Map.prototype.has(key)
  1553. // 23.2.3.7 Set.prototype.has(value)
  1554. has: function has(key) {
  1555. return !!getEntry(_validateCollection(this, NAME), key);
  1556. }
  1557. });
  1558. if (_descriptors) dP$3(C.prototype, 'size', {
  1559. get: function () {
  1560. return _validateCollection(this, NAME)[SIZE];
  1561. }
  1562. });
  1563. return C;
  1564. },
  1565. def: function (that, key, value) {
  1566. var entry = getEntry(that, key);
  1567. var prev, index;
  1568. // change existing entry
  1569. if (entry) {
  1570. entry.v = value;
  1571. // create new entry
  1572. } else {
  1573. that._l = entry = {
  1574. i: index = fastKey(key, true), // <- index
  1575. k: key, // <- key
  1576. v: value, // <- value
  1577. p: prev = that._l, // <- previous entry
  1578. n: undefined, // <- next entry
  1579. r: false // <- removed
  1580. };
  1581. if (!that._f) that._f = entry;
  1582. if (prev) prev.n = entry;
  1583. that[SIZE]++;
  1584. // add to index
  1585. if (index !== 'F') that._i[index] = entry;
  1586. } return that;
  1587. },
  1588. getEntry: getEntry,
  1589. setStrong: function (C, NAME, IS_MAP) {
  1590. // add .keys, .values, .entries, [@@iterator]
  1591. // 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
  1592. _iterDefine(C, NAME, function (iterated, kind) {
  1593. this._t = _validateCollection(iterated, NAME); // target
  1594. this._k = kind; // kind
  1595. this._l = undefined; // previous
  1596. }, function () {
  1597. var that = this;
  1598. var kind = that._k;
  1599. var entry = that._l;
  1600. // revert to the last existing entry
  1601. while (entry && entry.r) entry = entry.p;
  1602. // get next entry
  1603. if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
  1604. // or finish the iteration
  1605. that._t = undefined;
  1606. return _iterStep(1);
  1607. }
  1608. // return step by kind
  1609. if (kind == 'keys') return _iterStep(0, entry.k);
  1610. if (kind == 'values') return _iterStep(0, entry.v);
  1611. return _iterStep(0, [entry.k, entry.v]);
  1612. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  1613. // add [@@species], 23.1.2.2, 23.2.2.2
  1614. _setSpecies(NAME);
  1615. }
  1616. };
  1617. var SET = 'Set';
  1618. // 23.2 Set Objects
  1619. var es6_set = _collection(SET, function (get) {
  1620. return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1621. }, {
  1622. // 23.2.3.1 Set.prototype.add(value)
  1623. add: function add(value) {
  1624. return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value);
  1625. }
  1626. }, _collectionStrong);
  1627. var MAP = 'Map';
  1628. // 23.1 Map Objects
  1629. var es6_map = _collection(MAP, function (get) {
  1630. return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1631. }, {
  1632. // 23.1.3.6 Map.prototype.get(key)
  1633. get: function get(key) {
  1634. var entry = _collectionStrong.getEntry(_validateCollection(this, MAP), key);
  1635. return entry && entry.v;
  1636. },
  1637. // 23.1.3.9 Map.prototype.set(key, value)
  1638. set: function set(key, value) {
  1639. return _collectionStrong.def(_validateCollection(this, MAP), key === 0 ? 0 : key, value);
  1640. }
  1641. }, _collectionStrong, true);
  1642. _wksDefine('asyncIterator');
  1643. // 7.3.20 SpeciesConstructor(O, defaultConstructor)
  1644. var SPECIES$2 = _wks('species');
  1645. var _speciesConstructor = function (O, D) {
  1646. var C = _anObject(O).constructor;
  1647. var S;
  1648. return C === undefined || (S = _anObject(C)[SPECIES$2]) == undefined ? D : _aFunction(S);
  1649. };
  1650. // fast apply, http://jsperf.lnkit.com/fast-apply/5
  1651. var _invoke = function (fn, args, that) {
  1652. var un = that === undefined;
  1653. switch (args.length) {
  1654. case 0: return un ? fn()
  1655. : fn.call(that);
  1656. case 1: return un ? fn(args[0])
  1657. : fn.call(that, args[0]);
  1658. case 2: return un ? fn(args[0], args[1])
  1659. : fn.call(that, args[0], args[1]);
  1660. case 3: return un ? fn(args[0], args[1], args[2])
  1661. : fn.call(that, args[0], args[1], args[2]);
  1662. case 4: return un ? fn(args[0], args[1], args[2], args[3])
  1663. : fn.call(that, args[0], args[1], args[2], args[3]);
  1664. } return fn.apply(that, args);
  1665. };
  1666. var process = _global.process;
  1667. var setTask = _global.setImmediate;
  1668. var clearTask = _global.clearImmediate;
  1669. var MessageChannel = _global.MessageChannel;
  1670. var Dispatch = _global.Dispatch;
  1671. var counter = 0;
  1672. var queue = {};
  1673. var ONREADYSTATECHANGE = 'onreadystatechange';
  1674. var defer, channel, port;
  1675. var run = function () {
  1676. var id = +this;
  1677. // eslint-disable-next-line no-prototype-builtins
  1678. if (queue.hasOwnProperty(id)) {
  1679. var fn = queue[id];
  1680. delete queue[id];
  1681. fn();
  1682. }
  1683. };
  1684. var listener = function (event) {
  1685. run.call(event.data);
  1686. };
  1687. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  1688. if (!setTask || !clearTask) {
  1689. setTask = function setImmediate(fn) {
  1690. var args = [];
  1691. var i = 1;
  1692. while (arguments.length > i) args.push(arguments[i++]);
  1693. queue[++counter] = function () {
  1694. // eslint-disable-next-line no-new-func
  1695. _invoke(typeof fn == 'function' ? fn : Function(fn), args);
  1696. };
  1697. defer(counter);
  1698. return counter;
  1699. };
  1700. clearTask = function clearImmediate(id) {
  1701. delete queue[id];
  1702. };
  1703. // Node.js 0.8-
  1704. if (_cof(process) == 'process') {
  1705. defer = function (id) {
  1706. process.nextTick(_ctx(run, id, 1));
  1707. };
  1708. // Sphere (JS game engine) Dispatch API
  1709. } else if (Dispatch && Dispatch.now) {
  1710. defer = function (id) {
  1711. Dispatch.now(_ctx(run, id, 1));
  1712. };
  1713. // Browsers with MessageChannel, includes WebWorkers
  1714. } else if (MessageChannel) {
  1715. channel = new MessageChannel();
  1716. port = channel.port2;
  1717. channel.port1.onmessage = listener;
  1718. defer = _ctx(port.postMessage, port, 1);
  1719. // Browsers with postMessage, skip WebWorkers
  1720. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  1721. } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) {
  1722. defer = function (id) {
  1723. _global.postMessage(id + '', '*');
  1724. };
  1725. _global.addEventListener('message', listener, false);
  1726. // IE8-
  1727. } else if (ONREADYSTATECHANGE in _domCreate('script')) {
  1728. defer = function (id) {
  1729. _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () {
  1730. _html.removeChild(this);
  1731. run.call(id);
  1732. };
  1733. };
  1734. // Rest old browsers
  1735. } else {
  1736. defer = function (id) {
  1737. setTimeout(_ctx(run, id, 1), 0);
  1738. };
  1739. }
  1740. }
  1741. var _task = {
  1742. set: setTask,
  1743. clear: clearTask
  1744. };
  1745. var macrotask = _task.set;
  1746. var Observer = _global.MutationObserver || _global.WebKitMutationObserver;
  1747. var process$1 = _global.process;
  1748. var Promise$1 = _global.Promise;
  1749. var isNode = _cof(process$1) == 'process';
  1750. var _microtask = function () {
  1751. var head, last, notify;
  1752. var flush = function () {
  1753. var parent, fn;
  1754. if (isNode && (parent = process$1.domain)) parent.exit();
  1755. while (head) {
  1756. fn = head.fn;
  1757. head = head.next;
  1758. try {
  1759. fn();
  1760. } catch (e) {
  1761. if (head) notify();
  1762. else last = undefined;
  1763. throw e;
  1764. }
  1765. } last = undefined;
  1766. if (parent) parent.enter();
  1767. };
  1768. // Node.js
  1769. if (isNode) {
  1770. notify = function () {
  1771. process$1.nextTick(flush);
  1772. };
  1773. // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
  1774. } else if (Observer && !(_global.navigator && _global.navigator.standalone)) {
  1775. var toggle = true;
  1776. var node = document.createTextNode('');
  1777. new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
  1778. notify = function () {
  1779. node.data = toggle = !toggle;
  1780. };
  1781. // environments with maybe non-completely correct, but existent Promise
  1782. } else if (Promise$1 && Promise$1.resolve) {
  1783. // Promise.resolve without an argument throws an error in LG WebOS 2
  1784. var promise = Promise$1.resolve(undefined);
  1785. notify = function () {
  1786. promise.then(flush);
  1787. };
  1788. // for other environments - macrotask based on:
  1789. // - setImmediate
  1790. // - MessageChannel
  1791. // - window.postMessag
  1792. // - onreadystatechange
  1793. // - setTimeout
  1794. } else {
  1795. notify = function () {
  1796. // strange IE + webpack dev server bug - use .call(global)
  1797. macrotask.call(_global, flush);
  1798. };
  1799. }
  1800. return function (fn) {
  1801. var task = { fn: fn, next: undefined };
  1802. if (last) last.next = task;
  1803. if (!head) {
  1804. head = task;
  1805. notify();
  1806. } last = task;
  1807. };
  1808. };
  1809. // 25.4.1.5 NewPromiseCapability(C)
  1810. function PromiseCapability(C) {
  1811. var resolve, reject;
  1812. this.promise = new C(function ($$resolve, $$reject) {
  1813. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  1814. resolve = $$resolve;
  1815. reject = $$reject;
  1816. });
  1817. this.resolve = _aFunction(resolve);
  1818. this.reject = _aFunction(reject);
  1819. }
  1820. var f$7 = function (C) {
  1821. return new PromiseCapability(C);
  1822. };
  1823. var _newPromiseCapability = {
  1824. f: f$7
  1825. };
  1826. var _perform = function (exec) {
  1827. try {
  1828. return { e: false, v: exec() };
  1829. } catch (e) {
  1830. return { e: true, v: e };
  1831. }
  1832. };
  1833. var navigator = _global.navigator;
  1834. var _userAgent = navigator && navigator.userAgent || '';
  1835. var _promiseResolve = function (C, x) {
  1836. _anObject(C);
  1837. if (_isObject(x) && x.constructor === C) return x;
  1838. var promiseCapability = _newPromiseCapability.f(C);
  1839. var resolve = promiseCapability.resolve;
  1840. resolve(x);
  1841. return promiseCapability.promise;
  1842. };
  1843. var task = _task.set;
  1844. var microtask = _microtask();
  1845. var PROMISE = 'Promise';
  1846. var TypeError$1 = _global.TypeError;
  1847. var process$2 = _global.process;
  1848. var versions = process$2 && process$2.versions;
  1849. var v8 = versions && versions.v8 || '';
  1850. var $Promise = _global[PROMISE];
  1851. var isNode$1 = _classof(process$2) == 'process';
  1852. var empty = function () { /* empty */ };
  1853. var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
  1854. var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f;
  1855. var USE_NATIVE$1 = !!function () {
  1856. try {
  1857. // correct subclassing with @@species support
  1858. var promise = $Promise.resolve(1);
  1859. var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) {
  1860. exec(empty, empty);
  1861. };
  1862. // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  1863. return (isNode$1 || typeof PromiseRejectionEvent == 'function')
  1864. && promise.then(empty) instanceof FakePromise
  1865. // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  1866. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  1867. // we can't detect it synchronously, so just check versions
  1868. && v8.indexOf('6.6') !== 0
  1869. && _userAgent.indexOf('Chrome/66') === -1;
  1870. } catch (e) { /* empty */ }
  1871. }();
  1872. // helpers
  1873. var isThenable = function (it) {
  1874. var then;
  1875. return _isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  1876. };
  1877. var notify = function (promise, isReject) {
  1878. if (promise._n) return;
  1879. promise._n = true;
  1880. var chain = promise._c;
  1881. microtask(function () {
  1882. var value = promise._v;
  1883. var ok = promise._s == 1;
  1884. var i = 0;
  1885. var run = function (reaction) {
  1886. var handler = ok ? reaction.ok : reaction.fail;
  1887. var resolve = reaction.resolve;
  1888. var reject = reaction.reject;
  1889. var domain = reaction.domain;
  1890. var result, then, exited;
  1891. try {
  1892. if (handler) {
  1893. if (!ok) {
  1894. if (promise._h == 2) onHandleUnhandled(promise);
  1895. promise._h = 1;
  1896. }
  1897. if (handler === true) result = value;
  1898. else {
  1899. if (domain) domain.enter();
  1900. result = handler(value); // may throw
  1901. if (domain) {
  1902. domain.exit();
  1903. exited = true;
  1904. }
  1905. }
  1906. if (result === reaction.promise) {
  1907. reject(TypeError$1('Promise-chain cycle'));
  1908. } else if (then = isThenable(result)) {
  1909. then.call(result, resolve, reject);
  1910. } else resolve(result);
  1911. } else reject(value);
  1912. } catch (e) {
  1913. if (domain && !exited) domain.exit();
  1914. reject(e);
  1915. }
  1916. };
  1917. while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
  1918. promise._c = [];
  1919. promise._n = false;
  1920. if (isReject && !promise._h) onUnhandled(promise);
  1921. });
  1922. };
  1923. var onUnhandled = function (promise) {
  1924. task.call(_global, function () {
  1925. var value = promise._v;
  1926. var unhandled = isUnhandled(promise);
  1927. var result, handler, console;
  1928. if (unhandled) {
  1929. result = _perform(function () {
  1930. if (isNode$1) {
  1931. process$2.emit('unhandledRejection', value, promise);
  1932. } else if (handler = _global.onunhandledrejection) {
  1933. handler({ promise: promise, reason: value });
  1934. } else if ((console = _global.console) && console.error) {
  1935. console.error('Unhandled promise rejection', value);
  1936. }
  1937. });
  1938. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  1939. promise._h = isNode$1 || isUnhandled(promise) ? 2 : 1;
  1940. } promise._a = undefined;
  1941. if (unhandled && result.e) throw result.v;
  1942. });
  1943. };
  1944. var isUnhandled = function (promise) {
  1945. return promise._h !== 1 && (promise._a || promise._c).length === 0;
  1946. };
  1947. var onHandleUnhandled = function (promise) {
  1948. task.call(_global, function () {
  1949. var handler;
  1950. if (isNode$1) {
  1951. process$2.emit('rejectionHandled', promise);
  1952. } else if (handler = _global.onrejectionhandled) {
  1953. handler({ promise: promise, reason: promise._v });
  1954. }
  1955. });
  1956. };
  1957. var $reject = function (value) {
  1958. var promise = this;
  1959. if (promise._d) return;
  1960. promise._d = true;
  1961. promise = promise._w || promise; // unwrap
  1962. promise._v = value;
  1963. promise._s = 2;
  1964. if (!promise._a) promise._a = promise._c.slice();
  1965. notify(promise, true);
  1966. };
  1967. var $resolve = function (value) {
  1968. var promise = this;
  1969. var then;
  1970. if (promise._d) return;
  1971. promise._d = true;
  1972. promise = promise._w || promise; // unwrap
  1973. try {
  1974. if (promise === value) throw TypeError$1("Promise can't be resolved itself");
  1975. if (then = isThenable(value)) {
  1976. microtask(function () {
  1977. var wrapper = { _w: promise, _d: false }; // wrap
  1978. try {
  1979. then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1));
  1980. } catch (e) {
  1981. $reject.call(wrapper, e);
  1982. }
  1983. });
  1984. } else {
  1985. promise._v = value;
  1986. promise._s = 1;
  1987. notify(promise, false);
  1988. }
  1989. } catch (e) {
  1990. $reject.call({ _w: promise, _d: false }, e); // wrap
  1991. }
  1992. };
  1993. // constructor polyfill
  1994. if (!USE_NATIVE$1) {
  1995. // 25.4.3.1 Promise(executor)
  1996. $Promise = function Promise(executor) {
  1997. _anInstance(this, $Promise, PROMISE, '_h');
  1998. _aFunction(executor);
  1999. Internal.call(this);
  2000. try {
  2001. executor(_ctx($resolve, this, 1), _ctx($reject, this, 1));
  2002. } catch (err) {
  2003. $reject.call(this, err);
  2004. }
  2005. };
  2006. // eslint-disable-next-line no-unused-vars
  2007. Internal = function Promise(executor) {
  2008. this._c = []; // <- awaiting reactions
  2009. this._a = undefined; // <- checked in isUnhandled reactions
  2010. this._s = 0; // <- state
  2011. this._d = false; // <- done
  2012. this._v = undefined; // <- value
  2013. this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
  2014. this._n = false; // <- notify
  2015. };
  2016. Internal.prototype = _redefineAll($Promise.prototype, {
  2017. // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
  2018. then: function then(onFulfilled, onRejected) {
  2019. var reaction = newPromiseCapability(_speciesConstructor(this, $Promise));
  2020. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  2021. reaction.fail = typeof onRejected == 'function' && onRejected;
  2022. reaction.domain = isNode$1 ? process$2.domain : undefined;
  2023. this._c.push(reaction);
  2024. if (this._a) this._a.push(reaction);
  2025. if (this._s) notify(this, false);
  2026. return reaction.promise;
  2027. },
  2028. // 25.4.5.1 Promise.prototype.catch(onRejected)
  2029. 'catch': function (onRejected) {
  2030. return this.then(undefined, onRejected);
  2031. }
  2032. });
  2033. OwnPromiseCapability = function () {
  2034. var promise = new Internal();
  2035. this.promise = promise;
  2036. this.resolve = _ctx($resolve, promise, 1);
  2037. this.reject = _ctx($reject, promise, 1);
  2038. };
  2039. _newPromiseCapability.f = newPromiseCapability = function (C) {
  2040. return C === $Promise || C === Wrapper
  2041. ? new OwnPromiseCapability(C)
  2042. : newGenericPromiseCapability(C);
  2043. };
  2044. }
  2045. _export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Promise: $Promise });
  2046. _setToStringTag($Promise, PROMISE);
  2047. _setSpecies(PROMISE);
  2048. Wrapper = _core[PROMISE];
  2049. // statics
  2050. _export(_export.S + _export.F * !USE_NATIVE$1, PROMISE, {
  2051. // 25.4.4.5 Promise.reject(r)
  2052. reject: function reject(r) {
  2053. var capability = newPromiseCapability(this);
  2054. var $$reject = capability.reject;
  2055. $$reject(r);
  2056. return capability.promise;
  2057. }
  2058. });
  2059. _export(_export.S + _export.F * ( !USE_NATIVE$1), PROMISE, {
  2060. // 25.4.4.6 Promise.resolve(x)
  2061. resolve: function resolve(x) {
  2062. return _promiseResolve( this, x);
  2063. }
  2064. });
  2065. _export(_export.S + _export.F * !(USE_NATIVE$1 && _iterDetect(function (iter) {
  2066. $Promise.all(iter)['catch'](empty);
  2067. })), PROMISE, {
  2068. // 25.4.4.1 Promise.all(iterable)
  2069. all: function all(iterable) {
  2070. var C = this;
  2071. var capability = newPromiseCapability(C);
  2072. var resolve = capability.resolve;
  2073. var reject = capability.reject;
  2074. var result = _perform(function () {
  2075. var values = [];
  2076. var index = 0;
  2077. var remaining = 1;
  2078. _forOf(iterable, false, function (promise) {
  2079. var $index = index++;
  2080. var alreadyCalled = false;
  2081. values.push(undefined);
  2082. remaining++;
  2083. C.resolve(promise).then(function (value) {
  2084. if (alreadyCalled) return;
  2085. alreadyCalled = true;
  2086. values[$index] = value;
  2087. --remaining || resolve(values);
  2088. }, reject);
  2089. });
  2090. --remaining || resolve(values);
  2091. });
  2092. if (result.e) reject(result.v);
  2093. return capability.promise;
  2094. },
  2095. // 25.4.4.4 Promise.race(iterable)
  2096. race: function race(iterable) {
  2097. var C = this;
  2098. var capability = newPromiseCapability(C);
  2099. var reject = capability.reject;
  2100. var result = _perform(function () {
  2101. _forOf(iterable, false, function (promise) {
  2102. C.resolve(promise).then(capability.resolve, reject);
  2103. });
  2104. });
  2105. if (result.e) reject(result.v);
  2106. return capability.promise;
  2107. }
  2108. });
  2109. var typeDetect = createCommonjsModule(function (module, exports) {
  2110. (function (global, factory) {
  2111. module.exports = factory() ;
  2112. })(commonjsGlobal, function () {
  2113. /* !
  2114. * type-detect
  2115. * Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
  2116. * MIT Licensed
  2117. */
  2118. var promiseExists = typeof Promise === 'function';
  2119. /* eslint-disable no-undef */
  2120. var globalObject = (typeof self === "undefined" ? "undefined" : _typeof(self)) === 'object' ? self : commonjsGlobal; // eslint-disable-line id-blacklist
  2121. var symbolExists = typeof Symbol !== 'undefined';
  2122. var mapExists = typeof Map !== 'undefined';
  2123. var setExists = typeof Set !== 'undefined';
  2124. var weakMapExists = typeof WeakMap !== 'undefined';
  2125. var weakSetExists = typeof WeakSet !== 'undefined';
  2126. var dataViewExists = typeof DataView !== 'undefined';
  2127. var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
  2128. var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
  2129. var setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
  2130. var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
  2131. var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
  2132. var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
  2133. var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
  2134. var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
  2135. var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
  2136. var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
  2137. var toStringLeftSliceLength = 8;
  2138. var toStringRightSliceLength = -1;
  2139. /**
  2140. * ### typeOf (obj)
  2141. *
  2142. * Uses `Object.prototype.toString` to determine the type of an object,
  2143. * normalising behaviour across engine versions & well optimised.
  2144. *
  2145. * @param {Mixed} object
  2146. * @return {String} object type
  2147. * @api public
  2148. */
  2149. function typeDetect(obj) {
  2150. /* ! Speed optimisation
  2151. * Pre:
  2152. * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled)
  2153. * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled)
  2154. * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled)
  2155. * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled)
  2156. * function x 2,556,769 ops/sec ±1.73% (77 runs sampled)
  2157. * Post:
  2158. * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled)
  2159. * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled)
  2160. * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled)
  2161. * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled)
  2162. * function x 31,296,870 ops/sec ±0.96% (83 runs sampled)
  2163. */
  2164. var typeofObj = _typeof(obj);
  2165. if (typeofObj !== 'object') {
  2166. return typeofObj;
  2167. }
  2168. /* ! Speed optimisation
  2169. * Pre:
  2170. * null x 28,645,765 ops/sec ±1.17% (82 runs sampled)
  2171. * Post:
  2172. * null x 36,428,962 ops/sec ±1.37% (84 runs sampled)
  2173. */
  2174. if (obj === null) {
  2175. return 'null';
  2176. }
  2177. /* ! Spec Conformance
  2178. * Test: `Object.prototype.toString.call(window)``
  2179. * - Node === "[object global]"
  2180. * - Chrome === "[object global]"
  2181. * - Firefox === "[object Window]"
  2182. * - PhantomJS === "[object Window]"
  2183. * - Safari === "[object Window]"
  2184. * - IE 11 === "[object Window]"
  2185. * - IE Edge === "[object Window]"
  2186. * Test: `Object.prototype.toString.call(this)``
  2187. * - Chrome Worker === "[object global]"
  2188. * - Firefox Worker === "[object DedicatedWorkerGlobalScope]"
  2189. * - Safari Worker === "[object DedicatedWorkerGlobalScope]"
  2190. * - IE 11 Worker === "[object WorkerGlobalScope]"
  2191. * - IE Edge Worker === "[object WorkerGlobalScope]"
  2192. */
  2193. if (obj === globalObject) {
  2194. return 'global';
  2195. }
  2196. /* ! Speed optimisation
  2197. * Pre:
  2198. * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled)
  2199. * Post:
  2200. * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)
  2201. */
  2202. if (Array.isArray(obj) && (symbolToStringTagExists === false || !(Symbol.toStringTag in obj))) {
  2203. return 'Array';
  2204. } // Not caching existence of `window` and related properties due to potential
  2205. // for `window` to be unset before tests in quasi-browser environments.
  2206. if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && window !== null) {
  2207. /* ! Spec Conformance
  2208. * (https://html.spec.whatwg.org/multipage/browsers.html#location)
  2209. * WhatWG HTML$7.7.3 - The `Location` interface
  2210. * Test: `Object.prototype.toString.call(window.location)``
  2211. * - IE <=11 === "[object Object]"
  2212. * - IE Edge <=13 === "[object Object]"
  2213. */
  2214. if (_typeof(window.location) === 'object' && obj === window.location) {
  2215. return 'Location';
  2216. }
  2217. /* ! Spec Conformance
  2218. * (https://html.spec.whatwg.org/#document)
  2219. * WhatWG HTML$3.1.1 - The `Document` object
  2220. * Note: Most browsers currently adher to the W3C DOM Level 2 spec
  2221. * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268)
  2222. * which suggests that browsers should use HTMLTableCellElement for
  2223. * both TD and TH elements. WhatWG separates these.
  2224. * WhatWG HTML states:
  2225. * > For historical reasons, Window objects must also have a
  2226. * > writable, configurable, non-enumerable property named
  2227. * > HTMLDocument whose value is the Document interface object.
  2228. * Test: `Object.prototype.toString.call(document)``
  2229. * - Chrome === "[object HTMLDocument]"
  2230. * - Firefox === "[object HTMLDocument]"
  2231. * - Safari === "[object HTMLDocument]"
  2232. * - IE <=10 === "[object Document]"
  2233. * - IE 11 === "[object HTMLDocument]"
  2234. * - IE Edge <=13 === "[object HTMLDocument]"
  2235. */
  2236. if (_typeof(window.document) === 'object' && obj === window.document) {
  2237. return 'Document';
  2238. }
  2239. if (_typeof(window.navigator) === 'object') {
  2240. /* ! Spec Conformance
  2241. * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray)
  2242. * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray
  2243. * Test: `Object.prototype.toString.call(navigator.mimeTypes)``
  2244. * - IE <=10 === "[object MSMimeTypesCollection]"
  2245. */
  2246. if (_typeof(window.navigator.mimeTypes) === 'object' && obj === window.navigator.mimeTypes) {
  2247. return 'MimeTypeArray';
  2248. }
  2249. /* ! Spec Conformance
  2250. * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
  2251. * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray
  2252. * Test: `Object.prototype.toString.call(navigator.plugins)``
  2253. * - IE <=10 === "[object MSPluginsCollection]"
  2254. */
  2255. if (_typeof(window.navigator.plugins) === 'object' && obj === window.navigator.plugins) {
  2256. return 'PluginArray';
  2257. }
  2258. }
  2259. if ((typeof window.HTMLElement === 'function' || _typeof(window.HTMLElement) === 'object') && obj instanceof window.HTMLElement) {
  2260. /* ! Spec Conformance
  2261. * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
  2262. * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement`
  2263. * Test: `Object.prototype.toString.call(document.createElement('blockquote'))``
  2264. * - IE <=10 === "[object HTMLBlockElement]"
  2265. */
  2266. if (obj.tagName === 'BLOCKQUOTE') {
  2267. return 'HTMLQuoteElement';
  2268. }
  2269. /* ! Spec Conformance
  2270. * (https://html.spec.whatwg.org/#htmltabledatacellelement)
  2271. * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement`
  2272. * Note: Most browsers currently adher to the W3C DOM Level 2 spec
  2273. * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
  2274. * which suggests that browsers should use HTMLTableCellElement for
  2275. * both TD and TH elements. WhatWG separates these.
  2276. * Test: Object.prototype.toString.call(document.createElement('td'))
  2277. * - Chrome === "[object HTMLTableCellElement]"
  2278. * - Firefox === "[object HTMLTableCellElement]"
  2279. * - Safari === "[object HTMLTableCellElement]"
  2280. */
  2281. if (obj.tagName === 'TD') {
  2282. return 'HTMLTableDataCellElement';
  2283. }
  2284. /* ! Spec Conformance
  2285. * (https://html.spec.whatwg.org/#htmltableheadercellelement)
  2286. * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement`
  2287. * Note: Most browsers currently adher to the W3C DOM Level 2 spec
  2288. * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
  2289. * which suggests that browsers should use HTMLTableCellElement for
  2290. * both TD and TH elements. WhatWG separates these.
  2291. * Test: Object.prototype.toString.call(document.createElement('th'))
  2292. * - Chrome === "[object HTMLTableCellElement]"
  2293. * - Firefox === "[object HTMLTableCellElement]"
  2294. * - Safari === "[object HTMLTableCellElement]"
  2295. */
  2296. if (obj.tagName === 'TH') {
  2297. return 'HTMLTableHeaderCellElement';
  2298. }
  2299. }
  2300. }
  2301. /* ! Speed optimisation
  2302. * Pre:
  2303. * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled)
  2304. * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled)
  2305. * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled)
  2306. * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled)
  2307. * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled)
  2308. * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled)
  2309. * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled)
  2310. * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled)
  2311. * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled)
  2312. * Post:
  2313. * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled)
  2314. * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled)
  2315. * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled)
  2316. * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled)
  2317. * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled)
  2318. * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled)
  2319. * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled)
  2320. * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled)
  2321. * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled)
  2322. */
  2323. var stringTag = symbolToStringTagExists && obj[Symbol.toStringTag];
  2324. if (typeof stringTag === 'string') {
  2325. return stringTag;
  2326. }
  2327. var objPrototype = Object.getPrototypeOf(obj);
  2328. /* ! Speed optimisation
  2329. * Pre:
  2330. * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled)
  2331. * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled)
  2332. * Post:
  2333. * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled)
  2334. * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled)
  2335. */
  2336. if (objPrototype === RegExp.prototype) {
  2337. return 'RegExp';
  2338. }
  2339. /* ! Speed optimisation
  2340. * Pre:
  2341. * date x 2,130,074 ops/sec ±4.42% (68 runs sampled)
  2342. * Post:
  2343. * date x 3,953,779 ops/sec ±1.35% (77 runs sampled)
  2344. */
  2345. if (objPrototype === Date.prototype) {
  2346. return 'Date';
  2347. }
  2348. /* ! Spec Conformance
  2349. * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag)
  2350. * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise":
  2351. * Test: `Object.prototype.toString.call(Promise.resolve())``
  2352. * - Chrome <=47 === "[object Object]"
  2353. * - Edge <=20 === "[object Object]"
  2354. * - Firefox 29-Latest === "[object Promise]"
  2355. * - Safari 7.1-Latest === "[object Promise]"
  2356. */
  2357. if (promiseExists && objPrototype === Promise.prototype) {
  2358. return 'Promise';
  2359. }
  2360. /* ! Speed optimisation
  2361. * Pre:
  2362. * set x 2,222,186 ops/sec ±1.31% (82 runs sampled)
  2363. * Post:
  2364. * set x 4,545,879 ops/sec ±1.13% (83 runs sampled)
  2365. */
  2366. if (setExists && objPrototype === Set.prototype) {
  2367. return 'Set';
  2368. }
  2369. /* ! Speed optimisation
  2370. * Pre:
  2371. * map x 2,396,842 ops/sec ±1.59% (81 runs sampled)
  2372. * Post:
  2373. * map x 4,183,945 ops/sec ±6.59% (82 runs sampled)
  2374. */
  2375. if (mapExists && objPrototype === Map.prototype) {
  2376. return 'Map';
  2377. }
  2378. /* ! Speed optimisation
  2379. * Pre:
  2380. * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled)
  2381. * Post:
  2382. * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled)
  2383. */
  2384. if (weakSetExists && objPrototype === WeakSet.prototype) {
  2385. return 'WeakSet';
  2386. }
  2387. /* ! Speed optimisation
  2388. * Pre:
  2389. * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled)
  2390. * Post:
  2391. * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled)
  2392. */
  2393. if (weakMapExists && objPrototype === WeakMap.prototype) {
  2394. return 'WeakMap';
  2395. }
  2396. /* ! Spec Conformance
  2397. * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag)
  2398. * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView":
  2399. * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))``
  2400. * - Edge <=13 === "[object Object]"
  2401. */
  2402. if (dataViewExists && objPrototype === DataView.prototype) {
  2403. return 'DataView';
  2404. }
  2405. /* ! Spec Conformance
  2406. * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag)
  2407. * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator":
  2408. * Test: `Object.prototype.toString.call(new Map().entries())``
  2409. * - Edge <=13 === "[object Object]"
  2410. */
  2411. if (mapExists && objPrototype === mapIteratorPrototype) {
  2412. return 'Map Iterator';
  2413. }
  2414. /* ! Spec Conformance
  2415. * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag)
  2416. * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator":
  2417. * Test: `Object.prototype.toString.call(new Set().entries())``
  2418. * - Edge <=13 === "[object Object]"
  2419. */
  2420. if (setExists && objPrototype === setIteratorPrototype) {
  2421. return 'Set Iterator';
  2422. }
  2423. /* ! Spec Conformance
  2424. * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag)
  2425. * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator":
  2426. * Test: `Object.prototype.toString.call([][Symbol.iterator]())``
  2427. * - Edge <=13 === "[object Object]"
  2428. */
  2429. if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
  2430. return 'Array Iterator';
  2431. }
  2432. /* ! Spec Conformance
  2433. * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag)
  2434. * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator":
  2435. * Test: `Object.prototype.toString.call(''[Symbol.iterator]())``
  2436. * - Edge <=13 === "[object Object]"
  2437. */
  2438. if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
  2439. return 'String Iterator';
  2440. }
  2441. /* ! Speed optimisation
  2442. * Pre:
  2443. * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled)
  2444. * Post:
  2445. * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled)
  2446. */
  2447. if (objPrototype === null) {
  2448. return 'Object';
  2449. }
  2450. return Object.prototype.toString.call(obj).slice(toStringLeftSliceLength, toStringRightSliceLength);
  2451. }
  2452. return typeDetect;
  2453. });
  2454. });
  2455. var isBufferExists = typeof Buffer !== 'undefined';
  2456. var isBufferFromExists = isBufferExists && typeof Buffer.from !== 'undefined';
  2457. var isBuffer = isBufferExists ?
  2458. /**
  2459. * is value is Buffer?
  2460. *
  2461. * @param {*} value
  2462. * @return {boolean}
  2463. */
  2464. function isBuffer(value) {
  2465. return Buffer.isBuffer(value);
  2466. } :
  2467. /**
  2468. * return false
  2469. *
  2470. * NOTE: for Buffer unsupported
  2471. *
  2472. * @return {boolean}
  2473. */
  2474. function isBuffer() {
  2475. return false;
  2476. };
  2477. var copy = isBufferFromExists ?
  2478. /**
  2479. * copy Buffer
  2480. *
  2481. * @param {Buffer} value
  2482. * @return {Buffer}
  2483. */
  2484. function copy(value) {
  2485. return Buffer.from(value);
  2486. } : isBufferExists ?
  2487. /**
  2488. * copy Buffer
  2489. *
  2490. * NOTE: for old node.js
  2491. *
  2492. * @param {Buffer} value
  2493. * @return {Buffer}
  2494. */
  2495. function copy(value) {
  2496. return new Buffer(value);
  2497. } :
  2498. /**
  2499. * shallow copy
  2500. *
  2501. * NOTE: for Buffer unsupported
  2502. *
  2503. * @param {*}
  2504. * @return {*}
  2505. */
  2506. function copy(value) {
  2507. return value;
  2508. };
  2509. /**
  2510. * detect type of value
  2511. *
  2512. * @param {*} value
  2513. * @return {string}
  2514. */
  2515. function detectType(value) {
  2516. // NOTE: isBuffer must execute before type-detect,
  2517. // because type-detect returns 'Uint8Array'.
  2518. if (isBuffer(value)) {
  2519. return 'Buffer';
  2520. }
  2521. return typeDetect(value);
  2522. }
  2523. /**
  2524. * collection types
  2525. */
  2526. var collectionTypeSet = new Set(['Arguments', 'Array', 'Map', 'Object', 'Set']);
  2527. /**
  2528. * get value from collection
  2529. *
  2530. * @param {Array|Object|Map|Set} collection
  2531. * @param {string|number|symbol} key
  2532. * @param {string} [type=null]
  2533. * @return {*}
  2534. */
  2535. function get(collection, key) {
  2536. var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  2537. var valueType = type || detectType(collection);
  2538. switch (valueType) {
  2539. case 'Arguments':
  2540. case 'Array':
  2541. case 'Object':
  2542. return collection[key];
  2543. case 'Map':
  2544. return collection.get(key);
  2545. case 'Set':
  2546. // NOTE: Set.prototype.keys is alias of Set.prototype.values
  2547. // it means key is equals value
  2548. return key;
  2549. }
  2550. }
  2551. /**
  2552. * check to type string is collection
  2553. *
  2554. * @param {string} type
  2555. */
  2556. function isCollection(type) {
  2557. return collectionTypeSet.has(type);
  2558. }
  2559. /**
  2560. * set value to collection
  2561. *
  2562. * @param {Array|Object|Map|Set} collection
  2563. * @param {string|number|symbol} key
  2564. * @param {*} value
  2565. * @param {string} [type=null]
  2566. * @return {Array|Object|Map|Set}
  2567. */
  2568. function set(collection, key, value) {
  2569. var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  2570. var valueType = type || detectType(collection);
  2571. switch (valueType) {
  2572. case 'Arguments':
  2573. case 'Array':
  2574. case 'Object':
  2575. collection[key] = value;
  2576. break;
  2577. case 'Map':
  2578. collection.set(key, value);
  2579. break;
  2580. case 'Set':
  2581. collection.add(value);
  2582. break;
  2583. }
  2584. return collection;
  2585. }
  2586. var _stringWs = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
  2587. '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  2588. var space = '[' + _stringWs + ']';
  2589. var non = '\u200b\u0085';
  2590. var ltrim = RegExp('^' + space + space + '*');
  2591. var rtrim = RegExp(space + space + '*$');
  2592. var exporter = function (KEY, exec, ALIAS) {
  2593. var exp = {};
  2594. var FORCE = _fails(function () {
  2595. return !!_stringWs[KEY]() || non[KEY]() != non;
  2596. });
  2597. var fn = exp[KEY] = FORCE ? exec(trim) : _stringWs[KEY];
  2598. if (ALIAS) exp[ALIAS] = fn;
  2599. _export(_export.P + _export.F * FORCE, 'String', exp);
  2600. };
  2601. // 1 -> String#trimLeft
  2602. // 2 -> String#trimRight
  2603. // 3 -> String#trim
  2604. var trim = exporter.trim = function (string, TYPE) {
  2605. string = String(_defined(string));
  2606. if (TYPE & 1) string = string.replace(ltrim, '');
  2607. if (TYPE & 2) string = string.replace(rtrim, '');
  2608. return string;
  2609. };
  2610. var _stringTrim = exporter;
  2611. var gOPN$3 = _objectGopn.f;
  2612. var gOPD$2 = _objectGopd.f;
  2613. var dP$4 = _objectDp.f;
  2614. var $trim = _stringTrim.trim;
  2615. var NUMBER = 'Number';
  2616. var $Number = _global[NUMBER];
  2617. var Base$1 = $Number;
  2618. var proto$2 = $Number.prototype;
  2619. // Opera ~12 has broken Object#toString
  2620. var BROKEN_COF = _cof(_objectCreate(proto$2)) == NUMBER;
  2621. var TRIM = 'trim' in String.prototype;
  2622. // 7.1.3 ToNumber(argument)
  2623. var toNumber = function (argument) {
  2624. var it = _toPrimitive(argument, false);
  2625. if (typeof it == 'string' && it.length > 2) {
  2626. it = TRIM ? it.trim() : $trim(it, 3);
  2627. var first = it.charCodeAt(0);
  2628. var third, radix, maxCode;
  2629. if (first === 43 || first === 45) {
  2630. third = it.charCodeAt(2);
  2631. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  2632. } else if (first === 48) {
  2633. switch (it.charCodeAt(1)) {
  2634. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
  2635. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
  2636. default: return +it;
  2637. }
  2638. for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) {
  2639. code = digits.charCodeAt(i);
  2640. // parseInt parses a string to a first unavailable symbol
  2641. // but ToNumber should return NaN if a string contains unavailable symbols
  2642. if (code < 48 || code > maxCode) return NaN;
  2643. } return parseInt(digits, radix);
  2644. }
  2645. } return +it;
  2646. };
  2647. if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) {
  2648. $Number = function Number(value) {
  2649. var it = arguments.length < 1 ? 0 : value;
  2650. var that = this;
  2651. return that instanceof $Number
  2652. // check on 1..constructor(foo) case
  2653. && (BROKEN_COF ? _fails(function () { proto$2.valueOf.call(that); }) : _cof(that) != NUMBER)
  2654. ? _inheritIfRequired(new Base$1(toNumber(it)), that, $Number) : toNumber(it);
  2655. };
  2656. for (var keys$1 = _descriptors ? gOPN$3(Base$1) : (
  2657. // ES3:
  2658. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  2659. // ES6 (in case, if modules with ES6 Number statics required before):
  2660. 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
  2661. 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
  2662. ).split(','), j$1 = 0, key$1; keys$1.length > j$1; j$1++) {
  2663. if (_has(Base$1, key$1 = keys$1[j$1]) && !_has($Number, key$1)) {
  2664. dP$4($Number, key$1, gOPD$2(Base$1, key$1));
  2665. }
  2666. }
  2667. $Number.prototype = proto$2;
  2668. proto$2.constructor = $Number;
  2669. _redefine(_global, NUMBER, $Number);
  2670. }
  2671. var freeGlobalThis = typeof globalThis !== 'undefined' && globalThis !== null && globalThis.Object === Object && globalThis;
  2672. var freeGlobal = typeof global !== 'undefined' && global !== null && global.Object === Object && global;
  2673. var freeSelf = typeof self !== 'undefined' && self !== null && self.Object === Object && self;
  2674. var globalObject = freeGlobalThis || freeGlobal || freeSelf || Function('return this')();
  2675. /**
  2676. * copy ArrayBuffer
  2677. *
  2678. * @param {ArrayBuffer} value
  2679. * @return {ArrayBuffer}
  2680. */
  2681. function copyArrayBuffer(value) {
  2682. return value.slice(0);
  2683. }
  2684. /**
  2685. * copy Boolean
  2686. *
  2687. * @param {Boolean} value
  2688. * @return {Boolean}
  2689. */
  2690. function copyBoolean(value) {
  2691. return new Boolean(value.valueOf());
  2692. }
  2693. /**
  2694. * copy DataView
  2695. *
  2696. * @param {DataView} value
  2697. * @return {DataView}
  2698. */
  2699. function copyDataView(value) {
  2700. // TODO: copy ArrayBuffer?
  2701. return new DataView(value.buffer);
  2702. }
  2703. /**
  2704. * copy Buffer
  2705. *
  2706. * @param {Buffer} value
  2707. * @return {Buffer}
  2708. */
  2709. function copyBuffer(value) {
  2710. return copy(value);
  2711. }
  2712. /**
  2713. * copy Date
  2714. *
  2715. * @param {Date} value
  2716. * @return {Date}
  2717. */
  2718. function copyDate(value) {
  2719. return new Date(value.getTime());
  2720. }
  2721. /**
  2722. * copy Number
  2723. *
  2724. * @param {Number} value
  2725. * @return {Number}
  2726. */
  2727. function copyNumber(value) {
  2728. return new Number(value);
  2729. }
  2730. /**
  2731. * copy RegExp
  2732. *
  2733. * @param {RegExp} value
  2734. * @return {RegExp}
  2735. */
  2736. function copyRegExp(value) {
  2737. return new RegExp(value.source, value.flags);
  2738. }
  2739. /**
  2740. * copy String
  2741. *
  2742. * @param {String} value
  2743. * @return {String}
  2744. */
  2745. function copyString(value) {
  2746. return new String(value);
  2747. }
  2748. /**
  2749. * copy TypedArray
  2750. *
  2751. * @param {*} value
  2752. * @return {*}
  2753. */
  2754. function copyTypedArray(value, type) {
  2755. var typedArray = globalObject[type];
  2756. if (typedArray.from) {
  2757. return globalObject[type].from(value);
  2758. }
  2759. return new globalObject[type](value);
  2760. }
  2761. /**
  2762. * shallow copy
  2763. *
  2764. * @param {*} value
  2765. * @return {*}
  2766. */
  2767. function shallowCopy(value) {
  2768. return value;
  2769. }
  2770. /**
  2771. * get empty Array
  2772. *
  2773. * @return {Array}
  2774. */
  2775. function getEmptyArray() {
  2776. return [];
  2777. }
  2778. /**
  2779. * get empty Map
  2780. *
  2781. * @return {Map}
  2782. */
  2783. function getEmptyMap() {
  2784. return new Map();
  2785. }
  2786. /**
  2787. * get empty Object
  2788. *
  2789. * @return {Object}
  2790. */
  2791. function getEmptyObject() {
  2792. return {};
  2793. }
  2794. /**
  2795. * get empty Set
  2796. *
  2797. * @return {Set}
  2798. */
  2799. function getEmptySet() {
  2800. return new Set();
  2801. }
  2802. var copyMap = new Map([// deep copy
  2803. ['ArrayBuffer', copyArrayBuffer], ['Boolean', copyBoolean], ['Buffer', copyBuffer], ['DataView', copyDataView], ['Date', copyDate], ['Number', copyNumber], ['RegExp', copyRegExp], ['String', copyString], // typed arrays
  2804. // TODO: pass bound function
  2805. ['Float32Array', copyTypedArray], ['Float64Array', copyTypedArray], ['Int16Array', copyTypedArray], ['Int32Array', copyTypedArray], ['Int8Array', copyTypedArray], ['Uint16Array', copyTypedArray], ['Uint32Array', copyTypedArray], ['Uint8Array', copyTypedArray], ['Uint8ClampedArray', copyTypedArray], // shallow copy
  2806. ['Array Iterator', shallowCopy], ['Map Iterator', shallowCopy], ['Promise', shallowCopy], ['Set Iterator', shallowCopy], ['String Iterator', shallowCopy], ['function', shallowCopy], ['global', shallowCopy], // NOTE: WeakMap and WeakSet cannot get entries
  2807. ['WeakMap', shallowCopy], ['WeakSet', shallowCopy], // primitives
  2808. ['boolean', shallowCopy], ['null', shallowCopy], ['number', shallowCopy], ['string', shallowCopy], ['symbol', shallowCopy], ['undefined', shallowCopy], // collections
  2809. // NOTE: return empty value, because recursively copy later.
  2810. ['Arguments', getEmptyArray], ['Array', getEmptyArray], ['Map', getEmptyMap], ['Object', getEmptyObject], ['Set', getEmptySet] // NOTE: type-detect returns following types
  2811. // 'Location'
  2812. // 'Document'
  2813. // 'MimeTypeArray'
  2814. // 'PluginArray'
  2815. // 'HTMLQuoteElement'
  2816. // 'HTMLTableDataCellElement'
  2817. // 'HTMLTableHeaderCellElement'
  2818. // TODO: is type-detect never return 'object'?
  2819. // 'object'
  2820. ]);
  2821. /**
  2822. * no operation
  2823. */
  2824. function noop() {}
  2825. /**
  2826. * copy value
  2827. *
  2828. * @param {*} value
  2829. * @param {string} [type=null]
  2830. * @param {Function} [customizer=noop]
  2831. * @return {*}
  2832. */
  2833. function copy$1(value) {
  2834. var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  2835. var customizer = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
  2836. if (arguments.length === 2 && typeof type === 'function') {
  2837. customizer = type;
  2838. type = null;
  2839. }
  2840. var valueType = type || detectType(value);
  2841. var copyFunction = copyMap.get(valueType);
  2842. if (valueType === 'Object') {
  2843. var result = customizer(value, valueType);
  2844. if (result !== undefined) {
  2845. return result;
  2846. }
  2847. } // NOTE: TypedArray needs pass type to argument
  2848. return copyFunction ? copyFunction(value, valueType) : value;
  2849. }
  2850. /**
  2851. * deepcopy function
  2852. *
  2853. * @param {*} value
  2854. * @param {Object|Function} [options]
  2855. * @return {*}
  2856. */
  2857. function deepcopy(value) {
  2858. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2859. if (typeof options === 'function') {
  2860. options = {
  2861. customizer: options
  2862. };
  2863. }
  2864. var _options = options,
  2865. customizer = _options.customizer;
  2866. var valueType = detectType(value);
  2867. if (!isCollection(valueType)) {
  2868. return recursiveCopy(value, null, null, null, customizer);
  2869. }
  2870. var copiedValue = copy$1(value, valueType, customizer);
  2871. var references = new WeakMap([[value, copiedValue]]);
  2872. var visited = new WeakSet([value]);
  2873. return recursiveCopy(value, copiedValue, references, visited, customizer);
  2874. }
  2875. /**
  2876. * recursively copy
  2877. *
  2878. * @param {*} value target value
  2879. * @param {*} clone clone of value
  2880. * @param {WeakMap} references visited references of clone
  2881. * @param {WeakSet} visited visited references of value
  2882. * @param {Function} customizer user customize function
  2883. * @return {*}
  2884. */
  2885. function recursiveCopy(value, clone, references, visited, customizer) {
  2886. var _keys;
  2887. var type = detectType(value);
  2888. var copiedValue = copy$1(value, type); // return if not a collection value
  2889. if (!isCollection(type)) {
  2890. return copiedValue;
  2891. }
  2892. var keys;
  2893. switch (type) {
  2894. case 'Arguments':
  2895. case 'Array':
  2896. keys = Object.keys(value);
  2897. break;
  2898. case 'Object':
  2899. keys = Object.keys(value);
  2900. (_keys = keys).push.apply(_keys, _toConsumableArray(Object.getOwnPropertySymbols(value)));
  2901. break;
  2902. case 'Map':
  2903. case 'Set':
  2904. keys = value.keys();
  2905. break;
  2906. } // walk within collection with iterator
  2907. var _iterator = _createForOfIteratorHelper(keys),
  2908. _step;
  2909. try {
  2910. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2911. var collectionKey = _step.value;
  2912. var collectionValue = get(value, collectionKey, type);
  2913. if (visited.has(collectionValue)) {
  2914. // for [Circular]
  2915. set(clone, collectionKey, references.get(collectionValue), type);
  2916. } else {
  2917. var collectionValueType = detectType(collectionValue);
  2918. var copiedCollectionValue = copy$1(collectionValue, collectionValueType); // save reference if value is collection
  2919. if (isCollection(collectionValueType)) {
  2920. references.set(collectionValue, copiedCollectionValue);
  2921. visited.add(collectionValue);
  2922. }
  2923. set(clone, collectionKey, recursiveCopy(collectionValue, copiedCollectionValue, references, visited, customizer), type);
  2924. }
  2925. } // TODO: isSealed/isFrozen/isExtensible
  2926. } catch (err) {
  2927. _iterator.e(err);
  2928. } finally {
  2929. _iterator.f();
  2930. }
  2931. return clone;
  2932. }
  2933. return deepcopy;
  2934. })));
  2935. //# sourceMappingURL=deepcopy.legacy.js.map