call-matcher.js 98 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860
  1. /**
  2. * Modules in this bundle
  3. * @license
  4. *
  5. * call-matcher:
  6. * license: MIT (http://opensource.org/licenses/MIT)
  7. * author: Takuto Wada <takuto.wada@gmail.com>
  8. * homepage: https://github.com/twada/call-matcher
  9. * version: 1.1.0
  10. *
  11. * core-js:
  12. * license: MIT (http://opensource.org/licenses/MIT)
  13. * homepage: https://github.com/zloirock/core-js#readme
  14. * version: 2.5.7
  15. *
  16. * deep-equal:
  17. * license: MIT (http://opensource.org/licenses/MIT)
  18. * author: James Halliday <mail@substack.net>
  19. * homepage: https://github.com/substack/node-deep-equal#readme
  20. * version: 1.0.1
  21. *
  22. * espurify:
  23. * license: MIT (http://opensource.org/licenses/MIT)
  24. * author: Takuto Wada <takuto.wada@gmail.com>
  25. * homepage: https://github.com/estools/espurify
  26. * version: 1.8.1
  27. *
  28. * estraverse:
  29. * license: BSD-2-Clause (http://opensource.org/licenses/BSD-2-Clause)
  30. * maintainers: Yusuke Suzuki <utatane.tea@gmail.com>
  31. * homepage: https://github.com/estools/estraverse
  32. * version: 4.2.0
  33. *
  34. * This header is generated by licensify (https://github.com/twada/licensify)
  35. */
  36. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.CallMatcher = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw (a.code="MODULE_NOT_FOUND", a)}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
  37. /**
  38. * call-matcher:
  39. * ECMAScript CallExpression matcher made from function/method signature
  40. *
  41. * https://github.com/twada/call-matcher
  42. *
  43. * Copyright (c) 2015-2018 Takuto Wada
  44. * Licensed under the MIT license.
  45. * https://github.com/twada/call-matcher/blob/master/MIT-LICENSE.txt
  46. */
  47. 'use strict';
  48. /* jshint -W024 */
  49. var estraverse = _dereq_('estraverse');
  50. var espurify = _dereq_('espurify');
  51. var syntax = estraverse.Syntax;
  52. var hasOwn = Object.prototype.hasOwnProperty;
  53. var forEach = _dereq_('core-js/library/fn/array/for-each');
  54. var map = _dereq_('core-js/library/fn/array/map');
  55. var filter = _dereq_('core-js/library/fn/array/filter');
  56. var reduce = _dereq_('core-js/library/fn/array/reduce');
  57. var indexOf = _dereq_('core-js/library/fn/array/index-of');
  58. var deepEqual = _dereq_('deep-equal');
  59. var notCallExprMessage = 'Argument should be in the form of CallExpression';
  60. var duplicatedArgMessage = 'Duplicate argument name: ';
  61. var invalidFormMessage = 'Argument should be in the form of `name` or `[name]`';
  62. function CallMatcher (signatureAst, options) {
  63. validateApiExpression(signatureAst);
  64. options = options || {};
  65. this.visitorKeys = options.visitorKeys || estraverse.VisitorKeys;
  66. if (options.astWhiteList) {
  67. this.purifyAst = espurify.cloneWithWhitelist(options.astWhiteList);
  68. } else {
  69. this.purifyAst = espurify;
  70. }
  71. this.signatureAst = signatureAst;
  72. this.signatureCalleeDepth = astDepth(signatureAst.callee, this.visitorKeys);
  73. this.numMaxArgs = this.signatureAst.arguments.length;
  74. this.numMinArgs = filter(this.signatureAst.arguments, identifiers).length;
  75. }
  76. CallMatcher.prototype.test = function (currentNode) {
  77. var calleeMatched = this.isCalleeMatched(currentNode);
  78. var numArgs;
  79. if (calleeMatched) {
  80. numArgs = currentNode.arguments.length;
  81. return this.numMinArgs <= numArgs && numArgs <= this.numMaxArgs;
  82. }
  83. return false;
  84. };
  85. CallMatcher.prototype.matchArgument = function (currentNode, parentNode) {
  86. if (isCalleeOfParent(currentNode, parentNode)) {
  87. return null;
  88. }
  89. if (this.test(parentNode)) {
  90. var indexOfCurrentArg = indexOf(parentNode.arguments, currentNode);
  91. var numOptional = parentNode.arguments.length - this.numMinArgs;
  92. var matchedSignatures = reduce(this.argumentSignatures(), function (accum, argSig) {
  93. if (argSig.kind === 'mandatory') {
  94. accum.push(argSig);
  95. }
  96. if (argSig.kind === 'optional' && 0 < numOptional) {
  97. numOptional -= 1;
  98. accum.push(argSig);
  99. }
  100. return accum;
  101. }, []);
  102. return matchedSignatures[indexOfCurrentArg];
  103. }
  104. return null;
  105. };
  106. CallMatcher.prototype.calleeAst = function () {
  107. return this.purifyAst(this.signatureAst.callee);
  108. };
  109. CallMatcher.prototype.argumentSignatures = function () {
  110. return map(this.signatureAst.arguments, toArgumentSignature);
  111. };
  112. CallMatcher.prototype.isCalleeMatched = function (node) {
  113. if (!isCallExpression(node)) {
  114. return false;
  115. }
  116. if (!this.isSameDepthAsSignatureCallee(node.callee)) {
  117. return false;
  118. }
  119. return deepEqual(this.purifyAst(this.signatureAst.callee), this.purifyAst(node.callee));
  120. };
  121. CallMatcher.prototype.isSameDepthAsSignatureCallee = function (ast) {
  122. var depth = this.signatureCalleeDepth;
  123. var currentDepth = 0;
  124. estraverse.traverse(ast, {
  125. keys: this.visitorKeys,
  126. enter: function (currentNode, parentNode) {
  127. var path = this.path();
  128. var pathDepth = path ? path.length : 0;
  129. if (currentDepth < pathDepth) {
  130. currentDepth = pathDepth;
  131. }
  132. if (depth < currentDepth) {
  133. this['break']();
  134. }
  135. }
  136. });
  137. return (depth === currentDepth);
  138. };
  139. function toArgumentSignature (argSignatureNode, idx) {
  140. switch(argSignatureNode.type) {
  141. case syntax.Identifier:
  142. return {
  143. index: idx,
  144. name: argSignatureNode.name,
  145. kind: 'mandatory'
  146. };
  147. case syntax.ArrayExpression:
  148. return {
  149. index: idx,
  150. name: argSignatureNode.elements[0].name,
  151. kind: 'optional'
  152. };
  153. default:
  154. return null;
  155. }
  156. }
  157. function astDepth (ast, visitorKeys) {
  158. var maxDepth = 0;
  159. estraverse.traverse(ast, {
  160. keys: visitorKeys,
  161. enter: function (currentNode, parentNode) {
  162. var path = this.path();
  163. var pathDepth = path ? path.length : 0;
  164. if (maxDepth < pathDepth) {
  165. maxDepth = pathDepth;
  166. }
  167. }
  168. });
  169. return maxDepth;
  170. }
  171. function isCallExpression (node) {
  172. return node && node.type === syntax.CallExpression;
  173. }
  174. function isCalleeOfParent(currentNode, parentNode) {
  175. return parentNode && currentNode &&
  176. parentNode.type === syntax.CallExpression &&
  177. parentNode.callee === currentNode;
  178. }
  179. function identifiers (node) {
  180. return node.type === syntax.Identifier;
  181. }
  182. function validateApiExpression (callExpression) {
  183. if (!callExpression || !callExpression.type) {
  184. throw new Error(notCallExprMessage);
  185. }
  186. if (callExpression.type !== syntax.CallExpression) {
  187. throw new Error(notCallExprMessage);
  188. }
  189. var names = {};
  190. forEach(callExpression.arguments, function (arg) {
  191. var name = validateArg(arg);
  192. if (hasOwn.call(names, name)) {
  193. throw new Error(duplicatedArgMessage + name);
  194. } else {
  195. names[name] = name;
  196. }
  197. });
  198. }
  199. function validateArg (arg) {
  200. var inner;
  201. switch(arg.type) {
  202. case syntax.Identifier:
  203. return arg.name;
  204. case syntax.ArrayExpression:
  205. if (arg.elements.length !== 1) {
  206. throw new Error(invalidFormMessage);
  207. }
  208. inner = arg.elements[0];
  209. if (inner.type !== syntax.Identifier) {
  210. throw new Error(invalidFormMessage);
  211. }
  212. return inner.name;
  213. default:
  214. throw new Error(invalidFormMessage);
  215. }
  216. }
  217. module.exports = CallMatcher;
  218. },{"core-js/library/fn/array/filter":2,"core-js/library/fn/array/for-each":3,"core-js/library/fn/array/index-of":4,"core-js/library/fn/array/map":6,"core-js/library/fn/array/reduce":7,"deep-equal":98,"espurify":101,"estraverse":105}],2:[function(_dereq_,module,exports){
  219. _dereq_('../../modules/es6.array.filter');
  220. module.exports = _dereq_('../../modules/_core').Array.filter;
  221. },{"../../modules/_core":26,"../../modules/es6.array.filter":82}],3:[function(_dereq_,module,exports){
  222. _dereq_('../../modules/es6.array.for-each');
  223. module.exports = _dereq_('../../modules/_core').Array.forEach;
  224. },{"../../modules/_core":26,"../../modules/es6.array.for-each":83}],4:[function(_dereq_,module,exports){
  225. _dereq_('../../modules/es6.array.index-of');
  226. module.exports = _dereq_('../../modules/_core').Array.indexOf;
  227. },{"../../modules/_core":26,"../../modules/es6.array.index-of":84}],5:[function(_dereq_,module,exports){
  228. _dereq_('../../modules/es6.array.is-array');
  229. module.exports = _dereq_('../../modules/_core').Array.isArray;
  230. },{"../../modules/_core":26,"../../modules/es6.array.is-array":85}],6:[function(_dereq_,module,exports){
  231. _dereq_('../../modules/es6.array.map');
  232. module.exports = _dereq_('../../modules/_core').Array.map;
  233. },{"../../modules/_core":26,"../../modules/es6.array.map":87}],7:[function(_dereq_,module,exports){
  234. _dereq_('../../modules/es6.array.reduce');
  235. module.exports = _dereq_('../../modules/_core').Array.reduce;
  236. },{"../../modules/_core":26,"../../modules/es6.array.reduce":88}],8:[function(_dereq_,module,exports){
  237. _dereq_('../modules/es6.object.to-string');
  238. _dereq_('../modules/es6.string.iterator');
  239. _dereq_('../modules/web.dom.iterable');
  240. _dereq_('../modules/es6.map');
  241. _dereq_('../modules/es7.map.to-json');
  242. _dereq_('../modules/es7.map.of');
  243. _dereq_('../modules/es7.map.from');
  244. module.exports = _dereq_('../modules/_core').Map;
  245. },{"../modules/_core":26,"../modules/es6.map":89,"../modules/es6.object.to-string":92,"../modules/es6.string.iterator":93,"../modules/es7.map.from":94,"../modules/es7.map.of":95,"../modules/es7.map.to-json":96,"../modules/web.dom.iterable":97}],9:[function(_dereq_,module,exports){
  246. _dereq_('../../modules/es6.object.assign');
  247. module.exports = _dereq_('../../modules/_core').Object.assign;
  248. },{"../../modules/_core":26,"../../modules/es6.object.assign":90}],10:[function(_dereq_,module,exports){
  249. _dereq_('../../modules/es6.object.keys');
  250. module.exports = _dereq_('../../modules/_core').Object.keys;
  251. },{"../../modules/_core":26,"../../modules/es6.object.keys":91}],11:[function(_dereq_,module,exports){
  252. module.exports = function (it) {
  253. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  254. return it;
  255. };
  256. },{}],12:[function(_dereq_,module,exports){
  257. module.exports = function () { /* empty */ };
  258. },{}],13:[function(_dereq_,module,exports){
  259. module.exports = function (it, Constructor, name, forbiddenField) {
  260. if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
  261. throw TypeError(name + ': incorrect invocation!');
  262. } return it;
  263. };
  264. },{}],14:[function(_dereq_,module,exports){
  265. var isObject = _dereq_('./_is-object');
  266. module.exports = function (it) {
  267. if (!isObject(it)) throw TypeError(it + ' is not an object!');
  268. return it;
  269. };
  270. },{"./_is-object":43}],15:[function(_dereq_,module,exports){
  271. var forOf = _dereq_('./_for-of');
  272. module.exports = function (iter, ITERATOR) {
  273. var result = [];
  274. forOf(iter, false, result.push, result, ITERATOR);
  275. return result;
  276. };
  277. },{"./_for-of":34}],16:[function(_dereq_,module,exports){
  278. // false -> Array#indexOf
  279. // true -> Array#includes
  280. var toIObject = _dereq_('./_to-iobject');
  281. var toLength = _dereq_('./_to-length');
  282. var toAbsoluteIndex = _dereq_('./_to-absolute-index');
  283. module.exports = function (IS_INCLUDES) {
  284. return function ($this, el, fromIndex) {
  285. var O = toIObject($this);
  286. var length = toLength(O.length);
  287. var index = toAbsoluteIndex(fromIndex, length);
  288. var value;
  289. // Array#includes uses SameValueZero equality algorithm
  290. // eslint-disable-next-line no-self-compare
  291. if (IS_INCLUDES && el != el) while (length > index) {
  292. value = O[index++];
  293. // eslint-disable-next-line no-self-compare
  294. if (value != value) return true;
  295. // Array#indexOf ignores holes, Array#includes - not
  296. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  297. if (O[index] === el) return IS_INCLUDES || index || 0;
  298. } return !IS_INCLUDES && -1;
  299. };
  300. };
  301. },{"./_to-absolute-index":72,"./_to-iobject":74,"./_to-length":75}],17:[function(_dereq_,module,exports){
  302. // 0 -> Array#forEach
  303. // 1 -> Array#map
  304. // 2 -> Array#filter
  305. // 3 -> Array#some
  306. // 4 -> Array#every
  307. // 5 -> Array#find
  308. // 6 -> Array#findIndex
  309. var ctx = _dereq_('./_ctx');
  310. var IObject = _dereq_('./_iobject');
  311. var toObject = _dereq_('./_to-object');
  312. var toLength = _dereq_('./_to-length');
  313. var asc = _dereq_('./_array-species-create');
  314. module.exports = function (TYPE, $create) {
  315. var IS_MAP = TYPE == 1;
  316. var IS_FILTER = TYPE == 2;
  317. var IS_SOME = TYPE == 3;
  318. var IS_EVERY = TYPE == 4;
  319. var IS_FIND_INDEX = TYPE == 6;
  320. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  321. var create = $create || asc;
  322. return function ($this, callbackfn, that) {
  323. var O = toObject($this);
  324. var self = IObject(O);
  325. var f = ctx(callbackfn, that, 3);
  326. var length = toLength(self.length);
  327. var index = 0;
  328. var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  329. var val, res;
  330. for (;length > index; index++) if (NO_HOLES || index in self) {
  331. val = self[index];
  332. res = f(val, index, O);
  333. if (TYPE) {
  334. if (IS_MAP) result[index] = res; // map
  335. else if (res) switch (TYPE) {
  336. case 3: return true; // some
  337. case 5: return val; // find
  338. case 6: return index; // findIndex
  339. case 2: result.push(val); // filter
  340. } else if (IS_EVERY) return false; // every
  341. }
  342. }
  343. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  344. };
  345. };
  346. },{"./_array-species-create":20,"./_ctx":27,"./_iobject":40,"./_to-length":75,"./_to-object":76}],18:[function(_dereq_,module,exports){
  347. var aFunction = _dereq_('./_a-function');
  348. var toObject = _dereq_('./_to-object');
  349. var IObject = _dereq_('./_iobject');
  350. var toLength = _dereq_('./_to-length');
  351. module.exports = function (that, callbackfn, aLen, memo, isRight) {
  352. aFunction(callbackfn);
  353. var O = toObject(that);
  354. var self = IObject(O);
  355. var length = toLength(O.length);
  356. var index = isRight ? length - 1 : 0;
  357. var i = isRight ? -1 : 1;
  358. if (aLen < 2) for (;;) {
  359. if (index in self) {
  360. memo = self[index];
  361. index += i;
  362. break;
  363. }
  364. index += i;
  365. if (isRight ? index < 0 : length <= index) {
  366. throw TypeError('Reduce of empty array with no initial value');
  367. }
  368. }
  369. for (;isRight ? index >= 0 : length > index; index += i) if (index in self) {
  370. memo = callbackfn(memo, self[index], index, O);
  371. }
  372. return memo;
  373. };
  374. },{"./_a-function":11,"./_iobject":40,"./_to-length":75,"./_to-object":76}],19:[function(_dereq_,module,exports){
  375. var isObject = _dereq_('./_is-object');
  376. var isArray = _dereq_('./_is-array');
  377. var SPECIES = _dereq_('./_wks')('species');
  378. module.exports = function (original) {
  379. var C;
  380. if (isArray(original)) {
  381. C = original.constructor;
  382. // cross-realm fallback
  383. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  384. if (isObject(C)) {
  385. C = C[SPECIES];
  386. if (C === null) C = undefined;
  387. }
  388. } return C === undefined ? Array : C;
  389. };
  390. },{"./_is-array":42,"./_is-object":43,"./_wks":80}],20:[function(_dereq_,module,exports){
  391. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  392. var speciesConstructor = _dereq_('./_array-species-constructor');
  393. module.exports = function (original, length) {
  394. return new (speciesConstructor(original))(length);
  395. };
  396. },{"./_array-species-constructor":19}],21:[function(_dereq_,module,exports){
  397. // getting tag from 19.1.3.6 Object.prototype.toString()
  398. var cof = _dereq_('./_cof');
  399. var TAG = _dereq_('./_wks')('toStringTag');
  400. // ES3 wrong here
  401. var ARG = cof(function () { return arguments; }()) == 'Arguments';
  402. // fallback for IE11 Script Access Denied error
  403. var tryGet = function (it, key) {
  404. try {
  405. return it[key];
  406. } catch (e) { /* empty */ }
  407. };
  408. module.exports = function (it) {
  409. var O, T, B;
  410. return it === undefined ? 'Undefined' : it === null ? 'Null'
  411. // @@toStringTag case
  412. : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  413. // builtinTag case
  414. : ARG ? cof(O)
  415. // ES3 arguments fallback
  416. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  417. };
  418. },{"./_cof":22,"./_wks":80}],22:[function(_dereq_,module,exports){
  419. var toString = {}.toString;
  420. module.exports = function (it) {
  421. return toString.call(it).slice(8, -1);
  422. };
  423. },{}],23:[function(_dereq_,module,exports){
  424. 'use strict';
  425. var dP = _dereq_('./_object-dp').f;
  426. var create = _dereq_('./_object-create');
  427. var redefineAll = _dereq_('./_redefine-all');
  428. var ctx = _dereq_('./_ctx');
  429. var anInstance = _dereq_('./_an-instance');
  430. var forOf = _dereq_('./_for-of');
  431. var $iterDefine = _dereq_('./_iter-define');
  432. var step = _dereq_('./_iter-step');
  433. var setSpecies = _dereq_('./_set-species');
  434. var DESCRIPTORS = _dereq_('./_descriptors');
  435. var fastKey = _dereq_('./_meta').fastKey;
  436. var validate = _dereq_('./_validate-collection');
  437. var SIZE = DESCRIPTORS ? '_s' : 'size';
  438. var getEntry = function (that, key) {
  439. // fast case
  440. var index = fastKey(key);
  441. var entry;
  442. if (index !== 'F') return that._i[index];
  443. // frozen object case
  444. for (entry = that._f; entry; entry = entry.n) {
  445. if (entry.k == key) return entry;
  446. }
  447. };
  448. module.exports = {
  449. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  450. var C = wrapper(function (that, iterable) {
  451. anInstance(that, C, NAME, '_i');
  452. that._t = NAME; // collection type
  453. that._i = create(null); // index
  454. that._f = undefined; // first entry
  455. that._l = undefined; // last entry
  456. that[SIZE] = 0; // size
  457. if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
  458. });
  459. redefineAll(C.prototype, {
  460. // 23.1.3.1 Map.prototype.clear()
  461. // 23.2.3.2 Set.prototype.clear()
  462. clear: function clear() {
  463. for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
  464. entry.r = true;
  465. if (entry.p) entry.p = entry.p.n = undefined;
  466. delete data[entry.i];
  467. }
  468. that._f = that._l = undefined;
  469. that[SIZE] = 0;
  470. },
  471. // 23.1.3.3 Map.prototype.delete(key)
  472. // 23.2.3.4 Set.prototype.delete(value)
  473. 'delete': function (key) {
  474. var that = validate(this, NAME);
  475. var entry = getEntry(that, key);
  476. if (entry) {
  477. var next = entry.n;
  478. var prev = entry.p;
  479. delete that._i[entry.i];
  480. entry.r = true;
  481. if (prev) prev.n = next;
  482. if (next) next.p = prev;
  483. if (that._f == entry) that._f = next;
  484. if (that._l == entry) that._l = prev;
  485. that[SIZE]--;
  486. } return !!entry;
  487. },
  488. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  489. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  490. forEach: function forEach(callbackfn /* , that = undefined */) {
  491. validate(this, NAME);
  492. var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  493. var entry;
  494. while (entry = entry ? entry.n : this._f) {
  495. f(entry.v, entry.k, this);
  496. // revert to the last existing entry
  497. while (entry && entry.r) entry = entry.p;
  498. }
  499. },
  500. // 23.1.3.7 Map.prototype.has(key)
  501. // 23.2.3.7 Set.prototype.has(value)
  502. has: function has(key) {
  503. return !!getEntry(validate(this, NAME), key);
  504. }
  505. });
  506. if (DESCRIPTORS) dP(C.prototype, 'size', {
  507. get: function () {
  508. return validate(this, NAME)[SIZE];
  509. }
  510. });
  511. return C;
  512. },
  513. def: function (that, key, value) {
  514. var entry = getEntry(that, key);
  515. var prev, index;
  516. // change existing entry
  517. if (entry) {
  518. entry.v = value;
  519. // create new entry
  520. } else {
  521. that._l = entry = {
  522. i: index = fastKey(key, true), // <- index
  523. k: key, // <- key
  524. v: value, // <- value
  525. p: prev = that._l, // <- previous entry
  526. n: undefined, // <- next entry
  527. r: false // <- removed
  528. };
  529. if (!that._f) that._f = entry;
  530. if (prev) prev.n = entry;
  531. that[SIZE]++;
  532. // add to index
  533. if (index !== 'F') that._i[index] = entry;
  534. } return that;
  535. },
  536. getEntry: getEntry,
  537. setStrong: function (C, NAME, IS_MAP) {
  538. // add .keys, .values, .entries, [@@iterator]
  539. // 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
  540. $iterDefine(C, NAME, function (iterated, kind) {
  541. this._t = validate(iterated, NAME); // target
  542. this._k = kind; // kind
  543. this._l = undefined; // previous
  544. }, function () {
  545. var that = this;
  546. var kind = that._k;
  547. var entry = that._l;
  548. // revert to the last existing entry
  549. while (entry && entry.r) entry = entry.p;
  550. // get next entry
  551. if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
  552. // or finish the iteration
  553. that._t = undefined;
  554. return step(1);
  555. }
  556. // return step by kind
  557. if (kind == 'keys') return step(0, entry.k);
  558. if (kind == 'values') return step(0, entry.v);
  559. return step(0, [entry.k, entry.v]);
  560. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  561. // add [@@species], 23.1.2.2, 23.2.2.2
  562. setSpecies(NAME);
  563. }
  564. };
  565. },{"./_an-instance":13,"./_ctx":27,"./_descriptors":29,"./_for-of":34,"./_iter-define":46,"./_iter-step":47,"./_meta":50,"./_object-create":52,"./_object-dp":53,"./_redefine-all":62,"./_set-species":66,"./_validate-collection":79}],24:[function(_dereq_,module,exports){
  566. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  567. var classof = _dereq_('./_classof');
  568. var from = _dereq_('./_array-from-iterable');
  569. module.exports = function (NAME) {
  570. return function toJSON() {
  571. if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
  572. return from(this);
  573. };
  574. };
  575. },{"./_array-from-iterable":15,"./_classof":21}],25:[function(_dereq_,module,exports){
  576. 'use strict';
  577. var global = _dereq_('./_global');
  578. var $export = _dereq_('./_export');
  579. var meta = _dereq_('./_meta');
  580. var fails = _dereq_('./_fails');
  581. var hide = _dereq_('./_hide');
  582. var redefineAll = _dereq_('./_redefine-all');
  583. var forOf = _dereq_('./_for-of');
  584. var anInstance = _dereq_('./_an-instance');
  585. var isObject = _dereq_('./_is-object');
  586. var setToStringTag = _dereq_('./_set-to-string-tag');
  587. var dP = _dereq_('./_object-dp').f;
  588. var each = _dereq_('./_array-methods')(0);
  589. var DESCRIPTORS = _dereq_('./_descriptors');
  590. module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  591. var Base = global[NAME];
  592. var C = Base;
  593. var ADDER = IS_MAP ? 'set' : 'add';
  594. var proto = C && C.prototype;
  595. var O = {};
  596. if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
  597. new C().entries().next();
  598. }))) {
  599. // create collection constructor
  600. C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
  601. redefineAll(C.prototype, methods);
  602. meta.NEED = true;
  603. } else {
  604. C = wrapper(function (target, iterable) {
  605. anInstance(target, C, NAME, '_c');
  606. target._c = new Base();
  607. if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target);
  608. });
  609. each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
  610. var IS_ADDER = KEY == 'add' || KEY == 'set';
  611. if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) {
  612. anInstance(this, C, KEY);
  613. if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
  614. var result = this._c[KEY](a === 0 ? 0 : a, b);
  615. return IS_ADDER ? this : result;
  616. });
  617. });
  618. IS_WEAK || dP(C.prototype, 'size', {
  619. get: function () {
  620. return this._c.size;
  621. }
  622. });
  623. }
  624. setToStringTag(C, NAME);
  625. O[NAME] = C;
  626. $export($export.G + $export.W + $export.F, O);
  627. if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
  628. return C;
  629. };
  630. },{"./_an-instance":13,"./_array-methods":17,"./_descriptors":29,"./_export":32,"./_fails":33,"./_for-of":34,"./_global":35,"./_hide":37,"./_is-object":43,"./_meta":50,"./_object-dp":53,"./_redefine-all":62,"./_set-to-string-tag":67}],26:[function(_dereq_,module,exports){
  631. var core = module.exports = { version: '2.5.7' };
  632. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  633. },{}],27:[function(_dereq_,module,exports){
  634. // optional / simple context binding
  635. var aFunction = _dereq_('./_a-function');
  636. module.exports = function (fn, that, length) {
  637. aFunction(fn);
  638. if (that === undefined) return fn;
  639. switch (length) {
  640. case 1: return function (a) {
  641. return fn.call(that, a);
  642. };
  643. case 2: return function (a, b) {
  644. return fn.call(that, a, b);
  645. };
  646. case 3: return function (a, b, c) {
  647. return fn.call(that, a, b, c);
  648. };
  649. }
  650. return function (/* ...args */) {
  651. return fn.apply(that, arguments);
  652. };
  653. };
  654. },{"./_a-function":11}],28:[function(_dereq_,module,exports){
  655. // 7.2.1 RequireObjectCoercible(argument)
  656. module.exports = function (it) {
  657. if (it == undefined) throw TypeError("Can't call method on " + it);
  658. return it;
  659. };
  660. },{}],29:[function(_dereq_,module,exports){
  661. // Thank's IE8 for his funny defineProperty
  662. module.exports = !_dereq_('./_fails')(function () {
  663. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  664. });
  665. },{"./_fails":33}],30:[function(_dereq_,module,exports){
  666. var isObject = _dereq_('./_is-object');
  667. var document = _dereq_('./_global').document;
  668. // typeof document.createElement is 'object' in old IE
  669. var is = isObject(document) && isObject(document.createElement);
  670. module.exports = function (it) {
  671. return is ? document.createElement(it) : {};
  672. };
  673. },{"./_global":35,"./_is-object":43}],31:[function(_dereq_,module,exports){
  674. // IE 8- don't enum bug keys
  675. module.exports = (
  676. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  677. ).split(',');
  678. },{}],32:[function(_dereq_,module,exports){
  679. var global = _dereq_('./_global');
  680. var core = _dereq_('./_core');
  681. var ctx = _dereq_('./_ctx');
  682. var hide = _dereq_('./_hide');
  683. var has = _dereq_('./_has');
  684. var PROTOTYPE = 'prototype';
  685. var $export = function (type, name, source) {
  686. var IS_FORCED = type & $export.F;
  687. var IS_GLOBAL = type & $export.G;
  688. var IS_STATIC = type & $export.S;
  689. var IS_PROTO = type & $export.P;
  690. var IS_BIND = type & $export.B;
  691. var IS_WRAP = type & $export.W;
  692. var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  693. var expProto = exports[PROTOTYPE];
  694. var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
  695. var key, own, out;
  696. if (IS_GLOBAL) source = name;
  697. for (key in source) {
  698. // contains in native
  699. own = !IS_FORCED && target && target[key] !== undefined;
  700. if (own && has(exports, key)) continue;
  701. // export native or passed
  702. out = own ? target[key] : source[key];
  703. // prevent global pollution for namespaces
  704. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  705. // bind timers to global for call from export context
  706. : IS_BIND && own ? ctx(out, global)
  707. // wrap global constructors for prevent change them in library
  708. : IS_WRAP && target[key] == out ? (function (C) {
  709. var F = function (a, b, c) {
  710. if (this instanceof C) {
  711. switch (arguments.length) {
  712. case 0: return new C();
  713. case 1: return new C(a);
  714. case 2: return new C(a, b);
  715. } return new C(a, b, c);
  716. } return C.apply(this, arguments);
  717. };
  718. F[PROTOTYPE] = C[PROTOTYPE];
  719. return F;
  720. // make static versions for prototype methods
  721. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  722. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  723. if (IS_PROTO) {
  724. (exports.virtual || (exports.virtual = {}))[key] = out;
  725. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  726. if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
  727. }
  728. }
  729. };
  730. // type bitmap
  731. $export.F = 1; // forced
  732. $export.G = 2; // global
  733. $export.S = 4; // static
  734. $export.P = 8; // proto
  735. $export.B = 16; // bind
  736. $export.W = 32; // wrap
  737. $export.U = 64; // safe
  738. $export.R = 128; // real proto method for `library`
  739. module.exports = $export;
  740. },{"./_core":26,"./_ctx":27,"./_global":35,"./_has":36,"./_hide":37}],33:[function(_dereq_,module,exports){
  741. module.exports = function (exec) {
  742. try {
  743. return !!exec();
  744. } catch (e) {
  745. return true;
  746. }
  747. };
  748. },{}],34:[function(_dereq_,module,exports){
  749. var ctx = _dereq_('./_ctx');
  750. var call = _dereq_('./_iter-call');
  751. var isArrayIter = _dereq_('./_is-array-iter');
  752. var anObject = _dereq_('./_an-object');
  753. var toLength = _dereq_('./_to-length');
  754. var getIterFn = _dereq_('./core.get-iterator-method');
  755. var BREAK = {};
  756. var RETURN = {};
  757. var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  758. var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
  759. var f = ctx(fn, that, entries ? 2 : 1);
  760. var index = 0;
  761. var length, step, iterator, result;
  762. if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  763. // fast case for arrays with default iterator
  764. if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
  765. result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  766. if (result === BREAK || result === RETURN) return result;
  767. } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
  768. result = call(iterator, f, step.value, entries);
  769. if (result === BREAK || result === RETURN) return result;
  770. }
  771. };
  772. exports.BREAK = BREAK;
  773. exports.RETURN = RETURN;
  774. },{"./_an-object":14,"./_ctx":27,"./_is-array-iter":41,"./_iter-call":44,"./_to-length":75,"./core.get-iterator-method":81}],35:[function(_dereq_,module,exports){
  775. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  776. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  777. ? window : typeof self != 'undefined' && self.Math == Math ? self
  778. // eslint-disable-next-line no-new-func
  779. : Function('return this')();
  780. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  781. },{}],36:[function(_dereq_,module,exports){
  782. var hasOwnProperty = {}.hasOwnProperty;
  783. module.exports = function (it, key) {
  784. return hasOwnProperty.call(it, key);
  785. };
  786. },{}],37:[function(_dereq_,module,exports){
  787. var dP = _dereq_('./_object-dp');
  788. var createDesc = _dereq_('./_property-desc');
  789. module.exports = _dereq_('./_descriptors') ? function (object, key, value) {
  790. return dP.f(object, key, createDesc(1, value));
  791. } : function (object, key, value) {
  792. object[key] = value;
  793. return object;
  794. };
  795. },{"./_descriptors":29,"./_object-dp":53,"./_property-desc":61}],38:[function(_dereq_,module,exports){
  796. var document = _dereq_('./_global').document;
  797. module.exports = document && document.documentElement;
  798. },{"./_global":35}],39:[function(_dereq_,module,exports){
  799. module.exports = !_dereq_('./_descriptors') && !_dereq_('./_fails')(function () {
  800. return Object.defineProperty(_dereq_('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
  801. });
  802. },{"./_descriptors":29,"./_dom-create":30,"./_fails":33}],40:[function(_dereq_,module,exports){
  803. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  804. var cof = _dereq_('./_cof');
  805. // eslint-disable-next-line no-prototype-builtins
  806. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  807. return cof(it) == 'String' ? it.split('') : Object(it);
  808. };
  809. },{"./_cof":22}],41:[function(_dereq_,module,exports){
  810. // check on default Array iterator
  811. var Iterators = _dereq_('./_iterators');
  812. var ITERATOR = _dereq_('./_wks')('iterator');
  813. var ArrayProto = Array.prototype;
  814. module.exports = function (it) {
  815. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  816. };
  817. },{"./_iterators":48,"./_wks":80}],42:[function(_dereq_,module,exports){
  818. // 7.2.2 IsArray(argument)
  819. var cof = _dereq_('./_cof');
  820. module.exports = Array.isArray || function isArray(arg) {
  821. return cof(arg) == 'Array';
  822. };
  823. },{"./_cof":22}],43:[function(_dereq_,module,exports){
  824. module.exports = function (it) {
  825. return typeof it === 'object' ? it !== null : typeof it === 'function';
  826. };
  827. },{}],44:[function(_dereq_,module,exports){
  828. // call something on iterator step with safe closing on error
  829. var anObject = _dereq_('./_an-object');
  830. module.exports = function (iterator, fn, value, entries) {
  831. try {
  832. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  833. // 7.4.6 IteratorClose(iterator, completion)
  834. } catch (e) {
  835. var ret = iterator['return'];
  836. if (ret !== undefined) anObject(ret.call(iterator));
  837. throw e;
  838. }
  839. };
  840. },{"./_an-object":14}],45:[function(_dereq_,module,exports){
  841. 'use strict';
  842. var create = _dereq_('./_object-create');
  843. var descriptor = _dereq_('./_property-desc');
  844. var setToStringTag = _dereq_('./_set-to-string-tag');
  845. var IteratorPrototype = {};
  846. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  847. _dereq_('./_hide')(IteratorPrototype, _dereq_('./_wks')('iterator'), function () { return this; });
  848. module.exports = function (Constructor, NAME, next) {
  849. Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
  850. setToStringTag(Constructor, NAME + ' Iterator');
  851. };
  852. },{"./_hide":37,"./_object-create":52,"./_property-desc":61,"./_set-to-string-tag":67,"./_wks":80}],46:[function(_dereq_,module,exports){
  853. 'use strict';
  854. var LIBRARY = _dereq_('./_library');
  855. var $export = _dereq_('./_export');
  856. var redefine = _dereq_('./_redefine');
  857. var hide = _dereq_('./_hide');
  858. var Iterators = _dereq_('./_iterators');
  859. var $iterCreate = _dereq_('./_iter-create');
  860. var setToStringTag = _dereq_('./_set-to-string-tag');
  861. var getPrototypeOf = _dereq_('./_object-gpo');
  862. var ITERATOR = _dereq_('./_wks')('iterator');
  863. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  864. var FF_ITERATOR = '@@iterator';
  865. var KEYS = 'keys';
  866. var VALUES = 'values';
  867. var returnThis = function () { return this; };
  868. module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  869. $iterCreate(Constructor, NAME, next);
  870. var getMethod = function (kind) {
  871. if (!BUGGY && kind in proto) return proto[kind];
  872. switch (kind) {
  873. case KEYS: return function keys() { return new Constructor(this, kind); };
  874. case VALUES: return function values() { return new Constructor(this, kind); };
  875. } return function entries() { return new Constructor(this, kind); };
  876. };
  877. var TAG = NAME + ' Iterator';
  878. var DEF_VALUES = DEFAULT == VALUES;
  879. var VALUES_BUG = false;
  880. var proto = Base.prototype;
  881. var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  882. var $default = $native || getMethod(DEFAULT);
  883. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  884. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  885. var methods, key, IteratorPrototype;
  886. // Fix native
  887. if ($anyNative) {
  888. IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
  889. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  890. // Set @@toStringTag to native iterators
  891. setToStringTag(IteratorPrototype, TAG, true);
  892. // fix for some old engines
  893. if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
  894. }
  895. }
  896. // fix Array#{values, @@iterator}.name in V8 / FF
  897. if (DEF_VALUES && $native && $native.name !== VALUES) {
  898. VALUES_BUG = true;
  899. $default = function values() { return $native.call(this); };
  900. }
  901. // Define iterator
  902. if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
  903. hide(proto, ITERATOR, $default);
  904. }
  905. // Plug for library
  906. Iterators[NAME] = $default;
  907. Iterators[TAG] = returnThis;
  908. if (DEFAULT) {
  909. methods = {
  910. values: DEF_VALUES ? $default : getMethod(VALUES),
  911. keys: IS_SET ? $default : getMethod(KEYS),
  912. entries: $entries
  913. };
  914. if (FORCED) for (key in methods) {
  915. if (!(key in proto)) redefine(proto, key, methods[key]);
  916. } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  917. }
  918. return methods;
  919. };
  920. },{"./_export":32,"./_hide":37,"./_iter-create":45,"./_iterators":48,"./_library":49,"./_object-gpo":56,"./_redefine":63,"./_set-to-string-tag":67,"./_wks":80}],47:[function(_dereq_,module,exports){
  921. module.exports = function (done, value) {
  922. return { value: value, done: !!done };
  923. };
  924. },{}],48:[function(_dereq_,module,exports){
  925. module.exports = {};
  926. },{}],49:[function(_dereq_,module,exports){
  927. module.exports = true;
  928. },{}],50:[function(_dereq_,module,exports){
  929. var META = _dereq_('./_uid')('meta');
  930. var isObject = _dereq_('./_is-object');
  931. var has = _dereq_('./_has');
  932. var setDesc = _dereq_('./_object-dp').f;
  933. var id = 0;
  934. var isExtensible = Object.isExtensible || function () {
  935. return true;
  936. };
  937. var FREEZE = !_dereq_('./_fails')(function () {
  938. return isExtensible(Object.preventExtensions({}));
  939. });
  940. var setMeta = function (it) {
  941. setDesc(it, META, { value: {
  942. i: 'O' + ++id, // object ID
  943. w: {} // weak collections IDs
  944. } });
  945. };
  946. var fastKey = function (it, create) {
  947. // return primitive with prefix
  948. if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  949. if (!has(it, META)) {
  950. // can't set metadata to uncaught frozen object
  951. if (!isExtensible(it)) return 'F';
  952. // not necessary to add metadata
  953. if (!create) return 'E';
  954. // add missing metadata
  955. setMeta(it);
  956. // return object ID
  957. } return it[META].i;
  958. };
  959. var getWeak = function (it, create) {
  960. if (!has(it, META)) {
  961. // can't set metadata to uncaught frozen object
  962. if (!isExtensible(it)) return true;
  963. // not necessary to add metadata
  964. if (!create) return false;
  965. // add missing metadata
  966. setMeta(it);
  967. // return hash weak collections IDs
  968. } return it[META].w;
  969. };
  970. // add metadata on freeze-family methods calling
  971. var onFreeze = function (it) {
  972. if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
  973. return it;
  974. };
  975. var meta = module.exports = {
  976. KEY: META,
  977. NEED: false,
  978. fastKey: fastKey,
  979. getWeak: getWeak,
  980. onFreeze: onFreeze
  981. };
  982. },{"./_fails":33,"./_has":36,"./_is-object":43,"./_object-dp":53,"./_uid":78}],51:[function(_dereq_,module,exports){
  983. 'use strict';
  984. // 19.1.2.1 Object.assign(target, source, ...)
  985. var getKeys = _dereq_('./_object-keys');
  986. var gOPS = _dereq_('./_object-gops');
  987. var pIE = _dereq_('./_object-pie');
  988. var toObject = _dereq_('./_to-object');
  989. var IObject = _dereq_('./_iobject');
  990. var $assign = Object.assign;
  991. // should work with symbols and should have deterministic property order (V8 bug)
  992. module.exports = !$assign || _dereq_('./_fails')(function () {
  993. var A = {};
  994. var B = {};
  995. // eslint-disable-next-line no-undef
  996. var S = Symbol();
  997. var K = 'abcdefghijklmnopqrst';
  998. A[S] = 7;
  999. K.split('').forEach(function (k) { B[k] = k; });
  1000. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  1001. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  1002. var T = toObject(target);
  1003. var aLen = arguments.length;
  1004. var index = 1;
  1005. var getSymbols = gOPS.f;
  1006. var isEnum = pIE.f;
  1007. while (aLen > index) {
  1008. var S = IObject(arguments[index++]);
  1009. var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
  1010. var length = keys.length;
  1011. var j = 0;
  1012. var key;
  1013. while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
  1014. } return T;
  1015. } : $assign;
  1016. },{"./_fails":33,"./_iobject":40,"./_object-gops":55,"./_object-keys":58,"./_object-pie":59,"./_to-object":76}],52:[function(_dereq_,module,exports){
  1017. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  1018. var anObject = _dereq_('./_an-object');
  1019. var dPs = _dereq_('./_object-dps');
  1020. var enumBugKeys = _dereq_('./_enum-bug-keys');
  1021. var IE_PROTO = _dereq_('./_shared-key')('IE_PROTO');
  1022. var Empty = function () { /* empty */ };
  1023. var PROTOTYPE = 'prototype';
  1024. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  1025. var createDict = function () {
  1026. // Thrash, waste and sodomy: IE GC bug
  1027. var iframe = _dereq_('./_dom-create')('iframe');
  1028. var i = enumBugKeys.length;
  1029. var lt = '<';
  1030. var gt = '>';
  1031. var iframeDocument;
  1032. iframe.style.display = 'none';
  1033. _dereq_('./_html').appendChild(iframe);
  1034. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  1035. // createDict = iframe.contentWindow.Object;
  1036. // html.removeChild(iframe);
  1037. iframeDocument = iframe.contentWindow.document;
  1038. iframeDocument.open();
  1039. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  1040. iframeDocument.close();
  1041. createDict = iframeDocument.F;
  1042. while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
  1043. return createDict();
  1044. };
  1045. module.exports = Object.create || function create(O, Properties) {
  1046. var result;
  1047. if (O !== null) {
  1048. Empty[PROTOTYPE] = anObject(O);
  1049. result = new Empty();
  1050. Empty[PROTOTYPE] = null;
  1051. // add "__proto__" for Object.getPrototypeOf polyfill
  1052. result[IE_PROTO] = O;
  1053. } else result = createDict();
  1054. return Properties === undefined ? result : dPs(result, Properties);
  1055. };
  1056. },{"./_an-object":14,"./_dom-create":30,"./_enum-bug-keys":31,"./_html":38,"./_object-dps":54,"./_shared-key":68}],53:[function(_dereq_,module,exports){
  1057. var anObject = _dereq_('./_an-object');
  1058. var IE8_DOM_DEFINE = _dereq_('./_ie8-dom-define');
  1059. var toPrimitive = _dereq_('./_to-primitive');
  1060. var dP = Object.defineProperty;
  1061. exports.f = _dereq_('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  1062. anObject(O);
  1063. P = toPrimitive(P, true);
  1064. anObject(Attributes);
  1065. if (IE8_DOM_DEFINE) try {
  1066. return dP(O, P, Attributes);
  1067. } catch (e) { /* empty */ }
  1068. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  1069. if ('value' in Attributes) O[P] = Attributes.value;
  1070. return O;
  1071. };
  1072. },{"./_an-object":14,"./_descriptors":29,"./_ie8-dom-define":39,"./_to-primitive":77}],54:[function(_dereq_,module,exports){
  1073. var dP = _dereq_('./_object-dp');
  1074. var anObject = _dereq_('./_an-object');
  1075. var getKeys = _dereq_('./_object-keys');
  1076. module.exports = _dereq_('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
  1077. anObject(O);
  1078. var keys = getKeys(Properties);
  1079. var length = keys.length;
  1080. var i = 0;
  1081. var P;
  1082. while (length > i) dP.f(O, P = keys[i++], Properties[P]);
  1083. return O;
  1084. };
  1085. },{"./_an-object":14,"./_descriptors":29,"./_object-dp":53,"./_object-keys":58}],55:[function(_dereq_,module,exports){
  1086. exports.f = Object.getOwnPropertySymbols;
  1087. },{}],56:[function(_dereq_,module,exports){
  1088. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  1089. var has = _dereq_('./_has');
  1090. var toObject = _dereq_('./_to-object');
  1091. var IE_PROTO = _dereq_('./_shared-key')('IE_PROTO');
  1092. var ObjectProto = Object.prototype;
  1093. module.exports = Object.getPrototypeOf || function (O) {
  1094. O = toObject(O);
  1095. if (has(O, IE_PROTO)) return O[IE_PROTO];
  1096. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  1097. return O.constructor.prototype;
  1098. } return O instanceof Object ? ObjectProto : null;
  1099. };
  1100. },{"./_has":36,"./_shared-key":68,"./_to-object":76}],57:[function(_dereq_,module,exports){
  1101. var has = _dereq_('./_has');
  1102. var toIObject = _dereq_('./_to-iobject');
  1103. var arrayIndexOf = _dereq_('./_array-includes')(false);
  1104. var IE_PROTO = _dereq_('./_shared-key')('IE_PROTO');
  1105. module.exports = function (object, names) {
  1106. var O = toIObject(object);
  1107. var i = 0;
  1108. var result = [];
  1109. var key;
  1110. for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  1111. // Don't enum bug & hidden keys
  1112. while (names.length > i) if (has(O, key = names[i++])) {
  1113. ~arrayIndexOf(result, key) || result.push(key);
  1114. }
  1115. return result;
  1116. };
  1117. },{"./_array-includes":16,"./_has":36,"./_shared-key":68,"./_to-iobject":74}],58:[function(_dereq_,module,exports){
  1118. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  1119. var $keys = _dereq_('./_object-keys-internal');
  1120. var enumBugKeys = _dereq_('./_enum-bug-keys');
  1121. module.exports = Object.keys || function keys(O) {
  1122. return $keys(O, enumBugKeys);
  1123. };
  1124. },{"./_enum-bug-keys":31,"./_object-keys-internal":57}],59:[function(_dereq_,module,exports){
  1125. exports.f = {}.propertyIsEnumerable;
  1126. },{}],60:[function(_dereq_,module,exports){
  1127. // most Object methods by ES6 should accept primitives
  1128. var $export = _dereq_('./_export');
  1129. var core = _dereq_('./_core');
  1130. var fails = _dereq_('./_fails');
  1131. module.exports = function (KEY, exec) {
  1132. var fn = (core.Object || {})[KEY] || Object[KEY];
  1133. var exp = {};
  1134. exp[KEY] = exec(fn);
  1135. $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
  1136. };
  1137. },{"./_core":26,"./_export":32,"./_fails":33}],61:[function(_dereq_,module,exports){
  1138. module.exports = function (bitmap, value) {
  1139. return {
  1140. enumerable: !(bitmap & 1),
  1141. configurable: !(bitmap & 2),
  1142. writable: !(bitmap & 4),
  1143. value: value
  1144. };
  1145. };
  1146. },{}],62:[function(_dereq_,module,exports){
  1147. var hide = _dereq_('./_hide');
  1148. module.exports = function (target, src, safe) {
  1149. for (var key in src) {
  1150. if (safe && target[key]) target[key] = src[key];
  1151. else hide(target, key, src[key]);
  1152. } return target;
  1153. };
  1154. },{"./_hide":37}],63:[function(_dereq_,module,exports){
  1155. module.exports = _dereq_('./_hide');
  1156. },{"./_hide":37}],64:[function(_dereq_,module,exports){
  1157. 'use strict';
  1158. // https://tc39.github.io/proposal-setmap-offrom/
  1159. var $export = _dereq_('./_export');
  1160. var aFunction = _dereq_('./_a-function');
  1161. var ctx = _dereq_('./_ctx');
  1162. var forOf = _dereq_('./_for-of');
  1163. module.exports = function (COLLECTION) {
  1164. $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
  1165. var mapFn = arguments[1];
  1166. var mapping, A, n, cb;
  1167. aFunction(this);
  1168. mapping = mapFn !== undefined;
  1169. if (mapping) aFunction(mapFn);
  1170. if (source == undefined) return new this();
  1171. A = [];
  1172. if (mapping) {
  1173. n = 0;
  1174. cb = ctx(mapFn, arguments[2], 2);
  1175. forOf(source, false, function (nextItem) {
  1176. A.push(cb(nextItem, n++));
  1177. });
  1178. } else {
  1179. forOf(source, false, A.push, A);
  1180. }
  1181. return new this(A);
  1182. } });
  1183. };
  1184. },{"./_a-function":11,"./_ctx":27,"./_export":32,"./_for-of":34}],65:[function(_dereq_,module,exports){
  1185. 'use strict';
  1186. // https://tc39.github.io/proposal-setmap-offrom/
  1187. var $export = _dereq_('./_export');
  1188. module.exports = function (COLLECTION) {
  1189. $export($export.S, COLLECTION, { of: function of() {
  1190. var length = arguments.length;
  1191. var A = new Array(length);
  1192. while (length--) A[length] = arguments[length];
  1193. return new this(A);
  1194. } });
  1195. };
  1196. },{"./_export":32}],66:[function(_dereq_,module,exports){
  1197. 'use strict';
  1198. var global = _dereq_('./_global');
  1199. var core = _dereq_('./_core');
  1200. var dP = _dereq_('./_object-dp');
  1201. var DESCRIPTORS = _dereq_('./_descriptors');
  1202. var SPECIES = _dereq_('./_wks')('species');
  1203. module.exports = function (KEY) {
  1204. var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
  1205. if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
  1206. configurable: true,
  1207. get: function () { return this; }
  1208. });
  1209. };
  1210. },{"./_core":26,"./_descriptors":29,"./_global":35,"./_object-dp":53,"./_wks":80}],67:[function(_dereq_,module,exports){
  1211. var def = _dereq_('./_object-dp').f;
  1212. var has = _dereq_('./_has');
  1213. var TAG = _dereq_('./_wks')('toStringTag');
  1214. module.exports = function (it, tag, stat) {
  1215. if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
  1216. };
  1217. },{"./_has":36,"./_object-dp":53,"./_wks":80}],68:[function(_dereq_,module,exports){
  1218. var shared = _dereq_('./_shared')('keys');
  1219. var uid = _dereq_('./_uid');
  1220. module.exports = function (key) {
  1221. return shared[key] || (shared[key] = uid(key));
  1222. };
  1223. },{"./_shared":69,"./_uid":78}],69:[function(_dereq_,module,exports){
  1224. var core = _dereq_('./_core');
  1225. var global = _dereq_('./_global');
  1226. var SHARED = '__core-js_shared__';
  1227. var store = global[SHARED] || (global[SHARED] = {});
  1228. (module.exports = function (key, value) {
  1229. return store[key] || (store[key] = value !== undefined ? value : {});
  1230. })('versions', []).push({
  1231. version: core.version,
  1232. mode: _dereq_('./_library') ? 'pure' : 'global',
  1233. copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
  1234. });
  1235. },{"./_core":26,"./_global":35,"./_library":49}],70:[function(_dereq_,module,exports){
  1236. 'use strict';
  1237. var fails = _dereq_('./_fails');
  1238. module.exports = function (method, arg) {
  1239. return !!method && fails(function () {
  1240. // eslint-disable-next-line no-useless-call
  1241. arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);
  1242. });
  1243. };
  1244. },{"./_fails":33}],71:[function(_dereq_,module,exports){
  1245. var toInteger = _dereq_('./_to-integer');
  1246. var defined = _dereq_('./_defined');
  1247. // true -> String#at
  1248. // false -> String#codePointAt
  1249. module.exports = function (TO_STRING) {
  1250. return function (that, pos) {
  1251. var s = String(defined(that));
  1252. var i = toInteger(pos);
  1253. var l = s.length;
  1254. var a, b;
  1255. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  1256. a = s.charCodeAt(i);
  1257. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  1258. ? TO_STRING ? s.charAt(i) : a
  1259. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  1260. };
  1261. };
  1262. },{"./_defined":28,"./_to-integer":73}],72:[function(_dereq_,module,exports){
  1263. var toInteger = _dereq_('./_to-integer');
  1264. var max = Math.max;
  1265. var min = Math.min;
  1266. module.exports = function (index, length) {
  1267. index = toInteger(index);
  1268. return index < 0 ? max(index + length, 0) : min(index, length);
  1269. };
  1270. },{"./_to-integer":73}],73:[function(_dereq_,module,exports){
  1271. // 7.1.4 ToInteger
  1272. var ceil = Math.ceil;
  1273. var floor = Math.floor;
  1274. module.exports = function (it) {
  1275. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  1276. };
  1277. },{}],74:[function(_dereq_,module,exports){
  1278. // to indexed object, toObject with fallback for non-array-like ES3 strings
  1279. var IObject = _dereq_('./_iobject');
  1280. var defined = _dereq_('./_defined');
  1281. module.exports = function (it) {
  1282. return IObject(defined(it));
  1283. };
  1284. },{"./_defined":28,"./_iobject":40}],75:[function(_dereq_,module,exports){
  1285. // 7.1.15 ToLength
  1286. var toInteger = _dereq_('./_to-integer');
  1287. var min = Math.min;
  1288. module.exports = function (it) {
  1289. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  1290. };
  1291. },{"./_to-integer":73}],76:[function(_dereq_,module,exports){
  1292. // 7.1.13 ToObject(argument)
  1293. var defined = _dereq_('./_defined');
  1294. module.exports = function (it) {
  1295. return Object(defined(it));
  1296. };
  1297. },{"./_defined":28}],77:[function(_dereq_,module,exports){
  1298. // 7.1.1 ToPrimitive(input [, PreferredType])
  1299. var isObject = _dereq_('./_is-object');
  1300. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  1301. // and the second argument - flag - preferred type is a string
  1302. module.exports = function (it, S) {
  1303. if (!isObject(it)) return it;
  1304. var fn, val;
  1305. if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  1306. if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  1307. if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  1308. throw TypeError("Can't convert object to primitive value");
  1309. };
  1310. },{"./_is-object":43}],78:[function(_dereq_,module,exports){
  1311. var id = 0;
  1312. var px = Math.random();
  1313. module.exports = function (key) {
  1314. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  1315. };
  1316. },{}],79:[function(_dereq_,module,exports){
  1317. var isObject = _dereq_('./_is-object');
  1318. module.exports = function (it, TYPE) {
  1319. if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  1320. return it;
  1321. };
  1322. },{"./_is-object":43}],80:[function(_dereq_,module,exports){
  1323. var store = _dereq_('./_shared')('wks');
  1324. var uid = _dereq_('./_uid');
  1325. var Symbol = _dereq_('./_global').Symbol;
  1326. var USE_SYMBOL = typeof Symbol == 'function';
  1327. var $exports = module.exports = function (name) {
  1328. return store[name] || (store[name] =
  1329. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  1330. };
  1331. $exports.store = store;
  1332. },{"./_global":35,"./_shared":69,"./_uid":78}],81:[function(_dereq_,module,exports){
  1333. var classof = _dereq_('./_classof');
  1334. var ITERATOR = _dereq_('./_wks')('iterator');
  1335. var Iterators = _dereq_('./_iterators');
  1336. module.exports = _dereq_('./_core').getIteratorMethod = function (it) {
  1337. if (it != undefined) return it[ITERATOR]
  1338. || it['@@iterator']
  1339. || Iterators[classof(it)];
  1340. };
  1341. },{"./_classof":21,"./_core":26,"./_iterators":48,"./_wks":80}],82:[function(_dereq_,module,exports){
  1342. 'use strict';
  1343. var $export = _dereq_('./_export');
  1344. var $filter = _dereq_('./_array-methods')(2);
  1345. $export($export.P + $export.F * !_dereq_('./_strict-method')([].filter, true), 'Array', {
  1346. // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
  1347. filter: function filter(callbackfn /* , thisArg */) {
  1348. return $filter(this, callbackfn, arguments[1]);
  1349. }
  1350. });
  1351. },{"./_array-methods":17,"./_export":32,"./_strict-method":70}],83:[function(_dereq_,module,exports){
  1352. 'use strict';
  1353. var $export = _dereq_('./_export');
  1354. var $forEach = _dereq_('./_array-methods')(0);
  1355. var STRICT = _dereq_('./_strict-method')([].forEach, true);
  1356. $export($export.P + $export.F * !STRICT, 'Array', {
  1357. // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
  1358. forEach: function forEach(callbackfn /* , thisArg */) {
  1359. return $forEach(this, callbackfn, arguments[1]);
  1360. }
  1361. });
  1362. },{"./_array-methods":17,"./_export":32,"./_strict-method":70}],84:[function(_dereq_,module,exports){
  1363. 'use strict';
  1364. var $export = _dereq_('./_export');
  1365. var $indexOf = _dereq_('./_array-includes')(false);
  1366. var $native = [].indexOf;
  1367. var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
  1368. $export($export.P + $export.F * (NEGATIVE_ZERO || !_dereq_('./_strict-method')($native)), 'Array', {
  1369. // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
  1370. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  1371. return NEGATIVE_ZERO
  1372. // convert -0 to +0
  1373. ? $native.apply(this, arguments) || 0
  1374. : $indexOf(this, searchElement, arguments[1]);
  1375. }
  1376. });
  1377. },{"./_array-includes":16,"./_export":32,"./_strict-method":70}],85:[function(_dereq_,module,exports){
  1378. // 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
  1379. var $export = _dereq_('./_export');
  1380. $export($export.S, 'Array', { isArray: _dereq_('./_is-array') });
  1381. },{"./_export":32,"./_is-array":42}],86:[function(_dereq_,module,exports){
  1382. 'use strict';
  1383. var addToUnscopables = _dereq_('./_add-to-unscopables');
  1384. var step = _dereq_('./_iter-step');
  1385. var Iterators = _dereq_('./_iterators');
  1386. var toIObject = _dereq_('./_to-iobject');
  1387. // 22.1.3.4 Array.prototype.entries()
  1388. // 22.1.3.13 Array.prototype.keys()
  1389. // 22.1.3.29 Array.prototype.values()
  1390. // 22.1.3.30 Array.prototype[@@iterator]()
  1391. module.exports = _dereq_('./_iter-define')(Array, 'Array', function (iterated, kind) {
  1392. this._t = toIObject(iterated); // target
  1393. this._i = 0; // next index
  1394. this._k = kind; // kind
  1395. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  1396. }, function () {
  1397. var O = this._t;
  1398. var kind = this._k;
  1399. var index = this._i++;
  1400. if (!O || index >= O.length) {
  1401. this._t = undefined;
  1402. return step(1);
  1403. }
  1404. if (kind == 'keys') return step(0, index);
  1405. if (kind == 'values') return step(0, O[index]);
  1406. return step(0, [index, O[index]]);
  1407. }, 'values');
  1408. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  1409. Iterators.Arguments = Iterators.Array;
  1410. addToUnscopables('keys');
  1411. addToUnscopables('values');
  1412. addToUnscopables('entries');
  1413. },{"./_add-to-unscopables":12,"./_iter-define":46,"./_iter-step":47,"./_iterators":48,"./_to-iobject":74}],87:[function(_dereq_,module,exports){
  1414. 'use strict';
  1415. var $export = _dereq_('./_export');
  1416. var $map = _dereq_('./_array-methods')(1);
  1417. $export($export.P + $export.F * !_dereq_('./_strict-method')([].map, true), 'Array', {
  1418. // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
  1419. map: function map(callbackfn /* , thisArg */) {
  1420. return $map(this, callbackfn, arguments[1]);
  1421. }
  1422. });
  1423. },{"./_array-methods":17,"./_export":32,"./_strict-method":70}],88:[function(_dereq_,module,exports){
  1424. 'use strict';
  1425. var $export = _dereq_('./_export');
  1426. var $reduce = _dereq_('./_array-reduce');
  1427. $export($export.P + $export.F * !_dereq_('./_strict-method')([].reduce, true), 'Array', {
  1428. // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
  1429. reduce: function reduce(callbackfn /* , initialValue */) {
  1430. return $reduce(this, callbackfn, arguments.length, arguments[1], false);
  1431. }
  1432. });
  1433. },{"./_array-reduce":18,"./_export":32,"./_strict-method":70}],89:[function(_dereq_,module,exports){
  1434. 'use strict';
  1435. var strong = _dereq_('./_collection-strong');
  1436. var validate = _dereq_('./_validate-collection');
  1437. var MAP = 'Map';
  1438. // 23.1 Map Objects
  1439. module.exports = _dereq_('./_collection')(MAP, function (get) {
  1440. return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  1441. }, {
  1442. // 23.1.3.6 Map.prototype.get(key)
  1443. get: function get(key) {
  1444. var entry = strong.getEntry(validate(this, MAP), key);
  1445. return entry && entry.v;
  1446. },
  1447. // 23.1.3.9 Map.prototype.set(key, value)
  1448. set: function set(key, value) {
  1449. return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
  1450. }
  1451. }, strong, true);
  1452. },{"./_collection":25,"./_collection-strong":23,"./_validate-collection":79}],90:[function(_dereq_,module,exports){
  1453. // 19.1.3.1 Object.assign(target, source)
  1454. var $export = _dereq_('./_export');
  1455. $export($export.S + $export.F, 'Object', { assign: _dereq_('./_object-assign') });
  1456. },{"./_export":32,"./_object-assign":51}],91:[function(_dereq_,module,exports){
  1457. // 19.1.2.14 Object.keys(O)
  1458. var toObject = _dereq_('./_to-object');
  1459. var $keys = _dereq_('./_object-keys');
  1460. _dereq_('./_object-sap')('keys', function () {
  1461. return function keys(it) {
  1462. return $keys(toObject(it));
  1463. };
  1464. });
  1465. },{"./_object-keys":58,"./_object-sap":60,"./_to-object":76}],92:[function(_dereq_,module,exports){
  1466. },{}],93:[function(_dereq_,module,exports){
  1467. 'use strict';
  1468. var $at = _dereq_('./_string-at')(true);
  1469. // 21.1.3.27 String.prototype[@@iterator]()
  1470. _dereq_('./_iter-define')(String, 'String', function (iterated) {
  1471. this._t = String(iterated); // target
  1472. this._i = 0; // next index
  1473. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  1474. }, function () {
  1475. var O = this._t;
  1476. var index = this._i;
  1477. var point;
  1478. if (index >= O.length) return { value: undefined, done: true };
  1479. point = $at(O, index);
  1480. this._i += point.length;
  1481. return { value: point, done: false };
  1482. });
  1483. },{"./_iter-define":46,"./_string-at":71}],94:[function(_dereq_,module,exports){
  1484. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
  1485. _dereq_('./_set-collection-from')('Map');
  1486. },{"./_set-collection-from":64}],95:[function(_dereq_,module,exports){
  1487. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
  1488. _dereq_('./_set-collection-of')('Map');
  1489. },{"./_set-collection-of":65}],96:[function(_dereq_,module,exports){
  1490. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  1491. var $export = _dereq_('./_export');
  1492. $export($export.P + $export.R, 'Map', { toJSON: _dereq_('./_collection-to-json')('Map') });
  1493. },{"./_collection-to-json":24,"./_export":32}],97:[function(_dereq_,module,exports){
  1494. _dereq_('./es6.array.iterator');
  1495. var global = _dereq_('./_global');
  1496. var hide = _dereq_('./_hide');
  1497. var Iterators = _dereq_('./_iterators');
  1498. var TO_STRING_TAG = _dereq_('./_wks')('toStringTag');
  1499. var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  1500. 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  1501. 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  1502. 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  1503. 'TextTrackList,TouchList').split(',');
  1504. for (var i = 0; i < DOMIterables.length; i++) {
  1505. var NAME = DOMIterables[i];
  1506. var Collection = global[NAME];
  1507. var proto = Collection && Collection.prototype;
  1508. if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
  1509. Iterators[NAME] = Iterators.Array;
  1510. }
  1511. },{"./_global":35,"./_hide":37,"./_iterators":48,"./_wks":80,"./es6.array.iterator":86}],98:[function(_dereq_,module,exports){
  1512. var pSlice = Array.prototype.slice;
  1513. var objectKeys = _dereq_('./lib/keys.js');
  1514. var isArguments = _dereq_('./lib/is_arguments.js');
  1515. var deepEqual = module.exports = function (actual, expected, opts) {
  1516. if (!opts) opts = {};
  1517. // 7.1. All identical values are equivalent, as determined by ===.
  1518. if (actual === expected) {
  1519. return true;
  1520. } else if (actual instanceof Date && expected instanceof Date) {
  1521. return actual.getTime() === expected.getTime();
  1522. // 7.3. Other pairs that do not both pass typeof value == 'object',
  1523. // equivalence is determined by ==.
  1524. } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
  1525. return opts.strict ? actual === expected : actual == expected;
  1526. // 7.4. For all other Object pairs, including Array objects, equivalence is
  1527. // determined by having the same number of owned properties (as verified
  1528. // with Object.prototype.hasOwnProperty.call), the same set of keys
  1529. // (although not necessarily the same order), equivalent values for every
  1530. // corresponding key, and an identical 'prototype' property. Note: this
  1531. // accounts for both named and indexed properties on Arrays.
  1532. } else {
  1533. return objEquiv(actual, expected, opts);
  1534. }
  1535. }
  1536. function isUndefinedOrNull(value) {
  1537. return value === null || value === undefined;
  1538. }
  1539. function isBuffer (x) {
  1540. if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
  1541. if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
  1542. return false;
  1543. }
  1544. if (x.length > 0 && typeof x[0] !== 'number') return false;
  1545. return true;
  1546. }
  1547. function objEquiv(a, b, opts) {
  1548. var i, key;
  1549. if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
  1550. return false;
  1551. // an identical 'prototype' property.
  1552. if (a.prototype !== b.prototype) return false;
  1553. //~~~I've managed to break Object.keys through screwy arguments passing.
  1554. // Converting to array solves the problem.
  1555. if (isArguments(a)) {
  1556. if (!isArguments(b)) {
  1557. return false;
  1558. }
  1559. a = pSlice.call(a);
  1560. b = pSlice.call(b);
  1561. return deepEqual(a, b, opts);
  1562. }
  1563. if (isBuffer(a)) {
  1564. if (!isBuffer(b)) {
  1565. return false;
  1566. }
  1567. if (a.length !== b.length) return false;
  1568. for (i = 0; i < a.length; i++) {
  1569. if (a[i] !== b[i]) return false;
  1570. }
  1571. return true;
  1572. }
  1573. try {
  1574. var ka = objectKeys(a),
  1575. kb = objectKeys(b);
  1576. } catch (e) {//happens when one is a string literal and the other isn't
  1577. return false;
  1578. }
  1579. // having the same number of owned properties (keys incorporates
  1580. // hasOwnProperty)
  1581. if (ka.length != kb.length)
  1582. return false;
  1583. //the same set of keys (although not necessarily the same order),
  1584. ka.sort();
  1585. kb.sort();
  1586. //~~~cheap key test
  1587. for (i = ka.length - 1; i >= 0; i--) {
  1588. if (ka[i] != kb[i])
  1589. return false;
  1590. }
  1591. //equivalent values for every corresponding key, and
  1592. //~~~possibly expensive deep test
  1593. for (i = ka.length - 1; i >= 0; i--) {
  1594. key = ka[i];
  1595. if (!deepEqual(a[key], b[key], opts)) return false;
  1596. }
  1597. return typeof a === typeof b;
  1598. }
  1599. },{"./lib/is_arguments.js":99,"./lib/keys.js":100}],99:[function(_dereq_,module,exports){
  1600. var supportsArgumentsClass = (function(){
  1601. return Object.prototype.toString.call(arguments)
  1602. })() == '[object Arguments]';
  1603. exports = module.exports = supportsArgumentsClass ? supported : unsupported;
  1604. exports.supported = supported;
  1605. function supported(object) {
  1606. return Object.prototype.toString.call(object) == '[object Arguments]';
  1607. };
  1608. exports.unsupported = unsupported;
  1609. function unsupported(object){
  1610. return object &&
  1611. typeof object == 'object' &&
  1612. typeof object.length == 'number' &&
  1613. Object.prototype.hasOwnProperty.call(object, 'callee') &&
  1614. !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
  1615. false;
  1616. };
  1617. },{}],100:[function(_dereq_,module,exports){
  1618. exports = module.exports = typeof Object.keys === 'function'
  1619. ? Object.keys : shim;
  1620. exports.shim = shim;
  1621. function shim (obj) {
  1622. var keys = [];
  1623. for (var key in obj) keys.push(key);
  1624. return keys;
  1625. }
  1626. },{}],101:[function(_dereq_,module,exports){
  1627. /**
  1628. * espurify - Clone new AST without extra properties
  1629. *
  1630. * https://github.com/estools/espurify
  1631. *
  1632. * Copyright (c) 2014-2018 Takuto Wada
  1633. * Licensed under the MIT license.
  1634. * https://github.com/estools/espurify/blob/master/MIT-LICENSE.txt
  1635. */
  1636. 'use strict';
  1637. var createWhitelist = _dereq_('./lib/create-whitelist');
  1638. var cloneWithWhitelist = _dereq_('./lib/clone-ast');
  1639. function createCloneFunction (options) {
  1640. return cloneWithWhitelist(createWhitelist(options));
  1641. }
  1642. var espurify = createCloneFunction();
  1643. espurify.customize = createCloneFunction;
  1644. espurify.cloneWithWhitelist = cloneWithWhitelist;
  1645. module.exports = espurify;
  1646. },{"./lib/clone-ast":103,"./lib/create-whitelist":104}],102:[function(_dereq_,module,exports){
  1647. module.exports = {
  1648. ArrayExpression: ['type', 'elements'],
  1649. ArrayPattern: ['type', 'elements'],
  1650. ArrowFunctionExpression: ['type', 'id', 'params', 'body', 'generator', 'expression', 'async'],
  1651. AssignmentExpression: ['type', 'operator', 'left', 'right'],
  1652. AssignmentPattern: ['type', 'left', 'right'],
  1653. AwaitExpression: ['type', 'argument'],
  1654. BinaryExpression: ['type', 'operator', 'left', 'right'],
  1655. BlockStatement: ['type', 'body'],
  1656. BreakStatement: ['type', 'label'],
  1657. CallExpression: ['type', 'callee', 'arguments'],
  1658. CatchClause: ['type', 'param', 'guard', 'body'],
  1659. ClassBody: ['type', 'body'],
  1660. ClassDeclaration: ['type', 'id', 'superClass', 'body'],
  1661. ClassExpression: ['type', 'id', 'superClass', 'body'],
  1662. ConditionalExpression: ['type', 'test', 'consequent', 'alternate'],
  1663. ContinueStatement: ['type', 'label'],
  1664. DebuggerStatement: ['type'],
  1665. DoWhileStatement: ['type', 'body', 'test'],
  1666. EmptyStatement: ['type'],
  1667. ExportAllDeclaration: ['type', 'source'],
  1668. ExportDefaultDeclaration: ['type', 'declaration'],
  1669. ExportNamedDeclaration: ['type', 'declaration', 'specifiers', 'source'],
  1670. ExportSpecifier: ['type', 'exported', 'local'],
  1671. ExpressionStatement: ['type', 'expression'],
  1672. ForInStatement: ['type', 'left', 'right', 'body'],
  1673. ForOfStatement: ['type', 'left', 'right', 'body', 'await'],
  1674. ForStatement: ['type', 'init', 'test', 'update', 'body'],
  1675. FunctionDeclaration: ['type', 'id', 'params', 'body', 'generator', 'async'],
  1676. FunctionExpression: ['type', 'id', 'params', 'body', 'generator', 'async'],
  1677. Identifier: ['type', 'name'],
  1678. IfStatement: ['type', 'test', 'consequent', 'alternate'],
  1679. ImportDeclaration: ['type', 'specifiers', 'source'],
  1680. ImportDefaultSpecifier: ['type', 'local'],
  1681. ImportNamespaceSpecifier: ['type', 'local'],
  1682. ImportSpecifier: ['type', 'imported', 'local'],
  1683. LabeledStatement: ['type', 'label', 'body'],
  1684. Literal: ['type', 'value', 'regex'],
  1685. LogicalExpression: ['type', 'operator', 'left', 'right'],
  1686. MemberExpression: ['type', 'object', 'property', 'computed'],
  1687. MetaProperty: ['type', 'meta', 'property'],
  1688. MethodDefinition: ['type', 'key', 'value', 'kind', 'computed', 'static'],
  1689. NewExpression: ['type', 'callee', 'arguments'],
  1690. ObjectExpression: ['type', 'properties'],
  1691. ObjectPattern: ['type', 'properties'],
  1692. Program: ['type', 'body', 'sourceType'],
  1693. Property: ['type', 'key', 'value', 'kind', 'method', 'shorthand', 'computed'],
  1694. RestElement: ['type', 'argument'],
  1695. ReturnStatement: ['type', 'argument'],
  1696. SequenceExpression: ['type', 'expressions'],
  1697. SpreadElement: ['type', 'argument'],
  1698. Super: ['type'],
  1699. SwitchCase: ['type', 'test', 'consequent'],
  1700. SwitchStatement: ['type', 'discriminant', 'cases', 'lexical'],
  1701. TaggedTemplateExpression: ['type', 'tag', 'quasi'],
  1702. TemplateElement: ['type', 'tail', 'value'],
  1703. TemplateLiteral: ['type', 'quasis', 'expressions'],
  1704. ThisExpression: ['type'],
  1705. ThrowStatement: ['type', 'argument'],
  1706. TryStatement: ['type', 'block', 'handler', 'finalizer'],
  1707. UnaryExpression: ['type', 'operator', 'prefix', 'argument'],
  1708. UpdateExpression: ['type', 'operator', 'argument', 'prefix'],
  1709. VariableDeclaration: ['type', 'declarations', 'kind'],
  1710. VariableDeclarator: ['type', 'id', 'init'],
  1711. WhileStatement: ['type', 'test', 'body'],
  1712. WithStatement: ['type', 'object', 'body'],
  1713. YieldExpression: ['type', 'argument', 'delegate']
  1714. };
  1715. },{}],103:[function(_dereq_,module,exports){
  1716. 'use strict';
  1717. var isArray = _dereq_('core-js/library/fn/array/is-array');
  1718. var objectKeys = _dereq_('core-js/library/fn/object/keys');
  1719. var indexOf = _dereq_('core-js/library/fn/array/index-of');
  1720. var Map = _dereq_('core-js/library/fn/map');
  1721. var reduce = _dereq_('core-js/library/fn/array/reduce');
  1722. module.exports = function cloneWithWhitelist (astWhiteList) {
  1723. var whitelist = reduce(objectKeys(astWhiteList), function (props, key) {
  1724. var propNames = astWhiteList[key];
  1725. var prepend = (indexOf(propNames, 'type') === -1) ? ['type'] : [];
  1726. props[key] = prepend.concat(propNames || []);
  1727. return props;
  1728. }, {});
  1729. function cloneNodeOrObject (obj, seen) {
  1730. var props = obj.type ? whitelist[obj.type] : null;
  1731. if (props) {
  1732. return cloneNode(obj, props, seen);
  1733. } else {
  1734. return cloneObject(obj, seen);
  1735. }
  1736. }
  1737. function cloneArray (ary, seen) {
  1738. var i = ary.length;
  1739. var clone = [];
  1740. while (i--) {
  1741. clone[i] = cloneOf(ary[i], seen);
  1742. }
  1743. return clone;
  1744. }
  1745. function cloneNode (node, props, seen) {
  1746. var i, len, key;
  1747. var clone = {};
  1748. for (i = 0, len = props.length; i < len; i += 1) {
  1749. key = props[i];
  1750. if (node.hasOwnProperty(key)) {
  1751. clone[key] = cloneOf(node[key], seen);
  1752. }
  1753. }
  1754. return clone;
  1755. }
  1756. function cloneObject (obj, seen) {
  1757. var props = objectKeys(obj);
  1758. var i, len, key, value;
  1759. var clone = {};
  1760. for (i = 0, len = props.length; i < len; i += 1) {
  1761. key = props[i];
  1762. value = obj[key];
  1763. if (seen.has(value)) {
  1764. continue;
  1765. }
  1766. clone[key] = cloneOf(value, seen);
  1767. }
  1768. return clone;
  1769. }
  1770. function cloneOf (val, seen) {
  1771. if (typeof val === 'object' && val !== null) {
  1772. seen.set(val, true);
  1773. if (val instanceof RegExp) {
  1774. return new RegExp(val);
  1775. } else if (isArray(val)) {
  1776. return cloneArray(val, seen);
  1777. } else {
  1778. return cloneNodeOrObject(val, seen);
  1779. }
  1780. } else {
  1781. return val;
  1782. }
  1783. }
  1784. function cloneRoot (obj) {
  1785. var seen = new Map();
  1786. seen.set(obj, true);
  1787. return cloneNodeOrObject(obj, seen);
  1788. }
  1789. return cloneRoot;
  1790. };
  1791. },{"core-js/library/fn/array/index-of":4,"core-js/library/fn/array/is-array":5,"core-js/library/fn/array/reduce":7,"core-js/library/fn/map":8,"core-js/library/fn/object/keys":10}],104:[function(_dereq_,module,exports){
  1792. 'use strict';
  1793. var defaultProps = _dereq_('./ast-properties');
  1794. var objectKeys = _dereq_('core-js/library/fn/object/keys');
  1795. var assign = _dereq_('core-js/library/fn/object/assign');
  1796. module.exports = function createWhitelist (options) {
  1797. var opts = assign({}, options);
  1798. var typeName, i, len;
  1799. var keys = objectKeys(defaultProps);
  1800. var result = {};
  1801. for (i = 0, len = keys.length; i < len; i += 1) {
  1802. typeName = keys[i];
  1803. result[typeName] = defaultProps[typeName].concat(opts.extra || []);
  1804. }
  1805. return result;
  1806. };
  1807. },{"./ast-properties":102,"core-js/library/fn/object/assign":9,"core-js/library/fn/object/keys":10}],105:[function(_dereq_,module,exports){
  1808. /*
  1809. Copyright (C) 2012-2013 Yusuke Suzuki <utatane.tea@gmail.com>
  1810. Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
  1811. Redistribution and use in source and binary forms, with or without
  1812. modification, are permitted provided that the following conditions are met:
  1813. * Redistributions of source code must retain the above copyright
  1814. notice, this list of conditions and the following disclaimer.
  1815. * Redistributions in binary form must reproduce the above copyright
  1816. notice, this list of conditions and the following disclaimer in the
  1817. documentation and/or other materials provided with the distribution.
  1818. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  1819. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1820. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1821. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  1822. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  1823. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  1824. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  1825. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1826. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  1827. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1828. */
  1829. /*jslint vars:false, bitwise:true*/
  1830. /*jshint indent:4*/
  1831. /*global exports:true*/
  1832. (function clone(exports) {
  1833. 'use strict';
  1834. var Syntax,
  1835. isArray,
  1836. VisitorOption,
  1837. VisitorKeys,
  1838. objectCreate,
  1839. objectKeys,
  1840. BREAK,
  1841. SKIP,
  1842. REMOVE;
  1843. function ignoreJSHintError() { }
  1844. isArray = Array.isArray;
  1845. if (!isArray) {
  1846. isArray = function isArray(array) {
  1847. return Object.prototype.toString.call(array) === '[object Array]';
  1848. };
  1849. }
  1850. function deepCopy(obj) {
  1851. var ret = {}, key, val;
  1852. for (key in obj) {
  1853. if (obj.hasOwnProperty(key)) {
  1854. val = obj[key];
  1855. if (typeof val === 'object' && val !== null) {
  1856. ret[key] = deepCopy(val);
  1857. } else {
  1858. ret[key] = val;
  1859. }
  1860. }
  1861. }
  1862. return ret;
  1863. }
  1864. function shallowCopy(obj) {
  1865. var ret = {}, key;
  1866. for (key in obj) {
  1867. if (obj.hasOwnProperty(key)) {
  1868. ret[key] = obj[key];
  1869. }
  1870. }
  1871. return ret;
  1872. }
  1873. ignoreJSHintError(shallowCopy);
  1874. // based on LLVM libc++ upper_bound / lower_bound
  1875. // MIT License
  1876. function upperBound(array, func) {
  1877. var diff, len, i, current;
  1878. len = array.length;
  1879. i = 0;
  1880. while (len) {
  1881. diff = len >>> 1;
  1882. current = i + diff;
  1883. if (func(array[current])) {
  1884. len = diff;
  1885. } else {
  1886. i = current + 1;
  1887. len -= diff + 1;
  1888. }
  1889. }
  1890. return i;
  1891. }
  1892. function lowerBound(array, func) {
  1893. var diff, len, i, current;
  1894. len = array.length;
  1895. i = 0;
  1896. while (len) {
  1897. diff = len >>> 1;
  1898. current = i + diff;
  1899. if (func(array[current])) {
  1900. i = current + 1;
  1901. len -= diff + 1;
  1902. } else {
  1903. len = diff;
  1904. }
  1905. }
  1906. return i;
  1907. }
  1908. ignoreJSHintError(lowerBound);
  1909. objectCreate = Object.create || (function () {
  1910. function F() { }
  1911. return function (o) {
  1912. F.prototype = o;
  1913. return new F();
  1914. };
  1915. })();
  1916. objectKeys = Object.keys || function (o) {
  1917. var keys = [], key;
  1918. for (key in o) {
  1919. keys.push(key);
  1920. }
  1921. return keys;
  1922. };
  1923. function extend(to, from) {
  1924. var keys = objectKeys(from), key, i, len;
  1925. for (i = 0, len = keys.length; i < len; i += 1) {
  1926. key = keys[i];
  1927. to[key] = from[key];
  1928. }
  1929. return to;
  1930. }
  1931. Syntax = {
  1932. AssignmentExpression: 'AssignmentExpression',
  1933. AssignmentPattern: 'AssignmentPattern',
  1934. ArrayExpression: 'ArrayExpression',
  1935. ArrayPattern: 'ArrayPattern',
  1936. ArrowFunctionExpression: 'ArrowFunctionExpression',
  1937. AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.
  1938. BlockStatement: 'BlockStatement',
  1939. BinaryExpression: 'BinaryExpression',
  1940. BreakStatement: 'BreakStatement',
  1941. CallExpression: 'CallExpression',
  1942. CatchClause: 'CatchClause',
  1943. ClassBody: 'ClassBody',
  1944. ClassDeclaration: 'ClassDeclaration',
  1945. ClassExpression: 'ClassExpression',
  1946. ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7.
  1947. ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7.
  1948. ConditionalExpression: 'ConditionalExpression',
  1949. ContinueStatement: 'ContinueStatement',
  1950. DebuggerStatement: 'DebuggerStatement',
  1951. DirectiveStatement: 'DirectiveStatement',
  1952. DoWhileStatement: 'DoWhileStatement',
  1953. EmptyStatement: 'EmptyStatement',
  1954. ExportAllDeclaration: 'ExportAllDeclaration',
  1955. ExportDefaultDeclaration: 'ExportDefaultDeclaration',
  1956. ExportNamedDeclaration: 'ExportNamedDeclaration',
  1957. ExportSpecifier: 'ExportSpecifier',
  1958. ExpressionStatement: 'ExpressionStatement',
  1959. ForStatement: 'ForStatement',
  1960. ForInStatement: 'ForInStatement',
  1961. ForOfStatement: 'ForOfStatement',
  1962. FunctionDeclaration: 'FunctionDeclaration',
  1963. FunctionExpression: 'FunctionExpression',
  1964. GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.
  1965. Identifier: 'Identifier',
  1966. IfStatement: 'IfStatement',
  1967. ImportDeclaration: 'ImportDeclaration',
  1968. ImportDefaultSpecifier: 'ImportDefaultSpecifier',
  1969. ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
  1970. ImportSpecifier: 'ImportSpecifier',
  1971. Literal: 'Literal',
  1972. LabeledStatement: 'LabeledStatement',
  1973. LogicalExpression: 'LogicalExpression',
  1974. MemberExpression: 'MemberExpression',
  1975. MetaProperty: 'MetaProperty',
  1976. MethodDefinition: 'MethodDefinition',
  1977. ModuleSpecifier: 'ModuleSpecifier',
  1978. NewExpression: 'NewExpression',
  1979. ObjectExpression: 'ObjectExpression',
  1980. ObjectPattern: 'ObjectPattern',
  1981. Program: 'Program',
  1982. Property: 'Property',
  1983. RestElement: 'RestElement',
  1984. ReturnStatement: 'ReturnStatement',
  1985. SequenceExpression: 'SequenceExpression',
  1986. SpreadElement: 'SpreadElement',
  1987. Super: 'Super',
  1988. SwitchStatement: 'SwitchStatement',
  1989. SwitchCase: 'SwitchCase',
  1990. TaggedTemplateExpression: 'TaggedTemplateExpression',
  1991. TemplateElement: 'TemplateElement',
  1992. TemplateLiteral: 'TemplateLiteral',
  1993. ThisExpression: 'ThisExpression',
  1994. ThrowStatement: 'ThrowStatement',
  1995. TryStatement: 'TryStatement',
  1996. UnaryExpression: 'UnaryExpression',
  1997. UpdateExpression: 'UpdateExpression',
  1998. VariableDeclaration: 'VariableDeclaration',
  1999. VariableDeclarator: 'VariableDeclarator',
  2000. WhileStatement: 'WhileStatement',
  2001. WithStatement: 'WithStatement',
  2002. YieldExpression: 'YieldExpression'
  2003. };
  2004. VisitorKeys = {
  2005. AssignmentExpression: ['left', 'right'],
  2006. AssignmentPattern: ['left', 'right'],
  2007. ArrayExpression: ['elements'],
  2008. ArrayPattern: ['elements'],
  2009. ArrowFunctionExpression: ['params', 'body'],
  2010. AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7.
  2011. BlockStatement: ['body'],
  2012. BinaryExpression: ['left', 'right'],
  2013. BreakStatement: ['label'],
  2014. CallExpression: ['callee', 'arguments'],
  2015. CatchClause: ['param', 'body'],
  2016. ClassBody: ['body'],
  2017. ClassDeclaration: ['id', 'superClass', 'body'],
  2018. ClassExpression: ['id', 'superClass', 'body'],
  2019. ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7.
  2020. ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
  2021. ConditionalExpression: ['test', 'consequent', 'alternate'],
  2022. ContinueStatement: ['label'],
  2023. DebuggerStatement: [],
  2024. DirectiveStatement: [],
  2025. DoWhileStatement: ['body', 'test'],
  2026. EmptyStatement: [],
  2027. ExportAllDeclaration: ['source'],
  2028. ExportDefaultDeclaration: ['declaration'],
  2029. ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
  2030. ExportSpecifier: ['exported', 'local'],
  2031. ExpressionStatement: ['expression'],
  2032. ForStatement: ['init', 'test', 'update', 'body'],
  2033. ForInStatement: ['left', 'right', 'body'],
  2034. ForOfStatement: ['left', 'right', 'body'],
  2035. FunctionDeclaration: ['id', 'params', 'body'],
  2036. FunctionExpression: ['id', 'params', 'body'],
  2037. GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
  2038. Identifier: [],
  2039. IfStatement: ['test', 'consequent', 'alternate'],
  2040. ImportDeclaration: ['specifiers', 'source'],
  2041. ImportDefaultSpecifier: ['local'],
  2042. ImportNamespaceSpecifier: ['local'],
  2043. ImportSpecifier: ['imported', 'local'],
  2044. Literal: [],
  2045. LabeledStatement: ['label', 'body'],
  2046. LogicalExpression: ['left', 'right'],
  2047. MemberExpression: ['object', 'property'],
  2048. MetaProperty: ['meta', 'property'],
  2049. MethodDefinition: ['key', 'value'],
  2050. ModuleSpecifier: [],
  2051. NewExpression: ['callee', 'arguments'],
  2052. ObjectExpression: ['properties'],
  2053. ObjectPattern: ['properties'],
  2054. Program: ['body'],
  2055. Property: ['key', 'value'],
  2056. RestElement: [ 'argument' ],
  2057. ReturnStatement: ['argument'],
  2058. SequenceExpression: ['expressions'],
  2059. SpreadElement: ['argument'],
  2060. Super: [],
  2061. SwitchStatement: ['discriminant', 'cases'],
  2062. SwitchCase: ['test', 'consequent'],
  2063. TaggedTemplateExpression: ['tag', 'quasi'],
  2064. TemplateElement: [],
  2065. TemplateLiteral: ['quasis', 'expressions'],
  2066. ThisExpression: [],
  2067. ThrowStatement: ['argument'],
  2068. TryStatement: ['block', 'handler', 'finalizer'],
  2069. UnaryExpression: ['argument'],
  2070. UpdateExpression: ['argument'],
  2071. VariableDeclaration: ['declarations'],
  2072. VariableDeclarator: ['id', 'init'],
  2073. WhileStatement: ['test', 'body'],
  2074. WithStatement: ['object', 'body'],
  2075. YieldExpression: ['argument']
  2076. };
  2077. // unique id
  2078. BREAK = {};
  2079. SKIP = {};
  2080. REMOVE = {};
  2081. VisitorOption = {
  2082. Break: BREAK,
  2083. Skip: SKIP,
  2084. Remove: REMOVE
  2085. };
  2086. function Reference(parent, key) {
  2087. this.parent = parent;
  2088. this.key = key;
  2089. }
  2090. Reference.prototype.replace = function replace(node) {
  2091. this.parent[this.key] = node;
  2092. };
  2093. Reference.prototype.remove = function remove() {
  2094. if (isArray(this.parent)) {
  2095. this.parent.splice(this.key, 1);
  2096. return true;
  2097. } else {
  2098. this.replace(null);
  2099. return false;
  2100. }
  2101. };
  2102. function Element(node, path, wrap, ref) {
  2103. this.node = node;
  2104. this.path = path;
  2105. this.wrap = wrap;
  2106. this.ref = ref;
  2107. }
  2108. function Controller() { }
  2109. // API:
  2110. // return property path array from root to current node
  2111. Controller.prototype.path = function path() {
  2112. var i, iz, j, jz, result, element;
  2113. function addToPath(result, path) {
  2114. if (isArray(path)) {
  2115. for (j = 0, jz = path.length; j < jz; ++j) {
  2116. result.push(path[j]);
  2117. }
  2118. } else {
  2119. result.push(path);
  2120. }
  2121. }
  2122. // root node
  2123. if (!this.__current.path) {
  2124. return null;
  2125. }
  2126. // first node is sentinel, second node is root element
  2127. result = [];
  2128. for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {
  2129. element = this.__leavelist[i];
  2130. addToPath(result, element.path);
  2131. }
  2132. addToPath(result, this.__current.path);
  2133. return result;
  2134. };
  2135. // API:
  2136. // return type of current node
  2137. Controller.prototype.type = function () {
  2138. var node = this.current();
  2139. return node.type || this.__current.wrap;
  2140. };
  2141. // API:
  2142. // return array of parent elements
  2143. Controller.prototype.parents = function parents() {
  2144. var i, iz, result;
  2145. // first node is sentinel
  2146. result = [];
  2147. for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {
  2148. result.push(this.__leavelist[i].node);
  2149. }
  2150. return result;
  2151. };
  2152. // API:
  2153. // return current node
  2154. Controller.prototype.current = function current() {
  2155. return this.__current.node;
  2156. };
  2157. Controller.prototype.__execute = function __execute(callback, element) {
  2158. var previous, result;
  2159. result = undefined;
  2160. previous = this.__current;
  2161. this.__current = element;
  2162. this.__state = null;
  2163. if (callback) {
  2164. result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);
  2165. }
  2166. this.__current = previous;
  2167. return result;
  2168. };
  2169. // API:
  2170. // notify control skip / break
  2171. Controller.prototype.notify = function notify(flag) {
  2172. this.__state = flag;
  2173. };
  2174. // API:
  2175. // skip child nodes of current node
  2176. Controller.prototype.skip = function () {
  2177. this.notify(SKIP);
  2178. };
  2179. // API:
  2180. // break traversals
  2181. Controller.prototype['break'] = function () {
  2182. this.notify(BREAK);
  2183. };
  2184. // API:
  2185. // remove node
  2186. Controller.prototype.remove = function () {
  2187. this.notify(REMOVE);
  2188. };
  2189. Controller.prototype.__initialize = function(root, visitor) {
  2190. this.visitor = visitor;
  2191. this.root = root;
  2192. this.__worklist = [];
  2193. this.__leavelist = [];
  2194. this.__current = null;
  2195. this.__state = null;
  2196. this.__fallback = null;
  2197. if (visitor.fallback === 'iteration') {
  2198. this.__fallback = objectKeys;
  2199. } else if (typeof visitor.fallback === 'function') {
  2200. this.__fallback = visitor.fallback;
  2201. }
  2202. this.__keys = VisitorKeys;
  2203. if (visitor.keys) {
  2204. this.__keys = extend(objectCreate(this.__keys), visitor.keys);
  2205. }
  2206. };
  2207. function isNode(node) {
  2208. if (node == null) {
  2209. return false;
  2210. }
  2211. return typeof node === 'object' && typeof node.type === 'string';
  2212. }
  2213. function isProperty(nodeType, key) {
  2214. return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;
  2215. }
  2216. Controller.prototype.traverse = function traverse(root, visitor) {
  2217. var worklist,
  2218. leavelist,
  2219. element,
  2220. node,
  2221. nodeType,
  2222. ret,
  2223. key,
  2224. current,
  2225. current2,
  2226. candidates,
  2227. candidate,
  2228. sentinel;
  2229. this.__initialize(root, visitor);
  2230. sentinel = {};
  2231. // reference
  2232. worklist = this.__worklist;
  2233. leavelist = this.__leavelist;
  2234. // initialize
  2235. worklist.push(new Element(root, null, null, null));
  2236. leavelist.push(new Element(null, null, null, null));
  2237. while (worklist.length) {
  2238. element = worklist.pop();
  2239. if (element === sentinel) {
  2240. element = leavelist.pop();
  2241. ret = this.__execute(visitor.leave, element);
  2242. if (this.__state === BREAK || ret === BREAK) {
  2243. return;
  2244. }
  2245. continue;
  2246. }
  2247. if (element.node) {
  2248. ret = this.__execute(visitor.enter, element);
  2249. if (this.__state === BREAK || ret === BREAK) {
  2250. return;
  2251. }
  2252. worklist.push(sentinel);
  2253. leavelist.push(element);
  2254. if (this.__state === SKIP || ret === SKIP) {
  2255. continue;
  2256. }
  2257. node = element.node;
  2258. nodeType = node.type || element.wrap;
  2259. candidates = this.__keys[nodeType];
  2260. if (!candidates) {
  2261. if (this.__fallback) {
  2262. candidates = this.__fallback(node);
  2263. } else {
  2264. throw new Error('Unknown node type ' + nodeType + '.');
  2265. }
  2266. }
  2267. current = candidates.length;
  2268. while ((current -= 1) >= 0) {
  2269. key = candidates[current];
  2270. candidate = node[key];
  2271. if (!candidate) {
  2272. continue;
  2273. }
  2274. if (isArray(candidate)) {
  2275. current2 = candidate.length;
  2276. while ((current2 -= 1) >= 0) {
  2277. if (!candidate[current2]) {
  2278. continue;
  2279. }
  2280. if (isProperty(nodeType, candidates[current])) {
  2281. element = new Element(candidate[current2], [key, current2], 'Property', null);
  2282. } else if (isNode(candidate[current2])) {
  2283. element = new Element(candidate[current2], [key, current2], null, null);
  2284. } else {
  2285. continue;
  2286. }
  2287. worklist.push(element);
  2288. }
  2289. } else if (isNode(candidate)) {
  2290. worklist.push(new Element(candidate, key, null, null));
  2291. }
  2292. }
  2293. }
  2294. }
  2295. };
  2296. Controller.prototype.replace = function replace(root, visitor) {
  2297. var worklist,
  2298. leavelist,
  2299. node,
  2300. nodeType,
  2301. target,
  2302. element,
  2303. current,
  2304. current2,
  2305. candidates,
  2306. candidate,
  2307. sentinel,
  2308. outer,
  2309. key;
  2310. function removeElem(element) {
  2311. var i,
  2312. key,
  2313. nextElem,
  2314. parent;
  2315. if (element.ref.remove()) {
  2316. // When the reference is an element of an array.
  2317. key = element.ref.key;
  2318. parent = element.ref.parent;
  2319. // If removed from array, then decrease following items' keys.
  2320. i = worklist.length;
  2321. while (i--) {
  2322. nextElem = worklist[i];
  2323. if (nextElem.ref && nextElem.ref.parent === parent) {
  2324. if (nextElem.ref.key < key) {
  2325. break;
  2326. }
  2327. --nextElem.ref.key;
  2328. }
  2329. }
  2330. }
  2331. }
  2332. this.__initialize(root, visitor);
  2333. sentinel = {};
  2334. // reference
  2335. worklist = this.__worklist;
  2336. leavelist = this.__leavelist;
  2337. // initialize
  2338. outer = {
  2339. root: root
  2340. };
  2341. element = new Element(root, null, null, new Reference(outer, 'root'));
  2342. worklist.push(element);
  2343. leavelist.push(element);
  2344. while (worklist.length) {
  2345. element = worklist.pop();
  2346. if (element === sentinel) {
  2347. element = leavelist.pop();
  2348. target = this.__execute(visitor.leave, element);
  2349. // node may be replaced with null,
  2350. // so distinguish between undefined and null in this place
  2351. if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
  2352. // replace
  2353. element.ref.replace(target);
  2354. }
  2355. if (this.__state === REMOVE || target === REMOVE) {
  2356. removeElem(element);
  2357. }
  2358. if (this.__state === BREAK || target === BREAK) {
  2359. return outer.root;
  2360. }
  2361. continue;
  2362. }
  2363. target = this.__execute(visitor.enter, element);
  2364. // node may be replaced with null,
  2365. // so distinguish between undefined and null in this place
  2366. if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
  2367. // replace
  2368. element.ref.replace(target);
  2369. element.node = target;
  2370. }
  2371. if (this.__state === REMOVE || target === REMOVE) {
  2372. removeElem(element);
  2373. element.node = null;
  2374. }
  2375. if (this.__state === BREAK || target === BREAK) {
  2376. return outer.root;
  2377. }
  2378. // node may be null
  2379. node = element.node;
  2380. if (!node) {
  2381. continue;
  2382. }
  2383. worklist.push(sentinel);
  2384. leavelist.push(element);
  2385. if (this.__state === SKIP || target === SKIP) {
  2386. continue;
  2387. }
  2388. nodeType = node.type || element.wrap;
  2389. candidates = this.__keys[nodeType];
  2390. if (!candidates) {
  2391. if (this.__fallback) {
  2392. candidates = this.__fallback(node);
  2393. } else {
  2394. throw new Error('Unknown node type ' + nodeType + '.');
  2395. }
  2396. }
  2397. current = candidates.length;
  2398. while ((current -= 1) >= 0) {
  2399. key = candidates[current];
  2400. candidate = node[key];
  2401. if (!candidate) {
  2402. continue;
  2403. }
  2404. if (isArray(candidate)) {
  2405. current2 = candidate.length;
  2406. while ((current2 -= 1) >= 0) {
  2407. if (!candidate[current2]) {
  2408. continue;
  2409. }
  2410. if (isProperty(nodeType, candidates[current])) {
  2411. element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2));
  2412. } else if (isNode(candidate[current2])) {
  2413. element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2));
  2414. } else {
  2415. continue;
  2416. }
  2417. worklist.push(element);
  2418. }
  2419. } else if (isNode(candidate)) {
  2420. worklist.push(new Element(candidate, key, null, new Reference(node, key)));
  2421. }
  2422. }
  2423. }
  2424. return outer.root;
  2425. };
  2426. function traverse(root, visitor) {
  2427. var controller = new Controller();
  2428. return controller.traverse(root, visitor);
  2429. }
  2430. function replace(root, visitor) {
  2431. var controller = new Controller();
  2432. return controller.replace(root, visitor);
  2433. }
  2434. function extendCommentRange(comment, tokens) {
  2435. var target;
  2436. target = upperBound(tokens, function search(token) {
  2437. return token.range[0] > comment.range[0];
  2438. });
  2439. comment.extendedRange = [comment.range[0], comment.range[1]];
  2440. if (target !== tokens.length) {
  2441. comment.extendedRange[1] = tokens[target].range[0];
  2442. }
  2443. target -= 1;
  2444. if (target >= 0) {
  2445. comment.extendedRange[0] = tokens[target].range[1];
  2446. }
  2447. return comment;
  2448. }
  2449. function attachComments(tree, providedComments, tokens) {
  2450. // At first, we should calculate extended comment ranges.
  2451. var comments = [], comment, len, i, cursor;
  2452. if (!tree.range) {
  2453. throw new Error('attachComments needs range information');
  2454. }
  2455. // tokens array is empty, we attach comments to tree as 'leadingComments'
  2456. if (!tokens.length) {
  2457. if (providedComments.length) {
  2458. for (i = 0, len = providedComments.length; i < len; i += 1) {
  2459. comment = deepCopy(providedComments[i]);
  2460. comment.extendedRange = [0, tree.range[0]];
  2461. comments.push(comment);
  2462. }
  2463. tree.leadingComments = comments;
  2464. }
  2465. return tree;
  2466. }
  2467. for (i = 0, len = providedComments.length; i < len; i += 1) {
  2468. comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));
  2469. }
  2470. // This is based on John Freeman's implementation.
  2471. cursor = 0;
  2472. traverse(tree, {
  2473. enter: function (node) {
  2474. var comment;
  2475. while (cursor < comments.length) {
  2476. comment = comments[cursor];
  2477. if (comment.extendedRange[1] > node.range[0]) {
  2478. break;
  2479. }
  2480. if (comment.extendedRange[1] === node.range[0]) {
  2481. if (!node.leadingComments) {
  2482. node.leadingComments = [];
  2483. }
  2484. node.leadingComments.push(comment);
  2485. comments.splice(cursor, 1);
  2486. } else {
  2487. cursor += 1;
  2488. }
  2489. }
  2490. // already out of owned node
  2491. if (cursor === comments.length) {
  2492. return VisitorOption.Break;
  2493. }
  2494. if (comments[cursor].extendedRange[0] > node.range[1]) {
  2495. return VisitorOption.Skip;
  2496. }
  2497. }
  2498. });
  2499. cursor = 0;
  2500. traverse(tree, {
  2501. leave: function (node) {
  2502. var comment;
  2503. while (cursor < comments.length) {
  2504. comment = comments[cursor];
  2505. if (node.range[1] < comment.extendedRange[0]) {
  2506. break;
  2507. }
  2508. if (node.range[1] === comment.extendedRange[0]) {
  2509. if (!node.trailingComments) {
  2510. node.trailingComments = [];
  2511. }
  2512. node.trailingComments.push(comment);
  2513. comments.splice(cursor, 1);
  2514. } else {
  2515. cursor += 1;
  2516. }
  2517. }
  2518. // already out of owned node
  2519. if (cursor === comments.length) {
  2520. return VisitorOption.Break;
  2521. }
  2522. if (comments[cursor].extendedRange[0] > node.range[1]) {
  2523. return VisitorOption.Skip;
  2524. }
  2525. }
  2526. });
  2527. return tree;
  2528. }
  2529. exports.version = _dereq_('./package.json').version;
  2530. exports.Syntax = Syntax;
  2531. exports.traverse = traverse;
  2532. exports.replace = replace;
  2533. exports.attachComments = attachComments;
  2534. exports.VisitorKeys = VisitorKeys;
  2535. exports.VisitorOption = VisitorOption;
  2536. exports.Controller = Controller;
  2537. exports.cloneEnvironment = function () { return clone({}); };
  2538. return exports;
  2539. }(exports));
  2540. /* vim: set sw=4 ts=4 et tw=80 : */
  2541. },{"./package.json":106}],106:[function(_dereq_,module,exports){
  2542. module.exports={"name":"estraverse","version":"4.2.0"}
  2543. },{}]},{},[1])(1)
  2544. });