diff --git a/.eslintignore b/.eslintignore index 011ec9636212fc..b9b743fb536cf5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,8 +2,10 @@ lib/internal/v8_prof_polyfill.js lib/punycode.js test/addons/??_* test/fixtures +test/message/esm_display_syntax_error.mjs tools/eslint tools/icu +tools/remark-* node_modules benchmark/tmp doc/**/*.js diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 738a4b605d2669..da49eb8b4f7c82 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -56,6 +56,9 @@ rules: - object: assert property: deepEqual message: Use assert.deepStrictEqual(). + - object: assert + property: notDeepEqual + message: Use assert.notDeepStrictEqual(). - object: assert property: equal message: Use assert.strictEqual() rather than assert.equal(). @@ -66,6 +69,7 @@ rules: message: __defineGetter__ is deprecated. - property: __defineSetter__ message: __defineSetter__ is deprecated. + no-return-await: error no-self-assign: error no-throw-literal: error no-unused-labels: error diff --git a/.gitignore b/.gitignore index 922ef6733e6816..efbdc824d29289 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ node_g icu_config.gypi .eslintcache node_trace.*.log +coverage/ /out @@ -104,8 +105,8 @@ deps/npm/node_modules/.bin/ # test artifacts tools/faketime -tools/remark-cli -tools/remark-preset-lint-node +tools/remark-cli/node_modules +tools/remark-preset-lint-node/node_modules icu_config.gypi *.tap diff --git a/.mailmap b/.mailmap index 842d610df87b94..fd6816a5dce7d3 100644 --- a/.mailmap +++ b/.mailmap @@ -1,8 +1,10 @@ Aaron Bieber Aaron Heckmann +Aayush Ahuja aayush.a Abe Fettig Akito Ito Alejandro Oviedo Garcia Alejandro Oviedo +Alex Gilbert agilbert Alex Hultman Alex Jordan AJ Jordan Alex Kocharin @@ -19,6 +21,7 @@ Andy Bettisworth Angel Stoyanov atstojanov Anna Henningsen Anna Magdalena Kedzierska AnnaMag +Antoine Amara Antoine AMARA Aria Stewart Arlo Breault Arnaud Lefebvre BlackYoup @@ -26,6 +29,7 @@ Artem Zaytsev Artur G Vieira Artur Vieira Arnout Kazemier <3rd-Eden@users.noreply.github.com> Asaf David asafdav2 +Ashley Maceli ashleyraymaceli Atsuo Fukaya Ben Lugavere blugavere Ben Noordhuis @@ -42,30 +46,37 @@ Beth Griggs Bethany N Griggs BethGriggs Bidisha Pyne Brad Decker brad-decker +Brad Larson BradLarson Bradley Meck Bradley Farias Brandon Benvie Brandon Kobel kobelb Brendan Ashworth +Brent Pendergraft penDerGraft Brian White Brian White Caleb Boyd Calvin Metcalf Calvin Metcalf +Caralyn Reisle creisle Charles Chew Choon Keat Charles Rudolph +Chris Andrews cpandrews8 Chris Johnson +Chris Young Claudio Rodriguez Colin Ihrig Christophe Naud-Dulude Chris911 Christopher Lenz Dan Kaplun Dan Williams Dan.Williams +Daniel Abrão Daniel Abrão > Daniel Bevenius daniel.bevenius Daniel Berger Daniel Chcouri <333222@gmail.com> Daniel Gröber Daniel Gröber +Daniel Paulino dpaulino Daniel Pihlström Daniel Wang firedfox Daniel Wang firedfox @@ -84,6 +95,7 @@ Eduard Burtescu Einar Otto Stangvik Elliott Cable Eric Phetteplace +Erwin W. Ramadhan erwinwahyura Eugene Obrezkov ghaiklor EungJun Yi Evan Larkin @@ -99,14 +111,21 @@ Felix Geisendörfer Flandre Scarlet Flandre Florian Margaine Florian MARGAINE Forrest L Norvell +Franziska Hinkelmann F. Hinkelmann Friedemann Altrock Fuji Goro Gabriel de Perthuis Gareth Ellis +Geoffrey Bugaisky gbugaisky Gibson Fahnestock Gil Pedersen Graham Fairweather Xotic750 Greg Sabia Tucker +Gregor Martynus Gregor +Guy Bedford guybedford +Halil İbrahim Şener hisener +Hannah Kim heeeunkimmm +Hendrik Schwalm hschwalm Hitesh Kanwathirtha Henry Chin Herbert Vojčík @@ -122,8 +141,10 @@ Italo A. Casas Jackson Tian Jake Verbaten Jamen Marzonie Jamen Marz +James Beavers Druotic James Hartig James M Snell +James Nimlos JamesNimlos Jan Krems Jenna Vuong JeongHoon Byun Outsider @@ -139,13 +160,17 @@ Johann Hofmann John Barboza jBarz John Barboza jBarz John Gardner Alhadis +John McGuirk jmcgui05 Johnny Ray Austin Johnny Ray Jon Tippens legalcodes Jonas Pfenniger +Jonathan Gourlay mrgorbo Jonathan Ong Jonathan Persson Jonathan Rentzsch +Jose Luis Vivero jlvivero Josh Erickson +Josh Hunter jopann Joshua S. Weinstein Joyee Cheung joyeecheung Juan Soto @@ -154,6 +179,7 @@ Julien Waechter julien.waechter Junliang Yan Junshu Okamoto jun-oka +Justin Beckwith Jérémy Lal Jérémy Lal Kai Sasaki Lewuathe @@ -172,26 +198,34 @@ Lydia Kats Lydia Katsamberis Maciej Małecki Malte-Thorben Bruns Malte-Thorben Bruns skenqbx +Mandeep Singh +Manil Chowdhurian Chowdhurian Marcelo Gobelli decareano Marcin Cieślak Marcin Cieślak Marcin Zielinski marzelin Marti Martz Martial James Jefferson +Martijn Schrage Oblosys +Matheus Marchini Matt Lang matt-in-a-hat +Matt Reed matthewreed26 Matthias Bastian piepmatz Mathias Buus Mathias Pettersson Matthew Lye +Maurice Hayward maurice_hayward Michael Bernstein Michael Dawson Michael Wilber Michaël Zasso Michael-Rainabba Richardson rainabba +Michał Gołębiowski-Owczarek Micheil Smith Micleusanu Nicu Miguel Angel Asencio Hurtado maasencioh Mikael Bourges-Sevenier +Mike Kaufman Minqi Pan P.S.V.R Minwoo Jung JungMinu Miroslav Bajtoš @@ -208,8 +242,11 @@ Onne Gorter Paul Querna Pedro Lima Pedro Victor Pedro Lima Pedro lima +Peng Lyu rebornix Peter Flannery +Peter Paugh Peter Phillip Johnsen +Rachel White rachelnicole Ratikesh Misra Ravindra Barthwal Ravindra barthwal Ray Morgan @@ -220,11 +257,14 @@ Refael Ackermann Reza Akhavan jedireza Ricardo Sánchez Gregorio richnologies Rick Olson +Rob Adelmann +Rob Adelmann adelmann Rod Machen Roman Klauke Roman Reiss Ron Korving Ron Korving ronkorving +Russell Dempsey Ryan Dahl Ryan Emery Ryan Scheel Ryan Scheel @@ -245,11 +285,14 @@ Scott Blomquist Segu Riluvan Sergey Kryzhanovsky Shannen Saez +Shaopeng Zhang szhang351 Shigeki Ohtsu Shigeki Ohtsu +Shiya Luo shiya Siddharth Mahendraker Simon Willison Siobhan O'Donovan justshiv +Siyuan Gao r1cebank solebox solebox <5013box@gmail.com> Sreepurna Jasti Sreepurna Jasti sreepurnajasti @@ -261,6 +304,7 @@ Steve Mao Steven R. Loomis Stewart X Addison Stewart Addison Stewart X Addison sxa555 +Suraiya Hameed suraiyah Suramya shah ss22ever Surya Panikkal surya panikkal Surya Panikkal suryagh @@ -268,6 +312,8 @@ Taehee Kang hugnosis Tanuja-Sawant Taylor Woll taylor.woll Thomas Watson Steen Thomas Watson +Timur Shemsedinov tshemsedinov +Toby Farley tobyfarley Toby Stableford toboid Todd Kennedy TJ Holowaychuk @@ -278,6 +324,8 @@ Tarun Batra Tarun Ted Young Thomas Lee Thomas Reggi +Tierney Cyren &! (bitandbang) +Tierney Cyren bitandbang Tim Caswell Tim Price Tim Smart @@ -285,6 +333,8 @@ Tim Smart Timothy Leverett Timothy Tom Hughes Tom Hughes-Croucher +Tom Purcell tpurcell +Tomoki Okahana umatoma Travis Meisenheimer Trevor Burnham Tyler Larson @@ -295,10 +345,12 @@ vsemozhetbyt Vse Mozhet Byt Wang Xinyong Weijia Wang <381152119@qq.com> starkwang <381152119@qq.com> Willi Eggeling +Wyatt Preul geek xiaoyu <306766053@qq.com> Poker <306766053@qq.com> Yazhong Liu Yazhong Liu Yazhong Liu Yorkie Yazhong Liu Yorkie +Yazhong Liu Yorkie Liu Yoshihiro KIKUCHI Yosuke Furukawa Yuichiro MASUI diff --git a/AUTHORS b/AUTHORS index 977f3b619f4b00..8d8e74493aff0a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -710,7 +710,7 @@ Ryan Scheel Benjamin Gruenbaum Pavel Medvedev Russell Dempsey -&! (bitandbang) +Tierney Cyren h7lin Michael Dawson Ruben Verborgh @@ -791,7 +791,7 @@ Salman Aljammaz Thomas Reggi Laurent Fortin Fabio Oliveira -Michał Gołębiowski +Michał Gołębiowski-Owczarek Johann Hofmann Charles Rudolph Dave Eddy @@ -957,7 +957,7 @@ Bogdan Lobor Mihai Potra Brendon Pierson Brad Hill -Mike Kaufman +Mike Kaufman Igor Kalashnikov Amery James Reggio @@ -1194,12 +1194,12 @@ scalkpdev Ashton Kinslow Kevin Zurawel Wes Tyler -shiya +Shiya Luo Joyee Cheung Greg Valdez Bidur Adhikari Kyle Carter -adelmann +Rob Adelmann Daniel Pittman Ian White Chris Bystrek @@ -1274,7 +1274,6 @@ Sam Shull Michael-Bryant Choa CodeVana Daniel Sims -Rob Adelmann Diego Paez Paul Graham Jared Young @@ -1401,7 +1400,7 @@ James Sumners Bradley Curran chiaki-yokoo Benjamin Fleischer -maurice_hayward +Maurice Hayward Ali BARIN Nemanja Stojanovic Jeroen Mandersloot @@ -1526,11 +1525,10 @@ realwakka Gergely Nemeth Samuel Reed Anshul Guleria -Justin Beckwith +Justin Beckwith Scott McKenzie Julien Klepatch Dan Homola -Chris Young cornholio <0@mcornholio.ru> Tamás Hódi DuanPengfei <2459714173@qq.com> @@ -1618,7 +1616,7 @@ Guy Margalit Azard nishijayaraj Nick Stanish -Mandeep Singh +Mandeep Singh Prakash Palaniappan Keita Akutsu Michael Albert @@ -1667,5 +1665,376 @@ George Bezerra Benjamin Coe Tim Costa Rahul Mishra +Damien O'Reilly +Tuan Anh Tran +Alex Gresnel <31708810+agresnel@users.noreply.github.com> +Will Young +Martijn Schrage +Halil İbrahim Şener +Guy Bedford +Antoine Amara +Mani Maghsoudlou +Bartek Szczepański +Roga Pria Sembada +Jussi Räsänen +Thomas Corbière +atvoicu +Peng Lyu +Yang-Kichang +JP Wesselink +Rami Moshe +Rimas Misevičius +Jack Horton +Trivikram Kamat +Jose Luis Vivero +John-David Dalton +Pavel Pomerantsev +Daniela Borges Matos de Carvalho +Bruce Fletcher +Greg Byram +Manil Chowdhurian +Jonathan Eskew +James M. Greene +Pooya Paridel +Paul Berry +Ruxandra Fediuc +Saeed H +Rachel White +Geoffrey Bugaisky +Sam Skjonsberg +Emily Marigold Klassen +Ashley Maceli +Thomas Schorn +John Miller +rhalldearn +Annie Weng +Sean Cox +Luke Greenleaf +Alec Ferguson +Laura Cabrera +Barry Tam +Eric Pemberton +Josh Hunter +BinarySo1o +Chris Budy +Emily Platzer +jacjam +Brant Barger +Daniel Paulino +Emily Ford +Luis Del Águila +Mujtaba Al-Tameemi +Govee91 +joanne-jjb +Brad Larson +Alice Tsui +Greg Matthews +Daniel Kostro +Faisal Yaqoob +Alex McKenzie +Hannah Kim +Paul Milham +Christopher Choi +Suraiya Hameed +Charlie Duong +Joe Grace +Justin Lee +Brent Pendergraft +Gene Wu +nodexpertsdev +Rob Paton +Daniele Lisi +Sushil Tailor +Ben Michel +John McGuirk +Colin Leong +Caralyn Reisle +Savio Lucena +Rafal Leszczynski +Ivan Etchart +Robin Lungwitz +ryshep111 +gitHubTracey +tabulatedreams +Charles T Wall III +Minya Liang +Kinnan Kwok +Adil L +Seth Holladay +Chris Andrews +Matt Reed +Joe Henry +Alireza Alidousti +James Beavers +Cameron Burwell +Jakub Mrowiec - Alkagar +Oliver Luebeck +Chris Jimenez +James Hodgskiss +Guilherme Akio Sakae +Martin Michaelis +Christopher Sidebottom +Edward Andrew Robinson +Nigel Kibodeaux +Shakeel Mohamed +Tobias Kieslich +Ruy Adorno +Stefania Sharp +Pawel Golda +Steven Scott +Alex Gilbert +Siyuan Gao +Nicola Del Gobbo +Josh Lim +Feon Sua +Shawn McGinty +Jason Walton +Jonathan Gourlay +Peter Paugh +Gregor Martynus +Joel Dart +Tri Nguyen +Kasim Doctor +Steve Jenkins +AlexeyM +Nicolas Chaulet +Adarsh Honawad +Tim Ermilov +ekulnivek +Ethan Brown +Lewis Zhang +Kat Rosario +jpaulptr +Donovan Buck +Toby Farley +Suresh Srinivas +Alberto Lopez de Lara +Jem Bezooyen +Bob Clewell +Raj Parekh +Tom Boutell +Cristian Peñarrieta +Christian Murphy +Dolapo Toki +Shaopeng Zhang +Matthew Meyer +Chad Zezula +Eric Freiberg +Mabry Cervin +shaohui.liu2000@gmail.com +Chi-chi Wang +Roger Jiang +Cheyenne Arrowsmith +Tim Chon +Michael Pal +Fadi Asfour +Christina Chan +Alessandro Vergani +Ali Groening +Mike Fleming +WeiPlanet +243083df <243083df@dispostable.com> +Komivi Agbakpem +Tyler Seabrook +Bear Trickey +NiveditN +Shaun Sweet +James Nimlos +Kim Gentes +Vladimir Ilic +Randal Hanford +Jean-Baptiste Brossard +Orta +Ben Hallion +twk-b +Lam Chan +Jenna Zeigen +Lukas +tejbirsingh +Hendrik Schwalm +Jeremy Huang +Michael Rueppel +David8472 +Luke Childs +Robert Nagy +Nikki St Onge +zhangzifa +hwaisiu +Thomas Karsten +Lance Barlaan +Alvaro Cruz +Jean-Philippe Blais +Oscar Funes +Kanika Shah +Jack Wang +Braden Whitten +Omar Gonzalez +Supamic +Nikhil Komawar +Daniel Abrão +elisa lee +mog422 +André Føyn Berge +Tom Purcell +Tomoki Okahana +Aayush Ahuja +Paul Marion Camantigue +Jayson D. Henkel +Nicolas 'Pixel' Noble +Ashish Kaila +c0b <14798161+c0b@users.noreply.github.com> +Damian +Alec Perkins +Teppei Sato +Jinwoo Lee +Peter Marton +Erwin W. Ramadhan +Mark Walker +sharkfisher +nhoel +Hadis-Fard +Scott J Beck +Raphael Rheault +Iryna Yaremtso +Casie Lynch +Matthew Cantelon +Ben Halverson +cPhost <23620441+cPhost@users.noreply.github.com> +dicearr +Lucas Azzola +Ken Takagi +Ed Schouten +Andrew Stucki +Anthony Nandaa +Mithun Sasidharan +Mattias Holmlund +Mark S. Everitt +Alexey Kuzmin +gowpen <33104741+gowpen@users.noreply.github.com> +Adam Wegrzynek +Sascha Tandel +Patrick Heneise +Dumitru Glavan +Giovanni Lela +Matthias Reis +John Byrne +Octavian Ionescu +Kevin Yu +Jimi van der Woning +Dara Hayes +Maring, Damian Lion +Attila Gonda +Brian O'Connell +Sean Karson +Nicolas Morel +fjau +SonaySevik +jonask +Delapouite +Mark McNelis +mbornath +Andres Kalle +Paul Blanche +Vipin Menon +woj +Adam Jeffery +Paul Ashfield +Katie Stockton Roberts +Mamatha J V +Neil Vass +Vidya Subramanyam +Swathi Kalahastri +Tanvi Kini +Sabari Lakshmi Krishnamoorthy +Kabir Islam +subrahmanya chari p +Suryanarayana Murthy N +Chandrakala +Jayashree S Kumar +Nayana Das K +Anawesha Khuntia +Maton Anthony +saiHemak +Deepthi Sebastian +Pawan Jangid +Stephan Smith +joelostrowski +Javier Blanco +Cyril Lakech <1169286+clakech@users.noreply.github.com> +Grant Gasparyan +Klemen Kogovsek +Gus Caplan +ka3e +ChrBergert +sercan yersen +Steve Kinney +Sebastian Mayr +Vijayalakshmi Kannan +Benjamin Zaslavsky +Sebastian Silbermann +pimlie +buji +Witthawat Piwawatthanapanit +sgreylyn +Xavier Balloy +François Descamps +Guillaume Flandre +Pierre-Loic Doulcet +Fran Herrero +Francois KY +suman-mitra +Matheus Marchini +neta +Whien +Chiahao Lin +esbb48 +Roth Peng +jimliu7434 +YuLun Shih +Kyle Yu +Ivan Wei +john +Jamie Davis +Scya597 +Zack Yang +aryung chen +Larry Lu +Robert Rossmann +薛定谔的猫 +danielLin +jackyen +Kurt Hsu +sorarize@gmail.com +Jason Chung +Thomas den Hollander +Ronald Eddy Jr +Richard Littauer +pkovacs +zhengyuanjie +Andy Chen +Kcin1993 +yozian +jimmy +Leko +Aqui Tsuchida +koooge +kou-hin +Hiroaki KARASAWA +narirou +Antonio V +spring_raining +Hiromu Yoshiwara +yuza yuko +smatsu-hl +Bamieh +WhoMeNope +Junichi Kajiwara +Matthew Leon +Hativ +Tom Hallam +Hannes Magnusson +ChungNgoops +Jose M. Palacios Diaz +hmammedzadeh # Generated by tools/update-authors.sh diff --git a/BUILDING.md b/BUILDING.md index 52c11aa08e9adf..c459a867ba6096 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -66,6 +66,14 @@ note1 - The gcc4.8-libs package needs to be installed, because node In "Git bash" if you call the node shell alias (`node` without the `.exe` extension), `winpty` is used automatically. +The Windows Subsystem for Linux (WSL) is not directly supported, but the +GNU/Linux build process and binaries should work. The community will only +address issues that reproduce on native GNU/Linux systems. Issues that only +reproduce on WSL should be reported in the +[WSL issue tracker](https://github.com/Microsoft/WSL/issues). Running the +Windows binary (`node.exe`) in WSL is not recommended, and will not work +without adjustment (such as stdio redirection). + ### Supported toolchains Depending on host platform, the selection of toolchains may vary. @@ -81,6 +89,9 @@ Depending on host platform, the selection of toolchains may vary. ## Building Node.js on supported platforms +*Note:* All prerequisites can be easily installed by following +[this bootstrapping guide](https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md). + ### Unix / macOS Prerequisites: @@ -201,6 +212,8 @@ Prerequisites: * Basic Unix tools required for some tests, [Git for Windows](http://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. +* **Optional** (to build the MSI): the [WiX Toolset v3.11](http://wixtoolset.org/releases/) + and the [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension). If the path to your build directory contains a space, the build will likely fail. @@ -334,17 +347,13 @@ as `deps/icu` (You'll have: `deps/icu/source/...`) ## Building Node.js with FIPS-compliant OpenSSL -NOTE: Windows is not yet supported - -It is possible to build Node.js with -[OpenSSL FIPS module](https://www.openssl.org/docs/fipsnotes.html). +It is possible to build Node.js with the +[OpenSSL FIPS module](https://www.openssl.org/docs/fipsnotes.html) on POSIX +systems. Windows is not supported. -**Note**: building in this way does **not** allow you to claim that the -runtime is FIPS 140-2 validated. Instead you can indicate that the runtime -uses a validated module. See the -[security policy](http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1747.pdf) -page 60 for more details. In addition, the validation for the underlying module -is only valid if it is deployed in accordance with its +Building in this way does not mean the runtime is FIPS 140-2 validated, but +rather that the runtime uses a validated module. In addition, the validation for +the underlying module is only valid if it is deployed in accordance with its [security policy](http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1747.pdf). If you need FIPS validated cryptography it is recommended that you read both the [security policy](http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1747.pdf) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1801a86ae42ea..6b17c36f3e215d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,8 @@ release. -9.2.1
+9.3.0
+9.2.1
9.2.0
9.1.0
9.0.0
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index d9ad342881c1a9..5a935352a1f9f0 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,5 +1,8 @@ # Code of Conduct The Node.js Code of Conduct document has moved to -https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md. Please update +https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md. Please update links to this document accordingly. + +The Node.js Moderation policy can be found at +https://github.com/nodejs/admin/blob/master/Moderation-Policy.md diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index c61aad6e7d4f31..358fd59476d2cc 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -3,19 +3,37 @@ **Contents** * [Issues and Pull Requests](#issues-and-pull-requests) + - [Managing Issues and Pull Requests](#managing-issues-and-pull-requests) + - [Welcoming First-Time Contributiors](#welcoming-first-time-contributiors) + - [Closing Issues and Pull Requests](#closing-issues-and-pull-requests) * [Accepting Modifications](#accepting-modifications) - - [Useful CI Jobs](#useful-ci-jobs) - - [Internal vs. Public API](#internal-vs-public-api) - - [Breaking Changes](#breaking-changes) - - [Deprecations](#deprecations) - - [Involving the TSC](#involving-the-tsc) + - [Code Reviews and Consensus Seeking](#code-reviews-and-consensus-seeking) + - [Waiting for Approvals](#waiting-for-approvals) + - [Testing and CI](#testing-and-ci) + - [Useful CI Jobs](#useful-ci-jobs) + - [Internal vs. Public API](#internal-vs-public-api) + - [Breaking Changes](#breaking-changes) + - [Breaking Changes and Deprecations](#breaking-changes-and-deprecations) + - [Breaking Changes to Internal Elements](#breaking-changes-to-internal-elements) + - [When Breaking Changes Actually Break Things](#when-breaking-changes-actually-break-things) + - [Reverting commits](#reverting-commits) + - [Introducing New Modules](#introducing-new-modules) + - [Deprecations](#deprecations) + - [Involving the TSC](#involving-the-tsc) * [Landing Pull Requests](#landing-pull-requests) - - [Technical HOWTO](#technical-howto) - - [I Just Made a Mistake](#i-just-made-a-mistake) - - [Long Term Support](#long-term-support) + - [Technical HOWTO](#technical-howto) + - [Troubleshooting](#troubleshooting) + - [I Just Made a Mistake](#i-just-made-a-mistake) + - [Long Term Support](#long-term-support) + - [What is LTS?](#what-is-lts) + - [How does LTS work?](#how-does-lts-work) + - [Landing semver-minor commits in LTS](#landing-semver-minor-commits-in-lts) + - [How are LTS Branches Managed?](#how-are-lts-branches-managed) + - [How can I help?](#how-can-i-help) + - [How is an LTS release cut?](#how-is-an-lts-release-cut) This document contains information for Collaborators of the Node.js -project regarding maintaining the code, documentation and issues. +project regarding maintaining the code, documentation, and issues. Collaborators should be familiar with the guidelines for new contributors in [CONTRIBUTING.md](./CONTRIBUTING.md) and also @@ -24,16 +42,31 @@ understand the project governance model as outlined in ## Issues and Pull Requests -Courtesy should **always** be shown to individuals submitting issues and pull -requests to the Node.js project. Be welcoming to first time contributors, -identified by the GitHub ![badge](./doc/first_timer_badge.png) badge. +### Managing Issues and Pull Requests Collaborators should feel free to take full responsibility for managing issues and pull requests they feel qualified to handle, as long as this is done while being mindful of these guidelines, the -opinions of other Collaborators and guidance of the TSC. +opinions of other Collaborators and guidance of the [TSC][]. They +may also notify other qualified parties for more input on an issue +or a pull request. +[See "Who to CC in issues"](./doc/onboarding-extras.md#who-to-cc-in-issues) + +### Welcoming First-Time Contributiors + +Courtesy should always be shown to individuals submitting issues and pull +requests to the Node.js project. Be welcoming to first-time contributors, +identified by the GitHub ![badge](./doc/first_timer_badge.png) badge. + +For first-time contributors, check if the commit author is the same as the +pull request author, and ask if they have configured their git +username and email to their liking as per [this guide][git-username]. +This is to make sure they would be promoted to "contributor" once +their pull request gets landed. + +### Closing Issues and Pull Requests -Collaborators may **close** any issue or pull request they believe is +Collaborators may close any issue or pull request they believe is not relevant for the future of the Node.js project. Where this is unclear, the issue should be left open for several days to allow for additional discussion. Where this does not yield input from Node.js @@ -41,13 +74,14 @@ Collaborators or additional evidence that the issue has relevance, the issue may be closed. Remember that issues can always be re-opened if necessary. -[**See "Who to CC in issues"**](./doc/onboarding-extras.md#who-to-cc-in-issues) - ## Accepting Modifications All modifications to the Node.js code and documentation should be performed via GitHub pull requests, including modifications by -Collaborators and TSC members. +Collaborators and TSC members. A pull request must be reviewed, and usually +must also be tested with CI, before being landed into the codebase. + +### Code Reviews and Consensus Seeking All pull requests must be reviewed and accepted by a Collaborator with sufficient expertise who is able to take full responsibility for the @@ -55,22 +89,17 @@ change. In the case of pull requests proposed by an existing Collaborator, an additional Collaborator is required for sign-off. In some cases, it may be necessary to summon a qualified Collaborator -to a pull request for review by @-mention. +or a GitHub team to a pull request for review by @-mention. +[See "Who to CC in issues"](./doc/onboarding-extras.md#who-to-cc-in-issues) If you are unsure about the modification and are not prepared to take full responsibility for the change, defer to another Collaborator. -Before landing pull requests, sufficient time should be left for input -from other Collaborators. Leave at least 48 hours during the week and -72 hours over weekends to account for international time differences -and work schedules. Trivial changes (e.g. those which fix minor bugs -or improve performance without affecting API or causing other -wide-reaching impact), and focused changes that affect only documentation -and/or the test suite, may be landed after a shorter delay if they have -multiple approvals. - -For first time contributors, ask the author if they have configured their git -username and email to their liking as per [this guide][git-username]. +If any Collaborator objects to a change *without giving any additional +explanation or context*, and the objecting Collaborator fails to respond to +explicit requests for explanation or context within a reasonable period of +time, the objection may be dismissed. Note that this does not apply to +objections that are explained. For non-breaking changes, if there is no disagreement amongst Collaborators, a pull request may be landed given appropriate review. @@ -80,12 +109,32 @@ elevate discussion to the TSC for resolution (see below). Breaking changes (that is, pull requests that require an increase in the major version number, known as `semver-major` changes) must be -elevated for review by the TSC. This does not necessarily mean that the -PR must be put onto the TSC meeting agenda. If multiple TSC members -approve (`LGTM`) the PR and no Collaborators oppose the PR, it can be -landed. Where there is disagreement among TSC members or objections -from one or more Collaborators, `semver-major` pull requests should be -put on the TSC meeting agenda. +[elevated for review by the TSC](#involving-the-tsc). +This does not necessarily mean that the PR must be put onto the TSC meeting +agenda. If multiple TSC members approve (`LGTM`) the PR and no Collaborators +oppose the PR, it can be landed. Where there is disagreement among TSC members +or objections from one or more Collaborators, `semver-major` pull requests +should be put on the TSC meeting agenda. + +### Waiting for Approvals + +Before landing pull requests, sufficient time should be left for input +from other Collaborators. In general, leave at least 48 hours during the +week and 72 hours over weekends to account for international time +differences and work schedules. However, certain types of pull requests +can be fast-tracked and may be landed after a shorter delay: + +* Focused changes that affect only documentation and/or the test suite. + `code-and-learn` and `good-first-issue` pull requests typically fall + into this category. +* Changes that fix regressions. + +When a pull request is deemed suitable to be fast-tracked, label it with +`fast-track`. The pull request can be landed once 2 or more Collaborators +approve both the pull request and the fast-tracking request, and the necessary +CI testing is done. + +### Testing and CI All bugfixes require a test case which demonstrates the defect. The test should *fail* before the change, and *pass* after the change. @@ -94,12 +143,6 @@ All pull requests that modify executable code should be subjected to continuous integration tests on the [project CI server](https://ci.nodejs.org/). -If any Collaborator objects to a change *without giving any additional -explanation or context*, and the objecting Collaborator fails to respond to -explicit requests for explanation or context within a reasonable period of -time, the objection may be dismissed. Note that this does not apply to -objections that are explained. - #### Useful CI Jobs * [`node-test-pull-request`](https://ci.nodejs.org/job/node-test-pull-request/) @@ -110,10 +153,14 @@ which runs the `build-ci` and `test-ci` targets on all supported platforms. only runs the linter targets, which is useful for changes that only affect comments or documentation. +* [`node-test-pull-request-lite`](https://ci.nodejs.org/job/node-test-pull-request-lite/) +only runs the linter job, as well as the tests on LinuxONE. Should only be used for +trivial changes that do not require being tested on all platforms. + * [`citgm-smoker`](https://ci.nodejs.org/job/citgm-smoker/) uses [`CitGM`](https://github.com/nodejs/citgm) to allow you to run `npm install && npm test` on a large selection of common modules. This is useful to check whether a -change will cause breakage in the ecosystem. To test Node.JS ABI changes +change will cause breakage in the ecosystem. To test Node.js ABI changes you can run [`citgm-abi-smoker`](https://ci.nodejs.org/job/citgm-abi-smoker/). * [`node-stress-single-test`](https://ci.nodejs.org/job/node-stress-single-test/) @@ -172,33 +219,29 @@ using an API in a manner currently undocumented achieves a particular useful result, a decision will need to be made whether or not that falls within the supported scope of that API; and if it does, it should be documented. -Breaking changes to internal elements are permitted in semver-patch or -semver-minor commits but Collaborators should take significant care when -making and reviewing such changes. Before landing such commits, an effort -must be made to determine the potential impact of the change in the ecosystem -by analyzing current use and by validating such changes through ecosystem -testing using the [Canary in the Goldmine](https://github.com/nodejs/citgm) -tool. If a change cannot be made without ecosystem breakage, then TSC review is -required before landing the change as anything less than semver-major. - -If a determination is made that a particular internal API (for instance, an -underscore `_` prefixed property) is sufficiently relied upon by the ecosystem -such that any changes may break user code, then serious consideration should be -given to providing an alternative Public API for that functionality before any -breaking changes are made. +See [Breaking Changes to Internal Elements](#breaking-changes-to-internal-elements) +on how to handle those types of changes. ### Breaking Changes Backwards-incompatible changes may land on the master branch at any time after -sufficient review by collaborators and approval of at least two TSC members. +sufficient review by Collaborators and approval of at least two TSC members. + +Examples of breaking changes include: + +* removal or redefinition of existing API arguments +* changing return values +* removing or modifying existing properties on an options argument +* adding or removing errors +* altering expected timing of an event +* changing the side effects of using a particular API -Examples of breaking changes include, but are not necessarily limited to, -removal or redefinition of existing API arguments, changing return values -(except when return values do not currently exist), removing or modifying -existing properties on an options argument, adding or removing errors, -changing error messages in any way, altering expected timing of an event (e.g. -moving from sync to async responses or vice versa), and changing the -non-internal side effects of using a particular API. +Purely additive changes (e.g. adding new events to `EventEmitter` +implementations, adding new arguments to a method in a way that allows +existing code to continue working without modification, or adding new +properties to an options argument) are semver-minor changes. + +#### Breaking Changes and Deprecations With a few notable exceptions outlined below, when backwards incompatible changes to a *Public* API are necessary, the existing API *must* be deprecated @@ -216,14 +259,6 @@ Exception to this rule is given in the following cases: Such changes *must* be handled as semver-major changes but MAY be landed without a [Deprecation cycle](#deprecation-cycle). -From time-to-time, in particularly exceptional cases, the TSC may be asked to -consider and approve additional exceptions to this rule. - -Purely additive changes (e.g. adding new events to EventEmitter -implementations, adding new arguments to a method in a way that allows -existing code to continue working without modification, or adding new -properties to an options argument) are handled as semver-minor changes. - Note that errors thrown, along with behaviors and APIs implemented by dependencies of Node.js (e.g. those originating from V8) are generally not under the control of Node.js and therefore *are not directly subject to this @@ -231,7 +266,29 @@ policy*. However, care should still be taken when landing updates to dependencies when it is known or expected that breaking changes to error handling may have been made. Additional CI testing may be required. -#### When breaking changes actually break things +From time-to-time, in particularly exceptional cases, the TSC may be asked to +consider and approve additional exceptions to this rule. + +For more information, see [Deprecations](#deprecations). + +#### Breaking Changes to Internal Elements + +Breaking changes to internal elements are permitted in semver-patch or +semver-minor commits but Collaborators should take significant care when +making and reviewing such changes. Before landing such commits, an effort +must be made to determine the potential impact of the change in the ecosystem +by analyzing current use and by validating such changes through ecosystem +testing using the [Canary in the Goldmine](https://github.com/nodejs/citgm) +tool. If a change cannot be made without ecosystem breakage, then TSC review is +required before landing the change as anything less than semver-major. + +If a determination is made that a particular internal API (for instance, an +underscore `_` prefixed property) is sufficiently relied upon by the ecosystem +such that any changes may break user code, then serious consideration should be +given to providing an alternative Public API for that functionality before any +breaking changes are made. + +#### When Breaking Changes Actually Break Things Because breaking (semver-major) changes are permitted to land on the master branch at any time, at least some subset of the user ecosystem may be adversely @@ -349,12 +406,13 @@ Changes" section of the release notes. ### Involving the TSC -Collaborators may opt to elevate pull requests or issues to the TSC for -discussion by assigning the `tsc-review` label. This should be done -where a pull request: +Collaborators may opt to elevate pull requests or issues to the [TSC][] for +discussion by assigning the `tsc-review` label or @-mentioning the +`@nodejs/tsc` GitHub team. This should be done where a pull request: -- has a significant impact on the codebase, -- is inherently controversial; or +- is labeled `semver-major`, or +- has a significant impact on the codebase, or +- is inherently controversial, or - has failed to reach consensus amongst the Collaborators who are actively participating in the discussion. @@ -681,3 +739,4 @@ LTS working group and the Release team. [Enhancement Proposal]: https://github.com/nodejs/node-eps [git-username]: https://help.github.com/articles/setting-your-username-in-git/ [`node-core-utils`]: https://github.com/nodejs/node-core-utils +[TSC]: https://github.com/nodejs/TSC diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b234f9354883cb..9f8f89cdaa999e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,7 +74,7 @@ for any individual to *act* in such a manner that is not in violation of the strict letter of the Code of Conduct guidelines while still going completely against the spirit of what that Code is intended to accomplish. -Open, diverse and inclusive communities live and die on the basis of trust. +Open, diverse, and inclusive communities live and die on the basis of trust. Contributors can disagree with one another so long as they trust that those disagreements are in good faith and everyone is working towards a common goal. @@ -177,7 +177,7 @@ Node.js changed that broke the module. Once an issue has been opened, it is not uncommon for there to be discussion around it. Some contributors may have differing opinions about the issue, including whether the behavior being seen is a bug or a feature. This discussion -is part of the process and should be kept focused, helpful and professional. +is part of the process and should be kept focused, helpful, and professional. Short, clipped responses—that provide neither additional context nor supporting detail—are not helpful or professional. To many, such responses are simply @@ -221,9 +221,9 @@ In case of doubt, open an issue in the [issue tracker](https://github.com/nodejs/node/issues/) or contact one of the [project Collaborators](https://github.com/nodejs/node/#current-project-team-members). Node.js has two IRC channels: -[#Node.js](http://webchat.freenode.net/?channels=node.js) for general help and +[#Node.js](https://webchat.freenode.net/?channels=node.js) for general help and questions, and -[#Node-dev](http://webchat.freenode.net/?channels=node-dev) for development of +[#Node-dev](https://webchat.freenode.net/?channels=node-dev) for development of Node.js core specifically. ### Setting up your local environment @@ -862,7 +862,7 @@ By making a contribution to this project, I certify that: [benchmark results]: ./doc/guides/writing-and-running-benchmarks.md [Building guide]: ./BUILDING.md [CI (Continuous Integration) test run]: #ci-testing -[Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md +[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md [https://ci.nodejs.org/]: https://ci.nodejs.org/ [IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4 [Node.js help repository]: https://github.com/nodejs/help/issues diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index 3bea5bb107586f..62c96a8fd12e35 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -1,11 +1,34 @@ # C++ Style Guide +## Table of Contents + +* [Formatting](#formatting) + * [Left-leaning (C++ style) asterisks for pointer declarations](#left-leaning-c-style-asterisks-for-pointer-declarations) + * [2 spaces of indentation for blocks or bodies of conditionals](#2-spaces-of-indentation-for-blocks-or-bodies-of-conditionals) + * [4 spaces of indentation for statement continuations](#4-spaces-of-indentation-for-statement-continuations) + * [Align function arguments vertically](#align-function-arguments-vertically) + * [Initialization lists](#initialization-lists) + * [CamelCase for methods, functions, and classes](#camelcase-for-methods-functions-and-classes) + * [snake\_case for local variables and parameters](#snake_case-for-local-variables-and-parameters) + * [snake\_case\_ for private class fields](#snake_case_-for-private-class-fields) + * [Space after `template`](#space-after-template) +* [Memory Management](#memory-management) + * [Memory allocation](#memory-allocation) + * [Use `nullptr` instead of `NULL` or `0`](#use-nullptr-instead-of-null-or-0) + * [Ownership and Smart Pointers](#ownership-and-smart-pointers) +* [Others](#others) + * [Type casting](#type-casting) + * [Do not include `*.h` if `*-inl.h` has already been included](#do-not-include-h-if--inlh-has-already-been-included) + * [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods) + Unfortunately, the C++ linter (based on [Google’s `cpplint`](https://github.com/google/styleguide)), which can be run explicitly via `make lint-cpp`, does not currently catch a lot of rules that are specific to the Node.js C++ code base. This document explains the most common of these rules: +## Formatting + ## Left-leaning (C++ style) asterisks for pointer declarations `char* buffer;` instead of `char *buffer;` @@ -69,7 +92,7 @@ HandleWrap::HandleWrap(Environment* env, handle_(handle) { ``` -## CamelCase for methods, functions and classes +## CamelCase for methods, functions, and classes Exceptions are simple getters/setters, which are named `property_name()` and `set_property_name()`, respectively. @@ -110,23 +133,50 @@ class FancyContainer { ... } ``` - -## Type casting - -- Always avoid C-style casts (`(type)value`) -- `dynamic_cast` does not work because RTTI is not enabled -- Use `static_cast` for casting whenever it works -- `reinterpret_cast` is okay if `static_cast` is not appropriate +## Memory Management ## Memory allocation - `Malloc()`, `Calloc()`, etc. from `util.h` abort in Out-of-Memory situations - `UncheckedMalloc()`, etc. return `nullptr` in OOM situations -## `nullptr` instead of `NULL` or `0` +## Use `nullptr` instead of `NULL` or `0` What it says in the title. +## Ownership and Smart Pointers + +"Smart" pointers are classes that act like pointers, e.g. +by overloading the `*` and `->` operators. Some smart pointer types can be +used to automate ownership bookkeeping, to ensure these responsibilities are +met. `std::unique_ptr` is a smart pointer type introduced in C++11, which +expresses exclusive ownership of a dynamically allocated object; the object +is deleted when the `std::unique_ptr` goes out of scope. It cannot be +copied, but can be moved to represent ownership transfer. +`std::shared_ptr` is a smart pointer type that expresses shared ownership of a +dynamically allocated object. `std::shared_ptr`s can be copied; ownership +of the object is shared among all copies, and the object +is deleted when the last `std::shared_ptr` is destroyed. + +Prefer to use `std::unique_ptr` to make ownership +transfer explicit. For example: + +```cpp +std::unique_ptr FooFactory(); +void FooConsumer(std::unique_ptr ptr); +``` + +Never use `std::auto_ptr`. Instead, use `std::unique_ptr`. + +## Others + +## Type casting + +- Always avoid C-style casts (`(type)value`) +- `dynamic_cast` does not work because RTTI is not enabled +- Use `static_cast` for casting whenever it works +- `reinterpret_cast` is okay if `static_cast` is not appropriate + ## Do not include `*.h` if `*-inl.h` has already been included Do diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 20b75bd9718be2..7b8903fa5c8bae 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -134,4 +134,4 @@ The TSC follows a [Consensus Seeking][] decision making model as described by the [TSC Charter][]. [TSC Charter]: https://github.com/nodejs/TSC/blob/master/TSC-Charter.md -[Consensus Seeking]: http://en.wikipedia.org/wiki/Consensus-seeking_decision-making +[Consensus Seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making diff --git a/Makefile b/Makefile index b2facee41a8442..992af027687657 100644 --- a/Makefile +++ b/Makefile @@ -63,11 +63,17 @@ V ?= 1 # BUILDTYPE=Debug builds both release and debug builds. If you want to compile # just the debug build, run `make -C out BUILDTYPE=Debug` instead. ifeq ($(BUILDTYPE),Release) -all: out/Makefile $(NODE_EXE) +all: out/Makefile $(NODE_EXE) ## Default target, builds node in out/Release/node. else all: out/Makefile $(NODE_EXE) $(NODE_G_EXE) endif +# To add a target to the help, add a double comment (##) on the target line. +help: ## Print help for targets with comments. + @printf "For more targets and info see the comments in the Makefile.\n\n" + @grep -E '^[a-zA-Z0-9._-]+:.*?## .*$$' Makefile | sort | \ + awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' + # The .PHONY is needed to ensure that we recursively use the out/Makefile # to check for changes. .PHONY: $(NODE_EXE) $(NODE_G_EXE) @@ -94,13 +100,13 @@ out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp \ config.gypi: configure $(error Missing or stale $@, please run ./$<) -install: all +install: all ## Installs node into $PREFIX (default=/usr/local). $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)' -uninstall: +uninstall: ## Uninstalls node from $PREFIX (default=/usr/local). $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)' -clean: +clean: ## Remove build artifacts. $(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \ out/$(BUILDTYPE)/node.exp @if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi @@ -132,7 +138,7 @@ coverage-clean: $(RM) -r node_modules $(RM) -r gcovr testing $(RM) -r out/$(BUILDTYPE)/.coverage - $(RM) -r .cov_tmp coverage + $(RM) -r .cov_tmp $(RM) out/$(BUILDTYPE)/obj.target/node/{src,gen}/*.gcda $(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda $(RM) out/$(BUILDTYPE)/obj.target/node/{src,gen}/*.gcno @@ -145,7 +151,7 @@ coverage-clean: # For C++ coverage reporting, this needs to be run in conjunction with configure # --coverage. html coverage reports will be created under coverage/ -coverage: coverage-test +coverage: coverage-test ## Run the tests and generate a coverage report. coverage-build: all mkdir -p node_modules @@ -205,23 +211,18 @@ v8: tools/make-v8.sh $(MAKE) -C deps/v8 $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) -ifeq ($(NODE_TARGET_TYPE),static_library) -test: all - $(MAKE) cctest -else -test: all - $(MAKE) build-addons - $(MAKE) build-addons-napi - $(MAKE) doc-only - $(MAKE) lint - $(MAKE) cctest +test: all ## Default test target. Runs default tests, linters, and builds docs. + $(MAKE) -s build-addons + $(MAKE) -s build-addons-napi + $(MAKE) -s doc-only + $(MAKE) -s lint + $(MAKE) -s cctest $(PYTHON) tools/test.py --mode=release -J \ $(CI_ASYNC_HOOKS) \ $(CI_JS_SUITES) \ $(CI_NATIVE_SUITES) \ $(CI_DOC) \ known_issues -endif # For a quick test, does not run linter or build doc test-only: all @@ -319,7 +320,7 @@ test/addons/.buildstamp: config.gypi \ # .buildstamp is out of date and need a rebuild. # Just goes to show that recursive make really is harmful... # TODO(bnoordhuis) Force rebuild after gyp update. -build-addons: $(NODE_EXE) test/addons/.buildstamp +build-addons: | $(NODE_EXE) test/addons/.buildstamp ADDONS_NAPI_BINDING_GYPS := \ $(filter-out test/addons-napi/??_*/binding.gyp, \ @@ -358,7 +359,7 @@ test/addons-napi/.buildstamp: config.gypi \ # .buildstamp is out of date and need a rebuild. # Just goes to show that recursive make really is harmful... # TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. -build-addons-napi: $(NODE_EXE) test/addons-napi/.buildstamp +build-addons-napi: | $(NODE_EXE) test/addons-napi/.buildstamp clear-stalled: # Clean up any leftover processes but don't error if found. @@ -378,7 +379,7 @@ test-build: | all build-addons build-addons-napi test-build-addons-napi: all build-addons-napi -test-all: test-build test/gc/build/Release/binding.node +test-all: test-build test/gc/build/Release/binding.node ## Run everything in test/. $(PYTHON) tools/test.py --mode=debug,release test-all-valgrind: test-build @@ -457,7 +458,7 @@ test-doc: doc-only test-known-issues: all $(PYTHON) tools/test.py known_issues -test-npm: $(NODE_EXE) +test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm. $(NODE) tools/test-npm-package --install --logfile=test-npm.tap deps/npm test-node test-npm-publish: $(NODE_EXE) @@ -499,13 +500,14 @@ test-with-async-hooks: ifneq ("","$(wildcard deps/v8/tools/run-tests.py)") -test-v8: v8 +test-v8: v8 ## Runs the V8 test suite on deps/v8. # note: performs full test unless QUICKCHECK is specified deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \ --mode=$(BUILDTYPE_LOWER) $(V8_TEST_OPTIONS) $(QUICKCHECK_ARG) \ --no-presubmit \ --shell-dir=$(PWD)/deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) \ $(TAP_V8) + git clean -fdxq -- deps/v8 @echo Testing hash seed $(MAKE) test-hash-seed @@ -536,47 +538,68 @@ endif # generated .html files DOCS_ANALYTICS ?= +apidoc_dirs = out/doc out/doc/api out/doc/api/assets apidoc_sources = $(wildcard doc/api/*.md) -apidocs_html = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.html)) -apidocs_json = $(apidoc_dirs) $(apiassets) $(addprefix out/,$(apidoc_sources:.md=.json)) - -apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets +apidocs_html = $(addprefix out/,$(apidoc_sources:.md=.html)) +apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json)) apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*))) -doc-only: $(apidocs_html) $(apidocs_json) +# This uses the locally built node if available, otherwise uses the global node +doc-only: $(apidoc_dirs) $(apiassets) +# If it's a source tarball, assets are already in doc/api/assets, +# no need to install anything, we have already copied the docs over + if [ ! -d doc/api/assets ]; then \ + $(MAKE) tools/doc/node_modules/js-yaml/package.json; \ + fi; + @$(MAKE) -s $(apidocs_html) $(apidocs_json) + doc: $(NODE_EXE) doc-only -$(apidoc_dirs): - @mkdir -p $@ +out/doc: + mkdir -p $@ +# If it's a source tarball, doc/api already contains the generated docs. +# Just copy everything under doc/api over. +out/doc/api: doc/api + mkdir -p $@ + cp -r doc/api out/doc + +# If it's a source tarball, assets are already in doc/api/assets +out/doc/api/assets: + mkdir -p $@ + if [ -d doc/api/assets ]; then cp -r doc/api/assets out/doc/api; fi; + +# If it's not a source tarball, we need to copy assets from doc/api_assets out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets @cp $< $@ -out/doc/%: doc/% - @cp -r $< $@ +# Use -e to double check in case it's a broken link +# Use $(PWD) so we can cd to anywhere before calling this +available-node = \ + if [ -x $(PWD)/$(NODE) ] && [ -e $(PWD)/$(NODE) ]; then \ + $(PWD)/$(NODE) $(1); \ + elif [ -x `which node` ] && [ -e `which node` ]; then \ + `which node` $(1); \ + else \ + echo "No available node, cannot run \"node $(1)\""; \ + exit 1; \ + fi; + +run-npm-install = $(PWD)/$(NPM) install --production + +tools/doc/node_modules/js-yaml/package.json: + cd tools/doc && $(call available-node,$(run-npm-install)) -# check if ./node is actually set, else use user pre-installed binary gen-json = tools/doc/generate.js --format=json $< > $@ gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html \ --template=doc/template.html --analytics=$(DOCS_ANALYTICS) $< > $@ -gen-doc = \ - [ -e tools/doc/node_modules/js-yaml/package.json ] || \ - [ -e tools/eslint/node_modules/js-yaml/package.json ] || \ - if [ -x $(NODE) ]; then \ - cd tools/doc && ../../$(NODE) ../../$(NPM) install; \ - else \ - cd tools/doc && node ../../$(NPM) install; \ - fi;\ - [ -x $(NODE) ] && $(NODE) $(1) || node $(1) - out/doc/api/%.json: doc/api/%.md - @$(call gen-doc, $(gen-json)) + $(call available-node, $(gen-json)) -# check if ./node is actually set, else use user pre-installed binary out/doc/api/%.html: doc/api/%.md - @$(call gen-doc, $(gen-html)) + $(call available-node, $(gen-html)) docopen: $(apidocs_html) @$(PYTHON) -mwebbrowser file://$(PWD)/out/doc/api/all.html @@ -843,7 +866,7 @@ ifeq ($(XZ), 0) endif $(RM) $(TARNAME).tar -tar: $(TARBALL) +tar: $(TARBALL) ## Create a source tarball. tar-upload: tar ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" @@ -879,7 +902,7 @@ ifeq ($(XZ), 0) endif $(RM) $(TARNAME)-headers.tar -tar-headers: $(TARBALL)-headers +tar-headers: $(TARBALL)-headers ## Build the node header tarball. tar-headers-upload: tar-headers ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" @@ -916,7 +939,7 @@ ifeq ($(XZ), 0) endif $(RM) $(BINARYNAME).tar -binary: $(BINARYTAR) +binary: $(BINARYTAR) ## Build release binary tarballs. binary-upload: binary ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" @@ -967,7 +990,7 @@ bench-dgram: all bench-all: bench bench-misc bench-array bench-buffer bench-url bench-events bench-dgram bench-util -bench: bench-net bench-http bench-fs bench-tls +bench: bench-net bench-http bench-fs bench-tls ## Run node benchmarks. bench-ci: bench @@ -1015,6 +1038,13 @@ LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \ --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \ $(LINT_JS_TARGETS) +lint-js-fix: + @if [ -x $(NODE) ]; then \ + $(NODE) $(LINT_JS_CMD) --fix; \ + else \ + node $(LINT_JS_CMD) --fix; \ + fi + lint-js: @echo "Running JS linter..." @if [ -x $(NODE) ]; then \ @@ -1086,11 +1116,10 @@ cpplint: lint-cpp @echo "Please use lint-cpp instead of cpplint" ifneq ("","$(wildcard tools/eslint/)") -lint: +lint: ## Run JS, C++, MD and doc linters. @EXIT_STATUS=0 ; \ $(MAKE) lint-js || EXIT_STATUS=$$? ; \ $(MAKE) lint-cpp || EXIT_STATUS=$$? ; \ - $(MAKE) lint-md || EXIT_STATUS=$$? ; \ $(MAKE) lint-addon-docs || EXIT_STATUS=$$? ; \ exit $$EXIT_STATUS CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+ @@ -1152,6 +1181,7 @@ lint-clean: docclean \ docopen \ dynamiclib \ + help \ install \ install-bin \ install-includes \ @@ -1161,6 +1191,7 @@ lint-clean: lint-cpp \ lint-js \ lint-js-ci \ + lint-js-fix \ list-gtests \ lint-md \ lint-md-build \ diff --git a/README.md b/README.md index ce40c348e4cce2..e37a2b70d82b02 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,10 @@ policies, and releases are managed under an **This project is bound by a [Code of Conduct][].** -If you need help using or installing Node.js, please use the -[nodejs/help](https://github.com/nodejs/help) issue tracker. - # Table of Contents -* [Resources for Newcomers](#resources-for-newcomers) +* [Support](#support) * [Release Types](#release-types) * [Download](#download) * [Current and LTS Releases](#current-and-lts-releases) @@ -33,38 +30,43 @@ If you need help using or installing Node.js, please use the * [API Documentation](#api-documentation) * [Verifying Binaries](#verifying-binaries) * [Building Node.js](#building-nodejs) - * [Security](#security) - * [Current Project Team Members](#current-project-team-members) - * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) - * [Collaborators](#collaborators) - * [Release Team](#release-team) +* [Security](#security) +* [Current Project Team Members](#current-project-team-members) + * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) + * [Collaborators](#collaborators) + * [Release Team](#release-team) +* [Contributing to Node.js](#contributing-to-nodejs) + +## Support -## Resources for Newcomers +Node.js contributors have limited availability to address general support +questions. Please make sure you are using a [currently-supported version of +Node.js](https://github.com/nodejs/Release#release-schedule). -### Official Resources +When looking for support, please first search for your question in these venues: -* [Website][] +* [Node.js Website][] * [Node.js Help][] -* [Contributing to the project][] -* IRC (node core development): [#node-dev on chat.freenode.net][] +* [Open or closed issues in the Node.js GitHub organization](https://github.com/issues?utf8=%E2%9C%93&q=sort%3Aupdated-desc+org%3Anodejs+is%3Aissue) +* [Questions tagged 'node.js' on StackOverflow][] -### Unofficial Resources +If you didn't find an answer in one of the venues above, you can: -* IRC (general questions): [#node.js on chat.freenode.net][]. Please see - for more information regarding the `#node.js` IRC -channel. +* Join the **unofficial** [#node.js channel on chat.freenode.net][]. See + for more information. -_Please note that unofficial resources are neither managed by (nor necessarily -endorsed by) the Node.js TSC. Specifically, such resources are not -currently covered by the [Node.js Moderation Policy][] and the selection and -actions of resource operators/moderators are not subject to TSC oversight._ +GitHub issues are meant for tracking enhancements and bugs, not general support. + +Remember, libre != gratis; the open source license grants you the freedom to use +and modify, but not commitments of other people's time. Please be respectful, +and set your expectations accordingly. ## Release Types The Node.js project maintains multiple types of releases: * **Current**: Released from active development branches of this repository, - versioned by [SemVer](http://semver.org/) and signed by a member of the + versioned by [SemVer](https://semver.org) and signed by a member of the [Release Team](#release-team). Code for Current releases is organized in this repository by major version number. For example: [v4.x](https://github.com/nodejs/node/tree/v4.x). @@ -88,7 +90,7 @@ The Node.js project maintains multiple types of releases: More information can be found in the [LTS README](https://github.com/nodejs/LTS/). -## Download +### Download Binaries, installers, and source tarballs are available at . @@ -114,11 +116,11 @@ documentation of the latest stable version. ### Verifying Binaries -Current, LTS and Nightly download directories all contain a _SHASUMS256.txt_ +Current, LTS, and Nightly download directories all contain a SHASUMS256.txt file that lists the SHA checksums for each file available for download. -The _SHASUMS256.txt_ can be downloaded using curl. +The SHASUMS256.txt can be downloaded using `curl`. ```console $ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt @@ -131,12 +133,9 @@ it through `sha256sum` with a command such as: $ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c - ``` -_(Where "node-vx.y.z.tar.gz" is the name of the file you have -downloaded)_ - -Additionally, Current and LTS releases (not Nightlies) have the GPG -detached signature of SHASUMS256.txt available as SHASUMS256.txt.sig. -You can use `gpg` to verify that SHASUMS256.txt has not been tampered with. +Current and LTS releases (but not Nightlies) also have the GPG detached +signature of SHASUMS256.txt available as SHASUMS256.txt.sig. You can use `gpg` +to verify that SHASUMS256.txt has not been tampered with. To verify SHASUMS256.txt has not been altered, you will first need to import all of the GPG keys of individuals authorized to create releases. They are @@ -147,8 +146,7 @@ Use a command such as this to import the keys: $ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D ``` -_(See the bottom of this README for a full script to import active -release keys)_ +See the bottom of this README for a full script to import active release keys. Next, download the SHASUMS256.txt.sig for the release: @@ -195,12 +193,12 @@ us a report nonetheless. - [#14519](https://github.com/nodejs/node/issues/14519): _Internal domain function can be used to cause segfaults_. Causing program termination using - either the public Javascript APIs or the private bindings layer APIs requires - the ability to execute arbitrary Javascript code, which is already the highest + either the public JavaScript APIs or the private bindings layer APIs requires + the ability to execute arbitrary JavaScript code, which is already the highest level of privilege possible. - [#12141](https://github.com/nodejs/node/pull/12141): _buffer: zero fill - Buffer(num) by default_. The buffer constructor behaviour was documented, + Buffer(num) by default_. The buffer constructor behavior was documented, but found to be prone to [mis-use](https://snyk.io/blog/exploiting-buffer/). It has since been changed, but despite much debate, was not considered misuse prone enough to justify fixing in older release lines and breaking our @@ -364,6 +362,10 @@ For more information about the governance of the Node.js project, see **Gibson Fahnestock** <gibfahn@gmail.com> (he/him) * [gireeshpunathil](https://github.com/gireeshpunathil) - **Gireesh Punathil** <gpunathi@in.ibm.com> (he/him) +* [guybedford](https://github.com/guybedford) - +**Guy Bedford** <guybedford@gmail.com> (he/him) +* [hashseed](https://github.com/hashseed) - +**Yang Guo** <yangguo@chromium.org> (he/him) * [iarna](https://github.com/iarna) - **Rebecca Turner** <me@re-becca.org> * [imran-iq](https://github.com/imran-iq) - @@ -406,6 +408,8 @@ For more information about the governance of the Node.js project, see **Luigi Pinca** <luigipinca@gmail.com> (he/him) * [lucamaraschi](https://github.com/lucamaraschi) - **Luca Maraschi** <luca.maraschi@gmail.com> (he/him) +* [maclover7](https://github.com/maclover7) - +**Jon Moss** <me@jonathanmoss.me> (he/him) * [matthewloring](https://github.com/matthewloring) - **Matthew Loring** <mattloring@google.com> * [mcollina](https://github.com/mcollina) - @@ -575,16 +579,16 @@ Previous releases may also have been signed with one of the following GPG keys: * **Timothy J Fontaine** <tjfontaine@gmail.com> `7937DFD2AB06298B2293C3187D33FF9D0246406D` -### Working Groups +## Contributing to Node.js -Information on the current Node.js Working Groups can be found in the -[TSC repository](https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md). +* [Contributing to the project][] +* [Working Groups][] [npm]: https://www.npmjs.com -[Website]: https://nodejs.org/en/ +[Code of Conduct]: https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md [Contributing to the project]: CONTRIBUTING.md [Node.js Help]: https://github.com/nodejs/help -[Node.js Moderation Policy]: https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md -[#node.js on chat.freenode.net]: https://webchat.freenode.net?channels=node.js&uio=d4 -[#node-dev on chat.freenode.net]: https://webchat.freenode.net?channels=node-dev&uio=d4 -[Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md +[Node.js Website]: https://nodejs.org/en/ +[Questions tagged 'node.js' on StackOverflow]: https://stackoverflow.com/questions/tagged/node.js +[Working Groups]: https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md +[#node.js channel on chat.freenode.net]: https://webchat.freenode.net?channels=node.js&uio=d4 diff --git a/benchmark/async_hooks/gc-tracking.js b/benchmark/async_hooks/gc-tracking.js new file mode 100644 index 00000000000000..c71c1b07aa5431 --- /dev/null +++ b/benchmark/async_hooks/gc-tracking.js @@ -0,0 +1,45 @@ +'use strict'; +const common = require('../common.js'); +const { AsyncResource } = require('async_hooks'); + +const bench = common.createBenchmark(main, { + n: [1e6], + method: [ + 'trackingEnabled', + 'trackingDisabled', + ] +}, { + flags: ['--expose-gc'] +}); + +function endAfterGC(n) { + setImmediate(() => { + global.gc(); + setImmediate(() => { + bench.end(n); + }); + }); +} + +function main(conf) { + const n = +conf.n; + + switch (conf.method) { + case 'trackingEnabled': + bench.start(); + for (let i = 0; i < n; i++) { + new AsyncResource('foobar'); + } + endAfterGC(n); + break; + case 'trackingDisabled': + bench.start(); + for (let i = 0; i < n; i++) { + new AsyncResource('foobar', { requireManualDestroy: true }); + } + endAfterGC(n); + break; + default: + throw new Error('Unsupported method'); + } +} diff --git a/benchmark/fixtures/simple-http-server.js b/benchmark/fixtures/simple-http-server.js index 5f56bebdafd75f..d2eda0c085c9f2 100644 --- a/benchmark/fixtures/simple-http-server.js +++ b/benchmark/fixtures/simple-http-server.js @@ -34,7 +34,7 @@ module.exports = http.createServer(function(req, res) { const arg = params[2]; const n_chunks = parseInt(params[3], 10); const resHow = params.length >= 5 ? params[4] : 'normal'; - const chunkedEnc = params.length >= 6 && params[5] === 'false' ? false : true; + const chunkedEnc = params.length >= 6 && params[5] === '0' ? false : true; var status = 200; var n, i; diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js index 4412d41f98dc65..162cef6864a686 100644 --- a/benchmark/fs/read-stream-throughput.js +++ b/benchmark/fs/read-stream-throughput.js @@ -3,7 +3,8 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(__dirname, '.removeme-benchmark-garbage'); +const filename = path.resolve(__dirname, + `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); const assert = require('assert'); @@ -34,7 +35,7 @@ function main(conf) { throw new Error(`invalid encodingType: ${encodingType}`); } - makeFile(runTest); + makeFile(); } function runTest() { diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index d89061d6061b0c..82479ff14e5f68 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -5,7 +5,8 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(__dirname, '.removeme-benchmark-garbage'); +const filename = path.resolve(__dirname, + `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); const bench = common.createBenchmark(main, { diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index 2083cccbd6ac81..5c6464fdbb2cbb 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -3,7 +3,8 @@ const path = require('path'); const common = require('../common.js'); -const filename = path.resolve(__dirname, '.removeme-benchmark-garbage'); +const filename = path.resolve(__dirname, + `.removeme-benchmark-garbage-${process.pid}`); const fs = require('fs'); const bench = common.createBenchmark(main, { diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js index 238cd1885d3ca7..544aad49688386 100644 --- a/benchmark/http/simple.js +++ b/benchmark/http/simple.js @@ -8,14 +8,14 @@ const bench = common.createBenchmark(main, { len: [4, 1024, 102400], chunks: [1, 4], c: [50, 500], - chunkedEnc: ['true', 'false'], + chunkedEnc: [1, 0], res: ['normal', 'setHeader', 'setHeaderWH'] }); function main(conf) { process.env.PORT = PORT; var server = require('../fixtures/simple-http-server.js') - .listen(process.env.PORT || common.PORT) + .listen(PORT) .on('listening', function() { const path = `/${conf.type}/${conf.len}/${conf.chunks}/${conf.res}/${conf.chunkedEnc}`; diff --git a/benchmark/http2/headers.js b/benchmark/http2/headers.js index 62156774caa49d..3c8d0465acb0d0 100644 --- a/benchmark/http2/headers.js +++ b/benchmark/http2/headers.js @@ -13,7 +13,9 @@ function main(conf) { const n = +conf.n; const nheaders = +conf.nheaders; const http2 = require('http2'); - const server = http2.createServer(); + const server = http2.createServer({ + maxHeaderListPairs: 20000 + }); const headersObject = { ':path': '/', @@ -34,7 +36,9 @@ function main(conf) { stream.end('Hi!'); }); server.listen(PORT, () => { - const client = http2.connect(`http://localhost:${PORT}/`); + const client = http2.connect(`http://localhost:${PORT}/`, { + maxHeaderListPairs: 20000 + }); function doRequest(remaining) { const req = client.request(headersObject); diff --git a/benchmark/net/tcp-raw-c2s.js b/benchmark/net/tcp-raw-c2s.js index 9b2e926d690504..bd41be87728308 100644 --- a/benchmark/net/tcp-raw-c2s.js +++ b/benchmark/net/tcp-raw-c2s.js @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, { dur: [5] }); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const WriteWrap = process.binding('stream_wrap').WriteWrap; const PORT = common.PORT; @@ -36,7 +36,7 @@ function fail(err, syscall) { } function server() { - const serverHandle = new TCP(); + const serverHandle = new TCP(TCPConstants.SERVER); var err = serverHandle.bind('127.0.0.1', PORT); if (err) fail(err, 'bind'); @@ -92,7 +92,7 @@ function client() { throw new Error(`invalid type: ${type}`); } - const clientHandle = new TCP(); + const clientHandle = new TCP(TCPConstants.SOCKET); const connectReq = new TCPConnectWrap(); const err = clientHandle.connect(connectReq, '127.0.0.1', PORT); diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js index 204b27b965a340..4dd06ed446d6c1 100644 --- a/benchmark/net/tcp-raw-pipe.js +++ b/benchmark/net/tcp-raw-pipe.js @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, { dur: [5] }); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const WriteWrap = process.binding('stream_wrap').WriteWrap; const PORT = common.PORT; @@ -35,7 +35,7 @@ function fail(err, syscall) { } function server() { - const serverHandle = new TCP(); + const serverHandle = new TCP(TCPConstants.SERVER); var err = serverHandle.bind('127.0.0.1', PORT); if (err) fail(err, 'bind'); @@ -89,7 +89,7 @@ function client() { throw new Error(`invalid type: ${type}`); } - const clientHandle = new TCP(); + const clientHandle = new TCP(TCPConstants.SOCKET); const connectReq = new TCPConnectWrap(); const err = clientHandle.connect(connectReq, '127.0.0.1', PORT); var bytes = 0; diff --git a/benchmark/net/tcp-raw-s2c.js b/benchmark/net/tcp-raw-s2c.js index 412ded7355aa43..2ca6016ce017a1 100644 --- a/benchmark/net/tcp-raw-s2c.js +++ b/benchmark/net/tcp-raw-s2c.js @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, { dur: [5] }); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const WriteWrap = process.binding('stream_wrap').WriteWrap; const PORT = common.PORT; @@ -35,7 +35,7 @@ function fail(err, syscall) { } function server() { - const serverHandle = new TCP(); + const serverHandle = new TCP(TCPConstants.SERVER); var err = serverHandle.bind('127.0.0.1', PORT); if (err) fail(err, 'bind'); @@ -107,7 +107,7 @@ function server() { } function client() { - const clientHandle = new TCP(); + const clientHandle = new TCP(TCPConstants.SOCKET); const connectReq = new TCPConnectWrap(); const err = clientHandle.connect(connectReq, '127.0.0.1', PORT); diff --git a/benchmark/process/next-tick-breadth-args.js b/benchmark/process/next-tick-breadth-args.js index cc038dd348faac..ca608f15daa743 100644 --- a/benchmark/process/next-tick-breadth-args.js +++ b/benchmark/process/next-tick-breadth-args.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - millions: [2] + millions: [4] }); function main(conf) { diff --git a/benchmark/process/next-tick-breadth.js b/benchmark/process/next-tick-breadth.js index 8f8d0adc618dad..51951ce0afd645 100644 --- a/benchmark/process/next-tick-breadth.js +++ b/benchmark/process/next-tick-breadth.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - millions: [2] + millions: [4] }); function main(conf) { diff --git a/benchmark/process/next-tick-exec-args.js b/benchmark/process/next-tick-exec-args.js new file mode 100644 index 00000000000000..5ff017bb29cd5b --- /dev/null +++ b/benchmark/process/next-tick-exec-args.js @@ -0,0 +1,25 @@ +'use strict'; +const common = require('../common.js'); +const bench = common.createBenchmark(main, { + millions: [5] +}); + +function main(conf) { + var n = +conf.millions * 1e6; + + bench.start(); + for (var i = 0; i < n; i++) { + if (i % 4 === 0) + process.nextTick(onNextTick, i, true, 10, 'test'); + else if (i % 3 === 0) + process.nextTick(onNextTick, i, true, 10); + else if (i % 2 === 0) + process.nextTick(onNextTick, i, 20); + else + process.nextTick(onNextTick, i); + } + function onNextTick(i) { + if (i + 1 === n) + bench.end(+conf.millions); + } +} diff --git a/benchmark/process/next-tick-exec.js b/benchmark/process/next-tick-exec.js new file mode 100644 index 00000000000000..12c9d4624a903c --- /dev/null +++ b/benchmark/process/next-tick-exec.js @@ -0,0 +1,18 @@ +'use strict'; +const common = require('../common.js'); +const bench = common.createBenchmark(main, { + millions: [5] +}); + +function main(conf) { + var n = +conf.millions * 1e6; + + bench.start(); + for (var i = 0; i < n; i++) { + process.nextTick(onNextTick, i); + } + function onNextTick(i) { + if (i + 1 === n) + bench.end(+conf.millions); + } +} diff --git a/benchmark/timers/immediate.js b/benchmark/timers/immediate.js index 3ba4429260fb65..bbe81555cacc97 100644 --- a/benchmark/timers/immediate.js +++ b/benchmark/timers/immediate.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - thousands: [2000], + thousands: [5000], type: ['depth', 'depth1', 'breadth', 'breadth1', 'breadth4', 'clear'] }); @@ -88,6 +88,7 @@ function breadth1(N) { // concurrent setImmediate, 4 arguments function breadth4(N) { + N /= 2; var n = 0; bench.start(); function cb(a1, a2, a3, a4) { @@ -101,6 +102,7 @@ function breadth4(N) { } function clear(N) { + N *= 4; bench.start(); function cb(a1) { if (a1 === 2) diff --git a/benchmark/timers/set-immediate-breadth-args.js b/benchmark/timers/set-immediate-breadth-args.js index 6a904e2675d110..348cb62fb2cc1a 100644 --- a/benchmark/timers/set-immediate-breadth-args.js +++ b/benchmark/timers/set-immediate-breadth-args.js @@ -19,9 +19,9 @@ function main(conf) { bench.start(); for (let i = 0; i < N; i++) { if (i % 3 === 0) - setImmediate(cb3, 512, true, null); + setImmediate(cb3, 512, true, null, 512, true, null); else if (i % 2 === 0) - setImmediate(cb2, false, 5.1); + setImmediate(cb2, false, 5.1, 512); else setImmediate(cb1, 0); } diff --git a/benchmark/timers/set-immediate-depth-args.js b/benchmark/timers/set-immediate-depth-args.js index 1f12ae6ec73fc0..704b1814514a93 100644 --- a/benchmark/timers/set-immediate-depth-args.js +++ b/benchmark/timers/set-immediate-depth-args.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - millions: [10] + millions: [5] }); function main(conf) { @@ -15,9 +15,9 @@ function main(conf) { function cb3(n, arg2, arg3) { if (--n) { if (n % 3 === 0) - setImmediate(cb3, n, true, null); + setImmediate(cb3, n, true, null, 5.1, null, true); else if (n % 2 === 0) - setImmediate(cb2, n, 5.1); + setImmediate(cb2, n, 5.1, true); else setImmediate(cb1, n); } @@ -25,9 +25,9 @@ function main(conf) { function cb2(n, arg2) { if (--n) { if (n % 3 === 0) - setImmediate(cb3, n, true, null); + setImmediate(cb3, n, true, null, 5.1, null, true); else if (n % 2 === 0) - setImmediate(cb2, n, 5.1); + setImmediate(cb2, n, 5.1, true); else setImmediate(cb1, n); } @@ -35,9 +35,9 @@ function main(conf) { function cb1(n) { if (--n) { if (n % 3 === 0) - setImmediate(cb3, n, true, null); + setImmediate(cb3, n, true, null, 5.1, null, true); else if (n % 2 === 0) - setImmediate(cb2, n, 5.1); + setImmediate(cb2, n, 5.1, true); else setImmediate(cb1, n); } diff --git a/benchmark/timers/timers-breadth.js b/benchmark/timers/timers-breadth.js index 036c878191422c..02ebd5bb0d082b 100644 --- a/benchmark/timers/timers-breadth.js +++ b/benchmark/timers/timers-breadth.js @@ -2,7 +2,7 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - thousands: [500], + thousands: [5000], }); function main(conf) { diff --git a/benchmark/timers/timers-cancel-pooled.js b/benchmark/timers/timers-cancel-pooled.js index 2e834cc4db53fe..23cef153876f20 100644 --- a/benchmark/timers/timers-cancel-pooled.js +++ b/benchmark/timers/timers-cancel-pooled.js @@ -3,11 +3,11 @@ const common = require('../common.js'); const assert = require('assert'); const bench = common.createBenchmark(main, { - thousands: [500], + millions: [5], }); function main(conf) { - const iterations = +conf.thousands * 1e3; + const iterations = +conf.millions * 1e6; var timer = setTimeout(() => {}, 1); for (var i = 0; i < iterations; i++) { @@ -24,7 +24,7 @@ function main(conf) { clearTimeout(timer); } - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); } function cb() { diff --git a/benchmark/timers/timers-cancel-unpooled.js b/benchmark/timers/timers-cancel-unpooled.js index ca3c0dbcd92c12..50931e35124724 100644 --- a/benchmark/timers/timers-cancel-unpooled.js +++ b/benchmark/timers/timers-cancel-unpooled.js @@ -3,11 +3,11 @@ const common = require('../common.js'); const assert = require('assert'); const bench = common.createBenchmark(main, { - thousands: [100], + millions: [1], }); function main(conf) { - const iterations = +conf.thousands * 1e3; + const iterations = +conf.millions * 1e6; const timersList = []; for (var i = 0; i < iterations; i++) { @@ -18,7 +18,7 @@ function main(conf) { for (var j = 0; j < iterations + 1; j++) { clearTimeout(timersList[j]); } - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); } function cb() { diff --git a/benchmark/timers/timers-insert-pooled.js b/benchmark/timers/timers-insert-pooled.js index 80335a150a2a23..8bbc84290ad9b7 100644 --- a/benchmark/timers/timers-insert-pooled.js +++ b/benchmark/timers/timers-insert-pooled.js @@ -2,11 +2,11 @@ const common = require('../common.js'); const bench = common.createBenchmark(main, { - thousands: [500], + millions: [5], }); function main(conf) { - const iterations = +conf.thousands * 1e3; + const iterations = +conf.millions * 1e6; bench.start(); @@ -14,5 +14,5 @@ function main(conf) { setTimeout(() => {}, 1); } - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); } diff --git a/benchmark/timers/timers-insert-unpooled.js b/benchmark/timers/timers-insert-unpooled.js index 98415625862075..efe8e9aaa579c2 100644 --- a/benchmark/timers/timers-insert-unpooled.js +++ b/benchmark/timers/timers-insert-unpooled.js @@ -3,11 +3,11 @@ const common = require('../common.js'); const assert = require('assert'); const bench = common.createBenchmark(main, { - thousands: [100], + millions: [1], }); function main(conf) { - const iterations = +conf.thousands * 1e3; + const iterations = +conf.millions * 1e6; const timersList = []; @@ -15,7 +15,7 @@ function main(conf) { for (var i = 0; i < iterations; i++) { timersList.push(setTimeout(cb, i + 1)); } - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); for (var j = 0; j < iterations + 1; j++) { clearTimeout(timersList[j]); diff --git a/benchmark/timers/timers-timeout-pooled.js b/benchmark/timers/timers-timeout-pooled.js index 2e8753a0c3cda8..d39c8cf969a49b 100644 --- a/benchmark/timers/timers-timeout-pooled.js +++ b/benchmark/timers/timers-timeout-pooled.js @@ -1,23 +1,35 @@ 'use strict'; const common = require('../common.js'); +// The following benchmark measures setting up n * 1e6 timeouts, +// which then get executed on the next uv tick + const bench = common.createBenchmark(main, { - thousands: [500], + millions: [10], }); function main(conf) { - const iterations = +conf.thousands * 1e3; - var count = 0; + const iterations = +conf.millions * 1e6; + let count = 0; - for (var i = 0; i < iterations; i++) { - setTimeout(cb, 1); - } - - bench.start(); + // Function tracking on the hidden class in V8 can cause misleading + // results in this benchmark if only a single function is used — + // alternate between two functions for a fairer benchmark function cb() { count++; if (count === iterations) - bench.end(iterations / 1e3); + bench.end(iterations / 1e6); } + function cb2() { + count++; + if (count === iterations) + bench.end(iterations / 1e6); + } + + for (var i = 0; i < iterations; i++) { + setTimeout(i % 2 ? cb : cb2, 1); + } + + bench.start(); } diff --git a/benchmark/zlib/creation.js b/benchmark/zlib/creation.js index 8dd6f85a85775c..5046ef50ecff06 100644 --- a/benchmark/zlib/creation.js +++ b/benchmark/zlib/creation.js @@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, { function main(conf) { const n = +conf.n; - const fn = zlib['create' + conf.type]; + const fn = zlib[`create${conf.type}`]; if (typeof fn !== 'function') throw new Error('Invalid zlib type'); var i = 0; diff --git a/common.gypi b/common.gypi index 302d494e9e35e2..0d9529f3ad2cc5 100644 --- a/common.gypi +++ b/common.gypi @@ -27,7 +27,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.11', + 'v8_embedder_string': '-node.15', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, @@ -64,9 +64,9 @@ 'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a', }], ['openssl_fips != ""', { - 'OPENSSL_PRODUCT': 'libcrypto.a', + 'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)', }, { - 'OPENSSL_PRODUCT': 'libopenssl.a', + 'OPENSSL_PRODUCT': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)', }], ['OS=="mac"', { 'clang%': 1, @@ -169,7 +169,7 @@ 'msvs_settings': { 'VCCLCompilerTool': { 'Optimization': 3, # /Ox, full optimization - 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size + 'FavorSizeOrSpeed': 1, # /Ot, favor speed over size 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG 'OmitFramePointers': 'true', @@ -186,10 +186,12 @@ ], }, 'VCLinkerTool': { - 'LinkTimeCodeGeneration': 1, # link-time code generation 'OptimizeReferences': 2, # /OPT:REF 'EnableCOMDATFolding': 2, # /OPT:ICF 'LinkIncremental': 1, # disable incremental linking + 'AdditionalOptions': [ + '/LTCG:INCREMENTAL', # incremental link-time code generation + ], }, }, } @@ -212,8 +214,6 @@ 'DisableSpecificWarnings': ['4267'], 'WarnAsError': 'false', }, - 'VCLibrarianTool': { - }, 'VCLinkerTool': { 'conditions': [ ['target_arch=="ia32"', { @@ -420,7 +420,7 @@ }], ['OS=="freebsd"', { 'conditions': [ - ['llvm_version < "4.0"', { + ['"0" < llvm_version < "4.0"', { # Use this flag because on FreeBSD std::pairs copy constructor is non-trivial. # Doesn't apply to llvm 4.0 (FreeBSD 11.1) or later. # Refs: https://lists.freebsd.org/pipermail/freebsd-toolchain/2016-March/002094.html diff --git a/configure b/configure index 0c5aed8fcc0456..e434059d6f520b 100755 --- a/configure +++ b/configure @@ -35,21 +35,23 @@ import subprocess import shutil import string +# If not run from node/, cd to node/. +os.chdir(os.path.dirname(__file__) or '.') + # gcc and g++ as defaults matches what GYP's Makefile generator does, # except on OS X. CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'gcc') CXX = os.environ.get('CXX', 'c++' if sys.platform == 'darwin' else 'g++') -root_dir = os.path.dirname(__file__) -sys.path.insert(0, os.path.join(root_dir, 'tools', 'gyp', 'pylib')) +sys.path.insert(0, os.path.join('tools', 'gyp', 'pylib')) from gyp.common import GetFlavor # imports in tools/configure.d -sys.path.insert(0, os.path.join(root_dir, 'tools', 'configure.d')) +sys.path.insert(0, os.path.join('tools', 'configure.d')) import nodedownload # imports in tools/ -sys.path.insert(0, os.path.join(root_dir, 'tools')) +sys.path.insert(0, 'tools') import getmoduleversion from gyp_node import run_gyp @@ -144,17 +146,17 @@ parser.add_option("--partly-static", parser.add_option("--enable-vtune-profiling", action="store_true", dest="enable_vtune_profiling", - help="Enable profiling support for Intel VTune profiler to profile" + help="Enable profiling support for Intel VTune profiler to profile " "JavaScript code executed in nodejs. This feature is only available " - "for x32, x86 and x64 architectures.") + "for x32, x86, and x64 architectures.") parser.add_option("--link-module", action="append", dest="linked_module", - help="Path to a JS file to be bundled in the binary as a builtin." - "This module will be referenced by path without extension." - "e.g. /root/x/y.js will be referenced via require('root/x/y')." + help="Path to a JS file to be bundled in the binary as a builtin. " + "This module will be referenced by path without extension; " + "e.g. /root/x/y.js will be referenced via require('root/x/y'). " "Can be used multiple times") parser.add_option("--openssl-no-asm", @@ -220,6 +222,27 @@ shared_optgroup.add_option('--shared-libuv-libpath', dest='shared_libuv_libpath', help='a directory to search for the shared libuv DLL') +shared_optgroup.add_option('--shared-nghttp2', + action='store_true', + dest='shared_nghttp2', + help='link to a shared nghttp2 DLL instead of static linking') + +shared_optgroup.add_option('--shared-nghttp2-includes', + action='store', + dest='shared_nghttp2_includes', + help='directory containing nghttp2 header files') + +shared_optgroup.add_option('--shared-nghttp2-libname', + action='store', + dest='shared_nghttp2_libname', + default='nghttp2', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_option('--shared-nghttp2-libpath', + action='store', + dest='shared_nghttp2_libpath', + help='a directory to search for the shared nghttp2 DLLs') + shared_optgroup.add_option('--shared-openssl', action='store_true', dest='shared_openssl', @@ -411,7 +434,7 @@ intl_optgroup.add_option('--download', intl_optgroup.add_option('--download-path', action='store', dest='download_path', - default=os.path.join(root_dir, 'deps'), + default='deps', help='Download directory [default: %default]') parser.add_option_group(intl_optgroup) @@ -671,8 +694,7 @@ def check_compiler(o): # to a version that is not completely ancient. warn('C compiler too old, need gcc 4.2 or clang 3.2 (CC=%s)' % CC) - if is_clang: - o['variables']['llvm_version'] = get_llvm_version(CC) + o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else 0 # Need xcode_version or gas_version when openssl asm files are compiled. if options.without_ssl or options.openssl_no_asm or options.shared_openssl: @@ -863,7 +885,7 @@ def configure_node(o): o['variables']['node_enable_v8_vtunejit'] = b(options.enable_vtune_profiling) elif options.enable_vtune_profiling: raise Exception( - 'The VTune profiler for JavaScript is only supported on x32, x86 and x64 ' + 'The VTune profiler for JavaScript is only supported on x32, x86, and x64 ' 'architectures.') else: o['variables']['node_enable_v8_vtunejit'] = 'false' @@ -1026,7 +1048,7 @@ def configure_openssl(o): o['defines'] += ['NODE_WITHOUT_NODE_OPTIONS'] if options.openssl_fips: o['variables']['openssl_fips'] = options.openssl_fips - fips_dir = os.path.join(root_dir, 'deps', 'openssl', 'fips') + fips_dir = os.path.join('deps', 'openssl', 'fips') fips_ld = os.path.abspath(os.path.join(fips_dir, 'fipsld')) # LINK is for Makefiles, LD/LDXX is for ninja o['make_fips_settings'] = [ @@ -1071,7 +1093,7 @@ def configure_static(o): def write(filename, data): - filename = os.path.join(root_dir, filename) + filename = filename print('creating %s' % filename) f = open(filename, 'w+') f.write(data) @@ -1193,7 +1215,7 @@ def configure_intl(o): return # this is just the 'deps' dir. Used for unpacking. - icu_parent_path = os.path.join(root_dir, 'deps') + icu_parent_path = 'deps' # The full path to the ICU source directory. Should not include './'. icu_full_path = 'deps/icu' @@ -1415,6 +1437,7 @@ configure_library('zlib', output) configure_library('http_parser', output) configure_library('libuv', output) configure_library('libcares', output) +configure_library('nghttp2', output) # stay backwards compatible with shared cares builds output['variables']['node_shared_cares'] = \ output['variables'].pop('node_shared_libcares') @@ -1461,8 +1484,6 @@ config = { 'BUILDTYPE': 'Debug' if options.debug else 'Release', 'USE_XCODE': str(int(options.use_xcode or 0)), 'PYTHON': sys.executable, - 'NODE_TARGET_TYPE': variables['node_target_type'] if options.enable_static \ - else '', } if options.prefix: diff --git a/deps/icu-small/source/common/uchar_props_data.h b/deps/icu-small/source/common/uchar_props_data.h index 94de36673d72e3..868631131c8643 100644 --- a/deps/icu-small/source/common/uchar_props_data.h +++ b/deps/icu-small/source/common/uchar_props_data.h @@ -1362,7 +1362,7 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x79f,0x7a5,0x7ad,0x7b5,0x7bd,0x7c3,0x7cb,0x7d3,0x7db,0x7e1,0x7e9,0x7f1,0x7f9,0x801,0x809,0x810, 0x818,0x81e,0x826,0x82e,0x836,0x83c,0x844,0x84c,0x854,0x122d,0x85c,0x864,0x86c,0x873,0x87b,0x883, 0x88b,0x88f,0x897,0x89e,0x8a6,0x8ae,0x8b6,0x8be,0x153d,0x1545,0x8c6,0x8ce,0x8d6,0x8de,0x8e6,0x8ed, -0x15a3,0x1593,0x159b,0x1879,0x1881,0x123d,0x8f5,0x1235,0x147f,0x147f,0x1481,0x1251,0x1252,0x1245,0x1247,0x1249, +0x15a3,0x1593,0x159b,0x1879,0x1881,0x123d,0x8f5,0x1235,0x1487,0x1487,0x1489,0x1251,0x1252,0x1245,0x1247,0x1249, 0x15ab,0x15ad,0x8fd,0x15ad,0x905,0x90a,0x912,0x15b2,0x918,0x15ad,0x91e,0x926,0xc18,0x15ba,0x15ba,0x92e, 0x15ca,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb,0x15cb, 0x15cb,0x15cb,0x15cb,0x15c2,0x936,0x15d3,0x15d3,0x93e,0xb25,0xb2d,0xb35,0xb3d,0x15e3,0x15db,0x946,0x94e, @@ -1378,7 +1378,7 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x172a,0x172e,0x172e,0x1731,0x172e,0x172e,0x1737,0x172e,0x1777,0x1837,0x1891,0xb62,0xb68,0xb6e,0xb76,0xb7b, 0x17d7,0xc28,0xc2c,0x184c,0x17c7,0x17c7,0x17c7,0xc00,0x17cf,0xc20,0x1817,0xc75,0xc08,0xc10,0xc10,0x18d5, 0x1807,0x1899,0xc62,0xc65,0x9d2,0x160d,0x160d,0x9da,0x1615,0x1615,0x1615,0x1615,0x1615,0x1615,0x9e2,0x6d4, -0x1489,0x1491,0x9ea,0x1499,0x9f2,0x14a1,0x14a9,0x14b1,0x9fa,0x9ff,0x14b9,0x14c0,0xa04,0xa0c,0x1827,0xbf0, +0x146f,0x1491,0x9ea,0x1499,0x9f2,0x14a1,0x14a9,0x14b1,0x9fa,0x9ff,0x14b9,0x14c0,0xa04,0xa0c,0x1827,0xbf0, 0xa14,0x1517,0x151e,0x14c8,0x1526,0x152d,0x14d0,0xa1c,0x14e9,0x14e9,0x14eb,0x14d8,0x14e0,0x14e0,0x14e1,0x1535, 0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d, 0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d,0x161d, @@ -1481,7 +1481,7 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x145a,0x145a,0x145a,0x145a,0x145a,0x145a,0x145a,0x145a,0x1502,0x1502,0x1502,0x1502,0x1502,0x1502,0x1502,0x1502, 0x1507,0x150f,0x173f,0x11d2,0x181f,0x181f,0x11d6,0x11dd,0xa3c,0xa44,0xa4c,0x13c7,0x13ce,0x13d6,0xa54,0x13de, 0x140f,0x140f,0x13b7,0x13bf,0x13e6,0x1406,0x1407,0x1417,0x13ee,0x13af,0xa5c,0x13f6,0xa64,0x13fe,0xa6c,0xa70, -0xc7d,0x141f,0xa78,0xa80,0x1427,0x142d,0x1432,0xa88,0xa98,0x146f,0x1477,0x1462,0x1467,0xaa0,0xaa8,0xa90, +0xc7d,0x141f,0xa78,0xa80,0x1427,0x142d,0x1432,0xa88,0xa98,0x1477,0x147f,0x1462,0x1467,0xaa0,0xaa8,0xa90, 0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d, 0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x154d,0x1555,0x1555,0x1555,0x1555, 0x1390,0x1390,0x13d0,0x1410,0x1450,0x1490,0x14d0,0x1510,0x154c,0x158c,0x15b8,0x15f8,0x1638,0x1678,0x16b8,0x16f8, @@ -1661,19 +1661,19 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c,0x1c7c, 0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x285,0x28e,0x288,0x288,0x28b,0x282,0x282, 0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282,0x282, -0x7b0,0x7aa,0x78f,0x786,0x77d,0x77a,0x771,0x78c,0x777,0x783,0x786,0x7a1,0x798,0x789,0x7ad,0x780, -0x76e,0x76e,0x76e,0x76e,0x76e,0x76e,0x76e,0x76e,0x76e,0x76e,0x795,0x792,0x79b,0x79b,0x79b,0x7aa, -0x771,0x7bc,0x7bc,0x7bc,0x7bc,0x7bc,0x7bc,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6, -0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x777,0x77d,0x783,0x7a7,0x76b, -0x7a4,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3, -0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x7b3,0x777,0x79e,0x774,0x79b,0x282, +0x7b3,0x7ad,0x792,0x789,0x780,0x77d,0x774,0x78f,0x77a,0x786,0x789,0x7a4,0x79b,0x78c,0x7b0,0x783, +0x771,0x771,0x771,0x771,0x771,0x771,0x771,0x771,0x771,0x771,0x798,0x795,0x79e,0x79e,0x79e,0x7ad, +0x774,0x7bf,0x7bf,0x7bf,0x7bf,0x7bf,0x7bf,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9, +0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x7b9,0x77a,0x780,0x786,0x7aa,0x76e, +0x7a7,0x7bc,0x7bc,0x7bc,0x7bc,0x7bc,0x7bc,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6, +0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x7b6,0x77a,0x7a1,0x777,0x79e,0x282, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0x291,0x291,0x291,0x291,0x291,0x2a0,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291, 0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291,0x291, -0x294,0x609,0x7c5,0x7c8,0x60f,0x7c8,0x7c2,0x606,0x5fd,0x29a,0x61b,0x29d,0x7cb,0x5f4,0x612,0x7bf, +0x294,0x609,0x7c8,0x7cb,0x60f,0x7cb,0x7c5,0x606,0x5fd,0x29a,0x61b,0x29d,0x7ce,0x5f4,0x612,0x7c2, 0x60c,0x618,0x5fa,0x5fa,0x600,0x297,0x606,0x603,0x5fd,0x5fa,0x61b,0x29d,0x5f7,0x5f7,0x5f7,0x609, 0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x624,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6, 0x624,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x615,0x624,0x2a6,0x2a6,0x2a6,0x2a6,0x2a6,0x624,0x61e, @@ -1748,7 +1748,7 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x333,0x333,0x333,0x333,0x333,0x333,0x333,0x333,0x333,0x333,0x333,0x333,0x333,0x333,0x333,0xc, 0xc,0x336,0x327,0x327,0x327,0x32a,0x327,0x327,0xc,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d, 0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d, -0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x330,0xc,0x870,0x9c6,0xc, +0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x32d,0x330,0xc,0x87c,0x9c6,0xc, 0xc,0x14a9,0x14a9,0x13c2,0xf,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936, 0x936,0x936,0x936,0x936,0x936,0x936,0xd6e,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936,0x936, 0x936,0x936,0x936,0x936,0x339,0x339,0x339,0x339,0x339,0x339,0x339,0x339,0x339,0x339,0xeb2,0x339, @@ -1757,10 +1757,10 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0x34b,0xf, 0xf,0xf,0xf,0xf,0x34b,0x34b,0x34b,0x342,0x33f,0xf,0xf,0xf,0xf,0xf,0xf,0xf, 0xf,0xf,0xf,0xf,0xc87,0xc87,0xc87,0xc87,0x13c5,0x14ac,0xf5a,0xf5a,0xf5a,0xf57,0xf57,0xd7d, -0x876,0xc81,0xc7e,0xc7e,0xc75,0xc75,0xc75,0xc75,0xc75,0xc75,0xf54,0xf54,0xf54,0xf54,0xf54,0x873, -0x14a3,0x12,0xd7a,0x879,0x12d5,0x366,0x369,0x369,0x369,0x369,0x369,0x366,0x366,0x366,0x366,0x366, +0x882,0xc81,0xc7e,0xc7e,0xc75,0xc75,0xc75,0xc75,0xc75,0xc75,0xf54,0xf54,0xf54,0xf54,0xf54,0x87f, +0x14a3,0x12,0xd7a,0x885,0x12d5,0x366,0x369,0x369,0x369,0x369,0x369,0x366,0x366,0x366,0x366,0x366, 0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0xf5d, -0xf5d,0xf5d,0xf5d,0xf5d,0x87c,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x8fd, +0xf5d,0xf5d,0xf5d,0xf5d,0x888,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x366,0x8fd, 0x8fd,0x8fd,0x8fd,0x8fd,0x8fd,0x8fd,0x8fd,0xb10,0xb10,0xb10,0xc75,0xc7b,0xc78,0xd77,0xd77,0xd77, 0xd77,0xd77,0xd77,0x12d2,0x918,0x918,0x918,0x918,0x918,0x918,0x918,0x918,0x918,0x918,0x360,0x35d, 0x35a,0x357,0xb73,0xb73,0x8fa,0x366,0x366,0x372,0x366,0x36c,0x36c,0x36c,0x36c,0x366,0x366,0x366, @@ -1988,21 +1988,21 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae3,0xae6,0x6c,0x6c,0x6c,0x6c, 0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9, 0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0xae9,0x6f,0x6f, -0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x75,0x7ef,0x7e9,0x7ef,0x7e9,0x7ef,0x7e9,0x7ef, -0x7e9,0x7ef,0x7e9,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9, -0x7ec,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9,0x7e9,0x7e9,0x7e9,0x7ef,0x7e9,0x7ef,0x7e9,0x7ef, -0x7e9,0x7e9,0x7e9,0x7e9,0x7e9,0x7e9,0x7ef,0x7e9,0x7e9,0x7e9,0x7e9,0x7e9,0x7ec,0xc3f,0xc3f,0x75, -0x75,0x90f,0x90f,0x8d9,0x8d9,0x7f2,0x7f5,0xc3c,0x78,0x78,0x78,0x78,0x78,0x807,0x807,0x807, -0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807, -0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x807,0x10e6,0x18c3,0x78,0x7b,0x80a,0x80a,0x80a, -0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x7b, +0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x75,0x7fb,0x7f5,0x7fb,0x7f5,0x7fb,0x7f5,0x7fb, +0x7f5,0x7fb,0x7f5,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5, +0x7f8,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5,0x7f5,0x7f5,0x7f5,0x7fb,0x7f5,0x7fb,0x7f5,0x7fb, +0x7f5,0x7f5,0x7f5,0x7f5,0x7f5,0x7f5,0x7fb,0x7f5,0x7f5,0x7f5,0x7f5,0x7f5,0x7f8,0xc3f,0xc3f,0x75, +0x75,0x90f,0x90f,0x8d9,0x8d9,0x7fe,0x801,0xc3c,0x78,0x78,0x78,0x78,0x78,0x813,0x813,0x813, +0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813, +0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x10e6,0x18c3,0x78,0x7b,0x816,0x816,0x816, +0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x7b, 0x8e2,0x8e2,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5,0x8e5, 0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5, 0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0xaf5,0x1389,0x1389,0x1389,0x7e,0x7e,0x7e,0x7e,0x7e, -0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813, -0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0x813,0xd41,0xd41,0x81, -0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819, -0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x81, +0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f, +0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0xd41,0xd41,0x81, +0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825, +0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x81, 0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0xafb,0x84,0x84,0x84, 0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01,0xb01, 0xb01,0xc48,0xb01,0xb01,0xb01,0xc48,0xb01,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87, @@ -2024,16 +2024,16 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x5d0,0x5d0,0x5d0,0x5d3,0x5d3,0x5d3,0x5d0,0x5d0,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90, 0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c,0xb1c, 0x5d6,0x5d6,0x930,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5cd,0x5cd,0xbd3,0xd59,0x90,0x90, -0x82b,0x83d,0x83a,0x83d,0x83a,0xc5d,0xc5d,0xd4d,0xd4a,0x82e,0x82e,0x82e,0x82e,0x840,0x840,0x840, -0x858,0x85b,0x86a,0x93,0x85e,0x861,0x86d,0x86d,0x855,0x84c,0x846,0x84c,0x846,0x84c,0x846,0x849, -0x849,0x864,0x864,0x867,0x864,0x864,0x864,0x93,0x864,0x852,0x84f,0x849,0x93,0x93,0x93,0x93, +0x837,0x849,0x846,0x849,0x846,0xc5d,0xc5d,0xd4d,0xd4a,0x83a,0x83a,0x83a,0x83a,0x84c,0x84c,0x84c, +0x864,0x867,0x876,0x93,0x86a,0x86d,0x879,0x879,0x861,0x858,0x852,0x858,0x852,0x858,0x852,0x855, +0x855,0x870,0x870,0x873,0x870,0x870,0x870,0x93,0x870,0x85e,0x85b,0x855,0x93,0x93,0x93,0x93, 0x5e2,0x5ee,0x5e2,0xbd6,0x5e2,0x96,0x5e2,0x5ee,0x5e2,0x5ee,0x5e2,0x5ee,0x5e2,0x5ee,0x5e2,0x5ee, 0x5ee,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5eb, 0x5e5,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5eb,0x5e5,0x5eb,0x5e5,0x5eb,0x5e5,0x96,0x96,0x5df, -0x732,0x735,0x74a,0x74d,0x72c,0x735,0x735,0x9c,0x717,0x71a,0x71a,0x71a,0x71a,0x717,0x717,0x9c, +0x735,0x738,0x74d,0x750,0x72f,0x738,0x738,0x9c,0x717,0x71a,0x71a,0x71a,0x71a,0x717,0x717,0x9c, 0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0xad7,0xad7,0xad7,0x996,0x711,0x5f1,0x5f1, -0x9c,0x75c,0x73b,0x72c,0x735,0x732,0x72c,0x73e,0x72f,0x729,0x72c,0x74a,0x741,0x738,0x759,0x72c, -0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x756,0x747,0x744,0x74a,0x74a,0x74a,0x75c, +0x9c,0x75f,0x73e,0x72f,0x738,0x735,0x72f,0x741,0x732,0x72c,0x72f,0x74d,0x744,0x73b,0x75c,0x72f, +0x759,0x759,0x759,0x759,0x759,0x759,0x759,0x759,0x759,0x759,0x74a,0x747,0x74d,0x74d,0x74d,0x75f, 0x720,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d, 0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x9c, 0x9c,0x9c,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d,0x9c,0x9c,0x71d,0x71d,0x71d,0x71d,0x71d,0x71d, @@ -2513,14 +2513,14 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387, 0x387,0x387,0x387,0x387,0x384,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x378,0x384,0x384,0x384, 0x384,0x37e,0x1104,0x12db,0x387,0x900,0x903,0x37b,0x37b,0x1101,0x12d8,0x12d8,0x38a,0x38a,0x38a,0x38a, -0x38a,0x38a,0x38a,0x38a,0x387,0x387,0x378,0x378,0x87f,0x882,0x91b,0x91b,0x91b,0x91b,0x91b,0x91b, +0x38a,0x38a,0x38a,0x38a,0x387,0x387,0x378,0x378,0x88b,0x88e,0x91b,0x91b,0x91b,0x91b,0x91b,0x91b, 0x91b,0x91b,0x91b,0x91b,0x381,0xf63,0xf60,0x12de,0x12de,0x12de,0x12de,0x12de,0x14af,0x1107,0x1107,0xeb5, 0xeb5,0xd80,0xeb5,0xeb5,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x387,0x38a,0x387,0x387, 0x387,0x387,0x387,0x387,0x387,0x38a,0x387,0x387,0x38a,0x387,0x387,0x387,0x387,0x387,0x12d8,0x12db, 0x37b,0x387,0x384,0x384,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x12e4,0x429,0x429, 0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x429,0x12e4,0x1857, 0x1857,0xf81,0x41a,0x423,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465, -0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0xb79,0xb79,0xd8c,0xd8c,0x885, +0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0x465,0xb79,0xb79,0xd8c,0xd8c,0x891, 0xd8f,0x13ce,0x13ce,0x13ce,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468, 0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468,0x468, 0x468,0x468,0x468,0x468,0x46e,0x46e,0x46e,0x111c,0x111c,0x111c,0x111c,0x111c,0x46b,0x46b,0x46b,0x46b, @@ -2574,8 +2574,8 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x546,0x546,0x546,0x546,0x546,0x546,0x549,0x549,0x549,0x549,0x546,0x54f,0x546,0x546,0xbb2,0xbb2, 0xbb2,0xbb2,0xbb2,0xbb2,0xbb2,0xbb2,0xbb2,0xbb2,0xbb2,0xbb2,0xbb2,0xbb2,0x558,0xac5,0x558,0x558, 0x558,0x558,0x558,0x558,0x564,0x561,0x564,0x561,0x558,0x558,0x558,0x558,0x558,0x558,0x6d2,0x558, -0x558,0x558,0x558,0x558,0x558,0x558,0x7d4,0x7d4,0x558,0x558,0x558,0x558,0x55e,0x55e,0x558,0x558, -0x558,0x558,0x558,0x558,0x55b,0x7da,0x7d7,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558, +0x558,0x558,0x558,0x558,0x558,0x558,0x7d7,0x7d7,0x558,0x558,0x558,0x558,0x55e,0x55e,0x558,0x558, +0x558,0x558,0x558,0x558,0x55b,0x7dd,0x7da,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558, 0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558, 0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0x558,0xac5,0xbb8,0xac5,0xac5,0xac5, 0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567,0x567, @@ -2598,8 +2598,8 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x582,0x588,0x582,0x582,0xd3b,0xd3b,0xbc4,0xbc4,0xdbc,0xace,0x585,0x585,0x6f6,0x58e,0x6f6,0x585, 0x588,0x582,0x588,0x588,0x582,0x582,0x588,0x582,0x582,0x582,0x588,0x582,0x582,0x582,0x588,0x588, 0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x588,0x58b,0x58b,0x585,0x582,0x582,0x582,0x582, -0x705,0x582,0x705,0x582,0x582,0x582,0x582,0x582,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd,0x7dd, -0x7dd,0x7dd,0x7dd,0x7dd,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582, +0x705,0x582,0x705,0x582,0x582,0x582,0x582,0x582,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0, +0x7e0,0x7e0,0x7e0,0x7e0,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582,0x582, 0x702,0x6ff,0x591,0x702,0x6f3,0x6f9,0x588,0x6f3,0x6fc,0x6f3,0x6f3,0x582,0x6f3,0x6ff,0x591,0x6ff, 0xace,0xace,0xbc7,0xbc7,0xbc7,0xbc7,0xbc7,0xbc7,0xbc7,0xbc7,0xbc7,0xbca,0xbc7,0xbc7,0xdb3,0xe73, 0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594,0x594, @@ -2642,8 +2642,8 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d9,0x5d9,0x5d9,0x5d9, 0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9,0x5d9, 0x5d9,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5d6,0x5dc,0x5dc,0x5dc,0x5dc, -0xfc6,0xfc6,0xfc6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x16e3,0x16e3,0x831,0x837,0x837,0x843, -0x843,0x834,0x82b,0x834,0x82b,0x834,0x82b,0x834,0x82b,0x834,0x82b,0x834,0x5eb,0x5eb,0x5e5,0x5eb, +0xfc6,0xfc6,0xfc6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x14d6,0x16e3,0x16e3,0x83d,0x843,0x843,0x84f, +0x84f,0x840,0x837,0x840,0x837,0x840,0x837,0x840,0x837,0x840,0x837,0x840,0x5eb,0x5eb,0x5e5,0x5eb, 0x5e5,0x5eb,0x5e5,0x5eb,0x5e5,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb, 0x5e5,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5eb, 0x5e5,0x5eb,0x5e5,0x5eb,0x5e5,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5e8,0x5ee,0x5eb,0x5e5,0x5e8, @@ -2658,51 +2658,51 @@ static const uint16_t propsVectorsTrie_index[29236]={ 0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4, 0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x6e4,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e, 0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e, -0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0xc24,0x897,0x891,0x88e,0x894,0x88b,0x723,0x726, -0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x89d,0x723,0x723,0x723,0x723,0x723,0x723,0x723, +0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0x70e,0xc24,0x8a3,0x89d,0x89a,0x8a0,0x897,0x723,0x726, +0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x726,0x8a9,0x723,0x723,0x723,0x723,0x723,0x723,0x723, 0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723, -0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x89a,0x89a,0x72c,0x768,0x768,0x768, +0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x723,0x8a6,0x8a6,0x729,0x8b8,0x8bb,0x8c1, +0x7e3,0x7ef,0x8d6,0x7ec,0x8af,0x8ac,0x8af,0x8ac,0x8b5,0x8b2,0x8b5,0x8b2,0x8af,0x8ac,0x7e9,0x8c1, +0x8af,0x8ac,0x8af,0x8ac,0x8af,0x8ac,0x8af,0x8ac,0x8c4,0x8cd,0x8ca,0x8ca,0x72f,0x76b,0x76b,0x76b, +0x76b,0x76b,0x76b,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x765, +0x765,0x765,0x765,0x765,0x765,0x765,0x765,0x732,0x74d,0x72c,0x753,0x756,0x750,0x768,0x768,0x768, 0x768,0x768,0x768,0x762,0x762,0x762,0x762,0x762,0x762,0x762,0x762,0x762,0x762,0x762,0x762,0x762, -0x762,0x762,0x762,0x762,0x762,0x762,0x762,0x72f,0x74a,0x729,0x750,0x753,0x74d,0x765,0x765,0x765, -0x765,0x765,0x765,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f, -0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x75f,0x72f,0x74a,0x729,0x74a,0xc27,0x7ce,0x7ce,0x7ce,0x7ce, -0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce, -0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x7ce,0x1281,0x1281, -0x1281,0x1281,0x1281,0x7d1,0x8a0,0x8b8,0x8bb,0x8c1,0x8a3,0x7e3,0x8d6,0x7e0,0x8af,0x8a9,0x8af,0x8a9, -0x8b5,0x8b2,0x8b5,0x8b2,0x8af,0x8a9,0x8ac,0x8c1,0x8af,0x8a9,0x8af,0x8a9,0x8af,0x8a9,0x8af,0x8a9, -0x8c4,0x8cd,0x8ca,0x8ca,0x8ac,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x7e0,0x90c,0x90c, -0x90c,0x90c,0x7e6,0x7e6,0x8c7,0x8d3,0x8d3,0x8d3,0x8d3,0x8d0,0x8a6,0x8be,0xaf2,0xaf2,0xaf2,0xc39, -0xc57,0xc54,0xb0d,0x888,0x7ec,0x7e9,0x7ec,0x7ef,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9,0x7ec,0x7e9,0x7e9, -0x7e9,0x7e9,0x7e9,0x7e9,0x7ec,0x7ec,0x7e9,0x7ec,0x7ec,0x7e9,0x7ec,0x7ec,0x7e9,0x7ec,0x7ec,0x7e9, -0x7ec,0x7ec,0x7e9,0x7e9,0xc5a,0x7fe,0x7f8,0x7fe,0x7f8,0x7fe,0x7f8,0x7fe,0x7f8,0x7fe,0x7f8,0x7f8, -0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8, -0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7fe,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8,0x7fb,0x7f8,0x7f8, -0x7f8,0x7f8,0x7f8,0x7f8,0x7fb,0x7fb,0x7f8,0x7fb,0x7fb,0x7f8,0x7fb,0x7fb,0x7f8,0x7fb,0x7fb,0x7f8, -0x7fb,0x7fb,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7fe,0x7f8,0x7fe,0x7f8,0x7fe,0x7f8,0x7f8,0x7f8,0x7f8, -0x7f8,0x7f8,0x7fe,0x7f8,0x7f8,0x7f8,0x7f8,0x7f8,0x7fb,0x7fe,0x7fe,0x7fb,0x7fb,0x7fb,0x7fb,0x8dc, -0x8df,0x801,0x804,0xc42,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a, -0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a, -0x80a,0x80a,0x80a,0x80a,0x80d,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a, -0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a,0x80a, +0x762,0x762,0x762,0x762,0x762,0x762,0x762,0x732,0x74d,0x72c,0x74d,0xc27,0x7d1,0x7d1,0x7d1,0x7d1, +0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1, +0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x7d1,0x1281,0x1281, +0x1281,0x1281,0x1281,0x7d4,0x7e9,0x7ec,0x7ec,0x7ec,0x7ec,0x7ec,0x7ec,0x7ec,0x7ec,0x7ec,0x90c,0x90c, +0x90c,0x90c,0x7f2,0x7f2,0x8c7,0x8d3,0x8d3,0x8d3,0x8d3,0x8d0,0x7e6,0x8be,0xaf2,0xaf2,0xaf2,0xc39, +0xc57,0xc54,0xb0d,0x894,0x7f8,0x7f5,0x7f8,0x7fb,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5,0x7f8,0x7f5,0x7f5, +0x7f5,0x7f5,0x7f5,0x7f5,0x7f8,0x7f8,0x7f5,0x7f8,0x7f8,0x7f5,0x7f8,0x7f8,0x7f5,0x7f8,0x7f8,0x7f5, +0x7f8,0x7f8,0x7f5,0x7f5,0xc5a,0x80a,0x804,0x80a,0x804,0x80a,0x804,0x80a,0x804,0x80a,0x804,0x804, +0x807,0x804,0x807,0x804,0x807,0x804,0x807,0x804,0x807,0x804,0x807,0x804,0x807,0x804,0x807,0x804, +0x807,0x804,0x807,0x804,0x807,0x804,0x807,0x80a,0x804,0x807,0x804,0x807,0x804,0x807,0x804,0x804, +0x804,0x804,0x804,0x804,0x807,0x807,0x804,0x807,0x807,0x804,0x807,0x807,0x804,0x807,0x807,0x804, +0x807,0x807,0x804,0x804,0x804,0x804,0x804,0x80a,0x804,0x80a,0x804,0x80a,0x804,0x804,0x804,0x804, +0x804,0x804,0x80a,0x804,0x804,0x804,0x804,0x804,0x807,0x80a,0x80a,0x807,0x807,0x807,0x807,0x8dc, +0x8df,0x80d,0x810,0xc42,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816, +0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816, +0x816,0x816,0x816,0x816,0x819,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816, 0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816, -0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0x816,0xd44,0xd44,0xe76,0x810, +0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822, +0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0xd44,0xd44,0xe76,0x81c, 0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0xd3e,0xd3e,0xd3e,0xd3e, -0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819,0x819, +0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825, 0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1, -0x8f1,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0xd47,0xd47,0xd47,0xd47,0x8f4,0x8f4,0x8f4,0x8f4,0x8f4, -0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c, -0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c,0x81c, -0x81c,0x81c,0xd47,0xd47,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f, -0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f,0x81f, -0x81f,0x81f,0x81f,0x81f,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x822,0x822,0x822,0x822, -0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822, -0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0x822,0xe79,0xe79, +0x8f1,0x828,0x828,0x828,0x828,0x828,0x828,0xd47,0xd47,0xd47,0xd47,0x8f4,0x8f4,0x8f4,0x8f4,0x8f4, +0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828, +0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828,0x828, +0x828,0x828,0xd47,0xd47,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b, +0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b,0x82b, +0x82b,0x82b,0x82b,0x82b,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x8f1,0x82e,0x82e,0x82e,0x82e, +0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e, +0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0x82e,0xe79,0xe79, 0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79,0xe79, -0xe79,0xe79,0xe79,0xe79,0x10e9,0x10e9,0x10e9,0x10e9,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825, -0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825, -0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x828,0x828,0x825,0x828,0x825,0x828, -0x828,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x825,0x828,0x825,0x828,0x825,0x828, -0x828,0x825,0x825,0x828,0x828,0x828,0x825,0x825,0x825,0x825,0x148b,0x148b,0xc4b,0xc4b,0xc4b,0xc4b, +0xe79,0xe79,0xe79,0xe79,0x10e9,0x10e9,0x10e9,0x10e9,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831, +0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831, +0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x834,0x834,0x831,0x834,0x831,0x834, +0x834,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x831,0x834,0x831,0x834,0x831,0x834, +0x834,0x831,0x831,0x834,0x834,0x834,0x831,0x831,0x831,0x831,0x148b,0x148b,0xc4b,0xc4b,0xc4b,0xc4b, 0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0xc4b,0x8e8,0x8e8,0x8e8,0x8e8, 0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8, 0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x8e8,0x12bd,0x12bd,0x12bd,0x12bd, @@ -3314,31 +3314,31 @@ static const uint32_t propsVectors[6375]={ 0x11023600,0x24000020,0x10100000,0x11023700,0x24000000,0x100000,0x11023700,0x24000000,0xe00000,0x11023700,0x24000000,0x10100000,0x11023700,0x24000000,0x10e00000,0x11023700, 0x24000020,0x100000,0x11023700,0x24000020,0x10100000,0x11023700,0x24000020,0x10105200,0x11023800,0x4000000,0x100000,0x11023800,0x24000000,0x200000,0x11024e67,0, 0,0x11025600,0x4000000,0x100000,0x11042a00,0x4000000,0x1600000,0x11045700,0x4000000,0x20000a,0x11045700,0x4000020,0x20000a,0x11045712,0x7c00100,0xe3040a, -0x11045712,0x7c80100,0xe3040a,0x11045716,0x7c00100,0xe30c0a,0x11045716,0x7c00100,0x2530c0a,0x11065700,0x4000000,0x810011,0x11065700,0x4000000,0xe00011,0x11065700, -0x4000000,0x1410011,0x11065700,0x4000000,0x1500011,0x11065700,0x4000000,0x1600011,0x11065700,0x4000006,0xe70011,0x11065700,0x4000008,0xe00011,0x11065700,0x4000008, -0xe02c11,0x11065700,0x4000010,0x871411,0x11065700,0x4000010,0x1201411,0x11065700,0x4000010,0x1271011,0x11065700,0x4000020,0xe00011,0x11065700,0x4000400,0xe00011, -0x11065700,0x4000420,0xe00011,0x11065700,0x6800000,0xe01c11,0x11065700,0x6800040,0xe00011,0x11065700,0xc000010,0x80ac11,0x11065700,0xc000010,0xb48011,0x11065719, -0x7c00100,0xe20411,0x11065719,0x7c00100,0xe50411,0x11065719,0x7c00140,0xe20411,0x11065719,0x7c00140,0xe50411,0x11080100,0x6800000,0x201c00,0x11080100,0x68000c0, -0x19329800,0x11080100,0x24000000,0x200000,0x11080100,0x24000000,0x810000,0x11080100,0x24000000,0x1410000,0x11080100,0x24000000,0x1500000,0x11080100,0x24000000,0x1600000, -0x11080100,0x24000000,0x1b00000,0x11080100,0x24000000,0x2410000,0x11080100,0x24000000,0x18200000,0x11080100,0x24000006,0xd70000,0x11080100,0x24000008,0x1713c00,0x11080100, -0x24000008,0x1714000,0x11080100,0x24000010,0x1001400,0x11080100,0x24000010,0x1071000,0x11080100,0x24000010,0x1071400,0x11080100,0x24000020,0x200000,0x11080100,0x24000020, -0x400000,0x11080100,0x24000020,0x1600000,0x11080100,0x24000400,0x200000,0x11080100,0x24000420,0x200000,0x11080100,0x2c000010,0xb48000,0x11080100,0x2c000010,0x100ac00, -0x11080100,0x44000001,0x1a40000,0x11080119,0x7c00100,0x220400,0x11080119,0x7c00100,0x250400,0x11080119,0x7c001c0,0x220400,0x11080119,0x7c001c0,0x250400,0x11080200, -0x4000400,0x200002,0x11080200,0x24000000,0x200000,0x11080200,0x24000000,0x1500000,0x11080200,0x24000000,0x1600000,0x11080200,0x24000020,0x200000,0x110a1e12,0x7c00100, -0x2130480,0x110a1e12,0x7c80100,0x2130480,0x110a3000,0x24000000,0x30e00000,0x110a3000,0x24100000,0x810001,0x110a3000,0x24100000,0x1410001,0x110a3700,0x24000000,0x30200000, -0x110a3d11,0x7c00300,0xe30000,0x110a3d11,0x7c00900,0x1230400,0x110a3d12,0x2802400,0x962460,0x110a3e14,0x7c00100,0xe30000,0x110a3e14,0x7c00100,0xe30001,0x110a3e14, -0x7c00100,0x2530000,0x110a3e14,0x7c00900,0x1230000,0x110a3e14,0x7c00900,0x1230001,0x110a3f16,0x7c00100,0xe30c00,0x110a3f16,0x7c00100,0xe30c01,0x110a3f16,0x7c00100, -0x2530c00,0x110a3f16,0x7c00900,0x1230c00,0x110a3f16,0x7c00900,0x1230c01,0x110a4005,0x7c00100,0xe30400,0x110a4112,0x7c00100,0xe30402,0x110a4112,0x7c80100,0xe30402, -0x110a4400,0x4000000,0xe00000,0x110a4412,0x4000000,0xe00002,0x110a4412,0x4000000,0xe00003,0x110a4416,0x4000000,0xe00c03,0x110a4500,0x4000000,0xe0000d,0x110a4516, -0x4000000,0xe00c0d,0x110a4711,0x7c40300,0xe30000,0x110a4f11,0x7c00300,0xe30001,0x110a4f11,0x7c40300,0xe30000,0x110a5300,0x4000000,0x810010,0x110a5300,0x4000000, -0xe00002,0x110a5300,0x4000000,0xe00010,0x110a5300,0x4000000,0x1410010,0x110a5300,0x4000002,0xe70010,0x110a5300,0x4000008,0x810010,0x110a5300,0x4000008,0x1410010, -0x110a5300,0x6800000,0xe01c02,0x110a5300,0x6800000,0xe01c10,0x110a5400,0x4000000,0x81000c,0x110a5400,0x4000000,0xe0000c,0x110a5400,0x4000000,0x141000c,0x110a5400, -0x4000000,0x150000c,0x110a5400,0x4000000,0x160000c,0x110a5400,0x4000002,0xe7000c,0x110a5400,0x4000010,0x87140c,0x110a5400,0x4000010,0xe7000c,0x110a5400,0x4000010, -0x120140c,0x110a5400,0x4000010,0x127100c,0x110a5400,0x4000020,0xe0000c,0x110a5400,0x4000026,0xe7000c,0x110a5400,0xc000010,0x80ac0c,0x110a5400,0xc000010,0xb4800c, -0x11400a0c,0xc000010,0x1049400,0x11400c0e,0x4000010,0xb00000,0x11400c0e,0x4000010,0x1071400,0x11400c0e,0xc000010,0xb48000,0x11400c13,0x7c00900,0x230400,0x11400f36, -0xc000010,0x448000,0x11400f46,0xc000010,0x448000,0x11401d72,0x4000000,0x200000,0x11403d95,0x4000000,0xe00000,0x1144578a,0x4000004,0x120000a,0x1144578a,0x4000008, -0x81000a,0x1144578a,0x4000008,0x141000a,0x1144578a,0x4000010,0x87000a,0x1144578a,0xc000010,0x84800a,0x11445793,0x3802500,0x126246a,0x11445793,0x7c00d00,0x2530c0a, -0x11463d8a,0x4000001,0x440011,0x114a3d8a,0x4000000,0xe00000,0x114a3d8a,0x4000000,0xe00002,0x114a3d8a,0x24000000,0x810000,0x114a3d8a,0x24000000,0xe00000,0x114a3d8a, +0x11045712,0x7c80100,0xe3040a,0x11045716,0x7c00100,0xe30c0a,0x11045716,0x7c00100,0x2530c0a,0x11063d00,0x4000001,0x440011,0x11065700,0x4000000,0x810011,0x11065700, +0x4000000,0xe00011,0x11065700,0x4000000,0x1410011,0x11065700,0x4000000,0x1500011,0x11065700,0x4000000,0x1600011,0x11065700,0x4000006,0xe70011,0x11065700,0x4000008, +0xe00011,0x11065700,0x4000008,0xe02c11,0x11065700,0x4000010,0x871411,0x11065700,0x4000010,0x1201411,0x11065700,0x4000010,0x1271011,0x11065700,0x4000020,0xe00011, +0x11065700,0x4000400,0xe00011,0x11065700,0x4000420,0xe00011,0x11065700,0x6800000,0xe01c11,0x11065700,0x6800040,0xe00011,0x11065700,0xc000010,0x80ac11,0x11065700, +0xc000010,0xb48011,0x11065719,0x7c00100,0xe20411,0x11065719,0x7c00100,0xe50411,0x11065719,0x7c00140,0xe20411,0x11065719,0x7c00140,0xe50411,0x11080100,0x6800000, +0x201c00,0x11080100,0x68000c0,0x19329800,0x11080100,0x24000000,0x200000,0x11080100,0x24000000,0x810000,0x11080100,0x24000000,0x1410000,0x11080100,0x24000000,0x1500000, +0x11080100,0x24000000,0x1600000,0x11080100,0x24000000,0x1b00000,0x11080100,0x24000000,0x2410000,0x11080100,0x24000000,0x18200000,0x11080100,0x24000006,0xd70000,0x11080100, +0x24000008,0x1713c00,0x11080100,0x24000008,0x1714000,0x11080100,0x24000010,0x1001400,0x11080100,0x24000010,0x1071000,0x11080100,0x24000010,0x1071400,0x11080100,0x24000020, +0x200000,0x11080100,0x24000020,0x400000,0x11080100,0x24000020,0x1600000,0x11080100,0x24000400,0x200000,0x11080100,0x24000420,0x200000,0x11080100,0x2c000010,0xb48000, +0x11080100,0x2c000010,0x100ac00,0x11080100,0x44000001,0x1a40000,0x11080119,0x7c00100,0x220400,0x11080119,0x7c00100,0x250400,0x11080119,0x7c001c0,0x220400,0x11080119, +0x7c001c0,0x250400,0x11080200,0x4000400,0x200002,0x11080200,0x24000000,0x200000,0x11080200,0x24000000,0x1500000,0x11080200,0x24000000,0x1600000,0x11080200,0x24000020, +0x200000,0x110a1e12,0x7c00100,0x2130480,0x110a1e12,0x7c80100,0x2130480,0x110a3000,0x24000000,0x30e00000,0x110a3000,0x24100000,0x810001,0x110a3000,0x24100000,0x1410001, +0x110a3700,0x24000000,0x30200000,0x110a3d00,0x4000000,0xe00000,0x110a3d00,0x4000000,0xe00002,0x110a3d00,0x24000000,0xe00000,0x110a3d11,0x7c00300,0xe30000,0x110a3d11, +0x7c00900,0x1230400,0x110a3d12,0x2802400,0x962460,0x110a3e14,0x7c00100,0xe30000,0x110a3e14,0x7c00100,0xe30001,0x110a3e14,0x7c00100,0x2530000,0x110a3e14,0x7c00900, +0x1230000,0x110a3e14,0x7c00900,0x1230001,0x110a3f16,0x7c00100,0xe30c00,0x110a3f16,0x7c00100,0xe30c01,0x110a3f16,0x7c00100,0x2530c00,0x110a3f16,0x7c00900,0x1230c00, +0x110a3f16,0x7c00900,0x1230c01,0x110a4005,0x7c00100,0xe30400,0x110a4112,0x7c00100,0xe30402,0x110a4112,0x7c80100,0xe30402,0x110a4400,0x4000000,0xe00000,0x110a4412, +0x4000000,0xe00002,0x110a4412,0x4000000,0xe00003,0x110a4416,0x4000000,0xe00c03,0x110a4500,0x4000000,0xe0000d,0x110a4516,0x4000000,0xe00c0d,0x110a4711,0x7c40300, +0xe30000,0x110a4f11,0x7c00300,0xe30001,0x110a4f11,0x7c40300,0xe30000,0x110a5300,0x4000000,0x810010,0x110a5300,0x4000000,0xe00002,0x110a5300,0x4000000,0xe00010, +0x110a5300,0x4000000,0x1410010,0x110a5300,0x4000002,0xe70010,0x110a5300,0x4000008,0x810010,0x110a5300,0x4000008,0x1410010,0x110a5300,0x6800000,0xe01c02,0x110a5300, +0x6800000,0xe01c10,0x110a5400,0x4000000,0x81000c,0x110a5400,0x4000000,0xe0000c,0x110a5400,0x4000000,0x141000c,0x110a5400,0x4000000,0x150000c,0x110a5400,0x4000000, +0x160000c,0x110a5400,0x4000002,0xe7000c,0x110a5400,0x4000010,0x87140c,0x110a5400,0x4000010,0xe7000c,0x110a5400,0x4000010,0x120140c,0x110a5400,0x4000010,0x127100c, +0x110a5400,0x4000020,0xe0000c,0x110a5400,0x4000026,0xe7000c,0x110a5400,0xc000010,0x80ac0c,0x110a5400,0xc000010,0xb4800c,0x11400a0c,0xc000010,0x1049400,0x11400c0e, +0x4000010,0xb00000,0x11400c0e,0x4000010,0x1071400,0x11400c0e,0xc000010,0xb48000,0x11400c13,0x7c00900,0x230400,0x11400f36,0xc000010,0x448000,0x11400f46,0xc000010, +0x448000,0x11401d72,0x4000000,0x200000,0x11403d95,0x4000000,0xe00000,0x1144578a,0x4000004,0x120000a,0x1144578a,0x4000008,0x81000a,0x1144578a,0x4000008,0x141000a, +0x1144578a,0x4000010,0x87000a,0x1144578a,0xc000010,0x84800a,0x11445793,0x3802500,0x126246a,0x11445793,0x7c00d00,0x2530c0a,0x114a3d8a,0x24000000,0x810000,0x114a3d8a, 0x24000000,0x1410000,0x114a3d8a,0x24000008,0x810000,0x114a3d8a,0x24000008,0x1410000,0x114a3d8a,0x24000010,0x870000,0x114a3d8a,0x2c000010,0x848000,0x114a3d90,0x4000000, 0xe00000,0x114a3d90,0x24000000,0xe00000,0x114a3d90,0x24000002,0x1200000,0x114a3d90,0x24000002,0x10e00000,0x114a3d90,0x24000008,0x810000,0x114a3d90,0x24000008,0x1410000, 0x114a3d93,0x7c00900,0x930c00,0x114a3d93,0x7c00900,0xe30c00,0x114a3d95,0x7c00300,0xe30000,0x114a3e93,0x7000400,0x1200c02,0x114a3f8a,0x4000004,0x1200000,0x114a3f93, @@ -3601,7 +3601,7 @@ static const uint32_t propsVectors[6375]={ 0xe30000,0xa00b1596,0x7c00300,0xe30000,0xa040af86,0x6800400,0x962540}; static const int32_t countPropsVectors=6375; -static const int32_t propsVectorsColumns=3; /* The code assumes that this value is > 0*/ +static const int32_t propsVectorsColumns=3; static const uint16_t scriptExtensions[198]={ 0x800e,0x8019,8,0x8059,8,2,8,0x8038,8,6,8,0x8019,3,0x800c,2,0x22, 0x8025,2,0xe,2,0x22,0x54,0x79,0x7b,0x80a7,2,0x8022,2,0x8025,2,0x1b,4, diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp index ae5c980e06a5ab..88994a12b22097 100644 --- a/deps/openssl/openssl.gyp +++ b/deps/openssl/openssl.gyp @@ -7,7 +7,6 @@ 'is_clang': 0, 'gcc_version': 0, 'openssl_no_asm%': 0, - 'llvm_version%': 0, 'xcode_version%': 0, 'gas_version%': 0, 'openssl_fips%': 'false', diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 03255534fa1de3..b227123e4ac35c 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -318,3 +318,6 @@ Scott Parker Wade Brainerd rayrase Pekka Nikander +Ed Schouten +Xu Meng +Matt Harrison diff --git a/deps/uv/CONTRIBUTING.md b/deps/uv/CONTRIBUTING.md index aa97506dbc6923..d9bf0472fb1fc3 100644 --- a/deps/uv/CONTRIBUTING.md +++ b/deps/uv/CONTRIBUTING.md @@ -164,6 +164,6 @@ not send out notifications when you add commits. [issue tracker]: https://github.com/libuv/libuv/issues [libuv mailing list]: http://groups.google.com/group/libuv -[IRC]: http://webchat.freelibuv.net/?channels=libuv +[IRC]: http://webchat.freenode.net/?channels=libuv [Google C/C++ style guide]: https://google.github.io/styleguide/cppguide.html [project maintainers]: https://github.com/libuv/libuv/blob/master/MAINTAINERS.md diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 595b3871278898..113c28aed136a7 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,55 @@ +2017.12.02, Version 1.18.0 (Stable), 1489c98b7fc17f1702821a269eb0c5e730c5c813 + +Changes since version 1.17.0: + +* aix: fix -Wmaybe-uninitialized warning (cjihrig) + +* doc: remove note about SIGWINCH on Windows (Bartosz Sosnowski) + +* Revert "unix,win: wait for threads to start" (Ben Noordhuis) + +* unix,win: add uv_os_getpid() (Bartosz Sosnowski) + +* unix: remove incorrect assertion in uv_shutdown() (Jameson Nash) + +* doc: fix IRC URL in CONTRIBUTING.md (Matt Harrison) + + +2017.11.25, Version 1.17.0 (Stable), 1344d2bb82e195d0eafc0b40ba103f18dfd04cc5 + +Changes since version 1.16.1: + +* unix: avoid malloc() call in uv_spawn() (Ben Noordhuis) + +* doc: clarify the description of uv_loop_alive() (Ed Schouten) + +* win: map UV_FS_O_EXLOCK to a share mode of 0 (Joran Dirk Greef) + +* win: fix build on case-sensitive file systems (Ben Noordhuis) + +* win: fix test runner build with mingw64 (Ben Noordhuis) + +* win: remove unused variable in test/test-fs.c (Ben Noordhuis) + +* zos: add strnlen() implementation (jBarz) + +* unix: keep track of bound sockets sent via spawn (jBarz) + +* unix,win: wait for threads to start (Ben Noordhuis) + +* test: add threadpool init/teardown test (Bartosz Sosnowski) + +* test: avoid malloc() in threadpool test (Ben Noordhuis) + +* test: lower number of tasks in threadpool test (Ben Noordhuis) + +* win: issue memory barrier in uv_thread_join() (Ben Noordhuis) + +* ibmi: add support for new platform (Xu Meng) + +* test: fix test-spawn compilation (Bartosz Sosnowski) + + 2017.11.11, Version 1.16.1 (Stable), 4056fbe46493ef87237e307e0025e551db875e13 Changes since version 1.16.0: diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am index 6e548a69c374e6..e01cf416638bfe 100644 --- a/deps/uv/Makefile.am +++ b/deps/uv/Makefile.am @@ -329,7 +329,7 @@ libuv_la_CFLAGS += -D_ALL_SOURCE \ -D_THREAD_SAFE \ -DHAVE_SYS_AHAFS_EVPRODS_H include_HEADERS += include/uv-aix.h -libuv_la_SOURCES += src/unix/aix.c +libuv_la_SOURCES += src/unix/aix.c src/unix/aix-common.c endif if ANDROID diff --git a/deps/uv/appveyor.yml b/deps/uv/appveyor.yml index 8ad69718b6e619..f77e640eb10f09 100644 --- a/deps/uv/appveyor.yml +++ b/deps/uv/appveyor.yml @@ -1,4 +1,4 @@ -version: v1.16.1.build{build} +version: v1.18.0.build{build} init: - git config --global core.autocrlf true diff --git a/deps/uv/checksparse.sh b/deps/uv/checksparse.sh index ae0e5374f5efba..d4a983d02618b5 100755 --- a/deps/uv/checksparse.sh +++ b/deps/uv/checksparse.sh @@ -177,8 +177,18 @@ case `uname -s` in AIX) SPARSE_FLAGS="$SPARSE_FLAGS -D_AIX=1" SOURCES="$SOURCES + src/unix/aix-common.c src/unix/aix.c" ;; +OS400) + SPARSE_FLAGS="$SPARSE_FLAGS -D_PASE=1" + SOURCES="$SOURCES + src/unix/aix-common.c + src/unix/ibmi.c + src/unix/posix-poll.c + src/unix/no-fsevents.c + src/unix/no-proctitle.c" + ;; Darwin) SPARSE_FLAGS="$SPARSE_FLAGS -D__APPLE__=1" SOURCES="$SOURCES diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index 5fc0f72434d92e..7eb1674dbaa7fb 100644 --- a/deps/uv/configure.ac +++ b/deps/uv/configure.ac @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.16.1], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.18.0], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) diff --git a/deps/uv/docs/src/fs.rst b/deps/uv/docs/src/fs.rst index f46c4e761a5d2f..16d5e05c7834cf 100644 --- a/deps/uv/docs/src/fs.rst +++ b/deps/uv/docs/src/fs.rst @@ -409,7 +409,9 @@ File open constants Atomically obtain an exclusive lock. .. note:: - `UV_FS_O_EXLOCK` is only supported on macOS. + `UV_FS_O_EXLOCK` is only supported on macOS and Windows. + + .. versionchanged:: 1.17.0 support is added for Windows. .. c:macro:: UV_FS_O_NOATIME diff --git a/deps/uv/docs/src/loop.rst b/deps/uv/docs/src/loop.rst index c63f813993ff4b..18dd135cd63834 100644 --- a/deps/uv/docs/src/loop.rst +++ b/deps/uv/docs/src/loop.rst @@ -109,7 +109,8 @@ API .. c:function:: int uv_loop_alive(const uv_loop_t* loop) - Returns non-zero if there are active handles or request in the loop. + Returns non-zero if there are referenced active handles, active + requests or closing handles in the loop. .. c:function:: void uv_stop(uv_loop_t* loop) diff --git a/deps/uv/docs/src/misc.rst b/deps/uv/docs/src/misc.rst index 2968d1cea1cc2b..a653413e0927bd 100644 --- a/deps/uv/docs/src/misc.rst +++ b/deps/uv/docs/src/misc.rst @@ -227,6 +227,12 @@ API On Windows not all fields are set, the unsupported fields are filled with zeroes. See :c:type:`uv_rusage_t` for more details. +.. c:function:: uv_pid_t uv_os_getpid(void) + + Returns the current process ID. + + .. versionadded:: 1.18.0 + .. c:function:: uv_pid_t uv_os_getppid(void) Returns the parent process ID. diff --git a/deps/uv/docs/src/signal.rst b/deps/uv/docs/src/signal.rst index 5b3b352bdd257d..24354e4f7c1329 100644 --- a/deps/uv/docs/src/signal.rst +++ b/deps/uv/docs/src/signal.rst @@ -17,13 +17,6 @@ Reception of some signals is emulated on Windows: program is given approximately 10 seconds to perform cleanup. After that Windows will unconditionally terminate it. -* SIGWINCH is raised whenever libuv detects that the console has been - resized. SIGWINCH is emulated by libuv when the program uses a :c:type:`uv_tty_t` - handle to write to the console. SIGWINCH may not always be delivered in a - timely manner; libuv will only detect size changes when the cursor is - being moved. When a readable :c:type:`uv_tty_t` handle is used in raw mode, - resizing the console buffer will also trigger a SIGWINCH signal. - Watchers for other signals can be successfully created, but these signals are never received. These signals are: `SIGILL`, `SIGABRT`, `SIGFPE`, `SIGSEGV`, `SIGTERM` and `SIGKILL.` @@ -36,6 +29,7 @@ not detected by libuv; these will not trigger a signal watcher. manage threads. Installing watchers for those signals will lead to unpredictable behavior and is strongly discouraged. Future versions of libuv may simply reject them. +.. versionchanged:: 1.15.0 SIGWINCH support on Windows was improved. Data types ---------- diff --git a/deps/uv/include/uv-unix.h b/deps/uv/include/uv-unix.h index 6565ff441ef292..da32f86e8476fa 100644 --- a/deps/uv/include/uv-unix.h +++ b/deps/uv/include/uv-unix.h @@ -48,6 +48,8 @@ # include "uv-linux.h" #elif defined (__MVS__) # include "uv-os390.h" +#elif defined(_PASE) +# include "uv-posix.h" #elif defined(_AIX) # include "uv-aix.h" #elif defined(__sun) diff --git a/deps/uv/include/uv-version.h b/deps/uv/include/uv-version.h index 1c9113cdc9f7ee..831ee54de4486e 100644 --- a/deps/uv/include/uv-version.h +++ b/deps/uv/include/uv-version.h @@ -31,8 +31,8 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 16 -#define UV_VERSION_PATCH 1 +#define UV_VERSION_MINOR 18 +#define UV_VERSION_PATCH 0 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/include/uv-win.h b/deps/uv/include/uv-win.h index be150fc482f92e..b96bed22ace759 100644 --- a/deps/uv/include/uv-win.h +++ b/deps/uv/include/uv-win.h @@ -664,13 +664,13 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); #define UV_FS_O_WRONLY _O_WRONLY /* fs open() flags supported on other platforms (or mapped on this platform): */ -#define UV_FS_O_DIRECT 0x2000000 /* FILE_FLAG_NO_BUFFERING */ +#define UV_FS_O_DIRECT 0x02000000 /* FILE_FLAG_NO_BUFFERING */ #define UV_FS_O_DIRECTORY 0 -#define UV_FS_O_DSYNC 0x4000000 /* FILE_FLAG_WRITE_THROUGH */ -#define UV_FS_O_EXLOCK 0 +#define UV_FS_O_DSYNC 0x04000000 /* FILE_FLAG_WRITE_THROUGH */ +#define UV_FS_O_EXLOCK 0x10000000 /* EXCLUSIVE SHARING MODE */ #define UV_FS_O_NOATIME 0 #define UV_FS_O_NOCTTY 0 #define UV_FS_O_NOFOLLOW 0 #define UV_FS_O_NONBLOCK 0 #define UV_FS_O_SYMLINK 0 -#define UV_FS_O_SYNC 0x8000000 /* FILE_FLAG_WRITE_THROUGH */ +#define UV_FS_O_SYNC 0x08000000 /* FILE_FLAG_WRITE_THROUGH */ diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 3f61812081da5e..b11666e2e65806 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -1070,6 +1070,7 @@ UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size); UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd); UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd); +UV_EXTERN uv_pid_t uv_os_getpid(void); UV_EXTERN uv_pid_t uv_os_getppid(void); UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); diff --git a/deps/uv/src/unix/aix-common.c b/deps/uv/src/unix/aix-common.c new file mode 100644 index 00000000000000..2cfe8be6f11830 --- /dev/null +++ b/deps/uv/src/unix/aix-common.c @@ -0,0 +1,292 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +uint64_t uv__hrtime(uv_clocktype_t type) { + uint64_t G = 1000000000; + timebasestruct_t t; + read_wall_time(&t, TIMEBASE_SZ); + time_base_to_time(&t, TIMEBASE_SZ); + return (uint64_t) t.tb_high * G + t.tb_low; +} + + +/* + * We could use a static buffer for the path manipulations that we need outside + * of the function, but this function could be called by multiple consumers and + * we don't want to potentially create a race condition in the use of snprintf. + * There is no direct way of getting the exe path in AIX - either through /procfs + * or through some libc APIs. The below approach is to parse the argv[0]'s pattern + * and use it in conjunction with PATH environment variable to craft one. + */ +int uv_exepath(char* buffer, size_t* size) { + int res; + char args[PATH_MAX]; + char abspath[PATH_MAX]; + size_t abspath_size; + struct procsinfo pi; + + if (buffer == NULL || size == NULL || *size == 0) + return -EINVAL; + + pi.pi_pid = getpid(); + res = getargs(&pi, sizeof(pi), args, sizeof(args)); + if (res < 0) + return -EINVAL; + + /* + * Possibilities for args: + * i) an absolute path such as: /home/user/myprojects/nodejs/node + * ii) a relative path such as: ./node or ../myprojects/nodejs/node + * iii) a bare filename such as "node", after exporting PATH variable + * to its location. + */ + + /* Case i) and ii) absolute or relative paths */ + if (strchr(args, '/') != NULL) { + if (realpath(args, abspath) != abspath) + return -errno; + + abspath_size = strlen(abspath); + + *size -= 1; + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + return 0; + } else { + /* Case iii). Search PATH environment variable */ + char trypath[PATH_MAX]; + char *clonedpath = NULL; + char *token = NULL; + char *path = getenv("PATH"); + + if (path == NULL) + return -EINVAL; + + clonedpath = uv__strdup(path); + if (clonedpath == NULL) + return -ENOMEM; + + token = strtok(clonedpath, ":"); + while (token != NULL) { + snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, args); + if (realpath(trypath, abspath) == abspath) { + /* Check the match is executable */ + if (access(abspath, X_OK) == 0) { + abspath_size = strlen(abspath); + + *size -= 1; + if (*size > abspath_size) + *size = abspath_size; + + memcpy(buffer, abspath, *size); + buffer[*size] = '\0'; + + uv__free(clonedpath); + return 0; + } + } + token = strtok(NULL, ":"); + } + uv__free(clonedpath); + + /* Out of tokens (path entries), and no match found */ + return -EINVAL; + } +} + +void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { + int i; + + for (i = 0; i < count; ++i) { + uv__free(cpu_infos[i].model); + } + + uv__free(cpu_infos); +} + + +int uv_interface_addresses(uv_interface_address_t** addresses, + int* count) { + uv_interface_address_t* address; + int sockfd, inet6, size = 1; + struct ifconf ifc; + struct ifreq *ifr, *p, flg; + struct sockaddr_dl* sa_addr; + + *count = 0; + + if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) { + return -errno; + } + + if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) { + uv__close(sockfd); + return -errno; + } + + ifc.ifc_req = (struct ifreq*)uv__malloc(size); + ifc.ifc_len = size; + if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) { + uv__close(sockfd); + return -errno; + } + +#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p)) + + /* Count all up and running ipv4/ipv6 addresses */ + ifr = ifc.ifc_req; + while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { + p = ifr; + ifr = (struct ifreq*) + ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); + + if (!(p->ifr_addr.sa_family == AF_INET6 || + p->ifr_addr.sa_family == AF_INET)) + continue; + + memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { + uv__close(sockfd); + return -errno; + } + + if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) + continue; + + (*count)++; + } + + /* Alloc the return interface structs */ + *addresses = uv__malloc(*count * sizeof(uv_interface_address_t)); + if (!(*addresses)) { + uv__close(sockfd); + return -ENOMEM; + } + address = *addresses; + + ifr = ifc.ifc_req; + while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { + p = ifr; + ifr = (struct ifreq*) + ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); + + if (!(p->ifr_addr.sa_family == AF_INET6 || + p->ifr_addr.sa_family == AF_INET)) + continue; + + inet6 = (p->ifr_addr.sa_family == AF_INET6); + + memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); + if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { + uv__close(sockfd); + return -ENOSYS; + } + + if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) + continue; + + /* All conditions above must match count loop */ + + address->name = uv__strdup(p->ifr_name); + + if (inet6) + address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr); + else + address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr); + + sa_addr = (struct sockaddr_dl*) &p->ifr_addr; + memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); + + if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1) { + uv__close(sockfd); + return -ENOSYS; + } + + if (inet6) + address->netmask.netmask6 = *((struct sockaddr_in6*) &p->ifr_addr); + else + address->netmask.netmask4 = *((struct sockaddr_in*) &p->ifr_addr); + + address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0; + + address++; + } + +#undef ADDR_SIZE + + uv__close(sockfd); + return 0; +} + + +void uv_free_interface_addresses(uv_interface_address_t* addresses, + int count) { + int i; + + for (i = 0; i < count; ++i) { + uv__free(addresses[i].name); + } + + uv__free(addresses); +} \ No newline at end of file diff --git a/deps/uv/src/unix/aix.c b/deps/uv/src/unix/aix.c index 56a8f4ffe753e8..06f19a4fc9fc54 100644 --- a/deps/uv/src/unix/aix.c +++ b/deps/uv/src/unix/aix.c @@ -1,4 +1,5 @@ /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the @@ -316,104 +317,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { } -uint64_t uv__hrtime(uv_clocktype_t type) { - uint64_t G = 1000000000; - timebasestruct_t t; - read_wall_time(&t, TIMEBASE_SZ); - time_base_to_time(&t, TIMEBASE_SZ); - return (uint64_t) t.tb_high * G + t.tb_low; -} - - -/* - * We could use a static buffer for the path manipulations that we need outside - * of the function, but this function could be called by multiple consumers and - * we don't want to potentially create a race condition in the use of snprintf. - * There is no direct way of getting the exe path in AIX - either through /procfs - * or through some libc APIs. The below approach is to parse the argv[0]'s pattern - * and use it in conjunction with PATH environment variable to craft one. - */ -int uv_exepath(char* buffer, size_t* size) { - int res; - char args[PATH_MAX]; - char abspath[PATH_MAX]; - size_t abspath_size; - struct procsinfo pi; - - if (buffer == NULL || size == NULL || *size == 0) - return -EINVAL; - - pi.pi_pid = getpid(); - res = getargs(&pi, sizeof(pi), args, sizeof(args)); - if (res < 0) - return -EINVAL; - - /* - * Possibilities for args: - * i) an absolute path such as: /home/user/myprojects/nodejs/node - * ii) a relative path such as: ./node or ../myprojects/nodejs/node - * iii) a bare filename such as "node", after exporting PATH variable - * to its location. - */ - - /* Case i) and ii) absolute or relative paths */ - if (strchr(args, '/') != NULL) { - if (realpath(args, abspath) != abspath) - return -errno; - - abspath_size = strlen(abspath); - - *size -= 1; - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); - buffer[*size] = '\0'; - - return 0; - } else { - /* Case iii). Search PATH environment variable */ - char trypath[PATH_MAX]; - char *clonedpath = NULL; - char *token = NULL; - char *path = getenv("PATH"); - - if (path == NULL) - return -EINVAL; - - clonedpath = uv__strdup(path); - if (clonedpath == NULL) - return -ENOMEM; - - token = strtok(clonedpath, ":"); - while (token != NULL) { - snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, args); - if (realpath(trypath, abspath) == abspath) { - /* Check the match is executable */ - if (access(abspath, X_OK) == 0) { - abspath_size = strlen(abspath); - - *size -= 1; - if (*size > abspath_size) - *size = abspath_size; - - memcpy(buffer, abspath, *size); - buffer[*size] = '\0'; - - uv__free(clonedpath); - return 0; - } - } - token = strtok(NULL, ":"); - } - uv__free(clonedpath); - - /* Out of tokens (path entries), and no match found */ - return -EINVAL; - } -} - - uint64_t uv_get_free_memory(void) { perfstat_memory_total_t mem_total; int result = perfstat_memory_total(NULL, &mem_total, sizeof(mem_total), 1); @@ -1018,6 +921,7 @@ int uv_uptime(double* uptime) { size_t entries = 0; time_t boot_time; + boot_time = 0; utmpname(UTMP_FILE); setutent(); @@ -1094,143 +998,6 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { } -void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { - int i; - - for (i = 0; i < count; ++i) { - uv__free(cpu_infos[i].model); - } - - uv__free(cpu_infos); -} - - -int uv_interface_addresses(uv_interface_address_t** addresses, - int* count) { - uv_interface_address_t* address; - int sockfd, inet6, size = 1; - struct ifconf ifc; - struct ifreq *ifr, *p, flg; - struct sockaddr_dl* sa_addr; - - *count = 0; - - if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) { - return -errno; - } - - if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) { - uv__close(sockfd); - return -errno; - } - - ifc.ifc_req = (struct ifreq*)uv__malloc(size); - ifc.ifc_len = size; - if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) { - uv__close(sockfd); - return -errno; - } - -#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p)) - - /* Count all up and running ipv4/ipv6 addresses */ - ifr = ifc.ifc_req; - while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { - p = ifr; - ifr = (struct ifreq*) - ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); - - if (!(p->ifr_addr.sa_family == AF_INET6 || - p->ifr_addr.sa_family == AF_INET)) - continue; - - memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); - if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { - uv__close(sockfd); - return -errno; - } - - if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) - continue; - - (*count)++; - } - - /* Alloc the return interface structs */ - *addresses = (uv_interface_address_t*) - uv__malloc(*count * sizeof(uv_interface_address_t)); - if (!(*addresses)) { - uv__close(sockfd); - return -ENOMEM; - } - address = *addresses; - - ifr = ifc.ifc_req; - while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) { - p = ifr; - ifr = (struct ifreq*) - ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr)); - - if (!(p->ifr_addr.sa_family == AF_INET6 || - p->ifr_addr.sa_family == AF_INET)) - continue; - - inet6 = (p->ifr_addr.sa_family == AF_INET6); - - memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name)); - if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) { - uv__close(sockfd); - return -ENOSYS; - } - - if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING)) - continue; - - /* All conditions above must match count loop */ - - address->name = uv__strdup(p->ifr_name); - - if (inet6) - address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr); - else - address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr); - - sa_addr = (struct sockaddr_dl*) &p->ifr_addr; - memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); - - if (ioctl(sockfd, SIOCGIFNETMASK, p) == -1) { - uv__close(sockfd); - return -ENOSYS; - } - - if (inet6) - address->netmask.netmask6 = *((struct sockaddr_in6*) &p->ifr_addr); - else - address->netmask.netmask4 = *((struct sockaddr_in*) &p->ifr_addr); - - address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0; - - address++; - } - -#undef ADDR_SIZE - - uv__close(sockfd); - return 0; -} - - -void uv_free_interface_addresses(uv_interface_address_t* addresses, - int count) { - int i; - - for (i = 0; i < count; ++i) { - uv__free(addresses[i].name); - } - - uv__free(addresses); -} - void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) { struct pollfd* events; uintptr_t i; diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c index d64593a3134729..c7e431e5295d1b 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c @@ -1345,6 +1345,11 @@ uv_os_fd_t uv_get_osfhandle(int fd) { } +uv_pid_t uv_os_getpid(void) { + return getpid(); +} + + uv_pid_t uv_os_getppid(void) { return getppid(); } diff --git a/deps/uv/src/unix/ibmi.c b/deps/uv/src/unix/ibmi.c new file mode 100644 index 00000000000000..8380d02db7616d --- /dev/null +++ b/deps/uv/src/unix/ibmi.c @@ -0,0 +1,112 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +uint64_t uv_get_free_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_AVPHYS_PAGES); +} + + +uint64_t uv_get_total_memory(void) { + return (uint64_t) sysconf(_SC_PAGESIZE) * sysconf(_SC_PHYS_PAGES); +} + + +void uv_loadavg(double avg[3]) { + avg[0] = avg[1] = avg[2] = 0; + return; +} + + +int uv_resident_set_memory(size_t* rss) { + return UV_ENOSYS; +} + + +int uv_uptime(double* uptime) { + return UV_ENOSYS; +} + + +int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { + unsigned int numcpus, idx = 0; + uv_cpu_info_t* cpu_info; + + *cpu_infos = NULL; + *count = 0; + + numcpus = sysconf(_SC_NPROCESSORS_ONLN); + + *cpu_infos = uv__malloc(numcpus * sizeof(uv_cpu_info_t)); + if (!*cpu_infos) { + return -ENOMEM; + } + + cpu_info = *cpu_infos; + for (idx = 0; idx < numcpus; idx++) { + cpu_info->speed = 0; + cpu_info->model = uv__strdup("unknown"); + cpu_info->cpu_times.user = 0; + cpu_info->cpu_times.sys = 0; + cpu_info->cpu_times.idle = 0; + cpu_info->cpu_times.irq = 0; + cpu_info->cpu_times.nice = 0; + cpu_info++; + } + *count = numcpus; + + return 0; +} \ No newline at end of file diff --git a/deps/uv/src/unix/os390-syscalls.c b/deps/uv/src/unix/os390-syscalls.c index 86c6852b4b608c..5bc489387ef3c5 100644 --- a/deps/uv/src/unix/os390-syscalls.c +++ b/deps/uv/src/unix/os390-syscalls.c @@ -427,3 +427,12 @@ ssize_t os390_readlink(const char* path, char* buf, size_t len) { return rlen; } + + +size_t strnlen(const char* str, size_t maxlen) { + void* p = memchr(str, 0, maxlen); + if (p == NULL) + return maxlen; + else + return p - str; +} diff --git a/deps/uv/src/unix/os390-syscalls.h b/deps/uv/src/unix/os390-syscalls.h index 7aba3d27da7f9b..5ce6a681bf1cb3 100644 --- a/deps/uv/src/unix/os390-syscalls.h +++ b/deps/uv/src/unix/os390-syscalls.h @@ -66,5 +66,6 @@ int scandir(const char* maindir, struct dirent*** namelist, const struct dirent **)); char *mkdtemp(char* path); ssize_t os390_readlink(const char* path, char* buf, size_t len); +size_t strnlen(const char* str, size_t maxlen); #endif /* UV_OS390_SYSCALL_H_ */ diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c index 80b9686ec828f4..9842710d0ea159 100644 --- a/deps/uv/src/unix/process.c +++ b/deps/uv/src/unix/process.c @@ -419,6 +419,7 @@ int uv_spawn(uv_loop_t* loop, return -ENOSYS; #else int signal_pipe[2] = { -1, -1 }; + int pipes_storage[8][2]; int (*pipes)[2]; int stdio_count; ssize_t r; @@ -443,7 +444,10 @@ int uv_spawn(uv_loop_t* loop, stdio_count = 3; err = -ENOMEM; - pipes = uv__malloc(stdio_count * sizeof(*pipes)); + pipes = pipes_storage; + if (stdio_count > (int) ARRAY_SIZE(pipes_storage)) + pipes = uv__malloc(stdio_count * sizeof(*pipes)); + if (pipes == NULL) goto error; @@ -548,7 +552,9 @@ int uv_spawn(uv_loop_t* loop, process->pid = pid; process->exit_cb = options->exit_cb; - uv__free(pipes); + if (pipes != pipes_storage) + uv__free(pipes); + return exec_errorno; error: @@ -562,7 +568,9 @@ int uv_spawn(uv_loop_t* loop, if (pipes[i][1] != -1) uv__close_nocheckstdio(pipes[i][1]); } - uv__free(pipes); + + if (pipes != pipes_storage) + uv__free(pipes); } return err; diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c index 672a7e2d6c65f6..6fc0a01f5a51a6 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -1261,8 +1261,9 @@ static void uv__read(uv_stream_t* stream) { int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) { - assert((stream->type == UV_TCP || stream->type == UV_NAMED_PIPE) && - "uv_shutdown (unix) only supports uv_handle_t right now"); + assert(stream->type == UV_TCP || + stream->type == UV_TTY || + stream->type == UV_NAMED_PIPE); if (!(stream->flags & UV_STREAM_WRITABLE) || stream->flags & UV_STREAM_SHUT || diff --git a/deps/uv/src/unix/tcp.c b/deps/uv/src/unix/tcp.c index c423dcb15fe11d..c7c8d21c668080 100644 --- a/deps/uv/src/unix/tcp.c +++ b/deps/uv/src/unix/tcp.c @@ -28,15 +28,12 @@ #include -static int maybe_new_socket(uv_tcp_t* handle, int domain, int flags) { +static int new_socket(uv_tcp_t* handle, int domain, unsigned long flags) { + struct sockaddr_storage saddr; + socklen_t slen; int sockfd; int err; - if (domain == AF_UNSPEC || uv__stream_fd(handle) != -1) { - handle->flags |= flags; - return 0; - } - err = uv__socket(domain, SOCK_STREAM, 0); if (err < 0) return err; @@ -48,10 +45,74 @@ static int maybe_new_socket(uv_tcp_t* handle, int domain, int flags) { return err; } + if (flags & UV_HANDLE_BOUND) { + /* Bind this new socket to an arbitrary port */ + slen = sizeof(saddr); + memset(&saddr, 0, sizeof(saddr)); + err = getsockname(uv__stream_fd(handle), (struct sockaddr*) &saddr, &slen); + if (err) { + uv__close(sockfd); + return err; + } + + err = bind(uv__stream_fd(handle), (struct sockaddr*) &saddr, slen); + if (err) { + uv__close(sockfd); + return err; + } + } + return 0; } +static int maybe_new_socket(uv_tcp_t* handle, int domain, unsigned long flags) { + struct sockaddr_storage saddr; + socklen_t slen; + + if (domain == AF_UNSPEC) { + handle->flags |= flags; + return 0; + } + + if (uv__stream_fd(handle) != -1) { + + if (flags & UV_HANDLE_BOUND) { + + if (handle->flags & UV_HANDLE_BOUND) { + /* It is already bound to a port. */ + handle->flags |= flags; + return 0; + } + + /* Query to see if tcp socket is bound. */ + slen = sizeof(saddr); + memset(&saddr, 0, sizeof(saddr)); + if (getsockname(uv__stream_fd(handle), (struct sockaddr*) &saddr, &slen)) + return -errno; + + if ((saddr.ss_family == AF_INET6 && + ((struct sockaddr_in6*) &saddr)->sin6_port != 0) || + (saddr.ss_family == AF_INET && + ((struct sockaddr_in*) &saddr)->sin_port != 0)) { + /* Handle is already bound to a port. */ + handle->flags |= flags; + return 0; + } + + /* Bind to arbitrary port */ + if (bind(uv__stream_fd(handle), (struct sockaddr*) &saddr, slen)) + return -errno; + } + + handle->flags |= flags; + return 0; + } + + return new_socket(handle, domain, flags); +} + + int uv_tcp_init_ex(uv_loop_t* loop, uv_tcp_t* tcp, unsigned int flags) { int domain; @@ -260,6 +321,7 @@ int uv_tcp_getpeername(const uv_tcp_t* handle, int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { static int single_accept = -1; + unsigned long flags; int err; if (tcp->delayed_error) @@ -273,30 +335,17 @@ int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { if (single_accept) tcp->flags |= UV_TCP_SINGLE_ACCEPT; - err = maybe_new_socket(tcp, AF_INET, UV_STREAM_READABLE); - if (err) - return err; - -#ifdef __MVS__ + flags = UV_STREAM_READABLE; +#if defined(__MVS__) /* on zOS the listen call does not bind automatically if the socket is unbound. Hence the manual binding to an arbitrary port is required to be done manually */ - - if (!(tcp->flags & UV_HANDLE_BOUND)) { - struct sockaddr_storage saddr; - socklen_t slen = sizeof(saddr); - memset(&saddr, 0, sizeof(saddr)); - - if (getsockname(tcp->io_watcher.fd, (struct sockaddr*) &saddr, &slen)) - return -errno; - - if (bind(tcp->io_watcher.fd, (struct sockaddr*) &saddr, slen)) - return -errno; - - tcp->flags |= UV_HANDLE_BOUND; - } -#endif + flags |= UV_HANDLE_BOUND; +#endif + err = maybe_new_socket(tcp, AF_INET, flags); + if (err) + return err; if (listen(tcp->io_watcher.fd, backlog)) return -errno; diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index b90eaa7548969a..11c7c13edd04d6 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -439,8 +439,15 @@ void fs__open(uv_fs_t* req) { * does. We indiscriminately use all the sharing modes, to match * UNIX semantics. In particular, this ensures that the file can * be deleted even whilst it's open, fixing issue #1449. + * We still support exclusive sharing mode, since it is necessary + * for opening raw block devices, otherwise Windows will prevent + * any attempt to write past the master boot record. */ - share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; + if (flags & UV_FS_O_EXLOCK) { + share = 0; + } else { + share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; + } switch (flags & (UV_FS_O_CREAT | UV_FS_O_EXCL | UV_FS_O_TRUNC)) { case 0: diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c index 642213bc8886c2..1a7c4dc15e0b30 100644 --- a/deps/uv/src/win/pipe.c +++ b/deps/uv/src/win/pipe.c @@ -31,8 +31,8 @@ #include "stream-inl.h" #include "req-inl.h" -#include -#include +#include +#include typedef struct uv__ipc_queue_item_s uv__ipc_queue_item_t; diff --git a/deps/uv/src/win/thread.c b/deps/uv/src/win/thread.c index 30b2d7793cf906..9eaad77cd02c97 100644 --- a/deps/uv/src/win/thread.c +++ b/deps/uv/src/win/thread.c @@ -182,6 +182,7 @@ int uv_thread_join(uv_thread_t *tid) { else { CloseHandle(*tid); *tid = 0; + MemoryBarrier(); /* For feature parity with pthread_join(). */ return 0; } } diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c index 2aec9f8dfe3e2b..3100bc23ad3e09 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -331,6 +331,11 @@ uint64_t uv_get_total_memory(void) { } +uv_pid_t uv_os_getpid(void) { + return GetCurrentProcessId(); +} + + uv_pid_t uv_os_getppid(void) { int parent_pid = -1; HANDLE handle; diff --git a/deps/uv/test/run-tests.c b/deps/uv/test/run-tests.c index 4e10b68f3b42f7..da4ac82e431124 100644 --- a/deps/uv/test/run-tests.c +++ b/deps/uv/test/run-tests.c @@ -43,6 +43,7 @@ int ipc_send_recv_helper(void); int ipc_helper_bind_twice(void); int stdio_over_pipes_helper(void); int spawn_stdin_stdout(void); +int spawn_tcp_server_helper(void); static int maybe_run_test(int argc, char **argv); @@ -111,6 +112,10 @@ static int maybe_run_test(int argc, char **argv) { return 1; } + if (strcmp(argv[1], "spawn_tcp_server_helper") == 0) { + return spawn_tcp_server_helper(); + } + if (strcmp(argv[1], "spawn_helper3") == 0) { char buffer[256]; ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin)); diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index 6afa650793e670..cae02dd1fddec8 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c @@ -32,8 +32,12 @@ defined(__APPLE__) || defined(_AIX) || defined(__MVS__) #include /* unlink, rmdir, etc. */ #else +# include # include # include +# ifndef ERROR_SYMLINK_NOT_SUPPORTED +# define ERROR_SYMLINK_NOT_SUPPORTED 1464 +# endif # define unlink _unlink # define rmdir _rmdir # define open _open @@ -2167,7 +2171,6 @@ TEST_IMPL(fs_utime) { #ifdef _WIN32 TEST_IMPL(fs_stat_root) { int r; - uv_loop_t* loop = uv_default_loop(); r = uv_fs_stat(NULL, &stat_req, "\\", NULL); ASSERT(r == 0); @@ -3061,3 +3064,60 @@ TEST_IMPL(fs_null_req) { return 0; } + +#ifdef _WIN32 +TEST_IMPL(fs_exclusive_sharing_mode) { + int r; + + /* Setup. */ + unlink("test_file"); + + ASSERT(UV_FS_O_EXLOCK > 0); + + r = uv_fs_open(NULL, + &open_req1, + "test_file", + O_RDWR | O_CREAT | UV_FS_O_EXLOCK, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r >= 0); + ASSERT(open_req1.result >= 0); + uv_fs_req_cleanup(&open_req1); + + r = uv_fs_open(NULL, + &open_req2, + "test_file", + O_RDONLY | UV_FS_O_EXLOCK, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r < 0); + ASSERT(open_req2.result < 0); + uv_fs_req_cleanup(&open_req2); + + r = uv_fs_close(NULL, &close_req, open_req1.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + r = uv_fs_open(NULL, + &open_req2, + "test_file", + O_RDONLY | UV_FS_O_EXLOCK, + S_IWUSR | S_IRUSR, + NULL); + ASSERT(r >= 0); + ASSERT(open_req2.result >= 0); + uv_fs_req_cleanup(&open_req2); + + r = uv_fs_close(NULL, &close_req, open_req2.result, NULL); + ASSERT(r == 0); + ASSERT(close_req.result == 0); + uv_fs_req_cleanup(&close_req); + + /* Cleanup */ + unlink("test_file"); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 3e88e6c928d096..2adbe6a017cfc3 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -260,6 +260,7 @@ TEST_DECLARE (spawn_closed_process_io) TEST_DECLARE (spawn_reads_child_path) TEST_DECLARE (spawn_inherit_streams) TEST_DECLARE (spawn_quoted_path) +TEST_DECLARE (spawn_tcp_server) TEST_DECLARE (fs_poll) TEST_DECLARE (fs_poll_getpath) TEST_DECLARE (kill) @@ -321,6 +322,9 @@ TEST_DECLARE (fs_write_alotof_bufs) TEST_DECLARE (fs_write_alotof_bufs_with_offset) TEST_DECLARE (fs_file_pos_after_op_with_offset) TEST_DECLARE (fs_null_req) +#ifdef _WIN32 +TEST_DECLARE (fs_exclusive_sharing_mode) +#endif TEST_DECLARE (threadpool_queue_work_simple) TEST_DECLARE (threadpool_queue_work_einval) TEST_DECLARE (threadpool_multiple_event_loops) @@ -740,6 +744,7 @@ TASK_LIST_START TEST_ENTRY (spawn_reads_child_path) TEST_ENTRY (spawn_inherit_streams) TEST_ENTRY (spawn_quoted_path) + TEST_ENTRY (spawn_tcp_server) TEST_ENTRY (fs_poll) TEST_ENTRY (fs_poll_getpath) TEST_ENTRY (kill) @@ -832,6 +837,9 @@ TASK_LIST_START TEST_ENTRY (fs_read_write_null_arguments) TEST_ENTRY (fs_file_pos_after_op_with_offset) TEST_ENTRY (fs_null_req) +#ifdef _WIN32 + TEST_ENTRY (fs_exclusive_sharing_mode) +#endif TEST_ENTRY (get_osfhandle_valid_handle) TEST_ENTRY (threadpool_queue_work_simple) TEST_ENTRY (threadpool_queue_work_einval) diff --git a/deps/uv/test/test-platform-output.c b/deps/uv/test/test-platform-output.c index 50ed59a6d23a02..4025fba540e61e 100644 --- a/deps/uv/test/test-platform-output.c +++ b/deps/uv/test/test-platform-output.c @@ -29,6 +29,7 @@ TEST_IMPL(platform_output) { size_t rss; size_t size; double uptime; + uv_pid_t pid; uv_pid_t ppid; uv_rusage_t rusage; uv_cpu_info_t* cpus; @@ -145,6 +146,9 @@ TEST_IMPL(platform_output) { printf(" shell: %s\n", pwd.shell); printf(" home directory: %s\n", pwd.homedir); + pid = uv_os_getpid(); + ASSERT(pid > 0); + printf("uv_os_getpid: %d\n", (int) pid); ppid = uv_os_getppid(); ASSERT(ppid > 0); printf("uv_os_getppid: %d\n", (int) ppid); diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c index d3958fe216f983..4b138265a5bc51 100644 --- a/deps/uv/test/test-spawn.c +++ b/deps/uv/test/test-spawn.c @@ -50,6 +50,7 @@ static size_t exepath_size = 1024; static char* args[5]; static int no_term_signal; static int timer_counter; +static uv_tcp_t tcp_server; #define OUTPUT_SIZE 1024 static char output[OUTPUT_SIZE]; @@ -622,6 +623,84 @@ TEST_IMPL(spawn_stdio_greater_than_3) { } +int spawn_tcp_server_helper(void) { + uv_tcp_t tcp; + uv_os_sock_t handle; + int r; + + r = uv_tcp_init(uv_default_loop(), &tcp); + ASSERT(r == 0); + +#ifdef _WIN32 + handle = _get_osfhandle(3); +#else + handle = 3; +#endif + r = uv_tcp_open(&tcp, handle); + ASSERT(r == 0); + + /* Make sure that we can listen on a socket that was + * passed down from the parent process + */ + r = uv_listen((uv_stream_t*)&tcp, SOMAXCONN, NULL); + ASSERT(r == 0); + + return 1; +} + + +TEST_IMPL(spawn_tcp_server) { + uv_stdio_container_t stdio[4]; + struct sockaddr_in addr; + int fd; + int r; +#ifdef _WIN32 + uv_os_fd_t handle; +#endif + + init_process_options("spawn_tcp_server_helper", exit_cb); + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + + fd = -1; + r = uv_tcp_init_ex(uv_default_loop(), &tcp_server, AF_INET); + ASSERT(r == 0); + r = uv_tcp_bind(&tcp_server, (const struct sockaddr*) &addr, 0); + ASSERT(r == 0); +#ifdef _WIN32 + r = uv_fileno((uv_handle_t*)&tcp_server, &handle); + fd = _open_osfhandle((intptr_t) handle, 0); +#else + r = uv_fileno((uv_handle_t*)&tcp_server, &fd); + #endif + ASSERT(r == 0); + ASSERT(fd > 0); + + options.stdio = stdio; + options.stdio[0].flags = UV_INHERIT_FD; + options.stdio[0].data.fd = 0; + options.stdio[1].flags = UV_INHERIT_FD; + options.stdio[1].data.fd = 1; + options.stdio[2].flags = UV_INHERIT_FD; + options.stdio[2].data.fd = 2; + options.stdio[3].flags = UV_INHERIT_FD; + options.stdio[3].data.fd = fd; + options.stdio_count = 4; + + r = uv_spawn(uv_default_loop(), &process, &options); + ASSERT(r == 0); + + r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); + ASSERT(r == 0); + + ASSERT(exit_cb_called == 1); + ASSERT(close_cb_called == 1); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + TEST_IMPL(spawn_ignored_stdio) { int r; diff --git a/deps/uv/test/test-thread.c b/deps/uv/test/test-thread.c index b0e87e208155ea..955c9f2f1be149 100644 --- a/deps/uv/test/test-thread.c +++ b/deps/uv/test/test-thread.c @@ -44,7 +44,7 @@ struct fs_req { struct test_thread { uv_thread_t thread_id; - volatile int thread_called; + int thread_called; }; static void getaddrinfo_do(struct getaddrinfo_req* req); @@ -54,7 +54,7 @@ static void getaddrinfo_cb(uv_getaddrinfo_t* handle, static void fs_do(struct fs_req* req); static void fs_cb(uv_fs_t* handle); -static volatile int thread_called; +static int thread_called; static uv_key_t tls_key; @@ -105,36 +105,30 @@ static void fs_cb(uv_fs_t* handle) { static void do_work(void* arg) { - struct getaddrinfo_req getaddrinfo_reqs[16]; - struct fs_req fs_reqs[16]; - uv_loop_t* loop; + struct getaddrinfo_req getaddrinfo_reqs[4]; + struct fs_req fs_reqs[4]; + uv_loop_t loop; size_t i; - int r; struct test_thread* thread = arg; - loop = malloc(sizeof *loop); - ASSERT(loop != NULL); - ASSERT(0 == uv_loop_init(loop)); + ASSERT(0 == uv_loop_init(&loop)); for (i = 0; i < ARRAY_SIZE(getaddrinfo_reqs); i++) { struct getaddrinfo_req* req = getaddrinfo_reqs + i; - req->counter = 16; - req->loop = loop; + req->counter = 4; + req->loop = &loop; getaddrinfo_do(req); } for (i = 0; i < ARRAY_SIZE(fs_reqs); i++) { struct fs_req* req = fs_reqs + i; - req->counter = 16; - req->loop = loop; + req->counter = 4; + req->loop = &loop; fs_do(req); } - r = uv_run(loop, UV_RUN_DEFAULT); - ASSERT(r == 0); - - ASSERT(0 == uv_loop_close(loop)); - free(loop); + ASSERT(0 == uv_run(&loop, UV_RUN_DEFAULT)); + ASSERT(0 == uv_loop_close(&loop)); thread->thread_called = 1; } @@ -179,7 +173,7 @@ TEST_IMPL(threadpool_multiple_event_loops) { for (i = 0; i < ARRAY_SIZE(threads); i++) { r = uv_thread_join(&threads[i].thread_id); ASSERT(r == 0); - ASSERT(threads[i].thread_called); + ASSERT(threads[i].thread_called == 1); } return 0; diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 9d9bb4b735a310..96fb801a77b034 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -274,19 +274,43 @@ }, }], [ 'OS=="aix"', { - 'sources': [ 'src/unix/aix.c' ], + 'variables': { + 'os_name': ' task) = 0; + + /** + * Schedules a task to be invoked by this TaskRunner. The task is scheduled + * after the given number of seconds |delay_in_seconds|. The TaskRunner + * implementation takes ownership of |task|. + */ + virtual void PostDelayedTask(std::unique_ptr task, + double delay_in_seconds) = 0; + + /** + * Schedules an idle task to be invoked by this TaskRunner. The task is + * scheduled when the embedder is idle. Requires that + * TaskRunner::SupportsIdleTasks(isolate) is true. Idle tasks may be reordered + * relative to other task types and may be starved for an arbitrarily long + * time if no idle time is available. The TaskRunner implementation takes + * ownership of |task|. + */ + virtual void PostIdleTask(std::unique_ptr task) = 0; + + /** + * Returns true if idle tasks are enabled for this TaskRunner. + */ + virtual bool IdleTasksEnabled() = 0; + + TaskRunner() = default; + virtual ~TaskRunner() = default; + + private: + TaskRunner(const TaskRunner&) = delete; + TaskRunner& operator=(const TaskRunner&) = delete; +}; + /** * The interface represents complex arguments to trace events. */ @@ -150,6 +195,28 @@ class Platform { */ virtual size_t NumberOfAvailableBackgroundThreads() { return 0; } + /** + * Returns a TaskRunner which can be used to post a task on the foreground. + * This function should only be called from a foreground thread. + */ + virtual std::shared_ptr GetForegroundTaskRunner( + Isolate* isolate) { + // TODO(ahaas): Make this function abstract after it got implemented on all + // platforms. + return {}; + } + + /** + * Returns a TaskRunner which can be used to post a task on a background. + * This function should only be called from a foreground thread. + */ + virtual std::shared_ptr GetBackgroundTaskRunner( + Isolate* isolate) { + // TODO(ahaas): Make this function abstract after it got implemented on all + // platforms. + return {}; + } + /** * Schedules a task to be invoked on a background thread. |expected_runtime| * indicates that the task will run a long time. The Platform implementation diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 0e3fa434a4c608..2760fe3f297be8 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 2 #define V8_BUILD_NUMBER 414 -#define V8_PATCH_LEVEL 44 +#define V8_PATCH_LEVEL 46 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/debug/debug.cc b/deps/v8/src/debug/debug.cc index 8d5adfbaeacf95..966be62e63617f 100644 --- a/deps/v8/src/debug/debug.cc +++ b/deps/v8/src/debug/debug.cc @@ -338,13 +338,12 @@ bool Debug::Load() { void Debug::Unload() { ClearAllBreakPoints(); ClearStepping(); + if (FLAG_block_coverage) RemoveAllCoverageInfos(); RemoveDebugDelegate(); // Return debugger is not loaded. if (!is_loaded()) return; - if (FLAG_block_coverage) RemoveAllCoverageInfos(); - // Clear debugger context global handle. GlobalHandles::Destroy(Handle::cast(debug_context_).location()); debug_context_ = Handle(); @@ -643,8 +642,11 @@ void Debug::ApplyBreakPoints(Handle debug_info) { } void Debug::ClearBreakPoints(Handle debug_info) { + // If we attempt to clear breakpoints but none exist, simply return. This can + // happen e.g. CoverageInfos exit but no breakpoints are set. + if (!debug_info->HasDebugBytecodeArray()) return; + DisallowHeapAllocation no_gc; - DCHECK(debug_info->HasDebugBytecodeArray()); for (BreakIterator it(debug_info); !it.Done(); it.Next()) { it.ClearDebugBreak(); } @@ -1895,6 +1897,7 @@ void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle'; const y = 'foo⠊Set-Cookie: foo=bar'; let count = 0; +const countdown = new Countdown(3, () => server.close()); function test(res, code, key, value) { const header = { [key]: value }; @@ -46,8 +48,7 @@ const server = http.createServer((req, res) => { default: assert.fail('should not get to here.'); } - if (count === 3) - server.close(); + countdown.dec(); res.end('ok'); }); server.listen(0, () => { diff --git a/test/parallel/test-http-response-statuscode.js b/test/parallel/test-http-response-statuscode.js index 17fce6c2d0f11e..79c3f6305449bb 100644 --- a/test/parallel/test-http-response-statuscode.js +++ b/test/parallel/test-http-response-statuscode.js @@ -2,6 +2,7 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); const MAX_REQUESTS = 13; let reqNum = 0; @@ -56,12 +57,12 @@ const server = http.Server(common.mustCall(function(req, res) { test(res, '404 this is not valid either', '404 this is not valid either'); break; case 12: - assert.throws(() => { res.writeHead(); }, - common.expectsError({ - code: 'ERR_HTTP_INVALID_STATUS_CODE', - type: RangeError, - message: 'Invalid status code: undefined' - })); + common.expectsError(() => { res.writeHead(); }, + { + code: 'ERR_HTTP_INVALID_STATUS_CODE', + type: RangeError, + message: 'Invalid status code: undefined' + }); this.close(); break; default: @@ -72,13 +73,17 @@ const server = http.Server(common.mustCall(function(req, res) { }, MAX_REQUESTS)); server.listen(); +const countdown = new Countdown(MAX_REQUESTS, () => server.close()); + server.on('listening', function makeRequest() { http.get({ port: this.address().port }, (res) => { assert.strictEqual(res.statusCode, 200); res.on('end', () => { - if (++reqNum < MAX_REQUESTS) + countdown.dec(); + reqNum = MAX_REQUESTS - countdown.remaining; + if (countdown.remaining > 0) makeRequest.call(this); }); res.resume(); diff --git a/test/parallel/test-http-server-de-chunked-trailer.js b/test/parallel/test-http-server-de-chunked-trailer.js index 72c40ed5592690..dad744209ee419 100644 --- a/test/parallel/test-http-server-de-chunked-trailer.js +++ b/test/parallel/test-http-server-de-chunked-trailer.js @@ -14,8 +14,8 @@ const server = http.createServer(common.mustCall(function(req, res) { message: 'Trailers are invalid with this transfer encoding', type: Error }; - assert.throws(() => res.writeHead(200, { 'Content-Length': '2' }), - common.expectsError(trailerInvalidErr)); + common.expectsError(() => res.writeHead(200, { 'Content-Length': '2' }), + trailerInvalidErr); res.removeHeader('Trailer'); res.end('ok'); })); diff --git a/test/parallel/test-http-set-cookies.js b/test/parallel/test-http-set-cookies.js index 44a5f47bbb3d03..c307bda73a3515 100644 --- a/test/parallel/test-http-set-cookies.js +++ b/test/parallel/test-http-set-cookies.js @@ -23,9 +23,9 @@ require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); -let nresponses = 0; - +const countdown = new Countdown(2, () => server.close()); const server = http.createServer(function(req, res) { if (req.url === '/one') { res.writeHead(200, [['set-cookie', 'A'], @@ -55,9 +55,7 @@ server.on('listening', function() { }); res.on('end', function() { - if (++nresponses === 2) { - server.close(); - } + countdown.dec(); }); }); @@ -72,14 +70,8 @@ server.on('listening', function() { }); res.on('end', function() { - if (++nresponses === 2) { - server.close(); - } + countdown.dec(); }); }); }); - -process.on('exit', function() { - assert.strictEqual(2, nresponses); -}); diff --git a/test/parallel/test-http-should-keep-alive.js b/test/parallel/test-http-should-keep-alive.js index dd4709d6946a84..038af47ee4db97 100644 --- a/test/parallel/test-http-should-keep-alive.js +++ b/test/parallel/test-http-should-keep-alive.js @@ -24,6 +24,7 @@ require('../common'); const assert = require('assert'); const http = require('http'); const net = require('net'); +const Countdown = require('../common/countdown'); const SERVER_RESPONSES = [ 'HTTP/1.0 200 ok\r\nContent-Length: 0\r\n\r\n', @@ -41,34 +42,27 @@ const SHOULD_KEEP_ALIVE = [ true, // HTTP/1.1, Connection: keep-alive false // HTTP/1.1, Connection: close ]; -let requests = 0; -let responses = 0; http.globalAgent.maxSockets = 5; +const countdown = new Countdown(SHOULD_KEEP_ALIVE.length, () => server.close()); + +const getCountdownIndex = () => SERVER_RESPONSES.length - countdown.remaining; + const server = net.createServer(function(socket) { - socket.write(SERVER_RESPONSES[requests]); - ++requests; + socket.write(SERVER_RESPONSES[getCountdownIndex()]); }).listen(0, function() { function makeRequest() { const req = http.get({ port: server.address().port }, function(res) { assert.strictEqual( - req.shouldKeepAlive, SHOULD_KEEP_ALIVE[responses], - `${SERVER_RESPONSES[responses]} should ${ - SHOULD_KEEP_ALIVE[responses] ? '' : 'not '}Keep-Alive`); - ++responses; - if (responses < SHOULD_KEEP_ALIVE.length) { + req.shouldKeepAlive, SHOULD_KEEP_ALIVE[getCountdownIndex()], + `${SERVER_RESPONSES[getCountdownIndex()]} should ${ + SHOULD_KEEP_ALIVE[getCountdownIndex()] ? '' : 'not '}Keep-Alive`); + countdown.dec(); + if (countdown.remaining) { makeRequest(); - } else { - server.close(); } res.resume(); }); } - makeRequest(); }); - -process.on('exit', function() { - assert.strictEqual(requests, SERVER_RESPONSES.length); - assert.strictEqual(responses, SHOULD_KEEP_ALIVE.length); -}); diff --git a/test/parallel/test-http-status-code.js b/test/parallel/test-http-status-code.js index 802565f26bb697..246d22c131fe65 100644 --- a/test/parallel/test-http-status-code.js +++ b/test/parallel/test-http-status-code.js @@ -23,19 +23,19 @@ require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); // Simple test of Node's HTTP ServerResponse.statusCode // ServerResponse.prototype.statusCode -let testsComplete = 0; const tests = [200, 202, 300, 404, 451, 500]; -let testIdx = 0; +let test; +const countdown = new Countdown(tests.length, () => s.close()); const s = http.createServer(function(req, res) { - const t = tests[testIdx]; - res.writeHead(t, { 'Content-Type': 'text/plain' }); + res.writeHead(test, { 'Content-Type': 'text/plain' }); console.log(`--\nserver: statusCode after writeHead: ${res.statusCode}`); - assert.strictEqual(res.statusCode, t); + assert.strictEqual(res.statusCode, test); res.end('hello world\n'); }); @@ -43,25 +43,16 @@ s.listen(0, nextTest); function nextTest() { - if (testIdx + 1 === tests.length) { - return s.close(); - } - const test = tests[testIdx]; + test = tests.shift(); http.get({ port: s.address().port }, function(response) { console.log(`client: expected status: ${test}`); console.log(`client: statusCode: ${response.statusCode}`); assert.strictEqual(response.statusCode, test); response.on('end', function() { - testsComplete++; - testIdx += 1; - nextTest(); + if (countdown.dec()) + nextTest(); }); response.resume(); }); } - - -process.on('exit', function() { - assert.strictEqual(5, testsComplete); -}); diff --git a/test/parallel/test-http-status-reason-invalid-chars.js b/test/parallel/test-http-status-reason-invalid-chars.js index 75ccb2c2430c53..ce08ff84a09b42 100644 --- a/test/parallel/test-http-status-reason-invalid-chars.js +++ b/test/parallel/test-http-status-reason-invalid-chars.js @@ -3,6 +3,7 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +const Countdown = require('../common/countdown'); function explicit(req, res) { assert.throws(() => { @@ -34,13 +35,12 @@ const server = http.createServer((req, res) => { } }).listen(0, common.mustCall(() => { const hostname = 'localhost'; + const countdown = new Countdown(2, () => server.close()); const url = `http://${hostname}:${server.address().port}`; - let left = 2; const check = common.mustCall((res) => { - left--; assert.notStrictEqual(res.headers['content-type'], 'text/html'); assert.notStrictEqual(res.headers['content-type'], 'gotcha'); - if (left === 0) server.close(); + countdown.dec(); }, 2); http.get(`${url}/explicit`, check).end(); http.get(`${url}/implicit`, check).end(); diff --git a/test/parallel/test-http-timeout-overflow.js b/test/parallel/test-http-timeout-overflow.js index dc93b3da7ae20d..e95405bc8b3554 100644 --- a/test/parallel/test-http-timeout-overflow.js +++ b/test/parallel/test-http-timeout-overflow.js @@ -20,19 +20,13 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); -const assert = require('assert'); - +const common = require('../common'); const http = require('http'); -let serverRequests = 0; -let clientRequests = 0; - -const server = http.createServer(function(req, res) { - serverRequests++; +const server = http.createServer(common.mustCall(function(req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('OK'); -}); +})); server.listen(0, function() { function callback() {} @@ -44,10 +38,9 @@ server.listen(0, function() { }, function(res) { req.clearTimeout(callback); - res.on('end', function() { - clientRequests++; + res.on('end', common.mustCall(function() { server.close(); - }); + })); res.resume(); }); @@ -56,8 +49,3 @@ server.listen(0, function() { req.setTimeout(0xffffffff, callback); req.end(); }); - -process.once('exit', function() { - assert.strictEqual(clientRequests, 1); - assert.strictEqual(serverRequests, 1); -}); diff --git a/test/parallel/test-http-timeout.js b/test/parallel/test-http-timeout.js index 817bfe7a3c3be7..c576f1c5429101 100644 --- a/test/parallel/test-http-timeout.js +++ b/test/parallel/test-http-timeout.js @@ -23,24 +23,25 @@ require('../common'); const http = require('http'); +const Countdown = require('../common/countdown'); const server = http.createServer(function(req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('OK'); }); +const MAX_COUNT = 11; const agent = new http.Agent({ maxSockets: 1 }); +const countdown = new Countdown(MAX_COUNT, () => server.close()); server.listen(0, function() { - for (let i = 0; i < 11; ++i) { + for (let i = 0; i < MAX_COUNT; ++i) { createRequest().end(); } function callback() {} - let count = 0; - function createRequest() { const req = http.request( { port: server.address().port, path: '/', agent: agent }, @@ -48,11 +49,7 @@ server.listen(0, function() { req.clearTimeout(callback); res.on('end', function() { - count++; - - if (count === 11) { - server.close(); - } + countdown.dec(); }); res.resume(); diff --git a/test/parallel/test-http-upgrade-client.js b/test/parallel/test-http-upgrade-client.js index 3c56e5959fbd93..c637324a53d801 100644 --- a/test/parallel/test-http-upgrade-client.js +++ b/test/parallel/test-http-upgrade-client.js @@ -29,6 +29,7 @@ const assert = require('assert'); const http = require('http'); const net = require('net'); +const Countdown = require('../common/countdown'); // Create a TCP server const srv = net.createServer(function(c) { @@ -60,7 +61,8 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() { ['Origin', 'http://www.websocket.org'] ] ]; - let left = headers.length; + const countdown = new Countdown(headers.length, () => srv.close()); + headers.forEach(function(h) { const req = http.get({ port: port, @@ -87,8 +89,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() { assert.deepStrictEqual(expectedHeaders, res.headers); socket.end(); - if (--left === 0) - srv.close(); + countdown.dec(); })); req.on('close', common.mustCall(function() { assert.strictEqual(sawUpgrade, true); diff --git a/test/parallel/test-http-write-head.js b/test/parallel/test-http-write-head.js index 70ad5935a92690..2d1b8ff5504df0 100644 --- a/test/parallel/test-http-write-head.js +++ b/test/parallel/test-http-write-head.js @@ -52,14 +52,13 @@ const s = http.createServer(common.mustCall((req, res) => { res.writeHead(200, { Test: '2' }); - assert.throws(() => { + common.expectsError(() => { res.writeHead(100, {}); - }, common.expectsError({ + }, { code: 'ERR_HTTP_HEADERS_SENT', type: Error, message: 'Cannot render headers after they are sent to the client' - }) - ); + }); res.end(); })); diff --git a/test/parallel/test-http.js b/test/parallel/test-http.js index d9fa581f3b55ce..52bebc476e1510 100644 --- a/test/parallel/test-http.js +++ b/test/parallel/test-http.js @@ -72,33 +72,33 @@ server.on('listening', function() { Cookie: [ 'foo=bar', 'bar=baz', 'baz=quux' ] }, agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: foo=bar; bar=baz; baz=quux']); assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /hello'); })); })); - setTimeout(common.mustCall(function() { + setTimeout(common.mustCall(() => { const req = http.request({ port: server.address().port, method: 'PUT', path: '/there', agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: node=awesome; ta=da']); assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /there'); })); })); @@ -106,7 +106,7 @@ server.on('listening', function() { req.end(); }), 1); - setTimeout(common.mustCall(function() { + setTimeout(common.mustCall(() => { const req = http.request({ port: server.address().port, method: 'POST', @@ -115,7 +115,7 @@ server.on('listening', function() { ['Cookie', 'def=456'], ['Cookie', 'ghi=789'] ], agent: agent - }, common.mustCall(function(res) { + }, common.mustCall((res) => { const cookieHeaders = req._header.match(/^Cookie: .+$/img); assert.deepStrictEqual(cookieHeaders, ['Cookie: abc=123', @@ -124,8 +124,8 @@ server.on('listening', function() { assert.strictEqual(res.statusCode, 200); let body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { body += chunk; }); - res.on('end', common.mustCall(function() { + res.on('data', (chunk) => { body += chunk; }); + res.on('end', common.mustCall(() => { assert.strictEqual(body, 'The path was /world'); })); })); diff --git a/test/parallel/test-http2-client-promisify-connect.js b/test/parallel/test-http2-client-promisify-connect.js index f13f5f1408d307..b66827c1507302 100644 --- a/test/parallel/test-http2-client-promisify-connect.js +++ b/test/parallel/test-http2-client-promisify-connect.js @@ -1,6 +1,8 @@ 'use strict'; const common = require('../common'); +common.crashOnUnhandledRejection(); + if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); diff --git a/test/parallel/test-http2-client-request-options-errors.js b/test/parallel/test-http2-client-request-options-errors.js index 5d3fc0ab5a1fd8..4b146a1bc8c2e4 100644 --- a/test/parallel/test-http2-client-request-options-errors.js +++ b/test/parallel/test-http2-client-request-options-errors.js @@ -3,7 +3,6 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); -const assert = require('assert'); const http2 = require('http2'); // Check if correct errors are emitted when wrong type of data is passed @@ -40,19 +39,19 @@ server.listen(0, common.mustCall(() => { return; } - assert.throws( + common.expectsError( () => client.request({ ':method': 'CONNECT', ':authority': `localhost:${port}` }, { [option]: types[type] }), - common.expectsError({ + { type: TypeError, code: 'ERR_INVALID_OPT_VALUE', message: `The value "${String(types[type])}" is invalid ` + `for option "${option}"` - }) + } ); }); }); diff --git a/test/parallel/test-http2-client-upload.js b/test/parallel/test-http2-client-upload.js index cfba97696ce227..8fb5f369ca4cb7 100644 --- a/test/parallel/test-http2-client-upload.js +++ b/test/parallel/test-http2-client-upload.js @@ -38,7 +38,7 @@ fs.readFile(loc, common.mustCall((err, data) => { function maybeClose() { if (--remaining === 0) { server.close(); - client.destroy(); + client.shutdown(); } } @@ -47,7 +47,7 @@ fs.readFile(loc, common.mustCall((err, data) => { req.resume(); req.on('end', common.mustCall(maybeClose)); const str = fs.createReadStream(loc); - str.on('end', common.mustCall(maybeClose)); + req.on('finish', common.mustCall(maybeClose)); str.pipe(req); })); })); diff --git a/test/parallel/test-http2-compat-serverresponse-headers.js b/test/parallel/test-http2-compat-serverresponse-headers.js index ec1071bc34ffa1..6da74307e0d340 100644 --- a/test/parallel/test-http2-compat-serverresponse-headers.js +++ b/test/parallel/test-http2-compat-serverresponse-headers.js @@ -72,28 +72,28 @@ server.listen(0, common.mustCall(function() { ':path', ':authority', ':scheme' - ].forEach((header) => assert.throws( + ].forEach((header) => common.expectsError( () => response.setHeader(header, 'foobar'), - common.expectsError({ + { code: 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED', type: Error, message: 'Cannot set HTTP/2 pseudo-headers' }) - )); - assert.throws(function() { + ); + common.expectsError(function() { response.setHeader(real, null); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_HEADER_VALUE', type: TypeError, message: 'Invalid value "null" for header "foo-bar"' - })); - assert.throws(function() { + }); + common.expectsError(function() { response.setHeader(real, undefined); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_HEADER_VALUE', type: TypeError, message: 'Invalid value "undefined" for header "foo-bar"' - })); + }); common.expectsError( () => response.setHeader(), // header name undefined { diff --git a/test/parallel/test-http2-compat-serverresponse-statuscode.js b/test/parallel/test-http2-compat-serverresponse-statuscode.js index 96b033328f2855..6a573da88f9858 100644 --- a/test/parallel/test-http2-compat-serverresponse-statuscode.js +++ b/test/parallel/test-http2-compat-serverresponse-statuscode.js @@ -34,24 +34,24 @@ server.listen(0, common.mustCall(function() { response.statusCode = realStatusCodes.internalServerError; }); - assert.throws(function() { + common.expectsError(function() { response.statusCode = realStatusCodes.continue; - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INFO_STATUS_NOT_ALLOWED', type: RangeError - })); - assert.throws(function() { + }); + common.expectsError(function() { response.statusCode = fakeStatusCodes.tooLow; - }, common.expectsError({ + }, { code: 'ERR_HTTP2_STATUS_INVALID', type: RangeError - })); - assert.throws(function() { + }); + common.expectsError(function() { response.statusCode = fakeStatusCodes.tooHigh; - }, common.expectsError({ + }, { code: 'ERR_HTTP2_STATUS_INVALID', type: RangeError - })); + }); response.on('finish', common.mustCall(function() { server.close(); diff --git a/test/parallel/test-http2-compat-socket-set.js b/test/parallel/test-http2-compat-socket-set.js index 87b7a2b4448c86..ff53d998f4d207 100644 --- a/test/parallel/test-http2-compat-socket-set.js +++ b/test/parallel/test-http2-compat-socket-set.js @@ -6,7 +6,7 @@ if (!common.hasCrypto) const assert = require('assert'); const h2 = require('http2'); -// Tests behaviour of the proxied socket in Http2ServerRequest +// Tests behavior of the proxied socket in Http2ServerRequest // & Http2ServerResponse - specifically property setters const errMsg = { diff --git a/test/parallel/test-http2-compat-socket.js b/test/parallel/test-http2-compat-socket.js index 5d97872dfb6a14..d30b2f2a11613b 100644 --- a/test/parallel/test-http2-compat-socket.js +++ b/test/parallel/test-http2-compat-socket.js @@ -7,9 +7,9 @@ const assert = require('assert'); const h2 = require('http2'); const net = require('net'); -// Tests behaviour of the proxied socket in Http2ServerRequest +// Tests behavior of the proxied socket in Http2ServerRequest // & Http2ServerResponse - this proxy socket should mimic the -// behaviour of http1 but against the http2 api & model +// behavior of http1 but against the http2 api & model const errMsg = { code: 'ERR_HTTP2_NO_SOCKET_MANIPULATION', diff --git a/test/parallel/test-http2-connect-method.js b/test/parallel/test-http2-connect-method.js index 78c9a345293c12..4d443d5c217421 100644 --- a/test/parallel/test-http2-connect-method.js +++ b/test/parallel/test-http2-connect-method.js @@ -55,36 +55,36 @@ server.listen(0, common.mustCall(() => { const client = http2.connect(`http://localhost:${proxy.address().port}`); // confirm that :authority is required and :scheme & :path are forbidden - assert.throws( + common.expectsError( () => client.request({ [HTTP2_HEADER_METHOD]: 'CONNECT' }), - common.expectsError({ + { code: 'ERR_HTTP2_CONNECT_AUTHORITY', message: ':authority header is required for CONNECT requests' - }) + } ); - assert.throws( + common.expectsError( () => client.request({ [HTTP2_HEADER_METHOD]: 'CONNECT', [HTTP2_HEADER_AUTHORITY]: `localhost:${port}`, [HTTP2_HEADER_SCHEME]: 'http' }), - common.expectsError({ + { code: 'ERR_HTTP2_CONNECT_SCHEME', message: 'The :scheme header is forbidden for CONNECT requests' - }) + } ); - assert.throws( + common.expectsError( () => client.request({ [HTTP2_HEADER_METHOD]: 'CONNECT', [HTTP2_HEADER_AUTHORITY]: `localhost:${port}`, [HTTP2_HEADER_PATH]: '/' }), - common.expectsError({ + { code: 'ERR_HTTP2_CONNECT_PATH', message: 'The :path header is forbidden for CONNECT requests' - }) + } ); // valid CONNECT request diff --git a/test/parallel/test-http2-create-client-secure-session.js b/test/parallel/test-http2-create-client-secure-session.js index 62a79148dcac47..811ef772d5903a 100644 --- a/test/parallel/test-http2-create-client-secure-session.js +++ b/test/parallel/test-http2-create-client-secure-session.js @@ -20,10 +20,7 @@ function loadKey(keyname) { function onStream(stream, headers) { const socket = stream.session[kSocket]; assert(headers[':authority'].startsWith(socket.servername)); - stream.respond({ - 'content-type': 'text/html', - ':status': 200 - }); + stream.respond({ 'content-type': 'application/json' }); stream.end(JSON.stringify({ servername: socket.servername, alpnProtocol: socket.alpnProtocol @@ -33,35 +30,32 @@ function onStream(stream, headers) { function verifySecureSession(key, cert, ca, opts) { const server = h2.createSecureServer({ cert, key }); server.on('stream', common.mustCall(onStream)); - server.listen(0); - server.on('listening', common.mustCall(function() { - const headers = { ':path': '/' }; - if (!opts) { - opts = {}; - } + server.listen(0, common.mustCall(() => { + opts = opts || { }; opts.secureContext = tls.createSecureContext({ ca }); - const client = h2.connect(`https://localhost:${this.address().port}`, opts, function() { - const req = client.request(headers); + const client = h2.connect(`https://localhost:${server.address().port}`, + opts); + // Verify that a 'secureConnect' listener is attached + assert.strictEqual(client.socket.listenerCount('secureConnect'), 1); + const req = client.request(); - req.on('response', common.mustCall(function(headers) { - assert.strictEqual(headers[':status'], 200, 'status code is set'); - assert.strictEqual(headers['content-type'], 'text/html', - 'content type is set'); - assert(headers['date'], 'there is a date'); - })); + req.on('response', common.mustCall((headers) => { + assert.strictEqual(headers[':status'], 200); + assert.strictEqual(headers['content-type'], 'application/json'); + assert(headers['date']); + })); - let data = ''; - req.setEncoding('utf8'); - req.on('data', (d) => data += d); - req.on('end', common.mustCall(() => { - const jsonData = JSON.parse(data); - assert.strictEqual(jsonData.servername, opts.servername || 'localhost'); - assert.strictEqual(jsonData.alpnProtocol, 'h2'); - server.close(); - client[kSocket].destroy(); - })); - req.end(); - }); + let data = ''; + req.setEncoding('utf8'); + req.on('data', (d) => data += d); + req.on('end', common.mustCall(() => { + const jsonData = JSON.parse(data); + assert.strictEqual(jsonData.servername, + opts.servername || 'localhost'); + assert.strictEqual(jsonData.alpnProtocol, 'h2'); + server.close(); + client[kSocket].destroy(); + })); })); } diff --git a/test/parallel/test-http2-getpackedsettings.js b/test/parallel/test-http2-getpackedsettings.js index 7461176c5fcde7..9ae2512b2cea06 100644 --- a/test/parallel/test-http2-getpackedsettings.js +++ b/test/parallel/test-http2-getpackedsettings.js @@ -44,25 +44,25 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); ['maxHeaderListSize', -1], ['maxHeaderListSize', 2 ** 32] ].forEach((i) => { - assert.throws(() => { + common.expectsError(() => { http2.getPackedSettings({ [i[0]]: i[1] }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', type: RangeError, message: `Invalid value for setting "${i[0]}": ${i[1]}` - })); + }); }); [ 1, null, '', Infinity, new Date(), {}, NaN, [false] ].forEach((i) => { - assert.throws(() => { + common.expectsError(() => { http2.getPackedSettings({ enablePush: i }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', type: TypeError, message: `Invalid value for setting "enablePush": ${i}` - })); + }); }); { @@ -99,23 +99,23 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); 0x00, 0x02, 0x00, 0x00, 0x00, 0x01]); [1, true, '', [], {}, NaN].forEach((i) => { - assert.throws(() => { + common.expectsError(() => { http2.getUnpackedSettings(i); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "buf" argument must be one of type Buffer, TypedArray, or DataView' - })); + }); }); - assert.throws(() => { + common.expectsError(() => { http2.getUnpackedSettings(packed.slice(5)); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH', type: RangeError, message: 'Packed settings length must be a multiple of six' - })); + }); const settings = http2.getUnpackedSettings(packed); @@ -128,7 +128,6 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); assert.strictEqual(settings.enablePush, true); } -//should throw if enablePush is not 0 or 1 { const packed = Buffer.from([ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00]); @@ -140,13 +139,8 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); const packed = Buffer.from([ 0x00, 0x02, 0x00, 0x00, 0x00, 0x64]); - assert.throws(() => { - http2.getUnpackedSettings(packed, { validate: true }); - }, common.expectsError({ - code: 'ERR_HTTP2_INVALID_SETTING_VALUE', - type: RangeError, - message: 'Invalid value for setting "enablePush": 100' - })); + const settings = http2.getUnpackedSettings(packed, { validate: true }); + assert.strictEqual(settings.enablePush, true); } //check for what happens if passing {validate: true} and no errors happen @@ -166,24 +160,24 @@ assert.doesNotThrow(() => http2.getPackedSettings({ enablePush: false })); { const packed = Buffer.from([0x00, 0x05, 0x01, 0x00, 0x00, 0x00]); - assert.throws(() => { + common.expectsError(() => { http2.getUnpackedSettings(packed, { validate: true }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', type: RangeError, message: 'Invalid value for setting "maxFrameSize": 16777216' - })); + }); } // check for maxConcurrentStreams failing the max number { const packed = Buffer.from([0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF]); - assert.throws(() => { + common.expectsError(() => { http2.getUnpackedSettings(packed, { validate: true }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', type: RangeError, message: 'Invalid value for setting "maxConcurrentStreams": 4294967295' - })); + }); } diff --git a/test/parallel/test-http2-info-headers.js b/test/parallel/test-http2-info-headers.js index 609f56e8b8566c..332c688429c37e 100644 --- a/test/parallel/test-http2-info-headers.js +++ b/test/parallel/test-http2-info-headers.js @@ -18,19 +18,19 @@ const afterRespondregex = function onStream(stream, headers, flags) { - assert.throws(() => stream.additionalHeaders({ ':status': 201 }), - common.expectsError({ - code: 'ERR_HTTP2_INVALID_INFO_STATUS', - type: RangeError, - message: /^Invalid informational status code: 201$/ - })); - - assert.throws(() => stream.additionalHeaders({ ':status': 101 }), - common.expectsError({ - code: 'ERR_HTTP2_STATUS_101', - type: Error, - message: status101regex - })); + common.expectsError(() => stream.additionalHeaders({ ':status': 201 }), + { + code: 'ERR_HTTP2_INVALID_INFO_STATUS', + type: RangeError, + message: /^Invalid informational status code: 201$/ + }); + + common.expectsError(() => stream.additionalHeaders({ ':status': 101 }), + { + code: 'ERR_HTTP2_STATUS_101', + type: Error, + message: status101regex + }); common.expectsError( () => stream.additionalHeaders({ ':method': 'POST' }), @@ -50,12 +50,12 @@ function onStream(stream, headers, flags) { ':status': 200 }); - assert.throws(() => stream.additionalHeaders({ abc: 123 }), - common.expectsError({ - code: 'ERR_HTTP2_HEADERS_AFTER_RESPOND', - type: Error, - message: afterRespondregex - })); + common.expectsError(() => stream.additionalHeaders({ abc: 123 }), + { + code: 'ERR_HTTP2_HEADERS_AFTER_RESPOND', + type: Error, + message: afterRespondregex + }); stream.end('hello world'); } diff --git a/test/parallel/test-http2-misused-pseudoheaders.js b/test/parallel/test-http2-misused-pseudoheaders.js index 2ccb676b2199e5..1f501598c1c421 100644 --- a/test/parallel/test-http2-misused-pseudoheaders.js +++ b/test/parallel/test-http2-misused-pseudoheaders.js @@ -3,7 +3,6 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); -const assert = require('assert'); const h2 = require('http2'); const server = h2.createServer(); @@ -19,10 +18,10 @@ function onStream(stream, headers, flags) { ':method', ':scheme' ].forEach((i) => { - assert.throws(() => stream.respond({ [i]: '/' }), - common.expectsError({ - code: 'ERR_HTTP2_INVALID_PSEUDOHEADER' - })); + common.expectsError(() => stream.respond({ [i]: '/' }), + { + code: 'ERR_HTTP2_INVALID_PSEUDOHEADER' + }); }); stream.respond({ diff --git a/test/parallel/test-http2-respond-file-204.js b/test/parallel/test-http2-respond-file-204.js index 8181dbb317dab2..4be2d42c779a5e 100644 --- a/test/parallel/test-http2-respond-file-204.js +++ b/test/parallel/test-http2-respond-file-204.js @@ -5,7 +5,6 @@ if (!common.hasCrypto) common.skip('missing crypto'); const fixtures = require('../common/fixtures'); const http2 = require('http2'); -const assert = require('assert'); const { HTTP2_HEADER_CONTENT_TYPE, @@ -16,16 +15,16 @@ const fname = fixtures.path('elipses.txt'); const server = http2.createServer(); server.on('stream', (stream) => { - assert.throws(() => { + common.expectsError(() => { stream.respondWithFile(fname, { [HTTP2_HEADER_STATUS]: 204, [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain' }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_PAYLOAD_FORBIDDEN', type: Error, message: 'Responses with 204 status must not have a payload' - })); + }); stream.respond({}); stream.end(); }); diff --git a/test/parallel/test-http2-server-push-disabled.js b/test/parallel/test-http2-server-push-disabled.js index c0148fe63b672e..33390f2ecae886 100644 --- a/test/parallel/test-http2-server-push-disabled.js +++ b/test/parallel/test-http2-server-push-disabled.js @@ -21,16 +21,16 @@ server.on('stream', common.mustCall((stream) => { // and pushStream() must throw. assert.strictEqual(stream.pushAllowed, false); - assert.throws(() => { + common.expectsError(() => { stream.pushStream({ ':scheme': 'http', ':path': '/foobar', ':authority': `localhost:${server.address().port}`, }, common.mustNotCall()); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_PUSH_DISABLED', type: Error - })); + }); stream.respond({ ':status': 200 }); stream.end('test'); diff --git a/test/parallel/test-http2-server-rst-before-respond.js b/test/parallel/test-http2-server-rst-before-respond.js index 47ba68bd29ed81..950beea4eb39ab 100644 --- a/test/parallel/test-http2-server-rst-before-respond.js +++ b/test/parallel/test-http2-server-rst-before-respond.js @@ -14,15 +14,15 @@ server.on('stream', common.mustCall(onStream)); function onStream(stream, headers, flags) { stream.rstStream(); - assert.throws(() => { + common.expectsError(() => { stream.additionalHeaders({ ':status': 123, abc: 123 }); - }, common.expectsError({ + }, { code: 'ERR_HTTP2_INVALID_STREAM', message: /^The stream has been destroyed$/ - })); + }); } server.listen(0); diff --git a/test/parallel/test-http2-socket-proxy.js b/test/parallel/test-http2-socket-proxy.js index 60f31837790d51..3b15c18628d218 100644 --- a/test/parallel/test-http2-socket-proxy.js +++ b/test/parallel/test-http2-socket-proxy.js @@ -7,7 +7,7 @@ const assert = require('assert'); const h2 = require('http2'); const net = require('net'); -// Tests behaviour of the proxied socket on Http2Session +// Tests behavior of the proxied socket on Http2Session const errMsg = { code: 'ERR_HTTP2_NO_SOCKET_MANIPULATION', diff --git a/test/parallel/test-http2-too-many-settings.js b/test/parallel/test-http2-too-many-settings.js index 4feda98c05d522..9b685fa8ceb16f 100644 --- a/test/parallel/test-http2-too-many-settings.js +++ b/test/parallel/test-http2-too-many-settings.js @@ -17,11 +17,11 @@ let clients = 2; function doTest(session) { for (let n = 0; n < maxPendingAck; n++) assert.doesNotThrow(() => session.settings({ enablePush: false })); - assert.throws(() => session.settings({ enablePush: false }), - common.expectsError({ - code: 'ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', - type: Error - })); + common.expectsError(() => session.settings({ enablePush: false }), + { + code: 'ERR_HTTP2_MAX_PENDING_SETTINGS_ACK', + type: Error + }); } server.on('stream', common.mustNotCall()); diff --git a/test/parallel/test-http2-util-asserts.js b/test/parallel/test-http2-util-asserts.js index ca25396a2c1d0c..1e7a0113f4a850 100644 --- a/test/parallel/test-http2-util-asserts.js +++ b/test/parallel/test-http2-util-asserts.js @@ -27,17 +27,17 @@ const { [], [{}] ].forEach((i) => { - assert.throws(() => assertIsObject(i, 'foo', 'Object'), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - message: /^The "foo" argument must be of type Object$/ - })); + common.expectsError(() => assertIsObject(i, 'foo', 'Object'), + { + code: 'ERR_INVALID_ARG_TYPE', + message: /^The "foo" argument must be of type Object$/ + }); }); assert.doesNotThrow(() => assertWithinRange('foo', 1, 0, 2)); -assert.throws(() => assertWithinRange('foo', 1, 2, 3), - common.expectsError({ - code: 'ERR_HTTP2_INVALID_SETTING_VALUE', - message: /^Invalid value for setting "foo": 1$/ - })); +common.expectsError(() => assertWithinRange('foo', 1, 2, 3), + { + code: 'ERR_HTTP2_INVALID_SETTING_VALUE', + message: /^Invalid value for setting "foo": 1$/ + }); diff --git a/test/parallel/test-http2-window-size.js b/test/parallel/test-http2-window-size.js index d6c6bf3fed2af2..381416c0d23cc6 100644 --- a/test/parallel/test-http2-window-size.js +++ b/test/parallel/test-http2-window-size.js @@ -10,6 +10,7 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); const h2 = require('http2'); +common.crashOnUnhandledRejection(); // Given a list of buffers and an initial window size, have a server write // each buffer to the HTTP2 Writable stream, and let the client verify that diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index 0986f8472de871..0cdc9568d84470 100644 --- a/test/parallel/test-https-agent-getname.js +++ b/test/parallel/test-https-agent-getname.js @@ -12,7 +12,7 @@ const agent = new https.Agent(); // empty options assert.strictEqual( agent.getName({}), - 'localhost::::::::::' + 'localhost:::::::::::' ); // pass all options arguments @@ -31,5 +31,5 @@ const options = { assert.strictEqual( agent.getName(options), - '0.0.0.0:443:192.168.1.1:ca:cert:ciphers:key:pfx:false:localhost:' + '0.0.0.0:443:192.168.1.1:ca:cert::ciphers:key:pfx:false:localhost:' ); diff --git a/test/parallel/test-https-connect-address-family.js b/test/parallel/test-https-connect-address-family.js index 28d47b3a967424..8b3584b3396551 100644 --- a/test/parallel/test-https-connect-address-family.js +++ b/test/parallel/test-https-connect-address-family.js @@ -1,4 +1,7 @@ 'use strict'; + +// Test that the family option of https.get is honored. + const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); @@ -9,21 +12,28 @@ if (!common.hasIPv6) const assert = require('assert'); const fixtures = require('../common/fixtures'); const https = require('https'); -const dns = require('dns'); -function runTest() { +{ + // Test that `https` machinery passes host name, and receives IP. + const hostAddrIPv6 = '::1'; + const HOSTNAME = 'dummy'; https.createServer({ cert: fixtures.readKey('agent1-cert.pem'), key: fixtures.readKey('agent1-key.pem'), }, common.mustCall(function(req, res) { this.close(); res.end(); - })).listen(0, '::1', common.mustCall(function() { + })).listen(0, hostAddrIPv6, common.mustCall(function() { const options = { - host: 'localhost', + host: HOSTNAME, port: this.address().port, family: 6, rejectUnauthorized: false, + lookup: common.mustCall((addr, opt, cb) => { + assert.strictEqual(addr, HOSTNAME); + assert.strictEqual(opt.family, 6); + cb(null, hostAddrIPv6, opt.family); + }) }; // Will fail with ECONNREFUSED if the address family is not honored. https.get(options, common.mustCall(function() { @@ -32,17 +42,3 @@ function runTest() { })); })); } - -dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => { - if (err) { - if (err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN') - common.skip('localhost does not resolve to ::1'); - - throw err; - } - - if (addresses.some((val) => val.address === '::1')) - runTest(); - else - common.skip('localhost does not resolve to ::1'); -}); diff --git a/test/parallel/test-https-options-boolean-check.js b/test/parallel/test-https-options-boolean-check.js index eae319988e7c6a..ed124d43fbb74f 100644 --- a/test/parallel/test-https-options-boolean-check.js +++ b/test/parallel/test-https-options-boolean-check.js @@ -101,16 +101,16 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [[keyStr, keyStr2], true, invalidCertRE], [true, [certBuff, certBuff2], invalidKeyRE] ].map((params) => { - assert.throws(() => { + common.expectsError(() => { https.createServer({ key: params[0], cert: params[1] }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: params[2] - })); + }); }); // Checks to ensure https.createServer works with the CA parameter @@ -142,15 +142,15 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] ].map((params) => { - assert.throws(() => { + common.expectsError(() => { https.createServer({ key: params[0], cert: params[1], ca: params[2] }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "ca" argument must be one of type string, Buffer, TypedArray, or DataView$/ - })); + }); }); diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js index d2a3179c0d178d..c549da1571b80c 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.js @@ -67,6 +67,6 @@ const test = common.mustCall(function(res) { res.on('data', function(chunk) { bytes += chunk.length; this.pause(); - setTimeout(this.resume.bind(this), 1); + setTimeout(() => { this.resume(); }, 1); }); }); diff --git a/test/parallel/test-inspector-no-crash-ws-after-bindings.js b/test/parallel/test-inspector-no-crash-ws-after-bindings.js new file mode 100644 index 00000000000000..286373068e8e9b --- /dev/null +++ b/test/parallel/test-inspector-no-crash-ws-after-bindings.js @@ -0,0 +1,30 @@ +'use strict'; +const common = require('../common'); +common.skipIfInspectorDisabled(); +common.crashOnUnhandledRejection(); +const { NodeInstance } = require('../common/inspector-helper.js'); +const assert = require('assert'); + +const expected = 'Can connect now!'; + +const script = ` + 'use strict'; + const { Session } = require('inspector'); + + const s = new Session(); + s.connect(); + console.error('${expected}'); + process.stdin.on('data', () => process.exit(0)); +`; + +async function runTests() { + const instance = new NodeInstance(['--inspect=0', '--expose-internals'], + script); + while (await instance.nextStderrString() !== expected); + assert.strictEqual(400, await instance.expectConnectionDeclined()); + instance.write('Stop!\n'); + assert.deepStrictEqual({ exitCode: 0, signal: null }, + await instance.expectShutdown()); +} + +runTests(); diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index 80edc25df1902c..78582a53504748 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -52,139 +52,139 @@ errors.E('TEST_ERROR_2', (a, b) => `${a} ${b}`); assert.strictEqual(err.code, 'TEST_ERROR_1'); } -assert.throws( +common.expectsError( () => new errors.Error('TEST_FOO_KEY'), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('TEST_FOO_KEY') - })); + }); // Calling it twice yields same result (using the key does not create it) -assert.throws( +common.expectsError( () => new errors.Error('TEST_FOO_KEY'), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('TEST_FOO_KEY') - })); -assert.throws( + }); +common.expectsError( () => new errors.Error(1), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey(1) - })); -assert.throws( + }); +common.expectsError( () => new errors.Error({}), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('\\[object Object\\]') - })); -assert.throws( + }); +common.expectsError( () => new errors.Error([]), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('') - })); -assert.throws( + }); +common.expectsError( () => new errors.Error(true), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('true') - })); -assert.throws( + }); +common.expectsError( () => new errors.TypeError(1), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey(1) - })); -assert.throws( + }); +common.expectsError( () => new errors.TypeError({}), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('\\[object Object\\]') - })); -assert.throws( + }); +common.expectsError( () => new errors.TypeError([]), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('') - })); -assert.throws( + }); +common.expectsError( () => new errors.TypeError(true), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('true') - })); -assert.throws( + }); +common.expectsError( () => new errors.RangeError(1), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey(1) - })); -assert.throws( + }); +common.expectsError( () => new errors.RangeError({}), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('\\[object Object\\]') - })); -assert.throws( + }); +common.expectsError( () => new errors.RangeError([]), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('') - })); -assert.throws( + }); +common.expectsError( () => new errors.RangeError(true), - common.expectsError({ + { code: 'ERR_ASSERTION', message: invalidKey('true') - })); + }); // Tests for common.expectsError assert.doesNotThrow(() => { - assert.throws(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1' })); + }, { code: 'TEST_ERROR_1' }); }); assert.doesNotThrow(() => { - assert.throws(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', - type: TypeError, - message: /^Error for testing/ })); + }, { code: 'TEST_ERROR_1', + type: TypeError, + message: /^Error for testing/ }); }); assert.doesNotThrow(() => { - assert.throws(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', type: TypeError })); + }, { code: 'TEST_ERROR_1', type: TypeError }); }); assert.doesNotThrow(() => { - assert.throws(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', type: Error })); + }, { code: 'TEST_ERROR_1', type: Error }); }); -assert.throws(() => { - assert.throws(() => { +common.expectsError(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', type: RangeError })); -}, common.expectsError({ + }, { code: 'TEST_ERROR_1', type: RangeError }); +}, { code: 'ERR_ASSERTION', message: /^.+ is not instance of \S/ -})); +}); -assert.throws(() => { - assert.throws(() => { +common.expectsError(() => { + common.expectsError(() => { throw new errors.TypeError('TEST_ERROR_1', 'a'); - }, common.expectsError({ code: 'TEST_ERROR_1', - type: TypeError, - message: /^Error for testing 2/ })); -}, common.expectsError({ + }, { code: 'TEST_ERROR_1', + type: TypeError, + message: /^Error for testing 2/ }); +}, { code: 'ERR_ASSERTION', message: /.+ does not match \S/ -})); +}); // // Test ERR_INVALID_ARG_TYPE assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b']), @@ -229,12 +229,12 @@ assert.strictEqual(errors.message('ERR_INVALID_URL_SCHEME', [['http', 'ftp']]), 'The URL must be one of scheme http or ftp'); assert.strictEqual(errors.message('ERR_INVALID_URL_SCHEME', [['a', 'b', 'c']]), 'The URL must be one of scheme a, b, or c'); -assert.throws( +common.expectsError( () => errors.message('ERR_INVALID_URL_SCHEME', [[]]), - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^At least one expected value needs to be specified$/ - })); + }); // Test ERR_MISSING_ARGS assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['name']), @@ -243,12 +243,12 @@ assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['name', 'value']), 'The "name" and "value" arguments must be specified'); assert.strictEqual(errors.message('ERR_MISSING_ARGS', ['a', 'b', 'c']), 'The "a", "b", and "c" arguments must be specified'); -assert.throws( +common.expectsError( () => errors.message('ERR_MISSING_ARGS'), - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^At least one arg needs to be specified$/ - })); + }); // Test ERR_SOCKET_BAD_PORT assert.strictEqual( diff --git a/test/parallel/test-intl-v8BreakIterator.js b/test/parallel/test-intl-v8BreakIterator.js index 4f501e6ef6db28..257d6b2a769083 100644 --- a/test/parallel/test-intl-v8BreakIterator.js +++ b/test/parallel/test-intl-v8BreakIterator.js @@ -3,7 +3,7 @@ const common = require('../common'); const assert = require('assert'); const vm = require('vm'); -if (typeof Intl === 'undefined') +if (!common.hasIntl) common.skip('missing Intl'); assert(!('v8BreakIterator' in Intl)); diff --git a/test/parallel/test-microtask-queue-integration-domain.js b/test/parallel/test-microtask-queue-integration-domain.js index 98da703ee51429..8a4a06f9ffbe5e 100644 --- a/test/parallel/test-microtask-queue-integration-domain.js +++ b/test/parallel/test-microtask-queue-integration-domain.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); // Requiring the domain module here changes the function that is used by node to @@ -30,6 +30,8 @@ const assert = require('assert'); // removed. require('domain'); +common.crashOnUnhandledRejection(); + const implementations = [ function(fn) { Promise.resolve().then(fn); diff --git a/test/parallel/test-microtask-queue-integration.js b/test/parallel/test-microtask-queue-integration.js index 57c384f8ba8177..a7241d99ee9395 100644 --- a/test/parallel/test-microtask-queue-integration.js +++ b/test/parallel/test-microtask-queue-integration.js @@ -20,9 +20,11 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); +common.crashOnUnhandledRejection(); + const implementations = [ function(fn) { Promise.resolve().then(fn); diff --git a/test/parallel/test-microtask-queue-run-domain.js b/test/parallel/test-microtask-queue-run-domain.js index 39baf930232411..a895504fc2972a 100644 --- a/test/parallel/test-microtask-queue-run-domain.js +++ b/test/parallel/test-microtask-queue-run-domain.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); // Requiring the domain module here changes the function that is used by node to @@ -30,6 +30,8 @@ const assert = require('assert'); // removed. require('domain'); +common.crashOnUnhandledRejection(); + function enqueueMicrotask(fn) { Promise.resolve().then(fn); } diff --git a/test/parallel/test-microtask-queue-run-immediate-domain.js b/test/parallel/test-microtask-queue-run-immediate-domain.js index 60b17bc38c2670..807affd0589861 100644 --- a/test/parallel/test-microtask-queue-run-immediate-domain.js +++ b/test/parallel/test-microtask-queue-run-immediate-domain.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); // Requiring the domain module here changes the function that is used by node to @@ -30,6 +30,8 @@ const assert = require('assert'); // removed. require('domain'); +common.crashOnUnhandledRejection(); + function enqueueMicrotask(fn) { Promise.resolve().then(fn); } diff --git a/test/parallel/test-microtask-queue-run-immediate.js b/test/parallel/test-microtask-queue-run-immediate.js index 4d998cf0b8a59c..1e26f4beebfbe4 100644 --- a/test/parallel/test-microtask-queue-run-immediate.js +++ b/test/parallel/test-microtask-queue-run-immediate.js @@ -20,9 +20,11 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); +common.crashOnUnhandledRejection(); + function enqueueMicrotask(fn) { Promise.resolve().then(fn); } diff --git a/test/parallel/test-microtask-queue-run.js b/test/parallel/test-microtask-queue-run.js index 85eb770da1e0ff..ba9cf6731ef75b 100644 --- a/test/parallel/test-microtask-queue-run.js +++ b/test/parallel/test-microtask-queue-run.js @@ -20,9 +20,11 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); +common.crashOnUnhandledRejection(); + function enqueueMicrotask(fn) { Promise.resolve().then(fn); } diff --git a/test/parallel/test-module-builtin.js b/test/parallel/test-module-builtin.js new file mode 100644 index 00000000000000..3897d71ecf4405 --- /dev/null +++ b/test/parallel/test-module-builtin.js @@ -0,0 +1,14 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { builtinModules } = require('module'); + +// Includes modules in lib/ (even deprecated ones) +assert(builtinModules.includes('http')); +assert(builtinModules.includes('sys')); + +// Does not include internal modules +assert.deepStrictEqual( + builtinModules.filter((mod) => mod.startsWith('internal/')), + [] +); diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 68f45d774e5ce0..f1c457af2b2c9e 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -59,16 +59,16 @@ assert.throws( } ); -assert.throws( +common.expectsError( require, - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^missing path$/ - })); + }); -assert.throws( +common.expectsError( () => { require({}); }, - common.expectsError({ + { code: 'ERR_ASSERTION', message: /^path must be a string$/ - })); + }); diff --git a/test/parallel/test-net-better-error-messages-path.js b/test/parallel/test-net-better-error-messages-path.js index bb2256637a0d30..0d16894ff83f6c 100644 --- a/test/parallel/test-net-better-error-messages-path.js +++ b/test/parallel/test-net-better-error-messages-path.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); const net = require('net'); -const assert = require('assert'); { const fp = '/tmp/fadagagsdfgsdf'; @@ -15,8 +14,8 @@ const assert = require('assert'); } { - assert.throws( + common.expectsError( () => net.createConnection({ path: {} }), - common.expectsError({ code: 'ERR_INVALID_ARG_TYPE' }) + { code: 'ERR_INVALID_ARG_TYPE' } ); } diff --git a/test/parallel/test-net-better-error-messages-port-hostname.js b/test/parallel/test-net-better-error-messages-port-hostname.js index 818ea4bfff41f6..1a8aa770b44a22 100644 --- a/test/parallel/test-net-better-error-messages-port-hostname.js +++ b/test/parallel/test-net-better-error-messages-port-hostname.js @@ -1,21 +1,30 @@ 'use strict'; + +// This tests that the error thrown from net.createConnection +// comes with host and port properties. +// See https://github.com/nodejs/node-v0.x-archive/issues/7005 + const common = require('../common'); const net = require('net'); const assert = require('assert'); +const { addresses } = require('../common/internet'); +const { + errorLookupMock, + mockedErrorCode +} = require('../common/dns'); + // Using port 0 as hostname used is already invalid. -const c = net.createConnection(0, 'this.hostname.is.invalid'); +const c = net.createConnection({ + port: 0, + host: addresses.INVALID_HOST, + lookup: common.mustCall(errorLookupMock()) +}); c.on('connect', common.mustNotCall()); c.on('error', common.mustCall(function(e) { - // If Name Service Switch is available on the operating system then it - // might be configured differently (/etc/nsswitch.conf). - // If the system is configured with no dns the error code will be EAI_AGAIN, - // but if there are more services after the dns entry, for example some - // linux distributions ship a myhostname service by default which would - // still produce the ENOTFOUND error. - assert.ok(e.code === 'ENOTFOUND' || e.code === 'EAI_AGAIN'); + assert.strictEqual(e.code, mockedErrorCode); assert.strictEqual(e.port, 0); - assert.strictEqual(e.hostname, 'this.hostname.is.invalid'); + assert.strictEqual(e.hostname, addresses.INVALID_HOST); })); diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js index e2e5e1c6715b9a..27d988ab5af45f 100644 --- a/test/parallel/test-net-connect-immediate-finish.js +++ b/test/parallel/test-net-connect-immediate-finish.js @@ -20,28 +20,35 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; + +// This tests that if the socket is still in the 'connecting' state +// when the user calls socket.end() ('finish'), the socket would emit +// 'connect' and defer the handling until the 'connect' event is handled. + const common = require('../common'); const assert = require('assert'); const net = require('net'); +const { addresses } = require('../common/internet'); +const { + errorLookupMock, + mockedErrorCode, + mockedSysCall +} = require('../common/dns'); + const client = net.connect({ - host: 'this.hostname.is.invalid', - port: common.PORT -}); + host: addresses.INVALID_HOST, + port: 80, // port number doesn't matter because host name is invalid + lookup: common.mustCall(errorLookupMock()) +}, common.mustNotCall()); client.once('error', common.mustCall((err) => { assert(err); assert.strictEqual(err.code, err.errno); - // If Name Service Switch is available on the operating system then it - // might be configured differently (/etc/nsswitch.conf). - // If the system is configured with no dns the error code will be EAI_AGAIN, - // but if there are more services after the dns entry, for example some - // linux distributions ship a myhostname service by default which would - // still produce the ENOTFOUND error. - assert.ok(err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN'); + assert.strictEqual(err.code, mockedErrorCode); assert.strictEqual(err.host, err.hostname); - assert.strictEqual(err.host, 'this.hostname.is.invalid'); - assert.strictEqual(err.syscall, 'getaddrinfo'); + assert.strictEqual(err.host, addresses.INVALID_HOST); + assert.strictEqual(err.syscall, mockedSysCall); })); client.end(); diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index e0872cf7c5df3f..50c2a08efeb194 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -6,7 +6,7 @@ if (common.isWindows) const assert = require('assert'); const net = require('net'); const path = require('path'); -const Pipe = process.binding('pipe_wrap').Pipe; +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); common.refreshTmpDir(); @@ -71,7 +71,7 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); }) .listen({ path: serverPath }, common.mustCall(function serverOnListen() { const getSocketOpt = (index) => { - const handle = new Pipe(); + const handle = new Pipe(PipeConstants.SOCKET); const err = handle.bind(`${prefix}-client-${socketCounter++}`); assert(err >= 0, String(err)); assert.notStrictEqual(handle.fd, -1); @@ -83,14 +83,13 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); path: serverPath }); const getConnectCb = (index) => common.mustCall(function clientOnConnect() { - const client = this; // Test if it's wrapping an existing fd assert(handleMap.has(index)); const oldHandle = handleMap.get(index); assert.strictEqual(oldHandle.fd, this._handle.fd); - client.write(String(oldHandle.fd)); + this.write(String(oldHandle.fd)); console.error(`[Pipe]Sending data through fd ${oldHandle.fd}`); - client.on('error', function(err) { + this.on('error', function(err) { console.error(err); assert.fail(null, null, `[Pipe Client]${err}`); }); diff --git a/test/parallel/test-net-connect-options-ipv6.js b/test/parallel/test-net-connect-options-ipv6.js index aba07d9fcc8094..13381074ba46b7 100644 --- a/test/parallel/test-net-connect-options-ipv6.js +++ b/test/parallel/test-net-connect-options-ipv6.js @@ -19,6 +19,8 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +// Test that the family option of net.connect is honored. + 'use strict'; const common = require('../common'); if (!common.hasIPv6) @@ -27,63 +29,39 @@ if (!common.hasIPv6) const assert = require('assert'); const net = require('net'); -const hosts = common.localIPv6Hosts; -let hostIdx = 0; -let host = hosts[hostIdx]; -let localhostTries = 10; +const hostAddrIPv6 = '::1'; +const HOSTNAME = 'dummy'; -const server = net.createServer({ allowHalfOpen: true }, function(socket) { +const server = net.createServer({ allowHalfOpen: true }, (socket) => { socket.resume(); socket.on('end', common.mustCall()); socket.end(); }); -server.listen(0, '::1', tryConnect); - function tryConnect() { - const client = net.connect({ - host: host, + const connectOpt = { + host: HOSTNAME, port: server.address().port, family: 6, - allowHalfOpen: true - }, function() { - console.error('client connect cb'); + allowHalfOpen: true, + lookup: common.mustCall((addr, opt, cb) => { + assert.strictEqual(addr, HOSTNAME); + assert.strictEqual(opt.family, 6); + cb(null, hostAddrIPv6, opt.family); + }) + }; + // No `mustCall`, since test could skip, and it's the only path to `close`. + const client = net.connect(connectOpt, () => { client.resume(); - client.on('end', common.mustCall(function() { + client.on('end', () => { + // Wait for next uv tick and make sure the socket stream is writable. setTimeout(function() { assert(client.writable); client.end(); }, 10); - })); - client.on('close', function() { - server.close(); }); - }).on('error', function(err) { - // ENOTFOUND means we don't have the requested address. In this - // case we try the next one in the list and if we run out of - // candidates we assume IPv6 is not supported on the - // machine and skip the test. - // EAI_AGAIN means we tried to remotely resolve the address and - // timed out or hit some intermittent connectivity issue with the - // dns server. Although we are looking for local loopback addresses - // we may go remote since the list we search includes addresses that - // cover more than is available on any one distribution. The - // net is that if we get an EAI_AGAIN we were looking for an - // address which does not exist in this distribution so the error - // is not significant and we should just move on and try the - // next address in the list. - if ((err.syscall === 'getaddrinfo') && ((err.code === 'ENOTFOUND') || - (err.code === 'EAI_AGAIN'))) { - if (host !== 'localhost' || --localhostTries === 0) - host = hosts[++hostIdx]; - if (host) - tryConnect(); - else { - server.close(); - common.skip('no IPv6 localhost support'); - } - return; - } - throw err; + client.on('close', () => server.close()); }); } + +server.listen(0, hostAddrIPv6, tryConnect); diff --git a/test/parallel/test-net-connect-options-path.js b/test/parallel/test-net-connect-options-path.js index 07c5446fc6c0ab..3868b85a78a6d2 100644 --- a/test/parallel/test-net-connect-options-path.js +++ b/test/parallel/test-net-connect-options-path.js @@ -20,9 +20,8 @@ const CLIENT_VARIANTS = 12; }, CLIENT_VARIANTS)) .listen(serverPath, common.mustCall(function() { const getConnectCb = () => common.mustCall(function() { - const client = this; - client.end(); - client.on('close', common.mustCall(function() { + this.end(); + this.on('close', common.mustCall(function() { counter++; if (counter === CLIENT_VARIANTS) { server.close(); diff --git a/test/parallel/test-net-connect-options-port.js b/test/parallel/test-net-connect-options-port.js index 975022be8aa88c..37dc1d58b4519f 100644 --- a/test/parallel/test-net-connect-options-port.js +++ b/test/parallel/test-net-connect-options-port.js @@ -63,11 +63,11 @@ const net = require('net'); const hintOptBlocks = doConnect([{ hints: hints }], () => common.mustNotCall()); for (const block of hintOptBlocks) { - assert.throws(block, common.expectsError({ + common.expectsError(block, { code: 'ERR_INVALID_OPT_VALUE', type: TypeError, message: /The value "\d+" is invalid for option "hints"/ - })); + }); } } diff --git a/test/parallel/test-net-options-lookup.js b/test/parallel/test-net-options-lookup.js index 337a071a19b80b..0551a241147e84 100644 --- a/test/parallel/test-net-options-lookup.js +++ b/test/parallel/test-net-options-lookup.js @@ -13,12 +13,12 @@ function connectThrows(input) { lookup: input }; - assert.throws(() => { + common.expectsError(() => { net.connect(opts); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError - })); + }); } connectDoesNotThrow(() => {}); diff --git a/test/parallel/test-net-server-listen-handle.js b/test/parallel/test-net-server-listen-handle.js index db8e639f94885f..de1f1ca375d98e 100644 --- a/test/parallel/test-net-server-listen-handle.js +++ b/test/parallel/test-net-server-listen-handle.js @@ -5,8 +5,8 @@ const assert = require('assert'); const net = require('net'); const fs = require('fs'); const uv = process.binding('uv'); -const TCP = process.binding('tcp_wrap').TCP; -const Pipe = process.binding('pipe_wrap').Pipe; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); common.refreshTmpDir(); @@ -36,12 +36,12 @@ function randomPipePath() { function randomHandle(type) { let handle, errno, handleName; if (type === 'tcp') { - handle = new TCP(); + handle = new TCP(TCPConstants.SOCKET); errno = handle.bind('0.0.0.0', 0); handleName = 'arbitrary tcp port'; } else { const path = randomPipePath(); - handle = new Pipe(); + handle = new Pipe(PipeConstants.SOCKET); errno = handle.bind(path); handleName = `pipe ${path}`; } diff --git a/test/parallel/test-net-server-listen-options.js b/test/parallel/test-net-server-listen-options.js index bc28b57ac12854..f969fa9d43d2da 100644 --- a/test/parallel/test-net-server-listen-options.js +++ b/test/parallel/test-net-server-listen-options.js @@ -57,12 +57,12 @@ const listenOnPort = [ const block = () => { net.createServer().listen(options, common.mustNotCall()); }; - assert.throws(block, - common.expectsError({ - code: 'ERR_INVALID_OPT_VALUE', - type: Error, - message: /^The value "{.*}" is invalid for option "options"$/ - })); + common.expectsError(block, + { + code: 'ERR_INVALID_OPT_VALUE', + type: Error, + message: /^The value "{.*}" is invalid for option "options"$/ + }); } shouldFailToListen(false, { port: false }); diff --git a/test/parallel/test-net-server-max-connections-close-makes-more-available.js b/test/parallel/test-net-server-max-connections-close-makes-more-available.js index 12f1f81ffd08d3..eb045c704c637c 100644 --- a/test/parallel/test-net-server-max-connections-close-makes-more-available.js +++ b/test/parallel/test-net-server-max-connections-close-makes-more-available.js @@ -1,8 +1,9 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const net = require('net'); +common.crashOnUnhandledRejection(); // Sets the server's maxConnections property to 1. // Open 2 connections (connection 0 and connection 1). diff --git a/test/parallel/test-net-server-options.js b/test/parallel/test-net-server-options.js index 6b120821b0d3ac..2275d9f859b409 100644 --- a/test/parallel/test-net-server-options.js +++ b/test/parallel/test-net-server-options.js @@ -1,16 +1,15 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const net = require('net'); -assert.throws(function() { net.createServer('path'); }, - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - })); +common.expectsError(function() { net.createServer('path'); }, + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + }); -assert.throws(function() { net.createServer(0); }, - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - })); +common.expectsError(function() { net.createServer(0); }, + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + }); diff --git a/test/parallel/test-net-socket-write-error.js b/test/parallel/test-net-socket-write-error.js index 0a2dd967df6a2a..800d6020da4cbe 100644 --- a/test/parallel/test-net-socket-write-error.js +++ b/test/parallel/test-net-socket-write-error.js @@ -1,18 +1,17 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const net = require('net'); const server = net.createServer().listen(0, connectToServer); function connectToServer() { const client = net.createConnection(this.address().port, () => { - assert.throws(() => client.write(1337), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - })); + common.expectsError(() => client.write(1337), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + }); client.end(); }) diff --git a/test/parallel/test-net-write-fully-async-buffer.js b/test/parallel/test-net-write-fully-async-buffer.js index 04fd1231fdc322..207ae24f6a32d0 100644 --- a/test/parallel/test-net-write-fully-async-buffer.js +++ b/test/parallel/test-net-write-fully-async-buffer.js @@ -3,7 +3,7 @@ // Note: This is a variant of test-net-write-fully-async-hex-string.js. // This always worked, but it seemed appropriate to add a test that checks the -// behaviour for Buffers, too. +// behavior for Buffers, too. const common = require('../common'); const net = require('net'); diff --git a/test/parallel/test-next-tick-errors.js b/test/parallel/test-next-tick-errors.js index 989d02b4d9f3e4..acb7c497278429 100644 --- a/test/parallel/test-next-tick-errors.js +++ b/test/parallel/test-next-tick-errors.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const order = []; @@ -42,11 +42,15 @@ process.nextTick(function() { }); function testNextTickWith(val) { - assert.throws( + common.expectsError( function() { process.nextTick(val); }, - TypeError + { + code: 'ERR_INVALID_CALLBACK', + name: 'TypeError [ERR_INVALID_CALLBACK]', + type: TypeError + } ); } diff --git a/test/parallel/test-no-enter-tickcallback.js b/test/parallel/test-no-enter-tickcallback.js deleted file mode 100644 index aab22c5f3edc72..00000000000000 --- a/test/parallel/test-no-enter-tickcallback.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -let allsGood = false; -let cntr = 0; - -process.on('exit', () => { - assert.ok(cntr > 0, '_tickDomainCallback was never called'); -}); - -/** - * This test relies upon the following internals to work as specified: - * - require('domain') causes node::Environment::set_tick_callback_function() - * to use process._tickDomainCallback() to process the nextTickQueue; - * replacing process._tickCallback(). - * - setImmediate() uses node::MakeCallback() instead of - * node::AsyncWrap::MakeCallback(). Otherwise the test will always pass. - * Have not found a way to verify that node::MakeCallback() is used. - */ -process._tickDomainCallback = function _tickDomainCallback() { - assert.ok(allsGood, '_tickDomainCallback should not have been called'); - cntr++; -}; - -setImmediate(common.mustCall(() => { - require('domain'); - setImmediate(common.mustCall(() => setImmediate(common.mustCall(() => { - allsGood = true; - process.nextTick(() => {}); - })))); -})); diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index 34f48d50ccdb2b..d826eb09ed4756 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -57,7 +57,5 @@ function handleExit(error, stdout, stderr) { assert.strictEqual(code, 0, `npm install got error code ${code}`); assert.strictEqual(signalCode, null, `unexpected signal: ${signalCode}`); - assert.doesNotThrow(function() { - fs.accessSync(`${installDir}/node_modules/package-name`); - }); + assert(fs.existsSync(`${installDir}/node_modules/package-name`)); } diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index b35faeb7cd7bbe..f8e383e497a154 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -28,7 +28,7 @@ const { inspect } = require('util'); const is = { number: (value, key) => { - assert(!isNaN(value), `${key} should not be NaN`); + assert(!Number.isNaN(value), `${key} should not be NaN`); assert.strictEqual(typeof value, 'number'); }, string: (value) => { assert.strictEqual(typeof value, 'string'); }, diff --git a/test/parallel/test-path-parse-format.js b/test/parallel/test-path-parse-format.js index 83ae328c1ac343..3586ebece1af16 100644 --- a/test/parallel/test-path-parse-format.js +++ b/test/parallel/test-path-parse-format.js @@ -225,13 +225,13 @@ function checkFormat(path, testCases) { } [null, undefined, 1, true, false, 'string'].forEach((pathObject) => { - assert.throws(() => { + common.expectsError(() => { path.format(pathObject); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "pathObject" argument must be of type Object. ' + `Received type ${typeName(pathObject)}` - })); + }); }); } diff --git a/test/parallel/test-path-zero-length-strings.js b/test/parallel/test-path-zero-length-strings.js index ec9585fafaa169..c1b74c515fccdc 100644 --- a/test/parallel/test-path-zero-length-strings.js +++ b/test/parallel/test-path-zero-length-strings.js @@ -1,8 +1,8 @@ 'use strict'; -// These testcases are specific to one uncommon behaviour in path module. Few +// These testcases are specific to one uncommon behavior in path module. Few // of the functions in path module, treat '' strings as current working -// directory. This test makes sure that the behaviour is intact between commits. +// directory. This test makes sure that the behavior is intact between commits. // See: https://github.com/nodejs/node/pull/2106 require('../common'); diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index 58dfc92855cba6..a3f10eccdf1d7e 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -30,9 +30,9 @@ const typeErrorTests = [true, false, 7, null, {}, undefined, [], NaN]; function fail(fn) { const args = Array.from(arguments).slice(1); - assert.throws(() => { + common.expectsError(() => { fn.apply(null, args); - }, common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError })); + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError }); } typeErrorTests.forEach((test) => { diff --git a/test/parallel/test-performance-function.js b/test/parallel/test-performance-function.js index 8dd4d3004baed1..0deaa0e057c302 100644 --- a/test/parallel/test-performance-function.js +++ b/test/parallel/test-performance-function.js @@ -71,12 +71,12 @@ const { { [1, {}, [], null, undefined, Infinity].forEach((i) => { - assert.throws(() => performance.timerify(i), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "fn" argument must be of type Function' - })); + common.expectsError(() => performance.timerify(i), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "fn" argument must be of type Function' + }); }); } diff --git a/test/parallel/test-performance.js b/test/parallel/test-performance.js index 23ae4370c3cd7a..ba15479050f9e1 100644 --- a/test/parallel/test-performance.js +++ b/test/parallel/test-performance.js @@ -68,12 +68,13 @@ assert.strictEqual(typeof performance.timeOrigin, 'number'); }); [undefined, null, 'foo', 1].forEach((i) => { - assert.throws(() => performance.measure('test', 'A', i), - common.expectsError({ - code: 'ERR_INVALID_PERFORMANCE_MARK', - type: Error, - message: `The "${i}" performance mark has not been set` - })); + common.expectsError( + () => performance.measure('test', 'A', i), + { + code: 'ERR_INVALID_PERFORMANCE_MARK', + type: Error, + message: `The "${i}" performance mark has not been set` + }); }); performance.clearMeasures(); diff --git a/test/parallel/test-performanceobserver.js b/test/parallel/test-performanceobserver.js index 9b7dba5eb2a6f5..779e9740d7cc62 100644 --- a/test/parallel/test-performanceobserver.js +++ b/test/parallel/test-performanceobserver.js @@ -28,33 +28,34 @@ assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION], 0); { [1, null, undefined, {}, [], Infinity].forEach((i) => { - assert.throws(() => new PerformanceObserver(i), - common.expectsError({ - code: 'ERR_INVALID_CALLBACK', - type: TypeError, - message: 'Callback must be a function' - })); + common.expectsError(() => new PerformanceObserver(i), + { + code: 'ERR_INVALID_CALLBACK', + type: TypeError, + message: 'Callback must be a function' + }); }); const observer = new PerformanceObserver(common.mustNotCall()); [1, null, undefined].forEach((i) => { //observer.observe(i); - assert.throws(() => observer.observe(i), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "options" argument must be of type Object' - })); + common.expectsError( + () => observer.observe(i), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "options" argument must be of type Object' + }); }); [1, undefined, null, {}, Infinity].forEach((i) => { - assert.throws(() => observer.observe({ entryTypes: i }), - common.expectsError({ - code: 'ERR_INVALID_OPT_VALUE', - type: TypeError, - message: 'The value "[object Object]" is invalid for ' + - 'option "entryTypes"' - })); + common.expectsError(() => observer.observe({ entryTypes: i }), + { + code: 'ERR_INVALID_OPT_VALUE', + type: TypeError, + message: 'The value "[object Object]" is invalid ' + + 'for option "entryTypes"' + }); }); } diff --git a/test/parallel/test-process-assert.js b/test/parallel/test-process-assert.js index 4baccb21fd01c3..f62cf1a5ced1c7 100644 --- a/test/parallel/test-process-assert.js +++ b/test/parallel/test-process-assert.js @@ -3,19 +3,19 @@ const common = require('../common'); const assert = require('assert'); assert.strictEqual(process.assert(1, 'error'), undefined); -assert.throws(() => { +common.expectsError(() => { process.assert(undefined, 'errorMessage'); -}, common.expectsError({ +}, { code: 'ERR_ASSERTION', type: Error, message: 'errorMessage' -}) +} ); -assert.throws(() => { +common.expectsError(() => { process.assert(false); -}, common.expectsError({ +}, { code: 'ERR_ASSERTION', type: Error, message: 'assertion error' -}) +} ); diff --git a/test/parallel/test-process-dlopen-undefined-exports.js b/test/parallel/test-process-dlopen-undefined-exports.js new file mode 100644 index 00000000000000..3766a73a45ab7b --- /dev/null +++ b/test/parallel/test-process-dlopen-undefined-exports.js @@ -0,0 +1,10 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +const someBindingPath = './test/addons/hello-world/build/Release/binding.node'; + +assert.throws(() => { + process.dlopen({ exports: undefined }, someBindingPath); +}, Error); diff --git a/test/parallel/test-process-emit.js b/test/parallel/test-process-emit.js index f4f6d546f15cfa..8c2ad675cf8c62 100644 --- a/test/parallel/test-process-emit.js +++ b/test/parallel/test-process-emit.js @@ -19,4 +19,4 @@ process.emit('normal', 'normalData'); process.emit(sym, 'symbolData'); process.emit('SIGPIPE', 'signalData'); -assert.strictEqual(isNaN(process._eventsCount), false); +assert.strictEqual(Number.isNaN(process._eventsCount), false); diff --git a/test/parallel/test-process-exception-capture-errors.js b/test/parallel/test-process-exception-capture-errors.js new file mode 100644 index 00000000000000..7053497adaf873 --- /dev/null +++ b/test/parallel/test-process-exception-capture-errors.js @@ -0,0 +1,22 @@ +'use strict'; +const common = require('../common'); + +common.expectsError( + () => process.setUncaughtExceptionCaptureCallback(42), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "fn" argument must be one of type Function or null' + } +); + +process.setUncaughtExceptionCaptureCallback(common.mustNotCall()); + +common.expectsError( + () => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()), + { + code: 'ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET', + type: Error, + message: /setupUncaughtExceptionCapture.*called while a capture callback/ + } +); diff --git a/test/parallel/test-process-exception-capture-should-abort-on-uncaught-setflagsfromstring.js b/test/parallel/test-process-exception-capture-should-abort-on-uncaught-setflagsfromstring.js new file mode 100644 index 00000000000000..de14177b45a609 --- /dev/null +++ b/test/parallel/test-process-exception-capture-should-abort-on-uncaught-setflagsfromstring.js @@ -0,0 +1,13 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const v8 = require('v8'); + +assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false); + +v8.setFlagsFromString('--abort-on-uncaught-exception'); +// This should make the process not crash even though the flag was passed. +process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => { + assert.strictEqual(err.message, 'foo'); +})); +throw new Error('foo'); diff --git a/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js b/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js new file mode 100644 index 00000000000000..f9e685a86ea2e6 --- /dev/null +++ b/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js @@ -0,0 +1,12 @@ +// Flags: --abort-on-uncaught-exception +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false); + +// This should make the process not crash even though the flag was passed. +process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => { + assert.strictEqual(err.message, 'foo'); +})); +throw new Error('foo'); diff --git a/test/parallel/test-process-exception-capture.js b/test/parallel/test-process-exception-capture.js new file mode 100644 index 00000000000000..c84d3459e2318f --- /dev/null +++ b/test/parallel/test-process-exception-capture.js @@ -0,0 +1,13 @@ +// Flags: --abort-on-uncaught-exception +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false); + +// This should make the process not crash even though the flag was passed. +process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => { + assert.strictEqual(err.message, 'foo'); +})); +process.on('uncaughtException', common.mustNotCall()); +throw new Error('foo'); diff --git a/test/parallel/test-process-exit-code.js b/test/parallel/test-process-exit-code.js index 4deebb54a10784..55120f66926374 100644 --- a/test/parallel/test-process-exit-code.js +++ b/test/parallel/test-process-exit-code.js @@ -37,7 +37,7 @@ switch (process.argv[2]) { case undefined: return parent(); default: - throw new Error('wtf'); + throw new Error('invalid'); } function child1() { diff --git a/test/parallel/test-process-hrtime.js b/test/parallel/test-process-hrtime.js index 5ca9be72d14d63..1d2d2ecde9da2b 100644 --- a/test/parallel/test-process-hrtime.js +++ b/test/parallel/test-process-hrtime.js @@ -33,34 +33,34 @@ validateTuple(tuple); validateTuple(process.hrtime(tuple)); // test that only an Array may be passed to process.hrtime() -assert.throws(() => { +common.expectsError(() => { process.hrtime(1); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "time" argument must be of type Array. Received type number' -})); -assert.throws(() => { +}); +common.expectsError(() => { process.hrtime([]); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARRAY_LENGTH', type: TypeError, message: 'The array "time" (length 0) must be of length 2.' -})); -assert.throws(() => { +}); +common.expectsError(() => { process.hrtime([1]); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARRAY_LENGTH', type: TypeError, message: 'The array "time" (length 1) must be of length 2.' -})); -assert.throws(() => { +}); +common.expectsError(() => { process.hrtime([1, 2, 3]); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARRAY_LENGTH', type: TypeError, message: 'The array "time" (length 3) must be of length 2.' -})); +}); function validateTuple(tuple) { assert(Array.isArray(tuple)); diff --git a/test/parallel/test-process-kill-pid.js b/test/parallel/test-process-kill-pid.js index b020f6bc615b3c..2ff35c6e4f866f 100644 --- a/test/parallel/test-process-kill-pid.js +++ b/test/parallel/test-process-kill-pid.js @@ -92,7 +92,7 @@ function kill(tryPid, trySig, expectPid, expectSig) { } // Note that SIGHUP and SIGTERM map to 1 and 15 respectively, even on Windows -// (for Windows, libuv maps 1 and 15 to the correct behaviour). +// (for Windows, libuv maps 1 and 15 to the correct behavior). kill(0, 'SIGHUP', 0, 1); kill(0, undefined, 0, 15); diff --git a/test/parallel/test-process-next-tick.js b/test/parallel/test-process-next-tick.js index 5c078870806cc5..59de0da42d3962 100644 --- a/test/parallel/test-process-next-tick.js +++ b/test/parallel/test-process-next-tick.js @@ -21,7 +21,6 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const N = 2; function cb() { @@ -39,10 +38,10 @@ process.on('exit', function() { }); [null, 1, 'test', {}, [], Infinity, true].forEach((i) => { - assert.throws(() => process.nextTick(i), - common.expectsError({ - code: 'ERR_INVALID_CALLBACK', - type: TypeError, - message: 'Callback must be a function' - })); + common.expectsError(() => process.nextTick(i), + { + code: 'ERR_INVALID_CALLBACK', + type: TypeError, + message: 'Callback must be a function' + }); }); diff --git a/test/parallel/test-process-raw-debug.js b/test/parallel/test-process-raw-debug.js index 6f989e123e8916..1f1ec4c3803e2e 100644 --- a/test/parallel/test-process-raw-debug.js +++ b/test/parallel/test-process-raw-debug.js @@ -30,7 +30,7 @@ switch (process.argv[2]) { case undefined: return parent(); default: - throw new Error(`wtf? ${process.argv[2]}`); + throw new Error(`invalid: ${process.argv[2]}`); } function parent() { diff --git a/test/parallel/test-process-wrap.js b/test/parallel/test-process-wrap.js index 5601328eef3585..b3cca47c463c19 100644 --- a/test/parallel/test-process-wrap.js +++ b/test/parallel/test-process-wrap.js @@ -23,8 +23,8 @@ require('../common'); const assert = require('assert'); const Process = process.binding('process_wrap').Process; -const Pipe = process.binding('pipe_wrap').Pipe; -const pipe = new Pipe(); +const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap'); +const pipe = new Pipe(PipeConstants.SOCKET); const p = new Process(); let processExited = false; diff --git a/test/parallel/test-promises-unhandled-proxy-rejections.js b/test/parallel/test-promises-unhandled-proxy-rejections.js index 91808af14588d3..f632857d6373ba 100644 --- a/test/parallel/test-promises-unhandled-proxy-rejections.js +++ b/test/parallel/test-promises-unhandled-proxy-rejections.js @@ -6,8 +6,11 @@ const expectedDeprecationWarning = 'Unhandled promise rejections are ' + 'rejections that are not handled will ' + 'terminate the Node.js process with a ' + 'non-zero exit code.'; -const expectedPromiseWarning = 'Unhandled promise rejection (rejection id: ' + - '1): [object Object]'; +const expectedPromiseWarning = 'Unhandled promise rejection. ' + + 'This error originated either by throwing ' + + 'inside of an async function without a catch ' + + 'block, or by rejecting a promise which was ' + + 'not handled with .catch(). (rejection id: 1)'; function throwErr() { throw new Error('Error from proxy'); diff --git a/test/parallel/test-promises-unhandled-symbol-rejections.js b/test/parallel/test-promises-unhandled-symbol-rejections.js index a60a5f2e8aac30..3e687d4e49bf08 100644 --- a/test/parallel/test-promises-unhandled-symbol-rejections.js +++ b/test/parallel/test-promises-unhandled-symbol-rejections.js @@ -1,17 +1,24 @@ 'use strict'; const common = require('../common'); +const expectedValueWarning = 'Symbol()'; const expectedDeprecationWarning = 'Unhandled promise rejections are ' + 'deprecated. In the future, promise ' + 'rejections that are not handled will ' + 'terminate the Node.js process with a ' + 'non-zero exit code.'; -const expectedPromiseWarning = 'Unhandled promise rejection (rejection id: ' + - '1): Symbol()'; +const expectedPromiseWarning = 'Unhandled promise rejection. ' + + 'This error originated either by throwing ' + + 'inside of an async function without a catch ' + + 'block, or by rejecting a promise which was ' + + 'not handled with .catch(). (rejection id: 1)'; common.expectWarning({ DeprecationWarning: expectedDeprecationWarning, - UnhandledPromiseRejectionWarning: expectedPromiseWarning, + UnhandledPromiseRejectionWarning: [ + expectedPromiseWarning, + expectedValueWarning + ], }); // ensure this doesn't crash diff --git a/test/parallel/test-promises-warning-on-unhandled-rejection.js b/test/parallel/test-promises-warning-on-unhandled-rejection.js index 10f95162a09597..3ac7d8698beb37 100644 --- a/test/parallel/test-promises-warning-on-unhandled-rejection.js +++ b/test/parallel/test-promises-warning-on-unhandled-rejection.js @@ -12,18 +12,43 @@ let b = 0; process.on('warning', common.mustCall((warning) => { switch (b++) { case 0: - assert.strictEqual(warning.name, 'UnhandledPromiseRejectionWarning'); - assert(/Unhandled promise rejection/.test(warning.message)); + // String rejection error displayed + assert.strictEqual(warning.message, 'This was rejected'); break; case 1: - assert.strictEqual(warning.name, 'DeprecationWarning'); + // Warning about rejection not being handled (will be next tick) + assert.strictEqual(warning.name, 'UnhandledPromiseRejectionWarning'); + assert( + /Unhandled promise rejection/.test(warning.message), + 'Expected warning message to contain "Unhandled promise rejection" ' + + 'but did not. Had "' + warning.message + '" instead.' + ); break; case 2: + // One time deprecation warning, first unhandled rejection + assert.strictEqual(warning.name, 'DeprecationWarning'); + break; + case 3: + // Number rejection error displayed. Note it's been stringified + assert.strictEqual(warning.message, '42'); + break; + case 4: + // Unhandled rejection warning (won't be handled next tick) + assert.strictEqual(warning.name, 'UnhandledPromiseRejectionWarning'); + assert( + /Unhandled promise rejection/.test(warning.message), + 'Expected warning message to contain "Unhandled promise rejection" ' + + 'but did not. Had "' + warning.message + '" instead.' + ); + break; + case 5: + // Rejection handled asynchronously. assert.strictEqual(warning.name, 'PromiseRejectionHandledWarning'); assert(/Promise rejection was handled asynchronously/ .test(warning.message)); } -}, 3)); +}, 6)); -const p = Promise.reject('This was rejected'); -setImmediate(common.mustCall(() => p.catch(() => {}))); +const p = Promise.reject('This was rejected'); // Reject with a string +setImmediate(common.mustCall(() => p.catch(() => { }))); +Promise.reject(42); // Reject with a number diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index 400431fd2cb132..76049584dbe458 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -129,7 +129,7 @@ const qsWeirdObjects = [ [{ regexp: /./g }, 'regexp=', { 'regexp': '' }], // eslint-disable-next-line no-unescaped-regexp-dot [{ regexp: new RegExp('.', 'g') }, 'regexp=', { 'regexp': '' }], - [{ fn: function() {} }, 'fn=', { 'fn': '' }], + [{ fn: () => {} }, 'fn=', { 'fn': '' }], [{ fn: new Function('') }, 'fn=', { 'fn': '' }], [{ math: Math }, 'math=', { 'math': '' }], [{ e: extendedFunction }, 'e=', { 'e': '' }], @@ -192,7 +192,7 @@ function check(actual, expected, input) { `Expected keys: ${inspect(expectedKeys)}`; } assert.deepStrictEqual(actualKeys, expectedKeys, msg); - expectedKeys.forEach(function(key) { + expectedKeys.forEach((key) => { if (typeof input === 'string') { msg = `Input: ${inspect(input)}\n` + `Key: ${inspect(key)}\n` + @@ -206,21 +206,21 @@ function check(actual, expected, input) { } // test that the canonical qs is parsed properly. -qsTestCases.forEach(function(testCase) { +qsTestCases.forEach((testCase) => { check(qs.parse(testCase[0]), testCase[2], testCase[0]); }); // test that the colon test cases can do the same -qsColonTestCases.forEach(function(testCase) { +qsColonTestCases.forEach((testCase) => { check(qs.parse(testCase[0], ';', ':'), testCase[2], testCase[0]); }); // test the weird objects, that they get parsed properly -qsWeirdObjects.forEach(function(testCase) { +qsWeirdObjects.forEach((testCase) => { check(qs.parse(testCase[1]), testCase[2], testCase[1]); }); -qsNoMungeTestCases.forEach(function(testCase) { +qsNoMungeTestCases.forEach((testCase) => { assert.deepStrictEqual(testCase[0], qs.stringify(testCase[1], '&', '=')); }); @@ -258,15 +258,15 @@ qsNoMungeTestCases.forEach(function(testCase) { // now test stringifying // basic -qsTestCases.forEach(function(testCase) { +qsTestCases.forEach((testCase) => { assert.strictEqual(testCase[1], qs.stringify(testCase[2])); }); -qsColonTestCases.forEach(function(testCase) { +qsColonTestCases.forEach((testCase) => { assert.strictEqual(testCase[1], qs.stringify(testCase[2], ';', ':')); }); -qsWeirdObjects.forEach(function(testCase) { +qsWeirdObjects.forEach((testCase) => { assert.strictEqual(testCase[1], qs.stringify(testCase[0])); }); @@ -300,7 +300,7 @@ assert.strictEqual('foo=', qs.stringify({ foo: Infinity })); assert.strictEqual(f, 'a=b&q=x%3Dy%26y%3Dz'); } -assert.doesNotThrow(function() { +assert.doesNotThrow(() => { qs.parse(undefined); }); @@ -432,7 +432,7 @@ check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' }); } // Test QueryString.unescapeBuffer -qsUnescapeTestCases.forEach(function(testCase) { +qsUnescapeTestCases.forEach((testCase) => { assert.strictEqual(qs.unescape(testCase[0]), testCase[1]); assert.strictEqual(qs.unescapeBuffer(testCase[0]).toString(), testCase[1]); }); @@ -440,7 +440,7 @@ qsUnescapeTestCases.forEach(function(testCase) { // test overriding .unescape { const prevUnescape = qs.unescape; - qs.unescape = function(str) { + qs.unescape = (str) => { return str.replace(/o/g, '_'); }; check( diff --git a/test/parallel/test-readdouble.js b/test/parallel/test-readdouble.js index 01ea010609e504..76b259ba498a6d 100644 --- a/test/parallel/test-readdouble.js +++ b/test/parallel/test-readdouble.js @@ -72,12 +72,12 @@ function test(clazz) { buffer[5] = 0xff; buffer[6] = 0x0f; buffer[7] = 0x00; - assert.ok(isNaN(buffer.readDoubleBE(0))); + assert.ok(Number.isNaN(buffer.readDoubleBE(0))); assert.strictEqual(2.225073858507201e-308, buffer.readDoubleLE(0)); buffer[6] = 0xef; buffer[7] = 0x7f; - assert.ok(isNaN(buffer.readDoubleBE(0))); + assert.ok(Number.isNaN(buffer.readDoubleBE(0))); assert.strictEqual(1.7976931348623157e+308, buffer.readDoubleLE(0)); buffer[0] = 0; diff --git a/test/parallel/test-readfloat.js b/test/parallel/test-readfloat.js index 137eb732678233..bd64bbefb22fda 100644 --- a/test/parallel/test-readfloat.js +++ b/test/parallel/test-readfloat.js @@ -50,7 +50,7 @@ function test(clazz) { buffer[1] = 0xff; buffer[2] = 0x7f; buffer[3] = 0x7f; - assert.ok(isNaN(buffer.readFloatBE(0))); + assert.ok(Number.isNaN(buffer.readFloatBE(0))); assert.strictEqual(3.4028234663852886e+38, buffer.readFloatLE(0)); buffer[0] = 0xab; diff --git a/test/parallel/test-readline-csi.js b/test/parallel/test-readline-csi.js index d83948764314de..a3316a8800e4e3 100644 --- a/test/parallel/test-readline-csi.js +++ b/test/parallel/test-readline-csi.js @@ -73,13 +73,13 @@ assert.doesNotThrow(() => readline.cursorTo(writable, 'a', 'b')); assert.strictEqual(writable.data, ''); writable.data = ''; -assert.throws( +common.expectsError( () => readline.cursorTo(writable, 'a', 1), - common.expectsError({ + { type: Error, code: 'ERR_INVALID_CURSOR_POS', message: 'Cannot set cursor row without setting its column' - })); + }); assert.strictEqual(writable.data, ''); writable.data = ''; diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index fd622f8cabc564..22cb5891bb5d74 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -357,46 +357,46 @@ function isWarned(emitter) { // constructor throws if completer is not a function or undefined { const fi = new FakeInput(); - assert.throws(function() { + common.expectsError(function() { readline.createInterface({ input: fi, completer: 'string is not valid' }); - }, common.expectsError({ + }, { type: TypeError, code: 'ERR_INVALID_OPT_VALUE' - })); + }); } // constructor throws if historySize is not a positive number { const fi = new FakeInput(); - assert.throws(function() { + common.expectsError(function() { readline.createInterface({ input: fi, historySize: 'not a number' }); - }, common.expectsError({ + }, { type: RangeError, code: 'ERR_INVALID_OPT_VALUE' - })); + }); - assert.throws(function() { + common.expectsError(function() { readline.createInterface({ input: fi, historySize: -1 }); - }, common.expectsError({ + }, { type: RangeError, code: 'ERR_INVALID_OPT_VALUE' - })); + }); - assert.throws(function() { + common.expectsError(function() { readline.createInterface({ input: fi, historySize: NaN }); - }, common.expectsError({ + }, { type: RangeError, code: 'ERR_INVALID_OPT_VALUE' - })); + }); } // duplicate lines are removed from history when diff --git a/test/parallel/test-regress-GH-5727.js b/test/parallel/test-regress-GH-5727.js index 053719c6facf76..fab139ca7c305c 100644 --- a/test/parallel/test-regress-GH-5727.js +++ b/test/parallel/test-regress-GH-5727.js @@ -14,25 +14,25 @@ net.Server().listen(0, function() { }); // The first argument is a configuration object -assert.throws(() => { +common.expectsError(() => { net.Server().listen({ port: invalidPort }, common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_SOCKET_BAD_PORT', type: RangeError -})); +}); // The first argument is the port, no IP given. -assert.throws(() => { +common.expectsError(() => { net.Server().listen(invalidPort, common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_SOCKET_BAD_PORT', type: RangeError -})); +}); // The first argument is the port, the second an IP. -assert.throws(() => { +common.expectsError(() => { net.Server().listen(invalidPort, '0.0.0.0', common.mustNotCall()); -}, common.expectsError({ +}, { code: 'ERR_SOCKET_BAD_PORT', type: RangeError -})); +}); diff --git a/test/parallel/test-repl-load-multiline.js b/test/parallel/test-repl-load-multiline.js index fd58a3c21dd884..8ab878ae768ddd 100644 --- a/test/parallel/test-repl-load-multiline.js +++ b/test/parallel/test-repl-load-multiline.js @@ -4,6 +4,8 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const repl = require('repl'); +common.crashOnUnhandledRejection(); + const command = `.load ${fixtures.path('repl-load-multiline.js')}`; const terminalCode = '\u001b[1G\u001b[0J \u001b[1G'; const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g'); diff --git a/test/parallel/test-repl-reset-event.js b/test/parallel/test-repl-reset-event.js index e9772e3462cc83..83ab7fd6a3ec52 100644 --- a/test/parallel/test-repl-reset-event.js +++ b/test/parallel/test-repl-reset-event.js @@ -25,6 +25,7 @@ common.globalCheck = false; const assert = require('assert'); const repl = require('repl'); +const util = require('util'); // Create a dummy stream that does nothing const dummy = new common.ArrayStream(); @@ -38,11 +39,13 @@ function testReset(cb) { r.context.foo = 42; r.on('reset', common.mustCall(function(context) { assert(!!context, 'REPL did not emit a context with reset event'); - assert.strictEqual(context, r.context, 'REPL emitted incorrect context'); + assert.strictEqual(context, r.context, 'REPL emitted incorrect context. ' + + `context is ${util.inspect(context)}, expected ${util.inspect(r.context)}`); assert.strictEqual( context.foo, undefined, - 'REPL emitted the previous context, and is not using global as context' + 'REPL emitted the previous context and is not using global as context. ' + + `context.foo is ${context.foo}, expected undefined.` ); context.foo = 42; cb(); @@ -61,7 +64,8 @@ function testResetGlobal() { assert.strictEqual( context.foo, 42, - '"foo" property is missing from REPL using global as context' + '"foo" property is different from REPL using global as context. ' + + `context.foo is ${context.foo}, expected 42.` ); })); r.resetContext(); diff --git a/test/parallel/test-repl-syntax-error-handling.js b/test/parallel/test-repl-syntax-error-handling.js index 79dd4814c57545..67bf5f6038bf63 100644 --- a/test/parallel/test-repl-syntax-error-handling.js +++ b/test/parallel/test-repl-syntax-error-handling.js @@ -29,7 +29,7 @@ switch (process.argv[2]) { case undefined: return parent(); default: - throw new Error('wtf'); + throw new Error('invalid'); } function parent() { diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js index 8dd80464275bed..4bf6b7209d0bb4 100644 --- a/test/parallel/test-repl-tab-complete.js +++ b/test/parallel/test-repl-tab-complete.js @@ -519,8 +519,8 @@ const editor = repl.start({ editorStream.run(['.clear']); editorStream.run(['.editor']); -editor.completer('co', common.mustCall((error, data) => { - assert.deepStrictEqual(data, [['con'], 'co']); +editor.completer('Uin', common.mustCall((error, data) => { + assert.deepStrictEqual(data, [['Uint'], 'Uin']); })); editorStream.run(['.clear']); diff --git a/test/parallel/test-require-invalid-package.js b/test/parallel/test-require-invalid-package.js index 606fabd0e2f73d..669ea54e52b442 100644 --- a/test/parallel/test-require-invalid-package.js +++ b/test/parallel/test-require-invalid-package.js @@ -1,9 +1,8 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); // Should be an invalid package path. -assert.throws(() => require('package.json'), - common.expectsError({ code: 'MODULE_NOT_FOUND' }) +common.expectsError(() => require('package.json'), + { code: 'MODULE_NOT_FOUND' } ); diff --git a/test/parallel/test-require-resolve.js b/test/parallel/test-require-resolve.js index 6f2253a4e27083..4fbf697faf51b6 100644 --- a/test/parallel/test-require-resolve.js +++ b/test/parallel/test-require-resolve.js @@ -37,3 +37,4 @@ assert.strictEqual('path', require.resolve('path')); // Test configurable resolve() paths. require(fixtures.path('require-resolve.js')); +require(fixtures.path('resolve-paths', 'default', 'verify-paths.js')); diff --git a/test/parallel/test-signal-args.js b/test/parallel/test-signal-args.js new file mode 100644 index 00000000000000..d9fa6df347ddaa --- /dev/null +++ b/test/parallel/test-signal-args.js @@ -0,0 +1,24 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); + +if (common.isWindows) { + common.skip('Sending signals with process.kill is not supported on Windows'); +} + +process.once('SIGINT', common.mustCall((signal) => { + assert.strictEqual(signal, 'SIGINT'); +})); + +process.kill(process.pid, 'SIGINT'); + +process.once('SIGTERM', common.mustCall((signal) => { + assert.strictEqual(signal, 'SIGTERM'); +})); + +process.kill(process.pid, 'SIGTERM'); + +// Prevent Node.js from exiting due to empty event loop before signal handlers +// are fired +setImmediate(() => {}); diff --git a/test/parallel/test-stream-big-packet.js b/test/parallel/test-stream-big-packet.js index ae9bfeed4c2412..0dca3391961a93 100644 --- a/test/parallel/test-stream-big-packet.js +++ b/test/parallel/test-stream-big-packet.js @@ -44,7 +44,7 @@ s1.pipe(s3); s2.pipe(s3, { end: false }); // We must write a buffer larger than highWaterMark -const big = Buffer.alloc(s1._writableState.highWaterMark + 1, 'x'); +const big = Buffer.alloc(s1.writableHighWaterMark + 1, 'x'); // Since big is larger than highWaterMark, it will be buffered internally. assert(!s1.write(big)); diff --git a/test/parallel/test-stream-push-strings.js b/test/parallel/test-stream-push-strings.js index c2383f3de1de4f..d582c8add005a5 100644 --- a/test/parallel/test-stream-push-strings.js +++ b/test/parallel/test-stream-push-strings.js @@ -36,15 +36,15 @@ class MyStream extends Readable { case 0: return this.push(null); case 1: - return setTimeout(function() { + return setTimeout(() => { this.push('last chunk'); - }.bind(this), 100); + }, 100); case 2: return this.push('second to last chunk'); case 3: - return process.nextTick(function() { + return process.nextTick(() => { this.push('first chunk'); - }.bind(this)); + }); default: throw new Error('?'); } diff --git a/test/parallel/test-stream-readable-flow-recursion.js b/test/parallel/test-stream-readable-flow-recursion.js index 4dcec8901f9359..744298946c5eb1 100644 --- a/test/parallel/test-stream-readable-flow-recursion.js +++ b/test/parallel/test-stream-readable-flow-recursion.js @@ -68,7 +68,7 @@ flow(stream, 5000, function() { process.on('exit', function(code) { assert.strictEqual(reads, 2); // we pushed up the high water mark - assert.strictEqual(stream._readableState.highWaterMark, 8192); + assert.strictEqual(stream.readableHighWaterMark, 8192); // length is 0 right now, because we pulled it all out. assert.strictEqual(stream._readableState.length, 0); assert(!code); diff --git a/test/parallel/test-stream-readable-with-unimplemented-_read.js b/test/parallel/test-stream-readable-with-unimplemented-_read.js index b644bd40674367..e9619a31e2f298 100644 --- a/test/parallel/test-stream-readable-with-unimplemented-_read.js +++ b/test/parallel/test-stream-readable-with-unimplemented-_read.js @@ -1,12 +1,11 @@ 'use strict'; const common = require('../common'); const stream = require('stream'); -const assert = require('assert'); const readable = new stream.Readable(); -assert.throws(() => readable.read(), common.expectsError({ +common.expectsError(() => readable.read(), { code: 'ERR_STREAM_READ_NOT_IMPLEMENTED', type: Error, message: '_read() is not implemented' -})); +}); diff --git a/test/parallel/test-stream-transform-split-objectmode.js b/test/parallel/test-stream-transform-split-objectmode.js index 6d9603fca37909..55d613573493b9 100644 --- a/test/parallel/test-stream-transform-split-objectmode.js +++ b/test/parallel/test-stream-transform-split-objectmode.js @@ -29,8 +29,12 @@ const parser = new Transform({ readableObjectMode: true }); assert(parser._readableState.objectMode); assert(!parser._writableState.objectMode); -assert.strictEqual(parser._readableState.highWaterMark, 16); -assert.strictEqual(parser._writableState.highWaterMark, 16 * 1024); +assert.strictEqual(parser.readableHighWaterMark, 16); +assert.strictEqual(parser.writableHighWaterMark, 16 * 1024); +assert.strictEqual(parser.readableHighWaterMark, + parser._readableState.highWaterMark); +assert.strictEqual(parser.writableHighWaterMark, + parser._writableState.highWaterMark); parser._transform = function(chunk, enc, callback) { callback(null, { val: chunk[0] }); @@ -53,8 +57,12 @@ const serializer = new Transform({ writableObjectMode: true }); assert(!serializer._readableState.objectMode); assert(serializer._writableState.objectMode); -assert.strictEqual(serializer._readableState.highWaterMark, 16 * 1024); -assert.strictEqual(serializer._writableState.highWaterMark, 16); +assert.strictEqual(serializer.readableHighWaterMark, 16 * 1024); +assert.strictEqual(serializer.writableHighWaterMark, 16); +assert.strictEqual(parser.readableHighWaterMark, + parser._readableState.highWaterMark); +assert.strictEqual(parser.writableHighWaterMark, + parser._writableState.highWaterMark); serializer._transform = function(obj, _, callback) { callback(null, Buffer.from([obj.val])); diff --git a/test/parallel/test-stream-unshift-read-race.js b/test/parallel/test-stream-unshift-read-race.js index a67147506e48c3..cfa90c7f2bff1c 100644 --- a/test/parallel/test-stream-unshift-read-race.js +++ b/test/parallel/test-stream-unshift-read-race.js @@ -68,13 +68,13 @@ r._read = function(n) { }; function pushError() { - assert.throws(function() { + common.expectsError(function() { r.push(Buffer.allocUnsafe(1)); - }, common.expectsError({ + }, { code: 'ERR_STREAM_PUSH_AFTER_EOF', type: Error, message: 'stream.push() after EOF' - })); + }); } @@ -86,13 +86,13 @@ w._write = function(chunk, encoding, cb) { }; r.on('end', common.mustCall(function() { - assert.throws(function() { + common.expectsError(function() { r.unshift(Buffer.allocUnsafe(1)); - }, common.expectsError({ + }, { code: 'ERR_STREAM_UNSHIFT_AFTER_END_EVENT', type: Error, message: 'stream.unshift() after end event' - })); + }); w.end(); })); diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index 0f12476f506a93..819b088e2757f2 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -96,6 +96,13 @@ const Transform = require('_stream_transform'); assert(pt instanceof PassThrough); } +{ + // Verify transform constructor behavior + const pt = Transform(); + + assert(pt instanceof Transform); +} + { // Perform a simple transform const pt = new Transform(); @@ -211,14 +218,14 @@ const Transform = require('_stream_transform'); if (!chunk) chunk = ''; const s = chunk.toString(); - setTimeout(function() { + setTimeout(() => { this.state += s.charAt(0); if (this.state.length === 3) { pt.push(Buffer.from(this.state)); this.state = ''; } cb(); - }.bind(this), 10); + }, 10); }; pt._flush = function(cb) { diff --git a/test/parallel/test-stream2-unpipe-leak.js b/test/parallel/test-stream2-unpipe-leak.js index 27cad3d5f575c6..cc331d58217e25 100644 --- a/test/parallel/test-stream2-unpipe-leak.js +++ b/test/parallel/test-stream2-unpipe-leak.js @@ -68,6 +68,6 @@ console.error(src._readableState); process.on('exit', function() { src._readableState.buffer.length = 0; console.error(src._readableState); - assert(src._readableState.length >= src._readableState.highWaterMark); + assert(src._readableState.length >= src.readableHighWaterMark); console.log('ok'); }); diff --git a/test/parallel/test-stream3-cork-end.js b/test/parallel/test-stream3-cork-end.js index 85781cdf7187f2..fb109e6bb8c942 100644 --- a/test/parallel/test-stream3-cork-end.js +++ b/test/parallel/test-stream3-cork-end.js @@ -4,7 +4,7 @@ const assert = require('assert'); const stream = require('stream'); const Writable = stream.Writable; -// Test the buffering behaviour of Writable streams. +// Test the buffering behavior of Writable streams. // // The call to cork() triggers storing chunks which are flushed // on calling end() and the stream subsequently ended. diff --git a/test/parallel/test-stream3-cork-uncork.js b/test/parallel/test-stream3-cork-uncork.js index 2e8e86be1ef058..aa9df481cd720e 100644 --- a/test/parallel/test-stream3-cork-uncork.js +++ b/test/parallel/test-stream3-cork-uncork.js @@ -4,7 +4,7 @@ const assert = require('assert'); const stream = require('stream'); const Writable = stream.Writable; -// Test the buffering behaviour of Writable streams. +// Test the buffering behavior of Writable streams. // // The call to cork() triggers storing chunks which are flushed // on calling uncork() in the same tick. diff --git a/test/parallel/test-tcp-wrap-connect.js b/test/parallel/test-tcp-wrap-connect.js index 77f9814db2ebe5..c2746bca64d198 100644 --- a/test/parallel/test-tcp-wrap-connect.js +++ b/test/parallel/test-tcp-wrap-connect.js @@ -1,12 +1,12 @@ 'use strict'; require('../common'); const assert = require('assert'); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const ShutdownWrap = process.binding('stream_wrap').ShutdownWrap; function makeConnection() { - const client = new TCP(); + const client = new TCP(TCPConstants.SOCKET); const req = new TCPConnectWrap(); const err = client.connect(req, '127.0.0.1', this.address().port); diff --git a/test/parallel/test-tcp-wrap-listen.js b/test/parallel/test-tcp-wrap-listen.js index 7502969c967f86..8203a4771b861f 100644 --- a/test/parallel/test-tcp-wrap-listen.js +++ b/test/parallel/test-tcp-wrap-listen.js @@ -2,10 +2,10 @@ const common = require('../common'); const assert = require('assert'); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const WriteWrap = process.binding('stream_wrap').WriteWrap; -const server = new TCP(); +const server = new TCP(TCPConstants.SOCKET); const r = server.bind('0.0.0.0', 0); assert.strictEqual(0, r); diff --git a/test/parallel/test-tcp-wrap.js b/test/parallel/test-tcp-wrap.js index 96ddd5bfd31ffa..36a45d7606b125 100644 --- a/test/parallel/test-tcp-wrap.js +++ b/test/parallel/test-tcp-wrap.js @@ -23,10 +23,10 @@ require('../common'); const assert = require('assert'); -const TCP = process.binding('tcp_wrap').TCP; +const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); const uv = process.binding('uv'); -const handle = new TCP(); +const handle = new TCP(TCPConstants.SOCKET); // Should be able to bind to the port let err = handle.bind('0.0.0.0', 0); diff --git a/test/parallel/test-timers-enroll-invalid-msecs.js b/test/parallel/test-timers-enroll-invalid-msecs.js index 0ecad0bd2a3191..df6ad04069910f 100644 --- a/test/parallel/test-timers-enroll-invalid-msecs.js +++ b/test/parallel/test-timers-enroll-invalid-msecs.js @@ -2,7 +2,6 @@ const common = require('../common'); const timers = require('timers'); -const assert = require('assert'); [ {}, @@ -11,12 +10,12 @@ const assert = require('assert'); () => { }, Symbol('foo') ].forEach((val) => { - assert.throws( + common.expectsError( () => timers.enroll({}, val), - common.expectsError({ + { code: 'ERR_INVALID_ARG_TYPE', type: TypeError - }) + } ); }); @@ -25,13 +24,13 @@ const assert = require('assert'); Infinity, NaN ].forEach((val) => { - assert.throws( + common.expectsError( () => timers.enroll({}, val), - common.expectsError({ + { code: 'ERR_VALUE_OUT_OF_RANGE', type: RangeError, message: 'The value of "msecs" must be a non-negative ' + `finite number. Received "${val}"` - }) + } ); }); diff --git a/test/parallel/test-timers.js b/test/parallel/test-timers.js index 120e07a05fa9dd..1aa5d351a4d4bd 100644 --- a/test/parallel/test-timers.js +++ b/test/parallel/test-timers.js @@ -47,19 +47,19 @@ const inputs = [ 0.5, 1, 1.0, - 2147483648, // browser behaviour: timeouts > 2^31-1 run on next tick + 2147483648, // browser behavior: timeouts > 2^31-1 run on next tick 12345678901234 // ditto ]; const timeouts = []; const intervals = []; -inputs.forEach(function(value, index) { - setTimeout(function() { +inputs.forEach((value, index) => { + setTimeout(() => { timeouts[index] = true; }, value); - const handle = setInterval(function() { + const handle = setInterval(() => { clearInterval(handle); // disarm timer or we'll never finish intervals[index] = true; }, value); @@ -68,9 +68,9 @@ inputs.forEach(function(value, index) { // All values in inputs array coerce to 1 ms. Therefore, they should all run // before a timer set here for 2 ms. -setTimeout(common.mustCall(function() { +setTimeout(common.mustCall(() => { // assert that all other timers have run - inputs.forEach(function(value, index) { + inputs.forEach((value, index) => { assert(timeouts[index]); assert(intervals[index]); }); diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js index 2af42346b8381c..e747f5a5162db5 100644 --- a/test/parallel/test-tls-basic-validations.js +++ b/test/parallel/test-tls-basic-validations.js @@ -22,12 +22,12 @@ assert.throws(() => tls.createServer({ key: 'dummykey', passphrase: 1 }), assert.throws(() => tls.createServer({ ecdhCurve: 1 }), /TypeError: ECDH curve name must be a string/); -assert.throws(() => tls.createServer({ handshakeTimeout: 'abcd' }), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "timeout" argument must be of type number' - }) +common.expectsError(() => tls.createServer({ handshakeTimeout: 'abcd' }), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "timeout" argument must be of type number' + } ); assert.throws(() => tls.createServer({ sessionTimeout: 'abcd' }), diff --git a/test/parallel/test-tls-clientcertengine-invalid-arg-type.js b/test/parallel/test-tls-clientcertengine-invalid-arg-type.js new file mode 100644 index 00000000000000..b91e0f35c4c384 --- /dev/null +++ b/test/parallel/test-tls-clientcertengine-invalid-arg-type.js @@ -0,0 +1,14 @@ +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const tls = require('tls'); + +{ + common.expectsError( + () => { tls.createSecureContext({ clientCertEngine: 0 }); }, + { code: 'ERR_INVALID_ARG_TYPE', + message: / Received type number$/ }); +} diff --git a/test/parallel/test-tls-clientcertengine-unsupported.js b/test/parallel/test-tls-clientcertengine-unsupported.js new file mode 100644 index 00000000000000..0209a51fc78d31 --- /dev/null +++ b/test/parallel/test-tls-clientcertengine-unsupported.js @@ -0,0 +1,27 @@ +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +// Monkey-patch SecureContext +const binding = process.binding('crypto'); +const NativeSecureContext = binding.SecureContext; + +binding.SecureContext = function() { + const rv = new NativeSecureContext(); + rv.setClientCertEngine = undefined; + return rv; +}; + +const tls = require('tls'); + +{ + common.expectsError( + () => { tls.createSecureContext({ clientCertEngine: 'Cannonmouth' }); }, + { + code: 'ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED', + message: 'Custom engines not supported by this OpenSSL' + } + ); +} diff --git a/test/parallel/test-tls-interleave.js b/test/parallel/test-tls-interleave.js index d704a35e6881df..c82d7140fce887 100644 --- a/test/parallel/test-tls-interleave.js +++ b/test/parallel/test-tls-interleave.js @@ -26,15 +26,13 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); - const tls = require('tls'); -const fs = require('fs'); +const fixtures = require('../common/fixtures'); -const dir = common.fixturesDir; -const options = { key: fs.readFileSync(`${dir}/test_key.pem`), - cert: fs.readFileSync(`${dir}/test_cert.pem`), - ca: [ fs.readFileSync(`${dir}/test_ca.pem`) ] }; +const options = { key: fixtures.readSync('test_key.pem'), + cert: fixtures.readSync('test_cert.pem'), + ca: [ fixtures.readSync('test_ca.pem') ] }; const writes = [ 'some server data', diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js index b1027dd943386c..578ee4cbfd76f2 100644 --- a/test/parallel/test-tls-invoke-queued.js +++ b/test/parallel/test-tls-invoke-queued.js @@ -26,14 +26,15 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); -const fs = require('fs'); const tls = require('tls'); +const fixtures = require('../common/fixtures'); + let received = ''; const server = tls.createServer({ - key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') }, common.mustCall(function(c) { c._write('hello ', null, common.mustCall(function() { c._write('world!', null, common.mustCall(function() { diff --git a/test/parallel/test-tls-no-cert-required.js b/test/parallel/test-tls-no-cert-required.js index e5461d2291cf57..c6ad117831e5a6 100644 --- a/test/parallel/test-tls-no-cert-required.js +++ b/test/parallel/test-tls-no-cert-required.js @@ -39,12 +39,12 @@ tls.createServer(assert.fail) tls.createServer({}) .listen(0, common.mustCall(close)); -assert.throws(() => tls.createServer('this is not valid'), - common.expectsError({ - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: 'The "options" argument must be of type Object' - }) +common.expectsError(() => tls.createServer('this is not valid'), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "options" argument must be of type Object' + } ); tls.createServer() diff --git a/test/parallel/test-tls-options-boolean-check.js b/test/parallel/test-tls-options-boolean-check.js index e866f5a0692d54..d77f66c6885c97 100644 --- a/test/parallel/test-tls-options-boolean-check.js +++ b/test/parallel/test-tls-options-boolean-check.js @@ -98,13 +98,13 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [[keyStr, keyStr2], true, invalidCertRE], [true, [certBuff, certBuff2], invalidKeyRE] ].map(([key, cert, message]) => { - assert.throws(() => { + common.expectsError(() => { tls.createServer({ key, cert }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message - })); + }); }); // Checks to ensure tls.createServer works with the CA parameter @@ -132,13 +132,13 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] ].map(([key, cert, ca]) => { - assert.throws(() => { + common.expectsError(() => { tls.createServer({ key, cert, ca }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "ca" argument must be one of type string, Buffer, TypedArray, or DataView$/ - })); + }); }); // Checks to ensure tls.createServer throws an error for CA assignment @@ -150,13 +150,13 @@ const invalidCertRE = /^The "cert" argument must be one of type string, Buffer, [keyBuff, certBuff, true], [keyBuff, certBuff, [caCert, true]] ].map(([key, cert, ca]) => { - assert.throws(() => { + common.expectsError(() => { tls.createServer({ key, cert, ca }); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: /^The "ca" argument must be one of type string, Buffer, TypedArray, or DataView$/ - })); + }); }); // Checks to ensure tls.createSecureContext works with false-y input diff --git a/test/parallel/test-tls-server-setoptions-clientcertengine.js b/test/parallel/test-tls-server-setoptions-clientcertengine.js new file mode 100644 index 00000000000000..beafdd7c2be47b --- /dev/null +++ b/test/parallel/test-tls-server-setoptions-clientcertengine.js @@ -0,0 +1,15 @@ +'use strict'; +const common = require('../common'); + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const assert = require('assert'); +const tls = require('tls'); + +{ + const server = tls.createServer(); + assert.strictEqual(server.clientCertEngine, undefined); + server.setOptions({ clientCertEngine: 'Cannonmouth' }); + assert.strictEqual(server.clientCertEngine, 'Cannonmouth'); +} diff --git a/test/parallel/test-trace-event.js b/test/parallel/test-trace-event.js deleted file mode 100644 index 434c7db4d263cd..00000000000000 --- a/test/parallel/test-trace-event.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const cp = require('child_process'); -const fs = require('fs'); - -const CODE = 'for (var i = 0; i < 100000; i++) { "test" + i }'; -const FILE_NAME = 'node_trace.1.log'; - -common.refreshTmpDir(); -process.chdir(common.tmpDir); - -const proc_no_categories = cp.spawn( - process.execPath, - [ '--trace-events-enabled', '--trace-event-categories', '""', '-e', CODE ] -); - -proc_no_categories.once('exit', common.mustCall(() => { - assert(!common.fileExists(FILE_NAME)); - - const proc = cp.spawn(process.execPath, - [ '--trace-events-enabled', '-e', CODE ]); - - proc.once('exit', common.mustCall(() => { - assert(common.fileExists(FILE_NAME)); - fs.readFile(FILE_NAME, common.mustCall((err, data) => { - const traces = JSON.parse(data.toString()).traceEvents; - assert(traces.length > 0); - // Values that should be present on all runs to approximate correctness. - assert(traces.some((trace) => { - if (trace.pid !== proc.pid) - return false; - if (trace.cat !== 'v8') - return false; - if (trace.name !== 'V8.ScriptCompiler') - return false; - return true; - })); - })); - })); -})); diff --git a/test/parallel/test-trace-events-all.js b/test/parallel/test-trace-events-all.js new file mode 100644 index 00000000000000..329f99f591244d --- /dev/null +++ b/test/parallel/test-trace-events-all.js @@ -0,0 +1,56 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); +const fs = require('fs'); + +const CODE = + 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; +const FILE_NAME = 'node_trace.1.log'; + +common.refreshTmpDir(); +process.chdir(common.tmpDir); + +const proc = cp.spawn(process.execPath, + [ '--trace-events-enabled', '-e', CODE ]); + +proc.once('exit', common.mustCall(() => { + assert(common.fileExists(FILE_NAME)); + fs.readFile(FILE_NAME, common.mustCall((err, data) => { + const traces = JSON.parse(data.toString()).traceEvents; + assert(traces.length > 0); + // V8 trace events should be generated. + assert(traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'v8') + return false; + if (trace.name !== 'V8.ScriptCompiler') + return false; + return true; + })); + + // C++ async_hooks trace events should be generated. + assert(traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'node.async_hooks') + return false; + if (trace.name !== 'TIMERWRAP') + return false; + return true; + })); + + + // JavaScript async_hooks trace events should be generated. + assert(traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'node.async_hooks') + return false; + if (trace.name !== 'Timeout') + return false; + return true; + })); + })); +})); diff --git a/test/parallel/test-trace-events-async-hooks.js b/test/parallel/test-trace-events-async-hooks.js new file mode 100644 index 00000000000000..e1f78f791a636d --- /dev/null +++ b/test/parallel/test-trace-events-async-hooks.js @@ -0,0 +1,66 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); +const fs = require('fs'); + +const CODE = + 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; +const FILE_NAME = 'node_trace.1.log'; + +common.refreshTmpDir(); +process.chdir(common.tmpDir); + +const proc = cp.spawn(process.execPath, + [ '--trace-events-enabled', + '--trace-event-categories', 'node.async_hooks', + '-e', CODE ]); + +proc.once('exit', common.mustCall(() => { + assert(common.fileExists(FILE_NAME)); + fs.readFile(FILE_NAME, common.mustCall((err, data) => { + const traces = JSON.parse(data.toString()).traceEvents; + assert(traces.length > 0); + // V8 trace events should be generated. + assert(!traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'v8') + return false; + if (trace.name !== 'V8.ScriptCompiler') + return false; + return true; + })); + + // C++ async_hooks trace events should be generated. + assert(traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'node.async_hooks') + return false; + if (trace.name !== 'TIMERWRAP') + return false; + return true; + })); + + // JavaScript async_hooks trace events should be generated. + assert(traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'node.async_hooks') + return false; + if (trace.name !== 'Timeout') + return false; + return true; + })); + + // Check args in init events + const initEvents = traces.filter((trace) => { + return (trace.ph === 'b' && !trace.name.includes('_CALLBACK')); + }); + assert(initEvents.every((trace) => { + return (trace.args.executionAsyncId > 0 && + trace.args.triggerAsyncId > 0); + })); + })); +})); diff --git a/test/parallel/test-trace-events-binding.js b/test/parallel/test-trace-events-binding.js new file mode 100644 index 00000000000000..9a182821bac18e --- /dev/null +++ b/test/parallel/test-trace-events-binding.js @@ -0,0 +1,61 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); +const fs = require('fs'); + +const CODE = ` + process.binding("trace_events").emit( + 'b'.charCodeAt(0), 'custom', + 'type-value', 10, 'extra-value', 20); + process.binding("trace_events").emit( + 'b'.charCodeAt(0), 'custom', + 'type-value', 20, 'first-value', 20, 'second-value', 30); + process.binding("trace_events").emit( + 'b'.charCodeAt(0), 'custom', + 'type-value', 30); + process.binding("trace_events").emit( + 'b'.charCodeAt(0), 'missing', + 'type-value', 10, 'extra-value', 20); +`; +const FILE_NAME = 'node_trace.1.log'; + +common.refreshTmpDir(); +process.chdir(common.tmpDir); + +const proc = cp.spawn(process.execPath, + [ '--trace-events-enabled', + '--trace-event-categories', 'custom', + '-e', CODE ]); + +proc.once('exit', common.mustCall(() => { + assert(common.fileExists(FILE_NAME)); + fs.readFile(FILE_NAME, common.mustCall((err, data) => { + const traces = JSON.parse(data.toString()).traceEvents; + assert.strictEqual(traces.length, 3); + + assert.strictEqual(traces[0].pid, proc.pid); + assert.strictEqual(traces[0].ph, 'b'); + assert.strictEqual(traces[0].cat, 'custom'); + assert.strictEqual(traces[0].name, 'type-value'); + assert.strictEqual(traces[0].id, '0xa'); + assert.deepStrictEqual(traces[0].args, { 'extra-value': 20 }); + + assert.strictEqual(traces[1].pid, proc.pid); + assert.strictEqual(traces[1].ph, 'b'); + assert.strictEqual(traces[1].cat, 'custom'); + assert.strictEqual(traces[1].name, 'type-value'); + assert.strictEqual(traces[1].id, '0x14'); + assert.deepStrictEqual(traces[1].args, { + 'first-value': 20, + 'second-value': 30 + }); + + assert.strictEqual(traces[2].pid, proc.pid); + assert.strictEqual(traces[2].ph, 'b'); + assert.strictEqual(traces[2].cat, 'custom'); + assert.strictEqual(traces[2].name, 'type-value'); + assert.strictEqual(traces[2].id, '0x1e'); + assert.deepStrictEqual(traces[2].args, { }); + })); +})); diff --git a/test/parallel/test-trace-events-category-used.js b/test/parallel/test-trace-events-category-used.js new file mode 100644 index 00000000000000..39d09ad862d787 --- /dev/null +++ b/test/parallel/test-trace-events-category-used.js @@ -0,0 +1,35 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); + +const CODE = `console.log( + process.binding("trace_events").categoryGroupEnabled("custom") +);`; + +common.refreshTmpDir(); +process.chdir(common.tmpDir); + +const procEnabled = cp.spawn( + process.execPath, + [ '--trace-events-enabled', '--trace-event-categories', 'custom', '-e', CODE ] +); +let procEnabledOutput = ''; + +procEnabled.stdout.on('data', (data) => procEnabledOutput += data); +procEnabled.stderr.pipe(process.stderr); +procEnabled.once('exit', common.mustCall(() => { + assert.strictEqual(procEnabledOutput, 'true\n'); +})); + +const procDisabled = cp.spawn( + process.execPath, + [ '--trace-events-enabled', '--trace-event-categories', 'other', '-e', CODE ] +); +let procDisabledOutput = ''; + +procDisabled.stdout.on('data', (data) => procDisabledOutput += data); +procDisabled.stderr.pipe(process.stderr); +procDisabled.once('exit', common.mustCall(() => { + assert.strictEqual(procDisabledOutput, 'false\n'); +})); diff --git a/test/parallel/test-trace-events-none.js b/test/parallel/test-trace-events-none.js new file mode 100644 index 00000000000000..9a4d587f2db0e1 --- /dev/null +++ b/test/parallel/test-trace-events-none.js @@ -0,0 +1,20 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); + +const CODE = + 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; +const FILE_NAME = 'node_trace.1.log'; + +common.refreshTmpDir(); +process.chdir(common.tmpDir); + +const proc_no_categories = cp.spawn( + process.execPath, + [ '--trace-events-enabled', '--trace-event-categories', '""', '-e', CODE ] +); + +proc_no_categories.once('exit', common.mustCall(() => { + assert(!common.fileExists(FILE_NAME)); +})); diff --git a/test/parallel/test-trace-events-v8.js b/test/parallel/test-trace-events-v8.js new file mode 100644 index 00000000000000..b17b1473ecaf0c --- /dev/null +++ b/test/parallel/test-trace-events-v8.js @@ -0,0 +1,58 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); +const fs = require('fs'); + +const CODE = + 'setTimeout(() => { for (var i = 0; i < 100000; i++) { "test" + i } }, 1)'; +const FILE_NAME = 'node_trace.1.log'; + +common.refreshTmpDir(); +process.chdir(common.tmpDir); + +const proc = cp.spawn(process.execPath, + [ '--trace-events-enabled', + '--trace-event-categories', 'v8', + '-e', CODE ]); + +proc.once('exit', common.mustCall(() => { + assert(common.fileExists(FILE_NAME)); + fs.readFile(FILE_NAME, common.mustCall((err, data) => { + const traces = JSON.parse(data.toString()).traceEvents; + assert(traces.length > 0); + // V8 trace events should be generated. + assert(traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'v8') + return false; + if (trace.name !== 'V8.ScriptCompiler') + return false; + return true; + })); + + // C++ async_hooks trace events should be generated. + assert(!traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'node.async_hooks') + return false; + if (trace.name !== 'TIMERWRAP') + return false; + return true; + })); + + + // JavaScript async_hooks trace events should be generated. + assert(!traces.some((trace) => { + if (trace.pid !== proc.pid) + return false; + if (trace.cat !== 'node.async_hooks') + return false; + if (trace.name !== 'Timeout') + return false; + return true; + })); + })); +})); diff --git a/test/parallel/test-ttywrap-invalid-fd.js b/test/parallel/test-ttywrap-invalid-fd.js index 44647590ccb413..f54adb1ddc8737 100644 --- a/test/parallel/test-ttywrap-invalid-fd.js +++ b/test/parallel/test-ttywrap-invalid-fd.js @@ -4,14 +4,13 @@ const assert = require('assert'); const fs = require('fs'); const tty = require('tty'); -assert.throws(() => { +common.expectsError(() => { new tty.WriteStream(-1); -}, common.expectsError({ +}, { code: 'ERR_INVALID_FD', type: RangeError, message: '"fd" must be a positive integer: -1' -}) -); +}); const err_regex = common.isWindows ? /^Error: EBADF: bad file descriptor, uv_tty_init$/ : @@ -25,14 +24,13 @@ assert.throws(() => { new tty.WriteStream(fd); }, err_regex); -assert.throws(() => { +common.expectsError(() => { new tty.ReadStream(-1); -}, common.expectsError({ +}, { code: 'ERR_INVALID_FD', type: RangeError, message: '"fd" must be a positive integer: -1' -}) -); +}); assert.throws(() => { let fd = 2; diff --git a/test/parallel/test-util-callbackify.js b/test/parallel/test-util-callbackify.js index 0999fc4fd39f07..bc2154940cb405 100644 --- a/test/parallel/test-util-callbackify.js +++ b/test/parallel/test-util-callbackify.js @@ -28,7 +28,7 @@ const values = [ for (const value of values) { // Test and `async function` async function asyncFn() { - return await Promise.resolve(value); + return value; } const cbAsyncFn = callbackify(asyncFn); @@ -70,7 +70,7 @@ const values = [ for (const value of values) { // Test an `async function` async function asyncFn() { - return await Promise.reject(value); + return Promise.reject(value); } const cbAsyncFn = callbackify(asyncFn); @@ -142,7 +142,7 @@ const values = [ for (const value of values) { async function asyncFn(arg) { assert.strictEqual(arg, value); - return await Promise.resolve(arg); + return arg; } const cbAsyncFn = callbackify(asyncFn); @@ -183,7 +183,7 @@ const values = [ const iAmThat = { async fn(arg) { assert.strictEqual(this, iAmThat); - return await Promise.resolve(arg); + return arg; }, }; iAmThat.cbFn = callbackify(iAmThat.fn); @@ -229,19 +229,19 @@ const values = [ { // Verify that non-function inputs throw. ['foo', null, undefined, false, 0, {}, Symbol(), []].forEach((value) => { - assert.throws(() => { + common.expectsError(() => { callbackify(value); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "original" argument must be of type Function' - })); + }); }); } { async function asyncFn() { - return await Promise.resolve(42); + return 42; } const cb = callbackify(asyncFn); @@ -250,12 +250,12 @@ const values = [ // Verify that the last argument to the callbackified function is a function. ['foo', null, undefined, false, 0, {}, Symbol(), []].forEach((value) => { args.push(value); - assert.throws(() => { + common.expectsError(() => { cb(...args); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The last argument must be of type Function' - })); + }); }); } diff --git a/test/parallel/test-util-inherits.js b/test/parallel/test-util-inherits.js index f05135ec78cddc..9c610e380041ac 100644 --- a/test/parallel/test-util-inherits.js +++ b/test/parallel/test-util-inherits.js @@ -80,22 +80,22 @@ assert.strictEqual(e.e(), 'e'); assert.strictEqual(e.constructor, E); // should throw with invalid arguments -assert.throws(function() { +common.expectsError(function() { inherits(A, {}); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "superCtor.prototype" property must be of type Function' -}) +} ); assert.throws(function() { inherits(A, null); }, errCheck); -assert.throws(function() { +common.expectsError(function() { inherits(null, A); -}, common.expectsError({ +}, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "ctor" argument must be of type Function' -}) +} ); diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index c0f0c6b6444baf..d64888306719db 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -416,6 +416,8 @@ assert.strictEqual( // test positive/negative zero assert.strictEqual(util.inspect(0), '0'); assert.strictEqual(util.inspect(-0), '-0'); +// edge case from check +assert.strictEqual(util.inspect(-5e-324), '-5e-324'); // test for sparse array { @@ -567,25 +569,31 @@ assert.doesNotThrow(() => { assert.strictEqual(util.inspect(x).includes('inspect'), true); } -// util.inspect should not display the escaped value of a key. +// util.inspect should display the escaped value of a key. { const w = { '\\': 1, '\\\\': 2, '\\\\\\': 3, '\\\\\\\\': 4, + '\n': 5, + '\r': 6 }; const y = ['a', 'b', 'c']; - y['\\\\\\'] = 'd'; + y['\\\\'] = 'd'; + y['\n'] = 'e'; + y['\r'] = 'f'; assert.strictEqual( util.inspect(w), - '{ \'\\\': 1, \'\\\\\': 2, \'\\\\\\\': 3, \'\\\\\\\\\': 4 }' + '{ \'\\\\\': 1, \'\\\\\\\\\': 2, \'\\\\\\\\\\\\\': 3, ' + + '\'\\\\\\\\\\\\\\\\\': 4, \'\\n\': 5, \'\\r\': 6 }' ); assert.strictEqual( util.inspect(y), - '[ \'a\', \'b\', \'c\', \'\\\\\\\': \'d\' ]' + '[ \'a\', \'b\', \'c\', \'\\\\\\\\\': \'d\', ' + + '\'\\n\': \'e\', \'\\r\': \'f\' ]' ); } @@ -1131,22 +1139,22 @@ if (typeof Symbol !== 'undefined') { JSON.stringify(oldOptions) ); - assert.throws(() => { + common.expectsError(() => { util.inspect.defaultOptions = null; - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "options" argument must be of type Object' - }) + } ); - assert.throws(() => { + common.expectsError(() => { util.inspect.defaultOptions = 'bad'; - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "options" argument must be of type Object' - }) + } ); } diff --git a/test/parallel/test-vm-script-throw-in-tostring.js b/test/parallel/test-vm-script-throw-in-tostring.js new file mode 100644 index 00000000000000..20e7a75079b33c --- /dev/null +++ b/test/parallel/test-vm-script-throw-in-tostring.js @@ -0,0 +1,14 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +const vm = require('vm'); + +assert.throws(() => { + new vm.Script({ + toString() { + throw new Error(); + } + }); +}, Error); diff --git a/test/parallel/test-wasm-simple.js b/test/parallel/test-wasm-simple.js new file mode 100644 index 00000000000000..02a97ec2c9455f --- /dev/null +++ b/test/parallel/test-wasm-simple.js @@ -0,0 +1,19 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const fixtures = require('../common/fixtures'); + +common.crashOnUnhandledRejection(); + +const buffer = fixtures.readSync('test.wasm'); + +assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly'); + +WebAssembly.instantiate(buffer, {}).then((results) => { + assert.strictEqual( + results.instance.exports.addTwo(10, 20), + 30, + 'Exported function should add two numbers.', + ); +}); diff --git a/test/parallel/test-whatwg-encoding-textdecoder.js b/test/parallel/test-whatwg-encoding-textdecoder.js index 55c601364d0add..c4f919289adf2f 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder.js +++ b/test/parallel/test-whatwg-encoding-textdecoder.js @@ -52,12 +52,13 @@ assert(TextDecoder); if (common.hasIntl) { ['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => { const dec = new TextDecoder(i, { fatal: true }); - assert.throws(() => dec.decode(buf.slice(0, 8)), - common.expectsError({ - code: 'ERR_ENCODING_INVALID_ENCODED_DATA', - type: TypeError, - message: 'The encoded data was not valid for encoding utf-8' - })); + common.expectsError(() => dec.decode(buf.slice(0, 8)), + { + code: 'ERR_ENCODING_INVALID_ENCODED_DATA', + type: TypeError, + message: 'The encoded data was not valid ' + + 'for encoding utf-8' + }); }); ['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => { @@ -66,13 +67,13 @@ if (common.hasIntl) { assert.doesNotThrow(() => dec.decode(buf.slice(8))); }); } else { - assert.throws( + common.expectsError( () => new TextDecoder('utf-8', { fatal: true }), - common.expectsError({ + { code: 'ERR_NO_ICU', type: TypeError, message: '"fatal" option is not supported on Node.js compiled without ICU' - })); + }); } // Test TextDecoder, UTF-16le @@ -96,12 +97,12 @@ if (common.hasIntl) { }); [{}, [], true, 1, '', new TextEncoder()].forEach((i) => { - assert.throws(() => fn.call(i, Infinity, {}), - common.expectsError({ - code: 'ERR_INVALID_THIS', - type: TypeError, - message: 'Value of "this" must be of type TextDecoder' - })); + common.expectsError(() => fn.call(i, Infinity, {}), + { + code: 'ERR_INVALID_THIS', + type: TypeError, + message: 'Value of "this" must be of type TextDecoder' + }); }); } diff --git a/test/parallel/test-whatwg-encoding-textencoder.js b/test/parallel/test-whatwg-encoding-textencoder.js index 2e8ca9e9abafd1..fba5445c81941c 100644 --- a/test/parallel/test-whatwg-encoding-textencoder.js +++ b/test/parallel/test-whatwg-encoding-textencoder.js @@ -41,11 +41,11 @@ assert(TextEncoder); }); [{}, [], true, 1, '', new TextDecoder()].forEach((i) => { - assert.throws(() => fn.call(i, Infinity, {}), - common.expectsError({ - code: 'ERR_INVALID_THIS', - type: TypeError, - message: 'Value of "this" must be of type TextEncoder' - })); + common.expectsError(() => fn.call(i, Infinity, {}), + { + code: 'ERR_INVALID_THIS', + type: TypeError, + message: 'Value of "this" must be of type TextEncoder' + }); }); } diff --git a/test/parallel/test-whatwg-url-searchparams-append.js b/test/parallel/test-whatwg-url-searchparams-append.js index fc9f5bd75d160b..03e7205fb2cb51 100644 --- a/test/parallel/test-whatwg-url-searchparams-append.js +++ b/test/parallel/test-whatwg-url-searchparams-append.js @@ -52,20 +52,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.append.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.append('a'); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" and "value" arguments must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-delete.js b/test/parallel/test-whatwg-url-searchparams-delete.js index 2969f51a731c58..042ecb5d889beb 100644 --- a/test/parallel/test-whatwg-url-searchparams-delete.js +++ b/test/parallel/test-whatwg-url-searchparams-delete.js @@ -62,20 +62,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.delete.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.delete(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" argument must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-entries.js b/test/parallel/test-whatwg-url-searchparams-entries.js index 1dfcdb0338dffb..fc3086545870ee 100644 --- a/test/parallel/test-whatwg-url-searchparams-entries.js +++ b/test/parallel/test-whatwg-url-searchparams-entries.js @@ -26,17 +26,17 @@ assert.deepStrictEqual(entries.next(), { done: true }); -assert.throws(() => { +common.expectsError(() => { entries.next.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParamsIterator' -})); -assert.throws(() => { +}); +common.expectsError(() => { params.entries.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' -})); +}); diff --git a/test/parallel/test-whatwg-url-searchparams-foreach.js b/test/parallel/test-whatwg-url-searchparams-foreach.js index 0147418ff21f07..53c35da263f5ab 100644 --- a/test/parallel/test-whatwg-url-searchparams-foreach.js +++ b/test/parallel/test-whatwg-url-searchparams-foreach.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const { URL, URLSearchParams } = require('url'); const { test, assert_array_equals, assert_unreached } = require('../common/wpt'); @@ -50,11 +49,11 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.forEach.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); + }); } diff --git a/test/parallel/test-whatwg-url-searchparams-get.js b/test/parallel/test-whatwg-url-searchparams-get.js index 2e7d22c998bf02..e14bdc7e74fc8d 100644 --- a/test/parallel/test-whatwg-url-searchparams-get.js +++ b/test/parallel/test-whatwg-url-searchparams-get.js @@ -37,20 +37,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.get.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.get(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" argument must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-getall.js b/test/parallel/test-whatwg-url-searchparams-getall.js index 3a8bf347ff1f3f..a4692c22f1b21d 100644 --- a/test/parallel/test-whatwg-url-searchparams-getall.js +++ b/test/parallel/test-whatwg-url-searchparams-getall.js @@ -42,20 +42,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.getAll.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.getAll(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" argument must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-has.js b/test/parallel/test-whatwg-url-searchparams-has.js index dcdf585dcdf76d..47c6b6f7bae98f 100644 --- a/test/parallel/test-whatwg-url-searchparams-has.js +++ b/test/parallel/test-whatwg-url-searchparams-has.js @@ -40,20 +40,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.has.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.has(); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" argument must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-keys.js b/test/parallel/test-whatwg-url-searchparams-keys.js index cbf0766bc2e6c4..e4428eb3e98f6b 100644 --- a/test/parallel/test-whatwg-url-searchparams-keys.js +++ b/test/parallel/test-whatwg-url-searchparams-keys.js @@ -27,17 +27,17 @@ assert.deepStrictEqual(keys.next(), { done: true }); -assert.throws(() => { +common.expectsError(() => { keys.next.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParamsIterator' -})); -assert.throws(() => { +}); +common.expectsError(() => { params.keys.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' -})); +}); diff --git a/test/parallel/test-whatwg-url-searchparams-set.js b/test/parallel/test-whatwg-url-searchparams-set.js index 46414ff23aba14..1bca12e31bcc28 100644 --- a/test/parallel/test-whatwg-url-searchparams-set.js +++ b/test/parallel/test-whatwg-url-searchparams-set.js @@ -38,20 +38,20 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.set.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); - assert.throws(() => { + }); + common.expectsError(() => { params.set('a'); - }, common.expectsError({ + }, { code: 'ERR_MISSING_ARGS', type: TypeError, message: 'The "name" and "value" arguments must be specified' - })); + }); const obj = { toString() { throw new Error('toString'); }, diff --git a/test/parallel/test-whatwg-url-searchparams-stringifier.js b/test/parallel/test-whatwg-url-searchparams-stringifier.js index e2f73d262e590b..e3bfbdcf1982d8 100644 --- a/test/parallel/test-whatwg-url-searchparams-stringifier.js +++ b/test/parallel/test-whatwg-url-searchparams-stringifier.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); const URLSearchParams = require('url').URLSearchParams; const { test, assert_equals } = require('../common/wpt'); @@ -126,11 +125,11 @@ test(function() { // Tests below are not from WPT. { const params = new URLSearchParams(); - assert.throws(() => { + common.expectsError(() => { params.toString.call(undefined); - }, common.expectsError({ + }, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' - })); + }); } diff --git a/test/parallel/test-whatwg-url-searchparams-values.js b/test/parallel/test-whatwg-url-searchparams-values.js index 96f1a0fddbfb9f..e44b7f5e11267d 100644 --- a/test/parallel/test-whatwg-url-searchparams-values.js +++ b/test/parallel/test-whatwg-url-searchparams-values.js @@ -27,17 +27,17 @@ assert.deepStrictEqual(values.next(), { done: true }); -assert.throws(() => { +common.expectsError(() => { values.next.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParamsIterator' -})); -assert.throws(() => { +}); +common.expectsError(() => { params.values.call(undefined); -}, common.expectsError({ +}, { code: 'ERR_INVALID_THIS', type: TypeError, message: 'Value of "this" must be of type URLSearchParams' -})); +}); diff --git a/test/parallel/test-writedouble.js b/test/parallel/test-writedouble.js index b6a53842044340..cb1b0701531f06 100644 --- a/test/parallel/test-writedouble.js +++ b/test/parallel/test-writedouble.js @@ -189,8 +189,8 @@ function test(clazz) { // Darwin ia32 does the other kind of NaN. // Compiler bug. No one really cares. assert(0x7F === buffer[15] || 0xFF === buffer[15]); - assert.ok(isNaN(buffer.readDoubleBE(0))); - assert.ok(isNaN(buffer.readDoubleLE(8))); + assert.ok(Number.isNaN(buffer.readDoubleBE(0))); + assert.ok(Number.isNaN(buffer.readDoubleLE(8))); } diff --git a/test/parallel/test-writefloat.js b/test/parallel/test-writefloat.js index c175840f598087..b22b9e8c924899 100644 --- a/test/parallel/test-writefloat.js +++ b/test/parallel/test-writefloat.js @@ -127,8 +127,8 @@ function test(clazz) { // Darwin ia32 does the other kind of NaN. // Compiler bug. No one really cares. assert(0x7F === buffer[7] || 0xFF === buffer[7]); - assert.ok(isNaN(buffer.readFloatBE(0))); - assert.ok(isNaN(buffer.readFloatLE(4))); + assert.ok(Number.isNaN(buffer.readFloatBE(0))); + assert.ok(Number.isNaN(buffer.readFloatLE(4))); } diff --git a/test/parallel/test-writeint.js b/test/parallel/test-writeint.js index 66dc13997e2785..1e0a8e8812ecb2 100644 --- a/test/parallel/test-writeint.js +++ b/test/parallel/test-writeint.js @@ -41,10 +41,10 @@ function test8(clazz) { assert.strictEqual(0xfb, buffer[1]); /* Make sure we handle truncation correctly */ - assert.throws(function() { + assert.throws(() => { buffer.writeInt8(0xabc, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt8(0xabc, 0); }, errorOutOfBounds); @@ -54,10 +54,10 @@ function test8(clazz) { assert.strictEqual(0x7f, buffer[0]); assert.strictEqual(0x80, buffer[1]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt8(0x7f + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt8(-0x80 - 1, 0); }, errorOutOfBounds); } @@ -94,10 +94,10 @@ function test16(clazz) { assert.strictEqual(0xff, buffer[1]); assert.strictEqual(0x80, buffer[2]); assert.strictEqual(0x00, buffer[3]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt16BE(0x7fff + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt16BE(-0x8000 - 1, 0); }, errorOutOfBounds); @@ -107,10 +107,10 @@ function test16(clazz) { assert.strictEqual(0x7f, buffer[1]); assert.strictEqual(0x00, buffer[2]); assert.strictEqual(0x80, buffer[3]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt16LE(0x7fff + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt16LE(-0x8000 - 1, 0); }, errorOutOfBounds); } @@ -163,10 +163,10 @@ function test32(clazz) { assert.strictEqual(0x00, buffer[5]); assert.strictEqual(0x00, buffer[6]); assert.strictEqual(0x00, buffer[7]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt32BE(0x7fffffff + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt32BE(-0x80000000 - 1, 0); }, errorOutOfBounds); @@ -180,10 +180,10 @@ function test32(clazz) { assert.strictEqual(0x00, buffer[5]); assert.strictEqual(0x00, buffer[6]); assert.strictEqual(0x80, buffer[7]); - assert.throws(function() { + assert.throws(() => { buffer.writeInt32LE(0x7fffffff + 1, 0); }, errorOutOfBounds); - assert.throws(function() { + assert.throws(() => { buffer.writeInt32LE(-0x80000000 - 1, 0); }, errorOutOfBounds); } diff --git a/test/parallel/test-writeuint.js b/test/parallel/test-writeuint.js index 3ba4456beaaa38..0863135b2b8b05 100644 --- a/test/parallel/test-writeuint.js +++ b/test/parallel/test-writeuint.js @@ -154,10 +154,10 @@ function testUint(clazz) { type: RangeError, message: /^The value "[^"]*" is invalid for option "value"$/ }, 2); - assert.throws(function() { + assert.throws(() => { data.writeUIntBE(val, 0, i); }, errMsg); - assert.throws(function() { + assert.throws(() => { data.writeUIntLE(val, 0, i); }, errMsg); val *= 0x100; diff --git a/test/parallel/test-zerolengthbufferbug.js b/test/parallel/test-zerolengthbufferbug.js index 75aaa2f48dd8f3..0e1e976e568818 100644 --- a/test/parallel/test-zerolengthbufferbug.js +++ b/test/parallel/test-zerolengthbufferbug.js @@ -4,7 +4,7 @@ const common = require('../common'); const http = require('http'); -const server = http.createServer(function(req, res) { +const server = http.createServer((req, res) => { const buffer = Buffer.alloc(0); // FIXME: WTF gjslint want this? res.writeHead(200, { 'Content-Type': 'text/html', @@ -12,12 +12,12 @@ const server = http.createServer(function(req, res) { res.end(buffer); }); -server.listen(0, common.mustCall(function() { - http.get({ port: this.address().port }, common.mustCall(function(res) { +server.listen(0, common.mustCall(() => { + http.get({ port: server.address().port }, common.mustCall((res) => { res.on('data', common.mustNotCall()); - res.on('end', function(d) { + res.on('end', (d) => { server.close(); }); })); diff --git a/test/parallel/test-zlib-empty-buffer.js b/test/parallel/test-zlib-empty-buffer.js new file mode 100644 index 00000000000000..908c89cbbcef2e --- /dev/null +++ b/test/parallel/test-zlib-empty-buffer.js @@ -0,0 +1,26 @@ +'use strict'; +const common = require('../common'); +const zlib = require('zlib'); +const { inspect, promisify } = require('util'); +const assert = require('assert'); +const emptyBuffer = new Buffer(0); + +common.crashOnUnhandledRejection(); + +(async function() { + for (const [ compress, decompress, method ] of [ + [ zlib.deflateRawSync, zlib.inflateRawSync, 'raw sync' ], + [ zlib.deflateSync, zlib.inflateSync, 'deflate sync' ], + [ zlib.gzipSync, zlib.gunzipSync, 'gzip sync' ], + [ promisify(zlib.deflateRaw), promisify(zlib.inflateRaw), 'raw' ], + [ promisify(zlib.deflate), promisify(zlib.inflate), 'deflate' ], + [ promisify(zlib.gzip), promisify(zlib.gunzip), 'gzip' ] + ]) { + const compressed = await compress(emptyBuffer); + const decompressed = await decompress(compressed); + assert.deepStrictEqual( + emptyBuffer, decompressed, + `Expected ${inspect(compressed)} to match ${inspect(decompressed)} ` + + `to match for ${method}`); + } +})(); diff --git a/test/parallel/test-zlib-object-write.js b/test/parallel/test-zlib-object-write.js new file mode 100644 index 00000000000000..98f34b38bed850 --- /dev/null +++ b/test/parallel/test-zlib-object-write.js @@ -0,0 +1,11 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); +const { Gunzip } = require('zlib'); + +const gunzip = new Gunzip({ objectMode: true }); +assert.throws( + () => gunzip.write({}), + TypeError +); diff --git a/test/pseudo-tty/pseudo-tty.status b/test/pseudo-tty/pseudo-tty.status index 13279019b6bd72..5c8114692d9447 100644 --- a/test/pseudo-tty/pseudo-tty.status +++ b/test/pseudo-tty/pseudo-tty.status @@ -3,3 +3,8 @@ prefix pseudo-tty [$system==aix] # being investigated under https://github.com/nodejs/node/issues/9728 test-tty-wrap : FAIL, PASS + +[$system==solaris] +# https://github.com/nodejs/node/pull/16225 - `ioctl(fd, TIOCGWINSZ)` seems +# to fail with EINVAL on SmartOS when `fd` is a pty from python's pty module. +test-tty-stdout-resize : FAIL, PASS diff --git a/test/pseudo-tty/test-tty-stdout-resize.js b/test/pseudo-tty/test-tty-stdout-resize.js new file mode 100644 index 00000000000000..c92db615020c78 --- /dev/null +++ b/test/pseudo-tty/test-tty-stdout-resize.js @@ -0,0 +1,11 @@ +'use strict'; +const { mustCall } = require('../common'); +const { notStrictEqual } = require('assert'); + +// tty.WriteStream#_refreshSize() only emits the 'resize' event when the +// window dimensions change. We cannot influence that from the script +// but we can set the old values to something exceedingly unlikely. +process.stdout.columns = 9001; +process.stdout.on('resize', mustCall()); +process.kill(process.pid, 'SIGWINCH'); +setImmediate(mustCall(() => notStrictEqual(process.stdout.columns, 9001))); diff --git a/test/pseudo-tty/test-tty-stdout-resize.out b/test/pseudo-tty/test-tty-stdout-resize.out new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/pseudo-tty/test-tty-stream-constructors.js b/test/pseudo-tty/test-tty-stream-constructors.js new file mode 100644 index 00000000000000..27c33bad1868d6 --- /dev/null +++ b/test/pseudo-tty/test-tty-stream-constructors.js @@ -0,0 +1,21 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { ReadStream, WriteStream } = require('tty'); + +{ + // Verify that tty.ReadStream can be constructed without new. + const stream = ReadStream(0); + + stream.unref(); + assert(stream instanceof ReadStream); + assert.strictEqual(stream.isTTY, true); +} + +{ + // Verify that tty.WriteStream can be constructed without new. + const stream = WriteStream(1); + + assert(stream instanceof WriteStream); + assert.strictEqual(stream.isTTY, true); +} diff --git a/test/pseudo-tty/test-tty-stream-constructors.out b/test/pseudo-tty/test-tty-stream-constructors.out new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/pseudo-tty/test-tty-window-size.js b/test/pseudo-tty/test-tty-window-size.js new file mode 100644 index 00000000000000..782b66802e3ada --- /dev/null +++ b/test/pseudo-tty/test-tty-window-size.js @@ -0,0 +1,85 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const { WriteStream } = require('tty'); +const { TTY } = process.binding('tty_wrap'); +const getWindowSize = TTY.prototype.getWindowSize; + +function monkeyPatchGetWindowSize(fn) { + TTY.prototype.getWindowSize = function() { + TTY.prototype.getWindowSize = getWindowSize; + return fn.apply(this, arguments); + }; +} + +{ + // tty.WriteStream constructor does not define columns and rows if an error + // occurs while retrieving the window size from the handle. + monkeyPatchGetWindowSize(function() { + return -1; + }); + + const stream = WriteStream(1); + + assert(stream instanceof WriteStream); + assert.strictEqual(stream.columns, undefined); + assert.strictEqual(stream.rows, undefined); +} + +{ + // _refreshSize() emits an error if an error occurs while retrieving the + // window size from the handle. + const stream = WriteStream(1); + + stream.on('error', common.mustCall((err) => { + assert.strictEqual(err.syscall, 'getWindowSize'); + })); + + monkeyPatchGetWindowSize(function() { + return -1; + }); + + stream._refreshSize(); +} + +{ + // _refreshSize() emits a 'resize' event when the window size changes. + monkeyPatchGetWindowSize(function(size) { + size[0] = 80; + size[1] = 24; + return 0; + }); + + const stream = WriteStream(1); + + stream.on('resize', common.mustCall(() => { + assert.strictEqual(stream.columns, 82); + assert.strictEqual(stream.rows, 26); + })); + + assert.strictEqual(stream.columns, 80); + assert.strictEqual(stream.rows, 24); + + monkeyPatchGetWindowSize(function(size) { + size[0] = 82; + size[1] = 26; + return 0; + }); + + stream._refreshSize(); +} + +{ + // WriteStream.prototype.getWindowSize() returns the current columns and rows. + monkeyPatchGetWindowSize(function(size) { + size[0] = 99; + size[1] = 32; + return 0; + }); + + const stream = WriteStream(1); + + assert.strictEqual(stream.columns, 99); + assert.strictEqual(stream.rows, 32); + assert.deepStrictEqual(stream.getWindowSize(), [99, 32]); +} diff --git a/test/pseudo-tty/test-tty-window-size.out b/test/pseudo-tty/test-tty-window-size.out new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status index 1c38070bef7519..cf4763b00129cc 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -10,6 +10,7 @@ prefix sequential test-inspector-async-call-stack : PASS, FLAKY test-inspector-bindings : PASS, FLAKY test-inspector-debug-end : PASS, FLAKY +test-inspector-async-hook-setup-at-signal: PASS, FLAKY [$system==linux] diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index 3c82421706eebb..bd2b3254f06594 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -138,19 +138,27 @@ if (common.hasCrypto) { // eslint-disable-line crypto-check testInitialized(new Gzip()._handle, 'Zlib'); } - { const binding = process.binding('pipe_wrap'); - const handle = new binding.Pipe(); + const handle = new binding.Pipe(binding.constants.IPC); testInitialized(handle, 'Pipe'); - const req = new binding.PipeConnectWrap(); - testUninitialized(req, 'PipeConnectWrap'); - req.address = common.PIPE; - req.oncomplete = common.mustCall(() => handle.close()); - handle.connect(req, req.address, req.oncomplete); - testInitialized(req, 'PipeConnectWrap'); } +{ + const server = net.createServer(common.mustCall((socket) => { + server.close(); + })).listen(common.PIPE, common.mustCall(() => { + const binding = process.binding('pipe_wrap'); + const handle = new binding.Pipe(binding.constants.SOCKET); + testInitialized(handle, 'Pipe'); + const req = new binding.PipeConnectWrap(); + testUninitialized(req, 'PipeConnectWrap'); + req.address = common.PIPE; + req.oncomplete = common.mustCall(() => handle.close()); + handle.connect(req, req.address, req.oncomplete); + testInitialized(req, 'PipeConnectWrap'); + })); +} { const Process = process.binding('process_wrap').Process; @@ -173,13 +181,13 @@ if (common.hasCrypto) { // eslint-disable-line crypto-check const tcp_wrap = process.binding('tcp_wrap'); const server = net.createServer(common.mustCall((socket) => { server.close(); - socket.on('data', (x) => { + socket.on('data', () => { socket.end(); socket.destroy(); }); socket.resume(); })).listen(0, common.localhostIPv4, common.mustCall(() => { - const handle = new tcp_wrap.TCP(); + const handle = new tcp_wrap.TCP(tcp_wrap.constants.SOCKET); const req = new tcp_wrap.TCPConnectWrap(); const sreq = new stream_wrap.ShutdownWrap(); const wreq = new stream_wrap.WriteWrap(); @@ -221,8 +229,8 @@ if (common.hasCrypto) { // eslint-disable-line crypto-check if (common.hasCrypto) { // eslint-disable-line crypto-check - const TCP = process.binding('tcp_wrap').TCP; - const tcp = new TCP(); + const { TCP, constants: TCPConstants } = process.binding('tcp_wrap'); + const tcp = new TCP(TCPConstants.SOCKET); const ca = fixtures.readSync('test_ca.pem', 'ascii'); const cert = fixtures.readSync('test_cert.pem', 'ascii'); diff --git a/test/sequential/test-benchmark-buffer.js b/test/sequential/test-benchmark-buffer.js index 99a00c2ab84b31..26600cf4f26a87 100644 --- a/test/sequential/test-benchmark-buffer.js +++ b/test/sequential/test-benchmark-buffer.js @@ -8,6 +8,7 @@ runBenchmark('buffers', [ 'aligned=true', 'args=1', + 'buffer=fast', 'encoding=utf8', 'len=2', 'method=', diff --git a/test/sequential/test-child-process-pass-fd.js b/test/sequential/test-child-process-pass-fd.js index 8cc11f6c11f5b4..73e469cdede2be 100644 --- a/test/sequential/test-child-process-pass-fd.js +++ b/test/sequential/test-child-process-pass-fd.js @@ -1,11 +1,20 @@ 'use strict'; const common = require('../common'); + +// On some OS X versions, when passing fd's between processes: +// When the handle associated to a specific file descriptor is closed by the +// sender process before it's received in the destination, the handle is indeed +// closed while it should remain opened. In order to fix this behavior, don't +// close the handle until the `NODE_HANDLE_ACK` is received by the sender. +// This test is basically `test-cluster-net-send` but creating lots of workers +// so the issue reproduces on OS X consistently. + if ((process.config.variables.arm_version === '6') || (process.config.variables.arm_version === '7')) common.skip('Too slow for armv6 and armv7 bots'); const assert = require('assert'); -const fork = require('child_process').fork; +const { fork } = require('child_process'); const net = require('net'); const N = 80; @@ -46,14 +55,14 @@ if (process.argv[2] !== 'child') { process.on('message', common.mustCall()); const server = net.createServer((c) => { - process.once('message', function(msg) { + process.once('message', (msg) => { assert.strictEqual(msg, 'got'); c.end('hello'); }); socketConnected(); }).unref(); server.listen(0, common.localhostIPv4, () => { - const port = server.address().port; + const { port } = server.address(); socket = net.connect(port, common.localhostIPv4, socketConnected).unref(); }); } diff --git a/test/sequential/test-http-writable-true-after-close.js b/test/sequential/test-http-writable-true-after-close.js index 49688a00ef57a9..d0972673fb95e7 100644 --- a/test/sequential/test-http-writable-true-after-close.js +++ b/test/sequential/test-http-writable-true-after-close.js @@ -34,7 +34,7 @@ const server = createServer(common.mustCall((req, res) => { })); }).listen(0, () => { external = get(`http://127.0.0.1:${server.address().port}`); - external.on('error', common.mustCall((err) => { + external.on('error', common.mustCall(() => { server.close(); internal.close(); })); diff --git a/test/parallel/test-https-server-keep-alive-timeout.js b/test/sequential/test-https-server-keep-alive-timeout.js similarity index 100% rename from test/parallel/test-https-server-keep-alive-timeout.js rename to test/sequential/test-https-server-keep-alive-timeout.js diff --git a/test/sequential/test-inspector-async-stack-traces-promise-then.js b/test/sequential/test-inspector-async-stack-traces-promise-then.js index a321855b5ea613..9ed61d5ae13675 100644 --- a/test/sequential/test-inspector-async-stack-traces-promise-then.js +++ b/test/sequential/test-inspector-async-stack-traces-promise-then.js @@ -54,7 +54,7 @@ function debuggerPausedAt(msg, functionName, previousTickLocation) { `${Object.keys(msg.params)} contains "asyncStackTrace" property`); assert.strictEqual(msg.params.callFrames[0].functionName, functionName); - assert.strictEqual(msg.params.asyncStackTrace.description, 'PROMISE'); + assert.strictEqual(msg.params.asyncStackTrace.description, 'Promise.resolve'); const frameLocations = msg.params.asyncStackTrace.callFrames.map( (frame) => `${frame.functionName}:${frame.lineNumber}`); diff --git a/test/sequential/test-inspector-break-e.js b/test/sequential/test-inspector-break-e.js index 1a8f8ca50d3de1..9ae47253f49484 100644 --- a/test/sequential/test-inspector-break-e.js +++ b/test/sequential/test-inspector-break-e.js @@ -2,6 +2,7 @@ const common = require('../common'); common.skipIfInspectorDisabled(); +common.crashOnUnhandledRejection(); const assert = require('assert'); const { NodeInstance } = require('../common/inspector-helper.js'); diff --git a/test/sequential/test-inspector-contexts.js b/test/sequential/test-inspector-contexts.js index 54acfab0d5cace..c7db962f2af006 100644 --- a/test/sequential/test-inspector-contexts.js +++ b/test/sequential/test-inspector-contexts.js @@ -23,9 +23,18 @@ async function testContextCreatedAndDestroyed() { session.post('Runtime.enable'); let contextCreated = await mainContextPromise; - strictEqual('Node.js Main Context', - contextCreated.params.context.name, - JSON.stringify(contextCreated)); + { + const { name } = contextCreated.params.context; + if (common.isSunOS || common.isWindows) { + // uv_get_process_title() is unimplemented on Solaris-likes, it returns + // an empy string. On the Windows CI buildbots it returns "Administrator: + // Windows PowerShell[42]" because of a GetConsoleTitle() quirk. Not much + // we can do about either, just verify that it contains the PID. + strictEqual(name.includes(`[${process.pid}]`), true); + } else { + strictEqual(`${process.argv0}[${process.pid}]`, name); + } + } const secondContextCreatedPromise = notificationPromise('Runtime.executionContextCreated'); diff --git a/test/sequential/test-inspector-port-cluster.js b/test/sequential/test-inspector-port-cluster.js index 2428a7844e98c0..84ec408ebfb178 100644 --- a/test/sequential/test-inspector-port-cluster.js +++ b/test/sequential/test-inspector-port-cluster.js @@ -2,6 +2,7 @@ const common = require('../common'); +common.crashOnUnhandledRejection(); common.skipIfInspectorDisabled(); const assert = require('assert'); diff --git a/test/sequential/test-inspector-port-zero.js b/test/sequential/test-inspector-port-zero.js index a3eb08e5fb7a64..b7eb13ba13a68a 100644 --- a/test/sequential/test-inspector-port-zero.js +++ b/test/sequential/test-inspector-port-zero.js @@ -34,7 +34,10 @@ function test(arg, port = '') { }; proc.stdout.on('close', mustCall(() => onclose())); proc.stderr.on('close', mustCall(() => onclose())); - proc.on('exit', mustCall((exitCode) => assert.strictEqual(exitCode, 0))); + proc.on('exit', mustCall((exitCode, signal) => assert.strictEqual( + exitCode, + 0, + `exitCode: ${exitCode}, signal: ${signal}`))); } } diff --git a/test/sequential/test-inspector-stops-no-file.js b/test/sequential/test-inspector-stops-no-file.js index 772063b279f5af..9ec09fb15d93b4 100644 --- a/test/sequential/test-inspector-stops-no-file.js +++ b/test/sequential/test-inspector-stops-no-file.js @@ -7,7 +7,7 @@ const child = spawn(process.execPath, [ '--inspect', 'no-such-script.js' ], { 'stdio': 'inherit' }); -function signalHandler(value) { +function signalHandler() { child.kill(); process.exit(1); } diff --git a/test/sequential/test-net-GH-5504.js b/test/sequential/test-net-GH-5504.js index d744525710d2d5..ebe987d0443b6c 100644 --- a/test/sequential/test-net-GH-5504.js +++ b/test/sequential/test-net-GH-5504.js @@ -37,7 +37,7 @@ switch (process.argv[2]) { case 'server': return server(); case 'client': return client(); case undefined: return parent(); - default: throw new Error('wtf'); + default: throw new Error('invalid'); } function server() { diff --git a/test/sequential/test-next-tick-error-spin.js b/test/sequential/test-next-tick-error-spin.js index dc3a3a115d3b99..8bc323510a4da6 100644 --- a/test/sequential/test-next-tick-error-spin.js +++ b/test/sequential/test-next-tick-error-spin.js @@ -42,7 +42,7 @@ if (process.argv[2] !== 'child') { process.maxTickDepth = 10; // in the error handler, we trigger several MakeCallback events - d.on('error', function(e) { + d.on('error', function() { console.log('a'); console.log('b'); console.log('c'); diff --git a/test/sequential/test-readline-interface.js b/test/sequential/test-readline-interface.js index 1e64d0aa934974..5c1a0e08a13ae7 100644 --- a/test/sequential/test-readline-interface.js +++ b/test/sequential/test-readline-interface.js @@ -97,9 +97,7 @@ FakeInput.prototype.end = () => {}; crlfDelay }); let callCount = 0; - rli.on('line', function(line) { - callCount++; - }); + rli.on('line', () => callCount++); fi.emit('data', '\r'); setTimeout(common.mustCall(() => { fi.emit('data', '\n'); diff --git a/test/sequential/test-timers-block-eventloop.js b/test/sequential/test-timers-block-eventloop.js index 78ecc9e31746f5..f6426e454e0882 100644 --- a/test/sequential/test-timers-block-eventloop.js +++ b/test/sequential/test-timers-block-eventloop.js @@ -16,7 +16,7 @@ const t3 = setTimeout(common.mustNotCall('eventloop blocked!'), platformTimeout(200)); setTimeout(function() { - fs.stat('/dev/nonexistent', (err, stats) => { + fs.stat('/dev/nonexistent', () => { clearInterval(t1); clearInterval(t2); clearTimeout(t3); diff --git a/test/parallel/test-tls-connect.js b/test/sequential/test-tls-connect.js similarity index 100% rename from test/parallel/test-tls-connect.js rename to test/sequential/test-tls-connect.js diff --git a/test/parallel/test-tls-lookup.js b/test/sequential/test-tls-lookup.js similarity index 91% rename from test/parallel/test-tls-lookup.js rename to test/sequential/test-tls-lookup.js index fddbb20ee00f36..ff759cf2fe6bea 100644 --- a/test/parallel/test-tls-lookup.js +++ b/test/sequential/test-tls-lookup.js @@ -13,12 +13,12 @@ const tls = require('tls'); lookup: input }; - assert.throws(function() { + common.expectsError(function() { tls.connect(opts); - }, common.expectsError({ + }, { code: 'ERR_INVALID_ARG_TYPE', type: TypeError - })); + }); }); connectDoesNotThrow(common.mustCall(() => {})); diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py index f113c1253a477f..455d57f4d9157a 100644 --- a/test/testpy/__init__.py +++ b/test/testpy/__init__.py @@ -61,10 +61,7 @@ def GetCommand(self): source = open(self.file).read() flags_match = FLAGS_PATTERN.search(source) if flags_match: - # PORT should match the definition in test/common/index.js. - env = { 'PORT': int(os.getenv('NODE_COMMON_PORT', '12346')) } - env['PORT'] += self.thread_id * 100 - flag = flags_match.group(1).strip().format(**env).split() + flag = flags_match.group(1).strip().split() # The following block reads config.gypi to extract the v8_enable_inspector # value. This is done to check if the inspector is disabled in which case # the '--inspect' flag cannot be passed to the node process as it will diff --git a/tools/bootstrap/README.md b/tools/bootstrap/README.md new file mode 100644 index 00000000000000..a61e947a2af0b4 --- /dev/null +++ b/tools/bootstrap/README.md @@ -0,0 +1,55 @@ +# Node.js Bootstrapping Guide + +## Windows + +A [Boxstarter][] script can be used for easy setup of Windows systems with all +the required prerequisites for Node.js development. This script will install +the following [Chocolatey] packages: + * [Git for Windows][] with the `git` and Unix tools added to the `PATH` + * [Python 2.x][] + * [Visual Studio 2017 Build Tools][] with [Visual C++ workload][] + +To install Node.js prerequisites using [Boxstarter WebLauncher][], just open +[this link](http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter) +with Internet Explorer or Edge browser on the target machine. + +Alternatively, you can use PowerShell. Run those commands from an elevated +PowerShell terminal: +```console +Set-ExecutionPolicy Unrestricted -Force +iex ((New-Object System.Net.WebClient).DownloadString('http://boxstarter.org/bootstrapper.ps1')) +get-boxstarter -Force +Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter -DisableReboots +``` + +Entire installation will take up about 8 GB of disk space. + +## Linux + +For building Node.js on Linux, following packages are required (note, that this +can vary from distribution to distribution): + * `git` + * `python` + * `gcc-c++` or `g++` + * `make` + +To bootstrap Node.js on Linux, run in terminal: + * OpenSUSE: `sudo zypper install git python gcc-c++ make` + * Fedora: `sudo dnf install git python gcc-c++ make` + * Ubuntu, Debian: `sudo apt-get install git python g++ make` + +## macOS + +To install required tools on macOS, run in terminal: +```console +xcode-select --install +``` + +[Boxstarter]: http://boxstarter.org/ +[Boxstarter WebLauncher]: http://boxstarter.org/WebLauncher +[Chocolatey]: https://chocolatey.org/ +[Git for Windows]: https://chocolatey.org/packages/git +[Python 2.x]: https://chocolatey.org/packages/python2 +[Visual Studio 2017 Build Tools]: https://chocolatey.org/packages/visualstudio2017buildtools +[Visual C++ workload]: https://chocolatey.org/packages/visualstudio2017-workload-vctools + diff --git a/tools/bootstrap/windows_boxstarter b/tools/bootstrap/windows_boxstarter new file mode 100644 index 00000000000000..144c309ae11ad0 --- /dev/null +++ b/tools/bootstrap/windows_boxstarter @@ -0,0 +1,21 @@ +# Boxstarter (http://boxstarter.org/) script for Node.js prerequisites +# +# To install either open this link in IE or Edge: +# http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter +# +# Or run those commands in an elevated Powershell terminal: +# iex ((New-Object System.Net.WebClient).DownloadString('http://boxstarter.org/bootstrapper.ps1')) +# get-boxstarter -Force +# Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter -DisableReboots +# +# For more detail see +# https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md +# + +# Git and Unix tools will be added to the PATH +choco install git -params /GitAndUnixToolsOnPath -y +choco install python2 -y + +# Installs VS 2017 Build Tools +choco install visualstudio2017buildtools -y +choco install visualstudio2017-workload-vctools -y diff --git a/tools/cpplint.py b/tools/cpplint.py index ca42ddeb7bc477..460c1ecbfeb02f 100644 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -499,7 +499,6 @@ _ALT_TOKEN_REPLACEMENT_PATTERN = re.compile( r'[ =()](' + ('|'.join(_ALT_TOKEN_REPLACEMENT.keys())) + r')(?=[ (]|$)') - # These constants define types of headers for use with # _IncludeState.CheckNextIncludeOrder(). _C_SYS_HEADER = 1 @@ -526,6 +525,8 @@ # Match string that indicates we're working on a Linux Kernel file. _SEARCH_KERNEL_FILE = re.compile(r'\b(?:LINT_KERNEL_FILE)') +_NULL_TOKEN_PATTERN = re.compile(r'\bNULL\b') + _regexp_compile_cache = {} # {str, set(int)}: a map from error categories to sets of linenumbers @@ -4156,6 +4157,27 @@ def CheckAltTokens(filename, clean_lines, linenum, error): 'Use operator %s instead of %s' % ( _ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1))) +def CheckNullTokens(filename, clean_lines, linenum, error): + """Check NULL usage. + + Args: + filename: The name of the current file. + clean_lines: A CleansedLines instance containing the file. + linenum: The number of the line to check. + error: The function to call with any errors found. + """ + line = clean_lines.elided[linenum] + + # Avoid preprocessor lines + if Match(r'^\s*#', line): + return + + if line.find('/*') >= 0 or line.find('*/') >= 0: + return + + for match in _NULL_TOKEN_PATTERN.finditer(line): + error(filename, linenum, 'readability/null_usage', 2, + 'Use nullptr instead of NULL') def GetLineWidth(line): """Determines the width of the line in column positions. @@ -4294,6 +4316,7 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, CheckSpacingForFunctionCall(filename, clean_lines, linenum, error) CheckCheck(filename, clean_lines, linenum, error) CheckAltTokens(filename, clean_lines, linenum, error) + CheckNullTokens(filename, clean_lines, linenum, error) classinfo = nesting_state.InnermostClass() if classinfo: CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error) diff --git a/tools/doc/generate.js b/tools/doc/generate.js index 906aa962196306..f369427a8aaf19 100644 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -30,13 +30,13 @@ const fs = require('fs'); const args = process.argv.slice(2); let format = 'json'; let template = null; -let inputFile = null; +let filename = null; let nodeVersion = null; let analytics = null; args.forEach(function(arg) { if (!arg.startsWith('--')) { - inputFile = arg; + filename = arg; } else if (arg.startsWith('--format=')) { format = arg.replace(/^--format=/, ''); } else if (arg.startsWith('--template=')) { @@ -50,41 +50,32 @@ args.forEach(function(arg) { nodeVersion = nodeVersion || process.version; -if (!inputFile) { +if (!filename) { throw new Error('No input file specified'); } -fs.readFile(inputFile, 'utf8', function(er, input) { +fs.readFile(filename, 'utf8', (er, input) => { if (er) throw er; // process the input for @include lines - processIncludes(inputFile, input, next); + processIncludes(filename, input, next); }); function next(er, input) { if (er) throw er; switch (format) { case 'json': - require('./json.js')(input, inputFile, function(er, obj) { + require('./json.js')(input, filename, (er, obj) => { console.log(JSON.stringify(obj, null, 2)); if (er) throw er; }); break; case 'html': - require('./html.js')( - { - input: input, - filename: inputFile, - template: template, - nodeVersion: nodeVersion, - analytics: analytics, - }, - - function(er, html) { - if (er) throw er; - console.log(html); - } - ); + require('./html')({ input, filename, template, nodeVersion, analytics }, + (err, html) => { + if (err) throw err; + console.log(html); + }); break; default: diff --git a/tools/doc/html.js b/tools/doc/html.js index e25192599593f3..f2d3fcdbba6860 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -125,9 +125,7 @@ function toID(filename) { * opts: lexed, filename, template, nodeVersion. */ function render(opts, cb) { - var lexed = opts.lexed; - var filename = opts.filename; - var template = opts.template; + var { lexed, filename, template } = opts; const nodeVersion = opts.nodeVersion || process.version; // get the section @@ -418,7 +416,7 @@ const BSD_ONLY_SYSCALLS = new Set(['lchmod']); // 'open(2)' function linkManPages(text) { return text.replace( - / ([a-z.]+)\((\d)([a-z]?)\)/gm, + /\b([a-z.]+)\((\d)([a-z]?)\)/gm, (match, name, number, optionalCharacter) => { // name consists of lowercase letters, number is a single digit const displayAs = `${name}(${number}${optionalCharacter})`; diff --git a/tools/doc/node_modules/.bin/marked b/tools/doc/node_modules/.bin/marked deleted file mode 120000 index a8d872e9dc1fd9..00000000000000 --- a/tools/doc/node_modules/.bin/marked +++ /dev/null @@ -1 +0,0 @@ -../marked/bin/marked \ No newline at end of file diff --git a/tools/doc/node_modules/marked/lib/marked.js b/tools/doc/node_modules/marked/lib/marked.js index 03251f3c58a761..32521d993497ae 100644 --- a/tools/doc/node_modules/marked/lib/marked.js +++ b/tools/doc/node_modules/marked/lib/marked.js @@ -1094,7 +1094,8 @@ function escape(html, encode) { } function unescape(html) { - return html.replace(/&([#\w]+);/g, function(_, n) { + // explicitly match decimal, hex, and named HTML entities + return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g, function(_, n) { n = n.toLowerCase(); if (n === 'colon') return ':'; if (n.charAt(0) === '#') { diff --git a/tools/doc/node_modules/marked/package.json b/tools/doc/node_modules/marked/package.json index d631092cb80f42..81ab0639d2b1dc 100644 --- a/tools/doc/node_modules/marked/package.json +++ b/tools/doc/node_modules/marked/package.json @@ -1,38 +1,27 @@ { - "_args": [ - [ - "marked", - "/Users/firedfox/git/node/tools/doc" - ] - ], - "_from": "marked@latest", - "_id": "marked@0.3.5", - "_inCache": true, - "_installable": true, + "_from": "marked@^0.3.5", + "_id": "marked@0.3.6", + "_inBundle": false, + "_integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc=", "_location": "/marked", - "_nodeVersion": "0.12.7", - "_npmUser": { - "email": "chjjeffrey@gmail.com", - "name": "chjj" - }, - "_npmVersion": "2.13.2", "_phantomChildren": {}, "_requested": { + "type": "range", + "registry": true, + "raw": "marked@^0.3.5", "name": "marked", - "raw": "marked", - "rawSpec": "", - "scope": null, - "spec": "latest", - "type": "tag" + "escapedName": "marked", + "rawSpec": "^0.3.5", + "saveSpec": null, + "fetchSpec": "^0.3.5" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/marked/-/marked-0.3.5.tgz", - "_shasum": "4113a15ac5d7bca158a5aae07224587b9fa15b94", - "_shrinkwrap": null, - "_spec": "marked", - "_where": "/Users/firedfox/git/node/tools/doc", + "_resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz", + "_shasum": "b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7", + "_spec": "marked@^0.3.5", + "_where": "/mnt/d/code/node-github-desktop/tools/doc", "author": { "name": "Christopher Jeffrey" }, @@ -42,7 +31,8 @@ "bugs": { "url": "http://github.com/chjj/marked/issues" }, - "dependencies": {}, + "bundleDependencies": false, + "deprecated": false, "description": "A markdown parser built for speed", "devDependencies": { "gulp": "^3.8.11", @@ -51,12 +41,6 @@ "markdown": "*", "showdown": "*" }, - "directories": {}, - "dist": { - "shasum": "4113a15ac5d7bca158a5aae07224587b9fa15b94", - "tarball": "https://registry.npmjs.org/marked/-/marked-0.3.5.tgz" - }, - "gitHead": "88ce4df47c4d994dc1b1df1477a21fb893e11ddc", "homepage": "https://github.com/chjj/marked", "keywords": [ "markdown", @@ -65,19 +49,11 @@ ], "license": "MIT", "main": "./lib/marked.js", - "maintainers": [ - { - "email": "chjjeffrey@gmail.com", - "name": "chjj" - } - ], "man": [ "./man/marked.1" ], "name": "marked", - "optionalDependencies": {}, "preferGlobal": true, - "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "git://github.com/chjj/marked.git" @@ -91,5 +67,5 @@ "markup", "html" ], - "version": "0.3.5" + "version": "0.3.6" } diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json new file mode 100644 index 00000000000000..67bdbe87faf361 --- /dev/null +++ b/tools/doc/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "node-doc-generator", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "marked": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz", + "integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc=" + } + } +} diff --git a/tools/doc/package.json b/tools/doc/package.json index 15b8531e1f8052..d33943eacddbbd 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -7,10 +7,11 @@ "node": ">=6" }, "dependencies": { - "marked": "^0.3.5", + "marked": "^0.3.5" + }, + "devDependencies": { "js-yaml": "^3.5.2" }, - "devDependencies": {}, "optionalDependencies": {}, "bin": "./generate.js" } diff --git a/tools/doc/preprocess.js b/tools/doc/preprocess.js index 35348d583b0f0a..652f12a9f05472 100644 --- a/tools/doc/preprocess.js +++ b/tools/doc/preprocess.js @@ -10,11 +10,7 @@ const includeData = {}; function preprocess(inputFile, input, cb) { input = stripComments(input); - processIncludes(inputFile, input, function(err, data) { - if (err) return cb(err); - - cb(null, data); - }); + processIncludes(inputFile, input, cb); } function stripComments(input) { diff --git a/tools/eslint-rules/buffer-constructor.js b/tools/eslint-rules/buffer-constructor.js index 938598e8dbf618..412fdaa934664b 100644 --- a/tools/eslint-rules/buffer-constructor.js +++ b/tools/eslint-rules/buffer-constructor.js @@ -10,16 +10,11 @@ const msg = 'Use of the Buffer() constructor has been deprecated. ' + 'Please use either Buffer.alloc(), Buffer.allocUnsafe(), ' + 'or Buffer.from()'; - -function test(context, node) { - if (node.callee.name === 'Buffer') { - context.report(node, msg); - } -} +const astSelector = 'NewExpression[callee.name="Buffer"],' + + 'CallExpression[callee.name="Buffer"]'; module.exports = function(context) { return { - 'NewExpression': (node) => test(context, node), - 'CallExpression': (node) => test(context, node) + [astSelector]: (node) => context.report(node, msg) }; }; diff --git a/tools/eslint-rules/no-let-in-for-declaration.js b/tools/eslint-rules/no-let-in-for-declaration.js index 34ad2d5761fda2..1ae49a48dee8a2 100644 --- a/tools/eslint-rules/no-let-in-for-declaration.js +++ b/tools/eslint-rules/no-let-in-for-declaration.js @@ -11,46 +11,28 @@ //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ +const message = 'Use of `let` as the loop variable in a for-loop is ' + + 'not recommended. Please use `var` instead.'; +const forSelector = 'ForStatement[init.kind="let"]'; +const forInOfSelector = 'ForOfStatement[left.kind="let"],' + + 'ForInStatement[left.kind="let"]'; module.exports = { create(context) { const sourceCode = context.getSourceCode(); - const msg = 'Use of `let` as the loop variable in a for-loop is ' + - 'not recommended. Please use `var` instead.'; - - /** - * Report function to test if the for-loop is declared using `let`. - */ - function testForLoop(node) { - if (node.init && node.init.kind === 'let') { - context.report({ - node: node.init, - message: msg, - fix: (fixer) => - fixer.replaceText(sourceCode.getFirstToken(node.init), 'var') - }); - } - } - /** - * Report function to test if the for-in or for-of loop - * is declared using `let`. - */ - function testForInOfLoop(node) { - if (node.left && node.left.kind === 'let') { - context.report({ - node: node.left, - message: msg, - fix: (fixer) => - fixer.replaceText(sourceCode.getFirstToken(node.left), 'var') - }); - } + function report(node) { + context.report({ + node, + message, + fix: (fixer) => + fixer.replaceText(sourceCode.getFirstToken(node), 'var') + }); } return { - 'ForStatement': testForLoop, - 'ForInStatement': testForInOfLoop, - 'ForOfStatement': testForInOfLoop + [forSelector]: (node) => report(node.init), + [forInOfSelector]: (node) => report(node.left), }; } }; diff --git a/tools/eslint-rules/prefer-assert-methods.js b/tools/eslint-rules/prefer-assert-methods.js index fa345eb7c3fc33..0604fd3ed99046 100644 --- a/tools/eslint-rules/prefer-assert-methods.js +++ b/tools/eslint-rules/prefer-assert-methods.js @@ -1,15 +1,8 @@ 'use strict'; -function isAssert(node) { - return node.expression && - node.expression.type === 'CallExpression' && - node.expression.callee && - node.expression.callee.name === 'assert'; -} - -function getFirstArg(expression) { - return expression.arguments && expression.arguments[0]; -} +const astSelector = 'ExpressionStatement[expression.type="CallExpression"]' + + '[expression.callee.name="assert"]' + + '[expression.arguments.0.type="BinaryExpression"]'; function parseError(method, op) { return `'assert.${method}' should be used instead of '${op}'`; @@ -24,15 +17,11 @@ const preferedAssertMethod = { module.exports = function(context) { return { - ExpressionStatement(node) { - if (isAssert(node)) { - const arg = getFirstArg(node.expression); - if (arg && arg.type === 'BinaryExpression') { - const assertMethod = preferedAssertMethod[arg.operator]; - if (assertMethod) { - context.report(node, parseError(assertMethod, arg.operator)); - } - } + [astSelector]: function(node) { + const arg = node.expression.arguments[0]; + const assertMethod = preferedAssertMethod[arg.operator]; + if (assertMethod) { + context.report(node, parseError(assertMethod, arg.operator)); } } }; diff --git a/tools/eslint-rules/prefer-common-expectserror.js b/tools/eslint-rules/prefer-common-expectserror.js new file mode 100644 index 00000000000000..f33241697a68ef --- /dev/null +++ b/tools/eslint-rules/prefer-common-expectserror.js @@ -0,0 +1,21 @@ +'use strict'; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const msg = 'Please use common.expectsError(fn, err) instead of ' + + 'assert.throws(fn, common.expectsError(err)).'; + +const astSelector = + 'CallExpression[arguments.length=2]' + + '[callee.object.name="assert"]' + + '[callee.property.name="throws"]' + + '[arguments.1.callee.object.name="common"]' + + '[arguments.1.callee.property.name="expectsError"]'; + +module.exports = function(context) { + return { + [astSelector]: (node) => context.report(node, msg) + }; +}; diff --git a/tools/eslint-rules/prefer-common-mustnotcall.js b/tools/eslint-rules/prefer-common-mustnotcall.js index 6bc428ed59a8b8..ef3c5fb729f31f 100644 --- a/tools/eslint-rules/prefer-common-mustnotcall.js +++ b/tools/eslint-rules/prefer-common-mustnotcall.js @@ -10,30 +10,21 @@ const msg = 'Please use common.mustNotCall(msg) instead of ' + 'common.mustCall(fn, 0) or common.mustCall(0).'; - -function isCommonMustCall(node) { - return node && - node.callee && - node.callee.object && - node.callee.object.name === 'common' && - node.callee.property && - node.callee.property.name === 'mustCall'; -} - -function isArgZero(argument) { - return argument && - typeof argument.value === 'number' && - argument.value === 0; -} +const mustCallSelector = 'CallExpression[callee.object.name="common"]' + + '[callee.property.name="mustCall"]'; +const arg0Selector = `${mustCallSelector}[arguments.0.value=0]`; +const arg1Selector = `${mustCallSelector}[arguments.1.value=0]`; module.exports = function(context) { + function report(node) { + context.report(node, msg); + } + return { - CallExpression(node) { - if (isCommonMustCall(node) && - (isArgZero(node.arguments[0]) || // catch common.mustCall(0) - isArgZero(node.arguments[1]))) { // catch common.mustCall(fn, 0) - context.report(node, msg); - } - } + // Catch common.mustCall(0) + [arg0Selector]: report, + + // Catch common.mustCall(fn, 0) + [arg1Selector]: report }; }; diff --git a/tools/eslint-rules/prefer-util-format-errors.js b/tools/eslint-rules/prefer-util-format-errors.js new file mode 100644 index 00000000000000..f6993e627782dd --- /dev/null +++ b/tools/eslint-rules/prefer-util-format-errors.js @@ -0,0 +1,44 @@ +'use strict'; + +const errMsg = 'Please use a printf-like formatted string that util.format' + + ' can consume.'; + +function isArrowFunctionWithTemplateLiteral(node) { + return node.type === 'ArrowFunctionExpression' && + node.body.type === 'TemplateLiteral'; +} + +function isDefiningError(node) { + return node.expression && + node.expression.type === 'CallExpression' && + node.expression.callee && + node.expression.callee.name === 'E'; +} + +module.exports = { + create: function(context) { + return { + ExpressionStatement: function(node) { + if (!isDefiningError(node)) + return; + + const msg = node.expression.arguments[1]; + if (!isArrowFunctionWithTemplateLiteral(msg)) + return; + + // Checks to see if order of arguments to function is the same as the + // order of them being concatenated in the template string. The idea is + // that if both match, then you can use `util.format`-style args. + // Would pass rule: (a, b) => `${b}${a}`. + // Would fail rule: (a, b) => `${a}${b}`, and needs to be rewritten. + const { expressions } = msg.body; + const hasSequentialParams = msg.params.every((param, index) => { + const expr = expressions[index]; + return expr && expr.type === 'Identifier' && param.name === expr.name; + }); + if (hasSequentialParams) + context.report(msg, errMsg); + } + }; + } +}; diff --git a/tools/eslint-rules/require-buffer.js b/tools/eslint-rules/require-buffer.js index c9818cb758f7bd..c6040b43a181fb 100644 --- a/tools/eslint-rules/require-buffer.js +++ b/tools/eslint-rules/require-buffer.js @@ -1,10 +1,26 @@ 'use strict'; +const BUFFER_REQUIRE = 'const { Buffer } = require(\'buffer\');\n'; module.exports = function(context) { + function flagIt(reference) { const msg = 'Use const Buffer = require(\'buffer\').Buffer; ' + 'at the beginning of this file'; - context.report(reference.identifier, msg); + + context.report({ + node: reference.identifier, + message: msg, + fix: (fixer) => { + const sourceCode = context.getSourceCode(); + + const useStrict = /'use strict';\n\n?/g; + const hasUseStrict = !!useStrict.exec(sourceCode.text); + const firstLOC = sourceCode.ast.range[0]; + const rangeNeedle = hasUseStrict ? useStrict.lastIndex : firstLOC; + + return fixer.insertTextBeforeRange([rangeNeedle], BUFFER_REQUIRE); + } + }); } return { diff --git a/tools/eslint/README.md b/tools/eslint/README.md index 9da7d9cceab8cb..5a23d6295deff4 100644 --- a/tools/eslint/README.md +++ b/tools/eslint/README.md @@ -116,6 +116,7 @@ These folks keep the project moving and are resources for help. * Alberto Rodríguez ([@alberto](https://github.com/alberto)) * Kai Cataldo ([@kaicataldo](https://github.com/kaicataldo)) * Teddy Katz ([@not-an-aardvark](https://github.com/not-an-aardvark)) +* Kevin Partington ([@platinumazure](https://github.com/platinumazure)) ### Development Team @@ -130,7 +131,6 @@ These folks keep the project moving and are resources for help. * Henry Zhu ([@hzoo](https://github.com/hzoo)) * Marat Dulin ([@mdevils](https://github.com/mdevils)) * Alexej Yaroshevich ([@zxqfox](https://github.com/zxqfox)) -* Kevin Partington ([@platinumazure](https://github.com/platinumazure)) * Vitor Balocco ([@vitorbal](https://github.com/vitorbal)) * James Henry ([@JamesHenry](https://github.com/JamesHenry)) * Reyad Attiyat ([@soda0289](https://github.com/soda0289)) @@ -225,7 +225,7 @@ In all cases, make sure your plugins' peerDependencies have been installed as we ### Does ESLint support JSX? -Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/user-guide/configuring).). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics. +Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](https://eslint.org/docs/user-guide/configuring)). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics. ### What about ECMAScript 6 support? diff --git a/tools/eslint/conf/default-cli-options.js b/tools/eslint/conf/default-cli-options.js index 6e4a113003ec99..7d46d46c521049 100644 --- a/tools/eslint/conf/default-cli-options.js +++ b/tools/eslint/conf/default-cli-options.js @@ -17,9 +17,11 @@ module.exports = { ignorePath: null, cache: false, - // in order to honor the cacheFile option if specified - // this option should not have a default value otherwise - // it will always be used + /* + * in order to honor the cacheFile option if specified + * this option should not have a default value otherwise + * it will always be used + */ cacheLocation: "", cacheFile: ".eslintcache", fix: false, diff --git a/tools/eslint/conf/environments.js b/tools/eslint/conf/environments.js index a11f2963dc97d7..44f2e0dee56e4c 100644 --- a/tools/eslint/conf/environments.js +++ b/tools/eslint/conf/environments.js @@ -17,10 +17,126 @@ const globals = require("globals"); module.exports = { builtin: globals.es5, browser: { - globals: globals.browser + + /* + * For backward compatibility. + * Remove those on the next major release. + */ + globals: Object.assign( + { + AutocompleteErrorEvent: false, + CDATASection: false, + ClientRect: false, + ClientRectList: false, + CSSAnimation: false, + CSSTransition: false, + CSSUnknownRule: false, + CSSViewportRule: false, + Debug: false, + DocumentTimeline: false, + DOMSettableTokenList: false, + ElementTimeControl: false, + FederatedCredential: false, + FileError: false, + HTMLAppletElement: false, + HTMLBlockquoteElement: false, + HTMLIsIndexElement: false, + HTMLKeygenElement: false, + HTMLLayerElement: false, + IDBEnvironment: false, + InputMethodContext: false, + MediaKeyError: false, + MediaKeyEvent: false, + MediaKeys: false, + opera: false, + PasswordCredential: false, + ReadableByteStream: false, + SharedKeyframeList: false, + showModalDialog: false, + SiteBoundCredential: false, + SVGAltGlyphDefElement: false, + SVGAltGlyphElement: false, + SVGAltGlyphItemElement: false, + SVGAnimateColorElement: false, + SVGAnimatedPathData: false, + SVGAnimatedPoints: false, + SVGColor: false, + SVGColorProfileElement: false, + SVGColorProfileRule: false, + SVGCSSRule: false, + SVGCursorElement: false, + SVGDocument: false, + SVGElementInstance: false, + SVGElementInstanceList: false, + SVGEvent: false, + SVGExternalResourcesRequired: false, + SVGFilterPrimitiveStandardAttributes: false, + SVGFitToViewBox: false, + SVGFontElement: false, + SVGFontFaceElement: false, + SVGFontFaceFormatElement: false, + SVGFontFaceNameElement: false, + SVGFontFaceSrcElement: false, + SVGFontFaceUriElement: false, + SVGGlyphElement: false, + SVGGlyphRefElement: false, + SVGHKernElement: false, + SVGICCColor: false, + SVGLangSpace: false, + SVGLocatable: false, + SVGMissingGlyphElement: false, + SVGPaint: false, + SVGPathSeg: false, + SVGPathSegArcAbs: false, + SVGPathSegArcRel: false, + SVGPathSegClosePath: false, + SVGPathSegCurvetoCubicAbs: false, + SVGPathSegCurvetoCubicRel: false, + SVGPathSegCurvetoCubicSmoothAbs: false, + SVGPathSegCurvetoCubicSmoothRel: false, + SVGPathSegCurvetoQuadraticAbs: false, + SVGPathSegCurvetoQuadraticRel: false, + SVGPathSegCurvetoQuadraticSmoothAbs: false, + SVGPathSegCurvetoQuadraticSmoothRel: false, + SVGPathSegLinetoAbs: false, + SVGPathSegLinetoHorizontalAbs: false, + SVGPathSegLinetoHorizontalRel: false, + SVGPathSegLinetoRel: false, + SVGPathSegLinetoVerticalAbs: false, + SVGPathSegLinetoVerticalRel: false, + SVGPathSegList: false, + SVGPathSegMovetoAbs: false, + SVGPathSegMovetoRel: false, + SVGRenderingIntent: false, + SVGStylable: false, + SVGTests: false, + SVGTransformable: false, + SVGTRefElement: false, + SVGURIReference: false, + SVGViewSpec: false, + SVGVKernElement: false, + SVGZoomAndPan: false, + SVGZoomEvent: false, + TimeEvent: false, + XDomainRequest: false, + XMLHttpRequestProgressEvent: false, + XPathException: false, + XPathNamespace: false, + XPathNSResolver: false + }, + globals.browser + ) }, node: { - globals: globals.node, + + /* + * For backward compatibility. + * Remove those on the next major release. + */ + globals: Object.assign( + { arguments: false, GLOBAL: false, root: false }, + globals.node + ), parserOptions: { ecmaFeatures: { globalReturn: true @@ -51,7 +167,15 @@ module.exports = { globals: globals.jasmine }, jest: { - globals: globals.jest + + /* + * For backward compatibility. + * Remove those on the next major release. + */ + globals: Object.assign( + { check: false, gen: false }, + globals.jest + ) }, phantomjs: { globals: globals.phantomjs @@ -96,7 +220,7 @@ module.exports = { globals: globals.webextensions }, es6: { - globals: globals.es6, + globals: globals.es2015, parserOptions: { ecmaVersion: 6 } diff --git a/tools/eslint/conf/eslint-recommended.js b/tools/eslint/conf/eslint-recommended.js index 8421b9d38867a4..0acee234a56b87 100755 --- a/tools/eslint/conf/eslint-recommended.js +++ b/tools/eslint/conf/eslint-recommended.js @@ -53,6 +53,7 @@ module.exports = { "id-blacklist": "off", "id-length": "off", "id-match": "off", + "implicit-arrow-linebreak": "off", indent: "off", "indent-legacy": "off", "init-declarations": "off", diff --git a/tools/eslint/lib/ast-utils.js b/tools/eslint/lib/ast-utils.js index fc0471e9a4a7c6..a186bdee54df51 100644 --- a/tools/eslint/lib/ast-utils.js +++ b/tools/eslint/lib/ast-utils.js @@ -406,6 +406,31 @@ function createGlobalLinebreakMatcher() { return new RegExp(LINEBREAK_MATCHER.source, "g"); } +/** + * Checks whether or not the tokens of two given nodes are same. + * @param {ASTNode} left - A node 1 to compare. + * @param {ASTNode} right - A node 2 to compare. + * @param {SourceCode} sourceCode - The ESLint source code object. + * @returns {boolean} the source code for the given node. + */ +function equalTokens(left, right, sourceCode) { + const tokensL = sourceCode.getTokens(left); + const tokensR = sourceCode.getTokens(right); + + if (tokensL.length !== tokensR.length) { + return false; + } + for (let i = 0; i < tokensL.length; ++i) { + if (tokensL[i].type !== tokensR[i].type || + tokensL[i].value !== tokensR[i].value + ) { + return false; + } + } + + return true; +} + //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ @@ -438,6 +463,7 @@ module.exports = { isArrayFromMethod, isParenthesised, createGlobalLinebreakMatcher, + equalTokens, isArrowToken, isClosingBraceToken, @@ -620,15 +646,17 @@ module.exports = { node = parent; break; - // If the upper function is IIFE, checks the destination of the return value. - // e.g. - // obj.foo = (function() { - // // setup... - // return function foo() { ... }; - // })(); - // obj.foo = (() => - // function foo() { ... } - // )(); + /* + * If the upper function is IIFE, checks the destination of the return value. + * e.g. + * obj.foo = (function() { + * // setup... + * return function foo() { ... }; + * })(); + * obj.foo = (() => + * function foo() { ... } + * )(); + */ case "ReturnStatement": { const func = getUpperFunction(parent); @@ -645,23 +673,27 @@ module.exports = { node = parent.parent; break; - // e.g. - // var obj = { foo() { ... } }; - // var obj = { foo: function() { ... } }; - // class A { constructor() { ... } } - // class A { foo() { ... } } - // class A { get foo() { ... } } - // class A { set foo() { ... } } - // class A { static foo() { ... } } + /* + * e.g. + * var obj = { foo() { ... } }; + * var obj = { foo: function() { ... } }; + * class A { constructor() { ... } } + * class A { foo() { ... } } + * class A { get foo() { ... } } + * class A { set foo() { ... } } + * class A { static foo() { ... } } + */ case "Property": case "MethodDefinition": return parent.value !== node; - // e.g. - // obj.foo = function foo() { ... }; - // Foo = function() { ... }; - // [obj.foo = function foo() { ... }] = a; - // [Foo = function() { ... }] = a; + /* + * e.g. + * obj.foo = function foo() { ... }; + * Foo = function() { ... }; + * [obj.foo = function foo() { ... }] = a; + * [Foo = function() { ... }] = a; + */ case "AssignmentExpression": case "AssignmentPattern": if (parent.left.type === "MemberExpression") { @@ -676,8 +708,10 @@ module.exports = { } return true; - // e.g. - // var Foo = function() { ... }; + /* + * e.g. + * var Foo = function() { ... }; + */ case "VariableDeclarator": return !( isAnonymous && @@ -686,10 +720,12 @@ module.exports = { startsWithUpperCase(parent.id.name) ); - // e.g. - // var foo = function foo() { ... }.bind(obj); - // (function foo() { ... }).call(obj); - // (function foo() { ... }).apply(obj, []); + /* + * e.g. + * var foo = function foo() { ... }.bind(obj); + * (function foo() { ... }).call(obj); + * (function foo() { ... }).apply(obj, []); + */ case "MemberExpression": return ( parent.object !== node || @@ -700,10 +736,12 @@ module.exports = { isNullOrUndefined(parent.parent.arguments[0]) ); - // e.g. - // Reflect.apply(function() {}, obj, []); - // Array.from([], function() {}, obj); - // list.forEach(function() {}, obj); + /* + * e.g. + * Reflect.apply(function() {}, obj, []); + * Array.from([], function() {}, obj); + * list.forEach(function() {}, obj); + */ case "CallExpression": if (isReflectApply(parent.callee)) { return ( @@ -930,8 +968,10 @@ module.exports = { node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || - // Do not check arrow functions with implicit return. - // `() => "use strict";` returns the string `"use strict"`. + /* + * Do not check arrow functions with implicit return. + * `() => "use strict";` returns the string `"use strict"`. + */ (node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement") ) { const statements = node.type === "Program" ? node.body : node.body.body; @@ -954,7 +994,7 @@ module.exports = { /** * Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added - after the node will be parsed as a decimal point, rather than a property-access dot. + * after the node will be parsed as a decimal point, rather than a property-access dot. * @param {ASTNode} node - The node to check. * @returns {boolean} `true` if this node is a decimal integer. * @example @@ -1183,12 +1223,12 @@ module.exports = { }, /** - * Gets the parenthesized text of a node. This is similar to sourceCode.getText(node), but it also includes any parentheses - * surrounding the node. - * @param {SourceCode} sourceCode The source code object - * @param {ASTNode} node An expression node - * @returns {string} The text representing the node, with all surrounding parentheses included - */ + * Gets the parenthesized text of a node. This is similar to sourceCode.getText(node), but it also includes any parentheses + * surrounding the node. + * @param {SourceCode} sourceCode The source code object + * @param {ASTNode} node An expression node + * @returns {string} The text representing the node, with all surrounding parentheses included + */ getParenthesisedText(sourceCode, node) { let leftToken = sourceCode.getFirstToken(node); let rightToken = sourceCode.getLastToken(node); diff --git a/tools/eslint/lib/cli-engine.js b/tools/eslint/lib/cli-engine.js index 5fc35ae0ac8339..55450fd633e283 100644 --- a/tools/eslint/lib/cli-engine.js +++ b/tools/eslint/lib/cli-engine.js @@ -24,12 +24,16 @@ const fs = require("fs"), fileEntryCache = require("file-entry-cache"), globUtil = require("./util/glob-util"), validator = require("./config/config-validator"), - stringify = require("json-stable-stringify"), + stringify = require("json-stable-stringify-without-jsonify"), hash = require("./util/hash"), + ModuleResolver = require("./util/module-resolver"), + naming = require("./util/naming"), pkg = require("../package.json"); const debug = require("debug")("eslint:cli-engine"); +const resolver = new ModuleResolver(); + //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ @@ -405,9 +409,13 @@ class CLIEngine { }); } - Object.keys(this.options.rules || {}).forEach(name => { - validator.validateRuleOptions(name, this.options.rules[name], "CLI", this.linter.rules); - }); + if (this.options.rules && Object.keys(this.options.rules).length) { + const loadedRules = this.linter.getRules(); + + Object.keys(this.options.rules).forEach(name => { + validator.validateRuleOptions(loadedRules.get(name), name, this.options.rules[name], "CLI"); + }); + } this.config = new Config(this.options, this.linter); } @@ -542,10 +550,10 @@ class CLIEngine { if (result.messages.length) { /* - * if a file contains errors or warnings we don't want to - * store the file in the cache so we can guarantee that - * next execution will also operate on this file - */ + * if a file contains errors or warnings we don't want to + * store the file in the cache so we can guarantee that + * next execution will also operate on this file + */ fileCache.removeEntry(result.filePath); } else { @@ -670,15 +678,22 @@ class CLIEngine { // replace \ with / for Windows compatibility format = format.replace(/\\/g, "/"); + const cwd = this.options ? this.options.cwd : process.cwd(); + const namespace = naming.getNamespaceFromTerm(format); + let formatterPath; // if there's a slash, then it's a file - if (format.indexOf("/") > -1) { - const cwd = this.options ? this.options.cwd : process.cwd(); - + if (!namespace && format.indexOf("/") > -1) { formatterPath = path.resolve(cwd, format); } else { - formatterPath = `./formatters/${format}`; + try { + const npmFormat = naming.normalizePackageName(format, "eslint-formatter"); + + formatterPath = resolver.resolve(npmFormat, `${cwd}/node_modules`); + } catch (e) { + formatterPath = `./formatters/${format}`; + } } try { diff --git a/tools/eslint/lib/code-path-analysis/code-path-analyzer.js b/tools/eslint/lib/code-path-analysis/code-path-analyzer.js index 899f240bc4533c..1a4f7870baaab4 100644 --- a/tools/eslint/lib/code-path-analysis/code-path-analyzer.js +++ b/tools/eslint/lib/code-path-analysis/code-path-analyzer.js @@ -598,8 +598,10 @@ class CodePathAnalyzer { preprocess(this, node); } - // Updates the code path. - // And emits onCodePathStart/onCodePathSegmentStart events. + /* + * Updates the code path. + * And emits onCodePathStart/onCodePathSegmentStart events. + */ processCodePathToEnter(this, node); // Emits node events. @@ -618,8 +620,10 @@ class CodePathAnalyzer { leaveNode(node) { this.currentNode = node; - // Updates the code path. - // And emits onCodePathStart/onCodePathSegmentStart events. + /* + * Updates the code path. + * And emits onCodePathStart/onCodePathSegmentStart events. + */ processCodePathToExit(this, node); // Emits node events. diff --git a/tools/eslint/lib/code-path-analysis/code-path-segment.js b/tools/eslint/lib/code-path-analysis/code-path-segment.js index 9de4264b1304ab..8145f9280162bb 100644 --- a/tools/eslint/lib/code-path-analysis/code-path-segment.js +++ b/tools/eslint/lib/code-path-analysis/code-path-segment.js @@ -141,8 +141,10 @@ class CodePathSegment { static newUnreachable(id, allPrevSegments) { const segment = new CodePathSegment(id, CodePathSegment.flattenUnusedSegments(allPrevSegments), false); - // In `if (a) return a; foo();` case, the unreachable segment preceded by - // the return statement is not used but must not be remove. + /* + * In `if (a) return a; foo();` case, the unreachable segment preceded by + * the return statement is not used but must not be remove. + */ CodePathSegment.markUsed(segment); return segment; diff --git a/tools/eslint/lib/code-path-analysis/code-path-state.js b/tools/eslint/lib/code-path-analysis/code-path-state.js index 068caca9e6dd88..0c31e2072b00ae 100644 --- a/tools/eslint/lib/code-path-analysis/code-path-state.js +++ b/tools/eslint/lib/code-path-analysis/code-path-state.js @@ -774,8 +774,10 @@ class CodePathState { // Sets the normal path as the next. this.forkContext.replaceHead(normalSegments); - // If both paths of the `try` block and the `catch` block are - // unreachable, the next path becomes unreachable as well. + /* + * If both paths of the `try` block and the `catch` block are + * unreachable, the next path becomes unreachable as well. + */ if (!context.lastOfTryIsReachable && !context.lastOfCatchIsReachable) { this.forkContext.makeUnreachable(); } diff --git a/tools/eslint/lib/config.js b/tools/eslint/lib/config.js index c20522f6b36bfb..b66b9f41e0d8f4 100644 --- a/tools/eslint/lib/config.js +++ b/tools/eslint/lib/config.js @@ -120,10 +120,10 @@ class Config { } /** - * Loads the config options from a config specified on the command line. - * @param {string} [config] A shareable named config or path to a config file. - * @returns {void} - */ + * Loads the config options from a config specified on the command line. + * @param {string} [config] A shareable named config or path to a config file. + * @returns {void} + */ loadSpecificConfig(config) { if (config) { debug(`Using command line config ${config}`); @@ -216,8 +216,10 @@ class Config { return localConfigHierarchy; } - // Don't consider the personal config file in the home directory, - // except if the home directory is the same as the current working directory + /* + * Don't consider the personal config file in the home directory, + * except if the home directory is the same as the current working directory + */ if (localConfigDirectory === PERSONAL_CONFIG_DIR && localConfigFile !== projectConfigPath) { continue; } @@ -343,8 +345,10 @@ class Config { this.plugins.loadAll(this.cliConfig.plugins); } - // Step 3: Override parser only if it is passed explicitly through the command line - // or if it's not defined yet (because the final object will at least have the parser key) + /* + * Step 3: Override parser only if it is passed explicitly through the command line + * or if it's not defined yet (because the final object will at least have the parser key) + */ if (this.parser || !config.parser) { config = ConfigOps.merge(config, { parser: this.parser }); } diff --git a/tools/eslint/lib/config/autoconfig.js b/tools/eslint/lib/config/autoconfig.js index 6614a1bc48b984..8536fdc55ad733 100644 --- a/tools/eslint/lib/config/autoconfig.js +++ b/tools/eslint/lib/config/autoconfig.js @@ -61,13 +61,13 @@ function makeRegistryItems(rulesConfig) { } /** -* Creates an object in which to store rule configs and error counts -* -* Unless a rulesConfig is provided at construction, the registry will not contain -* any rules, only methods. This will be useful for building up registries manually. -* -* Registry class -*/ + * Creates an object in which to store rule configs and error counts + * + * Unless a rulesConfig is provided at construction, the registry will not contain + * any rules, only methods. This will be useful for building up registries manually. + * + * Registry class + */ class Registry { /** @@ -293,11 +293,13 @@ class Registry { lintResults.forEach(result => { - // It is possible that the error is from a configuration comment - // in a linted file, in which case there may not be a config - // set in this ruleSetIdx. - // (https://github.com/eslint/eslint/issues/5992) - // (https://github.com/eslint/eslint/issues/7860) + /* + * It is possible that the error is from a configuration comment + * in a linted file, in which case there may not be a config + * set in this ruleSetIdx. + * (https://github.com/eslint/eslint/issues/5992) + * (https://github.com/eslint/eslint/issues/7860) + */ if ( lintedRegistry.rules[result.ruleId] && lintedRegistry.rules[result.ruleId][ruleSetIdx] diff --git a/tools/eslint/lib/config/config-file.js b/tools/eslint/lib/config/config-file.js index 87412dd2a2d6b9..c5ff073cfcb9a2 100644 --- a/tools/eslint/lib/config/config-file.js +++ b/tools/eslint/lib/config/config-file.js @@ -13,11 +13,11 @@ const fs = require("fs"), path = require("path"), ConfigOps = require("./config-ops"), validator = require("./config-validator"), - pathUtil = require("../util/path-util"), ModuleResolver = require("../util/module-resolver"), + naming = require("../util/naming"), pathIsInside = require("path-is-inside"), stripComments = require("strip-json-comments"), - stringify = require("json-stable-stringify"), + stringify = require("json-stable-stringify-without-jsonify"), requireUncached = require("require-uncached"); const debug = require("debug")("eslint:config-file"); @@ -29,7 +29,7 @@ const debug = require("debug")("eslint:config-file"); /** * Determines sort order for object keys for json-stable-stringify * - * see: https://github.com/substack/json-stable-stringify#cmp + * see: https://github.com/samn/json-stable-stringify#cmp * * @param {Object} a The first comparison object ({key: akey, value: avalue}) * @param {Object} b The second comparison object ({key: bkey, value: bvalue}) @@ -436,50 +436,6 @@ function applyExtends(config, configContext, filePath, relativeTo) { return config; } -/** - * Brings package name to correct format based on prefix - * @param {string} name The name of the package. - * @param {string} prefix Can be either "eslint-plugin" or "eslint-config - * @returns {string} Normalized name of the package - * @private - */ -function normalizePackageName(name, prefix) { - - /* - * On Windows, name can come in with Windows slashes instead of Unix slashes. - * Normalize to Unix first to avoid errors later on. - * https://github.com/eslint/eslint/issues/5644 - */ - if (name.indexOf("\\") > -1) { - name = pathUtil.convertPathToPosix(name); - } - - if (name.charAt(0) === "@") { - - /* - * it's a scoped package - * package name is "eslint-config", or just a username - */ - const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`), - scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`); - - if (scopedPackageShortcutRegex.test(name)) { - name = name.replace(scopedPackageShortcutRegex, `$1/${prefix}`); - } else if (!scopedPackageNameRegex.test(name.split("/")[1])) { - - /* - * for scoped packages, insert the eslint-config after the first / unless - * the path is already @scope/eslint or @scope/eslint-config-xxx - */ - name = name.replace(/^@([^/]+)\/(.*)$/, `@$1/${prefix}-$2`); - } - } else if (name.indexOf(`${prefix}-`) !== 0) { - name = `${prefix}-${name}`; - } - - return name; -} - /** * Resolves a configuration file path into the fully-formed path, whether filename * or package name. @@ -505,12 +461,12 @@ function resolve(filePath, relativeTo) { const pluginName = filePath.slice(7, filePath.lastIndexOf("/")); const configName = filePath.slice(filePath.lastIndexOf("/") + 1); - normalizedPackageName = normalizePackageName(pluginName, "eslint-plugin"); + normalizedPackageName = naming.normalizePackageName(pluginName, "eslint-plugin"); debug(`Attempting to resolve ${normalizedPackageName}`); filePath = resolver.resolve(normalizedPackageName, getLookupPath(relativeTo)); return { filePath, configName, configFullName }; } - normalizedPackageName = normalizePackageName(filePath, "eslint-config"); + normalizedPackageName = naming.normalizePackageName(filePath, "eslint-config"); debug(`Attempting to resolve ${normalizedPackageName}`); filePath = resolver.resolve(normalizedPackageName, getLookupPath(relativeTo)); return { filePath, configFullName: filePath }; @@ -545,8 +501,10 @@ function loadFromDisk(resolvedPath, configContext) { } } + const ruleMap = configContext.linterContext.getRules(); + // validate the configuration before continuing - validator.validate(config, resolvedPath.configFullName, configContext.linterContext.rules, configContext.linterContext.environments); + validator.validate(config, resolvedPath.configFullName, ruleMap.get.bind(ruleMap), configContext.linterContext.environments); /* * If an `extends` property is defined, it represents a configuration file to use as @@ -614,7 +572,6 @@ module.exports = { resolve, write, applyExtends, - normalizePackageName, CONFIG_FILES, /** diff --git a/tools/eslint/lib/config/config-initializer.js b/tools/eslint/lib/config/config-initializer.js index 47139e06e3c2df..e4865a008cac4d 100644 --- a/tools/eslint/lib/config/config-initializer.js +++ b/tools/eslint/lib/config/config-initializer.js @@ -201,14 +201,18 @@ function configureRules(answers, config) { // Now that we know which rules to disable, strip out configs with errors registry = registry.stripFailingConfigs(); - // If there is only one config that results in no errors for a rule, we should use it. - // createConfig will only add rules that have one configuration in the registry. + /* + * If there is only one config that results in no errors for a rule, we should use it. + * createConfig will only add rules that have one configuration in the registry. + */ const singleConfigs = registry.createConfig().rules; - // The "sweet spot" for number of options in a config seems to be two (severity plus one option). - // Very often, a third option (usually an object) is available to address - // edge cases, exceptions, or unique situations. We will prefer to use a config with - // specificity of two. + /* + * The "sweet spot" for number of options in a config seems to be two (severity plus one option). + * Very often, a third option (usually an object) is available to address + * edge cases, exceptions, or unique situations. We will prefer to use a config with + * specificity of two. + */ const specTwoConfigs = registry.filterBySpecificity(2).createConfig().rules; // Maybe a specific combination using all three options works diff --git a/tools/eslint/lib/config/config-ops.js b/tools/eslint/lib/config/config-ops.js index 4ed5ec6b02e352..2ce500a4f479cb 100644 --- a/tools/eslint/lib/config/config-ops.js +++ b/tools/eslint/lib/config/config-ops.js @@ -105,27 +105,27 @@ module.exports = { merge: function deepmerge(target, src, combine, isRule) { /* - The MIT License (MIT) - - Copyright (c) 2012 Nicholas Fisher - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. + * The MIT License (MIT) + * + * Copyright (c) 2012 Nicholas Fisher + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ /* diff --git a/tools/eslint/lib/config/config-rule.js b/tools/eslint/lib/config/config-rule.js index 174b34a47d6bb0..5fc38ac5d17a17 100644 --- a/tools/eslint/lib/config/config-rule.js +++ b/tools/eslint/lib/config/config-rule.js @@ -187,19 +187,19 @@ class RuleConfigSet { constructor(configs) { /** - * Stored valid rule configurations for this instance - * @type {array} - */ + * Stored valid rule configurations for this instance + * @type {array} + */ this.ruleConfigs = configs || []; } /** - * Add a severity level to the front of all configs in the instance. - * This should only be called after all configs have been added to the instance. - * - * @param {number} [severity=2] The level of severity for the rule (0, 1, 2) - * @returns {void} - */ + * Add a severity level to the front of all configs in the instance. + * This should only be called after all configs have been added to the instance. + * + * @param {number} [severity=2] The level of severity for the rule (0, 1, 2) + * @returns {void} + */ addErrorSeverity(severity) { severity = severity || 2; @@ -213,19 +213,19 @@ class RuleConfigSet { } /** - * Add rule configs from an array of strings (schema enums) - * @param {string[]} enums Array of valid rule options (e.g. ["always", "never"]) - * @returns {void} - */ + * Add rule configs from an array of strings (schema enums) + * @param {string[]} enums Array of valid rule options (e.g. ["always", "never"]) + * @returns {void} + */ addEnums(enums) { this.ruleConfigs = this.ruleConfigs.concat(combineArrays(this.ruleConfigs, enums)); } /** - * Add rule configurations from a schema object - * @param {Object} obj Schema item with type === "object" - * @returns {boolean} true if at least one schema for the object could be generated, false otherwise - */ + * Add rule configurations from a schema object + * @param {Object} obj Schema item with type === "object" + * @returns {boolean} true if at least one schema for the object could be generated, false otherwise + */ addObject(obj) { const objectConfigSet = { objectConfigs: [], @@ -267,10 +267,10 @@ class RuleConfigSet { } /** -* Generate valid rule configurations based on a schema object -* @param {Object} schema A rule's schema object -* @returns {array[]} Valid rule configurations -*/ + * Generate valid rule configurations based on a schema object + * @param {Object} schema A rule's schema object + * @returns {array[]} Valid rule configurations + */ function generateConfigsFromSchema(schema) { const configSet = new RuleConfigSet(); @@ -296,9 +296,9 @@ function generateConfigsFromSchema(schema) { } /** -* Generate possible rule configurations for all of the core rules -* @returns {rulesConfig} Hash of rule names and arrays of possible configurations -*/ + * Generate possible rule configurations for all of the core rules + * @returns {rulesConfig} Hash of rule names and arrays of possible configurations + */ function createCoreRuleConfigs() { const ruleList = loadRules(); diff --git a/tools/eslint/lib/config/config-validator.js b/tools/eslint/lib/config/config-validator.js index 22bc1efbd0d235..3d98b510455537 100644 --- a/tools/eslint/lib/config/config-validator.js +++ b/tools/eslint/lib/config/config-validator.js @@ -14,9 +14,7 @@ const ajv = require("../util/ajv"), configSchema = require("../../conf/config-schema.js"), util = require("util"); -const validators = { - rules: Object.create(null) -}; +const ruleValidators = new WeakMap(); //------------------------------------------------------------------------------ // Private @@ -25,13 +23,11 @@ let validateSchema; /** * Gets a complete options schema for a rule. - * @param {string} id The rule's unique name. - * @param {Rules} rulesContext Rule context + * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object * @returns {Object} JSON Schema for the rule's options. */ -function getRuleOptionsSchema(id, rulesContext) { - const rule = rulesContext.get(id), - schema = rule && rule.schema || rule && rule.meta && rule.meta.schema; +function getRuleOptionsSchema(rule) { + const schema = rule.schema || rule.meta && rule.meta.schema; // Given a tuple of schemas, insert warning level at the beginning if (Array.isArray(schema)) { @@ -56,10 +52,10 @@ function getRuleOptionsSchema(id, rulesContext) { } /** -* Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. -* @param {options} options The given options for the rule. -* @returns {number|string} The rule's severity value -*/ + * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. + * @param {options} options The given options for the rule. + * @returns {number|string} The rule's severity value + */ function validateRuleSeverity(options) { const severity = Array.isArray(options) ? options[0] : options; @@ -71,46 +67,52 @@ function validateRuleSeverity(options) { } /** -* Validates the non-severity options passed to a rule, based on its schema. -* @param {string} id The rule's unique name -* @param {array} localOptions The options for the rule, excluding severity -* @param {Rules} rulesContext Rule context -* @returns {void} -*/ -function validateRuleSchema(id, localOptions, rulesContext) { - const schema = getRuleOptionsSchema(id, rulesContext); - - if (!validators.rules[id] && schema) { - validators.rules[id] = ajv.compile(schema); + * Validates the non-severity options passed to a rule, based on its schema. + * @param {{create: Function}} rule The rule to validate + * @param {array} localOptions The options for the rule, excluding severity + * @returns {void} + */ +function validateRuleSchema(rule, localOptions) { + if (!ruleValidators.has(rule)) { + const schema = getRuleOptionsSchema(rule); + + if (schema) { + ruleValidators.set(rule, ajv.compile(schema)); + } } - const validateRule = validators.rules[id]; + const validateRule = ruleValidators.get(rule); if (validateRule) { validateRule(localOptions); if (validateRule.errors) { - throw new Error(validateRule.errors.map(error => `\tValue "${error.data}" ${error.message}.\n`).join("")); + throw new Error(validateRule.errors.map( + error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` + ).join("")); } } } /** * Validates a rule's options against its schema. - * @param {string} id The rule's unique name. + * @param {{create: Function}|null} rule The rule that the config is being validated for + * @param {string} ruleId The rule's unique name. * @param {array|number} options The given options for the rule. * @param {string} source The name of the configuration source to report in any errors. - * @param {Rules} rulesContext Rule context * @returns {void} */ -function validateRuleOptions(id, options, source, rulesContext) { +function validateRuleOptions(rule, ruleId, options, source) { + if (!rule) { + return; + } try { const severity = validateRuleSeverity(options); if (severity !== 0 && !(typeof severity === "string" && severity.toLowerCase() === "off")) { - validateRuleSchema(id, Array.isArray(options) ? options.slice(1) : [], rulesContext); + validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); } } catch (err) { - throw new Error(`${source}:\n\tConfiguration for rule "${id}" is invalid:\n${err.message}`); + throw new Error(`${source}:\n\tConfiguration for rule "${ruleId}" is invalid:\n${err.message}`); } } @@ -141,16 +143,16 @@ function validateEnvironment(environment, source, envContext) { * Validates a rules config object * @param {Object} rulesConfig The rules config object to validate. * @param {string} source The name of the configuration source to report in any errors. - * @param {Rules} rulesContext Rule context + * @param {function(string): {create: Function}} ruleMapper A mapper function from strings to loaded rules * @returns {void} */ -function validateRules(rulesConfig, source, rulesContext) { +function validateRules(rulesConfig, source, ruleMapper) { if (!rulesConfig) { return; } Object.keys(rulesConfig).forEach(id => { - validateRuleOptions(id, rulesConfig[id], source, rulesContext); + validateRuleOptions(ruleMapper(id), id, rulesConfig[id], source); }); } @@ -221,13 +223,13 @@ function validateConfigSchema(config, source) { * Validates an entire config object. * @param {Object} config The config object to validate. * @param {string} source The name of the configuration source to report in any errors. - * @param {Rules} rulesContext The rules context + * @param {function(string): {create: Function}} ruleMapper A mapper function from rule IDs to defined rules * @param {Environments} envContext The env context * @returns {void} */ -function validate(config, source, rulesContext, envContext) { +function validate(config, source, ruleMapper, envContext) { validateConfigSchema(config, source); - validateRules(config.rules, source, rulesContext); + validateRules(config.rules, source, ruleMapper); validateEnvironment(config.env, source, envContext); } diff --git a/tools/eslint/lib/config/plugins.js b/tools/eslint/lib/config/plugins.js index 9884f360391a55..c509c48fe25ce4 100644 --- a/tools/eslint/lib/config/plugins.js +++ b/tools/eslint/lib/config/plugins.js @@ -9,13 +9,13 @@ //------------------------------------------------------------------------------ const debug = require("debug")("eslint:plugins"); +const naming = require("../util/naming"); //------------------------------------------------------------------------------ // Private //------------------------------------------------------------------------------ -const PLUGIN_NAME_PREFIX = "eslint-plugin-", - NAMESPACE_REGEX = /^@.*\//i; +const PLUGIN_NAME_PREFIX = "eslint-plugin-"; //------------------------------------------------------------------------------ // Public Interface @@ -37,33 +37,6 @@ class Plugins { this._rules = rulesContext; } - /** - * Removes the prefix `eslint-plugin-` from a plugin name. - * @param {string} pluginName The name of the plugin which may have the prefix. - * @returns {string} The name of the plugin without prefix. - */ - static removePrefix(pluginName) { - return pluginName.startsWith(PLUGIN_NAME_PREFIX) ? pluginName.slice(PLUGIN_NAME_PREFIX.length) : pluginName; - } - - /** - * Gets the scope (namespace) of a plugin. - * @param {string} pluginName The name of the plugin which may have the prefix. - * @returns {string} The name of the plugins namepace if it has one. - */ - static getNamespace(pluginName) { - return pluginName.match(NAMESPACE_REGEX) ? pluginName.match(NAMESPACE_REGEX)[0] : ""; - } - - /** - * Removes the namespace from a plugin name. - * @param {string} pluginName The name of the plugin which may have the prefix. - * @returns {string} The name of the plugin without the namespace. - */ - static removeNamespace(pluginName) { - return pluginName.replace(NAMESPACE_REGEX, ""); - } - /** * Defines a plugin with a given name rather than loading from disk. * @param {string} pluginName The name of the plugin to load. @@ -71,9 +44,9 @@ class Plugins { * @returns {void} */ define(pluginName, plugin) { - const pluginNamespace = Plugins.getNamespace(pluginName), - pluginNameWithoutNamespace = Plugins.removeNamespace(pluginName), - pluginNameWithoutPrefix = Plugins.removePrefix(pluginNameWithoutNamespace), + const pluginNamespace = naming.getNamespaceFromTerm(pluginName), + pluginNameWithoutNamespace = naming.removeNamespaceFromTerm(pluginName), + pluginNameWithoutPrefix = naming.removePrefixFromTerm(PLUGIN_NAME_PREFIX, pluginNameWithoutNamespace), shortName = pluginNamespace + pluginNameWithoutPrefix; // load up environments and rules @@ -106,9 +79,9 @@ class Plugins { * @throws {Error} If the plugin cannot be loaded. */ load(pluginName) { - const pluginNamespace = Plugins.getNamespace(pluginName), - pluginNameWithoutNamespace = Plugins.removeNamespace(pluginName), - pluginNameWithoutPrefix = Plugins.removePrefix(pluginNameWithoutNamespace), + const pluginNamespace = naming.getNamespaceFromTerm(pluginName), + pluginNameWithoutNamespace = naming.removeNamespaceFromTerm(pluginName), + pluginNameWithoutPrefix = naming.removePrefixFromTerm(PLUGIN_NAME_PREFIX, pluginNameWithoutNamespace), shortName = pluginNamespace + pluginNameWithoutPrefix, longName = pluginNamespace + PLUGIN_NAME_PREFIX + pluginNameWithoutPrefix; let plugin = null; diff --git a/tools/eslint/lib/formatters/checkstyle.js b/tools/eslint/lib/formatters/checkstyle.js index c807871930bdec..720e831a3ecd67 100644 --- a/tools/eslint/lib/formatters/checkstyle.js +++ b/tools/eslint/lib/formatters/checkstyle.js @@ -32,7 +32,7 @@ module.exports = function(results) { let output = ""; - output += ""; + output += ""; output += ""; results.forEach(result => { diff --git a/tools/eslint/lib/formatters/jslint-xml.js b/tools/eslint/lib/formatters/jslint-xml.js index 14743430d8ff94..e152d8bdd71bff 100644 --- a/tools/eslint/lib/formatters/jslint-xml.js +++ b/tools/eslint/lib/formatters/jslint-xml.js @@ -14,7 +14,7 @@ module.exports = function(results) { let output = ""; - output += ""; + output += ""; output += ""; results.forEach(result => { diff --git a/tools/eslint/lib/formatters/junit.js b/tools/eslint/lib/formatters/junit.js index 069ed5ff8f072d..ca666bb14c6ceb 100644 --- a/tools/eslint/lib/formatters/junit.js +++ b/tools/eslint/lib/formatters/junit.js @@ -32,29 +32,35 @@ module.exports = function(results) { let output = ""; - output += "\n"; + output += "\n"; output += "\n"; results.forEach(result => { const messages = result.messages; - output += `\n`; - messages.forEach(message => { - const type = message.fatal ? "error" : "failure"; + if (messages.length > 0) { + output += `\n`; + messages.forEach(message => { + const type = message.fatal ? "error" : "failure"; - output += ``; - output += `<${type} message="${xmlEscape(message.message || "")}">`; - output += ""; - output += ``; - output += "\n"; - }); - output += "\n"; + output += ``; + output += `<${type} message="${xmlEscape(message.message || "")}">`; + output += ""; + output += ``; + output += "\n"; + }); + output += "\n"; + } else { + output += `\n`; + output += `\n`; + output += "\n"; + } }); diff --git a/tools/eslint/lib/formatters/tap.js b/tools/eslint/lib/formatters/tap.js index 06699257b583c3..9651a2bcf12cee 100644 --- a/tools/eslint/lib/formatters/tap.js +++ b/tools/eslint/lib/formatters/tap.js @@ -63,9 +63,11 @@ module.exports = function(results) { } }; - // If we have multiple messages place them under a messages key - // The first error will be logged as message key - // This is to adhere to TAP 13 loosely defined specification of having a message key + /* + * If we have multiple messages place them under a messages key + * The first error will be logged as message key + * This is to adhere to TAP 13 loosely defined specification of having a message key + */ if ("message" in diagnostics) { if (typeof diagnostics.messages === "undefined") { diagnostics.messages = []; diff --git a/tools/eslint/lib/ignored-paths.js b/tools/eslint/lib/ignored-paths.js index f43ce4642287c3..c02e83bc2a527e 100644 --- a/tools/eslint/lib/ignored-paths.js +++ b/tools/eslint/lib/ignored-paths.js @@ -114,8 +114,10 @@ class IgnoredPaths { default: ignore() }; - // Add a way to keep track of ignored files. This was present in node-ignore - // 2.x, but dropped for now as of 3.0.10. + /* + * Add a way to keep track of ignored files. This was present in node-ignore + * 2.x, but dropped for now as of 3.0.10. + */ this.ig.custom.ignoreFiles = []; this.ig.default.ignoreFiles = []; diff --git a/tools/eslint/lib/linter.js b/tools/eslint/lib/linter.js index 089f0bb2503f4d..21d62f73ae6a3b 100755 --- a/tools/eslint/lib/linter.js +++ b/tools/eslint/lib/linter.js @@ -111,8 +111,10 @@ function parseJsonConfig(string, location) { // ignore to parse the string by a fallback. } - // Optionator cannot parse commaless notations. - // But we are supporting that. So this is a fallback for that. + /* + * Optionator cannot parse commaless notations. + * But we are supporting that. So this is a fallback for that. + */ items = {}; string = string.replace(/([a-zA-Z0-9\-/]+):/g, "\"$1\":").replace(/(]|[0-9])\s+(?=")/, "$1,"); try { @@ -276,7 +278,7 @@ function createDisableDirectives(type, loc, value) { * @param {string} filename The file being checked. * @param {ASTNode} ast The top node of the AST. * @param {Object} config The existing configuration data. - * @param {Linter} linterContext Linter context object + * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules * @returns {{ * config: Object, * problems: Problem[], @@ -289,7 +291,7 @@ function createDisableDirectives(type, loc, value) { * }} Modified config object, along with any problems encountered * while parsing config comments */ -function modifyConfigsFromComments(filename, ast, config, linterContext) { +function modifyConfigsFromComments(filename, ast, config, ruleMapper) { const commentConfig = { exported: {}, @@ -335,7 +337,7 @@ function modifyConfigsFromComments(filename, ast, config, linterContext) { Object.keys(parseResult.config).forEach(name => { const ruleValue = parseResult.config[name]; - validator.validateRuleOptions(name, ruleValue, `${filename} line ${comment.loc.start.line}`, linterContext.rules); + validator.validateRuleOptions(ruleMapper(name), name, ruleValue, `${filename} line ${comment.loc.start.line}`); commentRules[name] = ruleValue; }); } else { @@ -379,8 +381,10 @@ function normalizeEcmaVersion(ecmaVersion, isModule) { ecmaVersion = 6; } - // Calculate ECMAScript edition number from official year version starting with - // ES2015, which corresponds with ES6 (or a difference of 2009). + /* + * Calculate ECMAScript edition number from official year version starting with + * ES2015, which corresponds with ES6 (or a difference of 2009). + */ if (ecmaVersion >= 2015) { ecmaVersion -= 2009; } @@ -503,13 +507,13 @@ function getRuleOptions(ruleConfig) { * as possible * @param {string} text The text to parse. * @param {Object} providedParserOptions Options to pass to the parser - * @param {string} parserName The name of the parser + * @param {Object} parser The parser module * @param {string} filePath The path to the file being parsed. * @returns {{success: false, error: Problem}|{success: true,ast: ASTNode, services: Object}} * An object containing the AST and parser services if parsing was successful, or the error if parsing failed * @private */ -function parse(text, providedParserOptions, parserName, filePath) { +function parse(text, providedParserOptions, parser, filePath) { const parserOptions = Object.assign({}, providedParserOptions, { loc: true, @@ -520,25 +524,6 @@ function parse(text, providedParserOptions, parserName, filePath) { filePath }); - let parser; - - try { - parser = require(parserName); - } catch (ex) { - return { - success: false, - error: { - ruleId: null, - fatal: true, - severity: 2, - source: null, - message: ex.message, - line: 0, - column: 0 - } - }; - } - /* * Check for parsing errors first. If there's a parsing error, nothing * else can happen. However, a parsing error does not throw an error @@ -702,6 +687,7 @@ module.exports = class Linter { this.version = pkg.version; this.rules = new Rules(); + this._parsers = new Map(); this.environments = new Environments(); } @@ -781,10 +767,25 @@ module.exports = class Linter { return []; } + let parser; + + try { + parser = this._parsers.get(config.parser) || require(config.parser); + } catch (ex) { + return [{ + ruleId: null, + fatal: true, + severity: 2, + source: null, + message: ex.message, + line: 0, + column: 0 + }]; + } const parseResult = parse( stripUnicodeBOM(text).replace(astUtils.SHEBANG_MATCHER, (match, captured) => `//${captured}`), config.parserOptions, - config.parser, + parser, filename ); @@ -802,7 +803,7 @@ module.exports = class Linter { // parse global comments and modify config if (allowInlineConfig !== false) { - const modifyConfigResult = modifyConfigsFromComments(filename, sourceCode.ast, config, this); + const modifyConfigResult = modifyConfigsFromComments(filename, sourceCode.ast, config, ruleId => this.rules.get(ruleId)); config = modifyConfigResult.config; modifyConfigResult.problems.forEach(problem => problems.push(problem)); @@ -1032,6 +1033,16 @@ module.exports = class Linter { return this.rules.getAllLoadedRules(); } + /** + * Define a new parser module + * @param {any} parserId Name of the parser + * @param {any} parserModule The parser object + * @returns {void} + */ + defineParser(parserId, parserModule) { + this._parsers.set(parserId, parserModule); + } + /** * Performs multiple autofix passes over the text until as many fixes as possible * have been applied. @@ -1076,8 +1087,10 @@ module.exports = class Linter { debug(`Generating fixed text for ${debugTextDescription} (pass ${passNumber})`); fixedResult = SourceCodeFixer.applyFixes(text, messages, shouldFix); - // stop if there are any syntax errors. - // 'fixedResult.output' is a empty string. + /* + * stop if there are any syntax errors. + * 'fixedResult.output' is a empty string. + */ if (messages.length === 1 && messages[0].fatal) { break; } diff --git a/tools/eslint/lib/rules/.eslintrc.yml b/tools/eslint/lib/rules/.eslintrc.yml index 22d3a30ce32e1e..2a8d907935b5f7 100644 --- a/tools/eslint/lib/rules/.eslintrc.yml +++ b/tools/eslint/lib/rules/.eslintrc.yml @@ -1,3 +1,3 @@ rules: - internal-no-invalid-meta: "error" - internal-consistent-docs-description: "error" + rulesdir/no-invalid-meta: "error" + rulesdir/consistent-docs-description: "error" diff --git a/tools/eslint/lib/rules/array-bracket-newline.js b/tools/eslint/lib/rules/array-bracket-newline.js index 5115ef4b568c05..cb7350a825057f 100644 --- a/tools/eslint/lib/rules/array-bracket-newline.js +++ b/tools/eslint/lib/rules/array-bracket-newline.js @@ -96,11 +96,11 @@ module.exports = { } /** - * Reports that there shouldn't be a linebreak after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there shouldn't be a linebreak after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportNoBeginningLinebreak(node, token) { context.report({ node, @@ -119,11 +119,11 @@ module.exports = { } /** - * Reports that there shouldn't be a linebreak before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there shouldn't be a linebreak before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportNoEndingLinebreak(node, token) { context.report({ node, @@ -142,11 +142,11 @@ module.exports = { } /** - * Reports that there should be a linebreak after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a linebreak after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredBeginningLinebreak(node, token) { context.report({ node, @@ -159,11 +159,11 @@ module.exports = { } /** - * Reports that there should be a linebreak before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a linebreak before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredEndingLinebreak(node, token) { context.report({ node, diff --git a/tools/eslint/lib/rules/array-bracket-spacing.js b/tools/eslint/lib/rules/array-bracket-spacing.js index 73cfbdc3c1fa8e..aecef2c4f2099e 100644 --- a/tools/eslint/lib/rules/array-bracket-spacing.js +++ b/tools/eslint/lib/rules/array-bracket-spacing.js @@ -66,11 +66,11 @@ module.exports = { //-------------------------------------------------------------------------- /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportNoBeginningSpace(node, token) { context.report({ node, @@ -88,11 +88,11 @@ module.exports = { } /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportNoEndingSpace(node, token) { context.report({ node, @@ -110,11 +110,11 @@ module.exports = { } /** - * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredBeginningSpace(node, token) { context.report({ node, @@ -130,11 +130,11 @@ module.exports = { } /** - * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredEndingSpace(node, token) { context.report({ node, @@ -150,19 +150,19 @@ module.exports = { } /** - * Determines if a node is an object type - * @param {ASTNode} node - The node to check. - * @returns {boolean} Whether or not the node is an object type. - */ + * Determines if a node is an object type + * @param {ASTNode} node - The node to check. + * @returns {boolean} Whether or not the node is an object type. + */ function isObjectType(node) { return node && (node.type === "ObjectExpression" || node.type === "ObjectPattern"); } /** - * Determines if a node is an array type - * @param {ASTNode} node - The node to check. - * @returns {boolean} Whether or not the node is an array type. - */ + * Determines if a node is an array type + * @param {ASTNode} node - The node to check. + * @returns {boolean} Whether or not the node is an array type. + */ function isArrayType(node) { return node && (node.type === "ArrayExpression" || node.type === "ArrayPattern"); } diff --git a/tools/eslint/lib/rules/array-callback-return.js b/tools/eslint/lib/rules/array-callback-return.js index cf64a98e327e7e..37d6ebe3a72343 100644 --- a/tools/eslint/lib/rules/array-callback-return.js +++ b/tools/eslint/lib/rules/array-callback-return.js @@ -85,12 +85,14 @@ function isCallbackOfArrayMethod(node) { node = parent; break; - // If the upper function is IIFE, checks the destination of the return value. - // e.g. - // foo.every((function() { - // // setup... - // return function callback() { ... }; - // })()); + /* + * If the upper function is IIFE, checks the destination of the return value. + * e.g. + * foo.every((function() { + * // setup... + * return function callback() { ... }; + * })()); + */ case "ReturnStatement": { const func = astUtils.getUpperFunction(parent); @@ -101,9 +103,11 @@ function isCallbackOfArrayMethod(node) { break; } - // e.g. - // Array.from([], function() {}); - // list.every(function() {}); + /* + * e.g. + * Array.from([], function() {}); + * list.every(function() {}); + */ case "CallExpression": if (astUtils.isArrayFromMethod(parent.callee)) { return ( diff --git a/tools/eslint/lib/rules/array-element-newline.js b/tools/eslint/lib/rules/array-element-newline.js index 8cccae082e2917..26dc9bfa0b6af3 100644 --- a/tools/eslint/lib/rules/array-element-newline.js +++ b/tools/eslint/lib/rules/array-element-newline.js @@ -87,10 +87,10 @@ module.exports = { } /** - * Reports that there shouldn't be a line break after the first token - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there shouldn't be a line break after the first token + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportNoLineBreak(token) { const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true }); @@ -136,10 +136,10 @@ module.exports = { } /** - * Reports that there should be a line break after the first token - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a line break after the first token + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredLineBreak(token) { const tokenBefore = sourceCode.getTokenBefore(token, { includeComments: true }); diff --git a/tools/eslint/lib/rules/arrow-body-style.js b/tools/eslint/lib/rules/arrow-body-style.js index 1630b893720c88..78a391334d7a51 100644 --- a/tools/eslint/lib/rules/arrow-body-style.js +++ b/tools/eslint/lib/rules/arrow-body-style.js @@ -132,8 +132,10 @@ module.exports = { sourceCode.commentsExistBetween(openingBrace, firstValueToken) || sourceCode.commentsExistBetween(lastValueToken, closingBrace); - // Remove tokens around the return value. - // If comments don't exist, remove extra spaces as well. + /* + * Remove tokens around the return value. + * If comments don't exist, remove extra spaces as well. + */ if (commentsExist) { fixes.push( fixer.remove(openingBrace), @@ -147,8 +149,10 @@ module.exports = { ); } - // If the first token of the reutrn value is `{`, - // enclose the return value by parentheses to avoid syntax error. + /* + * If the first token of the reutrn value is `{`, + * enclose the return value by parentheses to avoid syntax error. + */ if (astUtils.isOpeningBraceToken(firstValueToken)) { fixes.push( fixer.insertTextBefore(firstValueToken, "("), @@ -156,8 +160,10 @@ module.exports = { ); } - // If the last token of the return statement is semicolon, remove it. - // Non-block arrow body is an expression, not a statement. + /* + * If the last token of the return statement is semicolon, remove it. + * Non-block arrow body is an expression, not a statement. + */ if (astUtils.isSemicolonToken(lastValueToken)) { fixes.push(fixer.remove(lastValueToken)); } diff --git a/tools/eslint/lib/rules/arrow-parens.js b/tools/eslint/lib/rules/arrow-parens.js index a756baa46b3678..e8f8ddd8e76583 100644 --- a/tools/eslint/lib/rules/arrow-parens.js +++ b/tools/eslint/lib/rules/arrow-parens.js @@ -67,8 +67,10 @@ module.exports = { function fixParamsWithParenthesis(fixer) { const paramToken = sourceCode.getTokenAfter(firstTokenOfParam); - // ES8 allows Trailing commas in function parameter lists and calls - // https://github.com/eslint/eslint/issues/8834 + /* + * ES8 allows Trailing commas in function parameter lists and calls + * https://github.com/eslint/eslint/issues/8834 + */ const closingParenToken = sourceCode.getTokenAfter(paramToken, astUtils.isClosingParenToken); const asyncToken = isAsync ? sourceCode.getTokenBefore(firstTokenOfParam) : null; const shouldAddSpaceForAsync = asyncToken && (asyncToken.range[1] === firstTokenOfParam.range[0]); diff --git a/tools/eslint/lib/rules/brace-style.js b/tools/eslint/lib/rules/brace-style.js index 44bd6d2c80b6f2..320da9dac91cbc 100644 --- a/tools/eslint/lib/rules/brace-style.js +++ b/tools/eslint/lib/rules/brace-style.js @@ -54,11 +54,11 @@ module.exports = { //-------------------------------------------------------------------------- /** - * Fixes a place where a newline unexpectedly appears - * @param {Token} firstToken The token before the unexpected newline - * @param {Token} secondToken The token after the unexpected newline - * @returns {Function} A fixer function to remove the newlines between the tokens - */ + * Fixes a place where a newline unexpectedly appears + * @param {Token} firstToken The token before the unexpected newline + * @param {Token} secondToken The token after the unexpected newline + * @returns {Function} A fixer function to remove the newlines between the tokens + */ function removeNewlineBetween(firstToken, secondToken) { const textRange = [firstToken.range[1], secondToken.range[0]]; const textBetween = sourceCode.text.slice(textRange[0], textRange[1]); @@ -71,11 +71,11 @@ module.exports = { } /** - * Validates a pair of curly brackets based on the user's config - * @param {Token} openingCurly The opening curly bracket - * @param {Token} closingCurly The closing curly bracket - * @returns {void} - */ + * Validates a pair of curly brackets based on the user's config + * @param {Token} openingCurly The opening curly bracket + * @param {Token} closingCurly The closing curly bracket + * @returns {void} + */ function validateCurlyPair(openingCurly, closingCurly) { const tokenBeforeOpeningCurly = sourceCode.getTokenBefore(openingCurly); const tokenAfterOpeningCurly = sourceCode.getTokenAfter(openingCurly); @@ -116,10 +116,10 @@ module.exports = { } /** - * Validates the location of a token that appears before a keyword (e.g. a newline before `else`) - * @param {Token} curlyToken The closing curly token. This is assumed to precede a keyword token (such as `else` or `finally`). - * @returns {void} - */ + * Validates the location of a token that appears before a keyword (e.g. a newline before `else`) + * @param {Token} curlyToken The closing curly token. This is assumed to precede a keyword token (such as `else` or `finally`). + * @returns {void} + */ function validateCurlyBeforeKeyword(curlyToken) { const keywordToken = sourceCode.getTokenAfter(curlyToken); diff --git a/tools/eslint/lib/rules/computed-property-spacing.js b/tools/eslint/lib/rules/computed-property-spacing.js index 0c05d9b4852db7..19c28fd22e1a38 100644 --- a/tools/eslint/lib/rules/computed-property-spacing.js +++ b/tools/eslint/lib/rules/computed-property-spacing.js @@ -36,12 +36,12 @@ module.exports = { //-------------------------------------------------------------------------- /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @param {Token} tokenAfter - The token after `token`. - * @returns {void} - */ + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @param {Token} tokenAfter - The token after `token`. + * @returns {void} + */ function reportNoBeginningSpace(node, token, tokenAfter) { context.report({ node, @@ -57,12 +57,12 @@ module.exports = { } /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @param {Token} tokenBefore - The token before `token`. - * @returns {void} - */ + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @param {Token} tokenBefore - The token before `token`. + * @returns {void} + */ function reportNoEndingSpace(node, token, tokenBefore) { context.report({ node, @@ -78,11 +78,11 @@ module.exports = { } /** - * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredBeginningSpace(node, token) { context.report({ node, @@ -98,11 +98,11 @@ module.exports = { } /** - * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredEndingSpace(node, token) { context.report({ node, diff --git a/tools/eslint/lib/rules/consistent-return.js b/tools/eslint/lib/rules/consistent-return.js index 20469772a91121..a42faaa1ed6484 100644 --- a/tools/eslint/lib/rules/consistent-return.js +++ b/tools/eslint/lib/rules/consistent-return.js @@ -36,10 +36,10 @@ function isUnreachable(segment) { } /** -* Checks whether a given node is a `constructor` method in an ES6 class -* @param {ASTNode} node A node to check -* @returns {boolean} `true` if the node is a `constructor` method -*/ + * Checks whether a given node is a `constructor` method in an ES6 class + * @param {ASTNode} node A node to check + * @returns {boolean} `true` if the node is a `constructor` method + */ function isClassConstructor(node) { return node.type === "FunctionExpression" && node.parent && diff --git a/tools/eslint/lib/rules/consistent-this.js b/tools/eslint/lib/rules/consistent-this.js index 35c2d56272a638..151cdcf9c9c03f 100644 --- a/tools/eslint/lib/rules/consistent-this.js +++ b/tools/eslint/lib/rules/consistent-this.js @@ -86,8 +86,10 @@ module.exports = { return; } - // The alias has been declared and not assigned: check it was - // assigned later in the same scope. + /* + * The alias has been declared and not assigned: check it was + * assigned later in the same scope. + */ if (!variable.references.some(reference => { const write = reference.writeExpr; diff --git a/tools/eslint/lib/rules/curly.js b/tools/eslint/lib/rules/curly.js index 2d867c72b58df7..37f07d95eece49 100644 --- a/tools/eslint/lib/rules/curly.js +++ b/tools/eslint/lib/rules/curly.js @@ -164,10 +164,10 @@ module.exports = { } /** - * Determines if a semicolon needs to be inserted after removing a set of curly brackets, in order to avoid a SyntaxError. - * @param {Token} closingBracket The } token - * @returns {boolean} `true` if a semicolon needs to be inserted after the last statement in the block. - */ + * Determines if a semicolon needs to be inserted after removing a set of curly brackets, in order to avoid a SyntaxError. + * @param {Token} closingBracket The } token + * @returns {boolean} `true` if a semicolon needs to be inserted after the last statement in the block. + */ function needsSemicolon(closingBracket) { const tokenBefore = sourceCode.getTokenBefore(closingBracket); const tokenAfter = sourceCode.getTokenAfter(closingBracket); @@ -187,9 +187,11 @@ module.exports = { if (lastBlockNode.type === "BlockStatement" && lastBlockNode.parent.type !== "FunctionExpression" && lastBlockNode.parent.type !== "ArrowFunctionExpression") { - // If the last node surrounded by curly brackets is a BlockStatement (other than a FunctionExpression or an ArrowFunctionExpression), - // don't insert a semicolon. Otherwise, the semicolon would be parsed as a separate statement, which would cause - // a SyntaxError if it was followed by `else`. + /* + * If the last node surrounded by curly brackets is a BlockStatement (other than a FunctionExpression or an ArrowFunctionExpression), + * don't insert a semicolon. Otherwise, the semicolon would be parsed as a separate statement, which would cause + * a SyntaxError if it was followed by `else`. + */ return false; } @@ -235,8 +237,10 @@ module.exports = { }, fix(fixer) { - // `do while` expressions sometimes need a space to be inserted after `do`. - // e.g. `do{foo()} while (bar)` should be corrected to `do foo() while (bar)` + /* + * `do while` expressions sometimes need a space to be inserted after `do`. + * e.g. `do{foo()} while (bar)` should be corrected to `do foo() while (bar)` + */ const needsPrecedingSpace = node.type === "DoWhileStatement" && sourceCode.getTokenBefore(bodyNode).range[1] === bodyNode.range[0] && !astUtils.canTokensBeAdjacent("do", sourceCode.getFirstToken(bodyNode, { skip: 1 })); diff --git a/tools/eslint/lib/rules/dot-notation.js b/tools/eslint/lib/rules/dot-notation.js index cb557993266653..21e3df17412e84 100644 --- a/tools/eslint/lib/rules/dot-notation.js +++ b/tools/eslint/lib/rules/dot-notation.js @@ -55,11 +55,11 @@ module.exports = { } /** - * Check if the property is valid dot notation - * @param {ASTNode} node The dot notation node - * @param {string} value Value which is to be checked - * @returns {void} - */ + * Check if the property is valid dot notation + * @param {ASTNode} node The dot notation node + * @param {string} value Value which is to be checked + * @returns {void} + */ function checkComputedProperty(node, value) { if ( validIdentifier.test(value) && diff --git a/tools/eslint/lib/rules/func-call-spacing.js b/tools/eslint/lib/rules/func-call-spacing.js index 4fd78c864b3890..00e677d33b0ac6 100644 --- a/tools/eslint/lib/rules/func-call-spacing.js +++ b/tools/eslint/lib/rules/func-call-spacing.js @@ -118,8 +118,10 @@ module.exports = { message: "Unexpected space between function name and paren.", fix(fixer) { - // Only autofix if there is no newline - // https://github.com/eslint/eslint/issues/7787 + /* + * Only autofix if there is no newline + * https://github.com/eslint/eslint/issues/7787 + */ if (!hasNewline) { return fixer.removeRange([prevToken.range[1], parenToken.range[0]]); } diff --git a/tools/eslint/lib/rules/getter-return.js b/tools/eslint/lib/rules/getter-return.js index 58fac8bdac2fbc..6eb1efc00c4951 100644 --- a/tools/eslint/lib/rules/getter-return.js +++ b/tools/eslint/lib/rules/getter-return.js @@ -102,7 +102,8 @@ module.exports = { } } - /** Checks whether a node means a getter function. + /** + * Checks whether a node means a getter function. * @param {ASTNode} node - a node to check. * @returns {boolean} if node means a getter, return true; else return false. */ diff --git a/tools/eslint/lib/rules/implicit-arrow-linebreak.js b/tools/eslint/lib/rules/implicit-arrow-linebreak.js new file mode 100644 index 00000000000000..b8802f4de53320 --- /dev/null +++ b/tools/eslint/lib/rules/implicit-arrow-linebreak.js @@ -0,0 +1,86 @@ +/** + * @fileoverview enforce the location of arrow function bodies + * @author Sharmila Jesupaul + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ +module.exports = { + meta: { + docs: { + description: "enforce the location of arrow function bodies", + category: "Stylistic Issues", + recommended: false + }, + fixable: "whitespace", + schema: [ + { + enum: ["beside", "below"] + } + ] + }, + + create(context) { + const sourceCode = context.getSourceCode(); + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + /** + * Gets the applicable preference for a particular keyword + * @returns {string} The applicable option for the keyword, e.g. 'beside' + */ + function getOption() { + return context.options[0] || "beside"; + } + + /** + * Validates the location of an arrow function body + * @param {ASTNode} node The arrow function body + * @param {string} keywordName The applicable keyword name for the arrow function body + * @returns {void} + */ + function validateExpression(node) { + const option = getOption(); + + let tokenBefore = sourceCode.getTokenBefore(node.body); + const hasParens = tokenBefore.value === "("; + + if (node.type === "BlockStatement") { + return; + } + + let fixerTarget = node.body; + + if (hasParens) { + + // Gets the first token before the function body that is not an open paren + tokenBefore = sourceCode.getTokenBefore(node.body, token => token.value !== "("); + fixerTarget = sourceCode.getTokenAfter(tokenBefore); + } + + if (tokenBefore.loc.end.line === fixerTarget.loc.start.line && option === "below") { + context.report({ + node: fixerTarget, + message: "Expected a linebreak before this expression.", + fix: fixer => fixer.insertTextBefore(fixerTarget, "\n") + }); + } else if (tokenBefore.loc.end.line !== fixerTarget.loc.start.line && option === "beside") { + context.report({ + node: fixerTarget, + message: "Expected no linebreak before this expression.", + fix: fixer => fixer.replaceTextRange([tokenBefore.range[1], fixerTarget.range[0]], " ") + }); + } + } + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + return { + ArrowFunctionExpression: node => validateExpression(node) + }; + } +}; diff --git a/tools/eslint/lib/rules/indent-legacy.js b/tools/eslint/lib/rules/indent-legacy.js index a5db2bb5d77315..cf914068062adf 100644 --- a/tools/eslint/lib/rules/indent-legacy.js +++ b/tools/eslint/lib/rules/indent-legacy.js @@ -274,8 +274,10 @@ module.exports = { foundStatement = `${actualSpaces} ${foundSpacesWord} and ${actualTabs} ${foundTabsWord}`; // e.g. "1 space and 2 tabs" } else if (actualSpaces > 0) { - // Abbreviate the message if the expected indentation is also spaces. - // e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' + /* + * Abbreviate the message if the expected indentation is also spaces. + * e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' + */ foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`; } else if (actualTabs > 0) { foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`; @@ -323,8 +325,8 @@ module.exports = { * @param {ASTNode|Token} node Node to examine * @param {boolean} [byLastLine=false] get indent of node's last line * @returns {Object} The node's indent. Contains keys `space` and `tab`, representing the indent of each character. Also - contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and - `badChar` is the amount of the other indentation character. + * contains keys `goodChar` and `badChar`, where `goodChar` is the amount of the user's desired indentation character, and + * `badChar` is the amount of the other indentation character. */ function getNodeIndent(node, byLastLine) { const token = byLastLine ? sourceCode.getLastToken(node) : sourceCode.getFirstToken(node); @@ -445,8 +447,10 @@ module.exports = { */ function checkLastReturnStatementLineIndent(node, firstLineIndent) { - // in case if return statement ends with ');' we have traverse back to ')' - // otherwise we'll measure indent for ';' and replace ')' + /* + * in case if return statement ends with ');' we have traverse back to ')' + * otherwise we'll measure indent for ';' and replace ')' + */ const lastToken = sourceCode.getLastToken(node, astUtils.isClosingParenToken); const textBeforeClosingParenthesis = sourceCode.getText(lastToken, lastToken.loc.start.column).slice(0, -1); @@ -645,8 +649,10 @@ module.exports = { } } - // function body indent should be indent + indent size, unless this - // is a FunctionDeclaration, FunctionExpression, or outer IIFE and the corresponding options are enabled. + /* + * function body indent should be indent + indent size, unless this + * is a FunctionDeclaration, FunctionExpression, or outer IIFE and the corresponding options are enabled. + */ let functionOffset = indentSize; if (options.outerIIFEBody !== null && isOuterIIFE(calleeNode)) { @@ -1027,10 +1033,12 @@ module.exports = { return; } - // The typical layout of variable declarations and assignments - // alter the expectation of correct indentation. Skip them. - // TODO: Add appropriate configuration options for variable - // declarations and assignments. + /* + * The typical layout of variable declarations and assignments + * alter the expectation of correct indentation. Skip them. + * TODO: Add appropriate configuration options for variable + * declarations and assignments. + */ if (getParentNodeByType(node, "VariableDeclarator", ["FunctionExpression", "ArrowFunctionExpression"])) { return; } diff --git a/tools/eslint/lib/rules/indent.js b/tools/eslint/lib/rules/indent.js index a804f544ab0b2a..42cebf9ea53ce2 100644 --- a/tools/eslint/lib/rules/indent.js +++ b/tools/eslint/lib/rules/indent.js @@ -200,19 +200,19 @@ class TokenInfo { } /** - * Gets the first token on a given token's line - * @param {Token|ASTNode} token a node or token - * @returns {Token} The first token on the given line - */ + * Gets the first token on a given token's line + * @param {Token|ASTNode} token a node or token + * @returns {Token} The first token on the given line + */ getFirstTokenOfLine(token) { return this.firstTokensByLineNumber.get(token.loc.start.line); } /** - * Determines whether a token is the first token in its line - * @param {Token} token The token - * @returns {boolean} `true` if the token is the first on its line - */ + * Determines whether a token is the first token in its line + * @param {Token} token The token + * @returns {boolean} `true` if the token is the first on its line + */ isFirstTokenOfLine(token) { return this.getFirstTokenOfLine(token) === token; } @@ -336,31 +336,31 @@ class OffsetStorage { } /** - * Sets the desired offset of all tokens in a range - * It's common for node listeners in this file to need to apply the same offset to a large, contiguous range of tokens. - * Moreover, the offset of any given token is usually updated multiple times (roughly once for each node that contains - * it). This means that the offset of each token is updated O(AST depth) times. - * It would not be performant to store and update the offsets for each token independently, because the rule would end - * up having a time complexity of O(number of tokens * AST depth), which is quite slow for large files. - * - * Instead, the offset tree is represented as a collection of contiguous offset ranges in a file. For example, the following - * list could represent the state of the offset tree at a given point: - * - * * Tokens starting in the interval [0, 15) are aligned with the beginning of the file - * * Tokens starting in the interval [15, 30) are offset by 1 indent level from the `bar` token - * * Tokens starting in the interval [30, 43) are offset by 1 indent level from the `foo` token - * * Tokens starting in the interval [43, 820) are offset by 2 indent levels from the `bar` token - * * Tokens starting in the interval [820, ∞) are offset by 1 indent level from the `baz` token - * - * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using: - * `setDesiredOffsets([30, 43], fooToken, 1);` - * - * @param {[number, number]} range A [start, end] pair. All tokens with range[0] <= token.start < range[1] will have the offset applied. - * @param {Token} fromToken The token that this is offset from - * @param {number} offset The desired indent level - * @param {boolean} force `true` if this offset should not use the normal collapsing behavior. This should almost always be false. - * @returns {void} - */ + * Sets the desired offset of all tokens in a range + * It's common for node listeners in this file to need to apply the same offset to a large, contiguous range of tokens. + * Moreover, the offset of any given token is usually updated multiple times (roughly once for each node that contains + * it). This means that the offset of each token is updated O(AST depth) times. + * It would not be performant to store and update the offsets for each token independently, because the rule would end + * up having a time complexity of O(number of tokens * AST depth), which is quite slow for large files. + * + * Instead, the offset tree is represented as a collection of contiguous offset ranges in a file. For example, the following + * list could represent the state of the offset tree at a given point: + * + * * Tokens starting in the interval [0, 15) are aligned with the beginning of the file + * * Tokens starting in the interval [15, 30) are offset by 1 indent level from the `bar` token + * * Tokens starting in the interval [30, 43) are offset by 1 indent level from the `foo` token + * * Tokens starting in the interval [43, 820) are offset by 2 indent levels from the `bar` token + * * Tokens starting in the interval [820, ∞) are offset by 1 indent level from the `baz` token + * + * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using: + * `setDesiredOffsets([30, 43], fooToken, 1);` + * + * @param {[number, number]} range A [start, end] pair. All tokens with range[0] <= token.start < range[1] will have the offset applied. + * @param {Token} fromToken The token that this is offset from + * @param {number} offset The desired indent level + * @param {boolean} force `true` if this offset should not use the normal collapsing behavior. This should almost always be false. + * @returns {void} + */ setDesiredOffsets(range, fromToken, offset, force) { /* @@ -408,17 +408,19 @@ class OffsetStorage { } /** - * Gets the desired indent of a token - * @param {Token} token The token - * @returns {string} The desired indent of the token - */ + * Gets the desired indent of a token + * @param {Token} token The token + * @returns {string} The desired indent of the token + */ getDesiredIndent(token) { if (!this._desiredIndentCache.has(token)) { if (this._ignoredTokens.has(token)) { - // If the token is ignored, use the actual indent of the token as the desired indent. - // This ensures that no errors are reported for this token. + /* + * If the token is ignored, use the actual indent of the token as the desired indent. + * This ensures that no errors are reported for this token. + */ this._desiredIndentCache.set( token, this._tokenInfo.getTokenIndent(token) @@ -453,10 +455,10 @@ class OffsetStorage { } /** - * Ignores a token, preventing it from being reported. - * @param {Token} token The token - * @returns {void} - */ + * Ignores a token, preventing it from being reported. + * @param {Token} token The token + * @returns {void} + */ ignoreToken(token) { if (this._tokenInfo.isFirstTokenOfLine(token)) { this._ignoredTokens.add(token); @@ -681,8 +683,10 @@ module.exports = { if (actualSpaces > 0) { - // Abbreviate the message if the expected indentation is also spaces. - // e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' + /* + * Abbreviate the message if the expected indentation is also spaces. + * e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' + */ foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`; } else if (actualTabs > 0) { foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`; @@ -770,20 +774,20 @@ module.exports = { } /** - * Check indentation for lists of elements (arrays, objects, function params) - * @param {ASTNode[]} elements List of elements that should be offset - * @param {Token} startToken The start token of the list that element should be aligned against, e.g. '[' - * @param {Token} endToken The end token of the list, e.g. ']' - * @param {number|string} offset The amount that the elements should be offset - * @returns {void} - */ + * Check indentation for lists of elements (arrays, objects, function params) + * @param {ASTNode[]} elements List of elements that should be offset + * @param {Token} startToken The start token of the list that element should be aligned against, e.g. '[' + * @param {Token} endToken The end token of the list, e.g. ']' + * @param {number|string} offset The amount that the elements should be offset + * @returns {void} + */ function addElementListIndent(elements, startToken, endToken, offset) { /** - * Gets the first token of a given element, including surrounding parentheses. - * @param {ASTNode} element A node in the `elements` list - * @returns {Token} The first token of this element - */ + * Gets the first token of a given element, including surrounding parentheses. + * @param {ASTNode} element A node in the `elements` list + * @returns {Token} The first token of this element + */ function getFirstToken(element) { let token = sourceCode.getTokenBefore(element); @@ -872,10 +876,10 @@ module.exports = { } /** - * Checks the indentation for nodes that are like function calls (`CallExpression` and `NewExpression`) - * @param {ASTNode} node A CallExpression or NewExpression node - * @returns {void} - */ + * Checks the indentation for nodes that are like function calls (`CallExpression` and `NewExpression`) + * @param {ASTNode} node A CallExpression or NewExpression node + * @returns {void} + */ function addFunctionCallIndent(node) { let openingParen; @@ -894,10 +898,10 @@ module.exports = { } /** - * Checks the indentation of parenthesized values, given a list of tokens in a program - * @param {Token[]} tokens A list of tokens - * @returns {void} - */ + * Checks the indentation of parenthesized values, given a list of tokens in a program + * @param {Token[]} tokens A list of tokens + * @returns {void} + */ function addParensIndent(tokens) { const parenStack = []; const parenPairs = []; @@ -932,11 +936,11 @@ module.exports = { } /** - * Ignore all tokens within an unknown node whose offset do not depend - * on another token's offset within the unknown node - * @param {ASTNode} node Unknown Node - * @returns {void} - */ + * Ignore all tokens within an unknown node whose offset do not depend + * on another token's offset within the unknown node + * @param {ASTNode} node Unknown Node + * @returns {void} + */ function ignoreNode(node) { const unknownNodeTokens = new Set(sourceCode.getTokens(node, { includeComments: true })); @@ -1023,10 +1027,10 @@ module.exports = { const operator = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); /* - * For backwards compatibility, don't check BinaryExpression indents, e.g. - * var foo = bar && - * baz; - */ + * For backwards compatibility, don't check BinaryExpression indents, e.g. + * var foo = bar && + * baz; + */ const tokenAfterOperator = sourceCode.getTokenAfter(operator); diff --git a/tools/eslint/lib/rules/key-spacing.js b/tools/eslint/lib/rules/key-spacing.js index a7b825072c1def..1c62ad42892012 100644 --- a/tools/eslint/lib/rules/key-spacing.js +++ b/tools/eslint/lib/rules/key-spacing.js @@ -329,9 +329,11 @@ module.exports = { return true; } - // Check that the first comment is adjacent to the end of the group, the - // last comment is adjacent to the candidate property, and that successive - // comments are adjacent to each other. + /* + * Check that the first comment is adjacent to the end of the group, the + * last comment is adjacent to the candidate property, and that successive + * comments are adjacent to each other. + */ const leadingComments = sourceCode.getCommentsBefore(candidate); if ( diff --git a/tools/eslint/lib/rules/lines-around-directive.js b/tools/eslint/lib/rules/lines-around-directive.js index 65b6cd1db59e7d..b560009f71439c 100644 --- a/tools/eslint/lib/rules/lines-around-directive.js +++ b/tools/eslint/lib/rules/lines-around-directive.js @@ -67,12 +67,12 @@ module.exports = { } /** - * Gets the last token of a node that is on the same line as the rest of the node. - * This will usually be the last token of the node, but it will be the second-to-last token if the node has a trailing - * semicolon on a different line. - * @param {ASTNode} node A directive node - * @returns {Token} The last token of the node on the line - */ + * Gets the last token of a node that is on the same line as the rest of the node. + * This will usually be the last token of the node, but it will be the second-to-last token if the node has a trailing + * semicolon on a different line. + * @param {ASTNode} node A directive node + * @returns {Token} The last token of the node on the line + */ function getLastTokenOnLine(node) { const lastToken = sourceCode.getLastToken(node); const secondToLastToken = sourceCode.getTokenBefore(lastToken); @@ -136,9 +136,11 @@ module.exports = { const firstDirective = directives[0]; const leadingComments = sourceCode.getCommentsBefore(firstDirective); - // Only check before the first directive if it is preceded by a comment or if it is at the top of - // the file and expectLineBefore is set to "never". This is to not force a newline at the top of - // the file if there are no comments as well as for compatibility with padded-blocks. + /* + * Only check before the first directive if it is preceded by a comment or if it is at the top of + * the file and expectLineBefore is set to "never". This is to not force a newline at the top of + * the file if there are no comments as well as for compatibility with padded-blocks. + */ if (leadingComments.length) { if (expectLineBefore === "always" && !hasNewlineBefore(firstDirective)) { reportError(firstDirective, "before", true); @@ -159,9 +161,11 @@ module.exports = { const lastDirective = directives[directives.length - 1]; const statements = node.type === "Program" ? node.body : node.body.body; - // Do not check after the last directive if the body only - // contains a directive prologue and isn't followed by a comment to ensure - // this rule behaves well with padded-blocks. + /* + * Do not check after the last directive if the body only + * contains a directive prologue and isn't followed by a comment to ensure + * this rule behaves well with padded-blocks. + */ if (lastDirective === statements[statements.length - 1] && !lastDirective.trailingComments) { return; } diff --git a/tools/eslint/lib/rules/max-statements-per-line.js b/tools/eslint/lib/rules/max-statements-per-line.js index 3bf370efd8805c..3d18da4ee10fc1 100644 --- a/tools/eslint/lib/rules/max-statements-per-line.js +++ b/tools/eslint/lib/rules/max-statements-per-line.js @@ -93,9 +93,11 @@ module.exports = { function enterStatement(node) { const line = node.loc.start.line; - // Skip to allow non-block statements if this is direct child of control statements. - // `if (a) foo();` is counted as 1. - // But `if (a) foo(); else foo();` should be counted as 2. + /* + * Skip to allow non-block statements if this is direct child of control statements. + * `if (a) foo();` is counted as 1. + * But `if (a) foo(); else foo();` should be counted as 2. + */ if (SINGLE_CHILD_ALLOWED.test(node.parent.type) && node.parent.alternate !== node ) { diff --git a/tools/eslint/lib/rules/newline-after-var.js b/tools/eslint/lib/rules/newline-after-var.js index 744a52a580af53..80f73c836fa38c 100644 --- a/tools/eslint/lib/rules/newline-after-var.js +++ b/tools/eslint/lib/rules/newline-after-var.js @@ -132,10 +132,10 @@ module.exports = { } /** - * Gets the last line of a group of consecutive comments - * @param {number} commentStartLine The starting line of the group - * @returns {number} The number of the last comment line of the group - */ + * Gets the last line of a group of consecutive comments + * @param {number} commentStartLine The starting line of the group + * @returns {number} The number of the last comment line of the group + */ function getLastCommentLineOfBlock(commentStartLine) { const currentCommentEnd = commentEndLine[commentStartLine]; @@ -190,8 +190,10 @@ module.exports = { return; } - // Some coding styles use multiple `var` statements, so do nothing if - // the next token is a `var` statement. + /* + * Some coding styles use multiple `var` statements, so do nothing if + * the next token is a `var` statement. + */ if (nextToken.type === "Keyword" && isVar(nextToken.value)) { return; } diff --git a/tools/eslint/lib/rules/newline-before-return.js b/tools/eslint/lib/rules/newline-before-return.js index ef6c4a9264e611..02bd66db13788a 100644 --- a/tools/eslint/lib/rules/newline-before-return.js +++ b/tools/eslint/lib/rules/newline-before-return.js @@ -166,13 +166,15 @@ module.exports = { return true; } - // if the last leading comment ends in the same line as the previous token and - // does not share a line with the `return` node, we can consider it safe to fix. - // Example: - // function a() { - // var b; //comment - // return; - // } + /* + * if the last leading comment ends in the same line as the previous token and + * does not share a line with the `return` node, we can consider it safe to fix. + * Example: + * function a() { + * var b; //comment + * return; + * } + */ if (lastLeadingComment.loc.end.line === tokenBefore.loc.end.line && lastLeadingComment.loc.end.line !== node.loc.start.line) { return true; diff --git a/tools/eslint/lib/rules/no-await-in-loop.js b/tools/eslint/lib/rules/no-await-in-loop.js index 97fff7f18e0f1c..d1ed92b704cebf 100644 --- a/tools/eslint/lib/rules/no-await-in-loop.js +++ b/tools/eslint/lib/rules/no-await-in-loop.js @@ -13,8 +13,10 @@ const loopTypes = new Set([ "DoWhileStatement" ]); -// Node types at which we should stop looking for loops. For example, it is fine to declare an async -// function within a loop, and use await inside of that. +/* + * Node types at which we should stop looking for loops. For example, it is fine to declare an async + * function within a loop, and use await inside of that. + */ const boundaryTypes = new Set([ "FunctionDeclaration", "FunctionExpression", @@ -38,9 +40,11 @@ module.exports = { // Reverse so that we can traverse from the deepest node upwards. ancestors.reverse(); - // Create a set of all the ancestors plus this node so that we can check - // if this use of await appears in the body of the loop as opposed to - // the right-hand side of a for...of, for example. + /* + * Create a set of all the ancestors plus this node so that we can check + * if this use of await appears in the body of the loop as opposed to + * the right-hand side of a for...of, for example. + */ const ancestorSet = new Set(ancestors).add(node); for (let i = 0; i < ancestors.length; i++) { @@ -48,14 +52,18 @@ module.exports = { if (boundaryTypes.has(ancestor.type)) { - // Short-circuit out if we encounter a boundary type. Loops above - // this do not matter. + /* + * Short-circuit out if we encounter a boundary type. Loops above + * this do not matter. + */ return; } if (loopTypes.has(ancestor.type)) { - // Only report if we are actually in the body or another part that gets executed on - // every iteration. + /* + * Only report if we are actually in the body or another part that gets executed on + * every iteration. + */ if ( ancestorSet.has(ancestor.body) || ancestorSet.has(ancestor.test) || diff --git a/tools/eslint/lib/rules/no-bitwise.js b/tools/eslint/lib/rules/no-bitwise.js index 28028028cae090..f062ad26699369 100644 --- a/tools/eslint/lib/rules/no-bitwise.js +++ b/tools/eslint/lib/rules/no-bitwise.js @@ -5,9 +5,11 @@ "use strict"; -// -// Set of bitwise operators. -// +/* + * + * Set of bitwise operators. + * + */ const BITWISE_OPERATORS = [ "^", "|", "&", "<<", ">>", ">>>", "^=", "|=", "&=", "<<=", ">>=", ">>>=", diff --git a/tools/eslint/lib/rules/no-catch-shadow.js b/tools/eslint/lib/rules/no-catch-shadow.js index beb16aa2baf8f8..bef61902e90598 100644 --- a/tools/eslint/lib/rules/no-catch-shadow.js +++ b/tools/eslint/lib/rules/no-catch-shadow.js @@ -51,8 +51,10 @@ module.exports = { CatchClause(node) { let scope = context.getScope(); - // When ecmaVersion >= 6, CatchClause creates its own scope - // so start from one upper scope to exclude the current node + /* + * When ecmaVersion >= 6, CatchClause creates its own scope + * so start from one upper scope to exclude the current node + */ if (scope.block === node) { scope = scope.upper; } diff --git a/tools/eslint/lib/rules/no-console.js b/tools/eslint/lib/rules/no-console.js index 32bdf6d1f4d78f..f5a3a235e6b196 100644 --- a/tools/eslint/lib/rules/no-console.js +++ b/tools/eslint/lib/rules/no-console.js @@ -111,7 +111,8 @@ module.exports = { const consoleVar = astUtils.getVariableByName(scope, "console"); const shadowed = consoleVar && consoleVar.defs.length > 0; - /* 'scope.through' includes all references to undefined + /* + * 'scope.through' includes all references to undefined * variables. If the variable 'console' is not defined, it uses * 'scope.through'. */ diff --git a/tools/eslint/lib/rules/no-else-return.js b/tools/eslint/lib/rules/no-else-return.js index 6eb6717495b0a0..deeff41ab83ed3 100644 --- a/tools/eslint/lib/rules/no-else-return.js +++ b/tools/eslint/lib/rules/no-else-return.js @@ -66,10 +66,12 @@ module.exports = { firstTokenOfElseBlock = startToken; } - // If the if block does not have curly braces and does not end in a semicolon - // and the else block starts with (, [, /, +, ` or -, then it is not - // safe to remove the else keyword, because ASI will not add a semicolon - // after the if block + /* + * If the if block does not have curly braces and does not end in a semicolon + * and the else block starts with (, [, /, +, ` or -, then it is not + * safe to remove the else keyword, because ASI will not add a semicolon + * after the if block + */ const ifBlockMaybeUnsafe = node.parent.consequent.type !== "BlockStatement" && lastIfToken.value !== ";"; const elseBlockUnsafe = /^[([/+`-]/.test(firstTokenOfElseBlock.value); @@ -86,10 +88,12 @@ module.exports = { const nextTokenUnsafe = nextToken && /^[([/+`-]/.test(nextToken.value); const nextTokenOnSameLine = nextToken && nextToken.loc.start.line === lastTokenOfElseBlock.loc.start.line; - // If the else block contents does not end in a semicolon, - // and the else block starts with (, [, /, +, ` or -, then it is not - // safe to remove the else block, because ASI will not add a semicolon - // after the remaining else block contents + /* + * If the else block contents does not end in a semicolon, + * and the else block starts with (, [, /, +, ` or -, then it is not + * safe to remove the else block, because ASI will not add a semicolon + * after the remaining else block contents + */ if (nextTokenUnsafe || (nextTokenOnSameLine && nextToken.value !== "}")) { return null; } @@ -101,9 +105,11 @@ module.exports = { fixedSource = source; } - // Extend the replacement range to include the entire - // function to avoid conflicting with no-useless-return. - // https://github.com/eslint/eslint/issues/8026 + /* + * Extend the replacement range to include the entire + * function to avoid conflicting with no-useless-return. + * https://github.com/eslint/eslint/issues/8026 + */ return new FixTracker(fixer, sourceCode) .retainEnclosingFunction(node) .replaceTextRange([elseToken.range[0], node.range[1]], fixedSource); diff --git a/tools/eslint/lib/rules/no-empty-character-class.js b/tools/eslint/lib/rules/no-empty-character-class.js index f36c6c9f0d8b19..0ea7c5a0d1c470 100644 --- a/tools/eslint/lib/rules/no-empty-character-class.js +++ b/tools/eslint/lib/rules/no-empty-character-class.js @@ -10,17 +10,17 @@ //------------------------------------------------------------------------------ /* -plain-English description of the following regexp: -0. `^` fix the match at the beginning of the string -1. `\/`: the `/` that begins the regexp -2. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following - 2.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) - 2.1. `\\.`: an escape sequence - 2.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty -3. `\/` the `/` that ends the regexp -4. `[gimuy]*`: optional regexp flags -5. `$`: fix the match at the end of the string -*/ + * plain-English description of the following regexp: + * 0. `^` fix the match at the beginning of the string + * 1. `\/`: the `/` that begins the regexp + * 2. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following + * 2.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) + * 2.1. `\\.`: an escape sequence + * 2.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty + * 3. `\/` the `/` that ends the regexp + * 4. `[gimuy]*`: optional regexp flags + * 5. `$`: fix the match at the end of the string + */ const regex = /^\/([^\\[]|\\.|\[([^\\\]]|\\.)+])*\/[gimuy]*$/; //------------------------------------------------------------------------------ diff --git a/tools/eslint/lib/rules/no-extra-parens.js b/tools/eslint/lib/rules/no-extra-parens.js index 020d2aeb10f36b..d8e0df64a7b2d9 100644 --- a/tools/eslint/lib/rules/no-extra-parens.js +++ b/tools/eslint/lib/rules/no-extra-parens.js @@ -372,8 +372,10 @@ module.exports = { hasDoubleExcessParens(callee) || !isIIFE(node) && !hasNewParensException && !( - // Allow extra parens around a new expression if - // there are intervening parentheses. + /* + * Allow extra parens around a new expression if + * there are intervening parentheses. + */ callee.type === "MemberExpression" && doesMemberExpressionContainCallExpression(callee) ) @@ -425,8 +427,10 @@ module.exports = { return; } - // If `node.superClass` is a LeftHandSideExpression, parentheses are extra. - // Otherwise, parentheses are needed. + /* + * If `node.superClass` is a LeftHandSideExpression, parentheses are extra. + * Otherwise, parentheses are needed. + */ const hasExtraParens = precedence(node.superClass) > PRECEDENCE_OF_UPDATE_EXPR ? hasExcessParens(node.superClass) : hasDoubleExcessParens(node.superClass); @@ -560,12 +564,16 @@ module.exports = { if ( firstLeftToken.value === "let" && ( - // If `let` is the only thing on the left side of the loop, it's the loop variable: `for ((let) of foo);` - // Removing it will cause a syntax error, because it will be parsed as the start of a VariableDeclarator. + /* + * If `let` is the only thing on the left side of the loop, it's the loop variable: `for ((let) of foo);` + * Removing it will cause a syntax error, because it will be parsed as the start of a VariableDeclarator. + */ firstLeftToken.range[1] === node.left.range[1] || - // If `let` is followed by a `[` token, it's a property access on the `let` value: `for ((let[foo]) of bar);` - // Removing it will cause the property access to be parsed as a destructuring declaration of `foo` instead. + /* + * If `let` is followed by a `[` token, it's a property access on the `let` value: `for ((let[foo]) of bar);` + * Removing it will cause the property access to be parsed as a destructuring declaration of `foo` instead. + */ astUtils.isOpeningBracketToken( sourceCode.getTokenAfter(firstLeftToken, astUtils.isNotClosingParenToken) ) diff --git a/tools/eslint/lib/rules/no-extra-semi.js b/tools/eslint/lib/rules/no-extra-semi.js index 0ec914989d4246..acd312b32b2513 100644 --- a/tools/eslint/lib/rules/no-extra-semi.js +++ b/tools/eslint/lib/rules/no-extra-semi.js @@ -42,9 +42,11 @@ module.exports = { message: "Unnecessary semicolon.", fix(fixer) { - // Expand the replacement range to include the surrounding - // tokens to avoid conflicting with semi. - // https://github.com/eslint/eslint/issues/7928 + /* + * Expand the replacement range to include the surrounding + * tokens to avoid conflicting with semi. + * https://github.com/eslint/eslint/issues/7928 + */ return new FixTracker(fixer, context.getSourceCode()) .retainSurroundingTokens(nodeOrToken) .remove(nodeOrToken); diff --git a/tools/eslint/lib/rules/no-global-assign.js b/tools/eslint/lib/rules/no-global-assign.js index 5a1cc64aeb2069..679650cb70fdd6 100644 --- a/tools/eslint/lib/rules/no-global-assign.js +++ b/tools/eslint/lib/rules/no-global-assign.js @@ -49,8 +49,10 @@ module.exports = { if (reference.init === false && reference.isWrite() && - // Destructuring assignments can have multiple default value, - // so possibly there are multiple writeable references for the same identifier. + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ (index === 0 || references[index - 1].identifier !== identifier) ) { context.report({ diff --git a/tools/eslint/lib/rules/no-implicit-coercion.js b/tools/eslint/lib/rules/no-implicit-coercion.js index cec411af75daa1..24e04858f0651f 100644 --- a/tools/eslint/lib/rules/no-implicit-coercion.js +++ b/tools/eslint/lib/rules/no-implicit-coercion.js @@ -189,12 +189,12 @@ module.exports = { const sourceCode = context.getSourceCode(); /** - * Reports an error and autofixes the node - * @param {ASTNode} node - An ast node to report the error on. - * @param {string} recommendation - The recommended code for the issue - * @param {bool} shouldFix - Whether this report should fix the node - * @returns {void} - */ + * Reports an error and autofixes the node + * @param {ASTNode} node - An ast node to report the error on. + * @param {string} recommendation - The recommended code for the issue + * @param {bool} shouldFix - Whether this report should fix the node + * @returns {void} + */ function report(node, recommendation, shouldFix) { shouldFix = typeof shouldFix === "undefined" ? true : shouldFix; diff --git a/tools/eslint/lib/rules/no-implied-eval.js b/tools/eslint/lib/rules/no-implied-eval.js index 4daadd8fb8733d..cfb16dbf73e42d 100644 --- a/tools/eslint/lib/rules/no-implied-eval.js +++ b/tools/eslint/lib/rules/no-implied-eval.js @@ -125,7 +125,8 @@ module.exports = { "CallExpression:exit"(node) { if (node === last(last(impliedEvalAncestorsStack))) { - /* Destroys the entire sub-stack, rather than just using + /* + * Destroys the entire sub-stack, rather than just using * last(impliedEvalAncestorsStack).pop(), as a CallExpression is * always the bottom of a impliedEvalAncestorsStack substack. */ diff --git a/tools/eslint/lib/rules/no-label-var.js b/tools/eslint/lib/rules/no-label-var.js index 00133685613609..954066aef32e69 100644 --- a/tools/eslint/lib/rules/no-label-var.js +++ b/tools/eslint/lib/rules/no-label-var.js @@ -54,8 +54,10 @@ module.exports = { // Fetch the innermost scope. const scope = context.getScope(); - // Recursively find the identifier walking up the scope, starting - // with the innermost scope. + /* + * Recursively find the identifier walking up the scope, starting + * with the innermost scope. + */ if (findIdentifier(scope, node.label.name)) { context.report({ node, message: "Found identifier with same name as label." }); } diff --git a/tools/eslint/lib/rules/no-lone-blocks.js b/tools/eslint/lib/rules/no-lone-blocks.js index 652812fba7bfa7..2b5666e213c4a2 100644 --- a/tools/eslint/lib/rules/no-lone-blocks.js +++ b/tools/eslint/lib/rules/no-lone-blocks.js @@ -30,7 +30,7 @@ module.exports = { * Reports a node as invalid. * @param {ASTNode} node - The node to be reported. * @returns {void} - */ + */ function report(node) { const message = node.parent.type === "BlockStatement" ? "Nested block is redundant." : "Block is redundant."; @@ -41,7 +41,7 @@ module.exports = { * Checks for any ocurrence of a BlockStatement in a place where lists of statements can appear * @param {ASTNode} node The node to check * @returns {boolean} True if the node is a lone block. - */ + */ function isLoneBlock(node) { return node.parent.type === "BlockStatement" || node.parent.type === "Program" || @@ -54,7 +54,7 @@ module.exports = { * Checks the enclosing block of the current node for block-level bindings, * and "marks it" as valid if any. * @returns {void} - */ + */ function markLoneBlock() { if (loneBlocks.length === 0) { return; diff --git a/tools/eslint/lib/rules/no-loop-func.js b/tools/eslint/lib/rules/no-loop-func.js index 0e586394d1fc69..c97e0c3c5aefd6 100644 --- a/tools/eslint/lib/rules/no-loop-func.js +++ b/tools/eslint/lib/rules/no-loop-func.js @@ -105,8 +105,10 @@ function isSafe(loopNode, reference) { return true; } - // Variables which are declared by `let` in the loop is safe. - // It's a different instance from the next loop step's. + /* + * Variables which are declared by `let` in the loop is safe. + * It's a different instance from the next loop step's. + */ if (kind === "let" && declaration.range[0] > loopNode.range[0] && declaration.range[1] < loopNode.range[1] @@ -114,8 +116,10 @@ function isSafe(loopNode, reference) { return true; } - // WriteReferences which exist after this border are unsafe because those - // can modify the variable. + /* + * WriteReferences which exist after this border are unsafe because those + * can modify the variable. + */ const border = getTopLoopNode( loopNode, (kind === "let") ? declaration : null diff --git a/tools/eslint/lib/rules/no-native-reassign.js b/tools/eslint/lib/rules/no-native-reassign.js index d3dfefbaf05f0b..a60d4e499cb816 100644 --- a/tools/eslint/lib/rules/no-native-reassign.js +++ b/tools/eslint/lib/rules/no-native-reassign.js @@ -53,8 +53,10 @@ module.exports = { if (reference.init === false && reference.isWrite() && - // Destructuring assignments can have multiple default value, - // so possibly there are multiple writeable references for the same identifier. + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ (index === 0 || references[index - 1].identifier !== identifier) ) { context.report({ diff --git a/tools/eslint/lib/rules/no-param-reassign.js b/tools/eslint/lib/rules/no-param-reassign.js index 560d1d6b6f2fd6..f32e42ae2fa4c6 100644 --- a/tools/eslint/lib/rules/no-param-reassign.js +++ b/tools/eslint/lib/rules/no-param-reassign.js @@ -127,8 +127,10 @@ module.exports = { if (identifier && !reference.init && - // Destructuring assignments can have multiple default value, - // so possibly there are multiple writeable references for the same identifier. + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ (index === 0 || references[index - 1].identifier !== identifier) ) { if (reference.isWrite()) { diff --git a/tools/eslint/lib/rules/no-regex-spaces.js b/tools/eslint/lib/rules/no-regex-spaces.js index b0c840df3a2343..9250437caa472e 100644 --- a/tools/eslint/lib/rules/no-regex-spaces.js +++ b/tools/eslint/lib/rules/no-regex-spaces.js @@ -32,7 +32,7 @@ module.exports = { * @param {ASTNode} node node to validate * @param {string} value regular expression to validate * @param {number} valueStart The start location of the regex/string literal. It will always be the case that - `sourceCode.getText().slice(valueStart, valueStart + value.length) === value` + * `sourceCode.getText().slice(valueStart, valueStart + value.length) === value` * @returns {void} * @private */ diff --git a/tools/eslint/lib/rules/no-restricted-imports.js b/tools/eslint/lib/rules/no-restricted-imports.js index d46b098aceef6a..eb477b4be612b6 100644 --- a/tools/eslint/lib/rules/no-restricted-imports.js +++ b/tools/eslint/lib/rules/no-restricted-imports.js @@ -8,8 +8,8 @@ // Helpers //------------------------------------------------------------------------------ -const DEFAULT_MESSAGE_TEMPLATE = "'{{importName}}' import is restricted from being used."; -const CUSTOM_MESSAGE_TEMPLATE = "'{{importName}}' import is restricted from being used. {{customMessage}}"; +const DEFAULT_MESSAGE_TEMPLATE = "'{{importSource}}' import is restricted from being used."; +const CUSTOM_MESSAGE_TEMPLATE = "'{{importSource}}' import is restricted from being used. {{customMessage}}"; //------------------------------------------------------------------------------ // Rule Definition @@ -35,6 +35,12 @@ const arrayOfStringsOrObjects = { message: { type: "string", minLength: 1 + }, + importNames: { + type: "array", + items: { + type: "string" + } } }, additionalProperties: false, @@ -81,11 +87,14 @@ module.exports = { const restrictedPaths = (isPathAndPatternsObject ? options[0].paths : context.options) || []; const restrictedPatterns = (isPathAndPatternsObject ? options[0].patterns : []) || []; - const restrictedPathMessages = restrictedPaths.reduce((memo, importName) => { - if (typeof importName === "string") { - memo[importName] = null; + const restrictedPathMessages = restrictedPaths.reduce((memo, importSource) => { + if (typeof importSource === "string") { + memo[importSource] = { message: null }; } else { - memo[importName.name] = importName.message; + memo[importSource.name] = { + message: importSource.message, + importNames: importSource.importNames + }; } return memo; }, {}); @@ -95,7 +104,16 @@ module.exports = { return {}; } - const ig = ignore().add(restrictedPatterns); + const restrictedPatternsMatcher = ignore().add(restrictedPatterns); + + /** + * Checks to see if "*" is being used to import everything. + * @param {Set.} importNames - Set of import names that are being imported + * @returns {boolean} whether everything is imported or not + */ + function isEverythingImported(importNames) { + return importNames.has("*"); + } /** * Report a restricted path. @@ -104,8 +122,8 @@ module.exports = { * @private */ function reportPath(node) { - const importName = node.source.value.trim(); - const customMessage = restrictedPathMessages[importName]; + const importSource = node.source.value.trim(); + const customMessage = restrictedPathMessages[importSource] && restrictedPathMessages[importSource].message; const message = customMessage ? CUSTOM_MESSAGE_TEMPLATE : DEFAULT_MESSAGE_TEMPLATE; @@ -114,39 +132,130 @@ module.exports = { node, message, data: { - importName, + importSource, customMessage } }); } /** - * Check if the given name is a restricted path name. - * @param {string} name name of a variable + * Report a restricted path specifically for patterns. + * @param {node} node - representing the restricted path reference + * @returns {void} + * @private + */ + function reportPathForPatterns(node) { + const importSource = node.source.value.trim(); + + context.report({ + node, + message: "'{{importSource}}' import is restricted from being used by a pattern.", + data: { + importSource + } + }); + } + + /** + * Report a restricted path specifically when using the '*' import. + * @param {string} importSource - path of the import + * @param {node} node - representing the restricted path reference + * @returns {void} + * @private + */ + function reportPathForEverythingImported(importSource, node) { + const importNames = restrictedPathMessages[importSource].importNames; + + context.report({ + node, + message: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.", + data: { + importSource, + importNames + } + }); + } + + /** + * Check if the given importSource is restricted because '*' is being imported. + * @param {string} importSource - path of the import + * @param {Set.} importNames - Set of import names that are being imported + * @returns {boolean} whether the path is restricted + * @private + */ + function isRestrictedForEverythingImported(importSource, importNames) { + return Object.prototype.hasOwnProperty.call(restrictedPathMessages, importSource) && + restrictedPathMessages[importSource].importNames && + isEverythingImported(importNames); + } + + /** + * Check if the given importNames are restricted given a list of restrictedImportNames. + * @param {Set.} importNames - Set of import names that are being imported + * @param {[string]} restrictedImportNames - array of import names that are restricted for this import + * @returns {boolean} whether the objectName is restricted + * @private + */ + function isRestrictedObject(importNames, restrictedImportNames) { + return restrictedImportNames.some(restrictedObjectName => ( + importNames.has(restrictedObjectName) + )); + } + + /** + * Check if the given importSource is a restricted path. + * @param {string} importSource - path of the import + * @param {Set.} importNames - Set of import names that are being imported * @returns {boolean} whether the variable is a restricted path or not * @private */ - function isRestrictedPath(name) { - return Object.prototype.hasOwnProperty.call(restrictedPathMessages, name); + function isRestrictedPath(importSource, importNames) { + let isRestricted = false; + + if (Object.prototype.hasOwnProperty.call(restrictedPathMessages, importSource)) { + if (restrictedPathMessages[importSource].importNames) { + isRestricted = isRestrictedObject(importNames, restrictedPathMessages[importSource].importNames); + } else { + isRestricted = true; + } + } + + return isRestricted; + } + + /** + * Check if the given importSource is restricted by a pattern. + * @param {string} importSource - path of the import + * @returns {boolean} whether the variable is a restricted pattern or not + * @private + */ + function isRestrictedPattern(importSource) { + return restrictedPatterns.length > 0 && restrictedPatternsMatcher.ignores(importSource); } return { ImportDeclaration(node) { - if (node && node.source && node.source.value) { - const importName = node.source.value.trim(); - - if (isRestrictedPath(importName)) { - reportPath(node); - } - if (restrictedPatterns.length > 0 && ig.ignores(importName)) { - context.report({ - node, - message: "'{{importName}}' import is restricted from being used by a pattern.", - data: { - importName - } - }); + const importSource = node.source.value.trim(); + const importNames = node.specifiers.reduce((set, specifier) => { + if (specifier.type === "ImportDefaultSpecifier") { + set.add("default"); + } else if (specifier.type === "ImportNamespaceSpecifier") { + set.add("*"); + } else { + set.add(specifier.imported.name); } + return set; + }, new Set()); + + if (isRestrictedForEverythingImported(importSource, importNames)) { + reportPathForEverythingImported(importSource, node); + } + + if (isRestrictedPath(importSource, importNames)) { + reportPath(node); + } + if (isRestrictedPattern(importSource)) { + reportPathForPatterns(node); } } }; diff --git a/tools/eslint/lib/rules/no-restricted-properties.js b/tools/eslint/lib/rules/no-restricted-properties.js index 44db74f5354036..cdc73f9e41097c 100644 --- a/tools/eslint/lib/rules/no-restricted-properties.js +++ b/tools/eslint/lib/rules/no-restricted-properties.js @@ -92,12 +92,12 @@ module.exports = { }); /** - * Checks to see whether a property access is restricted, and reports it if so. - * @param {ASTNode} node The node to report - * @param {string} objectName The name of the object - * @param {string} propertyName The name of the property - * @returns {undefined} - */ + * Checks to see whether a property access is restricted, and reports it if so. + * @param {ASTNode} node The node to report + * @param {string} objectName The name of the object + * @param {string} propertyName The name of the property + * @returns {undefined} + */ function checkPropertyAccess(node, objectName, propertyName) { if (propertyName === null) { return; @@ -135,10 +135,10 @@ module.exports = { } /** - * Checks property accesses in a destructuring assignment expression, e.g. `var foo; ({foo} = bar);` - * @param {ASTNode} node An AssignmentExpression or AssignmentPattern node - * @returns {undefined} - */ + * Checks property accesses in a destructuring assignment expression, e.g. `var foo; ({foo} = bar);` + * @param {ASTNode} node An AssignmentExpression or AssignmentPattern node + * @returns {undefined} + */ function checkDestructuringAssignment(node) { if (node.right.type === "Identifier") { const objectName = node.right.name; diff --git a/tools/eslint/lib/rules/no-return-await.js b/tools/eslint/lib/rules/no-return-await.js index a7933460d47624..2f06b611084904 100644 --- a/tools/eslint/lib/rules/no-return-await.js +++ b/tools/eslint/lib/rules/no-return-await.js @@ -40,12 +40,12 @@ module.exports = { } /** - * Determines whether a thrown error from this node will be caught/handled within this function rather than immediately halting - * this function. For example, a statement in a `try` block will always have an error handler. A statement in - * a `catch` block will only have an error handler if there is also a `finally` block. - * @param {ASTNode} node A node representing a location where an could be thrown - * @returns {boolean} `true` if a thrown error will be caught/handled in this function - */ + * Determines whether a thrown error from this node will be caught/handled within this function rather than immediately halting + * this function. For example, a statement in a `try` block will always have an error handler. A statement in + * a `catch` block will only have an error handler if there is also a `finally` block. + * @param {ASTNode} node A node representing a location where an could be thrown + * @returns {boolean} `true` if a thrown error will be caught/handled in this function + */ function hasErrorHandler(node) { let ancestor = node; diff --git a/tools/eslint/lib/rules/no-self-assign.js b/tools/eslint/lib/rules/no-self-assign.js index 8b9314a3e87659..48b922d46b88fa 100644 --- a/tools/eslint/lib/rules/no-self-assign.js +++ b/tools/eslint/lib/rules/no-self-assign.js @@ -114,8 +114,10 @@ function eachSelfAssignment(left, right, props, report) { right.properties.length >= 1 ) { - // Gets the index of the last spread property. - // It's possible to overwrite properties followed by it. + /* + * Gets the index of the last spread property. + * It's possible to overwrite properties followed by it. + */ let startJ = 0; for (let i = right.properties.length - 1; i >= 0; --i) { diff --git a/tools/eslint/lib/rules/no-sequences.js b/tools/eslint/lib/rules/no-sequences.js index 23c1956ebeba07..5e746dfa88f77b 100644 --- a/tools/eslint/lib/rules/no-sequences.js +++ b/tools/eslint/lib/rules/no-sequences.js @@ -40,10 +40,12 @@ module.exports = { WithStatement: "object", ArrowFunctionExpression: "body" - // Omitting CallExpression - commas are parsed as argument separators - // Omitting NewExpression - commas are parsed as argument separators - // Omitting ForInStatement - parts aren't individually parenthesised - // Omitting ForStatement - parts aren't individually parenthesised + /* + * Omitting CallExpression - commas are parsed as argument separators + * Omitting NewExpression - commas are parsed as argument separators + * Omitting ForInStatement - parts aren't individually parenthesised + * Omitting ForStatement - parts aren't individually parenthesised + */ }; /** diff --git a/tools/eslint/lib/rules/no-trailing-spaces.js b/tools/eslint/lib/rules/no-trailing-spaces.js index 598bbea4f9d67e..fbbc6402175029 100644 --- a/tools/eslint/lib/rules/no-trailing-spaces.js +++ b/tools/eslint/lib/rules/no-trailing-spaces.js @@ -101,8 +101,10 @@ module.exports = { Program: function checkTrailingSpaces(node) { - // Let's hack. Since Espree does not return whitespace nodes, - // fetch the source code and do matching via regexps. + /* + * Let's hack. Since Espree does not return whitespace nodes, + * fetch the source code and do matching via regexps. + */ const re = new RegExp(NONBLANK), skipMatch = new RegExp(SKIP_BLANK), @@ -117,9 +119,11 @@ module.exports = { for (let i = 0, ii = lines.length; i < ii; i++) { const matches = re.exec(lines[i]); - // Always add linebreak length to line length to accommodate for line break (\n or \r\n) - // Because during the fix time they also reserve one spot in the array. - // Usually linebreak length is 2 for \r\n (CRLF) and 1 for \n (LF) + /* + * Always add linebreak length to line length to accommodate for line break (\n or \r\n) + * Because during the fix time they also reserve one spot in the array. + * Usually linebreak length is 2 for \r\n (CRLF) and 1 for \n (LF) + */ const linebreakLength = linebreaks && linebreaks[i] ? linebreaks[i].length : 1; const lineLength = lines[i].length + linebreakLength; @@ -140,8 +144,10 @@ module.exports = { continue; } - // If the line has only whitespace, and skipBlankLines - // is true, don't report it + /* + * If the line has only whitespace, and skipBlankLines + * is true, don't report it + */ if (skipBlankLines && skipMatch.test(lines[i])) { totalLength += lineLength; continue; diff --git a/tools/eslint/lib/rules/no-unreachable.js b/tools/eslint/lib/rules/no-unreachable.js index 82ef8301a3612e..217a6a42995184 100644 --- a/tools/eslint/lib/rules/no-unreachable.js +++ b/tools/eslint/lib/rules/no-unreachable.js @@ -145,8 +145,10 @@ module.exports = { nextNode = node; } - // Report the current range since this statement is reachable or is - // not consecutive to the current range. + /* + * Report the current range since this statement is reachable or is + * not consecutive to the current range. + */ if (!range.isEmpty) { context.report({ message: "Unreachable code.", diff --git a/tools/eslint/lib/rules/no-use-before-define.js b/tools/eslint/lib/rules/no-use-before-define.js index bdff23934c21fd..ada01815d9c888 100644 --- a/tools/eslint/lib/rules/no-use-before-define.js +++ b/tools/eslint/lib/rules/no-use-before-define.js @@ -59,11 +59,11 @@ function isOuterClass(variable, reference) { } /** -* Checks whether or not a given variable is a variable declaration in an upper function scope. -* @param {eslint-scope.Variable} variable - A variable to check. -* @param {eslint-scope.Reference} reference - A reference to check. -* @returns {boolean} `true` if the variable is a variable declaration. -*/ + * Checks whether or not a given variable is a variable declaration in an upper function scope. + * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Reference} reference - A reference to check. + * @returns {boolean} `true` if the variable is a variable declaration. + */ function isOuterVariable(variable, reference) { return ( variable.defs[0].type === "Variable" && @@ -194,12 +194,14 @@ module.exports = { scope.references.forEach(reference => { const variable = reference.resolved; - // Skips when the reference is: - // - initialization's. - // - referring to an undefined variable. - // - referring to a global environment variable (there're no identifiers). - // - located preceded by the variable (except in initializers). - // - allowed by options. + /* + * Skips when the reference is: + * - initialization's. + * - referring to an undefined variable. + * - referring to a global environment variable (there're no identifiers). + * - located preceded by the variable (except in initializers). + * - allowed by options. + */ if (reference.init || !variable || variable.identifiers.length === 0 || diff --git a/tools/eslint/lib/rules/no-useless-call.js b/tools/eslint/lib/rules/no-useless-call.js index eb67bcb3b25271..e4820ac248e04a 100644 --- a/tools/eslint/lib/rules/no-useless-call.js +++ b/tools/eslint/lib/rules/no-useless-call.js @@ -28,30 +28,6 @@ function isCallOrNonVariadicApply(node) { ); } -/** - * Checks whether or not the tokens of two given nodes are same. - * @param {ASTNode} left - A node 1 to compare. - * @param {ASTNode} right - A node 2 to compare. - * @param {SourceCode} sourceCode - The ESLint source code object. - * @returns {boolean} the source code for the given node. - */ -function equalTokens(left, right, sourceCode) { - const tokensL = sourceCode.getTokens(left); - const tokensR = sourceCode.getTokens(right); - - if (tokensL.length !== tokensR.length) { - return false; - } - for (let i = 0; i < tokensL.length; ++i) { - if (tokensL[i].type !== tokensR[i].type || - tokensL[i].value !== tokensR[i].value - ) { - return false; - } - } - - return true; -} /** * Checks whether or not `thisArg` is not changed by `.call()`/`.apply()`. @@ -64,7 +40,7 @@ function isValidThisArg(expectedThis, thisArg, sourceCode) { if (!expectedThis) { return astUtils.isNullOrUndefined(thisArg); } - return equalTokens(expectedThis, thisArg, sourceCode); + return astUtils.equalTokens(expectedThis, thisArg, sourceCode); } //------------------------------------------------------------------------------ diff --git a/tools/eslint/lib/rules/no-useless-escape.js b/tools/eslint/lib/rules/no-useless-escape.js index 9e39eb6f43fa41..cdc3e98df85c5d 100644 --- a/tools/eslint/lib/rules/no-useless-escape.js +++ b/tools/eslint/lib/rules/no-useless-escape.js @@ -12,11 +12,11 @@ const astUtils = require("../ast-utils"); //------------------------------------------------------------------------------ /** -* Returns the union of two sets. -* @param {Set} setA The first set -* @param {Set} setB The second set -* @returns {Set} The union of the two sets -*/ + * Returns the union of two sets. + * @param {Set} setA The first set + * @param {Set} setB The second set + * @returns {Set} The union of the two sets + */ function union(setA, setB) { return new Set(function *() { yield* setA; @@ -29,22 +29,22 @@ const REGEX_GENERAL_ESCAPES = new Set("\\bcdDfnrsStvwWxu0123456789]"); const REGEX_NON_CHARCLASS_ESCAPES = union(REGEX_GENERAL_ESCAPES, new Set("^/.$*+?[{}|()B")); /** -* Parses a regular expression into a list of characters with character class info. -* @param {string} regExpText The raw text used to create the regular expression -* @returns {Object[]} A list of characters, each with info on escaping and whether they're in a character class. -* @example -* -* parseRegExp('a\\b[cd-]') -* -* returns: -* [ -* {text: 'a', index: 0, escaped: false, inCharClass: false, startsCharClass: false, endsCharClass: false}, -* {text: 'b', index: 2, escaped: true, inCharClass: false, startsCharClass: false, endsCharClass: false}, -* {text: 'c', index: 4, escaped: false, inCharClass: true, startsCharClass: true, endsCharClass: false}, -* {text: 'd', index: 5, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false}, -* {text: '-', index: 6, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false} -* ] -*/ + * Parses a regular expression into a list of characters with character class info. + * @param {string} regExpText The raw text used to create the regular expression + * @returns {Object[]} A list of characters, each with info on escaping and whether they're in a character class. + * @example + * + * parseRegExp('a\\b[cd-]') + * + * returns: + * [ + * {text: 'a', index: 0, escaped: false, inCharClass: false, startsCharClass: false, endsCharClass: false}, + * {text: 'b', index: 2, escaped: true, inCharClass: false, startsCharClass: false, endsCharClass: false}, + * {text: 'c', index: 4, escaped: false, inCharClass: true, startsCharClass: true, endsCharClass: false}, + * {text: 'd', index: 5, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false}, + * {text: '-', index: 6, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false} + * ] + */ function parseRegExp(regExpText) { const charList = []; @@ -130,7 +130,8 @@ module.exports = { isUnnecessaryEscape = match.input[match.index + 2] !== "{"; } else if (escapedChar === "{") { - /* Warn if `\{` is not preceded by `$`. If preceded by `$`, escaping + /* + * Warn if `\{` is not preceded by `$`. If preceded by `$`, escaping * is necessary and the rule should not warn. If preceded by `/$`, the rule * will warn for the `/$` instead, as it is the first unnecessarily escaped character. */ diff --git a/tools/eslint/lib/rules/no-useless-return.js b/tools/eslint/lib/rules/no-useless-return.js index 29f644cc43df73..5415bf59b80bce 100644 --- a/tools/eslint/lib/rules/no-useless-return.js +++ b/tools/eslint/lib/rules/no-useless-return.js @@ -222,10 +222,12 @@ module.exports = { fix(fixer) { if (isRemovable(node)) { - // Extend the replacement range to include the - // entire function to avoid conflicting with - // no-else-return. - // https://github.com/eslint/eslint/issues/8026 + /* + * Extend the replacement range to include the + * entire function to avoid conflicting with + * no-else-return. + * https://github.com/eslint/eslint/issues/8026 + */ return new FixTracker(fixer, context.getSourceCode()) .retainEnclosingFunction(node) .remove(node); @@ -238,8 +240,10 @@ module.exports = { scopeInfo = scopeInfo.upper; }, - // Initializes segments. - // NOTE: This event is notified for only reachable segments. + /* + * Initializes segments. + * NOTE: This event is notified for only reachable segments. + */ onCodePathSegmentStart(segment) { const info = { uselessReturns: getUselessReturns([], segment.allPrevSegments), @@ -270,8 +274,10 @@ module.exports = { scopeInfo.uselessReturns.push(node); }, - // Registers for all statement nodes except FunctionDeclaration, BlockStatement, BreakStatement. - // Removes return statements of the current segments from the useless return statement list. + /* + * Registers for all statement nodes except FunctionDeclaration, BlockStatement, BreakStatement. + * Removes return statements of the current segments from the useless return statement list. + */ ClassDeclaration: markReturnStatementsOnCurrentSegmentsAsUsed, ContinueStatement: markReturnStatementsOnCurrentSegmentsAsUsed, DebuggerStatement: markReturnStatementsOnCurrentSegmentsAsUsed, diff --git a/tools/eslint/lib/rules/no-whitespace-before-property.js b/tools/eslint/lib/rules/no-whitespace-before-property.js index 71db50c4395643..2d476b66c0a99c 100644 --- a/tools/eslint/lib/rules/no-whitespace-before-property.js +++ b/tools/eslint/lib/rules/no-whitespace-before-property.js @@ -53,8 +53,10 @@ module.exports = { fix(fixer) { if (!node.computed && astUtils.isDecimalInteger(node.object)) { - // If the object is a number literal, fixing it to something like 5.toString() would cause a SyntaxError. - // Don't fix this case. + /* + * If the object is a number literal, fixing it to something like 5.toString() would cause a SyntaxError. + * Don't fix this case. + */ return null; } return fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], replacementText); diff --git a/tools/eslint/lib/rules/object-curly-newline.js b/tools/eslint/lib/rules/object-curly-newline.js index 42f2778739d0ec..ebad69de2ee123 100644 --- a/tools/eslint/lib/rules/object-curly-newline.js +++ b/tools/eslint/lib/rules/object-curly-newline.js @@ -131,8 +131,15 @@ module.exports = { */ function check(node) { const options = normalizedOptions[node.type]; - const openBrace = sourceCode.getFirstToken(node); - const closeBrace = sourceCode.getLastToken(node); + const openBrace = sourceCode.getFirstToken(node, token => token.value === "{"); + let closeBrace; + + if (node.typeAnnotation) { + closeBrace = sourceCode.getTokenBefore(node.typeAnnotation); + } else { + closeBrace = sourceCode.getLastToken(node); + } + let first = sourceCode.getTokenAfter(openBrace, { includeComments: true }); let last = sourceCode.getTokenBefore(closeBrace, { includeComments: true }); const needsLinebreaks = ( diff --git a/tools/eslint/lib/rules/object-curly-spacing.js b/tools/eslint/lib/rules/object-curly-spacing.js index c1d83c73df41ab..3341e915f24954 100644 --- a/tools/eslint/lib/rules/object-curly-spacing.js +++ b/tools/eslint/lib/rules/object-curly-spacing.js @@ -65,11 +65,11 @@ module.exports = { //-------------------------------------------------------------------------- /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportNoBeginningSpace(node, token) { context.report({ node, @@ -87,11 +87,11 @@ module.exports = { } /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportNoEndingSpace(node, token) { context.report({ node, @@ -109,11 +109,11 @@ module.exports = { } /** - * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredBeginningSpace(node, token) { context.report({ node, @@ -129,11 +129,11 @@ module.exports = { } /** - * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ + * Reports that there should be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ function reportRequiredEndingSpace(node, token) { context.report({ node, diff --git a/tools/eslint/lib/rules/object-shorthand.js b/tools/eslint/lib/rules/object-shorthand.js index dfd8d1a64e027f..980d0fc35a52b2 100644 --- a/tools/eslint/lib/rules/object-shorthand.js +++ b/tools/eslint/lib/rules/object-shorthand.js @@ -127,16 +127,17 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the property can have a shorthand form * @private - **/ + * + */ function canHaveShorthand(property) { return (property.kind !== "set" && property.kind !== "get" && property.type !== "SpreadProperty" && property.type !== "ExperimentalSpreadProperty"); } /** - * Checks whether a node is a string literal. - * @param {ASTNode} node - Any AST node. - * @returns {boolean} `true` if it is a string literal. - */ + * Checks whether a node is a string literal. + * @param {ASTNode} node - Any AST node. + * @returns {boolean} `true` if it is a string literal. + */ function isStringLiteral(node) { return node.type === "Literal" && typeof node.value === "string"; } @@ -146,7 +147,8 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the property is considered shorthand, false if not. * @private - **/ + * + */ function isShorthand(property) { // property.method is true when `{a(){}}`. @@ -158,7 +160,8 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the key and value are named equally, false if not. * @private - **/ + * + */ function isRedundant(property) { const value = property.value; @@ -177,7 +180,8 @@ module.exports = { * @param {ASTNode} node Property AST node * @param {boolean} checkRedundancy Whether to check longform redundancy * @returns {void} - **/ + * + */ function checkConsistency(node, checkRedundancy) { // We are excluding getters/setters and spread properties as they are considered neither longform nor shorthand. @@ -187,8 +191,10 @@ module.exports = { if (properties.length > 0) { const shorthandProperties = properties.filter(isShorthand); - // If we do not have an equal number of longform properties as - // shorthand properties, we are using the annotations inconsistently + /* + * If we do not have an equal number of longform properties as + * shorthand properties, we are using the annotations inconsistently + */ if (shorthandProperties.length !== properties.length) { // We have at least 1 shorthand property @@ -196,8 +202,10 @@ module.exports = { context.report({ node, message: "Unexpected mix of shorthand and non-shorthand properties." }); } else if (checkRedundancy) { - // If all properties of the object contain a method or value with a name matching it's key, - // all the keys are redundant. + /* + * If all properties of the object contain a method or value with a name matching it's key, + * all the keys are redundant. + */ const canAlwaysUseShorthand = properties.every(isRedundant); if (canAlwaysUseShorthand) { @@ -209,11 +217,11 @@ module.exports = { } /** - * Fixes a FunctionExpression node by making it into a shorthand property. - * @param {SourceCodeFixer} fixer The fixer object - * @param {ASTNode} node A `Property` node that has a `FunctionExpression` or `ArrowFunctionExpression` as its value - * @returns {Object} A fix for this node - */ + * Fixes a FunctionExpression node by making it into a shorthand property. + * @param {SourceCodeFixer} fixer The fixer object + * @param {ASTNode} node A `Property` node that has a `FunctionExpression` or `ArrowFunctionExpression` as its value + * @returns {Object} A fix for this node + */ function makeFunctionShorthand(fixer, node) { const firstKeyToken = node.computed ? sourceCode.getFirstToken(node, astUtils.isOpeningBracketToken) @@ -253,11 +261,11 @@ module.exports = { } /** - * Fixes a FunctionExpression node by making it into a longform property. - * @param {SourceCodeFixer} fixer The fixer object - * @param {ASTNode} node A `Property` node that has a `FunctionExpression` as its value - * @returns {Object} A fix for this node - */ + * Fixes a FunctionExpression node by making it into a longform property. + * @param {SourceCodeFixer} fixer The fixer object + * @param {ASTNode} node A `Property` node that has a `FunctionExpression` as its value + * @returns {Object} A fix for this node + */ function makeFunctionLongform(fixer, node) { const firstKeyToken = node.computed ? sourceCode.getTokens(node).find(token => token.value === "[") : sourceCode.getFirstToken(node.key); const lastKeyToken = node.computed ? sourceCode.getTokensBetween(node.key, node.value).find(token => token.value === "]") : sourceCode.getLastToken(node.key); @@ -288,10 +296,10 @@ module.exports = { const argumentsIdentifiers = new WeakSet(); /** - * Enters a function. This creates a new lexical identifier scope, so a new Set of arrow functions is pushed onto the stack. - * Also, this marks all `arguments` identifiers so that they can be detected later. - * @returns {void} - */ + * Enters a function. This creates a new lexical identifier scope, so a new Set of arrow functions is pushed onto the stack. + * Also, this marks all `arguments` identifiers so that they can be detected later. + * @returns {void} + */ function enterFunction() { lexicalScopeStack.unshift(new Set()); context.getScope().variables.filter(variable => variable.name === "arguments").forEach(variable => { @@ -300,18 +308,18 @@ module.exports = { } /** - * Exits a function. This pops the current set of arrow functions off the lexical scope stack. - * @returns {void} - */ + * Exits a function. This pops the current set of arrow functions off the lexical scope stack. + * @returns {void} + */ function exitFunction() { lexicalScopeStack.shift(); } /** - * Marks the current function as having a lexical keyword. This implies that all arrow functions - * in the current lexical scope contain a reference to this lexical keyword. - * @returns {void} - */ + * Marks the current function as having a lexical keyword. This implies that all arrow functions + * in the current lexical scope contain a reference to this lexical keyword. + * @returns {void} + */ function reportLexicalIdentifier() { lexicalScopeStack[0].forEach(arrowFunction => arrowsWithLexicalIdentifiers.add(arrowFunction)); } diff --git a/tools/eslint/lib/rules/operator-assignment.js b/tools/eslint/lib/rules/operator-assignment.js index 99cca356f275a9..f776609f5e33ac 100644 --- a/tools/eslint/lib/rules/operator-assignment.js +++ b/tools/eslint/lib/rules/operator-assignment.js @@ -77,11 +77,11 @@ function same(a, b) { } /** -* Determines if the left side of a node can be safely fixed (i.e. if it activates the same getters/setters and) -* toString calls regardless of whether assignment shorthand is used) -* @param {ASTNode} node The node on the left side of the expression -* @returns {boolean} `true` if the node can be fixed -*/ + * Determines if the left side of a node can be safely fixed (i.e. if it activates the same getters/setters and) + * toString calls regardless of whether assignment shorthand is used) + * @param {ASTNode} node The node on the left side of the expression + * @returns {boolean} `true` if the node can be fixed + */ function canBeFixed(node) { return node.type === "Identifier" || node.type === "MemberExpression" && node.object.type === "Identifier" && (!node.computed || node.property.type === "Literal"); @@ -109,10 +109,10 @@ module.exports = { const sourceCode = context.getSourceCode(); /** - * Returns the operator token of an AssignmentExpression or BinaryExpression - * @param {ASTNode} node An AssignmentExpression or BinaryExpression node - * @returns {Token} The operator token in the node - */ + * Returns the operator token of an AssignmentExpression or BinaryExpression + * @param {ASTNode} node An AssignmentExpression or BinaryExpression node + * @returns {Token} The operator token in the node + */ function getOperatorToken(node) { return sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); } diff --git a/tools/eslint/lib/rules/operator-linebreak.js b/tools/eslint/lib/rules/operator-linebreak.js index 809da1fc8c5f4d..271cbb35c1d88b 100644 --- a/tools/eslint/lib/rules/operator-linebreak.js +++ b/tools/eslint/lib/rules/operator-linebreak.js @@ -69,11 +69,11 @@ module.exports = { //-------------------------------------------------------------------------- /** - * Gets a fixer function to fix rule issues - * @param {Token} operatorToken The operator token of an expression - * @param {string} desiredStyle The style for the rule. One of 'before', 'after', 'none' - * @returns {Function} A fixer function - */ + * Gets a fixer function to fix rule issues + * @param {Token} operatorToken The operator token of an expression + * @param {string} desiredStyle The style for the rule. One of 'before', 'after', 'none' + * @returns {Function} A fixer function + */ function getFixer(operatorToken, desiredStyle) { return fixer => { const tokenBefore = sourceCode.getTokenBefore(operatorToken); @@ -135,11 +135,13 @@ module.exports = { */ function validateNode(node, leftSide) { - // When the left part of a binary expression is a single expression wrapped in - // parentheses (ex: `(a) + b`), leftToken will be the last token of the expression - // and operatorToken will be the closing parenthesis. - // The leftToken should be the last closing parenthesis, and the operatorToken - // should be the token right after that. + /* + * When the left part of a binary expression is a single expression wrapped in + * parentheses (ex: `(a) + b`), leftToken will be the last token of the expression + * and operatorToken will be the closing parenthesis. + * The leftToken should be the last closing parenthesis, and the operatorToken + * should be the token right after that. + */ const operatorToken = sourceCode.getTokenAfter(leftSide, astUtils.isNotClosingParenToken); const leftToken = sourceCode.getTokenBefore(operatorToken); const rightToken = sourceCode.getTokenAfter(operatorToken); diff --git a/tools/eslint/lib/rules/padding-line-between-statements.js b/tools/eslint/lib/rules/padding-line-between-statements.js index bc6b26ee957b82..a89c49decf5e4a 100644 --- a/tools/eslint/lib/rules/padding-line-between-statements.js +++ b/tools/eslint/lib/rules/padding-line-between-statements.js @@ -85,8 +85,10 @@ function isBlockLikeStatement(sourceCode, node) { return true; } - // IIFE is a block-like statement specially from - // JSCS#disallowPaddingNewLinesAfterBlocks. + /* + * IIFE is a block-like statement specially from + * JSCS#disallowPaddingNewLinesAfterBlocks. + */ if (isIIFEStatement(node)) { return true; } diff --git a/tools/eslint/lib/rules/prefer-arrow-callback.js b/tools/eslint/lib/rules/prefer-arrow-callback.js index 7565e445f83168..31ae2859fea840 100644 --- a/tools/eslint/lib/rules/prefer-arrow-callback.js +++ b/tools/eslint/lib/rules/prefer-arrow-callback.js @@ -115,12 +115,12 @@ function getCallbackInfo(node) { } /** -* Checks whether a simple list of parameters contains any duplicates. This does not handle complex -parameter lists (e.g. with destructuring), since complex parameter lists are a SyntaxError with duplicate -parameter names anyway. Instead, it always returns `false` for complex parameter lists. -* @param {ASTNode[]} paramsList The list of parameters for a function -* @returns {boolean} `true` if the list of parameters contains any duplicates -*/ + * Checks whether a simple list of parameters contains any duplicates. This does not handle complex + * parameter lists (e.g. with destructuring), since complex parameter lists are a SyntaxError with duplicate + * parameter names anyway. Instead, it always returns `false` for complex parameter lists. + * @param {ASTNode[]} paramsList The list of parameters for a function + * @returns {boolean} `true` if the list of parameters contains any duplicates + */ function hasDuplicateParams(paramsList) { return paramsList.every(param => param.type === "Identifier") && paramsList.length !== new Set(paramsList.map(param => param.name)).size; } @@ -265,10 +265,12 @@ module.exports = { fix(fixer) { if ((!callbackInfo.isLexicalThis && scopeInfo.this) || hasDuplicateParams(node.params)) { - // If the callback function does not have .bind(this) and contains a reference to `this`, there - // is no way to determine what `this` should be, so don't perform any fixes. - // If the callback function has duplicates in its list of parameters (possible in sloppy mode), - // don't replace it with an arrow function, because this is a SyntaxError with arrow functions. + /* + * If the callback function does not have .bind(this) and contains a reference to `this`, there + * is no way to determine what `this` should be, so don't perform any fixes. + * If the callback function has duplicates in its list of parameters (possible in sloppy mode), + * don't replace it with an arrow function, because this is a SyntaxError with arrow functions. + */ return null; } diff --git a/tools/eslint/lib/rules/prefer-const.js b/tools/eslint/lib/rules/prefer-const.js index 1395e0a8a08e92..a8cf3b7ef61893 100644 --- a/tools/eslint/lib/rules/prefer-const.js +++ b/tools/eslint/lib/rules/prefer-const.js @@ -112,8 +112,10 @@ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) { } } - // If the assignment is from a different scope, ignore it. - // If the assignment cannot change to a declaration, ignore it. + /* + * If the assignment is from a different scope, ignore it. + * If the assignment cannot change to a declaration, ignore it. + */ const shouldBeConst = ( writer !== null && writer.from === variable.scope && @@ -179,8 +181,10 @@ function groupByDestructuring(variables, ignoreReadBeforeAssign) { const reference = references[j]; const id = reference.identifier; - // Avoid counting a reference twice or more for default values of - // destructuring. + /* + * Avoid counting a reference twice or more for default values of + * destructuring. + */ if (id === prevId) { continue; } @@ -274,17 +278,21 @@ module.exports = { const varDeclParent = findUp(nodes[0], "VariableDeclaration", parentNode => parentNode.type.endsWith("Statement")); const shouldFix = varDeclParent && - // If there are multiple variable declarations, like {let a = 1, b = 2}, then - // do not attempt to fix if one of the declarations should be `const`. It's - // too hard to know how the developer would want to automatically resolve the issue. + /* + * If there are multiple variable declarations, like {let a = 1, b = 2}, then + * do not attempt to fix if one of the declarations should be `const`. It's + * too hard to know how the developer would want to automatically resolve the issue. + */ varDeclParent.declarations.length === 1 && // Don't do a fix unless the variable is initialized (or it's in a for-in or for-of loop) (varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" || varDeclParent.declarations[0].init) && - // If options.destucturing is "all", then this warning will not occur unless - // every assignment in the destructuring should be const. In that case, it's safe - // to apply the fix. + /* + * If options.destucturing is "all", then this warning will not occur unless + * every assignment in the destructuring should be const. In that case, it's safe + * to apply the fix. + */ nodesToReport.length === nodes.length; nodesToReport.forEach(node => { diff --git a/tools/eslint/lib/rules/prefer-destructuring.js b/tools/eslint/lib/rules/prefer-destructuring.js index ebf4e713b3b888..56c348a4785321 100644 --- a/tools/eslint/lib/rules/prefer-destructuring.js +++ b/tools/eslint/lib/rules/prefer-destructuring.js @@ -18,8 +18,10 @@ module.exports = { schema: [ { - // old support {array: Boolean, object: Boolean} - // new support {VariableDeclarator: {}, AssignmentExpression: {}} + /* + * old support {array: Boolean, object: Boolean} + * new support {VariableDeclarator: {}, AssignmentExpression: {}} + */ oneOf: [ { type: "object", @@ -143,7 +145,7 @@ module.exports = { * @returns {void} */ function performCheck(leftNode, rightNode, reportNode) { - if (rightNode.type !== "MemberExpression") { + if (rightNode.type !== "MemberExpression" || rightNode.object.type === "Super") { return; } diff --git a/tools/eslint/lib/rules/prefer-numeric-literals.js b/tools/eslint/lib/rules/prefer-numeric-literals.js index 08deedd624dc83..929e660c665538 100644 --- a/tools/eslint/lib/rules/prefer-numeric-literals.js +++ b/tools/eslint/lib/rules/prefer-numeric-literals.js @@ -96,8 +96,10 @@ module.exports = { if (+(newPrefix + node.arguments[0].value) !== parseInt(node.arguments[0].value, node.arguments[1].value)) { - // If the newly-produced literal would be invalid, (e.g. 0b1234), - // or it would yield an incorrect parseInt result for some other reason, don't make a fix. + /* + * If the newly-produced literal would be invalid, (e.g. 0b1234), + * or it would yield an incorrect parseInt result for some other reason, don't make a fix. + */ return null; } return fixer.replaceText(node, prefixMap[node.arguments[1].value] + node.arguments[0].value); diff --git a/tools/eslint/lib/rules/prefer-promise-reject-errors.js b/tools/eslint/lib/rules/prefer-promise-reject-errors.js index 97223a65a822ba..d2a6b5df102eb1 100644 --- a/tools/eslint/lib/rules/prefer-promise-reject-errors.js +++ b/tools/eslint/lib/rules/prefer-promise-reject-errors.js @@ -38,10 +38,10 @@ module.exports = { //---------------------------------------------------------------------- /** - * Checks the argument of a reject() or Promise.reject() CallExpression, and reports it if it can't be an Error - * @param {ASTNode} callExpression A CallExpression node which is used to reject a Promise - * @returns {void} - */ + * Checks the argument of a reject() or Promise.reject() CallExpression, and reports it if it can't be an Error + * @param {ASTNode} callExpression A CallExpression node which is used to reject a Promise + * @returns {void} + */ function checkRejectCall(callExpression) { if (!callExpression.arguments.length && ALLOW_EMPTY_REJECT) { return; @@ -59,10 +59,10 @@ module.exports = { } /** - * Determines whether a function call is a Promise.reject() call - * @param {ASTNode} node A CallExpression node - * @returns {boolean} `true` if the call is a Promise.reject() call - */ + * Determines whether a function call is a Promise.reject() call + * @param {ASTNode} node A CallExpression node + * @returns {boolean} `true` if the call is a Promise.reject() call + */ function isPromiseRejectCall(node) { return node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "Promise" && @@ -96,14 +96,14 @@ module.exports = { context.getDeclaredVariables(node.arguments[0]) /* - * Find the first variable that matches the second parameter's name. - * If the first parameter has the same name as the second parameter, then the variable will actually - * be "declared" when the first parameter is evaluated, but then it will be immediately overwritten - * by the second parameter. It's not possible for an expression with the variable to be evaluated before - * the variable is overwritten, because functions with duplicate parameters cannot have destructuring or - * default assignments in their parameter lists. Therefore, it's not necessary to explicitly account for - * this case. - */ + * Find the first variable that matches the second parameter's name. + * If the first parameter has the same name as the second parameter, then the variable will actually + * be "declared" when the first parameter is evaluated, but then it will be immediately overwritten + * by the second parameter. It's not possible for an expression with the variable to be evaluated before + * the variable is overwritten, because functions with duplicate parameters cannot have destructuring or + * default assignments in their parameter lists. Therefore, it's not necessary to explicitly account for + * this case. + */ .find(variable => variable.name === node.arguments[0].params[1].name) // Get the references to that variable. diff --git a/tools/eslint/lib/rules/prefer-rest-params.js b/tools/eslint/lib/rules/prefer-rest-params.js index d55d5dad02a09e..03342371b2bfed 100644 --- a/tools/eslint/lib/rules/prefer-rest-params.js +++ b/tools/eslint/lib/rules/prefer-rest-params.js @@ -22,8 +22,10 @@ function getVariableOfArguments(scope) { if (variable.name === "arguments") { - // If there was a parameter which is named "arguments", the implicit "arguments" is not defined. - // So does fast return with null. + /* + * If there was a parameter which is named "arguments", the implicit "arguments" is not defined. + * So does fast return with null. + */ return (variable.identifiers.length === 0) ? variable : null; } } diff --git a/tools/eslint/lib/rules/prefer-spread.js b/tools/eslint/lib/rules/prefer-spread.js index 1f578582843030..c111d5f98e805f 100644 --- a/tools/eslint/lib/rules/prefer-spread.js +++ b/tools/eslint/lib/rules/prefer-spread.js @@ -28,30 +28,6 @@ function isVariadicApplyCalling(node) { ); } -/** - * Checks whether or not the tokens of two given nodes are same. - * @param {ASTNode} left - A node 1 to compare. - * @param {ASTNode} right - A node 2 to compare. - * @param {SourceCode} sourceCode - The ESLint source code object. - * @returns {boolean} the source code for the given node. - */ -function equalTokens(left, right, sourceCode) { - const tokensL = sourceCode.getTokens(left); - const tokensR = sourceCode.getTokens(right); - - if (tokensL.length !== tokensR.length) { - return false; - } - for (let i = 0; i < tokensL.length; ++i) { - if (tokensL[i].type !== tokensR[i].type || - tokensL[i].value !== tokensR[i].value - ) { - return false; - } - } - - return true; -} /** * Checks whether or not `thisArg` is not changed by `.apply()`. @@ -64,7 +40,7 @@ function isValidThisArg(expectedThis, thisArg, context) { if (!expectedThis) { return astUtils.isNullOrUndefined(thisArg); } - return equalTokens(expectedThis, thisArg, context); + return astUtils.equalTokens(expectedThis, thisArg, context); } //------------------------------------------------------------------------------ diff --git a/tools/eslint/lib/rules/prefer-template.js b/tools/eslint/lib/rules/prefer-template.js index 9dc05e8be24450..076ce6a3ea8a63 100644 --- a/tools/eslint/lib/rules/prefer-template.js +++ b/tools/eslint/lib/rules/prefer-template.js @@ -37,10 +37,10 @@ function getTopConcatBinaryExpression(node) { } /** -* Checks whether or not a given binary expression has string literals. -* @param {ASTNode} node - A node to check. -* @returns {boolean} `true` if the node has string literals. -*/ + * Checks whether or not a given binary expression has string literals. + * @param {ASTNode} node - A node to check. + * @returns {boolean} `true` if the node has string literals. + */ function hasStringLiteral(node) { if (isConcatenation(node)) { @@ -65,10 +65,10 @@ function hasNonStringLiteral(node) { } /** -* Determines whether a given node will start with a template curly expression (`${}`) when being converted to a template literal. -* @param {ASTNode} node The node that will be fixed to a template literal -* @returns {boolean} `true` if the node will start with a template curly. -*/ + * Determines whether a given node will start with a template curly expression (`${}`) when being converted to a template literal. + * @param {ASTNode} node The node that will be fixed to a template literal + * @returns {boolean} `true` if the node will start with a template curly. + */ function startsWithTemplateCurly(node) { if (node.type === "BinaryExpression") { return startsWithTemplateCurly(node.left); @@ -80,10 +80,10 @@ function startsWithTemplateCurly(node) { } /** -* Determines whether a given node end with a template curly expression (`${}`) when being converted to a template literal. -* @param {ASTNode} node The node that will be fixed to a template literal -* @returns {boolean} `true` if the node will end with a template curly. -*/ + * Determines whether a given node end with a template curly expression (`${}`) when being converted to a template literal. + * @param {ASTNode} node The node that will be fixed to a template literal + * @returns {boolean} `true` if the node will end with a template curly. + */ function endsWithTemplateCurly(node) { if (node.type === "BinaryExpression") { return startsWithTemplateCurly(node.right); @@ -116,11 +116,11 @@ module.exports = { let done = Object.create(null); /** - * Gets the non-token text between two nodes, ignoring any other tokens that appear between the two tokens. - * @param {ASTNode} node1 The first node - * @param {ASTNode} node2 The second node - * @returns {string} The text between the nodes, excluding other tokens - */ + * Gets the non-token text between two nodes, ignoring any other tokens that appear between the two tokens. + * @param {ASTNode} node1 The first node + * @param {ASTNode} node2 The second node + * @returns {string} The text between the nodes, excluding other tokens + */ function getTextBetween(node1, node2) { const allTokens = [node1].concat(sourceCode.getTokensBetween(node1, node2)).concat(node2); const sourceText = sourceCode.getText(); @@ -129,19 +129,21 @@ module.exports = { } /** - * Returns a template literal form of the given node. - * @param {ASTNode} currentNode A node that should be converted to a template literal - * @param {string} textBeforeNode Text that should appear before the node - * @param {string} textAfterNode Text that should appear after the node - * @returns {string} A string form of this node, represented as a template literal - */ + * Returns a template literal form of the given node. + * @param {ASTNode} currentNode A node that should be converted to a template literal + * @param {string} textBeforeNode Text that should appear before the node + * @param {string} textAfterNode Text that should appear after the node + * @returns {string} A string form of this node, represented as a template literal + */ function getTemplateLiteral(currentNode, textBeforeNode, textAfterNode) { if (currentNode.type === "Literal" && typeof currentNode.value === "string") { - // If the current node is a string literal, escape any instances of ${ or ` to prevent them from being interpreted - // as a template placeholder. However, if the code already contains a backslash before the ${ or ` - // for some reason, don't add another backslash, because that would change the meaning of the code (it would cause - // an actual backslash character to appear before the dollar sign). + /* + * If the current node is a string literal, escape any instances of ${ or ` to prevent them from being interpreted + * as a template placeholder. However, if the code already contains a backslash before the ${ or ` + * for some reason, don't add another backslash, because that would change the meaning of the code (it would cause + * an actual backslash character to appear before the dollar sign). + */ return `\`${currentNode.raw.slice(1, -1).replace(/\\*(\${|`)/g, matched => { if (matched.lastIndexOf("\\") % 2) { return `\\${matched}`; @@ -178,8 +180,10 @@ module.exports = { getTemplateLiteral(currentNode.right, textBeforePlus + textAfterPlus, textAfterNode).slice(1); } - // Otherwise, these nodes should not be combined into a template curly, since there is nowhere to put - // the text between them. + /* + * Otherwise, these nodes should not be combined into a template curly, since there is nowhere to put + * the text between them. + */ return `${getTemplateLiteral(currentNode.left, textBeforeNode, null)}${textBeforePlus}+${textAfterPlus}${getTemplateLiteral(currentNode.right, textAfterNode, null)}`; } diff --git a/tools/eslint/lib/rules/quote-props.js b/tools/eslint/lib/rules/quote-props.js index 305a1b41b6dff7..6ac1f3c138f9a4 100644 --- a/tools/eslint/lib/rules/quote-props.js +++ b/tools/eslint/lib/rules/quote-props.js @@ -104,19 +104,19 @@ module.exports = { } /** - * Returns a string representation of a property node with quotes removed - * @param {ASTNode} key Key AST Node, which may or may not be quoted - * @returns {string} A replacement string for this property - */ + * Returns a string representation of a property node with quotes removed + * @param {ASTNode} key Key AST Node, which may or may not be quoted + * @returns {string} A replacement string for this property + */ function getUnquotedKey(key) { return key.type === "Identifier" ? key.name : key.value; } /** - * Returns a string representation of a property node with quotes added - * @param {ASTNode} key Key AST Node, which may or may not be quoted - * @returns {string} A replacement string for this property - */ + * Returns a string representation of a property node with quotes added + * @param {ASTNode} key Key AST Node, which may or may not be quoted + * @returns {string} A replacement string for this property + */ function getQuotedKey(key) { if (key.type === "Literal" && typeof key.value === "string") { diff --git a/tools/eslint/lib/rules/semi-style.js b/tools/eslint/lib/rules/semi-style.js index 97fcc3ac8209bb..41fb39246c7514 100644 --- a/tools/eslint/lib/rules/semi-style.js +++ b/tools/eslint/lib/rules/semi-style.js @@ -18,13 +18,51 @@ const astUtils = require("../ast-utils"); const SELECTOR = `:matches(${ [ "BreakStatement", "ContinueStatement", "DebuggerStatement", - "DoWhileStatement", "EmptyStatement", "ExportAllDeclaration", + "DoWhileStatement", "ExportAllDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExpressionStatement", "ImportDeclaration", "ReturnStatement", "ThrowStatement", "VariableDeclaration" ].join(",") })`; +/** + * Get the child node list of a given node. + * This returns `Program#body`, `BlockStatement#body`, or `SwitchCase#consequent`. + * This is used to check whether a node is the first/last child. + * @param {Node} node A node to get child node list. + * @returns {Node[]|null} The child node list. + */ +function getChildren(node) { + const t = node.type; + + if (t === "BlockStatement" || t === "Program") { + return node.body; + } + if (t === "SwitchCase") { + return node.consequent; + } + return null; +} + +/** + * Check whether a given node is the last statement in the parent block. + * @param {Node} node A node to check. + * @returns {boolean} `true` if the node is the last statement in the parent block. + */ +function isLastChild(node) { + const t = node.parent.type; + + if (t === "IfStatement" && node.parent.consequent === node && node.parent.alternate) { // before `else` keyword. + return true; + } + if (t === "DoWhileStatement") { // before `while` keyword. + return true; + } + const nodeList = getChildren(node.parent); + + return nodeList !== null && nodeList[nodeList.length - 1] === node; // before `}` or etc. +} + module.exports = { meta: { docs: { @@ -40,23 +78,6 @@ module.exports = { const sourceCode = context.getSourceCode(); const option = context.options[0] || "last"; - /** - * Check whether comments exist between the given 2 tokens. - * @param {Token} left The left token to check. - * @param {Token} right The right token to check. - * @returns {boolean} `true` if comments exist between the given 2 tokens. - */ - function commentsExistBetween(left, right) { - return sourceCode.getFirstTokenBetween( - left, - right, - { - includeComments: true, - filter: astUtils.isCommentToken - } - ) !== null; - } - /** * Check the given semicolon token. * @param {Token} semiToken The semicolon token to check. @@ -79,7 +100,7 @@ module.exports = { : "the beginning of the next line" }, fix(fixer) { - if (prevToken && nextToken && commentsExistBetween(prevToken, nextToken)) { + if (prevToken && nextToken && sourceCode.commentsExistBetween(prevToken, nextToken)) { return null; } @@ -95,6 +116,10 @@ module.exports = { return { [SELECTOR](node) { + if (option === "first" && isLastChild(node)) { + return; + } + const lastToken = sourceCode.getLastToken(node); if (astUtils.isSemicolonToken(lastToken)) { diff --git a/tools/eslint/lib/rules/semi.js b/tools/eslint/lib/rules/semi.js index 0bfdff110f2437..78b6966deab67e 100644 --- a/tools/eslint/lib/rules/semi.js +++ b/tools/eslint/lib/rules/semi.js @@ -32,10 +32,19 @@ module.exports = { items: [ { enum: ["never"] + }, + { + type: "object", + properties: { + beforeStatementContinuationChars: { + enum: ["always", "any", "never"] + } + }, + additionalProperties: false } ], minItems: 0, - maxItems: 1 + maxItems: 2 }, { type: "array", @@ -62,9 +71,10 @@ module.exports = { const OPT_OUT_PATTERN = /^[-[(/+`]/; // One of [(/+-` const options = context.options[1]; - const never = context.options[0] === "never", - exceptOneLine = options && options.omitLastInOneLineBlock === true, - sourceCode = context.getSourceCode(); + const never = context.options[0] === "never"; + const exceptOneLine = Boolean(options && options.omitLastInOneLineBlock); + const beforeStatementContinuationChars = (options && options.beforeStatementContinuationChars) || "any"; + const sourceCode = context.getSourceCode(); //-------------------------------------------------------------------------- // Helpers @@ -93,9 +103,11 @@ module.exports = { loc = loc.start; fix = function(fixer) { - // Expand the replacement range to include the surrounding - // tokens to avoid conflicting with no-extra-semi. - // https://github.com/eslint/eslint/issues/7928 + /* + * Expand the replacement range to include the surrounding + * tokens to avoid conflicting with no-extra-semi. + * https://github.com/eslint/eslint/issues/7928 + */ return new FixTracker(fixer, sourceCode) .retainSurroundingTokens(lastToken) .remove(lastToken); @@ -112,29 +124,115 @@ module.exports = { } /** - * Check if a semicolon is unnecessary, only true if: - * - next token is on a new line and is not one of the opt-out tokens - * - next token is a valid statement divider - * @param {Token} lastToken last token of current node. - * @returns {boolean} whether the semicolon is unnecessary. + * Check whether a given semicolon token is redandant. + * @param {Token} semiToken A semicolon token to check. + * @returns {boolean} `true` if the next token is `;` or `}`. + */ + function isRedundantSemi(semiToken) { + const nextToken = sourceCode.getTokenAfter(semiToken); + + return ( + !nextToken || + astUtils.isClosingBraceToken(nextToken) || + astUtils.isSemicolonToken(nextToken) + ); + } + + /** + * Check whether a given token is the closing brace of an arrow function. + * @param {Token} lastToken A token to check. + * @returns {boolean} `true` if the token is the closing brace of an arrow function. */ - function isUnnecessarySemicolon(lastToken) { - if (!astUtils.isSemicolonToken(lastToken)) { + function isEndOfArrowBlock(lastToken) { + if (!astUtils.isClosingBraceToken(lastToken)) { return false; } + const node = sourceCode.getNodeByRangeIndex(lastToken.range[0]); - const nextToken = sourceCode.getTokenAfter(lastToken); + return ( + node.type === "BlockStatement" && + node.parent.type === "ArrowFunctionExpression" + ); + } + + /** + * Check whether a given node is on the same line with the next token. + * @param {Node} node A statement node to check. + * @returns {boolean} `true` if the node is on the same line with the next token. + */ + function isOnSameLineWithNextToken(node) { + const prevToken = sourceCode.getLastToken(node, 1); + const nextToken = sourceCode.getTokenAfter(node); + + return !!nextToken && astUtils.isTokenOnSameLine(prevToken, nextToken); + } + + /** + * Check whether a given node can connect the next line if the next line is unreliable. + * @param {Node} node A statement node to check. + * @returns {boolean} `true` if the node can connect the next line. + */ + function maybeAsiHazardAfter(node) { + const t = node.type; - if (!nextToken) { - return true; + if (t === "DoWhileStatement" || + t === "BreakStatement" || + t === "ContinueStatement" || + t === "DebuggerStatement" || + t === "ImportDeclaration" || + t === "ExportAllDeclaration" + ) { + return false; + } + if (t === "ReturnStatement") { + return Boolean(node.argument); + } + if (t === "ExportNamedDeclaration") { + return Boolean(node.declaration); + } + if (isEndOfArrowBlock(sourceCode.getLastToken(node, 1))) { + return false; } - const lastTokenLine = lastToken.loc.end.line; - const nextTokenLine = nextToken.loc.start.line; - const isOptOutToken = OPT_OUT_PATTERN.test(nextToken.value) && nextToken.value !== "++" && nextToken.value !== "--"; - const isDivider = (astUtils.isClosingBraceToken(nextToken) || astUtils.isSemicolonToken(nextToken)); + return true; + } - return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider; + /** + * Check whether a given token can connect the previous statement. + * @param {Token} token A token to check. + * @returns {boolean} `true` if the token is one of `[`, `(`, `/`, `+`, `-`, ```, `++`, and `--`. + */ + function maybeAsiHazardBefore(token) { + return ( + Boolean(token) && + OPT_OUT_PATTERN.test(token.value) && + token.value !== "++" && + token.value !== "--" + ); + } + + /** + * Check if the semicolon of a given node is unnecessary, only true if: + * - next token is a valid statement divider (`;` or `}`). + * - next token is on a new line and the node is not connectable to the new line. + * @param {Node} node A statement node to check. + * @returns {boolean} whether the semicolon is unnecessary. + */ + function canRemoveSemicolon(node) { + if (isRedundantSemi(sourceCode.getLastToken(node))) { + return true; // `;;` or `;}` + } + if (isOnSameLineWithNextToken(node)) { + return false; // One liner. + } + if (beforeStatementContinuationChars === "never" && !maybeAsiHazardAfter(node)) { + return true; // ASI works. This statement doesn't connect to the next. + } + if (!maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) { + return true; // ASI works. The next token doesn't connect to this statement. + } + + return false; } /** @@ -143,16 +241,17 @@ module.exports = { * @returns {boolean} whether the node is in a one-liner block statement. */ function isOneLinerBlock(node) { + const parent = node.parent; const nextToken = sourceCode.getTokenAfter(node); if (!nextToken || nextToken.value !== "}") { return false; } - - const parent = node.parent; - - return parent && parent.type === "BlockStatement" && - parent.loc.start.line === parent.loc.end.line; + return ( + !!parent && + parent.type === "BlockStatement" && + parent.loc.start.line === parent.loc.end.line + ); } /** @@ -161,21 +260,21 @@ module.exports = { * @returns {void} */ function checkForSemicolon(node) { - const lastToken = sourceCode.getLastToken(node); + const isSemi = astUtils.isSemicolonToken(sourceCode.getLastToken(node)); if (never) { - if (isUnnecessarySemicolon(lastToken)) { + if (isSemi && canRemoveSemicolon(node)) { report(node, true); + } else if (!isSemi && beforeStatementContinuationChars === "always" && maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) { + report(node); } } else { - if (!astUtils.isSemicolonToken(lastToken)) { - if (!exceptOneLine || !isOneLinerBlock(node)) { - report(node); - } - } else { - if (exceptOneLine && isOneLinerBlock(node)) { - report(node, true); - } + const oneLinerBlock = (exceptOneLine && isOneLinerBlock(node)); + + if (isSemi && oneLinerBlock) { + report(node, true); + } else if (!isSemi && !oneLinerBlock) { + report(node); } } } @@ -186,9 +285,7 @@ module.exports = { * @returns {void} */ function checkForSemicolonForVariableDeclaration(node) { - const ancestors = context.getAncestors(), - parentIndex = ancestors.length - 1, - parent = ancestors[parentIndex]; + const parent = node.parent; if ((parent.type !== "ForStatement" || parent.init !== node) && (!/^For(?:In|Of)Statement/.test(parent.type) || parent.left !== node) diff --git a/tools/eslint/lib/rules/sort-imports.js b/tools/eslint/lib/rules/sort-imports.js index be1605dc47f6f2..2bd415e9746968 100644 --- a/tools/eslint/lib/rules/sort-imports.js +++ b/tools/eslint/lib/rules/sort-imports.js @@ -113,9 +113,11 @@ module.exports = { currentLocalMemberName = currentLocalMemberName && currentLocalMemberName.toLowerCase(); } - // When the current declaration uses a different member syntax, - // then check if the ordering is correct. - // Otherwise, make a default string compare (like rule sort-vars to be consistent) of the first used local member name. + /* + * When the current declaration uses a different member syntax, + * then check if the ordering is correct. + * Otherwise, make a default string compare (like rule sort-vars to be consistent) of the first used local member name. + */ if (currentMemberSyntaxGroupIndex !== previousMemberSyntaxGroupIndex) { if (currentMemberSyntaxGroupIndex < previousMemberSyntaxGroupIndex) { context.report({ diff --git a/tools/eslint/lib/rules/sort-vars.js b/tools/eslint/lib/rules/sort-vars.js index 1fdfc9ace68424..c77cdf86207518 100644 --- a/tools/eslint/lib/rules/sort-vars.js +++ b/tools/eslint/lib/rules/sort-vars.js @@ -27,29 +27,64 @@ module.exports = { }, additionalProperties: false } - ] + ], + + fixable: "code" }, create(context) { const configuration = context.options[0] || {}, - ignoreCase = configuration.ignoreCase || false; + ignoreCase = configuration.ignoreCase || false, + sourceCode = context.getSourceCode(); return { VariableDeclaration(node) { const idDeclarations = node.declarations.filter(decl => decl.id.type === "Identifier"); + const getSortableName = ignoreCase ? decl => decl.id.name.toLowerCase() : decl => decl.id.name; + const unfixable = idDeclarations.some(decl => decl.init !== null && decl.init.type !== "Literal"); + let fixed = false; idDeclarations.slice(1).reduce((memo, decl) => { - let lastVariableName = memo.id.name, - currenVariableName = decl.id.name; + const lastVariableName = getSortableName(memo), + currentVariableName = getSortableName(decl); - if (ignoreCase) { - lastVariableName = lastVariableName.toLowerCase(); - currenVariableName = currenVariableName.toLowerCase(); - } + if (currentVariableName < lastVariableName) { + context.report({ + node: decl, + message: "Variables within the same declaration block should be sorted alphabetically.", + fix(fixer) { + if (unfixable || fixed) { + return null; + } + return fixer.replaceTextRange( + [idDeclarations[0].range[0], idDeclarations[idDeclarations.length - 1].range[1]], + idDeclarations + + // Clone the idDeclarations array to avoid mutating it + .slice() + + // Sort the array into the desired order + .sort((declA, declB) => { + const aName = getSortableName(declA); + const bName = getSortableName(declB); + + return aName > bName ? 1 : -1; + }) + + // Build a string out of the sorted list of identifier declarations and the text between the originals + .reduce((sourceText, identifier, index) => { + const textAfterIdentifier = index === idDeclarations.length - 1 + ? "" + : sourceCode.getText().slice(idDeclarations[index].range[1], idDeclarations[index + 1].range[0]); + + return sourceText + sourceCode.getText(identifier) + textAfterIdentifier; + }, "") - if (currenVariableName < lastVariableName) { - context.report({ node: decl, message: "Variables within the same declaration block should be sorted alphabetically." }); + ); + } + }); + fixed = true; return memo; } return decl; diff --git a/tools/eslint/lib/rules/space-in-parens.js b/tools/eslint/lib/rules/space-in-parens.js index 95b03c3db50487..67ec5847cd1514 100644 --- a/tools/eslint/lib/rules/space-in-parens.js +++ b/tools/eslint/lib/rules/space-in-parens.js @@ -45,8 +45,7 @@ module.exports = { const MISSING_SPACE_MESSAGE = "There must be a space inside this paren.", REJECTED_SPACE_MESSAGE = "There should be no spaces inside this paren.", ALWAYS = context.options[0] === "always", - - exceptionsArrayOptions = (context.options.length === 2) ? context.options[1].exceptions : [], + exceptionsArrayOptions = (context.options[1] && context.options[1].exceptions) || [], options = {}; let exceptions; diff --git a/tools/eslint/lib/rules/space-unary-ops.js b/tools/eslint/lib/rules/space-unary-ops.js index fadaff74b020c6..06a70fb6adec9b 100644 --- a/tools/eslint/lib/rules/space-unary-ops.js +++ b/tools/eslint/lib/rules/space-unary-ops.js @@ -56,50 +56,50 @@ module.exports = { //-------------------------------------------------------------------------- /** - * Check if the node is the first "!" in a "!!" convert to Boolean expression - * @param {ASTnode} node AST node - * @returns {boolean} Whether or not the node is first "!" in "!!" - */ + * Check if the node is the first "!" in a "!!" convert to Boolean expression + * @param {ASTnode} node AST node + * @returns {boolean} Whether or not the node is first "!" in "!!" + */ function isFirstBangInBangBangExpression(node) { return node && node.type === "UnaryExpression" && node.argument.operator === "!" && node.argument && node.argument.type === "UnaryExpression" && node.argument.operator === "!"; } /** - * Check if the node's child argument is an "ObjectExpression" - * @param {ASTnode} node AST node - * @returns {boolean} Whether or not the argument's type is "ObjectExpression" - */ + * Check if the node's child argument is an "ObjectExpression" + * @param {ASTnode} node AST node + * @returns {boolean} Whether or not the argument's type is "ObjectExpression" + */ function isArgumentObjectExpression(node) { return node.argument && node.argument.type && node.argument.type === "ObjectExpression"; } /** - * Checks if an override exists for a given operator. - * @param {string} operator Operator - * @returns {boolean} Whether or not an override has been provided for the operator - */ + * Checks if an override exists for a given operator. + * @param {string} operator Operator + * @returns {boolean} Whether or not an override has been provided for the operator + */ function overrideExistsForOperator(operator) { return options.overrides && options.overrides.hasOwnProperty(operator); } /** - * Gets the value that the override was set to for this operator - * @param {string} operator Operator - * @returns {boolean} Whether or not an override enforces a space with this operator - */ + * Gets the value that the override was set to for this operator + * @param {string} operator Operator + * @returns {boolean} Whether or not an override enforces a space with this operator + */ function overrideEnforcesSpaces(operator) { return options.overrides[operator]; } /** - * Verify Unary Word Operator has spaces after the word operator - * @param {ASTnode} node AST node - * @param {Object} firstToken first token from the AST node - * @param {Object} secondToken second token from the AST node - * @param {string} word The word to be used for reporting - * @returns {void} - */ + * Verify Unary Word Operator has spaces after the word operator + * @param {ASTnode} node AST node + * @param {Object} firstToken first token from the AST node + * @param {Object} secondToken second token from the AST node + * @param {string} word The word to be used for reporting + * @returns {void} + */ function verifyWordHasSpaces(node, firstToken, secondToken, word) { if (secondToken.range[0] === firstToken.range[1]) { context.report({ @@ -116,13 +116,13 @@ module.exports = { } /** - * Verify Unary Word Operator doesn't have spaces after the word operator - * @param {ASTnode} node AST node - * @param {Object} firstToken first token from the AST node - * @param {Object} secondToken second token from the AST node - * @param {string} word The word to be used for reporting - * @returns {void} - */ + * Verify Unary Word Operator doesn't have spaces after the word operator + * @param {ASTnode} node AST node + * @param {Object} firstToken first token from the AST node + * @param {Object} secondToken second token from the AST node + * @param {string} word The word to be used for reporting + * @returns {void} + */ function verifyWordDoesntHaveSpaces(node, firstToken, secondToken, word) { if (isArgumentObjectExpression(node)) { if (secondToken.range[0] > firstToken.range[1]) { @@ -141,13 +141,13 @@ module.exports = { } /** - * Check Unary Word Operators for spaces after the word operator - * @param {ASTnode} node AST node - * @param {Object} firstToken first token from the AST node - * @param {Object} secondToken second token from the AST node - * @param {string} word The word to be used for reporting - * @returns {void} - */ + * Check Unary Word Operators for spaces after the word operator + * @param {ASTnode} node AST node + * @param {Object} firstToken first token from the AST node + * @param {Object} secondToken second token from the AST node + * @param {string} word The word to be used for reporting + * @returns {void} + */ function checkUnaryWordOperatorForSpaces(node, firstToken, secondToken, word) { word = word || firstToken.value; @@ -165,10 +165,10 @@ module.exports = { } /** - * Verifies YieldExpressions satisfy spacing requirements - * @param {ASTnode} node AST node - * @returns {void} - */ + * Verifies YieldExpressions satisfy spacing requirements + * @param {ASTnode} node AST node + * @returns {void} + */ function checkForSpacesAfterYield(node) { const tokens = sourceCode.getFirstTokens(node, 3), word = "yield"; @@ -181,10 +181,10 @@ module.exports = { } /** - * Verifies AwaitExpressions satisfy spacing requirements - * @param {ASTNode} node AwaitExpression AST node - * @returns {void} - */ + * Verifies AwaitExpressions satisfy spacing requirements + * @param {ASTNode} node AwaitExpression AST node + * @returns {void} + */ function checkForSpacesAfterAwait(node) { const tokens = sourceCode.getFirstTokens(node, 3); @@ -192,12 +192,12 @@ module.exports = { } /** - * Verifies UnaryExpression, UpdateExpression and NewExpression have spaces before or after the operator - * @param {ASTnode} node AST node - * @param {Object} firstToken First token in the expression - * @param {Object} secondToken Second token in the expression - * @returns {void} - */ + * Verifies UnaryExpression, UpdateExpression and NewExpression have spaces before or after the operator + * @param {ASTnode} node AST node + * @param {Object} firstToken First token in the expression + * @param {Object} secondToken Second token in the expression + * @returns {void} + */ function verifyNonWordsHaveSpaces(node, firstToken, secondToken) { if (node.prefix) { if (isFirstBangInBangBangExpression(node)) { @@ -232,12 +232,12 @@ module.exports = { } /** - * Verifies UnaryExpression, UpdateExpression and NewExpression don't have spaces before or after the operator - * @param {ASTnode} node AST node - * @param {Object} firstToken First token in the expression - * @param {Object} secondToken Second token in the expression - * @returns {void} - */ + * Verifies UnaryExpression, UpdateExpression and NewExpression don't have spaces before or after the operator + * @param {ASTnode} node AST node + * @param {Object} firstToken First token in the expression + * @param {Object} secondToken Second token in the expression + * @returns {void} + */ function verifyNonWordsDontHaveSpaces(node, firstToken, secondToken) { if (node.prefix) { if (secondToken.range[0] > firstToken.range[1]) { @@ -272,10 +272,10 @@ module.exports = { } /** - * Verifies UnaryExpression, UpdateExpression and NewExpression satisfy spacing requirements - * @param {ASTnode} node AST node - * @returns {void} - */ + * Verifies UnaryExpression, UpdateExpression and NewExpression satisfy spacing requirements + * @param {ASTnode} node AST node + * @returns {void} + */ function checkForSpaces(node) { const tokens = node.type === "UpdateExpression" && !node.prefix ? sourceCode.getLastTokens(node, 2) diff --git a/tools/eslint/lib/rules/strict.js b/tools/eslint/lib/rules/strict.js index bb926f666141e9..433b47136797c6 100644 --- a/tools/eslint/lib/rules/strict.js +++ b/tools/eslint/lib/rules/strict.js @@ -109,19 +109,19 @@ module.exports = { } /** - * Determines whether a reported error should be fixed, depending on the error type. - * @param {string} errorType The type of error - * @returns {boolean} `true` if the reported error should be fixed - */ + * Determines whether a reported error should be fixed, depending on the error type. + * @param {string} errorType The type of error + * @returns {boolean} `true` if the reported error should be fixed + */ function shouldFix(errorType) { return errorType === "multiple" || errorType === "unnecessary" || errorType === "module" || errorType === "implied" || errorType === "unnecessaryInClasses"; } /** - * Gets a fixer function to remove a given 'use strict' directive. - * @param {ASTNode} node The directive that should be removed - * @returns {Function} A fixer function - */ + * Gets a fixer function to remove a given 'use strict' directive. + * @param {ASTNode} node The directive that should be removed + * @returns {Function} A fixer function + */ function getFixFunction(node) { return fixer => fixer.remove(node); } diff --git a/tools/eslint/lib/rules/valid-typeof.js b/tools/eslint/lib/rules/valid-typeof.js index 94b407b600a43c..fba4cc5712a7dc 100644 --- a/tools/eslint/lib/rules/valid-typeof.js +++ b/tools/eslint/lib/rules/valid-typeof.js @@ -37,10 +37,10 @@ module.exports = { const requireStringLiterals = context.options[0] && context.options[0].requireStringLiterals; /** - * Determines whether a node is a typeof expression. - * @param {ASTNode} node The node - * @returns {boolean} `true` if the node is a typeof expression - */ + * Determines whether a node is a typeof expression. + * @param {ASTNode} node The node + * @returns {boolean} `true` if the node is a typeof expression + */ function isTypeofExpression(node) { return node.type === "UnaryExpression" && node.operator === "typeof"; } diff --git a/tools/eslint/lib/rules/wrap-iife.js b/tools/eslint/lib/rules/wrap-iife.js index 59179eb17ed6a5..c4e6a9e0c735cf 100644 --- a/tools/eslint/lib/rules/wrap-iife.js +++ b/tools/eslint/lib/rules/wrap-iife.js @@ -59,10 +59,10 @@ module.exports = { } /** - * Get the function node from an IIFE - * @param {ASTNode} node node to evaluate - * @returns {ASTNode} node that is the function expression of the given IIFE, or null if none exist - */ + * Get the function node from an IIFE + * @param {ASTNode} node node to evaluate + * @returns {ASTNode} node that is the function expression of the given IIFE, or null if none exist + */ function getFunctionNodeFromIIFE(node) { const callee = node.callee; diff --git a/tools/eslint/lib/rules/yoda.js b/tools/eslint/lib/rules/yoda.js index bdb7d2a4278ba3..2ccb61f73a0946 100644 --- a/tools/eslint/lib/rules/yoda.js +++ b/tools/eslint/lib/rules/yoda.js @@ -126,9 +126,11 @@ function same(a, b) { ); } - // x[0] = x[0] - // x[y] = x[y] - // x.y = x.y + /* + * x[0] = x[0] + * x[y] = x[y] + * x.y = x.y + */ return ( a.computed === b.computed && same(a.object, b.object) && @@ -259,10 +261,10 @@ module.exports = { }; /** - * Returns a string representation of a BinaryExpression node with its sides/operator flipped around. - * @param {ASTNode} node The BinaryExpression node - * @returns {string} A string representation of the node with the sides and operator flipped - */ + * Returns a string representation of a BinaryExpression node with its sides/operator flipped around. + * @param {ASTNode} node The BinaryExpression node + * @returns {string} A string representation of the node with the sides and operator flipped + */ function getFlippedString(node) { const operatorToken = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); const textBeforeOperator = sourceCode.getText().slice(sourceCode.getTokenBefore(operatorToken).range[1], operatorToken.range[0]); diff --git a/tools/eslint/lib/testers/rule-tester.js b/tools/eslint/lib/testers/rule-tester.js index a76a38c6550083..aae66301d87173 100644 --- a/tools/eslint/lib/testers/rule-tester.js +++ b/tools/eslint/lib/testers/rule-tester.js @@ -204,9 +204,11 @@ class RuleTester { } - // If people use `mocha test.js --watch` command, `describe` and `it` function - // instances are different for each execution. So `describe` and `it` should get fresh instance - // always. + /* + * If people use `mocha test.js --watch` command, `describe` and `it` function + * instances are different for each execution. So `describe` and `it` should get fresh instance + * always. + */ static get describe() { return ( this[DESCRIBE] || @@ -269,6 +271,23 @@ class RuleTester { ].concat(scenarioErrors).join("\n")); } + + linter.defineRule(ruleName, Object.assign({}, rule, { + + // Create a wrapper rule that freezes the `context` properties. + create(context) { + freezeDeeply(context.options); + freezeDeeply(context.settings); + freezeDeeply(context.parserOptions); + + return (typeof rule === "function" ? rule : rule.create)(context); + } + })); + + linter.defineRules(this.rules); + + const ruleMap = linter.getRules(); + /** * Run the rule for the given item * @param {string|Object} item Item to run the rule against @@ -284,12 +303,16 @@ class RuleTester { } else { code = item.code; - // Assumes everything on the item is a config except for the - // parameters used by this tester + /* + * Assumes everything on the item is a config except for the + * parameters used by this tester + */ const itemConfig = lodash.omit(item, RuleTesterParameters); - // Create the config object from the tester config and this item - // specific configurations. + /* + * Create the config object from the tester config and this item + * specific configurations. + */ config = lodash.merge( config, itemConfig @@ -307,20 +330,22 @@ class RuleTester { config.rules[ruleName] = 1; } - linter.defineRule(ruleName, Object.assign({}, rule, { - - // Create a wrapper rule that freezes the `context` properties. - create(context) { - freezeDeeply(context.options); - freezeDeeply(context.settings); - freezeDeeply(context.parserOptions); + const schema = validator.getRuleOptionsSchema(rule); - return (typeof rule === "function" ? rule : rule.create)(context); + /* + * Setup AST getters. + * The goal is to check whether or not AST was modified when + * running the rule under test. + */ + linter.defineRule("rule-tester/validate-ast", () => ({ + Program(node) { + beforeAST = cloneDeeplyExcludesParent(node); + }, + "Program:exit"(node) { + afterAST = node; } })); - const schema = validator.getRuleOptionsSchema(ruleName, linter.rules); - if (schema) { ajv.validateSchema(schema); @@ -335,21 +360,7 @@ class RuleTester { } } - validator.validate(config, "rule-tester", linter.rules, new Environments()); - - /* - * Setup AST getters. - * The goal is to check whether or not AST was modified when - * running the rule under test. - */ - linter.defineRule("rule-tester/validate-ast", () => ({ - Program(node) { - beforeAST = cloneDeeplyExcludesParent(node); - }, - "Program:exit"(node) { - afterAST = node; - } - })); + validator.validate(config, "rule-tester", ruleMap.get.bind(ruleMap), new Environments()); return { messages: linter.verify(code, config, filename, true), @@ -526,7 +537,6 @@ class RuleTester { RuleTester.describe("valid", () => { test.valid.forEach(valid => { RuleTester.it(typeof valid === "object" ? valid.code : valid, () => { - linter.defineRules(this.rules); testValidTemplate(valid); }); }); @@ -535,7 +545,6 @@ class RuleTester { RuleTester.describe("invalid", () => { test.invalid.forEach(invalid => { RuleTester.it(invalid.code, () => { - linter.defineRules(this.rules); testInvalidTemplate(invalid); }); }); diff --git a/tools/eslint/lib/token-store/backward-token-cursor.js b/tools/eslint/lib/token-store/backward-token-cursor.js index caa117faeac286..93973bce443df7 100644 --- a/tools/eslint/lib/token-store/backward-token-cursor.js +++ b/tools/eslint/lib/token-store/backward-token-cursor.js @@ -45,9 +45,11 @@ module.exports = class BackwardTokenCursor extends Cursor { return false; } - // - // Shorthand for performance. - // + /* + * + * Shorthand for performance. + * + */ /** @inheritdoc */ getOneToken() { diff --git a/tools/eslint/lib/token-store/forward-token-cursor.js b/tools/eslint/lib/token-store/forward-token-cursor.js index 5748cb45a62981..523ed398fa3d9e 100644 --- a/tools/eslint/lib/token-store/forward-token-cursor.js +++ b/tools/eslint/lib/token-store/forward-token-cursor.js @@ -45,9 +45,11 @@ module.exports = class ForwardTokenCursor extends Cursor { return false; } - // - // Shorthand for performance. - // + /* + * + * Shorthand for performance. + * + */ /** @inheritdoc */ getOneToken() { diff --git a/tools/eslint/lib/token-store/utils.js b/tools/eslint/lib/token-store/utils.js index f83b6cf699999c..34b0a9af6da68d 100644 --- a/tools/eslint/lib/token-store/utils.js +++ b/tools/eslint/lib/token-store/utils.js @@ -62,8 +62,10 @@ exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) { const index = indexMap[startLoc - 1]; const token = (index >= 0 && index < tokens.length) ? tokens[index] : null; - // For the map of "comment's location -> token's index", it points the next token of a comment. - // In that case, +1 is unnecessary. + /* + * For the map of "comment's location -> token's index", it points the next token of a comment. + * In that case, +1 is unnecessary. + */ if (token && token.range[0] >= startLoc) { return index; } @@ -89,8 +91,10 @@ exports.getLastIndex = function getLastIndex(tokens, indexMap, endLoc) { const index = indexMap[endLoc - 1]; const token = (index >= 0 && index < tokens.length) ? tokens[index] : null; - // For the map of "comment's location -> token's index", it points the next token of a comment. - // In that case, -1 is necessary. + /* + * For the map of "comment's location -> token's index", it points the next token of a comment. + * In that case, -1 is necessary. + */ if (token && token.range[1] > endLoc) { return index - 1; } diff --git a/tools/eslint/lib/util/glob.js b/tools/eslint/lib/util/glob.js index a231e16f4d0bce..f352dae7a4dd3f 100644 --- a/tools/eslint/lib/util/glob.js +++ b/tools/eslint/lib/util/glob.js @@ -47,7 +47,7 @@ GlobSync.prototype._readdir = function(abs, inGlobStar) { * `options.nodir` makes `options.mark` as `true`. * Mark `abs` first * to make sure `"node_modules"` will be ignored immediately with ignore pattern `"node_modules/"`. - + * * There is a built-in cache about marked `File.Stat` in `glob`, so that we could not worry about the extra invocation of `this._mark()` */ const marked = this._mark(abs); diff --git a/tools/eslint/lib/util/naming.js b/tools/eslint/lib/util/naming.js new file mode 100644 index 00000000000000..dcac81bbd64660 --- /dev/null +++ b/tools/eslint/lib/util/naming.js @@ -0,0 +1,112 @@ +/** + * @fileoverview Common helpers for naming of plugins, formatters and configs + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const pathUtil = require("../util/path-util"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +const NAMESPACE_REGEX = /^@.*\//i; + +/** + * Brings package name to correct format based on prefix + * @param {string} name The name of the package. + * @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter" + * @returns {string} Normalized name of the package + * @private + */ +function normalizePackageName(name, prefix) { + + /** + * On Windows, name can come in with Windows slashes instead of Unix slashes. + * Normalize to Unix first to avoid errors later on. + * https://github.com/eslint/eslint/issues/5644 + */ + if (name.indexOf("\\") > -1) { + name = pathUtil.convertPathToPosix(name); + } + + if (name.charAt(0) === "@") { + + /** + * it's a scoped package + * package name is the prefix, or just a username + */ + const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`), + scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`); + + if (scopedPackageShortcutRegex.test(name)) { + name = name.replace(scopedPackageShortcutRegex, `$1/${prefix}`); + } else if (!scopedPackageNameRegex.test(name.split("/")[1])) { + + /** + * for scoped packages, insert the prefix after the first / unless + * the path is already @scope/eslint or @scope/eslint-xxx-yyy + */ + name = name.replace(/^@([^/]+)\/(.*)$/, `@$1/${prefix}-$2`); + } + } else if (name.indexOf(`${prefix}-`) !== 0) { + name = `${prefix}-${name}`; + } + + return name; +} + +/** + * Removes the prefix from a term. + * @param {string} prefix The prefix to remove. + * @param {string} term The term which may have the prefix. + * @returns {string} The term without prefix. + */ +function removePrefixFromTerm(prefix, term) { + return term.startsWith(prefix) ? term.slice(prefix.length) : term; +} + +/** + * Adds a prefix to a term. + * @param {string} prefix The prefix to add. + * @param {string} term The term which may not have the prefix. + * @returns {string} The term with prefix. + */ +function addPrefixToTerm(prefix, term) { + return term.startsWith(prefix) ? term : `${prefix}${term}`; +} + +/** + * Gets the scope (namespace) of a term. + * @param {string} term The term which may have the namespace. + * @returns {string} The namepace of the term if it has one. + */ +function getNamespaceFromTerm(term) { + const match = term.match(NAMESPACE_REGEX); + + return match ? match[0] : ""; +} + +/** + * Removes the namespace from a term. + * @param {string} term The term which may have the namespace. + * @returns {string} The name of the plugin without the namespace. + */ +function removeNamespaceFromTerm(term) { + return term.replace(NAMESPACE_REGEX, ""); +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + normalizePackageName, + removePrefixFromTerm, + addPrefixToTerm, + getNamespaceFromTerm, + removeNamespaceFromTerm +}; diff --git a/tools/eslint/lib/util/node-event-generator.js b/tools/eslint/lib/util/node-event-generator.js index 34ee78b4941c6d..9d477bbb4e66f1 100644 --- a/tools/eslint/lib/util/node-event-generator.js +++ b/tools/eslint/lib/util/node-event-generator.js @@ -33,10 +33,10 @@ const lodash = require("lodash"); //------------------------------------------------------------------------------ /** -* Gets the possible types of a selector -* @param {Object} parsedSelector An object (from esquery) describing the matching behavior of the selector -* @returns {string[]|null} The node types that could possibly trigger this selector, or `null` if all node types could trigger it -*/ + * Gets the possible types of a selector + * @param {Object} parsedSelector An object (from esquery) describing the matching behavior of the selector + * @returns {string[]|null} The node types that could possibly trigger this selector, or `null` if all node types could trigger it + */ function getPossibleTypes(parsedSelector) { switch (parsedSelector.type) { case "identifier": @@ -203,12 +203,12 @@ const parseSelector = lodash.memoize(rawSelector => { class NodeEventGenerator { /** - * @param {SafeEmitter} emitter - * An SafeEmitter which is the destination of events. This emitter must already - * have registered listeners for all of the events that it needs to listen for. - * (See lib/util/safe-emitter.js for more details on `SafeEmitter`.) - * @returns {NodeEventGenerator} new instance - */ + * @param {SafeEmitter} emitter + * An SafeEmitter which is the destination of events. This emitter must already + * have registered listeners for all of the events that it needs to listen for. + * (See lib/util/safe-emitter.js for more details on `SafeEmitter`.) + * @returns {NodeEventGenerator} new instance + */ constructor(emitter) { this.emitter = emitter; this.currentAncestry = []; diff --git a/tools/eslint/lib/util/safe-emitter.js b/tools/eslint/lib/util/safe-emitter.js index 242cbe4295987d..2fa373cb96deeb 100644 --- a/tools/eslint/lib/util/safe-emitter.js +++ b/tools/eslint/lib/util/safe-emitter.js @@ -10,7 +10,7 @@ //------------------------------------------------------------------------------ /** - * An object describing an AST selector + * An event emitter * @typedef {Object} SafeEmitter * @property {function(eventName: string, listenerFunc: Function): void} on Adds a listener for a given event name * @property {function(eventName: string, arg1?: any, arg2?: any, arg3?: any)} emit Emits an event with a given name. diff --git a/tools/eslint/lib/util/source-code-fixer.js b/tools/eslint/lib/util/source-code-fixer.js index ebb7e3e02dfce0..b5bfc7457a7238 100644 --- a/tools/eslint/lib/util/source-code-fixer.js +++ b/tools/eslint/lib/util/source-code-fixer.js @@ -122,8 +122,10 @@ SourceCodeFixer.applyFixes = function(sourceText, messages, shouldFix) { if (typeof shouldFix !== "function" || shouldFix(problem)) { attemptFix(problem); - // The only time attemptFix will fail is if a previous fix was - // applied which conflicts with it. So we can mark this as true. + /* + * The only time attemptFix will fail is if a previous fix was + * applied which conflicts with it. So we can mark this as true. + */ fixesWereApplied = true; } else { remainingMessages.push(problem); diff --git a/tools/eslint/lib/util/source-code.js b/tools/eslint/lib/util/source-code.js index d3fed5989cb273..0bd710bf67ae93 100644 --- a/tools/eslint/lib/util/source-code.js +++ b/tools/eslint/lib/util/source-code.js @@ -227,7 +227,8 @@ class SourceCode extends TokenStore { } } else { - /* Return comments as trailing comments of nodes that only contain + /* + * Return comments as trailing comments of nodes that only contain * comments (to mimic the comment attachment behavior present in Espree). */ if ((node.type === "BlockStatement" || node.type === "ClassBody") && node.body.length === 0 || diff --git a/tools/eslint/node_modules/acorn/package.json b/tools/eslint/node_modules/acorn/package.json index d6fda7838defb5..610943538459dd 100644 --- a/tools/eslint/node_modules/acorn/package.json +++ b/tools/eslint/node_modules/acorn/package.json @@ -1,5 +1,5 @@ { - "_from": "acorn@^5.1.1", + "_from": "acorn@^5.2.1", "_id": "acorn@5.2.1", "_inBundle": false, "_integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==", @@ -8,19 +8,19 @@ "_requested": { "type": "range", "registry": true, - "raw": "acorn@^5.1.1", + "raw": "acorn@^5.2.1", "name": "acorn", "escapedName": "acorn", - "rawSpec": "^5.1.1", + "rawSpec": "^5.2.1", "saveSpec": null, - "fetchSpec": "^5.1.1" + "fetchSpec": "^5.2.1" }, "_requiredBy": [ "/eslint/espree" ], "_resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", "_shasum": "317ac7821826c22c702d66189ab8359675f135d7", - "_spec": "acorn@^5.1.1", + "_spec": "acorn@^5.2.1", "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint/node_modules/espree", "bin": { "acorn": "./bin/acorn" diff --git a/tools/eslint/node_modules/ajv/README.md b/tools/eslint/node_modules/ajv/README.md index 384825cde1aa3a..fdf6144a20e9c7 100644 --- a/tools/eslint/node_modules/ajv/README.md +++ b/tools/eslint/node_modules/ajv/README.md @@ -7,13 +7,16 @@ The fastest JSON Schema validator for Node.js and browser with draft 6 support. [![Build Status](https://travis-ci.org/epoberezkin/ajv.svg?branch=master)](https://travis-ci.org/epoberezkin/ajv) [![npm version](https://badge.fury.io/js/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm@beta](https://img.shields.io/npm/v/ajv/beta.svg)](https://github.com/epoberezkin/ajv/tree/beta) [![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) -[![Code Climate](https://codeclimate.com/github/epoberezkin/ajv/badges/gpa.svg)](https://codeclimate.com/github/epoberezkin/ajv) [![Coverage Status](https://coveralls.io/repos/epoberezkin/ajv/badge.svg?branch=master&service=github)](https://coveralls.io/github/epoberezkin/ajv?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.io/epoberezkin/ajv.svg)](https://greenkeeper.io/) [![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) +__Please note__: Ajv [version 6](https://github.com/epoberezkin/ajv/tree/beta) with [JSON Schema draft-07](http://json-schema.org/work-in-progress) support is released. Use `npm install ajv@beta` to install. + + ## Using version 5 [JSON Schema draft-06](https://trac.tools.ietf.org/html/draft-wright-json-schema-validation-01) is published. @@ -107,6 +110,12 @@ Currently Ajv is the only validator that passes all the tests from [JSON Schema npm install ajv ``` +or to install [version 6](https://github.com/epoberezkin/ajv/tree/beta): + +``` +npm install ajv@beta +``` + ## Getting started @@ -136,8 +145,8 @@ or ```javascript // ... -ajv.addSchema(schema, 'mySchema'); -var valid = ajv.validate('mySchema', data); +var valid = ajv.addSchema(schema, 'mySchema') + .validate('mySchema', data); if (!valid) console.log(ajv.errorsText()); // ... ``` @@ -274,8 +283,8 @@ or use `addSchema` method: ```javascript var ajv = new Ajv; -ajv.addSchema(defsSchema); -var validate = ajv.compile(schema); +var validate = ajv.addSchema(defsSchema) + .compile(schema); ``` See [Options](#options) and [addSchema](#api) method. @@ -431,14 +440,17 @@ Ajv allows defining keywords with: Example. `range` and `exclusiveRange` keywords using compiled schema: ```javascript -ajv.addKeyword('range', { type: 'number', compile: function (sch, parentSchema) { - var min = sch[0]; - var max = sch[1]; +ajv.addKeyword('range', { + type: 'number', + compile: function (sch, parentSchema) { + var min = sch[0]; + var max = sch[1]; - return parentSchema.exclusiveRange === true - ? function (data) { return data > min && data < max; } - : function (data) { return data >= min && data <= max; } -} }); + return parentSchema.exclusiveRange === true + ? function (data) { return data > min && data < max; } + : function (data) { return data >= min && data <= max; } + } +}); var schema = { "range": [2, 4], "exclusiveRange": true }; var validate = ajv.compile(schema); @@ -905,7 +917,7 @@ __Please note__: every time this method is called the errors are overwritten so If the schema is asynchronous (has `$async` keyword on the top level) this method returns a Promise. See [Asynchronous validation](#asynchronous-validation). -##### .addSchema(Array<Object>|Object schema [, String key]) +##### .addSchema(Array<Object>|Object schema [, String key]) -> Ajv Add schema(s) to validator instance. This method does not compile schemas (but it still validates them). Because of that dependencies can be added in any order and circular dependencies are supported. It also prevents unnecessary compilation of schemas that are containers for other schemas but not used as a whole. @@ -920,8 +932,14 @@ Although `addSchema` does not compile schemas, explicit compilation is not requi By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option. +__Please note__: Ajv uses the [method chaining syntax](https://en.wikipedia.org/wiki/Method_chaining) for all methods with the prefix `add*` and `remove*`. +This allows you to do nice things like the following. + +```javascript +var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri); +``` -##### .addMetaSchema(Array<Object>|Object schema [, String key]) +##### .addMetaSchema(Array<Object>|Object schema [, String key]) -> Ajv Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option). @@ -946,7 +964,7 @@ Errors will be available at `ajv.errors`. Retrieve compiled schema previously added with `addSchema` by the key passed to `addSchema` or by its full reference (id). The returned validating function has `schema` property with the reference to the original schema. -##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) +##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) -> Ajv Remove added/cached schema. Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references. @@ -959,7 +977,7 @@ Schema can be removed using: If no parameter is passed all schemas but meta-schemas will be removed and the cache will be cleared. -##### .addFormat(String name, String|RegExp|Function|Object format) +##### .addFormat(String name, String|RegExp|Function|Object format) -> Ajv Add custom format to validate strings or numbers. It can also be used to replace pre-defined formats for Ajv instance. @@ -977,7 +995,7 @@ If object is passed it should have properties `validate`, `compare` and `async`: Custom formats can be also added via `formats` option. -##### .addKeyword(String keyword, Object definition) +##### .addKeyword(String keyword, Object definition) -> Ajv Add custom validation keyword to Ajv instance. @@ -1018,7 +1036,7 @@ See [Defining custom keywords](#defining-custom-keywords) for more details. Returns custom keyword definition, `true` for pre-defined keywords and `false` if the keyword is unknown. -##### .removeKeyword(String keyword) +##### .removeKeyword(String keyword) -> Ajv Removes custom or pre-defined keyword so you can redefine them. @@ -1051,6 +1069,7 @@ Defaults: formats: {}, unknownFormats: true, schemas: {}, + logger: undefined, // referenced schema options: schemaId: undefined // recommended '$id' missingRefs: true, @@ -1096,6 +1115,9 @@ Defaults: - `[String]` - an array of unknown format names that will be ignored. This option can be used to allow usage of third party schemas with format(s) for which you don't have definitions, but still fail if another unknown format is used. If `format` keyword value is [$data reference](#data-reference) and it is not in this array the validation will fail. - `"ignore"` - to log warning during schema compilation and always pass validation (the default behaviour in versions before 5.0.0). This option is not recommended, as it allows to mistype format name and it won't be validated without any error message. This behaviour is required by JSON-schema specification. - _schemas_: an array or object of schemas that will be added to the instance. In case you pass the array the schemas must have IDs in them. When the object is passed the method `addSchema(value, key)` will be called for each schema in this object. +- _logger_: sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. Option values: + - custom logger - it should have methods `log`, `warn` and `error`. If any of these methods is missing an exception will be thrown. + - `false` - logging is disabled. ##### Referenced schema options @@ -1232,11 +1254,14 @@ Properties of `params` object in errors depend on the keyword that failed valida ## Related packages -- [ajv-cli](https://github.com/epoberezkin/ajv-cli) - command line interface for Ajv +- [ajv-async](https://github.com/epoberezkin/ajv-async) - configure async validation mode +- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface +- [ajv-errors](https://github.com/epoberezkin/ajv-errors) - custom error messages - [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) - internationalised error messages -- [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) - keywords $merge and $patch. -- [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) - several custom keywords that can be used with Ajv (typeof, instanceof, range, propertyNames) -- [ajv-errors](https://github.com/epoberezkin/ajv-errors) - custom error messages for Ajv +- [ajv-istanbul](https://github.com/epoberezkin/ajv-istanbul) - instrument generated validation code to measure test coverage of your schemas +- [ajv-keywords](https://github.com/epoberezkin/ajv-keywords) - custom validation keywords (if/then/else, select, typeof, etc.) +- [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) - keywords $merge and $patch +- [ajv-pack](https://github.com/epoberezkin/ajv-pack) - produces a compact module exporting validation functions ## Some packages using Ajv diff --git a/tools/eslint/node_modules/ajv/dist/ajv.bundle.js b/tools/eslint/node_modules/ajv/dist/ajv.bundle.js index 592c7062c02cdb..ee5623cb196da0 100644 --- a/tools/eslint/node_modules/ajv/dist/ajv.bundle.js +++ b/tools/eslint/node_modules/ajv/dist/ajv.bundle.js @@ -482,6 +482,7 @@ function compile(schema, root, localRefs, baseId) { useCustomRule: useCustomRule, opts: opts, formats: formats, + logger: self.logger, self: self }); @@ -524,7 +525,7 @@ function compile(schema, root, localRefs, baseId) { refVal[0] = validate; } catch(e) { - console.error('Error compiling schema, function code:', sourceCode); + self.logger.error('Error compiling schema, function code:', sourceCode); throw e; } @@ -638,7 +639,7 @@ function compile(schema, root, localRefs, baseId) { var valid = validateSchema(schema); if (!valid) { var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); - if (self._opts.validateSchema == 'log') console.error(message); + if (self._opts.validateSchema == 'log') self.logger.error(message); else throw new Error(message); } } @@ -1052,7 +1053,7 @@ module.exports = function rules() { var ALL = [ 'type' ]; var KEYWORDS = [ - 'additionalItems', '$schema', 'id', 'title', + 'additionalItems', '$schema', '$id', 'id', 'title', 'description', 'default', 'definitions' ]; var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ]; @@ -2563,7 +2564,7 @@ module.exports = function generate_format(it, $keyword, $ruleType) { var $format = it.formats[$schema]; if (!$format) { if ($unknownFormats == 'ignore') { - console.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); + it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); if ($breakOnError) { out += ' if (true) { '; } @@ -3687,7 +3688,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) { if ($refVal === undefined) { var $message = it.MissingRefError.message(it.baseId, $schema); if (it.opts.missingRefs == 'fail') { - console.error($message); + it.logger.error($message); var $$outStack = $$outStack || []; $$outStack.push(out); out = ''; /* istanbul ignore else */ @@ -3718,7 +3719,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) { out += ' if (false) { '; } } else if (it.opts.missingRefs == 'ignore') { - console.warn($message); + it.logger.warn($message); if ($breakOnError) { out += ' if (true) { '; } @@ -4256,7 +4257,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) { throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); } else if (it.opts.extendRefs !== true) { $refKeywords = false; - console.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); + it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); } } if ($typeSchema) { @@ -4414,7 +4415,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) { } } else { if (it.opts.v5 && it.schema.patternGroups) { - console.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); + it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); } var arr2 = it.RULES; if (arr2) { @@ -4579,10 +4580,10 @@ module.exports = function generate_validate(it, $keyword, $ruleType) { } function $shouldUseRule($rule) { - return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImlementsSomeKeyword($rule)); + return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); } - function $ruleImlementsSomeKeyword($rule) { + function $ruleImplementsSomeKeyword($rule) { var impl = $rule.implements; for (var i = 0; i < impl.length; i++) if (it.schema[impl[i]] !== undefined) return true; @@ -4607,6 +4608,7 @@ module.exports = { * @this Ajv * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. + * @return {Ajv} this for method chaining */ function addKeyword(keyword, definition) { /* jshint validthis: true */ @@ -4684,6 +4686,8 @@ function addKeyword(keyword, definition) { function checkDataType(dataType) { if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType); } + + return this; } @@ -4704,6 +4708,7 @@ function getKeyword(keyword) { * Remove keyword * @this Ajv * @param {String} keyword pre-defined or custom keyword. + * @return {Ajv} this for method chaining */ function removeKeyword(keyword) { /* jshint validthis: true */ @@ -4720,6 +4725,7 @@ function removeKeyword(keyword) { } } } + return this; } },{"./dotjs/custom":21}],37:[function(require,module,exports){ @@ -4839,6 +4845,10 @@ module.exports={ "type": "string" }, "default": {}, + "examples": { + "type": "array", + "items": {} + }, "multipleOf": { "type": "number", "exclusiveMinimum": 0 @@ -6882,6 +6892,7 @@ var META_SUPPORT_DATA = ['/properties']; function Ajv(opts) { if (!(this instanceof Ajv)) return new Ajv(opts); opts = this._opts = util.copy(opts) || {}; + setLogger(this); this._schemas = {}; this._refs = {}; this._fragments = {}; @@ -6955,6 +6966,7 @@ function compile(schema, _meta) { * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + * @return {Ajv} this for method chaining */ function addSchema(schema, key, _skipValidation, _meta) { if (Array.isArray(schema)){ @@ -6967,6 +6979,7 @@ function addSchema(schema, key, _skipValidation, _meta) { key = resolve.normalizeId(key || id); checkUnique(this, key); this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true); + return this; } @@ -6977,9 +6990,11 @@ function addSchema(schema, key, _skipValidation, _meta) { * @param {Object} schema schema object * @param {String} key optional schema key * @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema + * @return {Ajv} this for method chaining */ function addMetaSchema(schema, key, skipValidation) { this.addSchema(schema, key, skipValidation, true); + return this; } @@ -6996,7 +7011,7 @@ function validateSchema(schema, throwOrLogError) { throw new Error('$schema must be a string'); $schema = $schema || this._opts.defaultMeta || defaultMeta(this); if (!$schema) { - console.warn('meta-schema not available'); + this.logger.warn('meta-schema not available'); this.errors = null; return true; } @@ -7009,7 +7024,7 @@ function validateSchema(schema, throwOrLogError) { finally { this._formats.uri = currentUriFormat; } if (!valid && throwOrLogError) { var message = 'schema is invalid: ' + this.errorsText(); - if (this._opts.validateSchema == 'log') console.error(message); + if (this._opts.validateSchema == 'log') this.logger.error(message); else throw new Error(message); } return valid; @@ -7076,25 +7091,26 @@ function _getSchemaObj(self, keyRef) { * Even if schema is referenced by other schemas it still can be removed as other schemas have local references. * @this Ajv * @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object + * @return {Ajv} this for method chaining */ function removeSchema(schemaKeyRef) { if (schemaKeyRef instanceof RegExp) { _removeAllSchemas(this, this._schemas, schemaKeyRef); _removeAllSchemas(this, this._refs, schemaKeyRef); - return; + return this; } switch (typeof schemaKeyRef) { case 'undefined': _removeAllSchemas(this, this._schemas); _removeAllSchemas(this, this._refs); this._cache.clear(); - return; + return this; case 'string': var schemaObj = _getSchemaObj(this, schemaKeyRef); if (schemaObj) this._cache.del(schemaObj.cacheKey); delete this._schemas[schemaKeyRef]; delete this._refs[schemaKeyRef]; - return; + return this; case 'object': var serialize = this._opts.serialize; var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef; @@ -7106,6 +7122,7 @@ function removeSchema(schemaKeyRef) { delete this._refs[id]; } } + return this; } @@ -7208,15 +7225,15 @@ function chooseGetId(opts) { } } - +/* @this Ajv */ function _getId(schema) { - if (schema.$id) console.warn('schema $id ignored', schema.$id); + if (schema.$id) this.logger.warn('schema $id ignored', schema.$id); return schema.id; } - +/* @this Ajv */ function _get$Id(schema) { - if (schema.id) console.warn('schema id ignored', schema.id); + if (schema.id) this.logger.warn('schema id ignored', schema.id); return schema.$id; } @@ -7256,10 +7273,12 @@ function errorsText(errors, options) { * @this Ajv * @param {String} name format name * @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) + * @return {Ajv} this for method chaining */ function addFormat(name, format) { if (typeof format == 'string') format = new RegExp(format); this._formats[name] = format; + return this; } @@ -7306,5 +7325,21 @@ function getMetaSchemaOptions(self) { return metaOpts; } + +function setLogger(self) { + var logger = self._opts.logger; + if (logger === false) { + self.logger = {log: noop, warn: noop, error: noop}; + } else { + if (logger === undefined) logger = console; + if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error)) + throw new Error('logger must implement log, warn and error methods'); + self.logger = logger; + } +} + + +function noop() {} + },{"./$data":1,"./cache":2,"./compile":7,"./compile/async":4,"./compile/error_classes":5,"./compile/formats":6,"./compile/resolve":8,"./compile/rules":9,"./compile/schema_obj":10,"./compile/util":12,"./keyword":36,"./patternGroups":37,"./refs/$data.json":38,"./refs/json-schema-draft-06.json":39,"co":40,"fast-json-stable-stringify":42}]},{},[])("ajv") }); \ No newline at end of file diff --git a/tools/eslint/node_modules/ajv/dist/ajv.min.js b/tools/eslint/node_modules/ajv/dist/ajv.min.js index 151ea32e5855f2..2bc334ced96c9f 100644 --- a/tools/eslint/node_modules/ajv/dist/ajv.min.js +++ b/tools/eslint/node_modules/ajv/dist/ajv.min.js @@ -1,3 +1,3 @@ -/* ajv 5.3.0: Another JSON Schema Validator */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Ajv=e()}}(function(){return function e(r,t,a){function s(i,n){if(!t[i]){if(!r[i]){var l="function"==typeof require&&require;if(!n&&l)return l(i,!0);if(o)return o(i,!0);var h=new Error("Cannot find module '"+i+"'");throw h.code="MODULE_NOT_FOUND",h}var u=t[i]={exports:{}};r[i][0].call(u.exports,function(e){var t=r[i][1][e];return s(t||e)},u,u.exports,e,r,t,a)}return t[i].exports}for(var o="function"==typeof require&&require,i=0;i=1&&t<=12&&a>=1&&a<=h[t]}function o(e,r){var t=e.match(u);return!!t&&(t[1]<=23&&t[2]<=59&&t[3]<=59&&(!r||t[5]))}function i(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}var n=e("./util"),l=/^\d\d\d\d-(\d\d)-(\d\d)$/,h=[0,31,29,31,30,31,30,31,31,30,31,30,31],u=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i,c=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,f=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,p=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,m=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,v=/^(?:\/(?:[^~/]|~0|~1)*)*$|^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,y=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;r.exports=a,a.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i,uri:/^(?:[a-z][a-z0-9+-.]*)(?::|\/)\/?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i,"uri-template":f,url:p,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:c,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:i,uuid:m,"json-pointer":v,"relative-json-pointer":y},a.full={date:s,time:o,"date-time":function(e){var r=e.split(g);return 2==r.length&&s(r[0])&&o(r[1],!0)},uri:function(e){return P.test(e)&&d.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":f,url:p,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:function(e){return e.length<=255&&c.test(e)},ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:i,uuid:m,"json-pointer":v,"relative-json-pointer":y};var g=/t|\s/i,P=/\/|:/,E=/[^\\]\\Z/},{"./util":12}],7:[function(e,r,t){"use strict";function a(e,r,t,i){function w(){var e=V.validate,r=e.apply(null,arguments);return w.errors=e.errors,r}function b(e,t,s,o){var i=!t||t&&t.schema==e;if(t.schema!=r.schema)return a.call(D,e,t,s,o);var m=!0===e.$async,w=v({isTop:!0,schema:e,isRoot:i,baseId:o,root:t,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:p.MissingRef,RULES:T,validate:v,util:f,resolve:d,resolveRef:S,usePattern:$,useDefault:R,useCustomRule:O,opts:I,formats:N,self:D});w=c(A,h)+c(q,n)+c(z,l)+c(Q,u)+w,I.processCode&&(w=I.processCode(w));var b;try{b=new Function("self","RULES","formats","root","refVal","defaults","customRules","co","equal","ucs2length","ValidationError",w)(D,T,N,r,A,z,Q,y,P,g,E),A[0]=b}catch(e){throw console.error("Error compiling schema, function code:",w),e}return b.schema=e,b.errors=null,b.refs=k,b.refVal=A,b.root=i?b:t,m&&(b.$async=!0),!0===I.sourceCode&&(b.source={code:w,patterns:q,defaults:z}),b}function S(e,s,o){s=d.url(e,s);var i,n,l=k[s];if(void 0!==l)return i=A[l],n="refVal["+l+"]",F(i,n);if(!o&&r.refs){var h=r.refs[s];if(void 0!==h)return i=r.refVal[h],n=j(s,i),F(i,n)}n=j(s);var u=d.call(D,b,r,s);if(void 0===u){var c=t&&t[s];c&&(u=d.inlineRef(c,I.inlineRefs)?c:a.call(D,c,r,t,e))}if(void 0!==u)return x(s,u),F(u,n);_(s)}function j(e,r){var t=A.length;return A[t]=r,k[e]=t,"refVal"+t}function _(e){delete k[e]}function x(e,r){A[k[e]]=r}function F(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&e.$async}}function $(e){var r=L[e];return void 0===r&&(r=L[e]=q.length,q[r]=e),"pattern"+r}function R(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return f.toQuotedString(e);case"object":if(null===e)return"null";var r=m(e),t=C[r];return void 0===t&&(t=C[r]=z.length,z[t]=e),"default"+t}}function O(e,r,t,a){var s=e.definition.validateSchema;if(s&&!1!==D._opts.validateSchema&&!s(r)){var o="keyword schema is invalid: "+D.errorsText(s.errors);if("log"!=D._opts.validateSchema)throw new Error(o);console.error(o)}var i,n=e.definition.compile,l=e.definition.inline,h=e.definition.macro;if(n)i=n.call(D,r,t,a);else if(h)i=h.call(D,r,t,a),!1!==I.validateSchema&&D.validateSchema(i,!0);else if(l)i=l.call(D,a,e.keyword,r,t);else if(!(i=e.definition.validate))return;if(void 0===i)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var u=Q.length;return Q[u]=i,{code:"customRule"+u,validate:i}}var D=this,I=this._opts,A=[void 0],k={},q=[],L={},z=[],C={},Q=[],U=s.call(this,e,r=r||{schema:e,refVal:A,refs:k},i),V=this._compilations[U.index];if(U.compiling)return V.callValidate=w;var N=this._formats,T=this.RULES;try{var M=b(e,r,t,i);V.validate=M;var H=V.callValidate;return H&&(H.schema=M.schema,H.errors=null,H.refs=M.refs,H.refVal=M.refVal,H.root=M.root,H.$async=M.$async,I.sourceCode&&(H.source=M.source)),M}finally{o.call(this,e,r,i)}}function s(e,r,t){var a=i.call(this,e,r,t);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:r,baseId:t},{index:a,compiling:!1})}function o(e,r,t){var a=i.call(this,e,r,t);a>=0&&this._compilations.splice(a,1)}function i(e,r,t){for(var a=0;a=55296&&r<=56319&&s=r)throw new Error("Cannot access property/index "+a+" levels up, current level is "+r);return t[r-a]}if(a>r)throw new Error("Cannot access data "+a+" levels up, current level is "+r);if(i="data"+(r-a||""),!s)return i}for(var l=i,h=s.split("/"),c=0;c",y=f?">":"<",g=void 0;if(e.opts.$data&&m&&m.$data){var P=e.util.getData(m.$data,i,e.dataPathArr),E="exclusive"+o,w="exclType"+o,b="exclIsNumber"+o,S="' + "+(j="op"+o)+" + '";s+=" var schemaExcl"+o+" = "+P+"; ",s+=" var "+E+"; var "+w+" = typeof "+(P="schemaExcl"+o)+"; if ("+w+" != 'boolean' && "+w+" != 'undefined' && "+w+" != 'number') { ";g=p;(_=_||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(g||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";x=s;s=_.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+w+" == 'number' ? ( ("+E+" = "+a+" === undefined || "+P+" "+v+"= "+a+") ? "+c+" "+y+"= "+P+" : "+c+" "+y+" "+a+" ) : ( ("+E+" = "+P+" === true) ? "+c+" "+y+"= "+a+" : "+c+" "+y+" "+a+" ) || "+c+" !== "+c+") { var op"+o+" = "+E+" ? '"+v+"' : '"+v+"=';"}else{S=v;if((b="number"==typeof m)&&d){j="'"+S+"'";s+=" if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ( "+a+" === undefined || "+m+" "+v+"= "+a+" ? "+c+" "+y+"= "+m+" : "+c+" "+y+" "+a+" ) || "+c+" !== "+c+") { "}else{b&&void 0===n?(E=!0,g=p,h=e.errSchemaPath+"/"+p,a=m,y+="="):(b&&(a=Math[f?"min":"max"](m,n)),m===(!b||a)?(E=!0,g=p,h=e.errSchemaPath+"/"+p,y+="="):(E=!1,S+="="));var j="'"+S+"'";s+=" if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+c+" "+y+" "+a+" || "+c+" !== "+c+") { "}}g=g||r;var _=_||[];_.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(g||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { comparison: "+j+", limit: "+a+", exclusive: "+E+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+S+" ",s+=d?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var x=s;return s=_.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n,s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+c+".length "+("maxItems"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==r?"more":"less",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n,s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ",s+=" "+("maxLength"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==r?"longer":"shorter",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n,s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==r?"more":"less",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.schema[r],o=e.schemaPath+e.util.getProperty(r),i=e.errSchemaPath+"/"+r,n=!e.opts.allErrors,l=e.util.copy(e),h="";l.level++;var u="valid"+l.level,c=l.baseId,d=!0,f=s;if(f)for(var p,m=-1,v=f.length-1;m=0)return h&&(a+=" if (true) { "),a;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var v="object"==typeof m&&!(m instanceof RegExp)&&m.validate,y=v&&m.type||"string";if(v){var g=!0===m.async;m=m.validate}if(y!=t)return h&&(a+=" if (true) { "),a;if(g){if(!e.async)throw new Error("async format in sync schema");P="formats"+e.util.getProperty(i)+".validate";a+=" if (!("+e.yieldAwait+" "+P+"("+u+"))) { "}else{a+=" if (! ";var P="formats"+e.util.getProperty(i);v&&(P+=".validate"),a+="function"==typeof m?" "+P+"("+u+") ":" "+P+".test("+u+") ",a+=") { "}}var E=E||[];E.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",a+=d?""+c:""+e.util.toQuotedString(i),a+=" } ",!1!==e.opts.messages&&(a+=" , message: 'should match format \"",a+=d?"' + "+c+" + '":""+e.util.escapeQuotes(i),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=d?"validate.schema"+n:""+e.util.toQuotedString(i),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var w=a;return a=E.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+w+"]); ":" validate.errors = ["+w+"]; return false; ":" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { "),a}},{}],25:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level,v="i"+s,y=f.dataLevel=e.dataLevel+1,g="data"+y,P=e.baseId;if(a+="var "+d+" = errors;var "+c+";",Array.isArray(i)){var E=e.schema.additionalItems;if(!1===E){a+=" "+c+" = "+u+".length <= "+i.length+"; ";var w=l;l=e.errSchemaPath+"/additionalItems",a+=" if (!"+c+") { ";var b=b||[];b.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+i.length+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var S=a;a=b.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l=w,h&&(p+="}",a+=" else { ")}var j=i;if(j)for(var _,x=-1,F=j.length-1;x "+x+") { ";$=u+"["+x+"]";f.schema=_,f.schemaPath=n+"["+x+"]",f.errSchemaPath=l+"/"+x,f.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0),f.dataPathArr[y]=x;R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",a+=" } ",h&&(a+=" if ("+m+") { ",p+="}")}if("object"==typeof E&&e.util.schemaHasRules(E,e.RULES.all)){f.schema=E,f.schemaPath=e.schemaPath+".additionalItems",f.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+m+" = true; if ("+u+".length > "+i.length+") { for (var "+v+" = "+i.length+"; "+v+" < "+u+".length; "+v+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);$=u+"["+v+"]";f.dataPathArr[y]=v;R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",h&&(a+=" if (!"+m+") break; "),a+=" } } ",h&&(a+=" if ("+m+") { ",p+="}")}}else if(e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=n,f.errSchemaPath=l,a+=" for (var "+v+" = 0; "+v+" < "+u+".length; "+v+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var $=u+"["+v+"]";f.dataPathArr[y]=v;var R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",h&&(a+=" if (!"+m+") break; "),a+=" }"}return h&&(a+=" "+p+" if ("+d+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],26:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n,s+="var division"+o+";if (",d&&(s+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),s+=" (division"+o+" = "+c+" / "+a+", ",s+=e.opts.multipleOfPrecision?" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":" division"+o+" !== parseInt(division"+o+") ",s+=" ) ",d&&(s+=" ) "),s+=" ) { ";var f=f||[];f.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { multipleOf: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be multiple of ",s+=d?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var p=s;return s=f.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],27:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="errs__"+s,d=e.util.copy(e);d.level++;var f="valid"+d.level;if(e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=n,d.errSchemaPath=l,a+=" var "+c+" = errors; ";var p=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var m;d.opts.allErrors&&(m=d.opts.allErrors,d.opts.allErrors=!1),a+=" "+e.validate(d)+" ",d.createErrors=!0,m&&(d.opts.allErrors=m),e.compositeRule=d.compositeRule=p,a+=" if ("+f+") { ";var v=v||[];v.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var y=a;a=v.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+y+"]); ":" validate.errors = ["+y+"]; return false; ":" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(a+=" if (false) { ");return a}},{}],28:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level;a+="var "+d+" = errors;var prevValid"+s+" = false;var "+c+" = false;";var v=f.baseId,y=e.compositeRule;e.compositeRule=f.compositeRule=!0;var g=i;if(g)for(var P,E=-1,w=g.length-1;E5)a+=" || validate.schema"+n+"["+v+"] ";else{var L=w;if(L)for(var z=-1,C=L.length-1;z= "+me+"; ",l=e.errSchemaPath+"/patternGroups/minimum",a+=" if (!"+c+") { ",(Ee=Ee||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { reason: '"+ge+"', limit: "+ye+", pattern: '"+e.util.escapeQuotes(he)+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have "+Pe+" than "+ye+' properties matching pattern "'+e.util.escapeQuotes(he)+"\"' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";we=a;a=Ee.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+we+"]); ":" validate.errors = ["+we+"]; return false; ":" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",void 0!==ve&&(a+=" else ")}if(void 0!==ve){var ye=ve,ge="maximum",Pe="more";a+=" "+c+" = pgPropCount"+s+" <= "+ve+"; ",l=e.errSchemaPath+"/patternGroups/maximum",a+=" if (!"+c+") { ";var Ee=Ee||[];Ee.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { reason: '"+ge+"', limit: "+ye+", pattern: '"+e.util.escapeQuotes(he)+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have "+Pe+" than "+ye+' properties matching pattern "'+e.util.escapeQuotes(he)+"\"' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var we=a;a=Ee.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+we+"]); ":" validate.errors = ["+we+"]; return false; ":" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}l=te,h&&(a+=" if ("+c+") { ",p+="}")}}}}return h&&(a+=" "+p+" if ("+d+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],31:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="errs__"+s,d=e.util.copy(e);d.level++;var f="valid"+d.level;if(e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=n,d.errSchemaPath=l;var p="key"+s,m="idx"+s,v="i"+s,y="' + "+p+" + '",g="data"+(d.dataLevel=e.dataLevel+1),P="dataProperties"+s,E=e.opts.ownProperties,w=e.baseId;a+=" var "+c+" = errors; ",E&&(a+=" var "+P+" = undefined; "),a+=E?" "+P+" = "+P+" || Object.keys("+u+"); for (var "+m+"=0; "+m+"<"+P+".length; "+m+"++) { var "+p+" = "+P+"["+m+"]; ":" for (var "+p+" in "+u+") { ",a+=" var startErrs"+s+" = errors; ";var b=p,S=e.compositeRule;e.compositeRule=d.compositeRule=!0;var j=e.validate(d);d.baseId=w,e.util.varOccurences(j,g)<2?a+=" "+e.util.varReplace(j,g,b)+" ":a+=" var "+g+" = "+b+"; "+j+" ",e.compositeRule=d.compositeRule=S,a+=" if (!"+f+") { for (var "+v+"=startErrs"+s+"; "+v+"=e.opts.loopRequired,b=e.opts.ownProperties;if(h)if(a+=" var missing"+s+"; ",w){d||(a+=" var "+f+" = validate.schema"+n+"; ");R="' + "+($="schema"+s+"["+(j="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,$,e.opts.jsonPointers)),a+=" var "+c+" = true; ",d&&(a+=" if (schema"+s+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+s+")) "+c+" = false; else {"),a+=" for (var "+j+" = 0; "+j+" < "+f+".length; "+j+"++) { "+c+" = "+u+"["+f+"["+j+"]] !== undefined ",b&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", "+f+"["+j+"]) "),a+="; if (!"+c+") break; } ",d&&(a+=" } "),a+=" if (!"+c+") { ",(x=x||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+R+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+R+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";F=a;a=x.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+F+"]); ":" validate.errors = ["+F+"]; return false; ":" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var S=p;if(S)for(var j=-1,_=S.length-1;j<_;)D=S[j+=1],j&&(a+=" || "),a+=" ( ( "+(q=u+(k=e.util.getProperty(D)))+" === undefined ",b&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(D)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?D:k)+") ) ";a+=") { ";R="' + "+($="missing"+s)+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,$,!0):E+" + "+$);var x=x||[];x.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+R+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+R+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var F=a;a=x.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+F+"]); ":" validate.errors = ["+F+"]; return false; ":" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(w){d||(a+=" var "+f+" = validate.schema"+n+"; ");var $="schema"+s+"["+(j="i"+s)+"]",R="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,$,e.opts.jsonPointers)),d&&(a+=" if ("+f+" && !Array.isArray("+f+")) { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+R+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+R+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+f+" !== undefined) { "),a+=" for (var "+j+" = 0; "+j+" < "+f+".length; "+j+"++) { if ("+u+"["+f+"["+j+"]] === undefined ",b&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", "+f+"["+j+"]) "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+R+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+R+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(a+=" } ")}else{var O=p;if(O)for(var D,I=-1,A=O.length-1;I 1) { var i = "+c+".length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal("+c+"[i], "+c+"[j])) { "+d+" = false; break outer; } } } } ",f&&(s+=" } "),s+=" if (!"+d+") { ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}},{}],35:[function(e,r,t){"use strict";r.exports=function(e,r,t){function a(e){for(var r=e.rules,t=0;t2&&(r=d.call(arguments,1)),t(r)})})}function i(e){return Promise.all(e.map(s,this))}function n(e){for(var r=new e.constructor,t=Object.keys(e),a=[],o=0;o1&&(a=t[0]+"@",e=t[1]),a+o((e=e.replace(O,".")).split("."),r).join(".")}function n(e){for(var r,t,a=[],s=0,o=e.length;s=55296&&r<=56319&&s65535&&(r+=k((e-=65536)>>>10&1023|55296),e=56320|1023&e),r+=k(e)}).join("")}function h(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:E}function u(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function c(e,r,t){var a=0;for(e=t?A(e/j):e>>1,e+=A(e/r);e>I*b>>1;a+=E)e=A(e/I);return A(a+(I+1)*e/(e+S))}function d(e){var r,t,a,o,i,n,u,d,f,p,m=[],v=e.length,y=0,g=x,S=_;for((t=e.lastIndexOf(F))<0&&(t=0),a=0;a=128&&s("not-basic"),m.push(e.charCodeAt(a));for(o=t>0?t+1:0;o=v&&s("invalid-input"),((d=h(e.charCodeAt(o++)))>=E||d>A((P-y)/n))&&s("overflow"),y+=d*n,f=u<=S?w:u>=S+b?b:u-S,!(dA(P/(p=E-f))&&s("overflow"),n*=p;S=c(y-i,r=m.length+1,0==i),A(y/r)>P-g&&s("overflow"),g+=A(y/r),y%=r,m.splice(y++,0,g)}return l(m)}function f(e){var r,t,a,o,i,l,h,d,f,p,m,v,y,g,S,j=[];for(v=(e=n(e)).length,r=x,t=0,i=_,l=0;l=r&&mA((P-t)/(y=a+1))&&s("overflow"),t+=(h-r)*y,r=h,l=0;lP&&s("overflow"),m==r){for(d=t,f=E;p=f<=i?w:f>=i+b?b:f-i,!(d= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=E-w,A=Math.floor,k=String.fromCharCode;if(y={version:"1.4.1",ucs2:{decode:n,encode:l},decode:d,encode:f,toASCII:function(e){return i(e,function(e){return R.test(e)?"xn--"+f(e):e})},toUnicode:function(e){return i(e,function(e){return $.test(e)?d(e.slice(4).toLowerCase()):e})}},p&&m)if(r.exports==p)m.exports=y;else for(g in y)y.hasOwnProperty(g)&&(p[g]=y[g]);else a.punycode=y}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(e,r,t){"use strict";function a(e,r){return Object.prototype.hasOwnProperty.call(e,r)}r.exports=function(e,r,t,o){r=r||"&",t=t||"=";var i={};if("string"!=typeof e||0===e.length)return i;var n=/\+/g;e=e.split(r);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var u=0;u=0?(c=m.substr(0,v),d=m.substr(v+1)):(c=m,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),a(i,f)?s(i[f])?i[f].push(p):i[f]=[i[f],p]:i[f]=p}return i};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],46:[function(e,r,t){"use strict";function a(e,r){if(e.map)return e.map(r);for(var t=[],a=0;a",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),f=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},P=e("querystring");a.prototype.parse=function(e,r,t){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),s=-1!==a&&a127?A+="x":A+=I[k];if(!A.match(p)){var L=O.slice(0,_),z=O.slice(_+1),C=I.match(m);C&&(L.push(C[1]),z.unshift(C[2])),z.length&&(u="/"+z.join(".")+u),this.hostname=L.join(".");break}}}this.hostname=this.hostname.length>255?"":this.hostname.toLowerCase(),R||(this.hostname=o.toASCII(this.hostname));var Q=this.port?":"+this.port:"";this.host=(this.hostname||"")+Q,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!v[b])for(var _=0,D=c.length;_0)&&t.host.split("@"))&&(t.auth=$.shift(),t.host=t.hostname=$.shift())),t.search=e.search,t.query=e.query,i.isNull(t.pathname)&&i.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t;if(!E.length)return t.pathname=null,t.path=t.search?"/"+t.search:null,t.href=t.format(),t;for(var S=E.slice(-1)[0],j=(t.host||e.host||E.length>1)&&("."===S||".."===S)||""===S,_=0,x=E.length;x>=0;x--)"."===(S=E[x])?E.splice(x,1):".."===S?(E.splice(x,1),_++):_&&(E.splice(x,1),_--);if(!v&&!P)for(;_--;_)E.unshift("..");!v||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),j&&"/"!==E.join("/").substr(-1)&&E.push("");var F=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(b){t.hostname=t.host=F?"":E.length?E.shift():"";var $=!!(t.host&&t.host.indexOf("@")>0)&&t.host.split("@");$&&(t.auth=$.shift(),t.host=t.hostname=$.shift())}return(v=v||t.host&&E.length)&&!F&&E.unshift(""),E.length?t.pathname=E.join("/"):(t.pathname=null,t.path=null),i.isNull(t.pathname)&&i.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t},a.prototype.parseHost=function(){var e=this.host,r=l.exec(e);r&&(":"!==(r=r[0])&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)}},{"./util":49,punycode:44,querystring:47}],49:[function(e,r,t){"use strict";r.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],ajv:[function(e,r,t){"use strict";function a(e){if(!(this instanceof a))return new a(e);e=this._opts=x.copy(e)||{},this._schemas={},this._refs={},this._fragments={},this._formats=b(e.format);var r=this._schemaUriFormat=this._formats["uri-reference"];this._schemaUriFormatFunc=function(e){return r.test(e)},this._cache=e.cache||new P,this._loadingSchemas={},this._compilations=[],this.RULES=S(),this._getId=l(e),e.loopRequired=e.loopRequired||1/0,"property"==e.errorDataPath&&(e._errorDataPathProperty=!0),void 0===e.serialize&&(e.serialize=w),this._metaOpts=v(this),e.formats&&p(this),d(this),"object"==typeof e.meta&&this.addMetaSchema(e.meta),f(this),e.patternGroups&&_(this)}function s(e){var r=e._opts.meta;return e._opts.defaultMeta="object"==typeof r?e._getId(r)||r:e.getSchema(O)?O:void 0,e._opts.defaultMeta}function o(e,r){var t=g.schema.call(e,{schema:{}},r);if(t){var a=t.schema,s=t.root,o=t.baseId,i=y.call(e,a,s,void 0,o);return e._fragments[r]=new E({ref:r,fragment:!0,schema:a,root:s,baseId:o,validate:i}),i}}function i(e,r){return r=g.normalizeId(r),e._schemas[r]||e._refs[r]||e._fragments[r]}function n(e,r,t){for(var a in r){var s=r[a];s.meta||t&&!t.test(a)||(e._cache.del(s.cacheKey),delete r[a])}}function l(e){switch(e.schemaId){case"$id":return u;case"id":return h;default:return c}}function h(e){return e.$id&&console.warn("schema $id ignored",e.$id),e.id}function u(e){return e.id&&console.warn("schema id ignored",e.id),e.$id}function c(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function d(r){var t;if(r._opts.$data&&(t=e("./refs/$data.json"),r.addMetaSchema(t,t.$id,!0)),!1!==r._opts.meta){var a=e("./refs/json-schema-draft-06.json");r._opts.$data&&(a=j(a,I)),r.addMetaSchema(a,O,!0),r._refs["http://json-schema.org/schema"]=O}}function f(e){var r=e._opts.schemas;if(r)if(Array.isArray(r))e.addSchema(r);else for(var t in r)e.addSchema(r[t],t)}function p(e){for(var r in e._opts.formats)e.addFormat(r,e._opts.formats[r])}function m(e,r){if(e._schemas[r]||e._refs[r])throw new Error('schema with key or id "'+r+'" already exists')}function v(e){for(var r=x.copy(e._opts),t=0;t=1&&t<=12&&a>=1&&a<=h[t]}function o(e,r){var t=e.match(u);if(!t)return!1;return t[1]<=23&&t[2]<=59&&t[3]<=59&&(!r||t[5])}function i(e){if(E.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}var n=e("./util"),l=/^\d\d\d\d-(\d\d)-(\d\d)$/,h=[0,31,29,31,30,31,30,31,31,30,31,30,31],u=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i,c=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i,d=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,f=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,p=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,m=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,v=/^(?:\/(?:[^~/]|~0|~1)*)*$|^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,y=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;r.exports=a,a.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i,uri:/^(?:[a-z][a-z0-9+-.]*)(?::|\/)\/?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i,"uri-template":f,url:p,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:c,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:i,uuid:m,"json-pointer":v,"relative-json-pointer":y},a.full={date:s,time:o,"date-time":function(e){var r=e.split(g);return 2==r.length&&s(r[0])&&o(r[1],!0)},uri:function(e){return P.test(e)&&d.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":f,url:p,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:function(e){return e.length<=255&&c.test(e)},ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:i,uuid:m,"json-pointer":v,"relative-json-pointer":y};var g=/t|\s/i,P=/\/|:/,E=/[^\\]\\Z/},{"./util":12}],7:[function(e,r,t){"use strict";function a(e,r,t,P){function E(){var e=C.validate,r=e.apply(null,arguments);return E.errors=e.errors,r}function w(e,t,s,f){var P=!t||t&&t.schema==e;if(t.schema!=r.schema)return a.call($,e,t,s,f);var E=!0===e.$async,w=p({isTop:!0,schema:e,isRoot:P,baseId:f,root:t,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:d.MissingRef,RULES:U,validate:p,util:c,resolve:u,resolveRef:b,usePattern:_,useDefault:x,useCustomRule:F,opts:R,formats:Q,logger:$.logger,self:$});w=h(O,n)+h(I,o)+h(k,i)+h(L,l)+w,R.processCode&&(w=R.processCode(w));var S;try{S=new Function("self","RULES","formats","root","refVal","defaults","customRules","co","equal","ucs2length","ValidationError",w)($,U,Q,r,O,k,L,m,y,v,g),O[0]=S}catch(e){throw $.logger.error("Error compiling schema, function code:",w),e}return S.schema=e,S.errors=null,S.refs=D,S.refVal=O,S.root=P?S:t,E&&(S.$async=!0),!0===R.sourceCode&&(S.source={code:w,patterns:I,defaults:k}),S}function b(e,s,o){s=u.url(e,s);var i,n,l=D[s];if(void 0!==l)return i=O[l],n="refVal["+l+"]",j(i,n);if(!o&&r.refs){var h=r.refs[s];if(void 0!==h)return i=r.refVal[h],n=S(s,i),j(i,n)}n=S(s);var c=u.call($,w,r,s);if(void 0===c){var d=t&&t[s];d&&(c=u.inlineRef(d,R.inlineRefs)?d:a.call($,d,r,t,e))}if(void 0!==c)return function(e,r){O[D[e]]=r}(s,c),j(c,n);!function(e){delete D[e]}(s)}function S(e,r){var t=O.length;return O[t]=r,D[e]=t,"refVal"+t}function j(e,r){return"object"==typeof e||"boolean"==typeof e?{code:r,schema:e,inline:!0}:{code:r,$async:e&&e.$async}}function _(e){var r=A[e];return void 0===r&&(r=A[e]=I.length,I[r]=e),"pattern"+r}function x(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return c.toQuotedString(e);case"object":if(null===e)return"null";var r=f(e),t=q[r];return void 0===t&&(t=q[r]=k.length,k[t]=e),"default"+t}}function F(e,r,t,a){var s=e.definition.validateSchema;if(s&&!1!==$._opts.validateSchema){if(!s(r)){var o="keyword schema is invalid: "+$.errorsText(s.errors);if("log"!=$._opts.validateSchema)throw new Error(o);$.logger.error(o)}}var i,n=e.definition.compile,l=e.definition.inline,h=e.definition.macro;if(n)i=n.call($,r,t,a);else if(h)i=h.call($,r,t,a),!1!==R.validateSchema&&$.validateSchema(i,!0);else if(l)i=l.call($,a,e.keyword,r,t);else if(!(i=e.definition.validate))return;if(void 0===i)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var u=L.length;return L[u]=i,{code:"customRule"+u,validate:i}}var $=this,R=this._opts,O=[void 0],D={},I=[],A={},k=[],q={},L=[],z=function(e,r,t){var a=s.call(this,e,r,t);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:r,baseId:t},{index:a,compiling:!1})}.call(this,e,r=r||{schema:e,refVal:O,refs:D},P),C=this._compilations[z.index];if(z.compiling)return C.callValidate=E;var Q=this._formats,U=this.RULES;try{var V=w(e,r,t,P);C.validate=V;var N=C.callValidate;return N&&(N.schema=V.schema,N.errors=null,N.refs=V.refs,N.refVal=V.refVal,N.root=V.root,N.$async=V.$async,R.sourceCode&&(N.source=V.source)),V}finally{(function(e,r,t){var a=s.call(this,e,r,t);a>=0&&this._compilations.splice(a,1)}).call(this,e,r,P)}}function s(e,r,t){for(var a=0;a=55296&&r<=56319&&s=r)throw new Error("Cannot access property/index "+a+" levels up, current level is "+r);return t[r-a]}if(a>r)throw new Error("Cannot access data "+a+" levels up, current level is "+r);if(i="data"+(r-a||""),!s)return i}for(var l=i,h=s.split("/"),c=0;c",y=f?">":"<",g=void 0;if(e.opts.$data&&m&&m.$data){var P=e.util.getData(m.$data,i,e.dataPathArr),E="exclusive"+o,w="exclType"+o,b="exclIsNumber"+o,S="' + "+(j="op"+o)+" + '";s+=" var schemaExcl"+o+" = "+P+"; ",s+=" var "+E+"; var "+w+" = typeof "+(P="schemaExcl"+o)+"; if ("+w+" != 'boolean' && "+w+" != 'undefined' && "+w+" != 'number') { ";g=p;(_=_||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(g||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+p+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";x=s;s=_.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+w+" == 'number' ? ( ("+E+" = "+a+" === undefined || "+P+" "+v+"= "+a+") ? "+c+" "+y+"= "+P+" : "+c+" "+y+" "+a+" ) : ( ("+E+" = "+P+" === true) ? "+c+" "+y+"= "+a+" : "+c+" "+y+" "+a+" ) || "+c+" !== "+c+") { var op"+o+" = "+E+" ? '"+v+"' : '"+v+"=';"}else{S=v;if((b="number"==typeof m)&&d){j="'"+S+"'";s+=" if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ( "+a+" === undefined || "+m+" "+v+"= "+a+" ? "+c+" "+y+"= "+m+" : "+c+" "+y+" "+a+" ) || "+c+" !== "+c+") { "}else{b&&void 0===n?(E=!0,g=p,h=e.errSchemaPath+"/"+p,a=m,y+="="):(b&&(a=Math[f?"min":"max"](m,n)),m===(!b||a)?(E=!0,g=p,h=e.errSchemaPath+"/"+p,y+="="):(E=!1,S+="="));var j="'"+S+"'";s+=" if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+c+" "+y+" "+a+" || "+c+" !== "+c+") { "}}g=g||r;var _=_||[];_.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(g||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { comparison: "+j+", limit: "+a+", exclusive: "+E+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+S+" ",s+=d?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var x=s;return s=_.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+x+"]); ":" validate.errors = ["+x+"]; return false; ":" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}},{}],14:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+c+".length "+("maxItems"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==r?"more":"less",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],15:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=!1===e.opts.unicode?" "+c+".length ":" ucs2length("+c+") ",s+=" "+("maxLength"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==r?"longer":"shorter",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],16:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n;s+="if ( ",d&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+c+").length "+("maxProperties"==r?">":"<")+" "+a+") { ";var f=r,p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==r?"more":"less",s+=" than ",s+=d?"' + "+a+" + '":""+n,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],17:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.schema[r],o=e.schemaPath+e.util.getProperty(r),i=e.errSchemaPath+"/"+r,n=!e.opts.allErrors,l=e.util.copy(e),h="";l.level++;var u="valid"+l.level,c=l.baseId,d=!0,f=s;if(f)for(var p,m=-1,v=f.length-1;m=0)return h&&(a+=" if (true) { "),a;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var v="object"==typeof m&&!(m instanceof RegExp)&&m.validate,y=v&&m.type||"string";if(v){var g=!0===m.async;m=m.validate}if(y!=t)return h&&(a+=" if (true) { "),a;if(g){if(!e.async)throw new Error("async format in sync schema");P="formats"+e.util.getProperty(i)+".validate";a+=" if (!("+e.yieldAwait+" "+P+"("+u+"))) { "}else{a+=" if (! ";var P="formats"+e.util.getProperty(i);v&&(P+=".validate"),a+="function"==typeof m?" "+P+"("+u+") ":" "+P+".test("+u+") ",a+=") { "}}var E=E||[];E.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",a+=d?""+c:""+e.util.toQuotedString(i),a+=" } ",!1!==e.opts.messages&&(a+=" , message: 'should match format \"",a+=d?"' + "+c+" + '":""+e.util.escapeQuotes(i),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=d?"validate.schema"+n:""+e.util.toQuotedString(i),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var w=a;return a=E.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+w+"]); ":" validate.errors = ["+w+"]; return false; ":" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",h&&(a+=" else { "),a}},{}],25:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level,v="i"+s,y=f.dataLevel=e.dataLevel+1,g="data"+y,P=e.baseId;if(a+="var "+d+" = errors;var "+c+";",Array.isArray(i)){var E=e.schema.additionalItems;if(!1===E){a+=" "+c+" = "+u+".length <= "+i.length+"; ";var w=l;l=e.errSchemaPath+"/additionalItems",a+=" if (!"+c+") { ";var b=b||[];b.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+i.length+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var S=a;a=b.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+S+"]); ":" validate.errors = ["+S+"]; return false; ":" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l=w,h&&(p+="}",a+=" else { ")}var j=i;if(j)for(var _,x=-1,F=j.length-1;x "+x+") { ";$=u+"["+x+"]";f.schema=_,f.schemaPath=n+"["+x+"]",f.errSchemaPath=l+"/"+x,f.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0),f.dataPathArr[y]=x;R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",a+=" } ",h&&(a+=" if ("+m+") { ",p+="}")}if("object"==typeof E&&e.util.schemaHasRules(E,e.RULES.all)){f.schema=E,f.schemaPath=e.schemaPath+".additionalItems",f.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+m+" = true; if ("+u+".length > "+i.length+") { for (var "+v+" = "+i.length+"; "+v+" < "+u+".length; "+v+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);$=u+"["+v+"]";f.dataPathArr[y]=v;R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",h&&(a+=" if (!"+m+") break; "),a+=" } } ",h&&(a+=" if ("+m+") { ",p+="}")}}else if(e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=n,f.errSchemaPath=l,a+=" for (var "+v+" = 0; "+v+" < "+u+".length; "+v+"++) { ",f.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var $=u+"["+v+"]";f.dataPathArr[y]=v;var R=e.validate(f);f.baseId=P,e.util.varOccurences(R,g)<2?a+=" "+e.util.varReplace(R,g,$)+" ":a+=" var "+g+" = "+$+"; "+R+" ",h&&(a+=" if (!"+m+") break; "),a+=" }"}return h&&(a+=" "+p+" if ("+d+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],26:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a,s=" ",o=e.level,i=e.dataLevel,n=e.schema[r],l=e.schemaPath+e.util.getProperty(r),h=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,c="data"+(i||""),d=e.opts.$data&&n&&n.$data;d?(s+=" var schema"+o+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",a="schema"+o):a=n,s+="var division"+o+";if (",d&&(s+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),s+=" (division"+o+" = "+c+" / "+a+", ",s+=e.opts.multipleOfPrecision?" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":" division"+o+" !== parseInt(division"+o+") ",s+=" ) ",d&&(s+=" ) "),s+=" ) { ";var f=f||[];f.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { multipleOf: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be multiple of ",s+=d?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=d?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var p=s;return s=f.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+p+"]); ":" validate.errors = ["+p+"]; return false; ":" var err = "+p+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},{}],27:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="errs__"+s,d=e.util.copy(e);d.level++;var f="valid"+d.level;if(e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=n,d.errSchemaPath=l,a+=" var "+c+" = errors; ";var p=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var m;d.opts.allErrors&&(m=d.opts.allErrors,d.opts.allErrors=!1),a+=" "+e.validate(d)+" ",d.createErrors=!0,m&&(d.opts.allErrors=m),e.compositeRule=d.compositeRule=p,a+=" if ("+f+") { ";var v=v||[];v.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var y=a;a=v.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+y+"]); ":" validate.errors = ["+y+"]; return false; ":" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(a+=" if (false) { ");return a}},{}],28:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="valid"+s,d="errs__"+s,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level;a+="var "+d+" = errors;var prevValid"+s+" = false;var "+c+" = false;";var v=f.baseId,y=e.compositeRule;e.compositeRule=f.compositeRule=!0;var g=i;if(g)for(var P,E=-1,w=g.length-1;E5)a+=" || validate.schema"+n+"["+v+"] ";else{var L=w;if(L)for(var z=-1,C=L.length-1;z= "+me+"; ",l=e.errSchemaPath+"/patternGroups/minimum",a+=" if (!"+c+") { ";(Ee=Ee||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { reason: '"+ge+"', limit: "+ye+", pattern: '"+e.util.escapeQuotes(he)+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have "+Pe+" than "+ye+' properties matching pattern "'+e.util.escapeQuotes(he)+"\"' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";we=a;a=Ee.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+we+"]); ":" validate.errors = ["+we+"]; return false; ":" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",void 0!==ve&&(a+=" else ")}if(void 0!==ve){var ye=ve,ge="maximum",Pe="more";a+=" "+c+" = pgPropCount"+s+" <= "+ve+"; ",l=e.errSchemaPath+"/patternGroups/maximum",a+=" if (!"+c+") { ";var Ee=Ee||[];Ee.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'patternGroups' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { reason: '"+ge+"', limit: "+ye+", pattern: '"+e.util.escapeQuotes(he)+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have "+Pe+" than "+ye+' properties matching pattern "'+e.util.escapeQuotes(he)+"\"' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var we=a;a=Ee.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+we+"]); ":" validate.errors = ["+we+"]; return false; ":" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}l=te,h&&(a+=" if ("+c+") { ",p+="}")}}}}return h&&(a+=" "+p+" if ("+d+" == errors) {"),a=e.util.cleanUpCode(a)}},{}],31:[function(e,r,t){"use strict";r.exports=function(e,r,t){var a=" ",s=e.level,o=e.dataLevel,i=e.schema[r],n=e.schemaPath+e.util.getProperty(r),l=e.errSchemaPath+"/"+r,h=!e.opts.allErrors,u="data"+(o||""),c="errs__"+s,d=e.util.copy(e);d.level++;var f="valid"+d.level;if(e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=n,d.errSchemaPath=l;var p="key"+s,m="idx"+s,v="i"+s,y="' + "+p+" + '",g="data"+(d.dataLevel=e.dataLevel+1),P="dataProperties"+s,E=e.opts.ownProperties,w=e.baseId;a+=" var "+c+" = errors; ",E&&(a+=" var "+P+" = undefined; "),a+=E?" "+P+" = "+P+" || Object.keys("+u+"); for (var "+m+"=0; "+m+"<"+P+".length; "+m+"++) { var "+p+" = "+P+"["+m+"]; ":" for (var "+p+" in "+u+") { ",a+=" var startErrs"+s+" = errors; ";var b=p,S=e.compositeRule;e.compositeRule=d.compositeRule=!0;var j=e.validate(d);d.baseId=w,e.util.varOccurences(j,g)<2?a+=" "+e.util.varReplace(j,g,b)+" ":a+=" var "+g+" = "+b+"; "+j+" ",e.compositeRule=d.compositeRule=S,a+=" if (!"+f+") { for (var "+v+"=startErrs"+s+"; "+v+"=e.opts.loopRequired,b=e.opts.ownProperties;if(h)if(a+=" var missing"+s+"; ",w){d||(a+=" var "+f+" = validate.schema"+n+"; ");R="' + "+($="schema"+s+"["+(j="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,$,e.opts.jsonPointers)),a+=" var "+c+" = true; ",d&&(a+=" if (schema"+s+" === undefined) "+c+" = true; else if (!Array.isArray(schema"+s+")) "+c+" = false; else {"),a+=" for (var "+j+" = 0; "+j+" < "+f+".length; "+j+"++) { "+c+" = "+u+"["+f+"["+j+"]] !== undefined ",b&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", "+f+"["+j+"]) "),a+="; if (!"+c+") break; } ",d&&(a+=" } "),a+=" if (!"+c+") { ";(x=x||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+R+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+R+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";F=a;a=x.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+F+"]); ":" validate.errors = ["+F+"]; return false; ":" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var S=p;if(S)for(var j=-1,_=S.length-1;j<_;){D=S[j+=1],j&&(a+=" || ");a+=" ( ( "+(q=u+(k=e.util.getProperty(D)))+" === undefined ",b&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(D)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?D:k)+") ) "}a+=") { ";R="' + "+($="missing"+s)+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(E,$,!0):E+" + "+$);var x=x||[];x.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+R+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+R+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var F=a;a=x.pop(),a+=!e.compositeRule&&h?e.async?" throw new ValidationError(["+F+"]); ":" validate.errors = ["+F+"]; return false; ":" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(w){d||(a+=" var "+f+" = validate.schema"+n+"; ");var $="schema"+s+"["+(j="i"+s)+"]",R="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(E,$,e.opts.jsonPointers)),d&&(a+=" if ("+f+" && !Array.isArray("+f+")) { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+R+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+R+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+f+" !== undefined) { "),a+=" for (var "+j+" = 0; "+j+" < "+f+".length; "+j+"++) { if ("+u+"["+f+"["+j+"]] === undefined ",b&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", "+f+"["+j+"]) "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+R+"' } ",!1!==e.opts.messages&&(a+=" , message: '",a+=e.opts._errorDataPathProperty?"is a required property":"should have required property \\'"+R+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(a+=" } ")}else{var O=p;if(O)for(var D,I=-1,A=O.length-1;I 1) { var i = "+c+".length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal("+c+"[i], "+c+"[j])) { "+d+" = false; break outer; } } } } ",f&&(s+=" } "),s+=" if (!"+d+") { ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(h)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",s+=f?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+c+" "),s+=" } "):s+=" {} ";var m=s;s=p.pop(),s+=!e.compositeRule&&u?e.async?" throw new ValidationError(["+m+"]); ":" validate.errors = ["+m+"]; return false; ":" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}},{}],35:[function(e,r,t){"use strict";r.exports=function(e,r,t){function a(e){for(var r=e.rules,t=0;t2&&(r=n.call(arguments,1)),t(r)})})}.call(this,e):Array.isArray(e)?function(e){return Promise.all(e.map(s,this))}.call(this,e):function(e){return Object==e.constructor}(e)?function(e){for(var r=new e.constructor,t=Object.keys(e),a=[],i=0;i1&&(a=t[0]+"@",e=t[1]);return a+o((e=e.replace(O,".")).split("."),r).join(".")}function n(e){for(var r,t,a=[],s=0,o=e.length;s=55296&&r<=56319&&s65535&&(r+=k((e-=65536)>>>10&1023|55296),e=56320|1023&e),r+=k(e)}).join("")}function h(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:E}function u(e,r){return e+22+75*(e<26)-((0!=r)<<5)}function c(e,r,t){var a=0;for(e=t?A(e/j):e>>1,e+=A(e/r);e>I*b>>1;a+=E)e=A(e/I);return A(a+(I+1)*e/(e+S))}function d(e){var r,t,a,o,i,n,u,d,f,p,m=[],v=e.length,y=0,g=x,S=_;for((t=e.lastIndexOf(F))<0&&(t=0),a=0;a=128&&s("not-basic"),m.push(e.charCodeAt(a));for(o=t>0?t+1:0;o=v&&s("invalid-input"),((d=h(e.charCodeAt(o++)))>=E||d>A((P-y)/n))&&s("overflow"),y+=d*n,f=u<=S?w:u>=S+b?b:u-S,!(dA(P/(p=E-f))&&s("overflow"),n*=p;S=c(y-i,r=m.length+1,0==i),A(y/r)>P-g&&s("overflow"),g+=A(y/r),y%=r,m.splice(y++,0,g)}return l(m)}function f(e){var r,t,a,o,i,l,h,d,f,p,m,v,y,g,S,j=[];for(v=(e=n(e)).length,r=x,t=0,i=_,l=0;l=r&&mA((P-t)/(y=a+1))&&s("overflow"),t+=(h-r)*y,r=h,l=0;lP&&s("overflow"),m==r){for(d=t,f=E;p=f<=i?w:f>=i+b?b:f-i,!(d= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=E-w,A=Math.floor,k=String.fromCharCode;if(y={version:"1.4.1",ucs2:{decode:n,encode:l},decode:d,encode:f,toASCII:function(e){return i(e,function(e){return R.test(e)?"xn--"+f(e):e})},toUnicode:function(e){return i(e,function(e){return $.test(e)?d(e.slice(4).toLowerCase()):e})}},p&&m)if(r.exports==p)m.exports=y;else for(g in y)y.hasOwnProperty(g)&&(p[g]=y[g]);else a.punycode=y}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(e,r,t){"use strict";function a(e,r){return Object.prototype.hasOwnProperty.call(e,r)}r.exports=function(e,r,t,o){r=r||"&",t=t||"=";var i={};if("string"!=typeof e||0===e.length)return i;var n=/\+/g;e=e.split(r);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var u=0;u=0?(c=m.substr(0,v),d=m.substr(v+1)):(c=m,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),a(i,f)?s(i[f])?i[f].push(p):i[f]=[i[f],p]:i[f]=p}return i};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],46:[function(e,r,t){"use strict";function a(e,r){if(e.map)return e.map(r);for(var t=[],a=0;a",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),f=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},P=e("querystring");a.prototype.parse=function(e,r,t){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var a=e.indexOf("?"),s=-1!==a&&a127?A+="x":A+=I[k];if(!A.match(p)){var L=O.slice(0,_),z=O.slice(_+1),C=I.match(m);C&&(L.push(C[1]),z.unshift(C[2])),z.length&&(u="/"+z.join(".")+u),this.hostname=L.join(".");break}}}this.hostname=this.hostname.length>255?"":this.hostname.toLowerCase(),R||(this.hostname=o.toASCII(this.hostname));T=this.port?":"+this.port:"";this.host=(this.hostname||"")+T,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!v[b])for(var _=0,D=c.length;_0)&&t.host.split("@"))&&(t.auth=$.shift(),t.host=t.hostname=$.shift())}return t.search=e.search,t.query=e.query,i.isNull(t.pathname)&&i.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!E.length)return t.pathname=null,t.path=t.search?"/"+t.search:null,t.href=t.format(),t;for(var S=E.slice(-1)[0],j=(t.host||e.host||E.length>1)&&("."===S||".."===S)||""===S,_=0,x=E.length;x>=0;x--)"."===(S=E[x])?E.splice(x,1):".."===S?(E.splice(x,1),_++):_&&(E.splice(x,1),_--);if(!v&&!P)for(;_--;_)E.unshift("..");!v||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),j&&"/"!==E.join("/").substr(-1)&&E.push("");var F=""===E[0]||E[0]&&"/"===E[0].charAt(0);if(b){t.hostname=t.host=F?"":E.length?E.shift():"";var $=!!(t.host&&t.host.indexOf("@")>0)&&t.host.split("@");$&&(t.auth=$.shift(),t.host=t.hostname=$.shift())}return(v=v||t.host&&E.length)&&!F&&E.unshift(""),E.length?t.pathname=E.join("/"):(t.pathname=null,t.path=null),i.isNull(t.pathname)&&i.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t},a.prototype.parseHost=function(){var e=this.host,r=l.exec(e);r&&(":"!==(r=r[0])&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)}},{"./util":49,punycode:44,querystring:47}],49:[function(e,r,t){"use strict";r.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],ajv:[function(e,r,t){"use strict";function a(r){if(!(this instanceof a))return new a(r);r=this._opts=E.copy(r)||{},function(e){var r=e._opts.logger;if(!1===r)e.logger={log:u,warn:u,error:u};else{if(void 0===r&&(r=console),!("object"==typeof r&&r.log&&r.warn&&r.error))throw new Error("logger must implement log, warn and error methods");e.logger=r}}(this),this._schemas={},this._refs={},this._fragments={},this._formats=v(r.format);var t=this._schemaUriFormat=this._formats["uri-reference"];this._schemaUriFormatFunc=function(e){return t.test(e)},this._cache=r.cache||new f,this._loadingSchemas={},this._compilations=[],this.RULES=y(),this._getId=function(e){switch(e.schemaId){case"$id":return n;case"id":return i;default:return l}}(r),r.loopRequired=r.loopRequired||1/0,"property"==r.errorDataPath&&(r._errorDataPathProperty=!0),void 0===r.serialize&&(r.serialize=m),this._metaOpts=function(e){for(var r=E.copy(e._opts),t=0;t<_.length;t++)delete r[_[t]];return r}(this),r.formats&&function(e){for(var r in e._opts.formats){e.addFormat(r,e._opts.formats[r])}}(this),function(r){var t;r._opts.$data&&(t=e("./refs/$data.json"),r.addMetaSchema(t,t.$id,!0));if(!1===r._opts.meta)return;var a=e("./refs/json-schema-draft-06.json");r._opts.$data&&(a=g(a,x));r.addMetaSchema(a,j,!0),r._refs["http://json-schema.org/schema"]=j}(this),"object"==typeof r.meta&&this.addMetaSchema(r.meta),function(e){var r=e._opts.schemas;if(!r)return;if(Array.isArray(r))e.addSchema(r);else for(var t in r)e.addSchema(r[t],t)}(this),r.patternGroups&&P(this)}function s(e,r){return r=d.normalizeId(r),e._schemas[r]||e._refs[r]||e._fragments[r]}function o(e,r,t){for(var a in r){var s=r[a];s.meta||t&&!t.test(a)||(e._cache.del(s.cacheKey),delete r[a])}}function i(e){return e.$id&&this.logger.warn("schema $id ignored",e.$id),e.id}function n(e){return e.id&&this.logger.warn("schema id ignored",e.id),e.$id}function l(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function h(e,r){if(e._schemas[r]||e._refs[r])throw new Error('schema with key or id "'+r+'" already exists')}function u(){}var c=e("./compile"),d=e("./compile/resolve"),f=e("./cache"),p=e("./compile/schema_obj"),m=e("fast-json-stable-stringify"),v=e("./compile/formats"),y=e("./compile/rules"),g=e("./$data"),P=e("./patternGroups"),E=e("./compile/util"),w=e("co");r.exports=a,a.prototype.validate=function(e,r){var t;if("string"==typeof e){if(!(t=this.getSchema(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var a=this._addSchema(e);t=a.validate||this._compile(a)}var s=t(r);return!0===t.$async?"*"==this._opts.async?w(s):s:(this.errors=t.errors,s)},a.prototype.compile=function(e,r){var t=this._addSchema(e,void 0,r);return t.validate||this._compile(t)},a.prototype.addSchema=function(e,r,t,a){if(!Array.isArray(e)){var s=this._getId(e);if(void 0!==s&&"string"!=typeof s)throw new Error("schema id must be string");return r=d.normalizeId(r||s),h(this,r),this._schemas[r]=this._addSchema(e,t,a,!0),this}for(var o=0;o=t}function i(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(l,"$1 $3")),e.test(r)}function s(e,t,n,r){var i=new e.constructor(e.options,e.input,t);if(n)for(var s in n)i[s]=n[s];var o=e,a=i;return["inFunction","inAsyncFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in o&&(a[e]=o[e])}),r&&(i.options.preserveParens=!0),i.nextToken(),i}var o={},a=/^async[\t ]+(return|throw)/,u=/^async[\t ]+function/,c=/^\s*[():;]/,l=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g,p=/\s*(get|set)\s*\(/;t.exports=function(e,t){var n=function(){};e.extend("initialContext",function(r){return function(){return this.options.ecmaVersion<7&&(n=function(t){e.raise(t.start,"async/await keywords only available when ecmaVersion>=7")}),this.reservedWords=new RegExp(this.reservedWords.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrict=new RegExp(this.reservedWordsStrict.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrictBind=new RegExp(this.reservedWordsStrictBind.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.inAsyncFunction=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),r.apply(this,arguments)}}),e.extend("shouldParseExportStatement",function(e){return function(){return!("name"!==this.type.label||"async"!==this.value||!i(u,this))||e.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,o=this.startLoc;if("name"===this.type.label)if(i(u,this,!0)){var c=this.inAsyncFunction;try{return this.inAsyncFunction=!0,this.next(),(l=this.parseStatement(n,r)).async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}finally{this.inAsyncFunction=c}}else if("object"==typeof t&&t.asyncExits&&i(a,this)){this.next();var l=this.parseStatement(n,r);return l.async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(t){var n=e.apply(this,arguments);return this.inAsyncFunction&&"await"===n.name&&0===arguments.length&&this.raise(n.start,"'await' is reserved within async functions"),n}}),e.extend("parseExprAtom",function(e){return function(i){var a,u=this.start,l=this.startLoc,p=e.apply(this,arguments);if("Identifier"===p.type)if("async"!==p.name||r(this,p.end)){if("await"===p.name){var h=this.startNodeAt(p.start,p.loc&&p.loc.start);if(this.inAsyncFunction)return a=this.parseExprSubscripts(),h.operator="await",h.argument=a,h=this.finishNodeAt(h,"AwaitExpression",a.end,a.loc&&a.loc.end),n(h),h;if(this.input.slice(p.end).match(c))return t.awaitAnywhere||"module"!==this.options.sourceType?p:this.raise(p.start,"'await' is reserved within modules");if("object"==typeof t&&t.awaitAnywhere&&(u=this.start,(a=s(this,u-4).parseExprSubscripts()).end<=u))return a=s(this,u).parseExprSubscripts(),h.operator="await",h.argument=a,h=this.finishNodeAt(h,"AwaitExpression",a.end,a.loc&&a.loc.end),this.pos=a.end,this.end=a.end,this.endLoc=a.endLoc,this.next(),n(h),h;if(!t.awaitAnywhere&&"module"===this.options.sourceType)return this.raise(p.start,"'await' is reserved within modules")}}else{var f=this.inAsyncFunction;try{this.inAsyncFunction=!0;var d=this,y=!1,m={parseFunctionBody:function(e,t){try{var n=y;return y=!0,d.parseFunctionBody.apply(this,arguments)}finally{y=n}},raise:function(){try{return d.raise.apply(this,arguments)}catch(e){throw y?e:o}}};if("SequenceExpression"===(a=s(this,this.start,m,!0).parseExpression()).type&&(a=a.expressions[0]),"CallExpression"===a.type&&(a=a.callee),"FunctionExpression"===a.type||"FunctionDeclaration"===a.type||"ArrowFunctionExpression"===a.type)return"SequenceExpression"===(a=s(this,this.start,m).parseExpression()).type&&(a=a.expressions[0]),"CallExpression"===a.type&&(a=a.callee),a.async=!0,a.start=u,a.loc&&(a.loc.start=l),a.range&&(a.range[0]=u),this.pos=a.end,this.end=a.end,this.endLoc=a.endLoc,this.next(),n(a),a}catch(e){if(e!==o)throw e}finally{this.inAsyncFunction=f}}return p}}),e.extend("finishNodeAt",function(e){return function(t,n,r,i){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}}),e.extend("finishNode",function(e){return function(t,n){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}}),e.extend("parsePropertyName",function(e){return function(t){t.key&&t.key.name;var i=e.apply(this,arguments);return"Identifier"!==i.type||"async"!==i.name||r(this,i.end)||this.input.slice(i.end).match(c)||(p.test(this.input.slice(i.end))?(i=e.apply(this,arguments),t.__asyncValue=!0):(n(t),"set"===t.kind&&this.raise(i.start,"'set (value)' cannot be be async"),"Identifier"===(i=e.apply(this,arguments)).type&&"set"===i.name&&this.raise(i.start,"'set (value)' cannot be be async"),t.__asyncValue=!0)),i}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i;n.__asyncValue&&("constructor"===n.kind&&this.raise(n.start,"class constructor() cannot be be async"),i=this.inAsyncFunction,this.inAsyncFunction=!0);var s=e.apply(this,arguments);return this.inAsyncFunction=i,s}}),e.extend("parseMethod",function(e){return function(t){var n;this.__currentProperty&&this.__currentProperty.__asyncValue&&(n=this.inAsyncFunction,this.inAsyncFunction=!0);var r=e.apply(this,arguments);return this.inAsyncFunction=n,r}}),e.extend("parsePropertyValue",function(e){return function(t,n,r,i,s,o){var a=this.__currentProperty;this.__currentProperty=t;var u;t.__asyncValue&&(u=this.inAsyncFunction,this.inAsyncFunction=!0);var c=e.apply(this,arguments);return this.inAsyncFunction=u,this.__currentProperty=a,c}})}},{}],3:[function(e,t,n){function r(e,t){return e.lineStart>=t}function i(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(u,"$1 $3")),e.test(r)}function s(e,t,n){var r=new e.constructor(e.options,e.input,t);if(n)for(var i in n)r[i]=n[i];var s=e,o=r;return["inFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in s&&(o[e]=s[e])}),r.nextToken(),r}var o=/^async[\t ]+(return|throw)/,a=/^\s*[):;]/,u=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g;t.exports=function(e,t){t&&"object"==typeof t||(t={}),e.extend("parse",function(n){return function(){return this.inAsync=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),n.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,a=this.startLoc;if("name"===this.type.label&&t.asyncExits&&i(o,this)){this.next();var u=this.parseStatement(n,r);return u.async=!0,u.start=s,u.loc&&(u.loc.start=a),u.range&&(u.range[0]=s),u}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(n){return"module"===this.options.sourceType&&this.options.ecmaVersion>=8&&t.awaitAnywhere?e.call(this,!0):e.apply(this,arguments)}}),e.extend("parseExprAtom",function(e){var n={};return function(r){var i,o=this.start,a=(this.startLoc,e.apply(this,arguments));if("Identifier"===a.type&&"await"===a.name&&!this.inAsync&&t.awaitAnywhere){var u=this.startNodeAt(a.start,a.loc&&a.loc.start);o=this.start;var c={raise:function(){try{return pp.raise.apply(this,arguments)}catch(e){throw n}}};try{if((i=s(this,o-4,c).parseExprSubscripts()).end<=o)return i=s(this,o,c).parseExprSubscripts(),u.argument=i,u=this.finishNodeAt(u,"AwaitExpression",i.end,i.loc&&i.loc.end),this.pos=i.end,this.end=i.end,this.endLoc=i.endLoc,this.next(),u}catch(e){if(e===n)return a;throw e}}return a}});var n={undefined:!0,get:!0,set:!0,static:!0,async:!0,constructor:!0};e.extend("parsePropertyName",function(e){return function(t){var i=t.key&&t.key.name,s=e.apply(this,arguments);return"get"===this.value&&(t.__maybeStaticAsyncGetter=!0),n[this.value]?s:("Identifier"!==s.type||"async"!==s.name&&"async"!==i||r(this,s.end)||this.input.slice(s.end).match(a)?delete t.__maybeStaticAsyncGetter:"set"===t.kind||"set"===s.name?this.raise(s.start,"'set (value)' cannot be be async"):(this.__isAsyncProp=!0,"Identifier"===(s=e.apply(this,arguments)).type&&"set"===s.name&&this.raise(s.start,"'set (value)' cannot be be async")),s)}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i=e.apply(this,arguments);return n.__maybeStaticAsyncGetter&&(delete n.__maybeStaticAsyncGetter,"get"!==n.key.name&&(n.kind="get")),i}}),e.extend("parseFunctionBody",function(e){return function(t,n){var r=this.inAsync;this.__isAsyncProp&&(t.async=!0,this.inAsync=!0,delete this.__isAsyncProp);var i=e.apply(this,arguments);return this.inAsync=r,i}})}},{}],4:[function(e,t,n){!function(e,r){"object"==typeof n&&void 0!==t?r(n):"function"==typeof define&&define.amd?define(["exports"],r):r(e.acorn=e.acorn||{})}(this,function(e){"use strict";function t(e,t){for(var n=65536,r=0;re)return!1;if((n+=t[r+1])>=e)return!0}}function n(e,n){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&w.test(String.fromCharCode(e)):!1!==n&&t(e,S)))}function r(e,n){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&E.test(String.fromCharCode(e)):!1!==n&&(t(e,S)||t(e,k)))))}function i(e,t){return new A(e,{beforeExpr:!0,binop:t})}function s(e,t){return void 0===t&&(t={}),t.keyword=e,L[e]=new A(e,t)}function o(e){return 10===e||13===e||8232===e||8233===e}function a(e,t){return B.call(e,t)}function u(e,t){for(var n=1,r=0;;){N.lastIndex=r;var i=N.exec(e);if(!(i&&i.index=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),I(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return I(t.onComment)&&(t.onComment=l(t,t.onComment)),t}function l(e,t){return function(n,r,i,s,o,a){var u={type:n?"Block":"Line",value:r,start:i,end:s};e.locations&&(u.loc=new M(this,o,a)),e.ranges&&(u.range=[i,s]),t.push(u)}}function p(e){return new RegExp("^(?:"+e.replace(/ /g,"|")+")$")}function h(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=-1}function f(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}function d(e,t,n,r){try{return new RegExp(e,t)}catch(e){if(void 0!==n)throw e instanceof SyntaxError&&r.raise(n,"Error parsing regular expression: "+e.message),e}}function y(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var m={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},g="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",v={5:g,6:g+" const class extends export import super"},b="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",x="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",w=new RegExp("["+b+"]"),E=new RegExp("["+b+x+"]");b=x=null;var S=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],k=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],A=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null},C={beforeExpr:!0},_={startsExpr:!0},L={},O={num:new A("num",_),regexp:new A("regexp",_),string:new A("string",_),name:new A("name",_),eof:new A("eof"),bracketL:new A("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new A("]"),braceL:new A("{",{beforeExpr:!0,startsExpr:!0}),braceR:new A("}"),parenL:new A("(",{beforeExpr:!0,startsExpr:!0}),parenR:new A(")"),comma:new A(",",C),semi:new A(";",C),colon:new A(":",C),dot:new A("."),question:new A("?",C),arrow:new A("=>",C),template:new A("template"),invalidTemplate:new A("invalidTemplate"),ellipsis:new A("...",C),backQuote:new A("`",_),dollarBraceL:new A("${",{beforeExpr:!0,startsExpr:!0}),eq:new A("=",{beforeExpr:!0,isAssign:!0}),assign:new A("_=",{beforeExpr:!0,isAssign:!0}),incDec:new A("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new A("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=/===/!==",6),relational:i("/<=/>=",7),bitShift:i("<>/>>>",8),plusMin:new A("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),starstar:new A("**",{beforeExpr:!0}),_break:s("break"),_case:s("case",C),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",C),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",C),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",_),_if:s("if"),_return:s("return",C),_switch:s("switch"),_throw:s("throw",C),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",_),_super:s("super",_),_class:s("class",_),_extends:s("extends",C),_export:s("export"),_import:s("import"),_null:s("null",_),_true:s("true",_),_false:s("false",_),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},T=/\r\n?|\n|\u2028|\u2029/,N=new RegExp(T.source,"g"),P=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,F=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,$=Object.prototype,B=$.hasOwnProperty,R=$.toString,I=Array.isArray||function(e){return"[object Array]"===R.call(e)},j=function(e,t){this.line=e,this.column=t};j.prototype.offset=function(e){return new j(this.line,this.column+e)};var M=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)},D={ecmaVersion:7,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1,plugins:{}},q={},V=function(e,t,n){this.options=e=c(e),this.sourceFile=e.sourceFile,this.keywords=p(v[e.ecmaVersion>=6?6:5]);var r="";if(!e.allowReserved){for(var i=e.ecmaVersion;!(r=m[i]);i--);"module"==e.sourceType&&(r+=" await")}this.reservedWords=p(r);var s=(r?r+" ":"")+m.strict;this.reservedWordsStrict=p(s),this.reservedWordsStrictBind=p(s+" "+m.strictBind),this.input=String(t),this.containsEsc=!1,this.loadPlugins(e.plugins),n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(T).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=O.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.inFunction=this.inGenerator=this.inAsync=!1,this.yieldPos=this.awaitPos=0,this.labels=[],0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterFunctionScope()};V.prototype.isKeyword=function(e){return this.keywords.test(e)},V.prototype.isReservedWord=function(e){return this.reservedWords.test(e)},V.prototype.extend=function(e,t){this[e]=t(this[e])},V.prototype.loadPlugins=function(e){var t=this;for(var n in e){var r=q[n];if(!r)throw new Error("Plugin '"+n+"' not found");r(t,e[n])}},V.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};var U=V.prototype,z=/^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/;U.strictDirective=function(e){for(var t=this;;){F.lastIndex=e,e+=F.exec(t.input)[0].length;var n=z.exec(t.input.slice(e));if(!n)return!1;if("use strict"==(n[1]||n[2]))return!0;e+=n[0].length}},U.eat=function(e){return this.type===e&&(this.next(),!0)},U.isContextual=function(e){return this.type===O.name&&this.value===e},U.eatContextual=function(e){return this.value===e&&this.eat(O.name)},U.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},U.canInsertSemicolon=function(){return this.type===O.eof||this.type===O.braceR||T.test(this.input.slice(this.lastTokEnd,this.start))},U.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},U.semicolon=function(){this.eat(O.semi)||this.insertSemicolon()||this.unexpected()},U.afterTrailingComma=function(e,t){if(this.type==e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},U.expect=function(e){this.eat(e)||this.unexpected()},U.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")},U.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,"Parenthesized pattern")}},U.checkExpressionErrors=function(e,t){var n=e?e.shorthandAssign:-1;if(!t)return n>=0;n>-1&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns")},U.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos=6&&(e.sourceType=this.options.sourceType),this.finishNode(e,"Program")};var G={kind:"loop"},J={kind:"switch"};W.isLet=function(){if(this.type!==O.name||this.options.ecmaVersion<6||"let"!=this.value)return!1;F.lastIndex=this.pos;var e=F.exec(this.input),t=this.pos+e[0].length,i=this.input.charCodeAt(t);if(91===i||123==i)return!0;if(n(i,!0)){for(var s=t+1;r(this.input.charCodeAt(s),!0);)++s;var o=this.input.slice(t,s);if(!this.isKeyword(o))return!0}return!1},W.isAsyncFunction=function(){if(this.type!==O.name||this.options.ecmaVersion<8||"async"!=this.value)return!1;F.lastIndex=this.pos;var e=F.exec(this.input),t=this.pos+e[0].length;return!(T.test(this.input.slice(this.pos,t))||"function"!==this.input.slice(t,t+8)||t+8!=this.input.length&&r(this.input.charAt(t+8)))},W.parseStatement=function(e,t,n){var r,i=this.type,s=this.startNode();switch(this.isLet()&&(i=O._var,r="let"),i){case O._break:case O._continue:return this.parseBreakContinueStatement(s,i.keyword);case O._debugger:return this.parseDebuggerStatement(s);case O._do:return this.parseDoStatement(s);case O._for:return this.parseForStatement(s);case O._function:return!e&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1);case O._class:return e||this.unexpected(),this.parseClass(s,!0);case O._if:return this.parseIfStatement(s);case O._return:return this.parseReturnStatement(s);case O._switch:return this.parseSwitchStatement(s);case O._throw:return this.parseThrowStatement(s);case O._try:return this.parseTryStatement(s);case O._const:case O._var:return r=r||this.value,e||"var"==r||this.unexpected(),this.parseVarStatement(s,r);case O._while:return this.parseWhileStatement(s);case O._with:return this.parseWithStatement(s);case O.braceL:return this.parseBlock();case O.semi:return this.parseEmptyStatement(s);case O._export:case O._import:return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===O._import?this.parseImport(s):this.parseExport(s,n);default:if(this.isAsyncFunction()&&e)return this.next(),this.parseFunctionStatement(s,!0);var o=this.value,a=this.parseExpression();return i===O.name&&"Identifier"===a.type&&this.eat(O.colon)?this.parseLabeledStatement(s,o,a):this.parseExpressionStatement(s,a)}},W.parseBreakContinueStatement=function(e,t){var n=this,r="break"==t;this.next(),this.eat(O.semi)||this.insertSemicolon()?e.label=null:this.type!==O.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var i=0;i=6?this.eat(O.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},W.parseForStatement=function(e){if(this.next(),this.labels.push(G),this.enterLexicalScope(),this.expect(O.parenL),this.type===O.semi)return this.parseFor(e,null);var t=this.isLet();if(this.type===O._var||this.type===O._const||t){var n=this.startNode(),r=t?"let":this.value;return this.next(),this.parseVar(n,!0,r),this.finishNode(n,"VariableDeclaration"),!(this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of"))||1!==n.declarations.length||"var"!==r&&n.declarations[0].init?this.parseFor(e,n):this.parseForIn(e,n)}var i=new h,s=this.parseExpression(!0,i);return this.type===O._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.toAssignable(s),this.checkLVal(s),this.checkPatternErrors(i,!0),this.parseForIn(e,s)):(this.checkExpressionErrors(i,!0),this.parseFor(e,s))},W.parseFunctionStatement=function(e,t){return this.next(),this.parseFunction(e,!0,!1,t)},W.isFunction=function(){return this.type===O._function||this.isAsyncFunction()},W.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!this.strict&&this.isFunction()),e.alternate=this.eat(O._else)?this.parseStatement(!this.strict&&this.isFunction()):null,this.finishNode(e,"IfStatement")},W.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(O.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},W.parseSwitchStatement=function(e){var t=this;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(O.braceL),this.labels.push(J),this.enterLexicalScope();for(var n,r=!1;this.type!=O.braceR;)if(t.type===O._case||t.type===O._default){var i=t.type===O._case;n&&t.finishNode(n,"SwitchCase"),e.cases.push(n=t.startNode()),n.consequent=[],t.next(),i?n.test=t.parseExpression():(r&&t.raiseRecoverable(t.lastTokStart,"Multiple default clauses"),r=!0,n.test=null),t.expect(O.colon)}else n||t.unexpected(),n.consequent.push(t.parseStatement(!0));return this.exitLexicalScope(),n&&this.finishNode(n,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},W.parseThrowStatement=function(e){return this.next(),T.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Y=[];W.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===O._catch){var t=this.startNode();this.next(),this.expect(O.parenL),t.param=this.parseBindingAtom(),this.enterLexicalScope(),this.checkLVal(t.param,"let"),this.expect(O.parenR),t.body=this.parseBlock(!1),this.exitLexicalScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(O._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},W.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},W.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(G),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"WhileStatement")},W.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},W.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},W.parseLabeledStatement=function(e,t,n){for(var r=this,i=0,s=r.labels;i=0;a--){var u=r.labels[a];if(u.statementStart!=e.start)break;u.statementStart=r.start,u.kind=o}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(!0),("ClassDeclaration"==e.body.type||"VariableDeclaration"==e.body.type&&"var"!=e.body.kind||"FunctionDeclaration"==e.body.type&&(this.strict||e.body.generator))&&this.raiseRecoverable(e.body.start,"Invalid labeled declaration"),this.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},W.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},W.parseBlock=function(e){var t=this;void 0===e&&(e=!0);var n=this.startNode();for(n.body=[],this.expect(O.braceL),e&&this.enterLexicalScope();!this.eat(O.braceR);){var r=t.parseStatement(!0);n.body.push(r)}return e&&this.exitLexicalScope(),this.finishNode(n,"BlockStatement")},W.parseFor=function(e,t){return e.init=t,this.expect(O.semi),e.test=this.type===O.semi?null:this.parseExpression(),this.expect(O.semi),e.update=this.type===O.parenR?null:this.parseExpression(),this.expect(O.parenR),this.exitLexicalScope(),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"ForStatement")},W.parseForIn=function(e,t){var n=this.type===O._in?"ForInStatement":"ForOfStatement";return this.next(),e.left=t,e.right=this.parseExpression(),this.expect(O.parenR),this.exitLexicalScope(),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,n)},W.parseVar=function(e,t,n){var r=this;for(e.declarations=[],e.kind=n;;){var i=r.startNode();if(r.parseVarId(i,n),r.eat(O.eq)?i.init=r.parseMaybeAssign(t):"const"!==n||r.type===O._in||r.options.ecmaVersion>=6&&r.isContextual("of")?"Identifier"==i.id.type||t&&(r.type===O._in||r.isContextual("of"))?i.init=null:r.raise(r.lastTokEnd,"Complex binding patterns require an initialization value"):r.unexpected(),e.declarations.push(r.finishNode(i,"VariableDeclarator")),!r.eat(O.comma))break}return e},W.parseVarId=function(e,t){e.id=this.parseBindingAtom(t),this.checkLVal(e.id,t,!1)},W.parseFunction=function(e,t,n,r){this.initFunction(e),this.options.ecmaVersion>=6&&!r&&(e.generator=this.eat(O.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&&(e.id="nullableID"===t&&this.type!=O.name?null:this.parseIdent(),e.id&&this.checkLVal(e.id,"var"));var i=this.inGenerator,s=this.inAsync,o=this.yieldPos,a=this.awaitPos,u=this.inFunction;return this.inGenerator=e.generator,this.inAsync=e.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),t||(e.id=this.type==O.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n),this.inGenerator=i,this.inAsync=s,this.yieldPos=o,this.awaitPos=a,this.inFunction=u,this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},W.parseFunctionParams=function(e){this.expect(O.parenL),e.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},W.parseClass=function(e,t){var n=this;this.next(),this.parseClassId(e,t),this.parseClassSuper(e);var r=this.startNode(),i=!1;for(r.body=[],this.expect(O.braceL);!this.eat(O.braceR);)if(!n.eat(O.semi)){var s=n.startNode(),o=n.eat(O.star),a=!1,u=n.type===O.name&&"static"===n.value;n.parsePropertyName(s),s.static=u&&n.type!==O.parenL,s.static&&(o&&n.unexpected(),o=n.eat(O.star),n.parsePropertyName(s)),n.options.ecmaVersion>=8&&!o&&!s.computed&&"Identifier"===s.key.type&&"async"===s.key.name&&n.type!==O.parenL&&!n.canInsertSemicolon()&&(a=!0,n.parsePropertyName(s)),s.kind="method";var c=!1;if(!s.computed){var l=s.key;o||a||"Identifier"!==l.type||n.type===O.parenL||"get"!==l.name&&"set"!==l.name||(c=!0,s.kind=l.name,l=n.parsePropertyName(s)),!s.static&&("Identifier"===l.type&&"constructor"===l.name||"Literal"===l.type&&"constructor"===l.value)&&(i&&n.raise(l.start,"Duplicate constructor in the same class"),c&&n.raise(l.start,"Constructor can't have get/set modifier"),o&&n.raise(l.start,"Constructor can't be a generator"),a&&n.raise(l.start,"Constructor can't be an async method"),s.kind="constructor",i=!0)}if(n.parseClassMethod(r,s,o,a),c){var p="get"===s.kind?0:1;if(s.value.params.length!==p){var h=s.value.start;"get"===s.kind?n.raiseRecoverable(h,"getter should have no params"):n.raiseRecoverable(h,"setter should have exactly one param")}else"set"===s.kind&&"RestElement"===s.value.params[0].type&&n.raiseRecoverable(s.value.params[0].start,"Setter cannot use rest params")}}return e.body=this.finishNode(r,"ClassBody"),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},W.parseClassMethod=function(e,t,n,r){t.value=this.parseMethod(n,r),e.body.push(this.finishNode(t,"MethodDefinition"))},W.parseClassId=function(e,t){e.id=this.type===O.name?this.parseIdent():!0===t?this.unexpected():null},W.parseClassSuper=function(e){e.superClass=this.eat(O._extends)?this.parseExprSubscripts():null},W.parseExport=function(e,t){var n=this;if(this.next(),this.eat(O.star))return this.expectContextual("from"),e.source=this.type===O.string?this.parseExprAtom():this.unexpected(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration");if(this.eat(O._default)){this.checkExport(t,"default",this.lastTokStart);var r;if(this.type===O._function||(r=this.isAsyncFunction())){var i=this.startNode();this.next(),r&&this.next(),e.declaration=this.parseFunction(i,"nullableID",!1,r)}else if(this.type===O._class){var s=this.startNode();e.declaration=this.parseClass(s,"nullableID")}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(!0),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id.name,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))e.source=this.type===O.string?this.parseExprAtom():this.unexpected();else{for(var o=0,a=e.specifiers;o=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Can not use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var r=0,i=e.properties;r=6&&(e.computed||e.method||e.shorthand))){var n,r=e.key;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var i=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===n&&"init"===i&&(t.proto&&this.raiseRecoverable(r.start,"Redefinition of __proto__ property"),t.proto=!0);else{var s=t[n="$"+n];if(s){("init"===i?this.strict&&s.init||s.get||s.set:s.init||s[i])&&this.raiseRecoverable(r.start,"Redefinition of property")}else s=t[n]={init:!1,get:!1,set:!1};s[i]=!0}}},Z.parseExpression=function(e,t){var n=this,r=this.start,i=this.startLoc,s=this.parseMaybeAssign(e,t);if(this.type===O.comma){var o=this.startNodeAt(r,i);for(o.expressions=[s];this.eat(O.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return this.finishNode(o,"SequenceExpression")}return s},Z.parseMaybeAssign=function(e,t,n){if(this.inGenerator&&this.isContextual("yield"))return this.parseYield();var r=!1,i=-1,s=-1;t?(i=t.parenthesizedAssign,s=t.trailingComma,t.parenthesizedAssign=t.trailingComma=-1):(t=new h,r=!0);var o=this.start,a=this.startLoc;this.type!=O.parenL&&this.type!=O.name||(this.potentialArrowAt=this.start);var u=this.parseMaybeConditional(e,t);if(n&&(u=n.call(this,u,o,a)),this.type.isAssign){this.checkPatternErrors(t,!0),r||h.call(t);var c=this.startNodeAt(o,a);return c.operator=this.value,c.left=this.type===O.eq?this.toAssignable(u):u,t.shorthandAssign=-1,this.checkLVal(u),this.next(),c.right=this.parseMaybeAssign(e),this.finishNode(c,"AssignmentExpression")}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),s>-1&&(t.trailingComma=s),u},Z.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(O.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(O.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return i},Z.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1);return this.checkExpressionErrors(t)?i:i.start==n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,r,-1,e)},Z.parseExprOp=function(e,t,n,r,i){var s=this.type.binop;if(null!=s&&(!i||this.type!==O._in)&&s>r){var o=this.type===O.logicalOR||this.type===O.logicalAND,a=this.value;this.next();var u=this.start,c=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1),u,c,s,i),p=this.buildBinary(t,n,e,l,a,o);return this.parseExprOp(p,t,n,r,i)}return e},Z.buildBinary=function(e,t,n,r,i,s){var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")},Z.parseMaybeUnary=function(e,t){var n,r=this,i=this.start,s=this.startLoc;if(this.inAsync&&this.isContextual("await"))n=this.parseAwait(e),t=!0;else if(this.type.prefix){var o=this.startNode(),a=this.type===O.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),a?this.checkLVal(o.argument):this.strict&&"delete"===o.operator&&"Identifier"===o.argument.type?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):t=!0,n=this.finishNode(o,a?"UpdateExpression":"UnaryExpression")}else{if(n=this.parseExprSubscripts(e),this.checkExpressionErrors(e))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=r.startNodeAt(i,s);u.operator=r.value,u.prefix=!1,u.argument=n,r.checkLVal(n),r.next(),n=r.finishNode(u,"UpdateExpression")}}return!t&&this.eat(O.starstar)?this.buildBinary(i,s,n,this.parseMaybeUnary(null,!1),"**",!1):n},Z.parseExprSubscripts=function(e){var t=this.start,n=this.startLoc,r=this.parseExprAtom(e),i="ArrowFunctionExpression"===r.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd);if(this.checkExpressionErrors(e)||i)return r;var s=this.parseSubscripts(r,t,n);return e&&"MemberExpression"===s.type&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1)),s},Z.parseSubscripts=function(e,t,n,r){for(var i=this,s=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd==e.end&&!this.canInsertSemicolon(),o=void 0;;)if((o=i.eat(O.bracketL))||i.eat(O.dot)){var a=i.startNodeAt(t,n);a.object=e,a.property=o?i.parseExpression():i.parseIdent(!0),a.computed=!!o,o&&i.expect(O.bracketR),e=i.finishNode(a,"MemberExpression")}else if(!r&&i.eat(O.parenL)){var u=new h,c=i.yieldPos,l=i.awaitPos;i.yieldPos=0,i.awaitPos=0;var p=i.parseExprList(O.parenR,i.options.ecmaVersion>=8,!1,u);if(s&&!i.canInsertSemicolon()&&i.eat(O.arrow))return i.checkPatternErrors(u,!1),i.checkYieldAwaitInDefaultParams(),i.yieldPos=c,i.awaitPos=l,i.parseArrowExpression(i.startNodeAt(t,n),p,!0);i.checkExpressionErrors(u,!0),i.yieldPos=c||i.yieldPos,i.awaitPos=l||i.awaitPos;var f=i.startNodeAt(t,n);f.callee=e,f.arguments=p,e=i.finishNode(f,"CallExpression")}else{if(i.type!==O.backQuote)return e;var d=i.startNodeAt(t,n);d.tag=e,d.quasi=i.parseTemplate({isTagged:!0}),e=i.finishNode(d,"TaggedTemplateExpression")}},Z.parseExprAtom=function(e){var t,n=this.potentialArrowAt==this.start;switch(this.type){case O._super:this.inFunction||this.raise(this.start,"'super' outside of function or class");case O._this:var r=this.type===O._this?"ThisExpression":"Super";return t=this.startNode(),this.next(),this.finishNode(t,r);case O.name:var i=this.start,s=this.startLoc,o=this.parseIdent(this.type!==O.name);if(this.options.ecmaVersion>=8&&"async"===o.name&&!this.canInsertSemicolon()&&this.eat(O._function))return this.parseFunction(this.startNodeAt(i,s),!1,!1,!0);if(n&&!this.canInsertSemicolon()){if(this.eat(O.arrow))return this.parseArrowExpression(this.startNodeAt(i,s),[o],!1);if(this.options.ecmaVersion>=8&&"async"===o.name&&this.type===O.name)return o=this.parseIdent(),!this.canInsertSemicolon()&&this.eat(O.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(i,s),[o],!0)}return o;case O.regexp:var a=this.value;return t=this.parseLiteral(a.value),t.regex={pattern:a.pattern,flags:a.flags},t;case O.num:case O.string:return this.parseLiteral(this.value);case O._null:case O._true:case O._false:return t=this.startNode(),t.value=this.type===O._null?null:this.type===O._true,t.raw=this.type.keyword,this.next(),this.finishNode(t,"Literal");case O.parenL:var u=this.start,c=this.parseParenAndDistinguishExpression(n);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),c;case O.bracketL:return t=this.startNode(),this.next(),t.elements=this.parseExprList(O.bracketR,!0,!0,e),this.finishNode(t,"ArrayExpression");case O.braceL:return this.parseObj(!1,e);case O._function:return t=this.startNode(),this.next(),this.parseFunction(t,!1);case O._class:return this.parseClass(this.startNode(),!1);case O._new:return this.parseNew();case O.backQuote:return this.parseTemplate();default:this.unexpected()}},Z.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),this.next(),this.finishNode(t,"Literal")},Z.parseParenExpression=function(){this.expect(O.parenL);var e=this.parseExpression();return this.expect(O.parenR),e},Z.parseParenAndDistinguishExpression=function(e){var t,n=this,r=this.start,i=this.startLoc,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o,a,u=this.start,c=this.startLoc,l=[],p=!0,f=!1,d=new h,y=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==O.parenR;){if(p?p=!1:n.expect(O.comma),s&&n.afterTrailingComma(O.parenR,!0)){f=!0;break}if(n.type===O.ellipsis){o=n.start,l.push(n.parseParenItem(n.parseRestBinding())),n.type===O.comma&&n.raise(n.start,"Comma is not permitted after the rest element");break}n.type!==O.parenL||a||(a=n.start),l.push(n.parseMaybeAssign(!1,d,n.parseParenItem))}var g=this.start,v=this.startLoc;if(this.expect(O.parenR),e&&!this.canInsertSemicolon()&&this.eat(O.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),a&&this.unexpected(a),this.yieldPos=y,this.awaitPos=m,this.parseParenArrowList(r,i,l);l.length&&!f||this.unexpected(this.lastTokStart),o&&this.unexpected(o),this.checkExpressionErrors(d,!0),this.yieldPos=y||this.yieldPos,this.awaitPos=m||this.awaitPos,l.length>1?((t=this.startNodeAt(u,c)).expressions=l,this.finishNodeAt(t,"SequenceExpression",g,v)):t=l[0]}else t=this.parseParenExpression();if(this.options.preserveParens){var b=this.startNodeAt(r,i);return b.expression=t,this.finishNode(b,"ParenthesizedExpression")}return t},Z.parseParenItem=function(e){return e},Z.parseParenArrowList=function(e,t,n){return this.parseArrowExpression(this.startNodeAt(e,t),n)};var X=[];Z.parseNew=function(){var e=this.startNode(),t=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(O.dot))return e.meta=t,e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is new.target"),this.inFunction||this.raiseRecoverable(e.start,"new.target can only be used in functions"),this.finishNode(e,"MetaProperty");var n=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(),n,r,!0),this.eat(O.parenL)?e.arguments=this.parseExprList(O.parenR,this.options.ecmaVersion>=8,!1):e.arguments=X,this.finishNode(e,"NewExpression")},Z.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===O.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value,cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===O.backQuote,this.finishNode(n,"TemplateElement")},Z.parseTemplate=function(e){var t=this;void 0===e&&(e={});var n=e.isTagged;void 0===n&&(n=!1);var r=this.startNode();this.next(),r.expressions=[];var i=this.parseTemplateElement({isTagged:n});for(r.quasis=[i];!i.tail;)t.expect(O.dollarBraceL),r.expressions.push(t.parseExpression()),t.expect(O.braceR),r.quasis.push(i=t.parseTemplateElement({isTagged:n}));return this.next(),this.finishNode(r,"TemplateLiteral")},Z.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===O.name||this.type===O.num||this.type===O.string||this.type===O.bracketL||this.type.keyword)&&!T.test(this.input.slice(this.lastTokEnd,this.start))},Z.parseObj=function(e,t){var n=this,r=this.startNode(),i=!0,s={};for(r.properties=[],this.next();!this.eat(O.braceR);){if(i)i=!1;else if(n.expect(O.comma),n.afterTrailingComma(O.braceR))break;var o=n.startNode(),a=void 0,u=void 0,c=void 0,l=void 0;n.options.ecmaVersion>=6&&(o.method=!1,o.shorthand=!1,(e||t)&&(c=n.start,l=n.startLoc),e||(a=n.eat(O.star))),n.parsePropertyName(o),!e&&n.options.ecmaVersion>=8&&!a&&n.isAsyncProp(o)?(u=!0,n.parsePropertyName(o,t)):u=!1,n.parsePropertyValue(o,e,a,u,c,l,t),n.checkPropClash(o,s),r.properties.push(n.finishNode(o,"Property"))}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},Z.parsePropertyValue=function(e,t,n,r,i,s,o){if((n||r)&&this.type===O.colon&&this.unexpected(),this.eat(O.colon))e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init";else if(this.options.ecmaVersion>=6&&this.type===O.parenL)t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,r);else if(this.options.ecmaVersion>=5&&!e.computed&&"Identifier"===e.key.type&&("get"===e.key.name||"set"===e.key.name)&&this.type!=O.comma&&this.type!=O.braceR){(n||r||t)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var a="get"===e.kind?0:1;if(e.value.params.length!==a){var u=e.value.start;"get"===e.kind?this.raiseRecoverable(u,"getter should have no params"):this.raiseRecoverable(u,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")}else this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?(this.checkUnreserved(e.key),e.kind="init",t?e.value=this.parseMaybeDefault(i,s,e.key):this.type===O.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,s,e.key)):e.value=e.key,e.shorthand=!0):this.unexpected()},Z.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(O.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(O.bracketR),e.key;e.computed=!1}return e.key=this.type===O.num||this.type===O.string?this.parseExprAtom():this.parseIdent(!0)},Z.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=!1,e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},Z.parseMethod=function(e,t){var n=this.startNode(),r=this.inGenerator,i=this.inAsync,s=this.yieldPos,o=this.awaitPos,a=this.inFunction;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.inGenerator=n.generator,this.inAsync=n.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),this.expect(O.parenL),n.params=this.parseBindingList(O.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=o,this.inFunction=a,this.finishNode(n,"FunctionExpression")},Z.parseArrowExpression=function(e,t,n){var r=this.inGenerator,i=this.inAsync,s=this.yieldPos,o=this.awaitPos,a=this.inFunction;return this.enterFunctionScope(),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.inGenerator=!1,this.inAsync=e.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=o,this.inFunction=a,this.finishNode(e,"ArrowFunctionExpression")},Z.parseFunctionBody=function(e,t){var n=t&&this.type!==O.braceL,r=this.strict,i=!1;if(n)e.body=this.parseMaybeAssign(),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);r&&!s||(i=this.strictDirective(this.end))&&s&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var o=this.labels;this.labels=[],i&&(this.strict=!0),this.checkParams(e,!r&&!i&&!t&&this.isSimpleParamList(e.params)),e.body=this.parseBlock(!1),e.expression=!1,this.labels=o}this.exitFunctionScope(),this.strict&&e.id&&this.checkLVal(e.id,"none"),this.strict=r},Z.isSimpleParamList=function(e){for(var t=0,n=e;t0;)t[n]=arguments[n+1];for(var r=0,i=t;r=1;t--){var n=e.context[t];if("function"===n.token)return n.generator}return!1},se.updateContext=function(e){var t,n=this.type;n.keyword&&e==O.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},O.parenR.updateContext=O.braceR.updateContext=function(){if(1!=this.context.length){var e=this.context.pop();e===ie.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},O.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?ie.b_stat:ie.b_expr),this.exprAllowed=!0},O.dollarBraceL.updateContext=function(){this.context.push(ie.b_tmpl),this.exprAllowed=!0},O.parenL.updateContext=function(e){var t=e===O._if||e===O._for||e===O._with||e===O._while;this.context.push(t?ie.p_stat:ie.p_expr),this.exprAllowed=!0},O.incDec.updateContext=function(){},O._function.updateContext=O._class.updateContext=function(e){e.beforeExpr&&e!==O.semi&&e!==O._else&&(e!==O.colon&&e!==O.braceL||this.curContext()!==ie.b_stat)?this.context.push(ie.f_expr):this.context.push(ie.f_stat),this.exprAllowed=!1},O.backQuote.updateContext=function(){this.curContext()===ie.q_tmpl?this.context.pop():this.context.push(ie.q_tmpl),this.exprAllowed=!1},O.star.updateContext=function(e){if(e==O._function){var t=this.context.length-1;this.context[t]===ie.f_expr?this.context[t]=ie.f_expr_gen:this.context[t]=ie.f_gen}this.exprAllowed=!0},O.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&("of"==this.value&&!this.exprAllowed||"yield"==this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var oe=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new M(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},ae=V.prototype,ue="object"==typeof Packages&&"[object JavaPackage]"==Object.prototype.toString.call(Packages);ae.next=function(){this.options.onToken&&this.options.onToken(new oe(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},ae.getToken=function(){return this.next(),new oe(this)},"undefined"!=typeof Symbol&&(ae[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===O.eof,value:t}}}}),ae.curContext=function(){return this.context[this.context.length-1]},ae.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(O.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},ae.readToken=function(e){return n(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},ae.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);return e<=55295||e>=57344?e:(e<<10)+this.input.charCodeAt(this.pos+1)-56613888},ae.skipBlockComment=function(){var e=this,t=this.options.onComment&&this.curPosition(),n=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations){N.lastIndex=n;for(var i;(i=N.exec(this.input))&&i.index8&&t<14||t>=5760&&P.test(String.fromCharCode(t))))break e;++e.pos}}},ae.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},ae.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(O.ellipsis)):(++this.pos,this.finishToken(O.dot))},ae.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(O.assign,2):this.finishOp(O.slash,1)},ae.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=42===e?O.star:O.modulo;return this.options.ecmaVersion>=7&&42===t&&(++n,r=O.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(O.assign,n+1):this.finishOp(r,n)},ae.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.finishOp(124===e?O.logicalOR:O.logicalAND,2):61===t?this.finishOp(O.assign,2):this.finishOp(124===e?O.bitwiseOR:O.bitwiseAND,1)},ae.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(O.assign,2):this.finishOp(O.bitwiseXOR,1)},ae.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!=t||this.inModule||62!=this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!T.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(O.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(O.assign,2):this.finishOp(O.plusMin,1)},ae.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(O.assign,n+1):this.finishOp(O.bitShift,n)):33!=t||60!=e||this.inModule||45!=this.input.charCodeAt(this.pos+2)||45!=this.input.charCodeAt(this.pos+3)?(61===t&&(n=2),this.finishOp(O.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},ae.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(O.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(O.arrow)):this.finishOp(61===e?O.eq:O.prefix,1)},ae.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(O.parenL);case 41:return++this.pos,this.finishToken(O.parenR);case 59:return++this.pos,this.finishToken(O.semi);case 44:return++this.pos,this.finishToken(O.comma);case 91:return++this.pos,this.finishToken(O.bracketL);case 93:return++this.pos,this.finishToken(O.bracketR);case 123:return++this.pos,this.finishToken(O.braceL);case 125:return++this.pos,this.finishToken(O.braceR);case 58:return++this.pos,this.finishToken(O.colon);case 63:return++this.pos,this.finishToken(O.question);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(O.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(O.prefix,1)}this.raise(this.pos,"Unexpected character '"+y(e)+"'")},ae.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)};var ce=!!d("￿","u");ae.readRegexp=function(){for(var e,t,n=this,r=this.pos;;){n.pos>=n.input.length&&n.raise(r,"Unterminated regular expression");var i=n.input.charAt(n.pos);if(T.test(i)&&n.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++n.pos}var s=this.input.slice(r,this.pos);++this.pos;var o=this.readWord1(),a=s,u="";if(o){var c=/^[gim]*$/;this.options.ecmaVersion>=6&&(c=/^[gimuy]*$/),c.test(o)||this.raise(r,"Invalid regular expression flag"),o.indexOf("u")>=0&&(ce?u="u":(a=(a=a.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(e,t,i){return(t=Number("0x"+t))>1114111&&n.raise(r+i+3,"Code point out of bounds"),"x"})).replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"),u=u.replace("u","")))}var l=null;return ue||(d(a,u,r,this),l=d(s,o)),this.finishToken(O.regexp,{pattern:s,flags:o,value:l})},ae.readInt=function(e,t){for(var n=this,r=this.pos,i=0,s=0,o=null==t?1/0:t;s=97?a-97+10:a>=65?a-65+10:a>=48&&a<=57?a-48:1/0)>=e)break;++n.pos,i=i*e+u}return this.pos===r||null!=t&&this.pos-r!==t?null:i},ae.readRadixNumber=function(e){this.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.start+2,"Expected number in radix "+e),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(O.num,t)},ae.readNumber=function(e){var t=this.pos,r=!1,i=48===this.input.charCodeAt(this.pos);e||null!==this.readInt(10)||this.raise(t,"Invalid number"),i&&this.pos==t+1&&(i=!1);var s=this.input.charCodeAt(this.pos);46!==s||i||(++this.pos,this.readInt(10),r=!0,s=this.input.charCodeAt(this.pos)),69!==s&&101!==s||i||(43!==(s=this.input.charCodeAt(++this.pos))&&45!==s||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),r=!0),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var o,a=this.input.slice(t,this.pos);return r?o=parseFloat(a):i&&1!==a.length?this.strict?this.raise(t,"Invalid number"):o=/[89]/.test(a)?parseInt(a,10):parseInt(a,8):o=parseInt(a,10),this.finishToken(O.num,o)},ae.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},ae.readString=function(e){for(var t=this,n="",r=++this.pos;;){t.pos>=t.input.length&&t.raise(t.start,"Unterminated string constant");var i=t.input.charCodeAt(t.pos);if(i===e)break;92===i?(n+=t.input.slice(r,t.pos),n+=t.readEscapedChar(!1),r=t.pos):(o(i)&&t.raise(t.start,"Unterminated string constant"),++t.pos)}return n+=this.input.slice(r,this.pos++),this.finishToken(O.string,n)};var le={};ae.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==le)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},ae.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw le;this.raise(e,t)},ae.readTmplToken=function(){for(var e=this,t="",n=this.pos;;){e.pos>=e.input.length&&e.raise(e.start,"Unterminated template");var r=e.input.charCodeAt(e.pos);if(96===r||36===r&&123===e.input.charCodeAt(e.pos+1))return e.pos!==e.start||e.type!==O.template&&e.type!==O.invalidTemplate?(t+=e.input.slice(n,e.pos),e.finishToken(O.template,t)):36===r?(e.pos+=2,e.finishToken(O.dollarBraceL)):(++e.pos,e.finishToken(O.backQuote));if(92===r)t+=e.input.slice(n,e.pos),t+=e.readEscapedChar(!0),n=e.pos;else if(o(r)){switch(t+=e.input.slice(n,e.pos),++e.pos,r){case 13:10===e.input.charCodeAt(e.pos)&&++e.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(r)}e.options.locations&&(++e.curLine,e.lineStart=e.pos),n=e.pos}else++e.pos}},ae.readInvalidTemplateToken=function(){for(var e=this;this.pos=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(n,8);return r>255&&(n=n.slice(0,-1),r=parseInt(n,8)),"0"!==n&&(this.strict||e)&&this.invalidStringToken(this.pos-2,"Octal literal in strict mode"),this.pos+=n.length-1,String.fromCharCode(r)}return String.fromCharCode(t)}},ae.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return null===n&&this.invalidStringToken(t,"Bad character escape sequence"),n},ae.readWord1=function(){var e=this;this.containsEsc=!1;for(var t="",i=!0,s=this.pos,o=this.options.ecmaVersion>=6;this.pos=s)&&a[c](t,n,e),(null==r||t.start==r)&&(null==s||t.end==s)&&o(c,t))throw new i(t,n)}(n,u)}catch(e){if(e instanceof i)return e;throw e}},e.findNodeAround=function(n,r,s,o,a){s=t(s),o||(o=e.base);try{!function e(t,n,a){var u=a||t.type;if(!(t.start>r||t.end=r&&s(u,t))throw new i(t,n);o[u](t,n,e)}}(n,a)}catch(e){if(e instanceof i)return e;throw e}},e.findNodeBefore=function(n,r,s,o,a){s=t(s),o||(o=e.base);var u;return function e(t,n,a){if(!(t.start>r)){var c=a||t.type;t.end<=r&&(!u||u.node.end0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function s(e,t,n){for(var r,s=[],o=t;o0?c-4:c;var l=0;for(t=0;t>16&255,o[l++]=i>>8&255,o[l++]=255&i;return 2===s?(i=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[l++]=255&i):1===s&&(i=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[l++]=i>>8&255,o[l++]=255&i),o},n.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i="",a=[],u=0,c=n-r;uc?c:u+16383));return 1===r?(t=e[n-1],i+=o[t>>2],i+=o[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=o[t>>10],i+=o[t>>4&63],i+=o[t<<2&63],i+="="),a.push(i),a.join("")};for(var o=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=c.length;lH)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(e)}return s(e,t,n)}function s(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return z(e)?p(e,t,n):"string"==typeof e?c(e,t):h(e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function a(e,t,n){return o(e),e<=0?r(e):void 0!==t?"string"==typeof n?r(e).fill(t,n):r(e).fill(t):r(e)}function u(e){return o(e),r(e<0?0:0|f(e))}function c(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,t),s=r(n),o=s.write(e,t);return o!==n&&(s=s.slice(0,o)),s}function l(e){for(var t=e.length<0?0:0|f(e.length),n=r(t),i=0;i=H)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+H.toString(16)+" bytes");return 0|e}function d(e,t){if(i.isBuffer(e))return e.length;if(W(e)||z(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return M(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(r)return M(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return L(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,s){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,G(n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,s);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){function s(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,n/=2}var c;if(i){var l=-1;for(c=n;ca&&(n=a-u),c=n;c>=0;c--){for(var p=!0,h=0;hi&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o239?4:s>223?3:s>191?2:1;if(i+a<=n){var u,c,l,p;switch(a){case 1:s<128&&(o=s);break;case 2:128==(192&(u=e[i+1]))&&(p=(31&s)<<6|63&u)>127&&(o=p);break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(p=(15&s)<<12|(63&u)<<6|63&c)>2047&&(p<55296||p>57343)&&(o=p);break;case 4:u=e[i+1],c=e[i+2],l=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(p=(15&s)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&p<1114112&&(o=p)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return _(r)}function _(e){var t=e.length;if(t<=Z)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,n,r,s,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function $(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,i){return t=+t,n>>>=0,i||$(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(e,t,n,r,23,4),n+4}function R(e,t,n,r,i){return t=+t,n>>>=0,i||$(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(e,t,n,r,52,8),n+8}function I(e){if((e=e.trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function j(e){return e<16?"0"+e.toString(16):e.toString(16)}function M(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],o=0;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function D(e){for(var t=[],n=0;n>8,i=n%256,s.push(i),s.push(r);return s}function V(e){return J.toByteArray(I(e))}function U(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function z(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function W(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function G(e){return e!==e}var J=e("base64-js"),Y=e("ieee754");n.Buffer=i,n.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},n.INSPECT_MAX_BYTES=50;var H=2147483647;n.kMaxLength=H,i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,n){return s(e,t,n)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,n){return a(e,t,n)},i.allocUnsafe=function(e){return u(e)},i.allocUnsafeSlow=function(e){return u(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,s=0,o=Math.min(n,r);s0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},i.prototype.compare=function(e,t,n,r,s){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||n>e.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&t>=n)return 0;if(r>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,s>>>=0,this===e)return 0;for(var o=s-r,a=n-t,u=Math.min(o,a),c=this.slice(r,s),l=e.slice(t,n),p=0;p>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||P(e,t,this.length);for(var r=this[e],i=1,s=0;++s>>=0,t>>>=0,n||P(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},i.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);for(var r=this[e],i=1,s=0;++s=i&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},i.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),Y.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),Y.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),Y.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),Y.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||F(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s>>=0,n>>>=0,r||F(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);F(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);F(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return R(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return R(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o>1,l=-7,p=n?i-1:0,h=n?-1:1,f=e[t+p];for(p+=h,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+p],p+=h,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+p],p+=h,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=c}return(f?-1:1)*o*Math.pow(2,s-r)},n.write=function(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,d=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+p>=1?h/u:h*Math.pow(2,1-p))*u>=2&&(o++,u/=2),o+p>=l?(a=0,o=l):o+p>=1?(a=(t*u-1)*Math.pow(2,i),o+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&a,f+=d,a/=256,i-=8);for(o=o<0;e[n+f]=255&o,f+=d,o/=256,c-=8);e[n+f-d]|=128*y}},{}],10:[function(e,t,n){(function(n){function r(e){var t={};return e.forEach(function(e){if(e&&"object"==typeof e)for(var n in e)t[n]=e[n]}),t}function i(e){return(e instanceof n?e:new n(e.toString(),"binary")).toString("base64")}function s(){}function o(e){this.covers={},this._ident=o.prototype.version+"_"+Math.random(),this.setOptions(e||{})}var a=e("./lib/parser"),u=e("./lib/arboriculture"),c=e("./lib/output");o.prototype.smCache={},o.prototype.setOptions=function(e){return this.log=!1===e.log?s:e.log||this.log,this.options=r([this.options,e]),delete this.options.log,this},o.prototype.version=e("./package.json").version,o.prototype.isThenable=function(e){return e&&e instanceof Object&&"function"==typeof e.then},o.prototype.compile=function(e,t,n,r){"object"==typeof n&&void 0===r&&(r=n),r=r||{};for(var i in o.initialCodeGenOpts)i in r||(r[i]=o.initialCodeGenOpts[i]);var a=this.parse(e,t,null,r);return this.asynchronize(a,null,r,this.log||s),this.prettyPrint(a,r),a},o.prototype.parse=function(e,t,n,r){"object"==typeof n&&void 0===r&&(r=n);var i={origCode:e.toString(),filename:t};try{return i.ast=a.parse(i.origCode,r&&r.parser),r.babelTree&&a.treeWalker(i.ast,function(e,t,n){"Literal"===e.type?n[0].replace(u.babelLiteralNode(e.value)):"Property"===e.type&&("ClassBody"===n[0].parent.type?e.type="ClassProperty":e.type="ObjectProperty"),t()}),i}catch(e){if(e instanceof SyntaxError){var s=i.origCode.substr(e.pos-e.loc.column);s=s.split("\n")[0],e.message+=" "+t+" (nodent)\n"+s+"\n"+s.replace(/[\S ]/g,"-").substring(0,e.loc.column)+"^",e.stack=""}throw e}},o.prototype.asynchronize=u.asynchronize,o.prototype.printNode=u.printNode,o.prototype.prettyPrint=function(t,n){var r=t.filename?t.filename.split("/"):["anonymous"],s=r.pop(),o=c(t.ast,n&&n.sourcemap?{map:{startLine:n.mapStartLine||0,file:s+"(original)",sourceMapRoot:r.join("/"),sourceContent:t.origCode}}:null,t.origCode);if(n&&n.sourcemap)try{var a="",u=o.map.toJSON();if(u){var l=e("source-map").SourceMapConsumer;t.sourcemap=u,this.smCache[t.filename]={map:u,smc:new l(u)},a="\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,"+i(JSON.stringify(u))+"\n"}t.code=o.code+a}catch(e){t.code=o}else t.code=o;return t},o.prototype.getDefaultCompileOptions=void 0,Object.defineProperty(o.prototype,"Promise",{get:function(){return initOpts.log("Warning: nodent.Promise is deprecated. Use nodent.Thenable instead"),Thenable},enumerable:!1,configurable:!1}),o.initialCodeGenOpts={noRuntime:!1,lazyThenables:!1,es6target:!1,noUseDirective:!1,wrapAwait:null,mapStartLine:0,sourcemap:!0,engine:!1,parser:{sourceType:"script"},$return:"$return",$error:"$error",$arguments:"$args",$asyncspawn:"$asyncspawn",$asyncbind:"$asyncbind",generatedSymbolPrefix:"$",$makeThenable:"$makeThenable"},t.exports=o}).call(this,e("buffer").Buffer)},{"./lib/arboriculture":11,"./lib/output":12,"./lib/parser":13,"./package.json":25,buffer:8,"source-map":24}],11:[function(e,t,n){"use strict";function r(e){if(!e)return"";if(Array.isArray(e))return e.map(r).join("|\n");try{return g(e)}catch(t){return t.message+": "+(e&&e.type)}}function i(e){if(Array.isArray(e))return e.map(function(e){return i(e)});var t={};return Object.keys(e).forEach(function(n){t[n]=e[n]}),t}function s(e,t){e!==t&&(e.__proto__=Object.getPrototypeOf(t),Object.keys(e).forEach(function(t){t in v||delete e[t]}),Object.keys(t).forEach(function(n){n in e||(e[n]=t[n])}))}function o(){}function a(e){return e?(x.node=e,x):{}}function u(e,t,n){if(!e)return null;if(t&&"object"==typeof t){var r=Object.keys(t);return u(e,function(e){return r.every(function(n){return e[n]==t[n]})})}var i,s={};if(Array.isArray(e)){for(var o=0;o0){if(!o)return t(e);delete e.async}return void(!o&&i?t():(e.type="ReturnStatement",e.$mapped=!0,e.argument={type:"CallExpression",callee:C(s,[n]).$error,arguments:[e.argument]}))}return"TryStatement"===e.type?(i++,t(e),void i--):a(e).isFunction?(r++,t(e),void r--):void t(e)}if(r>0){if(!a(e).isAsync)return t(e);delete e.async}return e.$mapped=!0,void(a(e.argument).isUnaryExpression&&"void"===e.argument.operator?e.argument=e.argument.argument:e.argument={type:"CallExpression",callee:C(s,[n]).$return,arguments:e.argument?[e.argument]:[]})},t)}function $(e,t){return Array.isArray(e)?e.map(function(e){return $(e,t)}):(m.treeWalker(e,function(e,t,n){if(t(),"ConditionalExpression"===e.type&&(c(e.alternate)||c(e.consequent))){f(S("condOp"));s(e,O(m.part("if ($0) return $1 ; return $2",[e.test,e.consequent,e.alternate]).body))}},t),e)}function B(e,t){return Array.isArray(e)?e.map(function(e){return B(e,t)}):(m.treeWalker(e,function(e,t,n){if(t(),"LogicalExpression"===e.type&&c(e.right)){var r,i=f(S("logical"+("&&"===e.operator?"And":"Or")));if("||"===e.operator)r="var $0; if (!($0 = $1)) {$0 = $2} return $0";else{if("&&"!==e.operator)throw new Error(b(e)+"Illegal logical operator: "+e.operator);r="var $0; if ($0 = $1) {$0 = $2} return $0"}s(e,O(m.part(r,[i,e.left,e.right]).body))}},t),e)}function R(e,t,n){if("SwitchCase"!==e.type&&a(e).isBlockStatement)for(var r=0;r { $$setMapped: while (q) { if (q.then) "+(1===i?" return void q.then($idTrampoline, $exit); ":" return q.then($idTrampoline, $exit); ")+" try { if (q.pop) if (q.length) return q.pop() ? $idContinuation.call(this) : q; else q = $idStep; else q = q.call(this) } catch (_exception) { return $exit(_exception); } } }))($idIter)":"($idTrampoline = (function (q) { $$setMapped: while (q) { if (q.then) "+(1===i?" return void q.then($idTrampoline, $exit); ":" return q.then($idTrampoline, $exit); ")+" try { if (q.pop) if (q.length) return q.pop() ? $idContinuation.call(this) : q; else q = $idStep; else q = q.call(this) } catch (_exception) { return $exit(_exception); } } }).bind(this))($idIter)",{setMapped:function(e){return e.$mapped=!0,e},idTrampoline:w,exit:P,idIter:E,idContinuation:k,idStep:S}).expr:m.part("(Function.$0.trampoline(this,$1,$2,$3,$5)($4))",[ge.asyncbind,k,S,P,E,x(1===i)]).expr,o.push({type:"ReturnStatement",argument:N}),o.push({$label:e.$label,type:"FunctionDeclaration",id:E,params:[],body:{type:"BlockStatement",body:d}}),h&&o.push({type:"FunctionDeclaration",id:S,params:[],body:{type:"BlockStatement",body:[h,_]}}),!l||"VariableDeclaration"!==l.type||"let"!==l.kind&&"const"!==l.kind?(o.push(v),t[0].replace(o.map(r))):("const"===l.kind&&(l.kind="let"),t[0].replace([{type:"BlockStatement",body:o.map(r)},r(v)]))}}function H(e,t){return m.treeWalker(e,function(e,t,r){function o(e){return{type:"ReturnStatement",argument:{type:"UnaryExpression",operator:"void",prefix:!0,argument:T(e||E)}}}"ForInStatement"===e.type&&c(e)?G(e,r):"ForOfStatement"===e.type&&c(e)&&J(e,r),t();var u;if(a(e).isLoop&&c(e)){var l=e.init,h=e.test||x(!0),d=e.update,y=e.body,v=p(y);l&&(a(l).isStatement||(l={type:"ExpressionStatement",expression:l})),d=d&&{type:"ExpressionStatement",expression:d},y=a(y).isBlockStatement?i(y).body:[i(y)];var b=e.$label&&e.$label.name;b="Loop_"+(b||me++);var w=n.generatedSymbolPrefix+(b+"_exit"),E=n.generatedSymbolPrefix+(b+"_next"),S=f(n.generatedSymbolPrefix+b),k=function(e){return{type:"ReturnStatement",argument:{type:"UnaryExpression",operator:"void",prefix:!0,argument:{type:"CallExpression",callee:f(e||w),arguments:[]}}}},A=L(E,[{type:"ReturnStatement",argument:{type:"CallExpression",callee:v?g(S):S,arguments:[f(w),ge.error]}}]);d&&A.body.body.unshift(d);for(var C=0;C0&&a(e).isAsync)return delete e.async,e.argument={type:"CallExpression",callee:"ThrowStatement"===e.type?ge.error:ge.return,arguments:e.argument?[e.argument]:[]},void(e.type="ReturnStatement");n(e)})}function ee(e,t){if(n.noRuntime)throw new Error("Nodent: 'noRuntime' option only compatible with -promise and -engine modes");return m.part("{ return (function*($return,$error){ $:body }).$asyncspawn(Promise,this) }",{return:ge.return,error:ge.error,asyncspawn:ge.asyncspawn,body:K(e).concat(t?[{type:"ReturnStatement",argument:ge.return}]:[])}).body[0]}function te(e){e.$asyncgetwarninig||(e.$asyncgetwarninig=!0,y(b(e)+"'async get "+r(e)+"(){...}' is non-standard. See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification"))}function ne(e,t){function r(e,t){m.treeWalker(e,function(n,r,i){n!==e&&a(n).isFunction||(a(n).isAwait?t?(n.$hidden=!0,r()):(delete n.operator,n.delegate=!1,n.type="YieldExpression",r()):r())})}function o(e){var t=n.promises;n.promises=!0,_(e,!0),n.promises=t}function u(e){return"BlockStatement"!==e.body.type&&(e.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:e.body}]}),e}function c(e,n){n.$asyncexitwarninig||(n.$asyncexitwarninig=!0,y(b(e)+"'async "+{ReturnStatement:"return",ThrowStatement:"throw"}[e.type]+"' not possible in "+(t?"engine":"generator")+" mode. Using Promises for function at "+b(n)))}m.treeWalker(e,function(e,n,i){n();var l,p,h;if(a(e).isAsync&&a(e).isFunction){var f;(f=w(i[0].parent))&&a(f).isAsync&&"get"===i[0].parent.kind&&te(i[0].parent.key),(p=Z(e))?(c(p,e.body),o(e)):t?"get"!==i[0].parent.kind&&r(e,!0):(delete(l=e).async,h=E(l),r(l,!1),(l=u(l)).body=ee(l.body.body,p),h&&q(l.body.body,[ve]),l.id&&"ExpressionStatement"===i[0].parent.type?(l.type="FunctionDeclaration",i[1].replace(l)):i[0].replace(l))}else(l=w(e))&&a(l).isAsync&&((p=Z(l))?(c(p,l),o(e)):t&&"get"!==e.kind||(t?o(e):(e.async=!1,h=E(l),r(l,!1),s(l,u(l)),l.body=ee(l.body.body,p)),h&&q(l.body.body,[ve])))});var l=i(n);return n.engine=!1,n.generators=!1,le(e),ae(e),D(e,l.engine),B(e),$(e),z(e,[U,Y,I,j,R]),W(e,"warn"),n.engine=l.engine,n.generators=l.generators,e}function re(e,t,n){var r=[];return m.treeWalker(e,function(i,s,o){if(i===e)return s();t(i,o)?r.push([].concat(o)):n||a(i).isScope||s()}),r}function ie(e,t){var n=[],r={};if((e=e.filter(function(e){return"ExportNamedDeclaration"!==e[0].parent.type})).length){var s={};e.forEach(function(e){for(var t=e[0],n=t.self,o=(n.kind,[]),a=0;a1?{type:"SequenceExpression",expressions:o}:o[0];"For"!==t.parent.type.slice(0,3)&&(l={type:"ExpressionStatement",expression:l}),t.replace(l)}});var o=Object.keys(s);o.length&&(o=o.map(function(e){return{type:"VariableDeclarator",id:f(e),loc:s[e].loc,start:s[e].start,end:s[e].end}}),n[0]&&"VariableDeclaration"===n[0].type?n[0].declarations=n[0].declarations.concat(o):n.unshift({type:"VariableDeclaration",kind:t,declarations:o}))}return{decls:n,duplicates:r}}function se(e){if(!e)return[];if(Array.isArray(e))return e.reduce(function(e,t){return e.concat(se(t.id))},[]);switch(e.type){case"Identifier":return[e.name];case"AssignmentPattern":return se(e.left);case"ArrayPattern":return e.elements.reduce(function(e,t){return e.concat(se(t))},[]);case"ObjectPattern":return e.properties.reduce(function(e,t){return e.concat(se(t))},[]);case"ObjectProperty":case"Property":return se(e.value);case"RestElement":case"RestProperty":return se(e.argument)}}function oe(e){function t(e){y(b(e)+"Possible assignment to 'const "+r(e)+"'")}function n(e){switch(e.type){case"Identifier":"const"===i[e.name]&&t(e);break;case"ArrayPattern":e.elements.forEach(function(e){"const"===i[e.name]&&t(e)});break;case"ObjectPattern":e.properties.forEach(function(e){"const"===i[e.key.name]&&t(e)})}}var i={};m.treeWalker(e,function(e,t,r){var s=a(e).isBlockStatement;if(s){i=Object.create(i);for(var o=0;o=0){var r=n[0];return("left"!=r.field||"ForInStatement"!==r.parent.type&&"ForOfStatement"!==r.parent.type)&&("init"!=r.field||"ForStatement"!==r.parent.type||"const"!==t.kind&&"let"!==t.kind)}}}function o(e,t){return!("FunctionDeclaration"!==e.type||!e.id)&&(a(e).isAsync||!e.$continuation)}var l={TemplateLiteral:function(e){return e.expressions},NewExpression:function(e){return e.arguments},CallExpression:function(e){return e.arguments},SequenceExpression:function(e){return e.expressions},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties.map(function(e){return e.value})}};m.treeWalker(e,function(e,n,r){var o;if(n(),e.type in l&&!e.$hoisted){var r,u=l[e.type](e),p=[];for(o=0;o0;o--)if(e.declarations[o]&&e.declarations[o].init&&c(e.declarations[o].init)){var h={type:"VariableDeclaration",kind:e.kind,declarations:e.declarations.splice(o)},f=r[0];if(!("index"in f))throw new Error("VariableDeclaration not in a block");f.parent[f.field].splice(f.index+1,0,h)}}),oe(e);var p=!1;return m.treeWalker(e,function(e,t,i){var s=p;if(p=p||he(e),a(e).isBlockStatement){if(c(e)){var u,l,h,d,m;if(!i[0].parent||a(i[0].parent).isScope){var g={},v={};(l=re(e,n(["const"]),!1)).forEach(function(e){e[0].self.declarations.forEach(function(e){se(e.id).forEach(function(t){g[t]||v[t]?(delete g[t],v[t]=e):g[t]=e})})}),l.forEach(function(e){for(var t=0;t=0&&"ReturnStatement"===r[1].self.type){var s=e.$thisCallName,o=i(ye[s].def.body.body);ye[s].$inlined=!0,a(r[1].self).isJump||o.push({type:"ReturnStatement"}),r[1].replace(o)}});var n=Object.keys(ye).map(function(e){return ye[e].$inlined&&ye[e].def});m.treeWalker(e,function(e,t,r){t(),n.indexOf(e)>=0&&r[0].remove()})}if(!("Program"===e.type&&"module"===e.sourceType||u(e,function(e){return a(e).isES6},!0))){var r=he(e);!function(e){m.treeWalker(e,function(e,t,n){if("Program"===e.type||"FunctionDeclaration"===e.type||"FunctionExpression"===e.type){var i=r;if(r=r||he(e)){t();var s="Program"===e.type?e:e.body,o=re(s,function(e,t){if("FunctionDeclaration"===e.type)return t[0].parent!==s});o=o.map(function(e){return e[0].remove()}),[].push.apply(s.body,o)}else t();r=i}else t()})}(e)}return m.treeWalker(e,function(e,t,n){t(),Object.keys(e).filter(function(e){return"$"===e[0]}).forEach(function(t){delete e[t]})}),e}var ye={},me=1,ge={};Object.keys(n).filter(function(e){return"$"===e[0]}).forEach(function(e){ge[e.slice(1)]=f(n[e])});var ve=m.part("var $0 = arguments",[ge.arguments]).body[0];return n.engine?(e.ast=ce(e.ast,!0),e.ast=ne(e.ast,n.engine),e.ast=pe(e.ast),de(e.ast)):n.generators?(e.ast=ce(e.ast),e.ast=ne(e.ast),e.ast=pe(e.ast),de(e.ast)):(e.ast=ce(e.ast),_(e.ast)),n.babelTree&&m.treeWalker(e.ast,function(e,t,n){t(),"Literal"===e.type&&s(e,x(e.value))}),e}var m=e("./parser"),g=e("./output"),v={start:!0,end:!0,loc:!0,range:!0},b={getScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type?this.node.body.body:"Program"===this.node.type?this.node.body:null},isScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"Program"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type},isFunction:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type},isClass:function(){return"ClassDeclaration"===this.node.type||"ClassExpression"===this.node.type},isBlockStatement:function(){return"ClassBody"===this.node.type||"Program"===this.node.type||"BlockStatement"===this.node.type?this.node.body:"SwitchCase"===this.node.type&&this.node.consequent},isExpressionStatement:function(){return"ExpressionStatement"===this.node.type},isLiteral:function(){return"Literal"===this.node.type||"BooleanLiteral"===this.node.type||"RegExpLiteral"===this.node.type||"NumericLiteral"===this.node.type||"StringLiteral"===this.node.type||"NullLiteral"===this.node.type},isDirective:function(){return"ExpressionStatement"===this.node.type&&("StringLiteral"===this.node.expression.type||"Literal"===this.node.expression.type&&"string"==typeof this.node.expression.value)},isUnaryExpression:function(){return"UnaryExpression"===this.node.type},isAwait:function(){return"AwaitExpression"===this.node.type&&!this.node.$hidden},isAsync:function(){return this.node.async},isStatement:function(){return null!==this.node.type.match(/[a-zA-Z]+Declaration/)||null!==this.node.type.match(/[a-zA-Z]+Statement/)},isExpression:function(){return null!==this.node.type.match(/[a-zA-Z]+Expression/)},isLoop:function(){return"ForStatement"===this.node.type||"WhileStatement"===this.node.type||"DoWhileStatement"===this.node.type},isJump:function(){return"ReturnStatement"===this.node.type||"ThrowStatement"===this.node.type||"BreakStatement"===this.node.type||"ContinueStatement"===this.node.type},isES6:function(){switch(this.node.type){case"ExportNamedDeclaration":case"ExportSpecifier":case"ExportDefaultDeclaration":case"ExportAllDeclaration":case"ImportDeclaration":case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ArrowFunctionExpression":case"ForOfStatement":case"YieldExpression":case"Super":case"RestElement":case"RestProperty":case"SpreadElement":case"TemplateLiteral":case"ClassDeclaration":case"ClassExpression":return!0;case"VariableDeclaration":return this.node.kind&&"var"!==this.node.kind;case"FunctionDeclaration":case"FunctionExpression":return!!this.node.generator}}},x={};Object.keys(b).forEach(function(e){Object.defineProperty(x,e,{get:b[e]})}),t.exports={printNode:r,babelLiteralNode:h,asynchronize:function(e,t,n,r){try{return y(e,0,n,r)}catch(t){if(t instanceof SyntaxError){var i=e.origCode.substr(t.pos-t.loc.column);i=i.split("\n")[0],t.message+=" (nodent)\n"+i+"\n"+i.replace(/[\S ]/g,"-").substring(0,t.loc.column)+"^",t.stack=""}throw t}}}},{"./output":12,"./parser":13}],12:[function(e,t,n){"use strict";function r(e){if("NewExpression"===e.type&&e.arguments&&e.arguments.length)return 19;var t=h[e.type]||h[e.type+e.operator]||h[e.type+e.operator+(e.prefix?"prefix":"")];return void 0!==t?t:20}var i,s,o,a,u,c,l=e("source-map").SourceMapGenerator;if("".repeat)c=function(e,t){return t&&e?e.repeat(t):""};else{var p={};c=function(e,t){if(!t||!e)return"";var n=""+e+t;if(!p[n]){for(var r=[];t--;)r.push(e);p[n]=r.join("")}return p[n]}}var h={ExpressionStatement:-1,Identifier:21,Literal:21,BooleanLiteral:21,RegExpLiteral:21,NumericLiteral:21,StringLiteral:21,NullLiteral:21,ThisExpression:21,SuperExpression:21,ObjectExpression:21,ClassExpression:21,MemberExpression:19,CallExpression:18,NewExpression:18,ArrayExpression:17.5,FunctionExpression:17.5,FunctionDeclaration:17.5,ArrowFunctionExpression:17.5,"UpdateExpression++":17,"UpdateExpression--":17,"UpdateExpression++prefix":16,"UpdateExpression--prefix":16,UnaryExpression:16,AwaitExpression:16,"BinaryExpression**":15,"BinaryExpression*":15,"BinaryExpression/":15,"BinaryExpression%":15,"BinaryExpression+":14,"BinaryExpression-":14,"BinaryExpression<<":13,"BinaryExpression>>":13,"BinaryExpression>>>":13,"BinaryExpression<":12,"BinaryExpression<=":12,"BinaryExpression>":12,"BinaryExpression>=":12,BinaryExpressionin:12,BinaryExpressioninstanceof:12,"BinaryExpression==":11,"BinaryExpression===":11,"BinaryExpression!=":11,"BinaryExpression!==":11,"BinaryExpression&":10,"BinaryExpression^":9,"BinaryExpression|":8,"LogicalExpression&&":7,"LogicalExpression||":6,ConditionalExpression:5,AssignmentPattern:4,AssignmentExpression:4,yield:3,YieldExpression:3,SpreadElement:2,"comma-separated-list":1.5,SequenceExpression:1},f={type:"comma-separated-list"},d={out:function(e,t,n){var r=this[n||e.type];r?r.call(this,e,t):t.write(e,"/*"+e.type+"?*/ "+t.sourceAt(e.start,e.end))},expr:function(e,t,n,i){2===i||r(n)0)for(var r=n.length,i=0;i0){this.out(e[0],t,e[0].type);for(var r=1,i=e.length;r0){t.write(null,s);for(var a=0,u=n.length;a0){this.out(n[0],t,"VariableDeclarator");for(var i=1;i0){for(var s=0;s0)for(var r=0;r ")):(this.formatParameters(e.params,t),t.write(e,"=> ")),"ObjectExpression"===e.body.type||"SequenceExpression"===e.body.type?(t.write(null,"("),this.out(e.body,t,e.body.type),t.write(null,")")):this.out(e.body,t,e.body.type)},ThisExpression:function(e,t){t.write(e,"this")},Super:function(e,t){t.write(e,"super")},RestElement:s=function(e,t){t.write(e,"..."),this.out(e.argument,t,e.argument.type)},SpreadElement:s,YieldExpression:function(e,t){t.write(e,e.delegate?"yield*":"yield"),e.argument&&(t.write(null," "),this.expr(t,e,e.argument))},AwaitExpression:function(e,t){t.write(e,"await "),this.expr(t,e,e.argument)},TemplateLiteral:function(e,t){var n,r=e.quasis,i=e.expressions;t.write(e,"`");for(var s=0,o=i.length;s0)for(var n=e.elements,r=n.length,i=0;;){var s=n[i];if(s&&this.expr(t,f,s),((i+=1)=r)break;t.lineLength()>t.wrapColumn&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1))}t.write(null,"]")},ArrayPattern:a,ObjectExpression:function(e,t){var n,r=c(t.indent,t.indentLevel++),i=t.lineEnd,s=r+t.indent;if(t.write(e,"{"),e.properties.length>0){t.write(null,i);for(var o=e.properties,a=o.length,u=0;n=o[u],t.write(null,s),this.out(n,t,"Property"),++ut.wrapColumn&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1));t.write(null,i,r,"}")}else t.write(null,"}");t.indentLevel--},Property:function(e,t){e.method||"get"===e.kind||"set"===e.kind?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write(null,"["),this.out(e.key,t,e.key.type),t.write(null,"]")):this.out(e.key,t,e.key.type),t.write(null,": ")),this.expr(t,f,e.value))},ObjectPattern:function(e,t){if(t.write(e,"{"),e.properties.length>0)for(var n=e.properties,r=n.length,i=0;this.out(n[i],t,"Property"),++i0)for(var i=r.length,s=0;s1&&t.write(e," "),this.expr(t,e,e.argument,!0)):(this.expr(t,e,e.argument),t.write(e,e.operator))},UpdateExpression:function(e,t){e.prefix?(t.write(e,e.operator),this.out(e.argument,t,e.argument.type)):(this.out(e.argument,t,e.argument.type),t.write(e,e.operator))},BinaryExpression:o=function(e,t){var n=e.operator;"in"===n&&t.inForInit&&t.write(null,"("),this.expr(t,e,e.left),t.write(e," ",n," "),this.expr(t,e,e.right,"ArrowFunctionExpression"===e.right.type?2:0),"in"===n&&t.inForInit&&t.write(null,")")},LogicalExpression:o,AssignmentExpression:function(e,t){"ObjectPattern"===e.left.type&&t.write(null,"("),this.BinaryExpression(e,t),"ObjectPattern"===e.left.type&&t.write(null,")")},AssignmentPattern:function(e,t){this.expr(t,e,e.left),t.write(e," = "),this.expr(t,e,e.right)},ConditionalExpression:function(e,t){this.expr(t,e,e.test,!0),t.write(e," ? "),this.expr(t,e,e.consequent),t.write(null," : "),this.expr(t,e,e.alternate)},NewExpression:function(e,t){t.write(e,"new "),this.expr(t,e,e.callee,"CallExpression"===e.callee.type||"ObjectExpression"===e.callee.type?2:0),this.argumentList(e,t)},CallExpression:function(e,t){this.expr(t,e,e.callee,"ObjectExpression"===e.callee.type?2:0),this.argumentList(e,t)},MemberExpression:function(e,t){!("ObjectExpression"===e.object.type||e.object.type.match(/Literal$/)&&e.object.raw&&e.object.raw.match(/^[0-9]/))&&("ArrayExpression"===e.object.type||"CallExpression"===e.object.type||"NewExpression"===e.object.type||r(e)<=r(e.object))?this.out(e.object,t,e.object.type):(t.write(null,"("),this.out(e.object,t,e.object.type),t.write(null,")")),e.computed?(t.write(e,"["),this.out(e.property,t,e.property.type),t.write(null,"]")):(t.write(e,"."),this.out(e.property,t,e.property.type))},Identifier:function(e,t){t.write(e,e.name)},Literal:function(e,t){t.write(e,e.raw)},NullLiteral:function(e,t){t.write(e,"null")},BooleanLiteral:function(e,t){t.write(e,JSON.stringify(e.value))},StringLiteral:function(e,t){t.write(e,JSON.stringify(e.value))},RegExpLiteral:function(e,t){t.write(e,e.extra.raw||"/"+e.pattern+"/"+e.flags)},NumericLiteral:function(e,t){t.write(e,JSON.stringify(e.value))}};t.exports=function(e,t,n){var r="",i=[],s=(t=t||{}).map&&new l(t.map);s&&t.map.sourceContent&&s.setSourceContent(t.map.file,t.map.sourceContent);var o="",a=[],u=[],p={inForInit:0,lineLength:function(){return r.length},sourceAt:function(e,t){return n?n.substring(e,t):"/* Omitted Non-standard node */"},write:function(e){o=arguments[arguments.length-1];for(var n=1;n=0&&r({self:i,parent:e,field:u[c],index:!0}):l instanceof Object&&i===l&&r({self:i,parent:e,field:u[c]})}})},n),e}function s(t,n){var r=[],s={ecmaVersion:8,allowHashBang:!0,allowReturnOutsideFunction:!0,allowImportExportEverywhere:!0,locations:!0,onComment:r};if((!n||!n.noNodentExtensions||parseInt(o.version)<4)&&(c||(parseInt(o.version)<4&&console.warn("Nodent: Warning - noNodentExtensions option requires acorn >=v4.x. Extensions installed."),e("acorn-es7-plugin")(o),c=!0),s.plugins=s.plugins||{},s.plugins.asyncawait={asyncExits:!0,awaitAnywhere:!0}),n)for(var a in n)"noNodentExtensions"!==a&&(s[a]=n[a]);var u=o.parse(t,s);return i(u,function(e,t,n){for(t();r.length&&e.loc&&e.loc.start.line>=r[0].loc.start.line&&e.loc.end.line>=r[0].loc.end.line;)e.$comments=e.$comments||[],e.$comments.push(r.shift())}),u}var o=e("acorn"),a=e("acorn/dist/walk").make({AwaitExpression:function(e,t,n){n(e.argument,t,"Expression")},SwitchStatement:function(e,t,n){n(e.discriminant,t,"Expression");for(var r=0;r=0)return t}else{var n=i.toSetString(e);if(s.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')},r.prototype.at=function(e){if(e>=0&&e>1;return 1==(1&e)?-t:t}var s=e("./base64");n.encode=function(e){var t,n="",i=r(e);do{t=31&i,(i>>>=5)>0&&(t|=32),n+=s.encode(t)}while(i>0);return n},n.decode=function(e,t,n){var r,o,a=e.length,u=0,c=0;do{if(t>=a)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=s.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));r=!!(32&o),u+=(o&=31)<0?t-u>1?r(u,t,i,s,o,a):a==n.LEAST_UPPER_BOUND?t1?r(e,u,i,s,o,a):a==n.LEAST_UPPER_BOUND?u:e<0?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,i,s){if(0===t.length)return-1;var o=r(-1,t.length,e,t,i,s||n.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&0===i(t[o],t[o-1],!0);)--o;return o}},{}],18:[function(e,t,n){function r(e,t){var n=e.generatedLine,r=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return r>n||r==n&&o>=i||s.compareByGeneratedPositionsInflated(e,t)<=0}function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var s=e("./util");i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){r(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(s.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=i},{"./util":23}],19:[function(e,t,n){function r(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function i(e,t){return Math.round(e+Math.random()*(t-e))}function s(e,t,n,o){if(n=0){var s=this._originalMappings[i];if(void 0===e.column)for(var o=s.originalLine;s&&s.originalLine===o;)r.push({line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var c=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==c;)r.push({line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return r},n.SourceMapConsumer=r,(i.prototype=Object.create(r.prototype)).consumer=r,i.fromSourceMap=function(e){var t=Object.create(i.prototype),n=t._names=c.fromArray(e._names.toArray(),!0),r=t._sources=c.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var o=e._mappings.toArray().slice(),u=t.__generatedMappings=[],l=t.__originalMappings=[],h=0,f=o.length;h1&&(n.source=y+i[1],y+=i[1],n.originalLine=f+i[2],f=n.originalLine,n.originalLine+=1,n.originalColumn=d+i[3],d=n.originalColumn,i.length>4&&(n.name=m+i[4],m+=i[4])),E.push(n),"number"==typeof n.originalLine&&w.push(n)}p(E,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=E,p(w,a.compareByOriginalPositions),this.__originalMappings=w},i.prototype._findMapping=function(e,t,n,r,i,s){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return u.search(e,t,i,s)},i.prototype.computeColumnSpans=function(){for(var e=0;e=0){var i=this._generatedMappings[n];if(i.generatedLine===t.generatedLine){var s=a.getArg(i,"source",null);null!==s&&(s=this._sources.at(s),null!=this.sourceRoot&&(s=a.join(this.sourceRoot,s)));var o=a.getArg(i,"name",null);return null!==o&&(o=this._names.at(o)),{source:s,line:a.getArg(i,"originalLine",null),column:a.getArg(i,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=a.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var n;if(null!=this.sourceRoot&&(n=a.urlParse(this.sourceRoot))){var r=e.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!n.path||"/"==n.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=a.getArg(e,"source");if(null!=this.sourceRoot&&(t=a.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};var n={source:t=this._sources.indexOf(t),originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",r.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===n.source)return{line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=i,(o.prototype=Object.create(r.prototype)).constructor=r,o.prototype._version=3,Object.defineProperty(o.prototype,"sources",{get:function(){for(var e=[],t=0;t0&&e.column>=0)||t||n||r)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))},r.prototype._serializeMappings=function(){for(var e,t,n,r,o=0,a=1,u=0,c=0,l=0,p=0,h="",f=this._mappings.toArray(),d=0,y=f.length;d0){if(!s.compareByGeneratedPositionsInflated(t,f[d-1]))continue;e+=","}e+=i.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(r=this._sources.indexOf(t.source),e+=i.encode(r-p),p=r,e+=i.encode(t.originalLine-1-c),c=t.originalLine-1,e+=i.encode(t.originalColumn-u),u=t.originalColumn,null!=t.name&&(n=this._names.indexOf(t.name),e+=i.encode(n-l),l=n)),h+=e}return h},r.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=s.relative(t,e));var n=s.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null},this)},r.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=r},{"./array-set":14,"./base64-vlq":15,"./mapping-list":18,"./util":23}],22:[function(e,t,n){function r(e,t,n,r,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==i?null:i,this[a]=!0,null!=r&&this.add(r)}var i=e("./source-map-generator").SourceMapGenerator,s=e("./util"),o=/(\r?\n)/,a="$$$isSourceNode$$$";r.fromStringWithSourceMap=function(e,t,n){function i(e,t){if(null===e||void 0===e.source)a.add(t);else{var i=n?s.join(n,e.source):e.source;a.add(new r(e.originalLine,e.originalColumn,i,t,e.name))}}var a=new r,u=e.split(o),c=0,l=function(){function e(){return c=0;t--)this.prepend(e[t]);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},r.prototype.walk=function(e){for(var t,n=0,r=this.children.length;n0){for(t=[],n=0;n=0;l--)"."===(o=u[l])?u.splice(l,1):".."===o?c++:c>0&&(""===o?(u.splice(l+1,c),c=0):(u.splice(l,2),c--));return""===(t=u.join("/"))&&(t=a?"/":"."),s?(s.path=t,i(s)):t}function o(e){return e}function a(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function u(e,t){return e===t?0:e>t?1:-1}n.getArg=function(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')};var c=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,l=/^data:.+\,.+$/;n.urlParse=r,n.urlGenerate=i,n.normalize=s,n.join=function(e,t){""===e&&(e="."),""===t&&(t=".");var n=r(t),o=r(e);if(o&&(e=o.path||"/"),n&&!n.scheme)return o&&(n.scheme=o.scheme),i(n);if(n||t.match(l))return t;if(o&&!o.host&&!o.path)return o.host=t,i(o);var a="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return o?(o.path=a,i(o)):a},n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(c)},n.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)};var p=!("__proto__"in Object.create(null));n.toSetString=p?o:function(e){return a(e)?"$"+e:e},n.fromSetString=p?o:function(e){return a(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,t,n){var r=e.source-t.source;return 0!==r?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)||n?r:0!=(r=e.generatedColumn-t.generatedColumn)?r:0!=(r=e.generatedLine-t.generatedLine)?r:e.name-t.name},n.compareByGeneratedPositionsDeflated=function(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-t.generatedColumn)||n?r:0!=(r=e.source-t.source)?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)?r:e.name-t.name},n.compareByGeneratedPositionsInflated=function(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!=(n=e.generatedColumn-t.generatedColumn)?n:0!==(n=u(e.source,t.source))?n:0!=(n=e.originalLine-t.originalLine)?n:0!=(n=e.originalColumn-t.originalColumn)?n:u(e.name,t.name)}},{}],24:[function(e,t,n){n.SourceMapGenerator=e("./lib/source-map-generator").SourceMapGenerator,n.SourceMapConsumer=e("./lib/source-map-consumer").SourceMapConsumer,n.SourceNode=e("./lib/source-node").SourceNode},{"./lib/source-map-consumer":20,"./lib/source-map-generator":21,"./lib/source-node":22}],25:[function(e,t,n){t.exports={_args:[[{raw:"nodent-compiler@>=3.1.3",scope:null,escapedName:"nodent-compiler",name:"nodent-compiler",rawSpec:">=3.1.3",spec:">=3.1.3",type:"range"},"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/nodent"]],_from:"nodent-compiler@>=3.1.3",_id:"nodent-compiler@3.1.3",_inCache:!0,_location:"/nodent-compiler",_nodeVersion:"8.4.0",_npmOperationalInternal:{host:"s3://npm-registry-packages",tmp:"tmp/nodent-compiler-3.1.3.tgz_1504874988276_0.6329000329133123"},_npmUser:{name:"matatbread",email:"npm@mailed.me.uk"},_npmVersion:"5.3.0",_phantomChildren:{},_requested:{raw:"nodent-compiler@>=3.1.3",scope:null,escapedName:"nodent-compiler",name:"nodent-compiler",rawSpec:">=3.1.3",spec:">=3.1.3",type:"range"},_requiredBy:["/nodent"],_resolved:"https://registry.npmjs.org/nodent-compiler/-/nodent-compiler-3.1.3.tgz",_shasum:"6f0f1f8098db251ec773742bb4f33cd0266434b2",_shrinkwrap:null,_spec:"nodent-compiler@>=3.1.3",_where:"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/nodent",author:{name:"Mat At Bread",email:"nodent@mailed.me.uk"},bugs:{url:"https://github.com/MatAtBread/nodent/issues"},dependencies:{acorn:">=2.5.2","acorn-es7-plugin":">=1.1.6","source-map":"^0.5.6"},description:"NoDent - Asynchronous Javascript language extensions",devDependencies:{},directories:{},dist:{integrity:"sha512-pcUC9gIgXXI3mbGjESZfVZO4Vgarw63xYZFRdkqxCDnygvvpiAwzwvvJ7rWqskp72Nk3cxWZY/rYxUIkPT14lw==",shasum:"6f0f1f8098db251ec773742bb4f33cd0266434b2",tarball:"https://registry.npmjs.org/nodent-compiler/-/nodent-compiler-3.1.3.tgz"},engines:"node >= 0.10.0",gitHead:"d72c5767ca302884c3215e6267d4910239add177",homepage:"https://github.com/MatAtBread/nodent-compiler#readme",keywords:["Javascript","ES7","async","await","language","extensions","Node","callback","generator","Promise","asynchronous"],license:"BSD-2-Clause",main:"compiler.js",maintainers:[{name:"matatbread",email:"npm@mailed.me.uk"}],name:"nodent-compiler",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/MatAtBread/nodent-compiler.git"},scripts:{test:"node tests/basic.js # Please install 'nodent' and test the compiler fully from there."},version:"3.1.3"}},{}],26:[function(e,t,n){"use strict";function r(e,t){if(Function.prototype.$asyncspawn||Object.defineProperty(Function.prototype,"$asyncspawn",{value:r,enumerable:!1,configurable:!0,writable:!0}),this instanceof Function){var n=this;return new e(function(e,r){function i(t,n){var o;try{if((o=t.call(s,n)).done){if(o.value!==e){if(o.value&&o.value===o.value.then)return o.value(e,r);e&&e(o.value),e=null}return}o.value.then?o.value.then(function(e){i(s.next,e)},function(e){i(s.throw,e)}):i(s.next,o.value)}catch(e){return r&&r(e),void(r=null)}}var s=n.call(t,e,r);i(s.next)})}}var i=function(e,t){for(var n=t.toString(),r="return "+n,i=n.match(/.*\(([^)]*)\)/)[1],s=/['"]!!!([^'"]*)['"]/g,o=[];;){var a=s.exec(r);if(!a)break;o.push(a)}return o.reverse().forEach(function(t){r=r.slice(0,t.index)+e[t[1]]+r.substr(t.index+t[0].length)}),r=r.replace(/\/\*[^*]*\*\//g," ").replace(/\s+/g," "),new Function(i,r)()}({zousan:e("./zousan").toString(),thenable:e("./thenableFactory").toString()},function e(t,n){function r(){return i.apply(t,arguments)}Function.prototype.$asyncbind||Object.defineProperty(Function.prototype,"$asyncbind",{value:e,enumerable:!1,configurable:!0,writable:!0}),e.trampoline||(e.trampoline=function(e,t,n,r,i){return function s(o){for(;o;){if(o.then)return o=o.then(s,r),i?void 0:o;try{if(o.pop){if(o.length)return o.pop()?t.call(e):o;o=n}else o=o.call(e)}catch(e){return r(e)}}}}),e.LazyThenable||(e.LazyThenable="!!!thenable"(),e.EagerThenable=e.Thenable=(e.EagerThenableFactory="!!!zousan")());var i=this;switch(n){case!0:return new e.Thenable(r);case 0:return new e.LazyThenable(r);case void 0:return r.then=r,r;default:return function(){try{return i.apply(t,arguments)}catch(e){return n(e)}}}});i(),r(),t.exports={$asyncbind:i,$asyncspawn:r}},{"./thenableFactory":27,"./zousan":28}],27:[function(e,t,n){t.exports=function(){function e(e){return e&&e instanceof Object&&"function"==typeof e.then}function t(n,r,i){try{var s=i?i(r):r;if(n===s)return n.reject(new TypeError("Promise resolution loop"));e(s)?s.then(function(e){t(n,e)},function(e){n.reject(e)}):n.resolve(s)}catch(e){n.reject(e)}}function n(){}function r(e){}function i(r,i){var s=new n;try{this._resolver(function(n){return e(n)?n.then(r,i):t(s,n,r)},function(e){t(s,e,i)})}catch(e){t(s,e,i)}return s}function s(e){this._resolver=e,this.then=i}return n.prototype={resolve:r,reject:r,then:function(e,t){this.resolve=e,this.reject=t}},s.resolve=function(e){return s.isThenable(e)?e:{then:function(t){return t(e)}}},s.isThenable=e,s}},{}],28:[function(e,t,n){(function(e){"use strict";t.exports=function(t){function n(e){if(e){var t=this;e(function(e){t.resolve(e)},function(e){t.reject(e)})}}function r(e,t){if("function"==typeof e.y)try{var n=e.y.call(void 0,t);e.p.resolve(n)}catch(t){e.p.reject(t)}else e.p.resolve(t)}function i(e,t){if("function"==typeof e.n)try{var n=e.n.call(void 0,t);e.p.resolve(n)}catch(t){e.p.reject(t)}else e.p.reject(t)}t=t||"object"==typeof e&&e.nextTick||"function"==typeof setImmediate&&setImmediate||function(e){setTimeout(e,0)};var s=function(){function e(){for(;n.length-r;){try{n[r]()}catch(e){}n[r++]=void 0,r===i&&(n.splice(0,i),r=0)}}var n=[],r=0,i=1024;return function(i){n.push(i),n.length-r==1&&t(e)}}();return n.prototype={resolve:function(e){if(void 0===this.state){if(e===this)return this.reject(new TypeError("Attempt to resolve promise with self"));var t=this;if(e&&("function"==typeof e||"object"==typeof e))try{var n=0,i=e.then;if("function"==typeof i)return void i.call(e,function(e){n++||t.resolve(e)},function(e){n++||t.reject(e)})}catch(e){return void(n||this.reject(e))}this.state=r,this.v=e,t.c&&s(function(){for(var n=0,i=t.c.length;n]*>)(.*)/i,/(.*)(<\/script>)(.*)/i],o=0,a=!0;t=t.split("\n");for(var u=0;u=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,i="/"===o.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),s="/"===o(e,-1);return(e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&s&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),o=Math.min(i.length,s.length),a=o,u=0;u1)for(var n=1;n=(t[n]||0))return!0;return!1}(o))for(var a=0;a"))}return Object.keys(hostOptions).forEach(function(k){"host"===parseOpts[k]&&(parseOpts[k]=function(){try{return eval(hostOptions[k]),!0}catch(e){return!1}}())}),parseOpts.promises||parseOpts.es7||parseOpts.generators||parseOpts.engine?((parseOpts.promises||parseOpts.es7)&&parseOpts.generators&&(log("No valid 'use nodent' directive, assumed -es7 mode"),parseOpts=optionSets.es7),(parseOpts.generators||parseOpts.engine)&&(parseOpts.promises=!0),parseOpts.promises&&(parseOpts.es7=!0),parseOpts):null}function stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),"#!"===e.substring(0,2)&&(e="//"+e),e}function compileNodentedFile(e,t){return t=t||e.log,function(n,r,i){var s=stripBOM(fs.readFileSync(r,"utf8")),o=e.parse(s,r,i);i=i||parseCompilerOptions(o.ast,t,r),e.asynchronize(o,void 0,i,t),e.prettyPrint(o,i),n._compile(o.code,o.filename)}}function asyncify(e){return e=e||Thenable,function(t,n,r){if(Array.isArray(n)){var i=n;n=function(e,t){return i.indexOf(e)>=0}}else n=n||function(e,t){return!(e.match(/Sync$/)&&e.replace(/Sync$/,"")in t)};r||(r="");var s=Object.create(t);for(var o in s)!function(){var i=o;try{"function"!=typeof t[i]||s[i+r]&&s[i+r].isAsync||!n(i,s)||(s[i+r]=function(){var n=Array.prototype.slice.call(arguments);return new e(function(e,r){var s=function(t,n){if(t)return r(t);switch(arguments.length){case 0:return e();case 2:return e(n);default:return e(Array.prototype.slice.call(arguments,1))}};n.length>t[i].length?n.push(s):n[t[i].length-1]=s;t[i].apply(t,n)})},s[i+r].isAsync=!0)}catch(e){}}();return s.super=t,s}}function generateRequestHandler(e,t,n){var r={},i=this;t||(t=/\.njs$/),n?n.compiler||(n.compiler={}):n={compiler:{}};var s=copyObj([NodentCompiler.initialCodeGenOpts,n.compiler]);return function(o,a,u){function c(e){a.statusCode=500,a.write(e.toString()),a.end()}if(r[o.url])return a.setHeader("Content-Type",r[o.url].contentType),n.setHeaders&&n.setHeaders(a),a.write(r[o.url].output),void a.end();if(!(o.url.match(t)||n.htmlScriptRegex&&o.url.match(n.htmlScriptRegex)))return u&&u();var l=e+o.url;if(n.extensions&&!fs.existsSync(l))for(var p=0;p=0?this.covers[n]=require(e):this.covers[n]=require(__dirname+"/covers/"+e)),this.covers[n](this,t)}function prepareMappedStackTrace(e,t){return e+t.map(function(e){var t=e.getFileName();if(t&&NodentCompiler.prototype.smCache[t]){var n=NodentCompiler.prototype.smCache[t].smc.originalPositionFor({line:e.getLineNumber(),column:e.getColumnNumber()});if(n&&n.line){var r=e.toString();return"\n at "+r.substring(0,r.length-1)+" => …"+n.source+":"+n.line+":"+n.column+(e.getFunctionName()?")":"")}}return"\n at "+e}).join("")}function setGlobalEnvironment(e){var t={};t[defaultCodeGenOpts.$asyncbind]={value:$asyncbind,writable:!0,enumerable:!1,configurable:!0},t[defaultCodeGenOpts.$asyncspawn]={value:$asyncspawn,writable:!0,enumerable:!1,configurable:!0};try{Object.defineProperties(Function.prototype,t)}catch(t){e.log("Function prototypes already assigned: ",t.messsage)}defaultCodeGenOpts[defaultCodeGenOpts.$error]in global||(global[defaultCodeGenOpts[defaultCodeGenOpts.$error]]=globalErrorHandler),e.augmentObject&&Object.defineProperties(Object.prototype,{asyncify:{value:function(e,t,n){return asyncify(e)(this,t,n)},writable:!0,configurable:!0},isThenable:{value:function(){return Thenable.isThenable(this)},writable:!0,configurable:!0}}),Object[defaultCodeGenOpts.$makeThenable]=Thenable.resolve}function initialize(e){function t(e,t){e=e.split("."),t=t.split(".");for(var n=0;n<3;n++){if(e[n]t[n])return 1}return 0}function n(r,i){if(!i.match(/nodent\/nodent\.js$/)){if(i.match(/node_modules\/nodent\/.*\.js$/))return stdJSLoader(r,i);for(var a=0;a0",engine:"(async ()=>0)",noRuntime:"Promise"};NodentCompiler.prototype.Thenable=Thenable,NodentCompiler.prototype.EagerThenable=$asyncbind.EagerThenableFactory,NodentCompiler.prototype.asyncify=asyncify,NodentCompiler.prototype.require=requireCover,NodentCompiler.prototype.generateRequestHandler=generateRequestHandler,NodentCompiler.prototype.$asyncspawn=$asyncspawn,NodentCompiler.prototype.$asyncbind=$asyncbind,NodentCompiler.prototype.parseCompilerOptions=parseCompilerOptions,$asyncbind.call($asyncbind);var compiler;initialize.setDefaultCompileOptions=function(e,t){return e&&Object.keys(e).forEach(function(t){if(!(t in defaultCodeGenOpts))throw new Error("NoDent: unknown compiler option: "+t);defaultCodeGenOpts[t]=e[t]}),t&&Object.keys(t).forEach(function(e){if(!(e in t))throw new Error("NoDent: unknown configuration option: "+e);config[e]=t[e]}),initialize},initialize.setCompileOptions=function(e,t){return optionSet[e]=optionSet[e]||copyObj([defaultCodeGenOpts]),t&&Object.keys(t).forEach(function(n){if(!(n in defaultCodeGenOpts))throw new Error("NoDent: unknown compiler option: "+n);optionSet[e][n]=t[n]}),initialize},initialize.asyncify=asyncify,initialize.Thenable=$asyncbind.Thenable,initialize.EagerThenable=$asyncbind.EagerThenableFactory,module.exports=initialize,require.main===module&&process.argv.length>=3&&runFromCLI()}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},"/node_modules/nodent")},{"./htmlScriptParser":29,_process:32,fs:7,"nodent-compiler":10,"nodent-runtime":26,path:30,resolve:33}]},{},[]); \ No newline at end of file +require=function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o=t}function i(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(l,"$1 $3")),e.test(r)}function s(e,t,n,r){var i=new e.constructor(e.options,e.input,t);if(n)for(var s in n)i[s]=n[s];var o=e,a=i;return["inFunction","inAsyncFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in o&&(a[e]=o[e])}),r&&(i.options.preserveParens=!0),i.nextToken(),i}var o={},a=/^async[\t ]+(return|throw)/,u=/^async[\t ]+function/,c=/^\s*[():;]/,l=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g,p=/\s*(get|set)\s*\(/;t.exports=function(e,t){var n=function(){};e.extend("initialContext",function(r){return function(){return this.options.ecmaVersion<7&&(n=function(t){e.raise(t.start,"async/await keywords only available when ecmaVersion>=7")}),this.reservedWords=new RegExp(this.reservedWords.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrict=new RegExp(this.reservedWordsStrict.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.reservedWordsStrictBind=new RegExp(this.reservedWordsStrictBind.toString().replace(/await|async/g,"").replace("|/","/").replace("/|","/").replace("||","|")),this.inAsyncFunction=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),r.apply(this,arguments)}}),e.extend("shouldParseExportStatement",function(e){return function(){return!("name"!==this.type.label||"async"!==this.value||!i(u,this))||e.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,o=this.startLoc;if("name"===this.type.label)if(i(u,this,!0)){var c=this.inAsyncFunction;try{return this.inAsyncFunction=!0,this.next(),(l=this.parseStatement(n,r)).async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}finally{this.inAsyncFunction=c}}else if("object"==typeof t&&t.asyncExits&&i(a,this)){this.next();var l=this.parseStatement(n,r);return l.async=!0,l.start=s,l.loc&&(l.loc.start=o),l.range&&(l.range[0]=s),l}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(t){var n=e.apply(this,arguments);return this.inAsyncFunction&&"await"===n.name&&0===arguments.length&&this.raise(n.start,"'await' is reserved within async functions"),n}}),e.extend("parseExprAtom",function(e){return function(i){var a,u=this.start,l=this.startLoc,p=e.apply(this,arguments);if("Identifier"===p.type)if("async"!==p.name||r(this,p.end)){if("await"===p.name){var h=this.startNodeAt(p.start,p.loc&&p.loc.start);if(this.inAsyncFunction)return a=this.parseExprSubscripts(),h.operator="await",h.argument=a,h=this.finishNodeAt(h,"AwaitExpression",a.end,a.loc&&a.loc.end),n(h),h;if(this.input.slice(p.end).match(c))return t.awaitAnywhere||"module"!==this.options.sourceType?p:this.raise(p.start,"'await' is reserved within modules");if("object"==typeof t&&t.awaitAnywhere&&(u=this.start,(a=s(this,u-4).parseExprSubscripts()).end<=u))return a=s(this,u).parseExprSubscripts(),h.operator="await",h.argument=a,h=this.finishNodeAt(h,"AwaitExpression",a.end,a.loc&&a.loc.end),this.pos=a.end,this.end=a.end,this.endLoc=a.endLoc,this.next(),n(h),h;if(!t.awaitAnywhere&&"module"===this.options.sourceType)return this.raise(p.start,"'await' is reserved within modules")}}else{var f=this.inAsyncFunction;try{this.inAsyncFunction=!0;var d=this,y=!1,m={parseFunctionBody:function(e,t){try{var n=y;return y=!0,d.parseFunctionBody.apply(this,arguments)}finally{y=n}},raise:function(){try{return d.raise.apply(this,arguments)}catch(e){throw y?e:o}}};if("SequenceExpression"===(a=s(this,this.start,m,!0).parseExpression()).type&&(a=a.expressions[0]),"CallExpression"===a.type&&(a=a.callee),"FunctionExpression"===a.type||"FunctionDeclaration"===a.type||"ArrowFunctionExpression"===a.type)return"SequenceExpression"===(a=s(this,this.start,m).parseExpression()).type&&(a=a.expressions[0]),"CallExpression"===a.type&&(a=a.callee),a.async=!0,a.start=u,a.loc&&(a.loc.start=l),a.range&&(a.range[0]=u),this.pos=a.end,this.end=a.end,this.endLoc=a.endLoc,this.next(),n(a),a}catch(e){if(e!==o)throw e}finally{this.inAsyncFunction=f}}return p}}),e.extend("finishNodeAt",function(e){return function(t,n,r,i){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}}),e.extend("finishNode",function(e){return function(t,n){return t.__asyncValue&&(delete t.__asyncValue,t.value.async=!0),e.apply(this,arguments)}}),e.extend("parsePropertyName",function(e){return function(t){t.key&&t.key.name;var i=e.apply(this,arguments);return"Identifier"!==i.type||"async"!==i.name||r(this,i.end)||this.input.slice(i.end).match(c)||(p.test(this.input.slice(i.end))?(i=e.apply(this,arguments),t.__asyncValue=!0):(n(t),"set"===t.kind&&this.raise(i.start,"'set (value)' cannot be be async"),"Identifier"===(i=e.apply(this,arguments)).type&&"set"===i.name&&this.raise(i.start,"'set (value)' cannot be be async"),t.__asyncValue=!0)),i}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i;n.__asyncValue&&("constructor"===n.kind&&this.raise(n.start,"class constructor() cannot be be async"),i=this.inAsyncFunction,this.inAsyncFunction=!0);var s=e.apply(this,arguments);return this.inAsyncFunction=i,s}}),e.extend("parseMethod",function(e){return function(t){var n;this.__currentProperty&&this.__currentProperty.__asyncValue&&(n=this.inAsyncFunction,this.inAsyncFunction=!0);var r=e.apply(this,arguments);return this.inAsyncFunction=n,r}}),e.extend("parsePropertyValue",function(e){return function(t,n,r,i,s,o){var a=this.__currentProperty;this.__currentProperty=t;var u;t.__asyncValue&&(u=this.inAsyncFunction,this.inAsyncFunction=!0);var c=e.apply(this,arguments);return this.inAsyncFunction=u,this.__currentProperty=a,c}})}},{}],3:[function(e,t,n){function r(e,t,n){var r=new e.constructor(e.options,e.input,t);if(n)for(var i in n)r[i]=n[i];var s=e,o=r;return["inFunction","inAsync","inGenerator","inModule"].forEach(function(e){e in s&&(o[e]=s[e])}),r.nextToken(),r}var i=/^async[\t ]+(return|throw)/,s=/^\s*[):;]/,o=/([^\n])\/\*(\*(?!\/)|[^\n*])*\*\/([^\n])/g;t.exports=function(e,t){t&&"object"==typeof t||(t={}),e.extend("parse",function(n){return function(){return this.inAsync=t.inAsyncFunction,t.awaitAnywhere&&t.inAsyncFunction&&e.raise(node.start,"The options awaitAnywhere and inAsyncFunction are mutually exclusive"),n.apply(this,arguments)}}),e.extend("parseStatement",function(e){return function(n,r){var s=this.start,a=this.startLoc;if("name"===this.type.label&&t.asyncExits&&function(e,t,n){var r=t.input.slice(t.start);return n&&(r=r.replace(o,"$1 $3")),e.test(r)}(i,this)){this.next();var u=this.parseStatement(n,r);return u.async=!0,u.start=s,u.loc&&(u.loc.start=a),u.range&&(u.range[0]=s),u}return e.apply(this,arguments)}}),e.extend("parseIdent",function(e){return function(n){return"module"===this.options.sourceType&&this.options.ecmaVersion>=8&&t.awaitAnywhere?e.call(this,!0):e.apply(this,arguments)}}),e.extend("parseExprAtom",function(e){var n={};return function(i){var s,o=this.start,a=(this.startLoc,e.apply(this,arguments));if("Identifier"===a.type&&"await"===a.name&&!this.inAsync&&t.awaitAnywhere){var u=this.startNodeAt(a.start,a.loc&&a.loc.start);o=this.start;var c={raise:function(){try{return pp.raise.apply(this,arguments)}catch(e){throw n}}};try{if((s=r(this,o-4,c).parseExprSubscripts()).end<=o)return s=r(this,o,c).parseExprSubscripts(),u.argument=s,u=this.finishNodeAt(u,"AwaitExpression",s.end,s.loc&&s.loc.end),this.pos=s.end,this.end=s.end,this.endLoc=s.endLoc,this.next(),u}catch(e){if(e===n)return a;throw e}}return a}});var n={undefined:!0,get:!0,set:!0,static:!0,async:!0,constructor:!0};e.extend("parsePropertyName",function(e){return function(t){var r=t.key&&t.key.name,i=e.apply(this,arguments);return"get"===this.value&&(t.__maybeStaticAsyncGetter=!0),n[this.value]?i:("Identifier"!==i.type||"async"!==i.name&&"async"!==r||function(e,t){return e.lineStart>=t}(this,i.end)||this.input.slice(i.end).match(s)?delete t.__maybeStaticAsyncGetter:"set"===t.kind||"set"===i.name?this.raise(i.start,"'set (value)' cannot be be async"):(this.__isAsyncProp=!0,"Identifier"===(i=e.apply(this,arguments)).type&&"set"===i.name&&this.raise(i.start,"'set (value)' cannot be be async")),i)}}),e.extend("parseClassMethod",function(e){return function(t,n,r){var i=e.apply(this,arguments);return n.__maybeStaticAsyncGetter&&(delete n.__maybeStaticAsyncGetter,"get"!==n.key.name&&(n.kind="get")),i}}),e.extend("parseFunctionBody",function(e){return function(t,n){var r=this.inAsync;this.__isAsyncProp&&(t.async=!0,this.inAsync=!0,delete this.__isAsyncProp);var i=e.apply(this,arguments);return this.inAsync=r,i}})}},{}],4:[function(e,t,n){!function(e,r){"object"==typeof n&&void 0!==t?r(n):"function"==typeof define&&define.amd?define(["exports"],r):r(e.acorn=e.acorn||{})}(this,function(e){"use strict";function t(e,t){for(var n=65536,r=0;re)return!1;if((n+=t[r+1])>=e)return!0}}function n(e,n){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&x.test(String.fromCharCode(e)):!1!==n&&t(e,E)))}function r(e,n){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&w.test(String.fromCharCode(e)):!1!==n&&(t(e,E)||t(e,S)))))}function i(e,t){return new k(e,{beforeExpr:!0,binop:t})}function s(e,t){return void 0===t&&(t={}),t.keyword=e,_[e]=new k(e,t)}function o(e){return 10===e||13===e||8232===e||8233===e}function a(e,t){return $.call(e,t)}function u(e,t){for(var n=1,r=0;;){T.lastIndex=r;var i=T.exec(e);if(!(i&&i.index=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),R(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return R(t.onComment)&&(t.onComment=function(e,t){return function(n,r,i,s,o,a){var u={type:n?"Block":"Line",value:r,start:i,end:s};e.locations&&(u.loc=new j(this,o,a)),e.ranges&&(u.range=[i,s]),t.push(u)}}(t,t.onComment)),t}function l(e){return new RegExp("^(?:"+e.replace(/ /g,"|")+")$")}function p(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=-1}function h(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}function f(e,t,n,r){try{return new RegExp(e,t)}catch(e){if(void 0!==n)throw e instanceof SyntaxError&&r.raise(n,"Error parsing regular expression: "+e.message),e}}function d(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var y={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},m="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",g={5:m,6:m+" const class extends export import super"},v="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",b="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",x=new RegExp("["+v+"]"),w=new RegExp("["+v+b+"]");v=b=null;var E=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],S=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],k=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null},A={beforeExpr:!0},C={startsExpr:!0},_={},L={num:new k("num",C),regexp:new k("regexp",C),string:new k("string",C),name:new k("name",C),eof:new k("eof"),bracketL:new k("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new k("]"),braceL:new k("{",{beforeExpr:!0,startsExpr:!0}),braceR:new k("}"),parenL:new k("(",{beforeExpr:!0,startsExpr:!0}),parenR:new k(")"),comma:new k(",",A),semi:new k(";",A),colon:new k(":",A),dot:new k("."),question:new k("?",A),arrow:new k("=>",A),template:new k("template"),invalidTemplate:new k("invalidTemplate"),ellipsis:new k("...",A),backQuote:new k("`",C),dollarBraceL:new k("${",{beforeExpr:!0,startsExpr:!0}),eq:new k("=",{beforeExpr:!0,isAssign:!0}),assign:new k("_=",{beforeExpr:!0,isAssign:!0}),incDec:new k("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new k("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=/===/!==",6),relational:i("/<=/>=",7),bitShift:i("<>/>>>",8),plusMin:new k("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),starstar:new k("**",{beforeExpr:!0}),_break:s("break"),_case:s("case",A),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",A),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",A),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",C),_if:s("if"),_return:s("return",A),_switch:s("switch"),_throw:s("throw",A),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",C),_super:s("super",C),_class:s("class",C),_extends:s("extends",A),_export:s("export"),_import:s("import"),_null:s("null",C),_true:s("true",C),_false:s("false",C),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},O=/\r\n?|\n|\u2028|\u2029/,T=new RegExp(O.source,"g"),N=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,P=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,F=Object.prototype,$=F.hasOwnProperty,B=F.toString,R=Array.isArray||function(e){return"[object Array]"===B.call(e)},I=function(e,t){this.line=e,this.column=t};I.prototype.offset=function(e){return new I(this.line,this.column+e)};var j=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)},D={ecmaVersion:7,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1,plugins:{}},M={},q=function(e,t,n){this.options=e=c(e),this.sourceFile=e.sourceFile,this.keywords=l(g[e.ecmaVersion>=6?6:5]);var r="";if(!e.allowReserved){for(var i=e.ecmaVersion;!(r=y[i]);i--);"module"==e.sourceType&&(r+=" await")}this.reservedWords=l(r);var s=(r?r+" ":"")+y.strict;this.reservedWordsStrict=l(s),this.reservedWordsStrictBind=l(s+" "+y.strictBind),this.input=String(t),this.containsEsc=!1,this.loadPlugins(e.plugins),n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(O).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=L.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.inFunction=this.inGenerator=this.inAsync=!1,this.yieldPos=this.awaitPos=0,this.labels=[],0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterFunctionScope()};q.prototype.isKeyword=function(e){return this.keywords.test(e)},q.prototype.isReservedWord=function(e){return this.reservedWords.test(e)},q.prototype.extend=function(e,t){this[e]=t(this[e])},q.prototype.loadPlugins=function(e){for(var t in e){var n=M[t];if(!n)throw new Error("Plugin '"+t+"' not found");n(this,e[t])}},q.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};var V=q.prototype,U=/^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/;V.strictDirective=function(e){for(;;){P.lastIndex=e,e+=P.exec(this.input)[0].length;var t=U.exec(this.input.slice(e));if(!t)return!1;if("use strict"==(t[1]||t[2]))return!0;e+=t[0].length}},V.eat=function(e){return this.type===e&&(this.next(),!0)},V.isContextual=function(e){return this.type===L.name&&this.value===e},V.eatContextual=function(e){return this.value===e&&this.eat(L.name)},V.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},V.canInsertSemicolon=function(){return this.type===L.eof||this.type===L.braceR||O.test(this.input.slice(this.lastTokEnd,this.start))},V.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},V.semicolon=function(){this.eat(L.semi)||this.insertSemicolon()||this.unexpected()},V.afterTrailingComma=function(e,t){if(this.type==e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},V.expect=function(e){this.eat(e)||this.unexpected()},V.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")},V.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,"Parenthesized pattern")}},V.checkExpressionErrors=function(e,t){var n=e?e.shorthandAssign:-1;if(!t)return n>=0;n>-1&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns")},V.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos=6&&(e.sourceType=this.options.sourceType),this.finishNode(e,"Program")};var W={kind:"loop"},G={kind:"switch"};z.isLet=function(){if(this.type!==L.name||this.options.ecmaVersion<6||"let"!=this.value)return!1;P.lastIndex=this.pos;var e=P.exec(this.input),t=this.pos+e[0].length,i=this.input.charCodeAt(t);if(91===i||123==i)return!0;if(n(i,!0)){for(var s=t+1;r(this.input.charCodeAt(s),!0);)++s;var o=this.input.slice(t,s);if(!this.isKeyword(o))return!0}return!1},z.isAsyncFunction=function(){if(this.type!==L.name||this.options.ecmaVersion<8||"async"!=this.value)return!1;P.lastIndex=this.pos;var e=P.exec(this.input),t=this.pos+e[0].length;return!(O.test(this.input.slice(this.pos,t))||"function"!==this.input.slice(t,t+8)||t+8!=this.input.length&&r(this.input.charAt(t+8)))},z.parseStatement=function(e,t,n){var r,i=this.type,s=this.startNode();switch(this.isLet()&&(i=L._var,r="let"),i){case L._break:case L._continue:return this.parseBreakContinueStatement(s,i.keyword);case L._debugger:return this.parseDebuggerStatement(s);case L._do:return this.parseDoStatement(s);case L._for:return this.parseForStatement(s);case L._function:return!e&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1);case L._class:return e||this.unexpected(),this.parseClass(s,!0);case L._if:return this.parseIfStatement(s);case L._return:return this.parseReturnStatement(s);case L._switch:return this.parseSwitchStatement(s);case L._throw:return this.parseThrowStatement(s);case L._try:return this.parseTryStatement(s);case L._const:case L._var:return r=r||this.value,e||"var"==r||this.unexpected(),this.parseVarStatement(s,r);case L._while:return this.parseWhileStatement(s);case L._with:return this.parseWithStatement(s);case L.braceL:return this.parseBlock();case L.semi:return this.parseEmptyStatement(s);case L._export:case L._import:return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===L._import?this.parseImport(s):this.parseExport(s,n);default:if(this.isAsyncFunction()&&e)return this.next(),this.parseFunctionStatement(s,!0);var o=this.value,a=this.parseExpression();return i===L.name&&"Identifier"===a.type&&this.eat(L.colon)?this.parseLabeledStatement(s,o,a):this.parseExpressionStatement(s,a)}},z.parseBreakContinueStatement=function(e,t){var n="break"==t;this.next(),this.eat(L.semi)||this.insertSemicolon()?e.label=null:this.type!==L.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r=6?this.eat(L.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},z.parseForStatement=function(e){if(this.next(),this.labels.push(W),this.enterLexicalScope(),this.expect(L.parenL),this.type===L.semi)return this.parseFor(e,null);var t=this.isLet();if(this.type===L._var||this.type===L._const||t){var n=this.startNode(),r=t?"let":this.value;return this.next(),this.parseVar(n,!0,r),this.finishNode(n,"VariableDeclaration"),!(this.type===L._in||this.options.ecmaVersion>=6&&this.isContextual("of"))||1!==n.declarations.length||"var"!==r&&n.declarations[0].init?this.parseFor(e,n):this.parseForIn(e,n)}var i=new p,s=this.parseExpression(!0,i);return this.type===L._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.toAssignable(s),this.checkLVal(s),this.checkPatternErrors(i,!0),this.parseForIn(e,s)):(this.checkExpressionErrors(i,!0),this.parseFor(e,s))},z.parseFunctionStatement=function(e,t){return this.next(),this.parseFunction(e,!0,!1,t)},z.isFunction=function(){return this.type===L._function||this.isAsyncFunction()},z.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!this.strict&&this.isFunction()),e.alternate=this.eat(L._else)?this.parseStatement(!this.strict&&this.isFunction()):null,this.finishNode(e,"IfStatement")},z.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(L.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},z.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(L.braceL),this.labels.push(G),this.enterLexicalScope();for(var t,n=!1;this.type!=L.braceR;)if(this.type===L._case||this.type===L._default){var r=this.type===L._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,t.test=null),this.expect(L.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(!0));return this.exitLexicalScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},z.parseThrowStatement=function(e){return this.next(),O.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var J=[];z.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===L._catch){var t=this.startNode();this.next(),this.expect(L.parenL),t.param=this.parseBindingAtom(),this.enterLexicalScope(),this.checkLVal(t.param,"let"),this.expect(L.parenR),t.body=this.parseBlock(!1),this.exitLexicalScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(L._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},z.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},z.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(W),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"WhileStatement")},z.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},z.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},z.parseLabeledStatement=function(e,t,n){for(var r=0,i=this.labels;r=0;o--){var a=this.labels[o];if(a.statementStart!=e.start)break;a.statementStart=this.start,a.kind=s}return this.labels.push({name:t,kind:s,statementStart:this.start}),e.body=this.parseStatement(!0),("ClassDeclaration"==e.body.type||"VariableDeclaration"==e.body.type&&"var"!=e.body.kind||"FunctionDeclaration"==e.body.type&&(this.strict||e.body.generator))&&this.raiseRecoverable(e.body.start,"Invalid labeled declaration"),this.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},z.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},z.parseBlock=function(e){void 0===e&&(e=!0);var t=this.startNode();for(t.body=[],this.expect(L.braceL),e&&this.enterLexicalScope();!this.eat(L.braceR);){var n=this.parseStatement(!0);t.body.push(n)}return e&&this.exitLexicalScope(),this.finishNode(t,"BlockStatement")},z.parseFor=function(e,t){return e.init=t,this.expect(L.semi),e.test=this.type===L.semi?null:this.parseExpression(),this.expect(L.semi),e.update=this.type===L.parenR?null:this.parseExpression(),this.expect(L.parenR),this.exitLexicalScope(),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,"ForStatement")},z.parseForIn=function(e,t){var n=this.type===L._in?"ForInStatement":"ForOfStatement";return this.next(),e.left=t,e.right=this.parseExpression(),this.expect(L.parenR),this.exitLexicalScope(),e.body=this.parseStatement(!1),this.labels.pop(),this.finishNode(e,n)},z.parseVar=function(e,t,n){for(e.declarations=[],e.kind=n;;){var r=this.startNode();if(this.parseVarId(r,n),this.eat(L.eq)?r.init=this.parseMaybeAssign(t):"const"!==n||this.type===L._in||this.options.ecmaVersion>=6&&this.isContextual("of")?"Identifier"==r.id.type||t&&(this.type===L._in||this.isContextual("of"))?r.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(L.comma))break}return e},z.parseVarId=function(e,t){e.id=this.parseBindingAtom(t),this.checkLVal(e.id,t,!1)},z.parseFunction=function(e,t,n,r){this.initFunction(e),this.options.ecmaVersion>=6&&!r&&(e.generator=this.eat(L.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&&(e.id="nullableID"===t&&this.type!=L.name?null:this.parseIdent(),e.id&&this.checkLVal(e.id,"var"));var i=this.inGenerator,s=this.inAsync,o=this.yieldPos,a=this.awaitPos,u=this.inFunction;return this.inGenerator=e.generator,this.inAsync=e.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),t||(e.id=this.type==L.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n),this.inGenerator=i,this.inAsync=s,this.yieldPos=o,this.awaitPos=a,this.inFunction=u,this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},z.parseFunctionParams=function(e){this.expect(L.parenL),e.params=this.parseBindingList(L.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},z.parseClass=function(e,t){this.next(),this.parseClassId(e,t),this.parseClassSuper(e);var n=this.startNode(),r=!1;for(n.body=[],this.expect(L.braceL);!this.eat(L.braceR);)if(!this.eat(L.semi)){var i=this.startNode(),s=this.eat(L.star),o=!1,a=this.type===L.name&&"static"===this.value;this.parsePropertyName(i),i.static=a&&this.type!==L.parenL,i.static&&(s&&this.unexpected(),s=this.eat(L.star),this.parsePropertyName(i)),this.options.ecmaVersion>=8&&!s&&!i.computed&&"Identifier"===i.key.type&&"async"===i.key.name&&this.type!==L.parenL&&!this.canInsertSemicolon()&&(o=!0,this.parsePropertyName(i)),i.kind="method";var u=!1;if(!i.computed){var c=i.key;s||o||"Identifier"!==c.type||this.type===L.parenL||"get"!==c.name&&"set"!==c.name||(u=!0,i.kind=c.name,c=this.parsePropertyName(i)),!i.static&&("Identifier"===c.type&&"constructor"===c.name||"Literal"===c.type&&"constructor"===c.value)&&(r&&this.raise(c.start,"Duplicate constructor in the same class"),u&&this.raise(c.start,"Constructor can't have get/set modifier"),s&&this.raise(c.start,"Constructor can't be a generator"),o&&this.raise(c.start,"Constructor can't be an async method"),i.kind="constructor",r=!0)}if(this.parseClassMethod(n,i,s,o),u){var l="get"===i.kind?0:1;if(i.value.params.length!==l){var p=i.value.start;"get"===i.kind?this.raiseRecoverable(p,"getter should have no params"):this.raiseRecoverable(p,"setter should have exactly one param")}else"set"===i.kind&&"RestElement"===i.value.params[0].type&&this.raiseRecoverable(i.value.params[0].start,"Setter cannot use rest params")}}return e.body=this.finishNode(n,"ClassBody"),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},z.parseClassMethod=function(e,t,n,r){t.value=this.parseMethod(n,r),e.body.push(this.finishNode(t,"MethodDefinition"))},z.parseClassId=function(e,t){e.id=this.type===L.name?this.parseIdent():!0===t?this.unexpected():null},z.parseClassSuper=function(e){e.superClass=this.eat(L._extends)?this.parseExprSubscripts():null},z.parseExport=function(e,t){if(this.next(),this.eat(L.star))return this.expectContextual("from"),e.source=this.type===L.string?this.parseExprAtom():this.unexpected(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration");if(this.eat(L._default)){this.checkExport(t,"default",this.lastTokStart);var n;if(this.type===L._function||(n=this.isAsyncFunction())){var r=this.startNode();this.next(),n&&this.next(),e.declaration=this.parseFunction(r,"nullableID",!1,n)}else if(this.type===L._class){var i=this.startNode();e.declaration=this.parseClass(i,"nullableID")}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(!0),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id.name,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))e.source=this.type===L.string?this.parseExprAtom():this.unexpected();else{for(var s=0,o=e.specifiers;s=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Can not use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var n=0,r=e.properties;n=6&&(e.computed||e.method||e.shorthand))){var n,r=e.key;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var i=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===n&&"init"===i&&(t.proto&&this.raiseRecoverable(r.start,"Redefinition of __proto__ property"),t.proto=!0);else{var s=t[n="$"+n];if(s){("init"===i?this.strict&&s.init||s.get||s.set:s.init||s[i])&&this.raiseRecoverable(r.start,"Redefinition of property")}else s=t[n]={init:!1,get:!1,set:!1};s[i]=!0}}},Y.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===L.comma){var s=this.startNodeAt(n,r);for(s.expressions=[i];this.eat(L.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(s,"SequenceExpression")}return i},Y.parseMaybeAssign=function(e,t,n){if(this.inGenerator&&this.isContextual("yield"))return this.parseYield();var r=!1,i=-1,s=-1;t?(i=t.parenthesizedAssign,s=t.trailingComma,t.parenthesizedAssign=t.trailingComma=-1):(t=new p,r=!0);var o=this.start,a=this.startLoc;this.type!=L.parenL&&this.type!=L.name||(this.potentialArrowAt=this.start);var u=this.parseMaybeConditional(e,t);if(n&&(u=n.call(this,u,o,a)),this.type.isAssign){this.checkPatternErrors(t,!0),r||p.call(t);var c=this.startNodeAt(o,a);return c.operator=this.value,c.left=this.type===L.eq?this.toAssignable(u):u,t.shorthandAssign=-1,this.checkLVal(u),this.next(),c.right=this.parseMaybeAssign(e),this.finishNode(c,"AssignmentExpression")}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),s>-1&&(t.trailingComma=s),u},Y.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(L.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(L.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return i},Y.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1);return this.checkExpressionErrors(t)?i:i.start==n&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,n,r,-1,e)},Y.parseExprOp=function(e,t,n,r,i){var s=this.type.binop;if(null!=s&&(!i||this.type!==L._in)&&s>r){var o=this.type===L.logicalOR||this.type===L.logicalAND,a=this.value;this.next();var u=this.start,c=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1),u,c,s,i),p=this.buildBinary(t,n,e,l,a,o);return this.parseExprOp(p,t,n,r,i)}return e},Y.buildBinary=function(e,t,n,r,i,s){var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")},Y.parseMaybeUnary=function(e,t){var n,r=this.start,i=this.startLoc;if(this.inAsync&&this.isContextual("await"))n=this.parseAwait(),t=!0;else if(this.type.prefix){var s=this.startNode(),o=this.type===L.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),o?this.checkLVal(s.argument):this.strict&&"delete"===s.operator&&"Identifier"===s.argument.type?this.raiseRecoverable(s.start,"Deleting local variable in strict mode"):t=!0,n=this.finishNode(s,o?"UpdateExpression":"UnaryExpression")}else{if(n=this.parseExprSubscripts(e),this.checkExpressionErrors(e))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var a=this.startNodeAt(r,i);a.operator=this.value,a.prefix=!1,a.argument=n,this.checkLVal(n),this.next(),n=this.finishNode(a,"UpdateExpression")}}return!t&&this.eat(L.starstar)?this.buildBinary(r,i,n,this.parseMaybeUnary(null,!1),"**",!1):n},Y.parseExprSubscripts=function(e){var t=this.start,n=this.startLoc,r=this.parseExprAtom(e),i="ArrowFunctionExpression"===r.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd);if(this.checkExpressionErrors(e)||i)return r;var s=this.parseSubscripts(r,t,n);return e&&"MemberExpression"===s.type&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1)),s},Y.parseSubscripts=function(e,t,n,r){for(var i=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd==e.end&&!this.canInsertSemicolon(),s=void 0;;)if((s=this.eat(L.bracketL))||this.eat(L.dot)){var o=this.startNodeAt(t,n);o.object=e,o.property=s?this.parseExpression():this.parseIdent(!0),o.computed=!!s,s&&this.expect(L.bracketR),e=this.finishNode(o,"MemberExpression")}else if(!r&&this.eat(L.parenL)){var a=new p,u=this.yieldPos,c=this.awaitPos;this.yieldPos=0,this.awaitPos=0;var l=this.parseExprList(L.parenR,this.options.ecmaVersion>=8,!1,a);if(i&&!this.canInsertSemicolon()&&this.eat(L.arrow))return this.checkPatternErrors(a,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=u,this.awaitPos=c,this.parseArrowExpression(this.startNodeAt(t,n),l,!0);this.checkExpressionErrors(a,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=c||this.awaitPos;var h=this.startNodeAt(t,n);h.callee=e,h.arguments=l,e=this.finishNode(h,"CallExpression")}else{if(this.type!==L.backQuote)return e;var f=this.startNodeAt(t,n);f.tag=e,f.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(f,"TaggedTemplateExpression")}},Y.parseExprAtom=function(e){var t,n=this.potentialArrowAt==this.start;switch(this.type){case L._super:return this.inFunction||this.raise(this.start,"'super' outside of function or class"),t=this.startNode(),this.next(),this.type!==L.dot&&this.type!==L.bracketL&&this.type!==L.parenL&&this.unexpected(),this.finishNode(t,"Super");case L._this:return t=this.startNode(),this.next(),this.finishNode(t,"ThisExpression");case L.name:var r=this.start,i=this.startLoc,s=this.parseIdent(this.type!==L.name);if(this.options.ecmaVersion>=8&&"async"===s.name&&!this.canInsertSemicolon()&&this.eat(L._function))return this.parseFunction(this.startNodeAt(r,i),!1,!1,!0);if(n&&!this.canInsertSemicolon()){if(this.eat(L.arrow))return this.parseArrowExpression(this.startNodeAt(r,i),[s],!1);if(this.options.ecmaVersion>=8&&"async"===s.name&&this.type===L.name)return s=this.parseIdent(),!this.canInsertSemicolon()&&this.eat(L.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,i),[s],!0)}return s;case L.regexp:var o=this.value;return t=this.parseLiteral(o.value),t.regex={pattern:o.pattern,flags:o.flags},t;case L.num:case L.string:return this.parseLiteral(this.value);case L._null:case L._true:case L._false:return t=this.startNode(),t.value=this.type===L._null?null:this.type===L._true,t.raw=this.type.keyword,this.next(),this.finishNode(t,"Literal");case L.parenL:var a=this.start,u=this.parseParenAndDistinguishExpression(n);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(e.parenthesizedAssign=a),e.parenthesizedBind<0&&(e.parenthesizedBind=a)),u;case L.bracketL:return t=this.startNode(),this.next(),t.elements=this.parseExprList(L.bracketR,!0,!0,e),this.finishNode(t,"ArrayExpression");case L.braceL:return this.parseObj(!1,e);case L._function:return t=this.startNode(),this.next(),this.parseFunction(t,!1);case L._class:return this.parseClass(this.startNode(),!1);case L._new:return this.parseNew();case L.backQuote:return this.parseTemplate();default:this.unexpected()}},Y.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),this.next(),this.finishNode(t,"Literal")},Y.parseParenExpression=function(){this.expect(L.parenL);var e=this.parseExpression();return this.expect(L.parenR),e},Y.parseParenAndDistinguishExpression=function(e){var t,n=this.start,r=this.startLoc,i=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var s,o,a=this.start,u=this.startLoc,c=[],l=!0,h=!1,f=new p,d=this.yieldPos,y=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==L.parenR;){if(l?l=!1:this.expect(L.comma),i&&this.afterTrailingComma(L.parenR,!0)){h=!0;break}if(this.type===L.ellipsis){s=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===L.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}this.type!==L.parenL||o||(o=this.start),c.push(this.parseMaybeAssign(!1,f,this.parseParenItem))}var m=this.start,g=this.startLoc;if(this.expect(L.parenR),e&&!this.canInsertSemicolon()&&this.eat(L.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),o&&this.unexpected(o),this.yieldPos=d,this.awaitPos=y,this.parseParenArrowList(n,r,c);c.length&&!h||this.unexpected(this.lastTokStart),s&&this.unexpected(s),this.checkExpressionErrors(f,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=y||this.awaitPos,c.length>1?((t=this.startNodeAt(a,u)).expressions=c,this.finishNodeAt(t,"SequenceExpression",m,g)):t=c[0]}else t=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(n,r);return v.expression=t,this.finishNode(v,"ParenthesizedExpression")}return t},Y.parseParenItem=function(e){return e},Y.parseParenArrowList=function(e,t,n){return this.parseArrowExpression(this.startNodeAt(e,t),n)};var Z=[];Y.parseNew=function(){var e=this.startNode(),t=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(L.dot))return e.meta=t,e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is new.target"),this.inFunction||this.raiseRecoverable(e.start,"new.target can only be used in functions"),this.finishNode(e,"MetaProperty");var n=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(),n,r,!0),this.eat(L.parenL)?e.arguments=this.parseExprList(L.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Z,this.finishNode(e,"NewExpression")},Y.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===L.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value,cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===L.backQuote,this.finishNode(n,"TemplateElement")},Y.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.expect(L.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(L.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,"TemplateLiteral")},Y.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===L.name||this.type===L.num||this.type===L.string||this.type===L.bracketL||this.type.keyword)&&!O.test(this.input.slice(this.lastTokEnd,this.start))},Y.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(L.braceR);){if(r)r=!1;else if(this.expect(L.comma),this.afterTrailingComma(L.braceR))break;var s=this.parseProperty(e,t);this.checkPropClash(s,i),n.properties.push(s)}return this.finishNode(n,e?"ObjectPattern":"ObjectExpression")},Y.parseProperty=function(e,t){var n,r,i,s,o=this.startNode();return this.options.ecmaVersion>=6&&(o.method=!1,o.shorthand=!1,(e||t)&&(i=this.start,s=this.startLoc),e||(n=this.eat(L.star))),this.parsePropertyName(o),!e&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(o)?(r=!0,this.parsePropertyName(o,t)):r=!1,this.parsePropertyValue(o,e,n,r,i,s,t),this.finishNode(o,"Property")},Y.parsePropertyValue=function(e,t,n,r,i,s,o){if((n||r)&&this.type===L.colon&&this.unexpected(),this.eat(L.colon))e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init";else if(this.options.ecmaVersion>=6&&this.type===L.parenL)t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,r);else if(t||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type==L.comma||this.type==L.braceR)this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?(this.checkUnreserved(e.key),e.kind="init",t?e.value=this.parseMaybeDefault(i,s,e.key):this.type===L.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,s,e.key)):e.value=e.key,e.shorthand=!0):this.unexpected();else{(n||r)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var a="get"===e.kind?0:1;if(e.value.params.length!==a){var u=e.value.start;"get"===e.kind?this.raiseRecoverable(u,"getter should have no params"):this.raiseRecoverable(u,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")}},Y.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(L.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(L.bracketR),e.key;e.computed=!1}return e.key=this.type===L.num||this.type===L.string?this.parseExprAtom():this.parseIdent(!0)},Y.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=!1,e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},Y.parseMethod=function(e,t){var n=this.startNode(),r=this.inGenerator,i=this.inAsync,s=this.yieldPos,o=this.awaitPos,a=this.inFunction;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.inGenerator=n.generator,this.inAsync=n.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,this.enterFunctionScope(),this.expect(L.parenL),n.params=this.parseBindingList(L.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=o,this.inFunction=a,this.finishNode(n,"FunctionExpression")},Y.parseArrowExpression=function(e,t,n){var r=this.inGenerator,i=this.inAsync,s=this.yieldPos,o=this.awaitPos,a=this.inFunction;return this.enterFunctionScope(),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.inGenerator=!1,this.inAsync=e.async,this.yieldPos=0,this.awaitPos=0,this.inFunction=!0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0),this.inGenerator=r,this.inAsync=i,this.yieldPos=s,this.awaitPos=o,this.inFunction=a,this.finishNode(e,"ArrowFunctionExpression")},Y.parseFunctionBody=function(e,t){var n=t&&this.type!==L.braceL,r=this.strict,i=!1;if(n)e.body=this.parseMaybeAssign(),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);r&&!s||(i=this.strictDirective(this.end))&&s&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var o=this.labels;this.labels=[],i&&(this.strict=!0),this.checkParams(e,!r&&!i&&!t&&this.isSimpleParamList(e.params)),e.body=this.parseBlock(!1),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=o}this.exitFunctionScope(),this.strict&&e.id&&this.checkLVal(e.id,"none"),this.strict=r},Y.isSimpleParamList=function(e){for(var t=0,n=e;t0;)t[n]=arguments[n+1];for(var r=0,i=t;r=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},ie.updateContext=function(e){var t,n=this.type;n.keyword&&e==L.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},L.parenR.updateContext=L.braceR.updateContext=function(){if(1!=this.context.length){var e=this.context.pop();e===re.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},L.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?re.b_stat:re.b_expr),this.exprAllowed=!0},L.dollarBraceL.updateContext=function(){this.context.push(re.b_tmpl),this.exprAllowed=!0},L.parenL.updateContext=function(e){var t=e===L._if||e===L._for||e===L._with||e===L._while;this.context.push(t?re.p_stat:re.p_expr),this.exprAllowed=!0},L.incDec.updateContext=function(){},L._function.updateContext=L._class.updateContext=function(e){e.beforeExpr&&e!==L.semi&&e!==L._else&&(e!==L.colon&&e!==L.braceL||this.curContext()!==re.b_stat)?this.context.push(re.f_expr):this.context.push(re.f_stat),this.exprAllowed=!1},L.backQuote.updateContext=function(){this.curContext()===re.q_tmpl?this.context.pop():this.context.push(re.q_tmpl),this.exprAllowed=!1},L.star.updateContext=function(e){if(e==L._function){var t=this.context.length-1;this.context[t]===re.f_expr?this.context[t]=re.f_expr_gen:this.context[t]=re.f_gen}this.exprAllowed=!0},L.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&("of"==this.value&&!this.exprAllowed||"yield"==this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var se=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new j(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},oe=q.prototype,ae="object"==typeof Packages&&"[object JavaPackage]"==Object.prototype.toString.call(Packages);oe.next=function(){this.options.onToken&&this.options.onToken(new se(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},oe.getToken=function(){return this.next(),new se(this)},"undefined"!=typeof Symbol&&(oe[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===L.eof,value:t}}}}),oe.curContext=function(){return this.context[this.context.length-1]},oe.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(L.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},oe.readToken=function(e){return n(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},oe.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=57344)return e;return(e<<10)+this.input.charCodeAt(this.pos+1)-56613888},oe.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(-1===n&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations){T.lastIndex=t;for(var r;(r=T.exec(this.input))&&r.index8&&e<14||e>=5760&&N.test(String.fromCharCode(e))))break e;++this.pos}}},oe.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},oe.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(L.ellipsis)):(++this.pos,this.finishToken(L.dot))},oe.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(L.assign,2):this.finishOp(L.slash,1)},oe.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=42===e?L.star:L.modulo;return this.options.ecmaVersion>=7&&42==e&&42===t&&(++n,r=L.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(L.assign,n+1):this.finishOp(r,n)},oe.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.finishOp(124===e?L.logicalOR:L.logicalAND,2):61===t?this.finishOp(L.assign,2):this.finishOp(124===e?L.bitwiseOR:L.bitwiseAND,1)},oe.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(L.assign,2):this.finishOp(L.bitwiseXOR,1)},oe.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!=t||this.inModule||62!=this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!O.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(L.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(L.assign,2):this.finishOp(L.plusMin,1)},oe.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(L.assign,n+1):this.finishOp(L.bitShift,n)):33!=t||60!=e||this.inModule||45!=this.input.charCodeAt(this.pos+2)||45!=this.input.charCodeAt(this.pos+3)?(61===t&&(n=2),this.finishOp(L.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},oe.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(L.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(L.arrow)):this.finishOp(61===e?L.eq:L.prefix,1)},oe.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(L.parenL);case 41:return++this.pos,this.finishToken(L.parenR);case 59:return++this.pos,this.finishToken(L.semi);case 44:return++this.pos,this.finishToken(L.comma);case 91:return++this.pos,this.finishToken(L.bracketL);case 93:return++this.pos,this.finishToken(L.bracketR);case 123:return++this.pos,this.finishToken(L.braceL);case 125:return++this.pos,this.finishToken(L.braceR);case 58:return++this.pos,this.finishToken(L.colon);case 63:return++this.pos,this.finishToken(L.question);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(L.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(L.prefix,1)}this.raise(this.pos,"Unexpected character '"+d(e)+"'")},oe.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)};var ue=!!f("￿","u");oe.readRegexp=function(){for(var e,t,n=this,r=this.pos;;){n.pos>=n.input.length&&n.raise(r,"Unterminated regular expression");var i=n.input.charAt(n.pos);if(O.test(i)&&n.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++n.pos}var s=this.input.slice(r,this.pos);++this.pos;var o=this.readWord1(),a=s,u="";if(o){var c=/^[gim]*$/;this.options.ecmaVersion>=6&&(c=/^[gimuy]*$/),c.test(o)||this.raise(r,"Invalid regular expression flag"),o.indexOf("u")>=0&&(ue?u="u":(a=(a=a.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(e,t,i){return(t=Number("0x"+t))>1114111&&n.raise(r+i+3,"Code point out of bounds"),"x"})).replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"),u=u.replace("u","")))}var l=null;return ae||(f(a,u,r,this),l=f(s,o)),this.finishToken(L.regexp,{pattern:s,flags:o,value:l})},oe.readInt=function(e,t){for(var n=this.pos,r=0,i=0,s=null==t?1/0:t;i=97?o-97+10:o>=65?o-65+10:o>=48&&o<=57?o-48:1/0)>=e)break;++this.pos,r=r*e+a}return this.pos===n||null!=t&&this.pos-n!==t?null:r},oe.readRadixNumber=function(e){this.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.start+2,"Expected number in radix "+e),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(L.num,t)},oe.readNumber=function(e){var t=this.pos,r=!1,i=48===this.input.charCodeAt(this.pos);e||null!==this.readInt(10)||this.raise(t,"Invalid number"),i&&this.pos==t+1&&(i=!1);var s=this.input.charCodeAt(this.pos);46!==s||i||(++this.pos,this.readInt(10),r=!0,s=this.input.charCodeAt(this.pos)),69!==s&&101!==s||i||(43!==(s=this.input.charCodeAt(++this.pos))&&45!==s||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),r=!0),n(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var o,a=this.input.slice(t,this.pos);return r?o=parseFloat(a):i&&1!==a.length?this.strict?this.raise(t,"Invalid number"):o=/[89]/.test(a)?parseInt(a,10):parseInt(a,8):o=parseInt(a,10),this.finishToken(L.num,o)},oe.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},oe.readString=function(e){for(var t="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;92===r?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):(o(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(L.string,t)};var ce={};oe.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==ce)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},oe.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ce;this.raise(e,t)},oe.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==L.template&&this.type!==L.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(L.template,e)):36===n?(this.pos+=2,this.finishToken(L.dollarBraceL)):(++this.pos,this.finishToken(L.backQuote));if(92===n)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(o(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},oe.readInvalidTemplateToken=function(){for(;this.pos=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(n,8);return r>255&&(n=n.slice(0,-1),r=parseInt(n,8)),"0"!==n&&(this.strict||e)&&this.invalidStringToken(this.pos-2,"Octal literal in strict mode"),this.pos+=n.length-1,String.fromCharCode(r)}return String.fromCharCode(t)}},oe.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return null===n&&this.invalidStringToken(t,"Bad character escape sequence"),n},oe.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,s=this.options.ecmaVersion>=6;this.pos=s)&&a[c](t,n,e),(null==r||t.start==r)&&(null==s||t.end==s)&&o(c,t))throw new i(t,n)}(n,u)}catch(e){if(e instanceof i)return e;throw e}},e.findNodeAround=function(n,r,s,o,a){s=t(s),o||(o=e.base);try{!function e(t,n,a){var u=a||t.type;if(!(t.start>r||t.end=r&&s(u,t))throw new i(t,n);o[u](t,n,e)}}(n,a)}catch(e){if(e instanceof i)return e;throw e}},e.findNodeBefore=function(n,r,s,o,a){s=t(s),o||(o=e.base);var u;return function e(t,n,a){if(!(t.start>r)){var c=a||t.type;t.end<=r&&(!u||u.node.end0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return o[e>>18&63]+o[e>>12&63]+o[e>>6&63]+o[63&e]}function s(e,t,n){for(var r,s=[],o=t;o0?c-4:c;var l=0;for(t=0;t>16&255,o[l++]=i>>8&255,o[l++]=255&i;return 2===s?(i=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,o[l++]=255&i):1===s&&(i=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,o[l++]=i>>8&255,o[l++]=255&i),o},n.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i="",a=[],u=0,c=n-r;uc?c:u+16383));return 1===r?(t=e[n-1],i+=o[t>>2],i+=o[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=o[t>>10],i+=o[t>>4&63],i+=o[t<<2&63],i+="="),a.push(i),a.join("")};for(var o=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=c.length;lB)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return a(e)}return s(e,t,n)}function s(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return T(e)?function(e,t,n){if(t<0||e.byteLength=B)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+B.toString(16)+" bytes");return 0|e}function l(e,t){if(i.isBuffer(e))return e.length;if(N(e)||T(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return _(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return L(e).length;default:if(r)return _(e).length;t=(""+t).toLowerCase(),r=!0}}function p(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0);(!n||n<0||n>r)&&(n=r);for(var i="",s=t;s2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,P(n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=i.from(t,r)),i.isBuffer(t))return 0===t.length?-1:d(e,t,n,r,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):d(e,[t],n,r,s);throw new TypeError("val must be string, number or Buffer")}function d(e,t,n,r,i){function s(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,n/=2}var c;if(i){var l=-1;for(c=n;ca&&(n=a-u),c=n;c>=0;c--){for(var p=!0,h=0;hi&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function w(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:s>223?3:s>191?2:1;if(i+a<=n){var u,c,l,p;switch(a){case 1:s<128&&(o=s);break;case 2:128==(192&(u=e[i+1]))&&(p=(31&s)<<6|63&u)>127&&(o=p);break;case 3:u=e[i+1],c=e[i+2],128==(192&u)&&128==(192&c)&&(p=(15&s)<<12|(63&u)<<6|63&c)>2047&&(p<55296||p>57343)&&(o=p);break;case 4:u=e[i+1],c=e[i+2],l=e[i+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(p=(15&s)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&p<1114112&&(o=p)}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rn)throw new RangeError("Trying to access beyond buffer length")}function S(e,t,n,r,s,o){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function k(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function A(e,t,n,r,i){return t=+t,n>>>=0,i||k(e,0,n,4),$.write(e,t,n,r,23,4),n+4}function C(e,t,n,r,i){return t=+t,n>>>=0,i||k(e,0,n,8),$.write(e,t,n,r,52,8),n+8}function _(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],o=0;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function L(e){return F.toByteArray(function(e){if((e=e.trim().replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function T(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function N(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function P(e){return e!=e}var F=e("base64-js"),$=e("ieee754");n.Buffer=i,n.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},n.INSPECT_MAX_BYTES=50;var B=2147483647;n.kMaxLength=B,(i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,n){return s(e,t,n)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,n){return function(e,t,n){return o(e),e<=0?r(e):void 0!==t?"string"==typeof n?r(e).fill(t,n):r(e).fill(t):r(e)}(e,t,n)},i.allocUnsafe=function(e){return a(e)},i.allocUnsafeSlow=function(e){return a(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,s=0,o=Math.min(n,r);s0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},i.prototype.compare=function(e,t,n,r,s){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),t<0||n>e.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&t>=n)return 0;if(r>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,s>>>=0,this===e)return 0;for(var o=s-r,a=n-t,u=Math.min(o,a),c=this.slice(r,s),l=e.slice(t,n),p=0;p>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return m(this,e,t,n);case"ascii":return g(this,e,t,n);case"latin1":case"binary":return v(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;i.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e],i=1,s=0;++s>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},i.prototype.readUInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);for(var r=this[e],i=1,s=0;++s=i&&(r-=Math.pow(2,8*t)),r},i.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||E(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},i.prototype.readInt8=function(e,t){return e>>>=0,t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||E(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(e,t){e>>>=0,t||E(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||E(e,4,this.length),$.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||E(e,4,this.length),$.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||E(e,8,this.length),$.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||E(e,8,this.length),$.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,s=0;for(this[t]=255&e;++s>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=n-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+n},i.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);S(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+n},i.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);S(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},i.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,n){return A(this,e,t,!0,n)},i.prototype.writeFloatBE=function(e,t,n){return A(this,e,t,!1,n)},i.prototype.writeDoubleLE=function(e,t,n){return C(this,e,t,!0,n)},i.prototype.writeDoubleBE=function(e,t,n){return C(this,e,t,!1,n)},i.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=t;o>1,l=-7,p=n?i-1:0,h=n?-1:1,f=e[t+p];for(p+=h,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+p],p+=h,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+e[t+p],p+=h,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=c}return(f?-1:1)*o*Math.pow(2,s-r)},n.write=function(e,t,n,r,i,s){var o,a,u,c=8*s-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:s-1,d=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+p>=1?h/u:h*Math.pow(2,1-p))*u>=2&&(o++,u/=2),o+p>=l?(a=0,o=l):o+p>=1?(a=(t*u-1)*Math.pow(2,i),o+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&a,f+=d,a/=256,i-=8);for(o=o<0;e[n+f]=255&o,f+=d,o/=256,c-=8);e[n+f-d]|=128*y}},{}],10:[function(e,t,n){(function(n){function r(){}function i(e){this.covers={},this._ident=i.prototype.version+"_"+Math.random(),this.setOptions(e||{})}var s=e("./lib/parser"),o=e("./lib/arboriculture"),a=e("./lib/output");i.prototype.smCache={},i.prototype.setOptions=function(e){return this.log=!1===e.log?r:e.log||this.log,this.options=function(e){var t={};return e.forEach(function(e){if(e&&"object"==typeof e)for(var n in e)t[n]=e[n]}),t}([this.options,e]),delete this.options.log,this},i.prototype.version=e("./package.json").version,i.prototype.isThenable=function(e){return e&&e instanceof Object&&"function"==typeof e.then},i.prototype.compile=function(e,t,n,s){"object"==typeof n&&void 0===s&&(s=n),s=s||{};for(var o in i.initialCodeGenOpts)o in s||(s[o]=i.initialCodeGenOpts[o]);var a=this.parse(e,t,null,s);return this.asynchronize(a,null,s,this.log||r),this.prettyPrint(a,s),a},i.prototype.parse=function(e,t,n,r){"object"==typeof n&&void 0===r&&(r=n);var i={origCode:e.toString(),filename:t};try{return i.ast=s.parse(i.origCode,r&&r.parser),r.babelTree&&s.treeWalker(i.ast,function(e,t,n){"Literal"===e.type?n[0].replace(o.babelLiteralNode(e.value)):"Property"===e.type&&("ClassBody"===n[0].parent.type?e.type="ClassProperty":e.type="ObjectProperty"),t()}),i}catch(e){if(e instanceof SyntaxError){var a=i.origCode.substr(e.pos-e.loc.column);a=a.split("\n")[0],e.message+=" "+t+" (nodent)\n"+a+"\n"+a.replace(/[\S ]/g,"-").substring(0,e.loc.column)+"^",e.stack=""}throw e}},i.prototype.asynchronize=o.asynchronize,i.prototype.printNode=o.printNode,i.prototype.prettyPrint=function(t,r){var i=t.filename?t.filename.split("/"):["anonymous"],s=i.pop(),o=a(t.ast,r&&r.sourcemap?{map:{startLine:r.mapStartLine||0,file:s+"(original)",sourceMapRoot:i.join("/"),sourceContent:t.origCode}}:null,t.origCode);if(r&&r.sourcemap)try{var u="",c=o.map.toJSON();if(c){var l=e("source-map").SourceMapConsumer;t.sourcemap=c,this.smCache[t.filename]={map:c,smc:new l(c)},u="\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,"+function(e){return(e instanceof n?e:new n(e.toString(),"binary")).toString("base64")}(JSON.stringify(c))+"\n"}t.code=o.code+u}catch(e){t.code=o}else t.code=o;return t},i.prototype.getDefaultCompileOptions=void 0,Object.defineProperty(i.prototype,"Promise",{get:function(){return initOpts.log("Warning: nodent.Promise is deprecated. Use nodent.Thenable instead"),Thenable},enumerable:!1,configurable:!1}),i.initialCodeGenOpts={noRuntime:!1,lazyThenables:!1,es6target:!1,noUseDirective:!1,wrapAwait:null,mapStartLine:0,sourcemap:!0,engine:!1,parser:{sourceType:"script"},$return:"$return",$error:"$error",$arguments:"$args",$asyncspawn:"$asyncspawn",$asyncbind:"$asyncbind",generatedSymbolPrefix:"$",$makeThenable:"$makeThenable"},t.exports=i}).call(this,e("buffer").Buffer)},{"./lib/arboriculture":11,"./lib/output":12,"./lib/parser":13,"./package.json":25,buffer:8,"source-map":24}],11:[function(e,t,n){"use strict";function r(e){if(!e)return"";if(Array.isArray(e))return e.map(r).join("|\n");try{return m(e)}catch(t){return t.message+": "+(e&&e.type)}}function i(e){if(Array.isArray(e))return e.map(function(e){return i(e)});var t={};return Object.keys(e).forEach(function(n){t[n]=e[n]}),t}function s(e,t){e!==t&&(e.__proto__=Object.getPrototypeOf(t),Object.keys(e).forEach(function(t){t in g||delete e[t]}),Object.keys(t).forEach(function(n){n in e||(e[n]=t[n])}))}function o(){}function a(e){return e?(b.node=e,b):{}}function u(e,t,n){if(!e)return null;if(t&&"object"==typeof t){var r=Object.keys(t);return u(e,function(e){return r.every(function(n){return e[n]==t[n]})})}var i,s={};if(Array.isArray(e)){for(var o=0;o0){if(!o)return t(e);delete e.async}return void(!o&&i?t():(e.type="ReturnStatement",e.$mapped=!0,e.argument={type:"CallExpression",callee:k(s,[n]).$error,arguments:[e.argument]}))}return"TryStatement"===e.type?(i++,t(e),void i--):a(e).isFunction?(r++,t(e),void r--):void t(e)}if(r>0){if(!a(e).isAsync)return t(e);delete e.async}return e.$mapped=!0,void(a(e.argument).isUnaryExpression&&"void"===e.argument.operator?e.argument=e.argument.argument:e.argument={type:"CallExpression",callee:k(s,[n]).$return,arguments:e.argument?[e.argument]:[]})},t)}function P(e,t){return Array.isArray(e)?e.map(function(e){return P(e,t)}):(y.treeWalker(e,function(e,t,n){if(t(),"ConditionalExpression"===e.type&&(c(e.alternate)||c(e.consequent))){h(E("condOp"));s(e,_(y.part("if ($0) return $1 ; return $2",[e.test,e.consequent,e.alternate]).body))}},t),e)}function F(e,t){return Array.isArray(e)?e.map(function(e){return F(e,t)}):(y.treeWalker(e,function(e,t,n){if(t(),"LogicalExpression"===e.type&&c(e.right)){var r,i=h(E("logical"+("&&"===e.operator?"And":"Or")));if("||"===e.operator)r="var $0; if (!($0 = $1)) {$0 = $2} return $0";else{if("&&"!==e.operator)throw new Error(v(e)+"Illegal logical operator: "+e.operator);r="var $0; if ($0 = $1) {$0 = $2} return $0"}s(e,_(y.part(r,[i,e.left,e.right]).body))}},t),e)}function $(e,t,n){if("SwitchCase"!==e.type&&a(e).isBlockStatement)for(var r=0;r { $$setMapped: while (q) { if (q.then) "+(1===i?" return void q.then($idTrampoline, $exit); ":" return q.then($idTrampoline, $exit); ")+" try { if (q.pop) if (q.length) return q.pop() ? $idContinuation.call(this) : q; else q = $idStep; else q = q.call(this) } catch (_exception) { return $exit(_exception); } } }))($idIter)":"($idTrampoline = (function (q) { $$setMapped: while (q) { if (q.then) "+(1===i?" return void q.then($idTrampoline, $exit); ":" return q.then($idTrampoline, $exit); ")+" try { if (q.pop) if (q.length) return q.pop() ? $idContinuation.call(this) : q; else q = $idStep; else q = q.call(this) } catch (_exception) { return $exit(_exception); } } }).bind(this))($idIter)",{setMapped:function(e){return e.$mapped=!0,e},idTrampoline:w,exit:P,idIter:E,idContinuation:A,idStep:S}).expr:y.part("(Function.$0.trampoline(this,$1,$2,$3,$5)($4))",[pe.asyncbind,A,S,P,E,b(1===i)]).expr,o.push({type:"ReturnStatement",argument:N}),o.push({$label:e.$label,type:"FunctionDeclaration",id:E,params:[],body:{type:"BlockStatement",body:d}}),f&&o.push({type:"FunctionDeclaration",id:S,params:[],body:{type:"BlockStatement",body:[f,L]}}),!l||"VariableDeclaration"!==l.type||"let"!==l.kind&&"const"!==l.kind?(o.push(v),t[0].replace(o.map(r))):("const"===l.kind&&(l.kind="let"),t[0].replace([{type:"BlockStatement",body:o.map(r)},r(v)]))}}function G(e){if(!a(e).isFunction)throw new Error("Cannot examine non-Function node types for async exits");return u(e.body,function(e){return"Identifier"===e.type&&(e.name===n.$return||e.name===n.$error)||I(e)&&a(e).isAsync},function(e){return!(a(e).isFunction&&(e.$wasAsync||a(e).isAsync))})}function J(t){return y.treeWalker(t,function(t,r,i){var s=x(t);if(r(),s&&a(s).isAsync){if("set"==t.kind){var o=new SyntaxError(v(s)+"method 'async set' cannot be invoked",e.filename,t.start);throw o.pos=t.start,o.loc=t.loc.start,o}s.async=!1;var u=w(s);G(s)||0!==s.body.body.length&&"ReturnStatement"===s.body.body[s.body.body.length-1].type||s.body.body.push({type:"ReturnStatement"});var c=m(S({type:"FunctionExpression",params:[pe.return,pe.error],body:J(N(s.body,i)),$wasAsync:!0},n),n.promises||n.generators||n.engine?null:b(!n.lazyThenables||0));n.promises?s.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"NewExpression",callee:h("Promise"),arguments:[c]}}]}:s.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:c}]},u&&D(s.body.body,[he])}})}function H(e){return y.treeWalker(e,function(e,t,r){if(t(),a(e).isAsync&&a(e).isFunction){var i;(i=x(r[0].parent))&&a(i).isAsync&&"get"===r[0].parent.kind&&X(r[0].parent.key),delete e.async;var s=w(e),o=S({type:"FunctionExpression",params:[pe.return,pe.error],$wasAsync:!0},n),u=[{self:o}].concat(r);return a(e.body).isBlockStatement?(G(e)||0!==e.body.body.length&&"ReturnStatement"===e.body.body[e.body.body.length-1].type||e.body.body.push({type:"ReturnStatement"}),o.body={type:"BlockStatement",body:e.body.body.map(function(e){return N(e,u)})}):(o.body={type:"BlockStatement",body:[N({type:"ReturnStatement",argument:e.body},u)]},e.expression=!1),o=m(o,n.promises||n.generators||n.engine?null:b(!n.lazyThenables||0)),n.promises&&(o={type:"NewExpression",callee:h("Promise"),arguments:[o]}),o={type:"BlockStatement",body:[{type:"ReturnStatement",loc:e.loc,argument:o}]},s&&D(o.body,[he]),void(e.body=o)}}),e}function Y(e){if(Array.isArray(e))return e.map(Y);var t=0;return y.treeWalker(e,function(e,n,r){if("ThrowStatement"!==e.type&&"ReturnStatement"!==e.type||e.$mapped){if(a(e).isFunction)return t++,n(e),void t--}else if(t>0&&a(e).isAsync)return delete e.async,e.argument={type:"CallExpression",callee:"ThrowStatement"===e.type?pe.error:pe.return,arguments:e.argument?[e.argument]:[]},void(e.type="ReturnStatement");n(e)})}function Z(e,t){if(n.noRuntime)throw new Error("Nodent: 'noRuntime' option only compatible with -promise and -engine modes");return y.part("{ return (function*($return,$error){ $:body }).$asyncspawn(Promise,this) }",{return:pe.return,error:pe.error,asyncspawn:pe.asyncspawn,body:Y(e).concat(t?[{type:"ReturnStatement",argument:pe.return}]:[])}).body[0]}function X(e){e.$asyncgetwarninig||(e.$asyncgetwarninig=!0,d(v(e)+"'async get "+r(e)+"(){...}' is non-standard. See https://github.com/MatAtBread/nodent#differences-from-the-es7-specification"))}function Q(e,t){function r(e,t){y.treeWalker(e,function(n,r,i){n!==e&&a(n).isFunction||(a(n).isAwait?t?(n.$hidden=!0,r()):(delete n.operator,n.delegate=!1,n.type="YieldExpression",r()):r())})}function o(e){var t=n.promises;n.promises=!0,A(e,!0),n.promises=t}function u(e){return"BlockStatement"!==e.body.type&&(e.body={type:"BlockStatement",body:[{type:"ReturnStatement",argument:e.body}]}),e}function c(e,n){n.$asyncexitwarninig||(n.$asyncexitwarninig=!0,d(v(e)+"'async "+{ReturnStatement:"return",ThrowStatement:"throw"}[e.type]+"' not possible in "+(t?"engine":"generator")+" mode. Using Promises for function at "+v(n)))}y.treeWalker(e,function(e,n,i){n();var l,p,h;if(a(e).isAsync&&a(e).isFunction){var f;(f=x(i[0].parent))&&a(f).isAsync&&"get"===i[0].parent.kind&&X(i[0].parent.key),(p=G(e))?(c(p,e.body),o(e)):t?"get"!==i[0].parent.kind&&r(e,!0):(delete(l=e).async,h=w(l),r(l,!1),(l=u(l)).body=Z(l.body.body,p),h&&D(l.body.body,[he]),l.id&&"ExpressionStatement"===i[0].parent.type?(l.type="FunctionDeclaration",i[1].replace(l)):i[0].replace(l))}else(l=x(e))&&a(l).isAsync&&((p=G(l))?(c(p,l),o(e)):t&&"get"!==e.kind||(t?o(e):(e.async=!1,h=w(l),r(l,!1),s(l,u(l)),l.body=Z(l.body.body,p)),h&&D(l.body.body,[he])))});var l=i(n);return n.engine=!1,n.generators=!1,ie(e),ne(e),j(e,l.engine),F(e),P(e),q(e,[M,W,B,R,$]),V(e,"warn"),n.engine=l.engine,n.generators=l.generators,e}function K(e,t,n){var r=[];return y.treeWalker(e,function(i,s,o){if(i===e)return s();t(i,o)?r.push([].concat(o)):n||a(i).isScope||s()}),r}function ee(e,t){var n=[],r={};if((e=e.filter(function(e){return"ExportNamedDeclaration"!==e[0].parent.type})).length){var s={};e.forEach(function(e){function t(e){e in s?r[e]=o.declarations[u]:s[e]=o.declarations[u]}for(var n=e[0],o=n.self,a=(o.kind,[]),u=0;u1?{type:"SequenceExpression",expressions:a}:a[0];"For"!==n.parent.type.slice(0,3)&&(p={type:"ExpressionStatement",expression:p}),n.replace(p)}});var o=Object.keys(s);o.length&&(o=o.map(function(e){return{type:"VariableDeclarator",id:h(e),loc:s[e].loc,start:s[e].start,end:s[e].end}}),n[0]&&"VariableDeclaration"===n[0].type?n[0].declarations=n[0].declarations.concat(o):n.unshift({type:"VariableDeclaration",kind:t,declarations:o}))}return{decls:n,duplicates:r}}function te(e){if(!e)return[];if(Array.isArray(e))return e.reduce(function(e,t){return e.concat(te(t.id))},[]);switch(e.type){case"Identifier":return[e.name];case"AssignmentPattern":return te(e.left);case"ArrayPattern":return e.elements.reduce(function(e,t){return e.concat(te(t))},[]);case"ObjectPattern":return e.properties.reduce(function(e,t){return e.concat(te(t))},[]);case"ObjectProperty":case"Property":return te(e.value);case"RestElement":case"RestProperty":return te(e.argument)}}function ne(e){function t(e){return u(e,function(e){return"AssignmentExpression"===e.type})}function n(e){return function(t,n){if("VariableDeclaration"===t.type&&(t.kind=t.kind||"var")&&e.indexOf(t.kind)>=0){var r=n[0];return("left"!=r.field||"ForInStatement"!==r.parent.type&&"ForOfStatement"!==r.parent.type)&&("init"!=r.field||"ForStatement"!==r.parent.type||"const"!==t.kind&&"let"!==t.kind)}}}function o(e,t){return!("FunctionDeclaration"!==e.type||!e.id)&&(a(e).isAsync||!e.$continuation)}var l={TemplateLiteral:function(e){return e.expressions},NewExpression:function(e){return e.arguments},CallExpression:function(e){return e.arguments},SequenceExpression:function(e){return e.expressions},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties.map(function(e){return e.value})}};y.treeWalker(e,function(e,n,r){function o(e){h.length&&(e.argument={type:"SequenceExpression",expressions:h.map(function(e){var t=i(e);return s(e,e.left),t}).concat(e.argument)},h=[])}var u;if(n(),e.type in l&&!e.$hoisted){var p=l[e.type](e),h=[];for(u=0;u0;u--)if(e.declarations[u]&&e.declarations[u].init&&c(e.declarations[u].init)){var f={type:"VariableDeclaration",kind:e.kind,declarations:e.declarations.splice(u)},d=r[0];if(!("index"in d))throw new Error("VariableDeclaration not in a block");d.parent[d.field].splice(d.index+1,0,f)}}),function(e){function t(e){d(v(e)+"Possible assignment to 'const "+r(e)+"'")}function n(e){switch(e.type){case"Identifier":"const"===i[e.name]&&t(e);break;case"ArrayPattern":e.elements.forEach(function(e){"const"===i[e.name]&&t(e)});break;case"ObjectPattern":e.properties.forEach(function(e){"const"===i[e.key.name]&&t(e)})}}var i={};y.treeWalker(e,function(e,t,r){var s=a(e).isBlockStatement;if(s){i=Object.create(i);for(var o=0;o=0&&"ReturnStatement"===r[1].self.type){var s=e.$thisCallName,o=i(ce[s].def.body.body);ce[s].$inlined=!0,a(r[1].self).isJump||o.push({type:"ReturnStatement"}),r[1].replace(o)}});var n=Object.keys(ce).map(function(e){return ce[e].$inlined&&ce[e].def});y.treeWalker(e,function(e,t,r){t(),n.indexOf(e)>=0&&r[0].remove()})}if(!("Program"===e.type&&"module"===e.sourceType||u(e,function(e){return a(e).isES6},!0))){var r=oe(e);!function(e){y.treeWalker(e,function(e,t,n){if("Program"===e.type||"FunctionDeclaration"===e.type||"FunctionExpression"===e.type){var i=r;if(r=r||oe(e)){t();var s="Program"===e.type?e:e.body,o=K(s,function(e,t){if("FunctionDeclaration"===e.type)return t[0].parent!==s});o=o.map(function(e){return e[0].remove()}),[].push.apply(s.body,o)}else t();r=i}else t()})}(e)}return y.treeWalker(e,function(e,t,n){t(),Object.keys(e).filter(function(e){return"$"===e[0]}).forEach(function(t){delete e[t]})}),e}var ce={},le=1,pe={};Object.keys(n).filter(function(e){return"$"===e[0]}).forEach(function(e){pe[e.slice(1)]=h(n[e])});var he=y.part("var $0 = arguments",[pe.arguments]).body[0];return n.engine?(e.ast=re(e.ast,!0),e.ast=Q(e.ast,n.engine),e.ast=se(e.ast),ue(e.ast)):n.generators?(e.ast=re(e.ast),e.ast=Q(e.ast),e.ast=se(e.ast),ue(e.ast)):(e.ast=re(e.ast),A(e.ast)),n.babelTree&&y.treeWalker(e.ast,function(e,t,n){t(),"Literal"===e.type&&s(e,b(e.value))}),e}var y=e("./parser"),m=e("./output"),g={start:!0,end:!0,loc:!0,range:!0},v={getScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type?this.node.body.body:"Program"===this.node.type?this.node.body:null},isScope:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"Program"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type&&"BlockStatement"===this.node.body.type},isFunction:function(){return"FunctionDeclaration"===this.node.type||"FunctionExpression"===this.node.type||"Function"===this.node.type||"ObjectMethod"===this.node.type||"ClassMethod"===this.node.type||"ArrowFunctionExpression"===this.node.type},isClass:function(){return"ClassDeclaration"===this.node.type||"ClassExpression"===this.node.type},isBlockStatement:function(){return"ClassBody"===this.node.type||"Program"===this.node.type||"BlockStatement"===this.node.type?this.node.body:"SwitchCase"===this.node.type&&this.node.consequent},isExpressionStatement:function(){return"ExpressionStatement"===this.node.type},isLiteral:function(){return"Literal"===this.node.type||"BooleanLiteral"===this.node.type||"RegExpLiteral"===this.node.type||"NumericLiteral"===this.node.type||"StringLiteral"===this.node.type||"NullLiteral"===this.node.type},isDirective:function(){return"ExpressionStatement"===this.node.type&&("StringLiteral"===this.node.expression.type||"Literal"===this.node.expression.type&&"string"==typeof this.node.expression.value)},isUnaryExpression:function(){return"UnaryExpression"===this.node.type},isAwait:function(){return"AwaitExpression"===this.node.type&&!this.node.$hidden},isAsync:function(){return this.node.async},isStatement:function(){return null!==this.node.type.match(/[a-zA-Z]+Declaration/)||null!==this.node.type.match(/[a-zA-Z]+Statement/)},isExpression:function(){return null!==this.node.type.match(/[a-zA-Z]+Expression/)},isLoop:function(){return"ForStatement"===this.node.type||"WhileStatement"===this.node.type||"DoWhileStatement"===this.node.type},isJump:function(){return"ReturnStatement"===this.node.type||"ThrowStatement"===this.node.type||"BreakStatement"===this.node.type||"ContinueStatement"===this.node.type},isES6:function(){switch(this.node.type){case"ExportNamedDeclaration":case"ExportSpecifier":case"ExportDefaultDeclaration":case"ExportAllDeclaration":case"ImportDeclaration":case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ArrowFunctionExpression":case"ForOfStatement":case"YieldExpression":case"Super":case"RestElement":case"RestProperty":case"SpreadElement":case"TemplateLiteral":case"ClassDeclaration":case"ClassExpression":return!0;case"VariableDeclaration":return this.node.kind&&"var"!==this.node.kind;case"FunctionDeclaration":case"FunctionExpression":return!!this.node.generator}}},b={};Object.keys(v).forEach(function(e){Object.defineProperty(b,e,{get:v[e]})}),t.exports={printNode:r,babelLiteralNode:p,asynchronize:function(e,t,n,r){try{return d(e,0,n,r)}catch(t){if(t instanceof SyntaxError){var i=e.origCode.substr(t.pos-t.loc.column);i=i.split("\n")[0],t.message+=" (nodent)\n"+i+"\n"+i.replace(/[\S ]/g,"-").substring(0,t.loc.column)+"^",t.stack=""}throw t}}}},{"./output":12,"./parser":13}],12:[function(e,t,n){"use strict";function r(e){if("NewExpression"===e.type&&e.arguments&&e.arguments.length)return 19;var t=h[e.type]||h[e.type+e.operator]||h[e.type+e.operator+(e.prefix?"prefix":"")];return void 0!==t?t:20}var i,s,o,a,u,c,l=e("source-map").SourceMapGenerator;if("".repeat)c=function(e,t){return t&&e?e.repeat(t):""};else{var p={};c=function(e,t){if(!t||!e)return"";var n=""+e+t;if(!p[n]){for(var r=[];t--;)r.push(e);p[n]=r.join("")}return p[n]}}var h={ExpressionStatement:-1,Identifier:21,Literal:21,BooleanLiteral:21,RegExpLiteral:21,NumericLiteral:21,StringLiteral:21,NullLiteral:21,ThisExpression:21,SuperExpression:21,ObjectExpression:21,ClassExpression:21,MemberExpression:19,CallExpression:18,NewExpression:18,ArrayExpression:17.5,FunctionExpression:17.5,FunctionDeclaration:17.5,ArrowFunctionExpression:17.5,"UpdateExpression++":17,"UpdateExpression--":17,"UpdateExpression++prefix":16,"UpdateExpression--prefix":16,UnaryExpression:16,AwaitExpression:16,"BinaryExpression**":15,"BinaryExpression*":15,"BinaryExpression/":15,"BinaryExpression%":15,"BinaryExpression+":14,"BinaryExpression-":14,"BinaryExpression<<":13,"BinaryExpression>>":13,"BinaryExpression>>>":13,"BinaryExpression<":12,"BinaryExpression<=":12,"BinaryExpression>":12,"BinaryExpression>=":12,BinaryExpressionin:12,BinaryExpressioninstanceof:12,"BinaryExpression==":11,"BinaryExpression===":11,"BinaryExpression!=":11,"BinaryExpression!==":11,"BinaryExpression&":10,"BinaryExpression^":9,"BinaryExpression|":8,"LogicalExpression&&":7,"LogicalExpression||":6,ConditionalExpression:5,AssignmentPattern:4,AssignmentExpression:4,yield:3,YieldExpression:3,SpreadElement:2,"comma-separated-list":1.5,SequenceExpression:1},f={type:"comma-separated-list"},d={out:function(e,t,n){var r=this[n||e.type];r?r.call(this,e,t):t.write(e,"/*"+e.type+"?*/ "+t.sourceAt(e.start,e.end))},expr:function(e,t,n,i){2===i||r(n)0)for(var r=n.length,i=0;i0){this.out(e[0],t,e[0].type);for(var r=1,i=e.length;r0){t.write(null,s);for(var a=0,u=n.length;a0){this.out(n[0],t,"VariableDeclarator");for(var i=1;i0){for(var s=0;s0)for(var r=0;r ")):(this.formatParameters(e.params,t),t.write(e,"=> ")),"ObjectExpression"===e.body.type||"SequenceExpression"===e.body.type?(t.write(null,"("),this.out(e.body,t,e.body.type),t.write(null,")")):this.out(e.body,t,e.body.type)},ThisExpression:function(e,t){t.write(e,"this")},Super:function(e,t){t.write(e,"super")},RestElement:s=function(e,t){t.write(e,"..."),this.out(e.argument,t,e.argument.type)},SpreadElement:s,YieldExpression:function(e,t){t.write(e,e.delegate?"yield*":"yield"),e.argument&&(t.write(null," "),this.expr(t,e,e.argument))},AwaitExpression:function(e,t){t.write(e,"await "),this.expr(t,e,e.argument)},TemplateLiteral:function(e,t){var n,r=e.quasis,i=e.expressions;t.write(e,"`");for(var s=0,o=i.length;s0)for(var n=e.elements,r=n.length,i=0;;){var s=n[i];if(s&&this.expr(t,f,s),((i+=1)=r)break;t.lineLength()>t.wrapColumn&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1))}t.write(null,"]")},ArrayPattern:a,ObjectExpression:function(e,t){var n,r=c(t.indent,t.indentLevel++),i=t.lineEnd,s=r+t.indent;if(t.write(e,"{"),e.properties.length>0){t.write(null,i);for(var o=e.properties,a=o.length,u=0;n=o[u],t.write(null,s),this.out(n,t,"Property"),++ut.wrapColumn&&t.write(null,t.lineEnd,c(t.indent,t.indentLevel+1));t.write(null,i,r,"}")}else t.write(null,"}");t.indentLevel--},Property:function(e,t){e.method||"get"===e.kind||"set"===e.kind?this.MethodDefinition(e,t):(e.shorthand||(e.computed?(t.write(null,"["),this.out(e.key,t,e.key.type),t.write(null,"]")):this.out(e.key,t,e.key.type),t.write(null,": ")),this.expr(t,f,e.value))},ObjectPattern:function(e,t){if(t.write(e,"{"),e.properties.length>0)for(var n=e.properties,r=n.length,i=0;this.out(n[i],t,"Property"),++i0)for(var i=r.length,s=0;s1&&t.write(e," "),this.expr(t,e,e.argument,!0)):(this.expr(t,e,e.argument),t.write(e,e.operator))},UpdateExpression:function(e,t){e.prefix?(t.write(e,e.operator),this.out(e.argument,t,e.argument.type)):(this.out(e.argument,t,e.argument.type),t.write(e,e.operator))},BinaryExpression:o=function(e,t){var n=e.operator;"in"===n&&t.inForInit&&t.write(null,"("),this.expr(t,e,e.left),t.write(e," ",n," "),this.expr(t,e,e.right,"ArrowFunctionExpression"===e.right.type?2:0),"in"===n&&t.inForInit&&t.write(null,")")},LogicalExpression:o,AssignmentExpression:function(e,t){"ObjectPattern"===e.left.type&&t.write(null,"("),this.BinaryExpression(e,t),"ObjectPattern"===e.left.type&&t.write(null,")")},AssignmentPattern:function(e,t){this.expr(t,e,e.left),t.write(e," = "),this.expr(t,e,e.right)},ConditionalExpression:function(e,t){this.expr(t,e,e.test,!0),t.write(e," ? "),this.expr(t,e,e.consequent),t.write(null," : "),this.expr(t,e,e.alternate)},NewExpression:function(e,t){t.write(e,"new "),this.expr(t,e,e.callee,"CallExpression"===e.callee.type||"ObjectExpression"===e.callee.type?2:0),this.argumentList(e,t)},CallExpression:function(e,t){this.expr(t,e,e.callee,"ObjectExpression"===e.callee.type?2:0),this.argumentList(e,t)},MemberExpression:function(e,t){!("ObjectExpression"===e.object.type||e.object.type.match(/Literal$/)&&e.object.raw&&e.object.raw.match(/^[0-9]/))&&("ArrayExpression"===e.object.type||"CallExpression"===e.object.type||"NewExpression"===e.object.type||r(e)<=r(e.object))?this.out(e.object,t,e.object.type):(t.write(null,"("),this.out(e.object,t,e.object.type),t.write(null,")")),e.computed?(t.write(e,"["),this.out(e.property,t,e.property.type),t.write(null,"]")):(t.write(e,"."),this.out(e.property,t,e.property.type))},Identifier:function(e,t){t.write(e,e.name)},Literal:function(e,t){t.write(e,e.raw)},NullLiteral:function(e,t){t.write(e,"null")},BooleanLiteral:function(e,t){t.write(e,JSON.stringify(e.value))},StringLiteral:function(e,t){t.write(e,JSON.stringify(e.value))},RegExpLiteral:function(e,t){t.write(e,e.extra.raw||"/"+e.pattern+"/"+e.flags)},NumericLiteral:function(e,t){t.write(e,JSON.stringify(e.value))}};t.exports=function(e,t,n){var r="",i=[],s=(t=t||{}).map&&new l(t.map);s&&t.map.sourceContent&&s.setSourceContent(t.map.file,t.map.sourceContent);var o="",a=[],u=[],p={inForInit:0,lineLength:function(){return r.length},sourceAt:function(e,t){return n?n.substring(e,t):"/* Omitted Non-standard node */"},write:function(e){o=arguments[arguments.length-1];for(var n=1;n=0&&r({self:i,parent:e,field:u[c],index:!0}):l instanceof Object&&i===l&&r({self:i,parent:e,field:u[c]})}})},n),e}function s(t,n){var r=[],s={ecmaVersion:8,allowHashBang:!0,allowReturnOutsideFunction:!0,allowImportExportEverywhere:!0,locations:!0,onComment:r};if((!n||!n.noNodentExtensions||parseInt(o.version)<4)&&(c||(parseInt(o.version)<4&&console.warn("Nodent: Warning - noNodentExtensions option requires acorn >=v4.x. Extensions installed."),e("acorn-es7-plugin")(o),c=!0),s.plugins=s.plugins||{},s.plugins.asyncawait={asyncExits:!0,awaitAnywhere:!0}),n)for(var a in n)"noNodentExtensions"!==a&&(s[a]=n[a]);var u=o.parse(t,s);return i(u,function(e,t,n){for(t();r.length&&e.loc&&e.loc.start.line>=r[0].loc.start.line&&e.loc.end.line>=r[0].loc.end.line;)e.$comments=e.$comments||[],e.$comments.push(r.shift())}),u}var o=e("acorn"),a=e("acorn/dist/walk").make({AwaitExpression:function(e,t,n){n(e.argument,t,"Expression")},SwitchStatement:function(e,t,n){n(e.discriminant,t,"Expression");for(var r=0;r=0)return t}else{var n=i.toSetString(e);if(s.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')},r.prototype.at=function(e){if(e>=0&&e>>=5)>0&&(t|=32),n+=r.encode(t)}while(i>0);return n},n.decode=function(e,t,n){var i,s,o=e.length,a=0,u=0;do{if(t>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(s=r.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));i=!!(32&s),a+=(s&=31)<>1;return 1==(1&e)?-t:t}(a),n.rest=t}},{"./base64":16}],16:[function(e,t,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");n.encode=function(e){if(0<=e&&e0?t-u>1?r(u,t,i,s,o,a):a==n.LEAST_UPPER_BOUND?t1?r(e,u,i,s,o,a):a==n.LEAST_UPPER_BOUND?u:e<0?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,i,s){if(0===t.length)return-1;var o=r(-1,t.length,e,t,i,s||n.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&0===i(t[o],t[o-1],!0);)--o;return o}},{}],18:[function(e,t,n){function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=e("./util");r.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},r.prototype.add=function(e){!function(e,t){var n=e.generatedLine,r=t.generatedLine,s=e.generatedColumn,o=t.generatedColumn;return r>n||r==n&&o>=s||i.compareByGeneratedPositionsInflated(e,t)<=0}(this._last,e)?(this._sorted=!1,this._array.push(e)):(this._last=e,this._array.push(e))},r.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=r},{"./util":23}],19:[function(e,t,n){function r(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function i(e,t,n,s){if(n=0){var s=this._originalMappings[i];if(void 0===e.column)for(var o=s.originalLine;s&&s.originalLine===o;)r.push({line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var c=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==c;)r.push({line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return r},n.SourceMapConsumer=r,(i.prototype=Object.create(r.prototype)).consumer=r,i.fromSourceMap=function(e){var t=Object.create(i.prototype),n=t._names=c.fromArray(e._names.toArray(),!0),r=t._sources=c.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var o=e._mappings.toArray().slice(),u=t.__generatedMappings=[],l=t.__originalMappings=[],h=0,f=o.length;h1&&(n.source=y+i[1],y+=i[1],n.originalLine=f+i[2],f=n.originalLine,n.originalLine+=1,n.originalColumn=d+i[3],d=n.originalColumn,i.length>4&&(n.name=m+i[4],m+=i[4])),E.push(n),"number"==typeof n.originalLine&&w.push(n)}p(E,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=E,p(w,a.compareByOriginalPositions),this.__originalMappings=w},i.prototype._findMapping=function(e,t,n,r,i,s){if(e[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[n]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return u.search(e,t,i,s)},i.prototype.computeColumnSpans=function(){for(var e=0;e=0){var i=this._generatedMappings[n];if(i.generatedLine===t.generatedLine){var s=a.getArg(i,"source",null);null!==s&&(s=this._sources.at(s),null!=this.sourceRoot&&(s=a.join(this.sourceRoot,s)));var o=a.getArg(i,"name",null);return null!==o&&(o=this._names.at(o)),{source:s,line:a.getArg(i,"originalLine",null),column:a.getArg(i,"originalColumn",null),name:o}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=a.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var n;if(null!=this.sourceRoot&&(n=a.urlParse(this.sourceRoot))){var r=e.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!n.path||"/"==n.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=a.getArg(e,"source");if(null!=this.sourceRoot&&(t=a.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};var n={source:t=this._sources.indexOf(t),originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",r.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===n.source)return{line:a.getArg(s,"generatedLine",null),column:a.getArg(s,"generatedColumn",null),lastColumn:a.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=i,(o.prototype=Object.create(r.prototype)).constructor=r,o.prototype._version=3,Object.defineProperty(o.prototype,"sources",{get:function(){for(var e=[],t=0;t0&&e.column>=0)||t||n||r)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))},r.prototype._serializeMappings=function(){for(var e,t,n,r,o=0,a=1,u=0,c=0,l=0,p=0,h="",f=this._mappings.toArray(),d=0,y=f.length;d0){if(!s.compareByGeneratedPositionsInflated(t,f[d-1]))continue;e+=","}e+=i.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(r=this._sources.indexOf(t.source),e+=i.encode(r-p),p=r,e+=i.encode(t.originalLine-1-c),c=t.originalLine-1,e+=i.encode(t.originalColumn-u),u=t.originalColumn,null!=t.name&&(n=this._names.indexOf(t.name),e+=i.encode(n-l),l=n)),h+=e}return h},r.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=s.relative(t,e));var n=s.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null},this)},r.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=r},{"./array-set":14,"./base64-vlq":15,"./mapping-list":18,"./util":23}],22:[function(e,t,n){function r(e,t,n,r,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==i?null:i,this[a]=!0,null!=r&&this.add(r)}var i=e("./source-map-generator").SourceMapGenerator,s=e("./util"),o=/(\r?\n)/,a="$$$isSourceNode$$$";r.fromStringWithSourceMap=function(e,t,n){function i(e,t){if(null===e||void 0===e.source)a.add(t);else{var i=n?s.join(n,e.source):e.source;a.add(new r(e.originalLine,e.originalColumn,i,t,e.name))}}var a=new r,u=e.split(o),c=0,l=function(){function e(){return c=0;t--)this.prepend(e[t]);else{if(!e[a]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},r.prototype.walk=function(e){for(var t,n=0,r=this.children.length;n0){for(t=[],n=0;n=0;l--)"."===(o=u[l])?u.splice(l,1):".."===o?c++:c>0&&(""===o?(u.splice(l+1,c),c=0):(u.splice(l,2),c--));return""===(t=u.join("/"))&&(t=a?"/":"."),s?(s.path=t,i(s)):t}function o(e){return e}function a(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function u(e,t){return e===t?0:e>t?1:-1}n.getArg=function(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')};var c=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,l=/^data:.+\,.+$/;n.urlParse=r,n.urlGenerate=i,n.normalize=s,n.join=function(e,t){""===e&&(e="."),""===t&&(t=".");var n=r(t),o=r(e);if(o&&(e=o.path||"/"),n&&!n.scheme)return o&&(n.scheme=o.scheme),i(n);if(n||t.match(l))return t;if(o&&!o.host&&!o.path)return o.host=t,i(o);var a="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return o?(o.path=a,i(o)):a},n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(c)},n.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)};var p=!("__proto__"in Object.create(null));n.toSetString=p?o:function(e){return a(e)?"$"+e:e},n.fromSetString=p?o:function(e){return a(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,t,n){var r=e.source-t.source;return 0!==r?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)||n?r:0!=(r=e.generatedColumn-t.generatedColumn)?r:0!=(r=e.generatedLine-t.generatedLine)?r:e.name-t.name},n.compareByGeneratedPositionsDeflated=function(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-t.generatedColumn)||n?r:0!=(r=e.source-t.source)?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)?r:e.name-t.name},n.compareByGeneratedPositionsInflated=function(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!=(n=e.generatedColumn-t.generatedColumn)?n:0!==(n=u(e.source,t.source))?n:0!=(n=e.originalLine-t.originalLine)?n:0!=(n=e.originalColumn-t.originalColumn)?n:u(e.name,t.name)}},{}],24:[function(e,t,n){n.SourceMapGenerator=e("./lib/source-map-generator").SourceMapGenerator,n.SourceMapConsumer=e("./lib/source-map-consumer").SourceMapConsumer,n.SourceNode=e("./lib/source-node").SourceNode},{"./lib/source-map-consumer":20,"./lib/source-map-generator":21,"./lib/source-node":22}],25:[function(e,t,n){t.exports={_args:[[{raw:"nodent-compiler@>=3.1.3",scope:null,escapedName:"nodent-compiler",name:"nodent-compiler",rawSpec:">=3.1.3",spec:">=3.1.3",type:"range"},"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/nodent"]],_from:"nodent-compiler@>=3.1.3",_id:"nodent-compiler@3.1.3",_inCache:!0,_location:"/nodent-compiler",_nodeVersion:"8.4.0",_npmOperationalInternal:{host:"s3://npm-registry-packages",tmp:"tmp/nodent-compiler-3.1.3.tgz_1504874988276_0.6329000329133123"},_npmUser:{name:"matatbread",email:"npm@mailed.me.uk"},_npmVersion:"5.3.0",_phantomChildren:{},_requested:{raw:"nodent-compiler@>=3.1.3",scope:null,escapedName:"nodent-compiler",name:"nodent-compiler",rawSpec:">=3.1.3",spec:">=3.1.3",type:"range"},_requiredBy:["/nodent"],_resolved:"https://registry.npmjs.org/nodent-compiler/-/nodent-compiler-3.1.3.tgz",_shasum:"6f0f1f8098db251ec773742bb4f33cd0266434b2",_shrinkwrap:null,_spec:"nodent-compiler@>=3.1.3",_where:"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/nodent",author:{name:"Mat At Bread",email:"nodent@mailed.me.uk"},bugs:{url:"https://github.com/MatAtBread/nodent/issues"},dependencies:{acorn:">=2.5.2","acorn-es7-plugin":">=1.1.6","source-map":"^0.5.6"},description:"NoDent - Asynchronous Javascript language extensions",devDependencies:{},directories:{},dist:{integrity:"sha512-pcUC9gIgXXI3mbGjESZfVZO4Vgarw63xYZFRdkqxCDnygvvpiAwzwvvJ7rWqskp72Nk3cxWZY/rYxUIkPT14lw==",shasum:"6f0f1f8098db251ec773742bb4f33cd0266434b2",tarball:"https://registry.npmjs.org/nodent-compiler/-/nodent-compiler-3.1.3.tgz"},engines:"node >= 0.10.0",gitHead:"d72c5767ca302884c3215e6267d4910239add177",homepage:"https://github.com/MatAtBread/nodent-compiler#readme",keywords:["Javascript","ES7","async","await","language","extensions","Node","callback","generator","Promise","asynchronous"],license:"BSD-2-Clause",main:"compiler.js",maintainers:[{name:"matatbread",email:"npm@mailed.me.uk"}],name:"nodent-compiler",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+https://github.com/MatAtBread/nodent-compiler.git"},scripts:{test:"node tests/basic.js # Please install 'nodent' and test the compiler fully from there."},version:"3.1.3"}},{}],26:[function(e,t,n){"use strict";function r(e,t){if(Function.prototype.$asyncspawn||Object.defineProperty(Function.prototype,"$asyncspawn",{value:r,enumerable:!1,configurable:!0,writable:!0}),this instanceof Function){var n=this;return new e(function(e,r){function i(t,n){var o;try{if((o=t.call(s,n)).done){if(o.value!==e){if(o.value&&o.value===o.value.then)return o.value(e,r);e&&e(o.value),e=null}return}o.value.then?o.value.then(function(e){i(s.next,e)},function(e){i(s.throw,e)}):i(s.next,o.value)}catch(e){return r&&r(e),void(r=null)}}var s=n.call(t,e,r);i(s.next)})}}var i=function(e,t){for(var n=t.toString(),r="return "+n,i=n.match(/.*\(([^)]*)\)/)[1],s=/['"]!!!([^'"]*)['"]/g,o=[];;){var a=s.exec(r);if(!a)break;o.push(a)}return o.reverse().forEach(function(t){r=r.slice(0,t.index)+e[t[1]]+r.substr(t.index+t[0].length)}),r=r.replace(/\/\*[^*]*\*\//g," ").replace(/\s+/g," "),new Function(i,r)()}({zousan:e("./zousan").toString(),thenable:e("./thenableFactory").toString()},function e(t,n){function r(){return i.apply(t,arguments)}Function.prototype.$asyncbind||Object.defineProperty(Function.prototype,"$asyncbind",{value:e,enumerable:!1,configurable:!0,writable:!0}),e.trampoline||(e.trampoline=function(e,t,n,r,i){return function s(o){for(;o;){if(o.then)return o=o.then(s,r),i?void 0:o;try{if(o.pop){if(o.length)return o.pop()?t.call(e):o;o=n}else o=o.call(e)}catch(e){return r(e)}}}}),e.LazyThenable||(e.LazyThenable="!!!thenable"(),e.EagerThenable=e.Thenable=(e.EagerThenableFactory="!!!zousan")());var i=this;switch(n){case!0:return new e.Thenable(r);case 0:return new e.LazyThenable(r);case void 0:return r.then=r,r;default:return function(){try{return i.apply(t,arguments)}catch(e){return n(e)}}}});i(),r(),t.exports={$asyncbind:i,$asyncspawn:r}},{"./thenableFactory":27,"./zousan":28}],27:[function(e,t,n){t.exports=function(){function e(e){return e&&e instanceof Object&&"function"==typeof e.then}function t(n,r,i){try{var s=i?i(r):r;if(n===s)return n.reject(new TypeError("Promise resolution loop"));e(s)?s.then(function(e){t(n,e)},function(e){n.reject(e)}):n.resolve(s)}catch(e){n.reject(e)}}function n(){}function r(e){}function i(r,i){var s=new n;try{this._resolver(function(n){return e(n)?n.then(r,i):t(s,n,r)},function(e){t(s,e,i)})}catch(e){t(s,e,i)}return s}function s(e){this._resolver=e,this.then=i}return n.prototype={resolve:r,reject:r,then:function(e,t){this.resolve=e,this.reject=t}},s.resolve=function(e){return s.isThenable(e)?e:{then:function(t){return t(e)}}},s.isThenable=e,s}},{}],28:[function(e,t,n){(function(e){"use strict";t.exports=function(t){function n(e){if(e){var t=this;e(function(e){t.resolve(e)},function(e){t.reject(e)})}}function r(e,t){if("function"==typeof e.y)try{var n=e.y.call(void 0,t);e.p.resolve(n)}catch(t){e.p.reject(t)}else e.p.resolve(t)}function i(e,t){if("function"==typeof e.n)try{var n=e.n.call(void 0,t);e.p.resolve(n)}catch(t){e.p.reject(t)}else e.p.reject(t)}t=t||"object"==typeof e&&e.nextTick||"function"==typeof setImmediate&&setImmediate||function(e){setTimeout(e,0)};var s=function(){function e(){for(;n.length-r;){try{n[r]()}catch(e){}n[r++]=void 0,r===i&&(n.splice(0,i),r=0)}}var n=[],r=0,i=1024;return function(i){n.push(i),n.length-r==1&&t(e)}}();return n.prototype={resolve:function(e){if(void 0===this.state){if(e===this)return this.reject(new TypeError("Attempt to resolve promise with self"));var t=this;if(e&&("function"==typeof e||"object"==typeof e))try{var n=0,i=e.then;if("function"==typeof i)return void i.call(e,function(e){n++||t.resolve(e)},function(e){n++||t.reject(e)})}catch(e){return void(n||this.reject(e))}this.state=r,this.v=e,t.c&&s(function(){for(var n=0,i=t.c.length;n]*>)(.*)/i,/(.*)(<\/script>)(.*)/i],o=0,a=!0;t=t.split("\n");for(var u=0;u=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(n=o+"/"+n,i="/"===o.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(e){var i=n.isAbsolute(e),s="/"===o(e,-1);return(e=t(r(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&s&&(e+="/"),(i?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var i=r(e.split("/")),s=r(t.split("/")),o=Math.min(i.length,s.length),a=o,u=0;u1)for(var n=1;n= 8.8",https:!0,_http_server:">= 0.11",_linklist:"< 8",module:!0,net:!0,os:!0,path:!0,perf_hooks:">= 8.5",process:">= 1",punycode:!0,querystring:!0,readline:!0,repl:!0,stream:!0,string_decoder:!0,sys:!0,timers:!0,tls:!0,tty:!0,url:!0,util:!0,v8:">= 1",vm:!0,zlib:!0}},{}],37:[function(e,t,n){(function(n){function r(e){if(!0===e)return!0;for(var t=e.split(" "),n=t[0],r=t[1].split("."),s=0;s<3;++s){var o=Number(i[s]||0),a=Number(r[s]||0);if(o!==a)return"<"===n?o="===n&&o>=a}return!1}var i=n.versions&&n.versions.node&&n.versions.node.split(".")||[],s=e("./core.json"),o={};for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(o[a]=r(s[a]));t.exports=o}).call(this,e("_process"))},{"./core.json":36,_process:32}],38:[function(e,t,n){var r=e("path"),i=e("fs"),s=r.parse||e("path-parse");t.exports=function(e,t){var n=t&&t.moduleDirectory?[].concat(t.moduleDirectory):["node_modules"],o=r.resolve(e);if(t&&!1===t.preserveSymlinks)try{o=i.realpathSync(o)}catch(e){if("ENOENT"!==e.code)throw e}var a="/";/^([A-Za-z]:)/.test(o)?a="":/^\\\\/.test(o)&&(a="\\\\");for(var u=[o],c=s(o);c.dir!==u[u.length-1];)u.push(c.dir),c=s(c.dir);var l=u.reduce(function(e,t){return e.concat(n.map(function(e){return r.join(a,t,e)}))},[]);return t&&t.paths?l.concat(t.paths):l}},{fs:7,path:30,"path-parse":31}],39:[function(e,t,n){var r=e("./core"),i=e("fs"),s=e("path"),o=e("./caller.js"),a=e("./node-modules-paths.js");t.exports=function(e,t){function n(e){if(l(e))return e;for(var t=0;t"))}return Object.keys(hostOptions).forEach(function(k){"host"===parseOpts[k]&&(parseOpts[k]=function(){try{return eval(hostOptions[k]),!0}catch(e){return!1}}())}),parseOpts.promises||parseOpts.es7||parseOpts.generators||parseOpts.engine?((parseOpts.promises||parseOpts.es7)&&parseOpts.generators&&(log("No valid 'use nodent' directive, assumed -es7 mode"),parseOpts=optionSets.es7),(parseOpts.generators||parseOpts.engine)&&(parseOpts.promises=!0),parseOpts.promises&&(parseOpts.es7=!0),parseOpts):null}function stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),"#!"===e.substring(0,2)&&(e="//"+e),e}function compileNodentedFile(e,t){return t=t||e.log,function(n,r,i){var s=stripBOM(fs.readFileSync(r,"utf8")),o=e.parse(s,r,i);i=i||parseCompilerOptions(o.ast,t,r),e.asynchronize(o,void 0,i,t),e.prettyPrint(o,i),n._compile(o.code,o.filename)}}function asyncify(e){return e=e||Thenable,function(t,n,r){if(Array.isArray(n)){var i=n;n=function(e,t){return i.indexOf(e)>=0}}else n=n||function(e,t){return!(e.match(/Sync$/)&&e.replace(/Sync$/,"")in t)};r||(r="");var s=Object.create(t);for(var o in s)!function(){var i=o;try{"function"!=typeof t[i]||s[i+r]&&s[i+r].isAsync||!n(i,s)||(s[i+r]=function(){var n=Array.prototype.slice.call(arguments);return new e(function(e,r){var s=function(t,n){if(t)return r(t);switch(arguments.length){case 0:return e();case 2:return e(n);default:return e(Array.prototype.slice.call(arguments,1))}};n.length>t[i].length?n.push(s):n[t[i].length-1]=s;t[i].apply(t,n)})},s[i+r].isAsync=!0)}catch(e){}}();return s.super=t,s}}function generateRequestHandler(e,t,n){var r={},i=this;t||(t=/\.njs$/),n?n.compiler||(n.compiler={}):n={compiler:{}};var s=copyObj([NodentCompiler.initialCodeGenOpts,n.compiler]);return function(o,a,u){function c(e){a.statusCode=500,a.write(e.toString()),a.end()}if(r[o.url])return a.setHeader("Content-Type",r[o.url].contentType),n.setHeaders&&n.setHeaders(a),a.write(r[o.url].output),void a.end();if(!(o.url.match(t)||n.htmlScriptRegex&&o.url.match(n.htmlScriptRegex)))return u&&u();var l=e+o.url;if(n.extensions&&!fs.existsSync(l))for(var p=0;p=0?this.covers[n]=require(e):this.covers[n]=require(__dirname+"/covers/"+e)),this.covers[n](this,t)}function prepareMappedStackTrace(e,t){return e+t.map(function(e){var t=e.getFileName();if(t&&NodentCompiler.prototype.smCache[t]){var n=NodentCompiler.prototype.smCache[t].smc.originalPositionFor({line:e.getLineNumber(),column:e.getColumnNumber()});if(n&&n.line){var r=e.toString();return"\n at "+r.substring(0,r.length-1)+" => …"+n.source+":"+n.line+":"+n.column+(e.getFunctionName()?")":"")}}return"\n at "+e}).join("")}function setGlobalEnvironment(e){var t={};t[defaultCodeGenOpts.$asyncbind]={value:$asyncbind,writable:!0,enumerable:!1,configurable:!0},t[defaultCodeGenOpts.$asyncspawn]={value:$asyncspawn,writable:!0,enumerable:!1,configurable:!0};try{Object.defineProperties(Function.prototype,t)}catch(t){e.log("Function prototypes already assigned: ",t.messsage)}defaultCodeGenOpts[defaultCodeGenOpts.$error]in global||(global[defaultCodeGenOpts[defaultCodeGenOpts.$error]]=globalErrorHandler),e.augmentObject&&Object.defineProperties(Object.prototype,{asyncify:{value:function(e,t,n){return asyncify(e)(this,t,n)},writable:!0,configurable:!0},isThenable:{value:function(){return Thenable.isThenable(this)},writable:!0,configurable:!0}}),Object[defaultCodeGenOpts.$makeThenable]=Thenable.resolve}function initialize(e){function t(n,r){if(!r.match(/nodent\/nodent\.js$/)){if(r.match(/node_modules\/nodent\/.*\.js$/))return stdJSLoader(n,r);for(var o=0;ot[n])return 1}return 0}(u.version,NodentCompiler.prototype.version)<0&&(u.originalNodentLoader=n.exports,n.exports=function(){var t=require.extensions[".js"],n=u.originalNodentLoader.apply(this,arguments);return u.jsCompiler=require.extensions[".js"],require.extensions[".js"]=t,setGlobalEnvironment(e),n},Object.keys(u.originalNodentLoader).forEach(function(e){n.exports[e]=u.originalNodentLoader[e]}),i.push(u),i=i.sort(function(e,t){return t.path.length-e.path.length})))}function n(t){if(Array.isArray(t))return t.forEach(n);if(require.extensions[t]){Object.keys(e).filter(function(t){return compiler[t]!=e[t]}).length&&e.log("File extension "+t+" already configured for async/await compilation.")}require.extensions[t]=compileNodentedFile(compiler,e.log)}if(e){for(var r in e)if("use"!==r&&!config.hasOwnProperty(r))throw new Error("NoDent: unknown option: "+r+"="+JSON.stringify(e[r]))}else e={};compiler?compiler.setOptions(e):(Object.keys(config).forEach(function(t){t in e||(e[t]=config[t])}),compiler=new NodentCompiler(e)),e.dontMapStackTraces||(Error.prepareStackTrace=prepareMappedStackTrace),setGlobalEnvironment(e);var i=[];if(!e.dontInstallRequireHook){if(!stdJSLoader){stdJSLoader=require.extensions[".js"];var s=compileNodentedFile(compiler,e.log);require.extensions[".js"]=t}e.extension&&n(e.extension)}return e.use&&(Array.isArray(e.use)?(e.log("Warning: nodent({use:[...]}) is deprecated. Use nodent.require(module,options)\n"+(new Error).stack.split("\n")[2]),e.use.length&&e.use.forEach(function(e){compiler[e]=compiler.require(e)})):(e.log("Warning: nodent({use:{...}}) is deprecated. Use nodent.require(module,options)\n"+(new Error).stack.split("\n")[2]),Object.keys(e.use).forEach(function(t){compiler[t]=compiler.require(t,e.use[t])}))),compiler}function runFromCLI(){function e(e,n){try{var s,o;if(r.fromast){if(e=JSON.parse(e),s={origCode:"",filename:t,ast:e},!(o=parseCompilerOptions(e,i.log))){var a=r.use?'"use nodent-'+r.use+'";':'"use nodent";';o=parseCompilerOptions(a,i.log),console.warn("/* "+t+": No 'use nodent*' directive, assumed "+a+" */")}}else(o=parseCompilerOptions(r.use?'"use nodent-'+r.use+'";':e,i.log))||(o=parseCompilerOptions('"use nodent";',i.log),r.dest||console.warn("/* "+t+": 'use nodent*' directive missing/ignored, assumed 'use nodent;' */")),s=i.parse(e,t,o);if(r.parseast||r.pretty||i.asynchronize(s,void 0,o,i.log),i.prettyPrint(s,o),r.out||r.pretty||r.dest){if(r.dest&&!n)throw new Error("Can't write unknown file to "+r.dest);var u="";r.runtime&&(u+="Function.prototype.$asyncbind = "+Function.prototype.$asyncbind.toString()+";\n",u+="global.$error = global.$error || "+global.$error.toString()+";\n"),u+=s.code,n&&r.dest?(fs.writeFileSync(r.dest+n,u),console.log("Compiled",r.dest+n)):console.log(u)}(r.minast||r.parseast)&&console.log(JSON.stringify(s.ast,function(e,t){return"$"===e[0]||e.match(/^(start|end|loc)$/)?void 0:t},2,null)),r.ast&&console.log(JSON.stringify(s.ast,function(e,t){return"$"===e[0]?void 0:t},0)),r.exec&&new Function(s.code)()}catch(e){console.error(e)}}var t,n=require("path"),r=(process.env.NODENT_OPTS&&JSON.parse(process.env.NODENT_OPTS),function(e){for(var t=[],n=e||2;n0",engine:"(async ()=>0)",noRuntime:"Promise"};NodentCompiler.prototype.Thenable=Thenable,NodentCompiler.prototype.EagerThenable=$asyncbind.EagerThenableFactory,NodentCompiler.prototype.asyncify=asyncify,NodentCompiler.prototype.require=requireCover,NodentCompiler.prototype.generateRequestHandler=generateRequestHandler,NodentCompiler.prototype.$asyncspawn=$asyncspawn,NodentCompiler.prototype.$asyncbind=$asyncbind,NodentCompiler.prototype.parseCompilerOptions=parseCompilerOptions,$asyncbind.call($asyncbind);var compiler;initialize.setDefaultCompileOptions=function(e,t){return e&&Object.keys(e).forEach(function(t){if(!(t in defaultCodeGenOpts))throw new Error("NoDent: unknown compiler option: "+t);defaultCodeGenOpts[t]=e[t]}),t&&Object.keys(t).forEach(function(e){if(!(e in t))throw new Error("NoDent: unknown configuration option: "+e);config[e]=t[e]}),initialize},initialize.setCompileOptions=function(e,t){return optionSet[e]=optionSet[e]||copyObj([defaultCodeGenOpts]),t&&Object.keys(t).forEach(function(n){if(!(n in defaultCodeGenOpts))throw new Error("NoDent: unknown compiler option: "+n);optionSet[e][n]=t[n]}),initialize},initialize.asyncify=asyncify,initialize.Thenable=$asyncbind.Thenable,initialize.EagerThenable=$asyncbind.EagerThenableFactory,module.exports=initialize,require.main===module&&process.argv.length>=3&&runFromCLI()}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},"/node_modules/nodent")},{"./htmlScriptParser":29,_process:32,fs:7,"nodent-compiler":10,"nodent-runtime":26,path:30,resolve:33}]},{},[]); \ No newline at end of file diff --git a/tools/eslint/node_modules/ajv/dist/regenerator.min.js b/tools/eslint/node_modules/ajv/dist/regenerator.min.js index 0abd2280ef24a5..0b05fb9cf684d8 100644 --- a/tools/eslint/node_modules/ajv/dist/regenerator.min.js +++ b/tools/eslint/node_modules/ajv/dist/regenerator.min.js @@ -1,2 +1,2 @@ /* regenerator 0.10.0: Source transformer enabling ECMAScript 6 generator functions (yield) in JavaScript-of-today (ES5) */ -require=function e(t,r,n){function i(a,o){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!o&&u)return u(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return i(r||e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var s="function"==typeof require&&require,a=0;a=0;o--)if(u[o]!==l[o])return!1;for(o=u.length-1;o>=0;o--)if(a=u[o],!f(e[a],t[a],r,n))return!1;return!0}function y(e,t,r){f(e,t,!0)&&p(e,t,r,"notDeepStrictEqual",y)}function g(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function b(e){var t;try{e()}catch(e){t=e}return t}function v(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=b(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&p(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&x.isError(i),o=!e&&i&&!r;if((a&&s&&g(i,r)||o)&&p(i,r,"Got unwanted exception"+n),e&&i&&r&&!g(i,r)||!e&&i)throw i}var x=e("util/"),E=Object.prototype.hasOwnProperty,A=Array.prototype.slice,D="foo"===function(){}.name,C=t.exports=h,S=/\s*function\s+([^\(\s]*)\s*/;C.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=c(this),this.generatedMessage=!0);var t=e.stackStartFunction||p;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=o(t),s=n.indexOf("\n"+i);if(s>=0){var a=n.indexOf("\n",s+1);n=n.substring(a+1)}this.stack=n}}},x.inherits(C.AssertionError,Error),C.fail=p,C.ok=h,C.equal=function(e,t,r){e!=t&&p(e,t,r,"==",C.equal)},C.notEqual=function(e,t,r){e==t&&p(e,t,r,"!=",C.notEqual)},C.deepEqual=function(e,t,r){f(e,t,!1)||p(e,t,r,"deepEqual",C.deepEqual)},C.deepStrictEqual=function(e,t,r){f(e,t,!0)||p(e,t,r,"deepStrictEqual",C.deepStrictEqual)},C.notDeepEqual=function(e,t,r){f(e,t,!1)&&p(e,t,r,"notDeepEqual",C.notDeepEqual)},C.notDeepStrictEqual=y,C.strictEqual=function(e,t,r){e!==t&&p(e,t,r,"===",C.strictEqual)},C.notStrictEqual=function(e,t,r){e===t&&p(e,t,r,"!==",C.notStrictEqual)},C.throws=function(e,t,r){v(!0,e,t,r)},C.doesNotThrow=function(e,t,r){v(!1,e,t,r)},C.ifError=function(e){if(e)throw e};var _=Object.keys||function(e){var t=[];for(var r in e)E.call(e,r)&&t.push(r);return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":613}],2:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("Noop").bases("Node").build(),i("DoExpression").bases("Expression").build("body").field("body",[i("Statement")]),i("Super").bases("Expression").build(),i("BindExpression").bases("Expression").build("object","callee").field("object",s(i("Expression"),null)).field("callee",i("Expression")),i("Decorator").bases("Node").build("expression").field("expression",i("Expression")),i("Property").field("decorators",s([i("Decorator")],null),n.null),i("MethodDefinition").field("decorators",s([i("Decorator")],null),n.null),i("MetaProperty").bases("Expression").build("meta","property").field("meta",i("Identifier")).field("property",i("Identifier")),i("ParenthesizedExpression").bases("Expression").build("expression").field("expression",i("Expression")),i("ImportSpecifier").bases("ModuleSpecifier").build("imported","local").field("imported",i("Identifier")),i("ImportDefaultSpecifier").bases("ModuleSpecifier").build("local"),i("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("local"),i("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",s(i("Declaration"),i("Expression"))),i("ExportNamedDeclaration").bases("Declaration").build("declaration","specifiers","source").field("declaration",s(i("Declaration"),null)).field("specifiers",[i("ExportSpecifier")],n.emptyArray).field("source",s(i("Literal"),null),n.null),i("ExportSpecifier").bases("ModuleSpecifier").build("local","exported").field("exported",i("Identifier")),i("ExportNamespaceSpecifier").bases("Specifier").build("exported").field("exported",i("Identifier")),i("ExportDefaultSpecifier").bases("Specifier").build("exported").field("exported",i("Identifier")),i("ExportAllDeclaration").bases("Declaration").build("exported","source").field("exported",s(i("Identifier"),null)).field("source",i("Literal")),i("CommentBlock").bases("Comment").build("value","leading","trailing"),i("CommentLine").bases("Comment").build("value","leading","trailing")}},{"../lib/shared":18,"../lib/types":19,"./es7":7}],3:[function(e,t,r){t.exports=function(t){t.use(e("./babel")),t.use(e("./flow"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("Directive").bases("Node").build("value").field("value",i("DirectiveLiteral")),i("DirectiveLiteral").bases("Node","Expression").build("value").field("value",String,n["use strict"]),i("BlockStatement").bases("Statement").build("body").field("body",[i("Statement")]).field("directives",[i("Directive")],n.emptyArray),i("Program").bases("Node").build("body").field("body",[i("Statement")]).field("directives",[i("Directive")],n.emptyArray),i("StringLiteral").bases("Literal").build("value").field("value",String),i("NumericLiteral").bases("Literal").build("value").field("value",Number),i("NullLiteral").bases("Literal").build(),i("BooleanLiteral").bases("Literal").build("value").field("value",Boolean),i("RegExpLiteral").bases("Literal").build("pattern","flags").field("pattern",String).field("flags",String);var a=s(i("Property"),i("ObjectMethod"),i("ObjectProperty"),i("SpreadProperty"));i("ObjectExpression").bases("Expression").build("properties").field("properties",[a]),i("ObjectMethod").bases("Node","Function").build("kind","key","params","body","computed").field("kind",s("method","get","set")).field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("params",[i("Pattern")]).field("body",i("BlockStatement")).field("computed",Boolean,n.false).field("generator",Boolean,n.false).field("async",Boolean,n.false).field("decorators",s([i("Decorator")],null),n.null),i("ObjectProperty").bases("Node").build("key","value").field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("value",s(i("Expression"),i("Pattern"))).field("computed",Boolean,n.false);var o=s(i("MethodDefinition"),i("VariableDeclarator"),i("ClassPropertyDefinition"),i("ClassProperty"),i("ClassMethod"));i("ClassBody").bases("Declaration").build("body").field("body",[o]),i("ClassMethod").bases("Declaration","Function").build("kind","key","params","body","computed","static").field("kind",s("get","set","method","constructor")).field("key",s(i("Literal"),i("Identifier"),i("Expression"))).field("params",[i("Pattern")]).field("body",i("BlockStatement")).field("computed",Boolean,n.false).field("static",Boolean,n.false).field("generator",Boolean,n.false).field("async",Boolean,n.false).field("decorators",s([i("Decorator")],null),n.null);var u=s(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"),i("SpreadProperty"),i("ObjectProperty"),i("RestProperty"));i("ObjectPattern").bases("Pattern").build("properties").field("properties",[u]).field("decorators",s([i("Decorator")],null),n.null),i("SpreadProperty").bases("Node").build("argument").field("argument",i("Expression")),i("RestProperty").bases("Node").build("argument").field("argument",i("Expression")),i("ForAwaitStatement").bases("Statement").build("left","right","body").field("left",s(i("VariableDeclaration"),i("Expression"))).field("right",i("Expression")).field("body",i("Statement")),i("Import").bases("Expression").build()}},{"../lib/shared":18,"../lib/types":19,"./babel":2,"./flow":9}],4:[function(e,t,r){t.exports=function(t){var r=t.use(e("../lib/types")).Type,n=r.def,i=r.or,s=t.use(e("../lib/shared")),a=s.defaults,o=s.geq;n("Printable").field("loc",i(n("SourceLocation"),null),a.null,!0),n("Node").bases("Printable").field("type",String).field("comments",i([n("Comment")],null),a.null,!0),n("SourceLocation").build("start","end","source").field("start",n("Position")).field("end",n("Position")).field("source",i(String,null),a.null),n("Position").build("line","column").field("line",o(1)).field("column",o(0)),n("File").bases("Node").build("program","name").field("program",n("Program")).field("name",i(String,null),a.null),n("Program").bases("Node").build("body").field("body",[n("Statement")]),n("Function").bases("Node").field("id",i(n("Identifier"),null),a.null).field("params",[n("Pattern")]).field("body",n("BlockStatement")),n("Statement").bases("Node"),n("EmptyStatement").bases("Statement").build(),n("BlockStatement").bases("Statement").build("body").field("body",[n("Statement")]),n("ExpressionStatement").bases("Statement").build("expression").field("expression",n("Expression")),n("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",n("Expression")).field("consequent",n("Statement")).field("alternate",i(n("Statement"),null),a.null),n("LabeledStatement").bases("Statement").build("label","body").field("label",n("Identifier")).field("body",n("Statement")),n("BreakStatement").bases("Statement").build("label").field("label",i(n("Identifier"),null),a.null),n("ContinueStatement").bases("Statement").build("label").field("label",i(n("Identifier"),null),a.null),n("WithStatement").bases("Statement").build("object","body").field("object",n("Expression")).field("body",n("Statement")),n("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",n("Expression")).field("cases",[n("SwitchCase")]).field("lexical",Boolean,a.false),n("ReturnStatement").bases("Statement").build("argument").field("argument",i(n("Expression"),null)),n("ThrowStatement").bases("Statement").build("argument").field("argument",n("Expression")),n("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",n("BlockStatement")).field("handler",i(n("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[n("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[n("CatchClause")],a.emptyArray).field("finalizer",i(n("BlockStatement"),null),a.null),n("CatchClause").bases("Node").build("param","guard","body").field("param",n("Pattern")).field("guard",i(n("Expression"),null),a.null).field("body",n("BlockStatement")),n("WhileStatement").bases("Statement").build("test","body").field("test",n("Expression")).field("body",n("Statement")),n("DoWhileStatement").bases("Statement").build("body","test").field("body",n("Statement")).field("test",n("Expression")),n("ForStatement").bases("Statement").build("init","test","update","body").field("init",i(n("VariableDeclaration"),n("Expression"),null)).field("test",i(n("Expression"),null)).field("update",i(n("Expression"),null)).field("body",n("Statement")),n("ForInStatement").bases("Statement").build("left","right","body").field("left",i(n("VariableDeclaration"),n("Expression"))).field("right",n("Expression")).field("body",n("Statement")),n("DebuggerStatement").bases("Statement").build(),n("Declaration").bases("Statement"),n("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",n("Identifier")),n("FunctionExpression").bases("Function","Expression").build("id","params","body"),n("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",i("var","let","const")).field("declarations",[n("VariableDeclarator")]),n("VariableDeclarator").bases("Node").build("id","init").field("id",n("Pattern")).field("init",i(n("Expression"),null)),n("Expression").bases("Node","Pattern"),n("ThisExpression").bases("Expression").build(),n("ArrayExpression").bases("Expression").build("elements").field("elements",[i(n("Expression"),null)]),n("ObjectExpression").bases("Expression").build("properties").field("properties",[n("Property")]),n("Property").bases("Node").build("kind","key","value").field("kind",i("init","get","set")).field("key",i(n("Literal"),n("Identifier"))).field("value",n("Expression")),n("SequenceExpression").bases("Expression").build("expressions").field("expressions",[n("Expression")]);var u=i("-","+","!","~","typeof","void","delete");n("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",u).field("argument",n("Expression")).field("prefix",Boolean,a.true);var l=i("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");n("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",l).field("left",n("Expression")).field("right",n("Expression"));var c=i("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");n("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",c).field("left",n("Pattern")).field("right",n("Expression"));var p=i("++","--");n("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",p).field("argument",n("Expression")).field("prefix",Boolean);var h=i("||","&&");n("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",n("Expression")).field("right",n("Expression")),n("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",n("Expression")).field("consequent",n("Expression")).field("alternate",n("Expression")),n("NewExpression").bases("Expression").build("callee","arguments").field("callee",n("Expression")).field("arguments",[n("Expression")]),n("CallExpression").bases("Expression").build("callee","arguments").field("callee",n("Expression")).field("arguments",[n("Expression")]),n("MemberExpression").bases("Expression").build("object","property","computed").field("object",n("Expression")).field("property",i(n("Identifier"),n("Expression"))).field("computed",Boolean,function(){var e=this.property.type;return"Literal"===e||"MemberExpression"===e||"BinaryExpression"===e}),n("Pattern").bases("Node"),n("SwitchCase").bases("Node").build("test","consequent").field("test",i(n("Expression"),null)).field("consequent",[n("Statement")]),n("Identifier").bases("Node","Expression","Pattern").build("name").field("name",String),n("Literal").bases("Node","Expression").build("value").field("value",i(String,Boolean,null,Number,RegExp)).field("regex",i({pattern:String,flags:String},null),function(){if(this.value instanceof RegExp){var e="";return this.value.ignoreCase&&(e+="i"),this.value.multiline&&(e+="m"),this.value.global&&(e+="g"),{pattern:this.value.source,flags:e}}return null}),n("Comment").bases("Printable").field("value",String).field("leading",Boolean,a.true).field("trailing",Boolean,a.false)}},{"../lib/shared":18,"../lib/types":19}],5:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or;n("XMLDefaultDeclaration").bases("Declaration").field("namespace",n("Expression")),n("XMLAnyName").bases("Expression"),n("XMLQualifiedIdentifier").bases("Expression").field("left",i(n("Identifier"),n("XMLAnyName"))).field("right",i(n("Identifier"),n("Expression"))).field("computed",Boolean),n("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",i(n("Identifier"),n("Expression"))).field("computed",Boolean),n("XMLAttributeSelector").bases("Expression").field("attribute",n("Expression")),n("XMLFilterExpression").bases("Expression").field("left",n("Expression")).field("right",n("Expression")),n("XMLElement").bases("XML","Expression").field("contents",[n("XML")]),n("XMLList").bases("XML","Expression").field("contents",[n("XML")]),n("XML").bases("Node"),n("XMLEscape").bases("XML").field("expression",n("Expression")),n("XMLText").bases("XML").field("text",String),n("XMLStartTag").bases("XML").field("contents",[n("XML")]),n("XMLEndTag").bases("XML").field("contents",[n("XML")]),n("XMLPointTag").bases("XML").field("contents",[n("XML")]),n("XMLName").bases("XML").field("contents",i(String,[n("XML")])),n("XMLAttribute").bases("XML").field("value",String),n("XMLCdata").bases("XML").field("contents",String),n("XMLComment").bases("XML").field("contents",String),n("XMLProcessingInstruction").bases("XML").field("target",String).field("contents",i(String,null))}},{"../lib/types":19,"./core":4}],6:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("Function").field("generator",Boolean,s.false).field("expression",Boolean,s.false).field("defaults",[i(n("Expression"),null)],s.emptyArray).field("rest",i(n("Identifier"),null),s.null),n("RestElement").bases("Pattern").build("argument").field("argument",n("Pattern")),n("SpreadElementPattern").bases("Pattern").build("argument").field("argument",n("Pattern")),n("FunctionDeclaration").build("id","params","body","generator","expression"),n("FunctionExpression").build("id","params","body","generator","expression"),n("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,s.null).field("body",i(n("BlockStatement"),n("Expression"))).field("generator",!1,s.false),n("YieldExpression").bases("Expression").build("argument","delegate").field("argument",i(n("Expression"),null)).field("delegate",Boolean,s.false),n("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",n("Expression")).field("blocks",[n("ComprehensionBlock")]).field("filter",i(n("Expression"),null)),n("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",n("Expression")).field("blocks",[n("ComprehensionBlock")]).field("filter",i(n("Expression"),null)),n("ComprehensionBlock").bases("Node").build("left","right","each").field("left",n("Pattern")).field("right",n("Expression")).field("each",Boolean),n("Property").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("value",i(n("Expression"),n("Pattern"))).field("method",Boolean,s.false).field("shorthand",Boolean,s.false).field("computed",Boolean,s.false),n("PropertyPattern").bases("Pattern").build("key","pattern").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("pattern",n("Pattern")).field("computed",Boolean,s.false),n("ObjectPattern").bases("Pattern").build("properties").field("properties",[i(n("PropertyPattern"),n("Property"))]),n("ArrayPattern").bases("Pattern").build("elements").field("elements",[i(n("Pattern"),null)]),n("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",i("constructor","method","get","set")).field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("value",n("Function")).field("computed",Boolean,s.false).field("static",Boolean,s.false),n("SpreadElement").bases("Node").build("argument").field("argument",n("Expression")),n("ArrayExpression").field("elements",[i(n("Expression"),n("SpreadElement"),n("RestElement"),null)]),n("NewExpression").field("arguments",[i(n("Expression"),n("SpreadElement"))]),n("CallExpression").field("arguments",[i(n("Expression"),n("SpreadElement"))]),n("AssignmentPattern").bases("Pattern").build("left","right").field("left",n("Pattern")).field("right",n("Expression"));var a=i(n("MethodDefinition"),n("VariableDeclarator"),n("ClassPropertyDefinition"),n("ClassProperty"));n("ClassProperty").bases("Declaration").build("key").field("key",i(n("Literal"),n("Identifier"),n("Expression"))).field("computed",Boolean,s.false),n("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",a),n("ClassBody").bases("Declaration").build("body").field("body",[a]),n("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",i(n("Identifier"),null)).field("body",n("ClassBody")).field("superClass",i(n("Expression"),null),s.null),n("ClassExpression").bases("Expression").build("id","body","superClass").field("id",i(n("Identifier"),null),s.null).field("body",n("ClassBody")).field("superClass",i(n("Expression"),null),s.null).field("implements",[n("ClassImplements")],s.emptyArray),n("ClassImplements").bases("Node").build("id").field("id",n("Identifier")).field("superClass",i(n("Expression"),null),s.null),n("Specifier").bases("Node"),n("ModuleSpecifier").bases("Specifier").field("local",i(n("Identifier"),null),s.null).field("id",i(n("Identifier"),null),s.null).field("name",i(n("Identifier"),null),s.null),n("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",n("Expression")).field("quasi",n("TemplateLiteral")),n("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[n("TemplateElement")]).field("expressions",[n("Expression")]),n("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean)}},{"../lib/shared":18,"../lib/types":19,"./core":4}],7:[function(e,t,r){t.exports=function(t){t.use(e("./es6"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=(r.builtInTypes,t.use(e("../lib/shared")).defaults);n("Function").field("async",Boolean,s.false),n("SpreadProperty").bases("Node").build("argument").field("argument",n("Expression")),n("ObjectExpression").field("properties",[i(n("Property"),n("SpreadProperty"))]),n("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",n("Pattern")),n("ObjectPattern").field("properties",[i(n("Property"),n("PropertyPattern"),n("SpreadPropertyPattern"))]),n("AwaitExpression").bases("Expression").build("argument","all").field("argument",i(n("Expression"),null)).field("all",Boolean,s.false)}},{"../lib/shared":18,"../lib/types":19,"./es6":6}],8:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=t.use(e("../lib/shared")).defaults,i=r.Type.def,s=r.Type.or;i("VariableDeclaration").field("declarations",[s(i("VariableDeclarator"),i("Identifier"))]),i("Property").field("value",s(i("Expression"),i("Pattern"))),i("ArrayPattern").field("elements",[s(i("Pattern"),i("SpreadElement"),null)]),i("ObjectPattern").field("properties",[s(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"),i("SpreadProperty"))]),i("ExportSpecifier").bases("ModuleSpecifier").build("id","name"),i("ExportBatchSpecifier").bases("Specifier").build(),i("ImportSpecifier").bases("ModuleSpecifier").build("id","name"),i("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("id"),i("ImportDefaultSpecifier").bases("ModuleSpecifier").build("id"),i("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",s(i("Declaration"),i("Expression"),null)).field("specifiers",[s(i("ExportSpecifier"),i("ExportBatchSpecifier"))],n.emptyArray).field("source",s(i("Literal"),null),n.null),i("ImportDeclaration").bases("Declaration").build("specifiers","source","importKind").field("specifiers",[s(i("ImportSpecifier"),i("ImportNamespaceSpecifier"),i("ImportDefaultSpecifier"))],n.emptyArray).field("source",i("Literal")).field("importKind",s("value","type"),function(){return"value"}),i("Block").bases("Comment").build("value","leading","trailing"),i("Line").bases("Comment").build("value","leading","trailing")}},{"../lib/shared":18,"../lib/types":19,"./es7":7}],9:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("Type").bases("Node"),n("AnyTypeAnnotation").bases("Type").build(),n("EmptyTypeAnnotation").bases("Type").build(),n("MixedTypeAnnotation").bases("Type").build(),n("VoidTypeAnnotation").bases("Type").build(),n("NumberTypeAnnotation").bases("Type").build(),n("NumberLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),n("NumericLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),n("StringTypeAnnotation").bases("Type").build(),n("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",String).field("raw",String),n("BooleanTypeAnnotation").bases("Type").build(),n("BooleanLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Boolean).field("raw",String),n("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",n("Type")),n("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",n("Type")),n("NullLiteralTypeAnnotation").bases("Type").build(),n("NullTypeAnnotation").bases("Type").build(),n("ThisTypeAnnotation").bases("Type").build(),n("ExistsTypeAnnotation").bases("Type").build(),n("ExistentialTypeParam").bases("Type").build(),n("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[n("FunctionTypeParam")]).field("returnType",n("Type")).field("rest",i(n("FunctionTypeParam"),null)).field("typeParameters",i(n("TypeParameterDeclaration"),null)),n("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",n("Identifier")).field("typeAnnotation",n("Type")).field("optional",Boolean),n("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",n("Type")),n("ObjectTypeAnnotation").bases("Type").build("properties","indexers","callProperties").field("properties",[n("ObjectTypeProperty")]).field("indexers",[n("ObjectTypeIndexer")],s.emptyArray).field("callProperties",[n("ObjectTypeCallProperty")],s.emptyArray).field("exact",Boolean,s.false),n("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",i(n("Literal"),n("Identifier"))).field("value",n("Type")).field("optional",Boolean).field("variance",i("plus","minus",null),s.null),n("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",n("Identifier")).field("key",n("Type")).field("value",n("Type")).field("variance",i("plus","minus",null),s.null),n("ObjectTypeCallProperty").bases("Node").build("value").field("value",n("FunctionTypeAnnotation")).field("static",Boolean,s.false),n("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",i(n("Identifier"),n("QualifiedTypeIdentifier"))).field("id",n("Identifier")),n("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",i(n("Identifier"),n("QualifiedTypeIdentifier"))).field("typeParameters",i(n("TypeParameterInstantiation"),null)),n("MemberTypeAnnotation").bases("Type").build("object","property").field("object",n("Identifier")).field("property",i(n("MemberTypeAnnotation"),n("GenericTypeAnnotation"))),n("UnionTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",n("Type")),n("Identifier").field("typeAnnotation",i(n("TypeAnnotation"),null),s.null),n("TypeParameterDeclaration").bases("Node").build("params").field("params",[n("TypeParameter")]),n("TypeParameterInstantiation").bases("Node").build("params").field("params",[n("Type")]),n("TypeParameter").bases("Type").build("name","variance","bound").field("name",String).field("variance",i("plus","minus",null),s.null).field("bound",i(n("TypeAnnotation"),null),s.null),n("Function").field("returnType",i(n("TypeAnnotation"),null),s.null).field("typeParameters",i(n("TypeParameterDeclaration"),null),s.null),n("ClassProperty").build("key","value","typeAnnotation","static").field("value",i(n("Expression"),null)).field("typeAnnotation",i(n("TypeAnnotation"),null)).field("static",Boolean,s.false).field("variance",i("plus","minus",null),s.null),n("ClassImplements").field("typeParameters",i(n("TypeParameterInstantiation"),null),s.null),n("InterfaceDeclaration").bases("Declaration").build("id","body","extends").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterDeclaration"),null),s.null).field("body",n("ObjectTypeAnnotation")).field("extends",[n("InterfaceExtends")]),n("DeclareInterface").bases("InterfaceDeclaration").build("id","body","extends"),n("InterfaceExtends").bases("Node").build("id").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterInstantiation"),null)),n("TypeAlias").bases("Declaration").build("id","typeParameters","right").field("id",n("Identifier")).field("typeParameters",i(n("TypeParameterDeclaration"),null)).field("right",n("Type")),n("DeclareTypeAlias").bases("TypeAlias").build("id","typeParameters","right"),n("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",n("Expression")).field("typeAnnotation",n("TypeAnnotation")),n("TupleTypeAnnotation").bases("Type").build("types").field("types",[n("Type")]),n("DeclareVariable").bases("Statement").build("id").field("id",n("Identifier")),n("DeclareFunction").bases("Statement").build("id").field("id",n("Identifier")),n("DeclareClass").bases("InterfaceDeclaration").build("id"),n("DeclareModule").bases("Statement").build("id","body").field("id",i(n("Identifier"),n("Literal"))).field("body",n("BlockStatement")),n("DeclareModuleExports").bases("Statement").build("typeAnnotation").field("typeAnnotation",n("Type")),n("DeclareExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",i(n("DeclareVariable"),n("DeclareFunction"),n("DeclareClass"),n("Type"),null)).field("specifiers",[i(n("ExportSpecifier"),n("ExportBatchSpecifier"))],s.emptyArray).field("source",i(n("Literal"),null),s.null),n("DeclareExportAllDeclaration").bases("Declaration").build("source").field("source",i(n("Literal"),null),s.null)}},{"../lib/shared":18,"../lib/types":19,"./es7":7}],10:[function(e,t,r){t.exports=function(t){t.use(e("./es7"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")).defaults;n("JSXAttribute").bases("Node").build("name","value").field("name",i(n("JSXIdentifier"),n("JSXNamespacedName"))).field("value",i(n("Literal"),n("JSXExpressionContainer"),null),s.null),n("JSXIdentifier").bases("Identifier").build("name").field("name",String),n("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",n("JSXIdentifier")).field("name",n("JSXIdentifier")),n("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",i(n("JSXIdentifier"),n("JSXMemberExpression"))).field("property",n("JSXIdentifier")).field("computed",Boolean,s.false);var a=i(n("JSXIdentifier"),n("JSXNamespacedName"),n("JSXMemberExpression"));n("JSXSpreadAttribute").bases("Node").build("argument").field("argument",n("Expression"));var o=[i(n("JSXAttribute"),n("JSXSpreadAttribute"))];n("JSXExpressionContainer").bases("Expression").build("expression").field("expression",n("Expression")),n("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",n("JSXOpeningElement")).field("closingElement",i(n("JSXClosingElement"),null),s.null).field("children",[i(n("JSXElement"),n("JSXExpressionContainer"),n("JSXText"),n("Literal"))],s.emptyArray).field("name",a,function(){return this.openingElement.name},!0).field("selfClosing",Boolean,function(){return this.openingElement.selfClosing},!0).field("attributes",o,function(){return this.openingElement.attributes},!0),n("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",a).field("attributes",o,s.emptyArray).field("selfClosing",Boolean,s.false),n("JSXClosingElement").bases("Node").build("name").field("name",a),n("JSXText").bases("Literal").build("value").field("value",String),n("JSXEmptyExpression").bases("Expression").build()}},{"../lib/shared":18,"../lib/types":19,"./es7":7}],11:[function(e,t,r){t.exports=function(t){t.use(e("./core"));var r=t.use(e("../lib/types")),n=r.Type.def,i=r.Type.or,s=t.use(e("../lib/shared")),a=s.geq,o=s.defaults;n("Function").field("body",i(n("BlockStatement"),n("Expression"))),n("ForInStatement").build("left","right","body","each").field("each",Boolean,o.false),n("ForOfStatement").bases("Statement").build("left","right","body").field("left",i(n("VariableDeclaration"),n("Expression"))).field("right",n("Expression")).field("body",n("Statement")),n("LetStatement").bases("Statement").build("head","body").field("head",[n("VariableDeclarator")]).field("body",n("Statement")),n("LetExpression").bases("Expression").build("head","body").field("head",[n("VariableDeclarator")]).field("body",n("Expression")),n("GraphExpression").bases("Expression").build("index","expression").field("index",a(0)).field("expression",n("Literal")),n("GraphIndexExpression").bases("Expression").build("index").field("index",a(0))}},{"../lib/shared":18,"../lib/types":19,"./core":4}],12:[function(e,t,r){t.exports=function(t){function r(e){var t=n.indexOf(e);return-1===t&&(t=n.length,n.push(e),i[t]=e(s)),i[t]}var n=[],i=[],s={};s.use=r;var a=r(e("./lib/types"));t.forEach(r),a.finalize();var o={Type:a.Type,builtInTypes:a.builtInTypes,namedTypes:a.namedTypes,builders:a.builders,defineMethod:a.defineMethod,getFieldNames:a.getFieldNames,getFieldValue:a.getFieldValue,eachField:a.eachField,someField:a.someField,getSupertypeNames:a.getSupertypeNames,astNodesAreEquivalent:r(e("./lib/equiv")),finalize:a.finalize,Path:r(e("./lib/path")),NodePath:r(e("./lib/node-path")),PathVisitor:r(e("./lib/path-visitor")),use:r};return o.visit=o.PathVisitor.visit,o}},{"./lib/equiv":13,"./lib/node-path":14,"./lib/path":16,"./lib/path-visitor":15,"./lib/types":19}],13:[function(e,t,r){t.exports=function(t){function r(e,t,r){return c.check(r)?r.length=0:r=null,i(e,t,r)}function n(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function i(e,t,r){return e===t||(c.check(e)?s(e,t,r):p.check(e)?a(e,t,r):h.check(e)?h.check(t)&&+e==+t:f.check(e)?f.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t)}function s(e,t,r){c.assert(e);var n=e.length;if(!c.check(t)||t.length!==n)return r&&r.push("length"),!1;for(var s=0;so)return!0;if(s===o&&"right"===this.name){if(r.right!==t)throw new Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(r.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(r.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===r.type&&p.check(t.value)&&"object"===this.name&&r.object===t;case"AssignmentExpression":case"ConditionalExpression":switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&r.callee===t;case"ConditionalExpression":return"test"===this.name&&r.test===t;case"MemberExpression":return"object"===this.name&&r.object===t;default:return!1}default:if("NewExpression"===r.type&&"callee"===this.name&&r.callee===t)return i(t)}return!(!0===e||this.canBeFirstInStatement()||!this.firstInStatement())};var y={};return[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){y[e]=t})}),m.canBeFirstInStatement=function(){var e=this.node;return!l.FunctionExpression.check(e)&&!l.ObjectExpression.check(e)},m.firstInStatement=function(){return s(this)},r}},{"./path":16,"./scope":17,"./types":19}],15:[function(e,t,r){var n=Object.prototype.hasOwnProperty;t.exports=function(t){function r(){if(!(this instanceof r))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=i(this),this._shouldVisitComments=n.call(this._methodNameTable,"Block")||n.call(this._methodNameTable,"Line"),this.Context=o(this),this._visiting=!1,this._changeReported=!1}function i(e){var t=Object.create(null);for(var r in e)/^visit[A-Z]/.test(r)&&(t[r.slice("visit".length)]=!0);for(var n=u.computeSupertypeLookupTable(t),i=Object.create(null),s=(t=Object.keys(n)).length,a=0;a=0&&(s[e.name=a]=e)}else i[e.name]=e.value,s[e.name]=e;if(i[e.name]!==e.value)throw new Error("");if(e.parentPath.get(e.name)!==e)throw new Error("");return e}var l=t.use(e("./types")),c=l.builtInTypes.array,p=l.builtInTypes.number,h=r.prototype;return h.getValueProperty=function(e){return this.value[e]},h.get=function(e){for(var t=this,r=arguments,n=r.length,i=0;i=e},a+" >= "+e)},r.defaults={null:function(){return null},emptyArray:function(){return[]},false:function(){return!1},true:function(){return!0},undefined:function(){}};var o=i.or(s.string,s.number,s.boolean,s.null,s.undefined);return r.isPrimitive=new i(function(e){if(null===e)return!0;var t=typeof e;return!("object"===t||"function"===t)},o.toString()),r}},{"../lib/types":19}],19:[function(e,t,r){var n=Array.prototype,i=n.slice,s=(n.map,n.forEach,Object.prototype),a=s.toString,o=a.call(function(){}),u=a.call(""),l=s.hasOwnProperty;t.exports=function(){function e(t,r){var n=this;if(!(n instanceof e))throw new Error("Type constructor cannot be invoked without 'new'");if(a.call(t)!==o)throw new Error(t+" is not a function");var i=a.call(r);if(i!==o&&i!==u)throw new Error(r+" is neither a function nor a string");Object.defineProperties(n,{name:{value:r},check:{value:function(e,r){var i=t.call(n,e,r);return!i&&r&&a.call(r)===o&&r(n,e),i}}})}function t(e){return _.check(e)?"{"+Object.keys(e).map(function(t){return t+": "+e[t]}).join(", ")+"}":S.check(e)?"["+e.map(t).join(", ")+"]":JSON.stringify(e)}function r(t,r){var n=a.call(t),i=new e(function(e){return a.call(e)===n},r);return A[r]=i,t&&"function"==typeof t.constructor&&(x.push(t.constructor),E.push(i)),i}function n(t,r){if(t instanceof e)return t;if(t instanceof c)return t.type;if(S.check(t))return e.fromArray(t);if(_.check(t))return e.fromObject(t);if(C.check(t)){var n=x.indexOf(t);return n>=0?E[n]:new e(t,r)}return new e(function(e){return e===t},k.check(r)?function(){return t+""}:r)}function s(e,t,r,i){var a=this;if(!(a instanceof s))throw new Error("Field constructor cannot be invoked without 'new'");D.assert(e);var o={name:{value:e},type:{value:t=n(t)},hidden:{value:!!i}};C.check(r)&&(o.defaultFn={value:r}),Object.defineProperties(a,o)}function c(t){var r=this;if(!(r instanceof c))throw new Error("Def constructor cannot be invoked without 'new'");Object.defineProperties(r,{typeName:{value:t},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new e(function(e,t){return r.check(e,t)},t)}})}function p(e){return e.replace(/^[A-Z]+/,function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}})}function h(e){return(e=p(e)).replace(/(Expression)?$/,"Statement")}function f(e){var t=c.fromValue(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw new Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function d(e,t){var r=c.fromValue(e);if(r){var n=r.allFields[t];if(n)return n.getValue(e)}return e&&e[t]}function m(e){var t=h(e);if(!B[t]){var r=B[p(e)];r&&(B[t]=function(){return B.expressionStatement(r.apply(B,arguments))})}}function y(e,t){t.length=0,t.push(e);for(var r=Object.create(null),n=0;n=0&&m(e.typeName)}},b.finalize=function(){Object.keys(T).forEach(function(e){T[e].finalize()})},b}},{}],20:[function(e,t,r){t.exports=e("./fork")([e("./def/core"),e("./def/es6"),e("./def/es7"),e("./def/mozilla"),e("./def/e4x"),e("./def/jsx"),e("./def/flow"),e("./def/esprima"),e("./def/babel"),e("./def/babel6")])},{"./def/babel":2,"./def/babel6":3,"./def/core":4,"./def/e4x":5,"./def/es6":6,"./def/es7":7,"./def/esprima":8,"./def/flow":9,"./def/jsx":10,"./def/mozilla":11,"./fork":12}],21:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return{keyword:e.cyan,capitalized:e.yellow,jsx_tag:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.grey,invalid:e.white.bgRed.bold,gutter:e.grey,marker:e.red.bold}}function s(e){var t=e.slice(-2),r=t[0],n=t[1],i=(0,o.matchToToken)(e);if("name"===i.type){if(l.default.keyword.isReservedWordES6(i.value))return"keyword";if(h.test(i.value)&&("<"===n[r-1]||"3&&void 0!==arguments[3]?arguments[3]:{};r=Math.max(r,0);var s=n.highlightCode&&c.default.supportsColor||n.forceColor,o=c.default;n.forceColor&&(o=new c.default.constructor({enabled:!0}));var u=function(e,t){return s?e(t):t},l=i(o);s&&(e=a(l,e));var h=n.linesAbove||2,f=n.linesBelow||3,d=e.split(p),m=Math.max(t-(h+1),0),y=Math.min(d.length,t+f);t||r||(m=0,y=d.length);var g=String(y).length,b=d.slice(m,y).map(function(e,n){var i=m+1+n,s=" "+(" "+i).slice(-g)+" | ";if(i===t){var a="";if(r){var o=e.slice(0,r-1).replace(/[^\t]/g," ");a=["\n ",u(l.gutter,s.replace(/\d/g," ")),o,u(l.marker,"^")].join("")}return[u(l.marker,">"),u(l.gutter,s),e,a].join("")}return" "+u(l.gutter,s)+e}).join("\n");return s?o.reset(b):b};var o=e("js-tokens"),u=n(o),l=n(e("esutils")),c=n(e("chalk")),p=/\r\n|[\n\r\u2028\u2029]/,h=/^[a-z][\w-]*$/i,f=/^[()\[\]{}]$/;t.exports=r.default},{chalk:24,esutils:28,"js-tokens":322}],22:[function(e,t,r){"use strict";t.exports=function(){return/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g}},{}],23:[function(e,t,r){"use strict";Object.defineProperty(t,"exports",{enumerable:!0,get:function(){var e={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};return e.colors.grey=e.colors.gray,Object.keys(e).forEach(function(t){var r=e[t];Object.keys(r).forEach(function(t){var n=r[t];e[t]=r[t]={open:"["+n[0]+"m",close:"["+n[1]+"m"}}),Object.defineProperty(e,t,{value:r,enumerable:!1})}),e}})},{}],24:[function(e,t,r){(function(r){"use strict";function n(e){this.enabled=e&&void 0!==e.enabled?e.enabled:c}function i(e){var t=function(){return s.apply(t,arguments)};return t._styles=e,t.enabled=this.enabled,t.__proto__=d,t}function s(){var e=arguments,t=e.length,r=0!==t&&String(arguments[0]);if(t>1)for(var n=1;n=97&&o<=122||o>=65&&o<=90||36===o||95===o;for(a=new Array(128),o=0;o<128;++o)a[o]=o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||36===o||95===o;t.exports={isDecimalDigit:function(e){return 48<=e&&e<=57},isHexDigit:function(e){return 48<=e&&e<=57||97<=e&&e<=102||65<=e&&e<=70},isOctalDigit:function(e){return e>=48&&e<=55},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&i.indexOf(e)>=0},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStartES5:function(t){return t<128?s[t]:n.NonAsciiIdentifierStart.test(e(t))},isIdentifierPartES5:function(t){return t<128?a[t]:n.NonAsciiIdentifierPart.test(e(t))},isIdentifierStartES6:function(t){return t<128?s[t]:r.NonAsciiIdentifierStart.test(e(t))},isIdentifierPartES6:function(t){return t<128?a[t]:r.NonAsciiIdentifierPart.test(e(t))}}}()},{}],27:[function(e,t,r){!function(){"use strict";function r(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function n(e,t){return!(!t&&"yield"===e)&&i(e,t)}function i(e,t){if(t&&r(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function s(e,t){return"null"===e||"true"===e||"false"===e||n(e,t)}function a(e,t){return"null"===e||"true"===e||"false"===e||i(e,t)}function o(e){var t,r,n;if(0===e.length)return!1;if(n=e.charCodeAt(0),!c.isIdentifierStartES5(n))return!1;for(t=1,r=e.length;t=r)return!1;if(!(56320<=(i=e.charCodeAt(t))&&i<=57343))return!1;n=u(n,i)}if(!s(n))return!1;s=c.isIdentifierPartES6}return!0}var c=e("./code");t.exports={isKeywordES5:n,isKeywordES6:i,isReservedWordES5:s,isReservedWordES6:a,isRestrictedWord:function(e){return"eval"===e||"arguments"===e},isIdentifierNameES5:o,isIdentifierNameES6:l,isIdentifierES5:function(e,t){return o(e)&&!s(e,t)},isIdentifierES6:function(e,t){return l(e)&&!a(e,t)}}}()},{"./code":26}],28:[function(e,t,r){!function(){"use strict";r.ast=e("./ast"),r.code=e("./code"),r.keyword=e("./keyword")}()},{"./ast":25,"./code":26,"./keyword":27}],29:[function(e,t,r){"use strict";var n=e("ansi-regex")();t.exports=function(e){return"string"==typeof e?e.replace(n,""):e}},{"ansi-regex":22}],30:[function(e,t,r){(function(e){"use strict";var r=e.argv,n=r.indexOf("--"),i=function(e){e="--"+e;var t=r.indexOf(e);return-1!==t&&(-1===n||t1&&void 0!==arguments[1]?arguments[1]:{};return t.filename=e,x(h.default.readFileSync(e,"utf8"),t)};var h=i(e("fs")),f=n(e("../util")),d=n(e("babel-messages")),m=n(e("babel-types")),y=i(e("babel-traverse")),g=i(e("../transformation/file/options/option-manager")),b=i(e("../transformation/pipeline"));r.util=f,r.messages=d,r.types=m,r.traverse=y.default,r.OptionManager=g.default,r.Pipeline=b.default;var v=new b.default,x=(r.analyse=v.analyse.bind(v),r.transform=v.transform.bind(v));r.transformFromAst=v.transformFromAst.bind(v)},{"../../package":73,"../helpers/resolve-plugin":38,"../helpers/resolve-preset":39,"../tools/build-external-helpers":42,"../transformation/file":43,"../transformation/file/options/config":47,"../transformation/file/options/option-manager":49,"../transformation/pipeline":54,"../util":57,"babel-messages":110,"babel-template":139,"babel-traverse":143,"babel-types":178,fs:191}],33:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){return["babel-plugin-"+e,e]},t.exports=r.default},{}],34:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){var t=["babel-preset-"+e,e],r=e.match(/^(@[^/]+)\/(.+)$/);if(r){var n=r[1],i=r[2];t.push(n+"/babel-preset-"+i)}return t},t.exports=r.default},{}],35:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator"));r.default=function(e,t){if(e&&t)return(0,s.default)(e,t,function(e,t){if(t&&Array.isArray(e)){for(var r=t.slice(0),n=e,s=Array.isArray(n),a=0,n=s?n:(0,i.default)(n);;){var o;if(s){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var u=o;r.indexOf(u)<0&&r.push(u)}return r}})};var s=n(e("lodash/mergeWith"));t.exports=r.default},{"babel-runtime/core-js/get-iterator":120,"lodash/mergeWith":527}],36:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t,r){if(e){if("Program"===e.type)return n.file(e,t||[],r||[]);if("File"===e.type)return e}throw new Error("Not a valid ast?")};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));t.exports=r.default},{"babel-types":178}],37:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){return e.reduce(function(e,r){return e||(0,n.default)(r,t)},null)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./resolve"));t.exports=r.default},{"./resolve":40}],38:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();return(0,s.default)((0,a.default)(e),t)};var s=i(e("./resolve-from-possible-names")),a=i(e("./get-possible-plugin-names"));t.exports=r.default}).call(this,e("_process"))},{"./get-possible-plugin-names":33,"./resolve-from-possible-names":37,_process:550}],39:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();return(0,s.default)((0,a.default)(e),t)};var s=i(e("./resolve-from-possible-names")),a=i(e("./get-possible-preset-names"));t.exports=r.default}).call(this,e("_process"))},{"./get-possible-preset-names":34,"./resolve-from-possible-names":37,_process:550}],40:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var s=i(e("babel-runtime/helpers/typeof"));r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.cwd();if("object"===(void 0===a.default?"undefined":(0,s.default)(a.default)))return null;var r=u[t];if(!r){r=new a.default;var i=o.default.join(t,".babelrc");r.id=i,r.filename=i,r.paths=a.default._nodeModulePaths(t),u[t]=r}try{return a.default._resolveFilename(e,r)}catch(e){return null}};var a=i(e("module")),o=i(e("path")),u={};t.exports=r.default}).call(this,e("_process"))},{_process:550,"babel-runtime/helpers/typeof":138,module:191,path:546}],41:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/map")),s=n(e("babel-runtime/helpers/classCallCheck")),a=n(e("babel-runtime/helpers/possibleConstructorReturn")),o=n(e("babel-runtime/helpers/inherits")),u=function(e){function t(){(0,s.default)(this,t);var r=(0,a.default)(this,e.call(this));return r.dynamicData={},r}return(0,o.default)(t,e),t.prototype.setDynamic=function(e,t){this.dynamicData[e]=t},t.prototype.get=function(t){if(this.has(t))return e.prototype.get.call(this,t);if(Object.prototype.hasOwnProperty.call(this.dynamicData,t)){var r=this.dynamicData[t]();return this.set(t,r),r}},t}(i.default);r.default=u,t.exports=r.default},{"babel-runtime/core-js/map":122,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137}],42:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function s(e,t){var r=[],n=f.functionExpression(null,[f.identifier("global")],f.blockStatement(r)),i=f.program([f.expressionStatement(f.callExpression(n,[l.get("selfGlobal")]))]);return r.push(f.variableDeclaration("var",[f.variableDeclarator(e,f.assignmentExpression("=",f.memberExpression(f.identifier("global"),e),f.objectExpression([])))])),t(r),i}function a(e,t){var r=[];return r.push(f.variableDeclaration("var",[f.variableDeclarator(e,f.identifier("global"))])),t(r),f.program([d({FACTORY_PARAMETERS:f.identifier("global"),BROWSER_ARGUMENTS:f.assignmentExpression("=",f.memberExpression(f.identifier("root"),e),f.objectExpression([])),COMMON_ARGUMENTS:f.identifier("exports"),AMD_ARGUMENTS:f.arrayExpression([f.stringLiteral("exports")]),FACTORY_BODY:r,UMD_ROOT:f.identifier("this")})])}function o(e,t){var r=[];return r.push(f.variableDeclaration("var",[f.variableDeclarator(e,f.objectExpression([]))])),t(r),r.push(f.expressionStatement(e)),f.program(r)}function u(e,t,r){l.list.forEach(function(n){if(!(r&&r.indexOf(n)<0)){var i=f.identifier(n);e.push(f.expressionStatement(f.assignmentExpression("=",f.memberExpression(t,i),l.get(n))))}})}r.__esModule=!0,r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"global",r=f.identifier("babelHelpers"),n=void 0,i={global:s,umd:a,var:o}[t];if(!i)throw new Error(p.get("unsupportedOutputType",t));return n=i(r,function(t){return u(t,r,e)}),(0,c.default)(n).code};var l=i(e("babel-helpers")),c=n(e("babel-generator")),p=i(e("babel-messages")),h=n(e("babel-template")),f=i(e("babel-types")),d=(0,h.default)('\n (function (root, factory) {\n if (typeof define === "function" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === "object") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n');t.exports=r.default},{"babel-generator":85,"babel-helpers":109,"babel-messages":110,"babel-template":139,"babel-types":178}],43:[function(e,t,r){(function(t){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0,r.File=void 0;var s=i(e("babel-runtime/core-js/get-iterator")),a=i(e("babel-runtime/core-js/object/create")),o=i(e("babel-runtime/core-js/object/assign")),u=i(e("babel-runtime/helpers/classCallCheck")),l=i(e("babel-runtime/helpers/possibleConstructorReturn")),c=i(e("babel-runtime/helpers/inherits")),p=i(e("babel-helpers")),h=n(e("./metadata")),f=i(e("convert-source-map")),d=i(e("./options/option-manager")),m=i(e("../plugin-pass")),y=e("babel-traverse"),g=i(y),b=i(e("source-map")),v=i(e("babel-generator")),x=i(e("babel-code-frame")),E=i(e("lodash/defaults")),A=i(e("./logger")),D=i(e("../../store")),C=e("babylon"),S=n(e("../../util")),_=i(e("path")),w=n(e("babel-types")),k=i(e("../../helpers/resolve")),F=i(e("../internal-plugins/block-hoist")),T=i(e("../internal-plugins/shadow-functions")),P=/^#!.*/,B=[[F.default],[T.default]],O={enter:function(e,t){var r=e.node.loc;r&&(t.loc=r,e.stop())}},j=function(r){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];(0,u.default)(this,n);var i=(0,l.default)(this,r.call(this));return i.pipeline=t,i.log=new A.default(i,e.filename||"unknown"),i.opts=i.initOptions(e),i.parserOpts={sourceType:i.opts.sourceType,sourceFileName:i.opts.filename,plugins:[]},i.pluginVisitors=[],i.pluginPasses=[],i.buildPluginsForOptions(i.opts),i.opts.passPerPreset&&(i.perPresetOpts=[],i.opts.presets.forEach(function(e){var t=(0,o.default)((0,a.default)(i.opts),e);i.perPresetOpts.push(t),i.buildPluginsForOptions(t)})),i.metadata={usedHelpers:[],marked:[],modules:{imports:[],exports:{exported:[],specifiers:[]}}},i.dynamicImportTypes={},i.dynamicImportIds={},i.dynamicImports=[],i.declarations={},i.usedHelpers={},i.path=null,i.ast={},i.code="",i.shebang="",i.hub=new y.Hub(i),i}return(0,c.default)(n,r),n.prototype.getMetadata=function(){for(var e=!1,t=this.ast.program.body,r=Array.isArray(t),n=0,t=r?t:(0,s.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var a=i;if(w.isModuleDeclaration(a)){e=!0;break}}e&&this.path.traverse(h,this)},n.prototype.initOptions=function(e){(e=new d.default(this.log,this.pipeline).init(e)).inputSourceMap&&(e.sourceMaps=!0),e.moduleId&&(e.moduleIds=!0),e.basename=_.default.basename(e.filename,_.default.extname(e.filename)),e.ignore=S.arrayify(e.ignore,S.regexify),e.only&&(e.only=S.arrayify(e.only,S.regexify)),(0,E.default)(e,{moduleRoot:e.sourceRoot}),(0,E.default)(e,{sourceRoot:e.moduleRoot}),(0,E.default)(e,{filenameRelative:e.filename});var t=_.default.basename(e.filenameRelative);return(0,E.default)(e,{sourceFileName:t,sourceMapTarget:t}),e},n.prototype.buildPluginsForOptions=function(e){if(Array.isArray(e.plugins)){for(var t=[],r=[],n=e.plugins.concat(B),i=Array.isArray(n),a=0,n=i?n:(0,s.default)(n);;){var o;if(i){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var u=o,l=u[0],c=u[1];t.push(l.visitor),r.push(new m.default(this,l,c)),l.manipulateOptions&&l.manipulateOptions(e,this.parserOpts,this)}this.pluginVisitors.push(t),this.pluginPasses.push(r)}},n.prototype.getModuleName=function(){var e=this.opts;if(!e.moduleIds)return null;if(null!=e.moduleId&&!e.getModuleId)return e.moduleId;var t=e.filenameRelative,r="";if(null!=e.moduleRoot&&(r=e.moduleRoot+"/"),!e.filenameRelative)return r+e.filename.replace(/^\//,"");if(null!=e.sourceRoot){var n=new RegExp("^"+e.sourceRoot+"/?");t=t.replace(n,"")}return t=t.replace(/\.(\w*?)$/,""),r+=t,r=r.replace(/\\/g,"/"),e.getModuleId?e.getModuleId(r)||r:r},n.prototype.resolveModuleSource=function(e){var t=this.opts.resolveModuleSource;return t&&(e=t(e,this.opts.filename)),e},n.prototype.addImport=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=e+":"+t,i=this.dynamicImportIds[n];if(!i){e=this.resolveModuleSource(e),i=this.dynamicImportIds[n]=this.scope.generateUidIdentifier(r);var s=[];"*"===t?s.push(w.importNamespaceSpecifier(i)):"default"===t?s.push(w.importDefaultSpecifier(i)):s.push(w.importSpecifier(i,w.identifier(t)));var a=w.importDeclaration(s,w.stringLiteral(e));a._blockHoist=3,this.path.unshiftContainer("body",a)}return i},n.prototype.addHelper=function(e){var t=this.declarations[e];if(t)return t;this.usedHelpers[e]||(this.metadata.usedHelpers.push(e),this.usedHelpers[e]=!0);var r=this.get("helperGenerator"),n=this.get("helpersNamespace");if(r){var i=r(e);if(i)return i}else if(n)return w.memberExpression(n,w.identifier(e));var s=(0,p.default)(e),a=this.declarations[e]=this.scope.generateUidIdentifier(e);return w.isFunctionExpression(s)&&!s.id?(s.body._compact=!0,s._generated=!0,s.id=a,s.type="FunctionDeclaration",this.path.unshiftContainer("body",s)):(s._compact=!0,this.scope.push({id:a,init:s,unique:!0})),a},n.prototype.addTemplateObject=function(e,t,r){var n=r.elements.map(function(e){return e.value}),i=e+"_"+r.elements.length+"_"+n.join(","),s=this.declarations[i];if(s)return s;var a=this.declarations[i]=this.scope.generateUidIdentifier("templateObject"),o=this.addHelper(e),u=w.callExpression(o,[t,r]);return u._compact=!0,this.scope.push({id:a,init:u,_blockHoist:1.9}),a},n.prototype.buildCodeFrameError=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:SyntaxError,n=e&&(e.loc||e._loc),i=new r(t);return n?i.loc=n.start:((0,g.default)(e,O,this.scope,i),i.message+=" (This is an error on an internal node. Probably an internal error",i.loc&&(i.message+=". Location has been estimated."),i.message+=")"),i},n.prototype.mergeSourceMap=function(e){var t=this.opts.inputSourceMap;if(t){var r=new b.default.SourceMapConsumer(t),n=new b.default.SourceMapConsumer(e),i=new b.default.SourceMapGenerator({file:r.file,sourceRoot:r.sourceRoot}),s=n.sources[0];r.eachMapping(function(e){var t=n.generatedPositionFor({line:e.generatedLine,column:e.generatedColumn,source:s});null!=t.column&&i.addMapping({source:e.source,original:null==e.source?null:{line:e.originalLine,column:e.originalColumn},generated:t})});var a=i.toJSON();return t.mappings=a.mappings,t}return e},n.prototype.parse=function(r){var n=C.parse,i=this.opts.parserOpts;if(i&&(i=(0,o.default)({},this.parserOpts,i)).parser){if("string"==typeof i.parser){var s=_.default.dirname(this.opts.filename)||t.cwd(),a=(0,k.default)(i.parser,s);if(!a)throw new Error("Couldn't find parser "+i.parser+' with "parse" method relative to directory '+s);n=e(a).parse}else n=i.parser;i.parser={parse:function(e){return(0,C.parse)(e,i)}}}this.log.debug("Parse start");var u=n(r,i||this.parserOpts);return this.log.debug("Parse stop"),u},n.prototype._addAst=function(e){this.path=y.NodePath.get({hub:this.hub,parentPath:null,parent:e,container:e,key:"program"}).setContext(),this.scope=this.path.scope,this.ast=e,this.getMetadata()},n.prototype.addAst=function(e){this.log.debug("Start set AST"),this._addAst(e),this.log.debug("End set AST")},n.prototype.transform=function(){for(var e=0;e=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}var o=a,u=o.plugin[e];u&&u.call(o,this)}},n.prototype.parseInputSourceMap=function(e){var t=this.opts;if(!1!==t.inputSourceMap){var r=f.default.fromSource(e);r&&(t.inputSourceMap=r.toObject(),e=f.default.removeComments(e))}return e},n.prototype.parseShebang=function(){var e=P.exec(this.code);e&&(this.shebang=e[0],this.code=this.code.replace(P,""))},n.prototype.makeResult=function(e){var t=e.code,r=e.map,n=e.ast,i=e.ignored,s={metadata:null,options:this.opts,ignored:!!i,code:null,ast:null,map:r||null};return this.opts.code&&(s.code=t),this.opts.ast&&(s.ast=n),this.opts.metadata&&(s.metadata=this.metadata),s},n.prototype.generate=function(){var r=this.opts,n=this.ast,i={ast:n};if(!r.code)return this.makeResult(i);var s=v.default;if(r.generatorOpts.generator&&"string"==typeof(s=r.generatorOpts.generator)){var a=_.default.dirname(this.opts.filename)||t.cwd(),u=(0,k.default)(s,a);if(!u)throw new Error("Couldn't find generator "+s+' with "print" method relative to directory '+a);s=e(u).print}this.log.debug("Generation start");var l=s(n,r.generatorOpts?(0,o.default)(r,r.generatorOpts):r,this.code);return i.code=l.code,i.map=l.map,this.log.debug("Generation end"),this.shebang&&(i.code=this.shebang+"\n"+i.code),i.map&&(i.map=this.mergeSourceMap(i.map)),"inline"!==r.sourceMaps&&"both"!==r.sourceMaps||(i.code+="\n"+f.default.fromObject(i.map).toComment()),"inline"===r.sourceMaps&&(i.map=null),this.makeResult(i)},n}(D.default);r.default=j,r.File=j}).call(this,e("_process"))},{"../../helpers/resolve":40,"../../store":41,"../../util":57,"../internal-plugins/block-hoist":52,"../internal-plugins/shadow-functions":53,"../plugin-pass":55,"./logger":44,"./metadata":45,"./options/option-manager":49,_process:550,"babel-code-frame":21,"babel-generator":85,"babel-helpers":109,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/object/assign":124,"babel-runtime/core-js/object/create":125,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137,"babel-traverse":143,"babel-types":178,babylon:186,"convert-source-map":58,"lodash/defaults":495,path:546,"source-map":72}],44:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("debug/node")),a=(0,s.default)("babel:verbose"),o=(0,s.default)("babel"),u=[],l=function(){function e(t,r){(0,i.default)(this,e),this.filename=r,this.file=t}return e.prototype._buildMessage=function(e){var t="[BABEL] "+this.filename;return e&&(t+=": "+e),t},e.prototype.warn=function(e){console.warn(this._buildMessage(e))},e.prototype.error=function(e){throw new(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Error)(this._buildMessage(e))},e.prototype.deprecate=function(e){this.file.opts&&this.file.opts.suppressDeprecationMessages||(e=this._buildMessage(e),u.indexOf(e)>=0||(u.push(e),console.error(e)))},e.prototype.verbose=function(e){a.enabled&&a(this._buildMessage(e))},e.prototype.debug=function(e){o.enabled&&o(this._buildMessage(e))},e.prototype.deopt=function(e,t){this.debug(t)},e}();r.default=l,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134,"debug/node":59}],45:[function(e,t,r){"use strict";r.__esModule=!0,r.ImportDeclaration=r.ModuleDeclaration=void 0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.ExportDeclaration=function(e,t){var r=e.node,s=r.source?r.source.value:null,a=t.metadata.modules.exports,o=e.get("declaration");if(o.isStatement()){var u=o.getBindingIdentifiers();for(var l in u)a.exported.push(l),a.specifiers.push({kind:"local",local:l,exported:e.isExportDefaultDeclaration()?"default":l})}if(e.isExportNamedDeclaration()&&r.specifiers)for(var c=r.specifiers,p=Array.isArray(c),h=0,c=p?c:(0,n.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if((h=c.next()).done)break;f=h.value}var d=f,m=d.exported.name;a.exported.push(m),i.isExportDefaultSpecifier(d)&&a.specifiers.push({kind:"external",local:m,exported:m,source:s}),i.isExportNamespaceSpecifier(d)&&a.specifiers.push({kind:"external-namespace",exported:m,source:s});var y=d.local;y&&(s&&a.specifiers.push({kind:"external",local:y.name,exported:m,source:s}),s||a.specifiers.push({kind:"local",local:y.name,exported:m}))}e.isExportAllDeclaration()&&a.specifiers.push({kind:"external-all",source:s})},r.Scope=function(e){e.skip()};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.ModuleDeclaration={enter:function(e,t){var r=e.node;r.source&&(r.source.value=t.resolveModuleSource(r.source.value))}},r.ImportDeclaration={exit:function(e,t){var r=e.node,i=[],s=[];t.metadata.modules.imports.push({source:r.source.value,imported:s,specifiers:i});for(var a=e.get("specifiers"),o=Array.isArray(a),u=0,a=o?a:(0,n.default)(a);;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l,p=c.node.local.name;if(c.isImportDefaultSpecifier()&&(s.push("default"),i.push({kind:"named",imported:"default",local:p})),c.isImportSpecifier()){var h=c.node.imported.name;s.push(h),i.push({kind:"named",imported:h,local:p})}c.isImportNamespaceSpecifier()&&(s.push("*"),i.push({kind:"namespace",local:p}))}}}},{"babel-runtime/core-js/get-iterator":120,"babel-types":178}],46:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=f[e];return null==t?f[e]=h.default.existsSync(e):t}r.__esModule=!0;var a=i(e("babel-runtime/core-js/object/assign")),o=i(e("babel-runtime/helpers/classCallCheck"));r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],r=e.filename,n=new m(t);return!1!==e.babelrc&&n.findConfigs(r),n.mergeConfig({options:e,alias:"base",dirname:r&&p.default.dirname(r)}),n.configs};var u=i(e("../../../helpers/resolve")),l=i(e("json5")),c=i(e("path-is-absolute")),p=i(e("path")),h=i(e("fs")),f={},d={},m=function(){function e(t){(0,o.default)(this,e),this.resolvedConfigs=[],this.configs=[],this.log=t}return e.prototype.findConfigs=function(e){if(e){(0,c.default)(e)||(e=p.default.join(n.cwd(),e));for(var t=!1,r=!1;e!==(e=p.default.dirname(e));){if(!t){var i=p.default.join(e,".babelrc");s(i)&&(this.addConfig(i),t=!0);var a=p.default.join(e,"package.json");!t&&s(a)&&(t=this.addConfig(a,"babel",JSON))}if(!r){var o=p.default.join(e,".babelignore");s(o)&&(this.addIgnoreConfig(o),r=!0)}if(r&&t)return}}},e.prototype.addIgnoreConfig=function(e){var t=h.default.readFileSync(e,"utf8").split("\n");(t=t.map(function(e){return e.replace(/#(.*?)$/,"").trim()}).filter(function(e){return!!e})).length&&this.mergeConfig({options:{ignore:t},alias:e,dirname:p.default.dirname(e)})},e.prototype.addConfig=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default;if(this.resolvedConfigs.indexOf(e)>=0)return!1;this.resolvedConfigs.push(e);var n=h.default.readFileSync(e,"utf8"),i=void 0;try{i=d[n]=d[n]||r.parse(n),t&&(i=i[t])}catch(t){throw t.message=e+": Error while parsing JSON - "+t.message,t}return this.mergeConfig({options:i,alias:e,dirname:p.default.dirname(e)}),!!i},e.prototype.mergeConfig=function(e){var t=e.options,r=e.alias,i=e.loc,s=e.dirname;if(!t)return!1;if(t=(0,a.default)({},t),s=s||n.cwd(),i=i||r,t.extends){var o=(0,u.default)(t.extends,s);o?this.addConfig(o):this.log&&this.log.error("Couldn't resolve extends clause of "+t.extends+" in "+r),delete t.extends}this.configs.push({options:t,alias:r,loc:i,dirname:s});var l=void 0,c=n.env.BABEL_ENV||n.env.NODE_ENV||"development";t.env&&(l=t.env[c],delete t.env),this.mergeConfig({options:l,alias:r+".env."+c,dirname:s})},e}();t.exports=r.default}).call(this,e("_process"))},{"../../../helpers/resolve":40,_process:550,"babel-runtime/core-js/object/assign":124,"babel-runtime/helpers/classCallCheck":134,fs:191,json5:324,path:546,"path-is-absolute":547}],47:[function(e,t,r){"use strict";t.exports={filename:{type:"filename",description:"filename to use when reading from stdin - this will be used in source-maps, errors etc",default:"unknown",shorthand:"f"},filenameRelative:{hidden:!0,type:"string"},inputSourceMap:{hidden:!0},env:{hidden:!0,default:{}},mode:{description:"",hidden:!0},retainLines:{type:"boolean",default:!1,description:"retain line numbers - will result in really ugly code"},highlightCode:{description:"enable/disable ANSI syntax highlighting of code frames (on by default)",type:"boolean",default:!0},suppressDeprecationMessages:{type:"boolean",default:!1,hidden:!0},presets:{type:"list",description:"",default:[]},plugins:{type:"list",default:[],description:""},ignore:{type:"list",description:"list of glob paths to **not** compile",default:[]},only:{type:"list",description:"list of glob paths to **only** compile"},code:{hidden:!0,default:!0,type:"boolean"},metadata:{hidden:!0,default:!0,type:"boolean"},ast:{hidden:!0,default:!0,type:"boolean"},extends:{type:"string",hidden:!0},comments:{type:"boolean",default:!0,description:"write comments to generated output (true by default)"},shouldPrintComment:{hidden:!0,description:"optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"},wrapPluginVisitorMethod:{hidden:!0,description:"optional callback to wrap all visitor methods"},compact:{type:"booleanString",default:"auto",description:"do not include superfluous whitespace characters and line terminators [true|false|auto]"},minified:{type:"boolean",default:!1,description:"save as much bytes when printing [true|false]"},sourceMap:{alias:"sourceMaps",hidden:!0},sourceMaps:{type:"booleanString",description:"[true|false|inline]",default:!1,shorthand:"s"},sourceMapTarget:{type:"string",description:"set `file` on returned source map"},sourceFileName:{type:"string",description:"set `sources[0]` on returned source map"},sourceRoot:{type:"filename",description:"the root from which all sources are relative"},babelrc:{description:"Whether or not to look up .babelrc and .babelignore files",type:"boolean",default:!0},sourceType:{description:"",default:"module"},auxiliaryCommentBefore:{type:"string",description:"print a comment before any injected non-user code"},auxiliaryCommentAfter:{type:"string",description:"print a comment after any injected non-user code"},resolveModuleSource:{hidden:!0},getModuleId:{hidden:!0},moduleRoot:{type:"filename",description:"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"},moduleIds:{type:"boolean",default:!1,shorthand:"M",description:"insert an explicit id for modules"},moduleId:{description:"specify a custom name for module ids",type:"string"},passPerPreset:{description:"Whether to spawn a traversal pass per a preset. By default all presets are merged.",type:"boolean",default:!1,hidden:!0},parserOpts:{description:"Options to pass into the parser, or to change parsers (parserOpts.parser)",default:!1},generatorOpts:{description:"Options to pass into the generator, or to change generators (generatorOpts.generator)",default:!1}}},{}],48:[function(e,t,r){"use strict";r.__esModule=!0,r.config=void 0,r.normaliseOptions=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in e){var r=e[t];if(null!=r){var s=i.default[t];if(s&&s.alias&&(s=i.default[s.alias]),s){var a=n[s.type];a&&(r=a(r)),e[t]=r}}}return e};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./parsers")),i=function(e){return e&&e.__esModule?e:{default:e}}(e("./config"));r.config=i.default},{"./config":47,"./parsers":50}],49:[function(e,t,r){(function(n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function s(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var a=s(e("babel-runtime/helpers/objectWithoutProperties")),o=s(e("babel-runtime/core-js/json/stringify")),u=s(e("babel-runtime/core-js/object/assign")),l=s(e("babel-runtime/core-js/get-iterator")),c=s(e("babel-runtime/helpers/typeof")),p=s(e("babel-runtime/helpers/classCallCheck")),h=i(e("../../../api/node")),f=s(e("../../plugin")),d=i(e("babel-messages")),m=e("./index"),y=s(e("../../../helpers/resolve-plugin")),g=s(e("../../../helpers/resolve-preset")),b=s(e("lodash/cloneDeepWith")),v=s(e("lodash/clone")),x=s(e("../../../helpers/merge")),E=s(e("./config")),A=s(e("./removed")),D=s(e("./build-config-chain")),C=s(e("path")),S=function(){function t(e){(0,p.default)(this,t),this.resolvedConfigs=[],this.options=t.createBareOptions(),this.log=e}return t.memoisePluginContainer=function(e,r,n,i){for(var s=t.memoisedPlugins,a=Array.isArray(s),o=0,s=a?s:(0,l.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var p=u;if(p.container===e)return p.plugin}var m=void 0;if("object"===(void 0===(m="function"==typeof e?e(h):e)?"undefined":(0,c.default)(m))){var y=new f.default(m,i);return t.memoisedPlugins.push({container:e,plugin:y}),y}throw new TypeError(d.get("pluginNotObject",r,n,void 0===m?"undefined":(0,c.default)(m))+r+n)},t.createBareOptions=function(){var e={};for(var t in E.default){var r=E.default[t];e[t]=(0,v.default)(r.default)}return e},t.normalisePlugin=function(e,r,n,i){if(!((e=e.__esModule?e.default:e)instanceof f.default)){if("function"!=typeof e&&"object"!==(void 0===e?"undefined":(0,c.default)(e)))throw new TypeError(d.get("pluginNotFunction",r,n,void 0===e?"undefined":(0,c.default)(e)));e=t.memoisePluginContainer(e,r,n,i)}return e.init(r,n),e},t.normalisePlugins=function(r,n,i){return i.map(function(i,s){var a=void 0,o=void 0;if(!i)throw new TypeError("Falsy value found in plugins");Array.isArray(i)?(a=i[0],o=i[1]):a=i;var u="string"==typeof a?a:r+"$"+s;if("string"==typeof a){var l=(0,y.default)(a,n);if(!l)throw new ReferenceError(d.get("pluginUnknown",a,r,s,n));a=e(l)}return a=t.normalisePlugin(a,r,s,u),[a,o]})},t.prototype.mergeOptions=function(e){var r=this,i=e.options,s=e.extending,a=e.alias,o=e.loc,l=e.dirname;if(a=a||"foreign",i){("object"!==(void 0===i?"undefined":(0,c.default)(i))||Array.isArray(i))&&this.log.error("Invalid options type for "+a,TypeError);var p=(0,b.default)(i,function(e){if(e instanceof f.default)return e});l=l||n.cwd(),o=o||a;for(var h in p)if(!E.default[h]&&this.log)if(A.default[h])this.log.error("Using removed Babel 5 option: "+a+"."+h+" - "+A.default[h].message,ReferenceError);else{var d="Unknown option: "+a+"."+h+". Check out http://babeljs.io/docs/usage/options/ for more information about options.";this.log.error(d+"\n\nA common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.",ReferenceError)}(0,m.normaliseOptions)(p),p.plugins&&(p.plugins=t.normalisePlugins(o,l,p.plugins)),p.presets&&(p.passPerPreset?p.presets=this.resolvePresets(p.presets,l,function(e,t){r.mergeOptions({options:e,extending:e,alias:t,loc:t,dirname:l})}):(this.mergePresets(p.presets,l),delete p.presets)),i===s?(0,u.default)(s,p):(0,x.default)(s||this.options,p)}},t.prototype.mergePresets=function(e,t){var r=this;this.resolvePresets(e,t,function(e,t){r.mergeOptions({options:e,alias:t,loc:t,dirname:C.default.dirname(t||"")})})},t.prototype.resolvePresets=function(t,r,n){return t.map(function(t){var i=void 0;if(Array.isArray(t)){if(t.length>2)throw new Error("Unexpected extra options "+(0,o.default)(t.slice(2))+" passed to preset.");var s=t;t=s[0],i=s[1]}var u=void 0;try{if("string"==typeof t){if(!(u=(0,g.default)(t,r)))throw new Error("Couldn't find preset "+(0,o.default)(t)+" relative to directory "+(0,o.default)(r));t=e(u)}if("object"===(void 0===t?"undefined":(0,c.default)(t))&&t.__esModule)if(t.default)t=t.default;else{var l=t;l.__esModule;t=(0,a.default)(l,["__esModule"])}if("object"===(void 0===t?"undefined":(0,c.default)(t))&&t.buildPreset&&(t=t.buildPreset),"function"!=typeof t&&void 0!==i)throw new Error("Options "+(0,o.default)(i)+" passed to "+(u||"a preset")+" which does not accept options.");if("function"==typeof t&&(t=t(h,i,{dirname:r})),"object"!==(void 0===t?"undefined":(0,c.default)(t)))throw new Error("Unsupported preset format: "+t+".");n&&n(t,u)}catch(e){throw u&&(e.message+=" (While processing preset: "+(0,o.default)(u)+")"),e}return t})},t.prototype.normaliseOptions=function(){var e=this.options;for(var t in E.default){var r=E.default[t],n=e[t];!n&&r.optional||(r.alias?e[r.alias]=e[r.alias]||n:e[t]=n)}},t.prototype.init=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,D.default)(e,this.log),r=Array.isArray(t),n=0,t=r?t:(0,l.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;this.mergeOptions(s)}return this.normaliseOptions(e),this.options},t}();r.default=S,S.memoisedPlugins=[],t.exports=r.default}).call(this,e("_process"))},{"../../../api/node":32,"../../../helpers/merge":35,"../../../helpers/resolve-plugin":38,"../../../helpers/resolve-preset":39,"../../plugin":56,"./build-config-chain":46,"./config":47,"./index":48,"./removed":51,_process:550,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/core-js/object/assign":124,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/objectWithoutProperties":136,"babel-runtime/helpers/typeof":138,"lodash/clone":491,"lodash/cloneDeepWith":493,path:546}],50:[function(e,t,r){"use strict";r.__esModule=!0,r.filename=void 0,r.boolean=function(e){return!!e},r.booleanString=function(e){return i.booleanify(e)},r.list=function(e){return i.list(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("slash")),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("../../../util"));r.filename=n.default},{"../../../util":57,slash:603}],51:[function(e,t,r){"use strict";t.exports={auxiliaryComment:{message:"Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"},blacklist:{message:"Put the specific transforms you want in the `plugins` option"},breakConfig:{message:"This is not a necessary option in Babel 6"},experimental:{message:"Put the specific transforms you want in the `plugins` option"},externalHelpers:{message:"Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"},extra:{message:""},jsxPragma:{message:"use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"},loose:{message:"Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."},metadataUsedHelpers:{message:"Not required anymore as this is enabled by default"},modules:{message:"Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"},nonStandard:{message:"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"},optional:{message:"Put the specific transforms you want in the `plugins` option"},sourceMapName:{message:"Use the `sourceMapTarget` option"},stage:{message:"Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"},whitelist:{message:"Put the specific transforms you want in the `plugins` option"}}},{}],52:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("../plugin")),s=n(e("lodash/sortBy"));r.default=new i.default({name:"internal.blockHoist",visitor:{Block:{exit:function(e){for(var t=e.node,r=!1,n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return t.code=!1,t.mode="lint",this.transform(e,t)},e.prototype.pretransform=function(e,t){var r=new o.default(t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r})},e.prototype.transform=function(e,t){var r=new o.default(t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r.transform()})},e.prototype.analyse=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2];return t.code=!1,r&&(t.plugins=t.plugins||[],t.plugins.push(new a.default({visitor:r}))),this.transform(e,t).metadata},e.prototype.transformFromAst=function(e,t,r){e=(0,s.default)(e);var n=new o.default(r,this);return n.wrap(t,function(){return n.addCode(t),n.addAst(e),n.transform()})},e}();r.default=u,t.exports=r.default},{"../helpers/normalize-ast":36,"./file":43,"./plugin":56,"babel-runtime/helpers/classCallCheck":134}],55:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("babel-runtime/helpers/possibleConstructorReturn")),a=n(e("babel-runtime/helpers/inherits")),o=n(e("../store")),u=(n(e("./file")),function(e){function t(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,i.default)(this,t);var o=(0,s.default)(this,e.call(this));return o.plugin=n,o.key=n.key,o.file=r,o.opts=a,o}return(0,a.default)(t,e),t.prototype.addHelper=function(){var e;return(e=this.file).addHelper.apply(e,arguments)},t.prototype.addImport=function(){var e;return(e=this.file).addImport.apply(e,arguments)},t.prototype.getModuleName=function(){var e;return(e=this.file).getModuleName.apply(e,arguments)},t.prototype.buildCodeFrameError=function(){var e;return(e=this.file).buildCodeFrameError.apply(e,arguments)},t}(o.default));r.default=u,t.exports=r.default},{"../store":41,"./file":43,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137}],56:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator")),s=n(e("babel-runtime/helpers/classCallCheck")),a=n(e("babel-runtime/helpers/possibleConstructorReturn")),o=n(e("babel-runtime/helpers/inherits")),u=n(e("./file/options/option-manager")),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-messages")),c=n(e("../store")),p=n(e("babel-traverse")),h=n(e("lodash/assign")),f=n(e("lodash/clone")),d=["enter","exit"],m=function(e){function t(r,n){(0,s.default)(this,t);var i=(0,a.default)(this,e.call(this));return i.initialized=!1,i.raw=(0,h.default)({},r),i.key=i.take("name")||n,i.manipulateOptions=i.take("manipulateOptions"),i.post=i.take("post"),i.pre=i.take("pre"),i.visitor=i.normaliseVisitor((0,f.default)(i.take("visitor"))||{}),i}return(0,o.default)(t,e),t.prototype.take=function(e){var t=this.raw[e];return delete this.raw[e],t},t.prototype.chain=function(e,t){if(!e[t])return this[t];if(!this[t])return e[t];var r=[e[t],this[t]];return function(){for(var e=void 0,t=arguments.length,n=Array(t),s=0;s=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l;if(c){var p=c.apply(this,n);null!=p&&(e=p)}}return e}},t.prototype.maybeInherit=function(e){var t=this.take("inherits");t&&(t=u.default.normalisePlugin(t,e,"inherits"),this.manipulateOptions=this.chain(t,"manipulateOptions"),this.post=this.chain(t,"post"),this.pre=this.chain(t,"pre"),this.visitor=p.default.visitors.merge([t.visitor,this.visitor]))},t.prototype.init=function(e,t){if(!this.initialized){this.initialized=!0,this.maybeInherit(e);for(var r in this.raw)throw new Error(l.get("pluginInvalidProperty",e,t,r))}},t.prototype.normaliseVisitor=function(e){for(var t=d,r=Array.isArray(t),n=0,t=r?t:(0,i.default)(t);;){var s;if(r){if(n>=t.length)break;s=t[n++]}else{if((n=t.next()).done)break;s=n.value}if(e[s])throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. Please target individual nodes.")}return p.default.explode(e),e},t}(c.default);r.default=m,t.exports=r.default},{"../store":41,"./file/options/option-manager":49,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137,"babel-traverse":143,"lodash/assign":488,"lodash/clone":491}],57:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var r=t||i.EXTENSIONS,n=m.default.extname(e);return(0,f.default)(r,n)}function s(e){return e?Array.isArray(e)?e:"string"==typeof e?e.split(","):[e]:[]}function a(e,t){return e?"boolean"==typeof e?a([e],t):"string"==typeof e?a(s(e),t):Array.isArray(e)?(t&&(e=e.map(t)),e):[e]:[]}function o(e,t){return"function"==typeof e?e(t):e.test(t)}r.__esModule=!0,r.inspect=r.inherits=void 0;var u=n(e("babel-runtime/core-js/get-iterator")),l=e("util");Object.defineProperty(r,"inherits",{enumerable:!0,get:function(){return l.inherits}}),Object.defineProperty(r,"inspect",{enumerable:!0,get:function(){return l.inspect}}),r.canCompile=i,r.list=s,r.regexify=function(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=new RegExp(e.map(c.default).join("|"),"i")),"string"==typeof e){e=(0,y.default)(e),((0,p.default)(e,"./")||(0,p.default)(e,"*/"))&&(e=e.slice(2)),(0,p.default)(e,"**/")&&(e=e.slice(3));var t=h.default.makeRe(e,{nocase:!0});return new RegExp(t.source.slice(1,-1),"i")}if((0,d.default)(e))return e;throw new TypeError("illegal type for regexify")},r.arrayify=a,r.booleanify=function(e){return"true"===e||1==e||!("false"===e||0==e||!e)&&e},r.shouldIgnore=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2];if(e=e.replace(/\\/g,"/"),r){for(var n=r,i=Array.isArray(n),s=0,n=i?n:(0,u.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}if(o(a,e))return!1}return!0}if(t.length)for(var l=t,c=Array.isArray(l),p=0,l=c?l:(0,u.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if((p=l.next()).done)break;h=p.value}if(o(h,e))return!0}return!1};var c=n(e("lodash/escapeRegExp")),p=n(e("lodash/startsWith")),h=n(e("minimatch")),f=n(e("lodash/includes")),d=n(e("lodash/isRegExp")),m=n(e("path")),y=n(e("slash"));i.EXTENSIONS=[".js",".jsx",".es6",".es"]},{"babel-runtime/core-js/get-iterator":120,"lodash/escapeRegExp":497,"lodash/includes":507,"lodash/isRegExp":519,"lodash/startsWith":532,minimatch:542,path:546,slash:603,util:613}],58:[function(e,t,r){(function(t){"use strict";function n(e){return new t(e,"base64").toString()}function i(e){return e.split(",").pop()}function s(e,t){var n=r.mapFileCommentRegex.exec(e),i=n[1]||n[2],s=u.resolve(t,i);try{return o.readFileSync(s,"utf8")}catch(e){throw new Error("An error occurred while trying to read the map file at "+s+"\n"+e)}}function a(e,t){(t=t||{}).isFileComment&&(e=s(e,t.commentFileDir)),t.hasComment&&(e=i(e)),t.isEncoded&&(e=n(e)),(t.isJSON||t.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}var o=e("fs"),u=e("path");Object.defineProperty(r,"commentRegex",{get:function(){return/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/gm}}),Object.defineProperty(r,"mapFileCommentRegex",{get:function(){return/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm}}),a.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},a.prototype.toBase64=function(){var e=this.toJSON();return new t(e).toString("base64")},a.prototype.toComment=function(e){var t="sourceMappingURL=data:application/json;charset=utf-8;base64,"+this.toBase64();return e&&e.multiline?"/*# "+t+" */":"//# "+t},a.prototype.toObject=function(){return JSON.parse(this.toJSON())},a.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(e,t)},a.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},a.prototype.getProperty=function(e){return this.sourcemap[e]},r.fromObject=function(e){return new a(e)},r.fromJSON=function(e){return new a(e,{isJSON:!0})},r.fromBase64=function(e){return new a(e,{isEncoded:!0})},r.fromComment=function(e){return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new a(e,{isEncoded:!0,hasComment:!0})},r.fromMapFileComment=function(e,t){return new a(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},r.fromSource=function(e){var t=e.match(r.commentRegex);return t?r.fromComment(t.pop()):null},r.fromMapFileSource=function(e,t){var n=e.match(r.mapFileCommentRegex);return n?r.fromMapFileComment(n.pop(),t):null},r.removeComments=function(e){return e.replace(r.commentRegex,"")},r.removeMapFileComments=function(e){return e.replace(r.mapFileCommentRegex,"")},r.generateMapFileComment=function(e,t){var r="sourceMappingURL="+e;return t&&t.multiline?"/*# "+r+" */":"//# "+r}}).call(this,e("buffer").Buffer)},{buffer:192,fs:191,path:546}],59:[function(e,t,r){t.exports=e("./src/node")},{"./src/node":61}],60:[function(e,t,r){function n(e){var t,n=0;for(t in e)n=(n<<5)-n+e.charCodeAt(t),n|=0;return r.colors[Math.abs(n)%r.colors.length]}function i(e){function t(){if(t.enabled){var e=t,n=+new Date,i=n-(s||n);e.diff=i,e.prev=s,e.curr=n,s=n;for(var a=new Array(arguments.length),o=0;o=0)return t}else{var r=i.toSetString(e);if(s.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},n.prototype.at=function(e){if(e>=0&&e>1;return 1==(1&e)?-t:t}var s=e("./base64");r.encode=function(e){var t,r="",i=n(e);do{t=31&i,(i>>>=5)>0&&(t|=32),r+=s.encode(t)}while(i>0);return r},r.decode=function(e,t,r){var n,a,o=e.length,u=0,l=0;do{if(t>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(a=s.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(32&a),u+=(a&=31)<0?t-u>1?n(u,t,i,s,a,o):o==r.LEAST_UPPER_BOUND?t1?n(e,u,i,s,a,o):o==r.LEAST_UPPER_BOUND?u:e<0?-1:e}r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.search=function(e,t,i,s){if(0===t.length)return-1;var a=n(-1,t.length,e,t,i,s||r.GREATEST_LOWER_BOUND);if(a<0)return-1;for(;a-1>=0&&0===i(t[a],t[a-1],!0);)--a;return a}},{}],66:[function(e,t,r){function n(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=i||s.compareByGeneratedPositionsInflated(e,t)<=0}function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var s=e("./util");i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(s.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},r.MappingList=i},{"./util":71}],67:[function(e,t,r){function n(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function i(e,t){return Math.round(e+Math.random()*(t-e))}function s(e,t,r,a){if(r=0){var s=this._originalMappings[i];if(void 0===e.column)for(var a=s.originalLine;s&&s.originalLine===a;)n.push({line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var l=s.originalColumn;s&&s.originalLine===t&&s.originalColumn==l;)n.push({line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return n},r.SourceMapConsumer=n,(i.prototype=Object.create(n.prototype)).consumer=n,i.fromSourceMap=function(e){var t=Object.create(i.prototype),r=t._names=l.fromArray(e._names.toArray(),!0),n=t._sources=l.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var a=e._mappings.toArray().slice(),u=t.__generatedMappings=[],c=t.__originalMappings=[],h=0,f=a.length;h1&&(r.source=m+i[1],m+=i[1],r.originalLine=f+i[2],f=r.originalLine,r.originalLine+=1,r.originalColumn=d+i[3],d=r.originalColumn,i.length>4&&(r.name=y+i[4],y+=i[4])),A.push(r),"number"==typeof r.originalLine&&E.push(r)}p(A,o.compareByGeneratedPositionsDeflated),this.__generatedMappings=A,p(E,o.compareByOriginalPositions),this.__originalMappings=E},i.prototype._findMapping=function(e,t,r,n,i,s){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return u.search(e,t,i,s)},i.prototype.computeColumnSpans=function(){for(var e=0;e=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var s=o.getArg(i,"source",null);null!==s&&(s=this._sources.at(s),null!=this.sourceRoot&&(s=o.join(this.sourceRoot,s)));var a=o.getArg(i,"name",null);return null!==a&&(a=this._names.at(a)),{source:s,line:o.getArg(i,"originalLine",null),column:o.getArg(i,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=o.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=o.urlParse(this.sourceRoot))){var n=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(n))return this.sourcesContent[this._sources.indexOf(n)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=o.getArg(e,"source");if(null!=this.sourceRoot&&(t=o.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};var r={source:t=this._sources.indexOf(t),originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===r.source)return{line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},r.BasicSourceMapConsumer=i,(a.prototype=Object.create(n.prototype)).constructor=n,a.prototype._version=3,Object.defineProperty(a.prototype,"sources",{get:function(){for(var e=[],t=0;t0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},n.prototype._serializeMappings=function(){for(var e,t,r,n,a=0,o=1,u=0,l=0,c=0,p=0,h="",f=this._mappings.toArray(),d=0,m=f.length;d0){if(!s.compareByGeneratedPositionsInflated(t,f[d-1]))continue;e+=","}e+=i.encode(t.generatedColumn-a),a=t.generatedColumn,null!=t.source&&(n=this._sources.indexOf(t.source),e+=i.encode(n-p),p=n,e+=i.encode(t.originalLine-1-l),l=t.originalLine-1,e+=i.encode(t.originalColumn-u),u=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=i.encode(r-c),c=r)),h+=e}return h},n.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=s.relative(t,e));var r=s.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},n.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},r.SourceMapGenerator=n},{"./array-set":62,"./base64-vlq":63,"./mapping-list":66,"./util":71}],70:[function(e,t,r){function n(e,t,r,n,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==i?null:i,this[o]=!0,null!=n&&this.add(n)}var i=e("./source-map-generator").SourceMapGenerator,s=e("./util"),a=/(\r?\n)/,o="$$$isSourceNode$$$";n.fromStringWithSourceMap=function(e,t,r){function i(e,t){if(null===e||void 0===e.source)o.add(t);else{var i=r?s.join(r,e.source):e.source;o.add(new n(e.originalLine,e.originalColumn,i,t,e.name))}}var o=new n,u=e.split(a),l=0,c=function(){function e(){return l=0;t--)this.prepend(e[t]);else{if(!e[o]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},n.prototype.walk=function(e){for(var t,r=0,n=this.children.length;r0){for(t=[],r=0;r=0;c--)"."===(a=u[c])?u.splice(c,1):".."===a?l++:l>0&&(""===a?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return""===(t=u.join("/"))&&(t=o?"/":"."),s?(s.path=t,i(s)):t}function a(e){return e}function o(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function u(e,t){return e===t?0:e>t?1:-1}r.getArg=function(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')};var l=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,c=/^data:.+\,.+$/;r.urlParse=n,r.urlGenerate=i,r.normalize=s,r.join=function(e,t){""===e&&(e="."),""===t&&(t=".");var r=n(t),a=n(e);if(a&&(e=a.path||"/"),r&&!r.scheme)return a&&(r.scheme=a.scheme),i(r);if(r||t.match(c))return t;if(a&&!a.host&&!a.path)return a.host=t,i(a);var o="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return a?(a.path=o,i(a)):o},r.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(l)},r.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(n<0)return t;if((e=e.slice(0,n)).match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)};var p=!("__proto__"in Object.create(null));r.toSetString=p?a:function(e){return o(e)?"$"+e:e},r.fromSetString=p?a:function(e){return o(e)?e.slice(1):e},r.compareByOriginalPositions=function(e,t,r){var n=e.source-t.source;return 0!==n?n:0!=(n=e.originalLine-t.originalLine)?n:0!=(n=e.originalColumn-t.originalColumn)||r?n:0!=(n=e.generatedColumn-t.generatedColumn)?n:0!=(n=e.generatedLine-t.generatedLine)?n:e.name-t.name},r.compareByGeneratedPositionsDeflated=function(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!=(n=e.generatedColumn-t.generatedColumn)||r?n:0!=(n=e.source-t.source)?n:0!=(n=e.originalLine-t.originalLine)?n:0!=(n=e.originalColumn-t.originalColumn)?n:e.name-t.name},r.compareByGeneratedPositionsInflated=function(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!=(r=e.generatedColumn-t.generatedColumn)?r:0!==(r=u(e.source,t.source))?r:0!=(r=e.originalLine-t.originalLine)?r:0!=(r=e.originalColumn-t.originalColumn)?r:u(e.name,t.name)}},{}],72:[function(e,t,r){r.SourceMapGenerator=e("./lib/source-map-generator").SourceMapGenerator,r.SourceMapConsumer=e("./lib/source-map-consumer").SourceMapConsumer,r.SourceNode=e("./lib/source-node").SourceNode},{"./lib/source-map-consumer":68,"./lib/source-map-generator":69,"./lib/source-node":70}],73:[function(e,t,r){t.exports={_args:[[{raw:"babel-core@^6.18.2",scope:null,escapedName:"babel-core",name:"babel-core",rawSpec:"^6.18.2",spec:">=6.18.2 <7.0.0",type:"range"},"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/regenerator"]],_from:"babel-core@>=6.18.2 <7.0.0",_id:"babel-core@6.26.0",_inCache:!0,_location:"/babel-core",_nodeVersion:"6.9.0",_npmOperationalInternal:{host:"s3://npm-registry-packages",tmp:"tmp/babel-core-6.26.0.tgz_1502898861183_0.43529116874560714"},_npmUser:{name:"hzoo",email:"hi@henryzoo.com"},_npmVersion:"4.6.1",_phantomChildren:{ms:"2.0.0"},_requested:{raw:"babel-core@^6.18.2",scope:null,escapedName:"babel-core",name:"babel-core",rawSpec:"^6.18.2",spec:">=6.18.2 <7.0.0",type:"range"},_requiredBy:["/babel-register","/regenerator"],_resolved:"https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",_shasum:"af32f78b31a6fcef119c87b0fd8d9753f03a0bb8",_shrinkwrap:null,_spec:"babel-core@^6.18.2",_where:"/Users/evgenypoberezkin/Documents/JSON/ajv/node_modules/regenerator",author:{name:"Sebastian McKenzie",email:"sebmck@gmail.com"},dependencies:{"babel-code-frame":"^6.26.0","babel-generator":"^6.26.0","babel-helpers":"^6.24.1","babel-messages":"^6.23.0","babel-register":"^6.26.0","babel-runtime":"^6.26.0","babel-template":"^6.26.0","babel-traverse":"^6.26.0","babel-types":"^6.26.0",babylon:"^6.18.0","convert-source-map":"^1.5.0",debug:"^2.6.8",json5:"^0.5.1",lodash:"^4.17.4",minimatch:"^3.0.4","path-is-absolute":"^1.0.1",private:"^0.1.7",slash:"^1.0.0","source-map":"^0.5.6"},description:"Babel compiler core.",devDependencies:{"babel-helper-fixtures":"^6.26.0","babel-helper-transform-fixture-test-runner":"^6.26.0","babel-polyfill":"^6.26.0"},directories:{},dist:{shasum:"af32f78b31a6fcef119c87b0fd8d9753f03a0bb8",tarball:"https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz"},homepage:"https://babeljs.io/",keywords:["6to5","babel","classes","const","es6","harmony","let","modules","transpile","transpiler","var","babel-core","compiler"],license:"MIT",maintainers:[{name:"thejameskyle",email:"me@thejameskyle.com"},{name:"sebmck",email:"sebmck@gmail.com"},{name:"danez",email:"daniel@tschinder.de"},{name:"hzoo",email:"hi@henryzoo.com"},{name:"loganfsmyth",email:"loganfsmyth@gmail.com"}],name:"babel-core",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"https://github.com/babel/babel/tree/master/packages/babel-core"},scripts:{bench:"make bench",test:"make test"},version:"6.26.0"}},{}],74:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=n(e("trim-right")),a=/^[ \t]+$/,o=function(){function e(t){(0,i.default)(this,e),this._map=null,this._buf=[],this._last="",this._queue=[],this._position={line:1,column:0},this._sourcePosition={identifierName:null,line:null,column:null,filename:null},this._map=t}return e.prototype.get=function(){this._flush();var e=this._map,t={code:(0,s.default)(this._buf.join("")),map:null,rawMappings:e&&e.getRawMappings()};return e&&Object.defineProperty(t,"map",{configurable:!0,enumerable:!0,get:function(){return this.map=e.get()},set:function(e){Object.defineProperty(this,"map",{value:e,writable:!0})}}),t},e.prototype.append=function(e){this._flush();var t=this._sourcePosition,r=t.line,n=t.column,i=t.filename,s=t.identifierName;this._append(e,r,n,s,i)},e.prototype.queue=function(e){if("\n"===e)for(;this._queue.length>0&&a.test(this._queue[0][0]);)this._queue.shift();var t=this._sourcePosition,r=t.line,n=t.column,i=t.filename,s=t.identifierName;this._queue.unshift([e,r,n,s,i])},e.prototype._flush=function(){for(var e=void 0;e=this._queue.pop();)this._append.apply(this,e)},e.prototype._append=function(e,t,r,n,i){this._map&&"\n"!==e[0]&&this._map.mark(this._position.line,this._position.column,t,r,n,i),this._buf.push(e),this._last=e[e.length-1];for(var s=0;s0&&"\n"===this._queue[0][0]&&this._queue.shift()},e.prototype.removeLastSemicolon=function(){this._queue.length>0&&";"===this._queue[0][0]&&this._queue.shift()},e.prototype.endsWith=function(e){if(1===e.length){var t=void 0;if(this._queue.length>0){var r=this._queue[0][0];t=r[r.length-1]}else t=this._last;return t===e}var n=this._last+this._queue.reduce(function(e,t){return t[0]+e},"");return e.length<=n.length&&n.slice(-e.length)===e},e.prototype.hasContent=function(){return this._queue.length>0||!!this._last},e.prototype.source=function(e,t){if(!e||t){var r=t?t[e]:null;this._sourcePosition.identifierName=t&&t.identifierName||null,this._sourcePosition.line=r?r.line:null,this._sourcePosition.column=r?r.column:null,this._sourcePosition.filename=t&&t.filename||null}},e.prototype.withSource=function(e,t,r){if(!this._map)return r();var n=this._sourcePosition.line,i=this._sourcePosition.column,s=this._sourcePosition.filename,a=this._sourcePosition.identifierName;this.source(e,t),r(),this._sourcePosition.line=n,this._sourcePosition.column=i,this._sourcePosition.filename=s,this._sourcePosition.identifierName=a},e.prototype.getCurrentColumn=function(){var e=this._queue.reduce(function(e,t){return t[0]+e},""),t=e.lastIndexOf("\n");return-1===t?this._position.column+e.length:e.length-1-t},e.prototype.getCurrentLine=function(){for(var e=this._queue.reduce(function(e,t){return t[0]+e},""),t=0,r=0;r")}function o(){this.space(),this.token("|"),this.space()}r.__esModule=!0,r.TypeParameterDeclaration=r.StringLiteralTypeAnnotation=r.NumericLiteralTypeAnnotation=r.GenericTypeAnnotation=r.ClassImplements=void 0,r.AnyTypeAnnotation=function(){this.word("any")},r.ArrayTypeAnnotation=function(e){this.print(e.elementType,e),this.token("["),this.token("]")},r.BooleanTypeAnnotation=function(){this.word("boolean")},r.BooleanLiteralTypeAnnotation=function(e){this.word(e.value?"true":"false")},r.NullLiteralTypeAnnotation=function(){this.word("null")},r.DeclareClass=function(e,t){l.isDeclareExportDeclaration(t)||(this.word("declare"),this.space()),this.word("class"),this.space(),this._interfaceish(e)},r.DeclareFunction=function(e,t){l.isDeclareExportDeclaration(t)||(this.word("declare"),this.space()),this.word("function"),this.space(),this.print(e.id,e),this.print(e.id.typeAnnotation.typeAnnotation,e),this.semicolon()},r.DeclareInterface=function(e){this.word("declare"),this.space(),this.InterfaceDeclaration(e)},r.DeclareModule=function(e){this.word("declare"),this.space(),this.word("module"),this.space(),this.print(e.id,e),this.space(),this.print(e.body,e)},r.DeclareModuleExports=function(e){this.word("declare"),this.space(),this.word("module"),this.token("."),this.word("exports"),this.print(e.typeAnnotation,e)},r.DeclareTypeAlias=function(e){this.word("declare"),this.space(),this.TypeAlias(e)},r.DeclareOpaqueType=function(e,t){l.isDeclareExportDeclaration(t)||(this.word("declare"),this.space()),this.OpaqueType(e)},r.DeclareVariable=function(e,t){l.isDeclareExportDeclaration(t)||(this.word("declare"),this.space()),this.word("var"),this.space(),this.print(e.id,e),this.print(e.id.typeAnnotation,e),this.semicolon()},r.DeclareExportDeclaration=function(e){this.word("declare"),this.space(),this.word("export"),this.space(),e.default&&(this.word("default"),this.space()),n.apply(this,arguments)},r.ExistentialTypeParam=function(){this.token("*")},r.FunctionTypeAnnotation=function(e,t){this.print(e.typeParameters,e),this.token("("),this.printList(e.params,e),e.rest&&(e.params.length&&(this.token(","),this.space()),this.token("..."),this.print(e.rest,e)),this.token(")"),"ObjectTypeCallProperty"===t.type||"DeclareFunction"===t.type?this.token(":"):(this.space(),this.token("=>")),this.space(),this.print(e.returnType,e)},r.FunctionTypeParam=function(e){this.print(e.name,e),e.optional&&this.token("?"),this.token(":"),this.space(),this.print(e.typeAnnotation,e)},r.InterfaceExtends=i,r._interfaceish=function(e){this.print(e.id,e),this.print(e.typeParameters,e),e.extends.length&&(this.space(),this.word("extends"),this.space(),this.printList(e.extends,e)),e.mixins&&e.mixins.length&&(this.space(),this.word("mixins"),this.space(),this.printList(e.mixins,e)),this.space(),this.print(e.body,e)},r._variance=function(e){"plus"===e.variance?this.token("+"):"minus"===e.variance&&this.token("-")},r.InterfaceDeclaration=function(e){this.word("interface"),this.space(),this._interfaceish(e)},r.IntersectionTypeAnnotation=function(e){this.printJoin(e.types,e,{separator:s})},r.MixedTypeAnnotation=function(){this.word("mixed")},r.EmptyTypeAnnotation=function(){this.word("empty")},r.NullableTypeAnnotation=function(e){this.token("?"),this.print(e.typeAnnotation,e)};var u=e("./types");Object.defineProperty(r,"NumericLiteralTypeAnnotation",{enumerable:!0,get:function(){return u.NumericLiteral}}),Object.defineProperty(r,"StringLiteralTypeAnnotation",{enumerable:!0,get:function(){return u.StringLiteral}}),r.NumberTypeAnnotation=function(){this.word("number")},r.StringTypeAnnotation=function(){this.word("string")},r.ThisTypeAnnotation=function(){this.word("this")},r.TupleTypeAnnotation=function(e){this.token("["),this.printList(e.types,e),this.token("]")},r.TypeofTypeAnnotation=function(e){this.word("typeof"),this.space(),this.print(e.argument,e)},r.TypeAlias=function(e){this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),this.space(),this.token("="),this.space(),this.print(e.right,e),this.semicolon()},r.OpaqueType=function(e){this.word("opaque"),this.space(),this.word("type"),this.space(),this.print(e.id,e),this.print(e.typeParameters,e),e.supertype&&(this.token(":"),this.space(),this.print(e.supertype,e)),e.impltype&&(this.space(),this.token("="),this.space(),this.print(e.impltype,e)),this.semicolon()},r.TypeAnnotation=function(e){this.token(":"),this.space(),e.optional&&this.token("?"),this.print(e.typeAnnotation,e)},r.TypeParameter=function(e){this._variance(e),this.word(e.name),e.bound&&this.print(e.bound,e),e.default&&(this.space(),this.token("="),this.space(),this.print(e.default,e))},r.TypeParameterInstantiation=a,r.ObjectTypeAnnotation=function(e){var t=this;e.exact?this.token("{|"):this.token("{");var r=e.properties.concat(e.callProperties,e.indexers);r.length&&(this.space(),this.printJoin(r,e,{addNewlines:function(e){if(e&&!r[0])return 1},indent:!0,statement:!0,iterator:function(){1!==r.length&&(t.format.flowCommaSeparator?t.token(","):t.semicolon(),t.space())}}),this.space()),e.exact?this.token("|}"):this.token("}")},r.ObjectTypeCallProperty=function(e){e.static&&(this.word("static"),this.space()),this.print(e.value,e)},r.ObjectTypeIndexer=function(e){e.static&&(this.word("static"),this.space()),this._variance(e),this.token("["),this.print(e.id,e),this.token(":"),this.space(),this.print(e.key,e),this.token("]"),this.token(":"),this.space(),this.print(e.value,e)},r.ObjectTypeProperty=function(e){e.static&&(this.word("static"),this.space()),this._variance(e),this.print(e.key,e),e.optional&&this.token("?"),this.token(":"),this.space(),this.print(e.value,e)},r.ObjectTypeSpreadProperty=function(e){this.token("..."),this.print(e.argument,e)},r.QualifiedTypeIdentifier=function(e){this.print(e.qualification,e),this.token("."),this.print(e.id,e)},r.UnionTypeAnnotation=function(e){this.printJoin(e.types,e,{separator:o})},r.TypeCastExpression=function(e){this.token("("),this.print(e.expression,e),this.print(e.typeAnnotation,e),this.token(")")},r.VoidTypeAnnotation=function(){this.word("void")};var l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.ClassImplements=i,r.GenericTypeAnnotation=i,r.TypeParameterDeclaration=a},{"./types":84,"babel-types":178}],79:[function(e,t,r){"use strict";function n(){this.space()}r.__esModule=!0;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.JSXAttribute=function(e){this.print(e.name,e),e.value&&(this.token("="),this.print(e.value,e))},r.JSXIdentifier=function(e){this.word(e.name)},r.JSXNamespacedName=function(e){this.print(e.namespace,e),this.token(":"),this.print(e.name,e)},r.JSXMemberExpression=function(e){this.print(e.object,e),this.token("."),this.print(e.property,e)},r.JSXSpreadAttribute=function(e){this.token("{"),this.token("..."),this.print(e.argument,e),this.token("}")},r.JSXExpressionContainer=function(e){this.token("{"),this.print(e.expression,e),this.token("}")},r.JSXSpreadChild=function(e){this.token("{"),this.token("..."),this.print(e.expression,e),this.token("}")},r.JSXText=function(e){this.token(e.value)},r.JSXElement=function(e){var t=e.openingElement;if(this.print(t,e),!t.selfClosing){this.indent();for(var r=e.children,n=Array.isArray(r),s=0,r=n?r:(0,i.default)(r);;){var a;if(n){if(s>=r.length)break;a=r[s++]}else{if((s=r.next()).done)break;a=s.value}var o=a;this.print(o,e)}this.dedent(),this.print(e.closingElement,e)}},r.JSXOpeningElement=function(e){this.token("<"),this.print(e.name,e),e.attributes.length>0&&(this.space(),this.printJoin(e.attributes,e,{separator:n})),e.selfClosing?(this.space(),this.token("/>")):this.token(">")},r.JSXClosingElement=function(e){this.token("")},r.JSXEmptyExpression=function(){}},{"babel-runtime/core-js/get-iterator":120}],80:[function(e,t,r){"use strict";function n(e){e.async&&(this.word("async"),this.space()),this.word("function"),e.generator&&this.token("*"),e.id?(this.space(),this.print(e.id,e)):this.space(),this._params(e),this.space(),this.print(e.body,e)}function i(e,t){return e.typeParameters||e.returnType||t.typeAnnotation||t.optional||t.trailingComments}r.__esModule=!0,r.FunctionDeclaration=void 0,r._params=function(e){var t=this;this.print(e.typeParameters,e),this.token("("),this.printList(e.params,e,{iterator:function(e){e.optional&&t.token("?"),t.print(e.typeAnnotation,e)}}),this.token(")"),e.returnType&&this.print(e.returnType,e)},r._method=function(e){var t=e.kind,r=e.key;"method"!==t&&"init"!==t||e.generator&&this.token("*"),"get"!==t&&"set"!==t||(this.word(t),this.space()),e.async&&(this.word("async"),this.space()),e.computed?(this.token("["),this.print(r,e),this.token("]")):this.print(r,e),this._params(e),this.space(),this.print(e.body,e)},r.FunctionExpression=n,r.ArrowFunctionExpression=function(e){e.async&&(this.word("async"),this.space());var t=e.params[0];1===e.params.length&&s.isIdentifier(t)&&!i(e,t)?this.print(t,e):this._params(e),this.space(),this.token("=>"),this.space(),this.print(e.body,e)};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.FunctionDeclaration=n},{"babel-types":178}],81:[function(e,t,r){"use strict";function n(e){if(e.declaration){var t=e.declaration;this.print(t,e),i.isStatement(t)||this.semicolon()}else{"type"===e.exportKind&&(this.word("type"),this.space());for(var r=e.specifiers.slice(0),n=!1;;){var s=r[0];if(!i.isExportDefaultSpecifier(s)&&!i.isExportNamespaceSpecifier(s))break;n=!0,this.print(r.shift(),e),r.length&&(this.token(","),this.space())}(r.length||!r.length&&!n)&&(this.token("{"),r.length&&(this.space(),this.printList(r,e),this.space()),this.token("}")),e.source&&(this.space(),this.word("from"),this.space(),this.print(e.source,e)),this.semicolon()}}r.__esModule=!0,r.ImportSpecifier=function(e){"type"!==e.importKind&&"typeof"!==e.importKind||(this.word(e.importKind),this.space()),this.print(e.imported,e),e.local&&e.local.name!==e.imported.name&&(this.space(),this.word("as"),this.space(),this.print(e.local,e))},r.ImportDefaultSpecifier=function(e){this.print(e.local,e)},r.ExportDefaultSpecifier=function(e){this.print(e.exported,e)},r.ExportSpecifier=function(e){this.print(e.local,e),e.exported&&e.local.name!==e.exported.name&&(this.space(),this.word("as"),this.space(),this.print(e.exported,e))},r.ExportNamespaceSpecifier=function(e){this.token("*"),this.space(),this.word("as"),this.space(),this.print(e.exported,e)},r.ExportAllDeclaration=function(e){this.word("export"),this.space(),this.token("*"),this.space(),this.word("from"),this.space(),this.print(e.source,e),this.semicolon()},r.ExportNamedDeclaration=function(){this.word("export"),this.space(),n.apply(this,arguments)},r.ExportDefaultDeclaration=function(){this.word("export"),this.space(),this.word("default"),this.space(),n.apply(this,arguments)},r.ImportDeclaration=function(e){this.word("import"),this.space(),"type"!==e.importKind&&"typeof"!==e.importKind||(this.word(e.importKind),this.space());var t=e.specifiers.slice(0);if(t&&t.length){for(;;){var r=t[0];if(!i.isImportDefaultSpecifier(r)&&!i.isImportNamespaceSpecifier(r))break;this.print(t.shift(),e),t.length&&(this.token(","),this.space())}t.length&&(this.token("{"),this.space(),this.printList(t,e),this.space(),this.token("}")),this.space(),this.word("from"),this.space()}this.print(e.source,e),this.semicolon()},r.ImportNamespaceSpecifier=function(e){this.token("*"),this.space(),this.word("as"),this.space(),this.print(e.local,e)};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))},{"babel-types":178}],82:[function(e,t,r){"use strict";function n(e){return u.isStatement(e.body)?n(e.body):e}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"label";return function(r){this.word(e);var n=r[t];if(n){this.space();var i=this.startTerminatorless();this.print(n,r),this.endTerminatorless(i)}this.semicolon()}}function s(){if(this.token(","),this.newline(),this.endsWith("\n"))for(var e=0;e<4;e++)this.space(!0)}function a(){if(this.token(","),this.newline(),this.endsWith("\n"))for(var e=0;e<6;e++)this.space(!0)}r.__esModule=!0,r.ThrowStatement=r.BreakStatement=r.ReturnStatement=r.ContinueStatement=r.ForAwaitStatement=r.ForOfStatement=r.ForInStatement=void 0;var o=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.WithStatement=function(e){this.word("with"),this.space(),this.token("("),this.print(e.object,e),this.token(")"),this.printBlock(e)},r.IfStatement=function(e){this.word("if"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.space();var t=e.alternate&&u.isIfStatement(n(e.consequent));t&&(this.token("{"),this.newline(),this.indent()),this.printAndIndentOnComments(e.consequent,e),t&&(this.dedent(),this.newline(),this.token("}")),e.alternate&&(this.endsWith("}")&&this.space(),this.word("else"),this.space(),this.printAndIndentOnComments(e.alternate,e))},r.ForStatement=function(e){this.word("for"),this.space(),this.token("("),this.inForStatementInitCounter++,this.print(e.init,e),this.inForStatementInitCounter--,this.token(";"),e.test&&(this.space(),this.print(e.test,e)),this.token(";"),e.update&&(this.space(),this.print(e.update,e)),this.token(")"),this.printBlock(e)},r.WhileStatement=function(e){this.word("while"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.printBlock(e)},r.DoWhileStatement=function(e){this.word("do"),this.space(),this.print(e.body,e),this.space(),this.word("while"),this.space(),this.token("("),this.print(e.test,e),this.token(")"),this.semicolon()},r.LabeledStatement=function(e){this.print(e.label,e),this.token(":"),this.space(),this.print(e.body,e)},r.TryStatement=function(e){this.word("try"),this.space(),this.print(e.block,e),this.space(),e.handlers?this.print(e.handlers[0],e):this.print(e.handler,e),e.finalizer&&(this.space(),this.word("finally"),this.space(),this.print(e.finalizer,e))},r.CatchClause=function(e){this.word("catch"),this.space(),this.token("("),this.print(e.param,e),this.token(")"),this.space(),this.print(e.body,e)},r.SwitchStatement=function(e){this.word("switch"),this.space(),this.token("("),this.print(e.discriminant,e),this.token(")"),this.space(),this.token("{"),this.printSequence(e.cases,e,{indent:!0,addNewlines:function(t,r){if(!t&&e.cases[e.cases.length-1]===r)return-1}}),this.token("}")},r.SwitchCase=function(e){e.test?(this.word("case"),this.space(),this.print(e.test,e),this.token(":")):(this.word("default"),this.token(":")),e.consequent.length&&(this.newline(),this.printSequence(e.consequent,e,{indent:!0}))},r.DebuggerStatement=function(){this.word("debugger"),this.semicolon()},r.VariableDeclaration=function(e,t){this.word(e.kind),this.space();var r=!1;if(!u.isFor(t))for(var n=e.declarations,i=Array.isArray(n),l=0,n=i?n:(0,o.default)(n);;){var c;if(i){if(l>=n.length)break;c=n[l++]}else{if((l=n.next()).done)break;c=l.value}c.init&&(r=!0)}var p=void 0;r&&(p="const"===e.kind?a:s),this.printList(e.declarations,e,{separator:p}),(!u.isFor(t)||t.left!==e&&t.init!==e)&&this.semicolon()},r.VariableDeclarator=function(e){this.print(e.id,e),this.print(e.id.typeAnnotation,e),e.init&&(this.space(),this.token("="),this.space(),this.print(e.init,e))};var u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),l=function(e){return function(t){this.word("for"),this.space(),"await"===e&&(this.word("await"),this.space()),this.token("("),this.print(t.left,t),this.space(),this.word("await"===e?"of":e),this.space(),this.print(t.right,t),this.token(")"),this.printBlock(t)}};r.ForInStatement=l("in"),r.ForOfStatement=l("of"),r.ForAwaitStatement=l("await"),r.ContinueStatement=i("continue"),r.ReturnStatement=i("return","argument"),r.BreakStatement=i("break"),r.ThrowStatement=i("throw","argument")},{"babel-runtime/core-js/get-iterator":120,"babel-types":178}],83:[function(e,t,r){"use strict";r.__esModule=!0,r.TaggedTemplateExpression=function(e){this.print(e.tag,e),this.print(e.quasi,e)},r.TemplateElement=function(e,t){var r=t.quasis[0]===e,n=t.quasis[t.quasis.length-1]===e,i=(r?"`":"}")+e.value.raw+(n?"`":"${");this.token(i)},r.TemplateLiteral=function(e){for(var t=e.quasis,r=0;r0&&this.space(),this.print(i,e),n=0||e.indexOf("@preserve")>=0},"auto"===a.compact&&(a.compact=e.length>5e5,a.compact&&console.error("[BABEL] "+p.get("codeGeneratorDeopt",t.filename,"500KB"))),a.compact&&(a.indent.adjustMultilineComment=!1),a}function s(e,t){if(!e)return"double";for(var r={single:0,double:0},n=0,i=0;i=3))break}return r.single>r.double?"single":"double"}r.__esModule=!0,r.CodeGenerator=void 0;var a=n(e("babel-runtime/helpers/classCallCheck")),o=n(e("babel-runtime/helpers/possibleConstructorReturn")),u=n(e("babel-runtime/helpers/inherits"));r.default=function(e,t,r){return new h(e,t,r).generate()};var l=n(e("detect-indent")),c=n(e("./source-map")),p=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-messages")),h=function(e){function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments[2];(0,a.default)(this,t);var u=r.tokens||[],l=i(s,n,u),p=n.sourceMaps?new c.default(n,s):null,h=(0,o.default)(this,e.call(this,l,p,u));return h.ast=r,h}return(0,u.default)(t,e),t.prototype.generate=function(){return e.prototype.generate.call(this,this.ast)},t}(n(e("./printer")).default);r.CodeGenerator=function(){function e(t,r,n){(0,a.default)(this,e),this._generator=new h(t,r,n)}return e.prototype.generate=function(){return this._generator.generate()},e}()},{"./printer":89,"./source-map":90,"babel-messages":110,"babel-runtime/helpers/classCallCheck":134,"babel-runtime/helpers/inherits":135,"babel-runtime/helpers/possibleConstructorReturn":137,"detect-indent":309}],86:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){function t(e,t){var n=r[e];r[e]=n?function(e,r,i){var s=n(e,r,i);return null==s?t(e,r,i):s}:t}for(var r={},n=(0,c.default)(e),i=Array.isArray(n),s=0,n=i?n:(0,l.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a,u=f.FLIPPED_ALIAS_KEYS[o];if(u)for(var p=u,h=Array.isArray(p),d=0,p=h?p:(0,l.default)(p);;){var m;if(h){if(d>=p.length)break;m=p[d++]}else{if((d=p.next()).done)break;m=d.value}t(m,e[o])}else t(o,e[o])}return r}function a(e,t,r,n){var i=e[t.type];return i?i(t,r,n):null}function o(e){return!!f.isCallExpression(e)||!!f.isMemberExpression(e)&&(o(e.object)||!e.computed&&o(e.property))}function u(e,t,r){if(!e)return 0;f.isExpressionStatement(e)&&(e=e.expression);var n=a(m,e,t);if(!n){var i=a(y,e,t);if(i)for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:{},r=t.considerArrow,n=void 0!==r&&r,i=t.considerDefaultExports,s=void 0!==i&&i,a=e.length-1,o=e[a],l=e[--a];a>0;){if(u.isExpressionStatement(l,{expression:o})||u.isTaggedTemplateExpression(l)||s&&u.isExportDefaultDeclaration(l,{declaration:o})||n&&u.isArrowFunctionExpression(l,{body:o}))return!0;if(!(u.isCallExpression(l,{callee:o})||u.isSequenceExpression(l)&&l.expressions[0]===o||u.isMemberExpression(l,{object:o})||u.isConditional(l,{test:o})||u.isBinary(l,{left:o})||u.isAssignmentExpression(l,{left:o})))return!1;o=l,l=e[--a]}return!1}r.__esModule=!0,r.AwaitExpression=r.FunctionTypeAnnotation=void 0,r.NullableTypeAnnotation=n,r.UpdateExpression=function(e,t){return u.isMemberExpression(t)&&t.object===e},r.ObjectExpression=function(e,t,r){return o(r,{considerArrow:!0})},r.DoExpression=function(e,t,r){return o(r)},r.Binary=function(e,t){if((u.isCallExpression(t)||u.isNewExpression(t))&&t.callee===e||u.isUnaryLike(t)||u.isMemberExpression(t)&&t.object===e||u.isAwaitExpression(t))return!0;if(u.isBinary(t)){var r=t.operator,n=l[r],i=e.operator,s=l[i];if(n===s&&t.right===e&&!u.isLogicalExpression(t)||n>s)return!0}return!1},r.BinaryExpression=function(e,t){return"in"===e.operator&&(u.isVariableDeclarator(t)||u.isFor(t))},r.SequenceExpression=function(e,t){return!(u.isForStatement(t)||u.isThrowStatement(t)||u.isReturnStatement(t)||u.isIfStatement(t)&&t.test===e||u.isWhileStatement(t)&&t.test===e||u.isForInStatement(t)&&t.right===e||u.isSwitchStatement(t)&&t.discriminant===e||u.isExpressionStatement(t)&&t.expression===e)},r.YieldExpression=i,r.ClassExpression=function(e,t,r){return o(r,{considerDefaultExports:!0})},r.UnaryLike=s,r.FunctionExpression=function(e,t,r){return o(r,{considerDefaultExports:!0})},r.ArrowFunctionExpression=function(e,t){return!!(u.isExportDeclaration(t)||u.isBinaryExpression(t)||u.isLogicalExpression(t)||u.isUnaryExpression(t)||u.isTaggedTemplateExpression(t))||s(e,t)},r.ConditionalExpression=a,r.AssignmentExpression=function(e){return!!u.isObjectPattern(e.left)||a.apply(void 0,arguments)};var u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),l={"||":0,"&&":1,"|":2,"^":3,"&":4,"==":5,"===":5,"!=":5,"!==":5,"<":6,">":6,"<=":6,">=":6,in:6,instanceof:6,">>":7,"<<":7,">>>":7,"+":8,"-":8,"*":9,"/":9,"%":9,"**":10};r.FunctionTypeAnnotation=n,r.AwaitExpression=i},{"babel-types":178}],88:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o.isMemberExpression(e)?(n(e.object,t),e.computed&&n(e.property,t)):o.isBinary(e)||o.isAssignmentExpression(e)?(n(e.left,t),n(e.right,t)):o.isCallExpression(e)?(t.hasCall=!0,n(e.callee,t)):o.isFunction(e)?t.hasFunction=!0:o.isIdentifier(e)&&(t.hasHelper=t.hasHelper||i(e.callee)),t}function i(e){return o.isMemberExpression(e)?i(e.object)||i(e.property):o.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:o.isCallExpression(e)?i(e.callee):!(!o.isBinary(e)&&!o.isAssignmentExpression(e))&&(o.isIdentifier(e.left)&&i(e.left)||i(e.right))}function s(e){return o.isLiteral(e)||o.isObjectExpression(e)||o.isArrayExpression(e)||o.isIdentifier(e)||o.isMemberExpression(e)}var a=function(e){return e&&e.__esModule?e:{default:e}}(e("lodash/map")),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.nodes={AssignmentExpression:function(e){var t=n(e.right);if(t.hasCall&&t.hasHelper||t.hasFunction)return{before:t.hasFunction,after:!0}},SwitchCase:function(e,t){return{before:e.consequent.length||t.cases[0]===e}},LogicalExpression:function(e){if(o.isFunction(e.left)||o.isFunction(e.right))return{after:!0}},Literal:function(e){if("use strict"===e.value)return{after:!0}},CallExpression:function(e){if(o.isFunction(e.callee)||i(e))return{before:!0,after:!0}},VariableDeclaration:function(e){for(var t=0;t0?new g.default(n):null}return e.prototype.generate=function(e){return this.print(e),this._maybeAddAuxComment(),this._buf.get()},e.prototype.indent=function(){this.format.compact||this.format.concise||this._indent++},e.prototype.dedent=function(){this.format.compact||this.format.concise||this._indent--},e.prototype.semicolon=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._maybeAddAuxComment(),this._append(";",!e)},e.prototype.rightBrace=function(){this.format.minified&&this._buf.removeLastSemicolon(),this.token("}")},e.prototype.space=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.format.compact||(this._buf.hasContent()&&!this.endsWith(" ")&&!this.endsWith("\n")||e)&&this._space()},e.prototype.word=function(e){this._endsWithWord&&this._space(),this._maybeAddAuxComment(),this._append(e),this._endsWithWord=!0},e.prototype.number=function(e){this.word(e),this._endsWithInteger=(0,f.default)(+e)&&!E.test(e)&&!v.test(e)&&!x.test(e)&&"."!==e[e.length-1]},e.prototype.token=function(e){("--"===e&&this.endsWith("!")||"+"===e[0]&&this.endsWith("+")||"-"===e[0]&&this.endsWith("-")||"."===e[0]&&this._endsWithInteger)&&this._space(),this._maybeAddAuxComment(),this._append(e)},e.prototype.newline=function(e){if(!this.format.retainLines&&!this.format.compact)if(this.format.concise)this.space();else if(!(this.endsWith("\n\n")||("number"!=typeof e&&(e=1),e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,e<=0)))for(var t=0;t1&&void 0!==arguments[1]&&arguments[1];this._maybeAddParen(e),this._maybeIndent(e),t?this._buf.queue(e):this._buf.append(e),this._endsWithWord=!1,this._endsWithInteger=!1},e.prototype._maybeIndent=function(e){this._indent&&this.endsWith("\n")&&"\n"!==e[0]&&this._buf.queue(this._getIndent())},e.prototype._maybeAddParen=function(e){var t=this._parenPushNewlineState;if(t){this._parenPushNewlineState=null;var r=void 0;for(r=0;r2&&void 0!==arguments[2]?arguments[2]:{};if(e&&e.length){r.indent&&this.indent();for(var n={addNewlines:r.addNewlines},i=0;i1&&void 0!==arguments[1])||arguments[1];e.innerComments&&(t&&this.indent(),this._printComments(e.innerComments),t&&this.dedent())},e.prototype.printSequence=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.statement=!0,this.printJoin(e,t,r)},e.prototype.printList=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return null==r.separator&&(r.separator=s),this.printJoin(e,t,r)},e.prototype._printNewline=function(e,t,r,n){var i=this;if(!this.format.retainLines&&!this.format.compact)if(this.format.concise)this.space();else{var s=0;if(null!=t.start&&!t._ignoreUserWhitespace&&this._whitespace)if(e){var a=t.leadingComments,o=a&&(0,p.default)(a,function(e){return!!e.loc&&i.format.shouldPrintComment(e.value)});s=this._whitespace.getNewlinesBefore(o||t)}else{var u=t.trailingComments,l=u&&(0,h.default)(u,function(e){return!!e.loc&&i.format.shouldPrintComment(e.value)});s=this._whitespace.getNewlinesAfter(l||t)}else{e||s++,n.addNewlines&&(s+=n.addNewlines(e,t)||0);var c=y.needsWhitespaceAfter;e&&(c=y.needsWhitespaceBefore),c(t,r)&&s++,this._buf.hasContent()||(s=0)}this.newline(s)}},e.prototype._getComments=function(e,t){return t&&(e?t.leadingComments:t.trailingComments)||[]},e.prototype._printComment=function(e){var t=this;if(this.format.shouldPrintComment(e.value)&&!e.ignore&&!this._printedComments.has(e)){if(this._printedComments.add(e),null!=e.start){if(this._printedCommentStarts[e.start])return;this._printedCommentStarts[e.start]=!0}this.newline(this._whitespace?this._whitespace.getNewlinesBefore(e):0),this.endsWith("[")||this.endsWith("{")||this.space();var r="CommentLine"===e.type?"//"+e.value+"\n":"/*"+e.value+"*/";if("CommentBlock"===e.type&&this.format.indent.adjustMultilineComment){var n=e.loc&&e.loc.start.column;if(n){var i=new RegExp("\\n\\s{1,"+n+"}","g");r=r.replace(i,"\n")}var s=Math.max(this._getIndent().length,this._buf.getCurrentColumn());r=r.replace(/\n(?!$)/g,"\n"+(0,d.default)(" ",s))}this.withSource("start",e.loc,function(){t._append(r)}),this.newline((this._whitespace?this._whitespace.getNewlinesAfter(e):0)+("CommentLine"===e.type?-1:0))}},e.prototype._printComments=function(e){if(e&&e.length)for(var t=e,r=Array.isArray(t),n=0,t=r?t:(0,o.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;this._printComment(s)}},e}();r.default=A;for(var D=[e("./generators/template-literals"),e("./generators/expressions"),e("./generators/statements"),e("./generators/classes"),e("./generators/methods"),e("./generators/modules"),e("./generators/types"),e("./generators/flow"),e("./generators/base"),e("./generators/jsx")],C=0;C=0){for(;i&&e.start===n[i-1].start;)--i;t=n[i-1],r=n[i]}return this._getNewlinesBetween(t,r)},e.prototype.getNewlinesAfter=function(e){var t=void 0,r=void 0,n=this.tokens,i=this._findToken(function(t){return t.end-e.end},0,n.length);if(i>=0){for(;i&&e.end===n[i-1].end;)--i;t=n[i],","===(r=n[i+1]).type.label&&(r=n[i+2])}return r&&"eof"===r.type.label?1:this._getNewlinesBetween(t,r)},e.prototype._getNewlinesBetween=function(e,t){if(!t||!t.loc)return 0;for(var r=e?e.loc.end.line:1,n=t.loc.start.line,i=0,s=r;s=r)return-1;var n=t+r>>>1,i=e(this.tokens[n]);return i<0?this._findToken(e,n+1,r):i>0?this._findToken(e,t,n):0===i?n:-1},e}();r.default=i,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134}],92:[function(e,t,r){arguments[4][62][0].apply(r,arguments)},{"./util":101,dup:62}],93:[function(e,t,r){arguments[4][63][0].apply(r,arguments)},{"./base64":94,dup:63}],94:[function(e,t,r){arguments[4][64][0].apply(r,arguments)},{dup:64}],95:[function(e,t,r){arguments[4][65][0].apply(r,arguments)},{dup:65}],96:[function(e,t,r){arguments[4][66][0].apply(r,arguments)},{"./util":101,dup:66}],97:[function(e,t,r){arguments[4][67][0].apply(r,arguments)},{dup:67}],98:[function(e,t,r){arguments[4][68][0].apply(r,arguments)},{"./array-set":92,"./base64-vlq":93,"./binary-search":95,"./quick-sort":97,"./util":101,dup:68}],99:[function(e,t,r){arguments[4][69][0].apply(r,arguments)},{"./array-set":92,"./base64-vlq":93,"./mapping-list":96,"./util":101,dup:69}],100:[function(e,t,r){arguments[4][70][0].apply(r,arguments)},{"./source-map-generator":99,"./util":101,dup:70}],101:[function(e,t,r){arguments[4][71][0].apply(r,arguments)},{dup:71}],102:[function(e,t,r){arguments[4][72][0].apply(r,arguments)},{"./lib/source-map-consumer":98,"./lib/source-map-generator":99,"./lib/source-node":100,dup:72}],103:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return!l.isClassMethod(e)&&!l.isObjectMethod(e)||"get"!==e.kind&&"set"!==e.kind?"value":e.kind}function s(e){var t=l.objectExpression([]);return(0,a.default)(e).forEach(function(r){var n=e[r],i=l.objectExpression([]),s=l.objectProperty(n._key,i,n._computed);(0,a.default)(n).forEach(function(e){var t=n[e];if("_"!==e[0]){var r=t;(l.isClassMethod(t)||l.isClassProperty(t))&&(t=t.value);var s=l.objectProperty(l.identifier(e),t);l.inheritsComments(s,r),l.removeComments(r),i.properties.push(s)}}),t.properties.push(s)}),t}r.__esModule=!0;var a=n(e("babel-runtime/core-js/object/keys"));r.push=function(e,t,r,n,s){var a=l.toKeyAlias(t),c={};if((0,u.default)(e,a)&&(c=e[a]),e[a]=c,c._inherits=c._inherits||[],c._inherits.push(t),c._key=t.key,t.computed&&(c._computed=!0),t.decorators){var p=c.decorators=c.decorators||l.arrayExpression([]);p.elements=p.elements.concat(t.decorators.map(function(e){return e.expression}).reverse())}if(c.value||c.initializer)throw n.buildCodeFrameError(t,"Key conflict with sibling node");var h=void 0,f=void 0;(l.isObjectProperty(t)||l.isObjectMethod(t)||l.isClassMethod(t))&&(h=l.toComputedKey(t,t.key)),l.isObjectProperty(t)||l.isClassProperty(t)?f=t.value:(l.isObjectMethod(t)||l.isClassMethod(t))&&((f=l.functionExpression(null,t.params,t.body,t.generator,t.async)).returnType=t.returnType);var d=i(t);return r&&"value"===d||(r=d),s&&l.isStringLiteral(h)&&("value"===r||"initializer"===r)&&l.isFunctionExpression(f)&&(f=(0,o.default)({id:h,node:f,scope:s})),f&&(l.inheritsComments(f,t),c[r]=f),c},r.hasComputed=function(e){for(var t in e)if(e[t]._computed)return!0;return!1},r.toComputedObjectFromClass=function(e){for(var t=l.arrayExpression([]),r=0;r1&&void 0!==arguments[1]&&arguments[1];(0,u.default)(this,e),this.forceSuperMemoisation=t.forceSuperMemoisation,this.methodPath=t.methodPath,this.methodNode=t.methodNode,this.superRef=t.superRef,this.isStatic=t.isStatic,this.hasSuper=!1,this.inClass=r,this.isLoose=t.isLoose,this.scope=this.methodPath.scope,this.file=t.file,this.opts=t,this.bareSupers=[],this.returns=[],this.thises=[]}return e.prototype.getObjectRef=function(){return this.opts.objectRef||this.opts.getObjectRef()},e.prototype.setSuperProperty=function(e,t,r){return h.callExpression(this.file.addHelper("set"),[o(this.getObjectRef(),this.isStatic),r?e:h.stringLiteral(e.name),t,h.thisExpression()])},e.prototype.getSuperProperty=function(e,t){return h.callExpression(this.file.addHelper("get"),[o(this.getObjectRef(),this.isStatic),t?e:h.stringLiteral(e.name),h.thisExpression()])},e.prototype.replace=function(){this.methodPath.traverse(d,this)},e.prototype.getLooseSuperProperty=function(e,t){var r=this.methodNode,n=this.superRef||h.identifier("Function");return t.property===e?void 0:h.isCallExpression(t,{callee:e})?void 0:h.isMemberExpression(t)&&!r.static?h.memberExpression(n,h.identifier("prototype")):n},e.prototype.looseHandle=function(e){var t=e.node;if(e.isSuper())return this.getLooseSuperProperty(t,e.parent);if(e.isCallExpression()){var r=t.callee;if(!h.isMemberExpression(r))return;if(!h.isSuper(r.object))return;return h.appendToMemberExpression(r,h.identifier("call")),t.arguments.unshift(h.thisExpression()),!0}},e.prototype.specHandleAssignmentExpression=function(e,t,r){return"="===r.operator?this.setSuperProperty(r.left.property,r.right,r.left.computed):(e=e||t.scope.generateUidIdentifier("ref"),[h.variableDeclaration("var",[h.variableDeclarator(e,r.left)]),h.expressionStatement(h.assignmentExpression("=",r.left,h.binaryExpression(r.operator[0],e,r.right)))])},e.prototype.specHandle=function(e){var t=void 0,r=void 0,n=void 0,i=e.parent,o=e.node;if(s(o,i))throw e.buildCodeFrameError(p.get("classesIllegalBareSuper"));if(h.isCallExpression(o)){var u=o.callee;if(h.isSuper(u))return;a(u)&&(t=u.property,r=u.computed,n=o.arguments)}else if(h.isMemberExpression(o)&&h.isSuper(o.object))t=o.property,r=o.computed;else{if(h.isUpdateExpression(o)&&a(o.argument)){var l=h.binaryExpression(o.operator[0],o.argument,h.numericLiteral(1));if(o.prefix)return this.specHandleAssignmentExpression(null,e,l);var c=e.scope.generateUidIdentifier("ref");return this.specHandleAssignmentExpression(c,e,l).concat(h.expressionStatement(c))}if(h.isAssignmentExpression(o)&&a(o.left))return this.specHandleAssignmentExpression(null,e,o)}if(t){var f=this.getSuperProperty(t,r);return n?this.optimiseCall(f,n):f}},e.prototype.optimiseCall=function(e,t){var r=h.thisExpression();return r[f]=!0,(0,c.default)(e,r,t)},e}();r.default=m,t.exports=r.default},{"babel-helper-optimise-call-expression":106,"babel-messages":110,"babel-runtime/core-js/symbol":129,"babel-runtime/helpers/classCallCheck":134,"babel-types":178}],108:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-template")),i={};r.default=i,i.typeof=(0,n.default)('\n (typeof Symbol === "function" && typeof Symbol.iterator === "symbol")\n ? function (obj) { return typeof obj; }\n : function (obj) {\n return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype\n ? "symbol"\n : typeof obj;\n };\n'),i.jsx=(0,n.default)('\n (function () {\n var REACT_ELEMENT_TYPE = (typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")) || 0xeac7;\n\n return function createRawReactElement (type, props, key, children) {\n var defaultProps = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n // If we\'re going to assign props.children, we create a new object now\n // to avoid mutating defaultProps.\n props = {};\n }\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n props.children = childArray;\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : \'\' + key,\n ref: null,\n props: props,\n _owner: null,\n };\n };\n\n })()\n'),i.asyncIterator=(0,n.default)('\n (function (iterable) {\n if (typeof Symbol === "function") {\n if (Symbol.asyncIterator) {\n var method = iterable[Symbol.asyncIterator];\n if (method != null) return method.call(iterable);\n }\n if (Symbol.iterator) {\n return iterable[Symbol.iterator]();\n }\n }\n throw new TypeError("Object is not async iterable");\n })\n'),i.asyncGenerator=(0,n.default)('\n (function () {\n function AwaitValue(value) {\n this.value = value;\n }\n\n function AsyncGenerator(gen) {\n var front, back;\n\n function send(key, arg) {\n return new Promise(function (resolve, reject) {\n var request = {\n key: key,\n arg: arg,\n resolve: resolve,\n reject: reject,\n next: null\n };\n\n if (back) {\n back = back.next = request;\n } else {\n front = back = request;\n resume(key, arg);\n }\n });\n }\n\n function resume(key, arg) {\n try {\n var result = gen[key](arg)\n var value = result.value;\n if (value instanceof AwaitValue) {\n Promise.resolve(value.value).then(\n function (arg) { resume("next", arg); },\n function (arg) { resume("throw", arg); });\n } else {\n settle(result.done ? "return" : "normal", result.value);\n }\n } catch (err) {\n settle("throw", err);\n }\n }\n\n function settle(type, value) {\n switch (type) {\n case "return":\n front.resolve({ value: value, done: true });\n break;\n case "throw":\n front.reject(value);\n break;\n default:\n front.resolve({ value: value, done: false });\n break;\n }\n\n front = front.next;\n if (front) {\n resume(front.key, front.arg);\n } else {\n back = null;\n }\n }\n\n this._invoke = send;\n\n // Hide "return" method if generator return is not supported\n if (typeof gen.return !== "function") {\n this.return = undefined;\n }\n }\n\n if (typeof Symbol === "function" && Symbol.asyncIterator) {\n AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; };\n }\n\n AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); };\n AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); };\n AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); };\n\n return {\n wrap: function (fn) {\n return function () {\n return new AsyncGenerator(fn.apply(this, arguments));\n };\n },\n await: function (value) {\n return new AwaitValue(value);\n }\n };\n\n })()\n'),i.asyncGeneratorDelegate=(0,n.default)('\n (function (inner, awaitWrap) {\n var iter = {}, waiting = false;\n\n function pump(key, value) {\n waiting = true;\n value = new Promise(function (resolve) { resolve(inner[key](value)); });\n return { done: false, value: awaitWrap(value) };\n };\n\n if (typeof Symbol === "function" && Symbol.iterator) {\n iter[Symbol.iterator] = function () { return this; };\n }\n\n iter.next = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n return pump("next", value);\n };\n\n if (typeof inner.throw === "function") {\n iter.throw = function (value) {\n if (waiting) {\n waiting = false;\n throw value;\n }\n return pump("throw", value);\n };\n }\n\n if (typeof inner.return === "function") {\n iter.return = function (value) {\n return pump("return", value);\n };\n }\n\n return iter;\n })\n'),i.asyncToGenerator=(0,n.default)('\n (function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n return new Promise(function (resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function (value) {\n step("next", value);\n }, function (err) {\n step("throw", err);\n });\n }\n }\n\n return step("next");\n });\n };\n })\n'),i.classCallCheck=(0,n.default)('\n (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n });\n'),i.createClass=(0,n.default)('\n (function() {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i ++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n })()\n'),i.defineEnumerableProperties=(0,n.default)('\n (function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if ("value" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n return obj;\n })\n'),i.defaults=(0,n.default)("\n (function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n return obj;\n })\n"),i.defineProperty=(0,n.default)("\n (function (obj, key, value) {\n // Shortcircuit the slow defineProperty path when possible.\n // We are trying to avoid issues where setters defined on the\n // prototype cause side effects under the fast path of simple\n // assignment. By checking for existence of the property with\n // the in operator, we can optimize most of this overhead away.\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n });\n"),i.extends=(0,n.default)("\n Object.assign || (function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n })\n"),i.get=(0,n.default)('\n (function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if ("value" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n });\n'),i.inherits=(0,n.default)('\n (function (subClass, superClass) {\n if (typeof superClass !== "function" && superClass !== null) {\n throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n })\n'),i.instanceof=(0,n.default)('\n (function (left, right) {\n if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n });\n'),i.interopRequireDefault=(0,n.default)("\n (function (obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n })\n"),i.interopRequireWildcard=(0,n.default)("\n (function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n newObj.default = obj;\n return newObj;\n }\n })\n"),i.newArrowCheck=(0,n.default)('\n (function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError("Cannot instantiate an arrow function");\n }\n });\n'),i.objectDestructuringEmpty=(0,n.default)('\n (function (obj) {\n if (obj == null) throw new TypeError("Cannot destructure undefined");\n });\n'),i.objectWithoutProperties=(0,n.default)("\n (function (obj, keys) {\n var target = {};\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n return target;\n })\n"),i.possibleConstructorReturn=(0,n.default)('\n (function (self, call) {\n if (!self) {\n throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");\n }\n return call && (typeof call === "object" || typeof call === "function") ? call : self;\n });\n'),i.selfGlobal=(0,n.default)('\n typeof global === "undefined" ? self : global\n'),i.set=(0,n.default)('\n (function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if ("value" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n });\n'),i.slicedToArray=(0,n.default)('\n (function () {\n // Broken out into a separate function to avoid deoptimizations due to the try/catch for the\n // array iterator case.\n function sliceIterator(arr, i) {\n // this is an expanded form of `for...of` that properly supports abrupt completions of\n // iterators etc. variable names have been minimised to reduce the size of this massive\n // helper. sometimes spec compliancy is annoying :(\n //\n // _n = _iteratorNormalCompletion\n // _d = _didIteratorError\n // _e = _iteratorError\n // _i = _iterator\n // _s = _step\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i["return"]) _i["return"]();\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError("Invalid attempt to destructure non-iterable instance");\n }\n };\n })();\n'),i.slicedToArrayLoose=(0,n.default)('\n (function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n if (i && _arr.length === i) break;\n }\n return _arr;\n } else {\n throw new TypeError("Invalid attempt to destructure non-iterable instance");\n }\n });\n'),i.taggedTemplateLiteral=(0,n.default)("\n (function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: { value: Object.freeze(raw) }\n }));\n });\n"),i.taggedTemplateLiteralLoose=(0,n.default)("\n (function (strings, raw) {\n strings.raw = raw;\n return strings;\n });\n"),i.temporalRef=(0,n.default)('\n (function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + " is not defined - temporal dead zone");\n } else {\n return val;\n }\n })\n'),i.temporalUndefined=(0,n.default)("\n ({})\n"),i.toArray=(0,n.default)("\n (function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n });\n"),i.toConsumableArray=(0,n.default)("\n (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n return arr2;\n } else {\n return Array.from(arr);\n }\n });\n"),t.exports=r.default},{"babel-template":139}],109:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=a.default[e];if(!t)throw new ReferenceError("Unknown helper "+e);return t().expression}r.__esModule=!0,r.list=void 0;var s=n(e("babel-runtime/core-js/object/keys"));r.get=i;var a=n(e("./helpers"));r.list=(0,s.default)(a.default).map(function(e){return e.replace(/^_/,"")}).filter(function(e){return"__esModule"!==e});r.default=i},{"./helpers":108,"babel-runtime/core-js/object/keys":127}],110:[function(e,t,r){"use strict";function n(e){return e.map(function(e){if(null!=e&&e.inspect)return e.inspect();try{return(0,i.default)(e)||e+""}catch(t){return s.inspect(e)}})}r.__esModule=!0,r.MESSAGES=void 0;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/json/stringify"));r.get=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),s=1;s4&&void 0!==arguments[4]&&arguments[4];if(t||(t=e.node),!d.isFor(r))for(var s=0;s0&&e.traverse(v,t),e.skip()}},f.visitor]),v=h.default.visitors.merge([{ReferencedIdentifier:function(e,t){var r=t.letReferences[e.node.name];if(r){var n=e.scope.getBindingIdentifier(e.node.name);n&&n!==r||(t.closurify=!0)}}},f.visitor]),x={enter:function(e,t){var r=e.node;e.parent;if(e.isForStatement()){if(o(r.init)){var n=t.pushDeclar(r.init);1===n.length?r.init=n[0]:r.init=d.sequenceExpression(n)}}else if(e.isFor())o(r.left)&&(t.pushDeclar(r.left),r.left=r.left.declarations[0].id);else if(o(r))e.replaceWithMultiple(t.pushDeclar(r).map(function(e){return d.expressionStatement(e)}));else if(e.isFunction())return e.skip()}},E={LabeledStatement:function(e,t){var r=e.node;t.innerLabels.push(r.label.name)}},A={enter:function(e,t){if(e.isAssignmentExpression()||e.isUpdateExpression()){var r=e.getBindingIdentifiers();for(var n in r)t.outsideReferences[n]===e.scope.getBindingIdentifier(n)&&(t.reassignments[n]=!0)}}},D={Loop:function(e,t){var r=t.ignoreLabeless;t.ignoreLabeless=!0,e.traverse(D,t),t.ignoreLabeless=r,e.skip()},Function:function(e){e.skip()},SwitchCase:function(e,t){var r=t.inSwitchCase;t.inSwitchCase=!0,e.traverse(D,t),t.inSwitchCase=r,e.skip()},"BreakStatement|ContinueStatement|ReturnStatement":function(e,t){var r=e.node,n=e.parent,i=e.scope;if(!r[this.LOOP_IGNORE]){var s=void 0,a=u(r);if(a){if(r.label){if(t.innerLabels.indexOf(r.label.name)>=0)return;a=a+"|"+r.label.name}else{if(t.ignoreLabeless)return;if(t.inSwitchCase)return;if(d.isBreakStatement(r)&&d.isSwitchCase(n))return}t.hasBreakContinue=!0,t.map[a]=r,s=d.stringLiteral(a)}e.isReturnStatement()&&(t.hasReturn=!0,s=d.objectExpression([d.objectProperty(d.identifier("v"),r.argument||i.buildUndefinedNode())])),s&&((s=d.returnStatement(s))[this.LOOP_IGNORE]=!0,e.skip(),e.replaceWith(d.inherits(s,r)))}}},C=function(){function e(t,r,n,i,s){(0,p.default)(this,e),this.parent=n,this.scope=i,this.file=s,this.blockPath=r,this.block=r.node,this.outsideLetReferences=(0,c.default)(null),this.hasLetReferences=!1,this.letReferences=(0,c.default)(null),this.body=[],t&&(this.loopParent=t.parent,this.loopLabel=d.isLabeledStatement(this.loopParent)&&this.loopParent.label,this.loopPath=t,this.loop=t.node)}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var t=this.getLetReferences();if(d.isFunction(this.parent)||d.isProgram(this.block))this.updateScopeInfo();else if(this.hasLetReferences)return t?this.wrapClosure():this.remap(),this.updateScopeInfo(t),this.loopLabel&&!d.isLabeledStatement(this.loopParent)?d.labeledStatement(this.loopLabel,this.loop):void 0}},e.prototype.updateScopeInfo=function(e){var t=this.scope,r=t.getFunctionParent(),n=this.letReferences;for(var i in n){var s=n[i],a=t.getBinding(s.name);a&&("let"!==a.kind&&"const"!==a.kind||(a.kind="var",e?t.removeBinding(s.name):t.moveBindingTo(s.name,r)))}},e.prototype.remap=function(){var e=this.letReferences,t=this.scope;for(var r in e){var n=e[r];(t.parentHasBinding(r)||t.hasGlobal(r))&&(t.hasOwnBinding(r)&&t.rename(n.name),this.blockPath.scope.hasOwnBinding(r)&&this.blockPath.scope.rename(n.name))}},e.prototype.wrapClosure=function(){if(this.file.opts.throwIfClosureRequired)throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure (throwIfClosureRequired).");var e=this.block,t=this.outsideLetReferences;if(this.loop)for(var r in t){var n=t[r];(this.scope.hasGlobal(n.name)||this.scope.parentHasBinding(n.name))&&(delete t[n.name],delete this.letReferences[n.name],this.scope.rename(n.name),this.letReferences[n.name]=n,t[n.name]=n)}this.has=this.checkLoop(),this.hoistVarDeclarations();var i=(0,m.default)(t),s=(0,m.default)(t),a=this.blockPath.isSwitchStatement(),o=d.functionExpression(null,i,d.blockStatement(a?[e]:e.body));o.shadow=!0,this.addContinuations(o);var u=o;this.loop&&(u=this.scope.generateUidIdentifier("loop"),this.loopPath.insertBefore(d.variableDeclaration("var",[d.variableDeclarator(u,o)])));var l=d.callExpression(u,s),c=this.scope.generateUidIdentifier("ret");h.default.hasType(o.body,this.scope,"YieldExpression",d.FUNCTION_TYPES)&&(o.generator=!0,l=d.yieldExpression(l,!0)),h.default.hasType(o.body,this.scope,"AwaitExpression",d.FUNCTION_TYPES)&&(o.async=!0,l=d.awaitExpression(l)),this.buildClosure(c,l),a?this.blockPath.replaceWithMultiple(this.body):e.body=this.body},e.prototype.buildClosure=function(e,t){var r=this.has;r.hasReturn||r.hasBreakContinue?this.buildHas(e,t):this.body.push(d.expressionStatement(t))},e.prototype.addContinuations=function(e){var t={reassignments:{},outsideReferences:this.outsideLetReferences};this.scope.traverse(e,A,t);for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:"value",n=arguments[3],i=void 0;e.static?(this.hasStaticDescriptors=!0,i=this.staticMutatorMap):(this.hasInstanceDescriptors=!0,i=this.instanceMutatorMap);var s=c.push(i,e,r,this.file,n);return t&&(s.enumerable=h.booleanLiteral(!0)),s},e.prototype.constructorMeMaybe=function(){for(var e=!1,t=this.path.get("body.body"),r=Array.isArray(t),n=0,t=r?t:(0,s.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}if(e=i.equals("kind","constructor"))break}if(!e){var a=void 0,o=void 0;if(this.isDerived){var u=f().expression;a=u.params,o=u.body}else a=[],o=h.blockStatement([]);this.path.get("body").unshiftContainer("body",h.classMethod("constructor",h.identifier("constructor"),a,o))}},e.prototype.buildBody=function(){if(this.constructorMeMaybe(),this.pushBody(),this.verifyConstructor(),this.userConstructor){var e=this.constructorBody;e.body=e.body.concat(this.userConstructor.body.body),h.inherits(this.constructor,this.userConstructor),h.inherits(e,this.userConstructor.body)}this.pushDescriptors()},e.prototype.pushBody=function(){for(var e=this.path.get("body.body"),t=Array.isArray(e),r=0,e=t?e:(0,s.default)(e);;){var n;if(t){if(r>=e.length)break;n=e[r++]}else{if((r=e.next()).done)break;n=r.value}var i=n,a=i.node;if(i.isClassProperty())throw i.buildCodeFrameError("Missing class properties transform.");if(a.decorators)throw i.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.");if(h.isClassMethod(a)){var o="constructor"===a.kind;if(o&&(i.traverse(m,this),!this.hasBareSuper&&this.isDerived))throw i.buildCodeFrameError("missing super() call in constructor");var l=new u.default({forceSuperMemoisation:o,methodPath:i,methodNode:a,objectRef:this.classRef,superRef:this.superName,isStatic:a.static,isLoose:this.isLoose,scope:this.scope,file:this.file},!0);l.replace(),o?this.pushConstructor(l,a,i):this.pushMethod(a,i)}}},e.prototype.clearDescriptors=function(){this.hasInstanceDescriptors=!1,this.hasStaticDescriptors=!1,this.instanceMutatorMap={},this.staticMutatorMap={}},e.prototype.pushDescriptors=function(){this.pushInherits();var e=this.body,t=void 0,r=void 0;if(this.hasInstanceDescriptors&&(t=c.toClassObject(this.instanceMutatorMap)),this.hasStaticDescriptors&&(r=c.toClassObject(this.staticMutatorMap)),t||r){t&&(t=c.toComputedObjectFromClass(t)),r&&(r=c.toComputedObjectFromClass(r));var n=h.nullLiteral(),i=[this.classRef,n,n,n,n];t&&(i[1]=t),r&&(i[2]=r),this.instanceInitializersId&&(i[3]=this.instanceInitializersId,e.unshift(this.buildObjectAssignment(this.instanceInitializersId))),this.staticInitializersId&&(i[4]=this.staticInitializersId,e.unshift(this.buildObjectAssignment(this.staticInitializersId)));for(var s=0,a=0;a=o.length)break;c=o[l++]}else{if((l=o.next()).done)break;c=l.value}var p=c;this.wrapSuperCall(p,i,a,r),n&&p.find(function(e){return e===t||(e.isLoop()||e.isConditional()?(n=!1,!0):void 0)})}for(var f=this.superThises,d=Array.isArray(f),m=0,f=d?f:(0,s.default)(f);;){var g;if(d){if(m>=f.length)break;g=f[m++]}else{if((m=f.next()).done)break;g=m.value}g.replaceWith(a)}var b=function(t){return h.callExpression(e.file.addHelper("possibleConstructorReturn"),[a].concat(t||[]))},v=r.get("body");v.length&&!v.pop().isReturnStatement()&&r.pushContainer("body",h.returnStatement(n?a:b()));for(var x=this.superReturns,E=Array.isArray(x),A=0,x=E?x:(0,s.default)(x);;){var D;if(E){if(A>=x.length)break;D=x[A++]}else{if((A=x.next()).done)break;D=A.value}var C=D;if(C.node.argument){var S=C.scope.generateDeclaredUidIdentifier("ret");C.get("argument").replaceWithMultiple([h.assignmentExpression("=",S,C.node.argument),b(S)])}else C.get("argument").replaceWith(b())}}},e.prototype.pushMethod=function(e,t){var r=t?t.scope:this.scope;"method"===e.kind&&this._processMethod(e,r)||this.pushToMap(e,!1,null,r)},e.prototype._processMethod=function(){return!1},e.prototype.pushConstructor=function(e,t,r){this.bareSupers=e.bareSupers,this.superReturns=e.returns,r.scope.hasOwnBinding(this.classRef.name)&&r.scope.rename(this.classRef.name);var n=this.constructor;this.userConstructorPath=r,this.userConstructor=t,this.hasConstructor=!0,h.inheritsComments(n,t),n._ignoreUserWhitespace=!0,n.params=t.params,h.inherits(n.body,t.body),n.body.directives=t.body.directives,this._pushConstructor()},e.prototype._pushConstructor=function(){this.pushedConstructor||(this.pushedConstructor=!0,(this.hasInstanceDescriptors||this.hasStaticDescriptors)&&this.pushDescriptors(),this.body.push(this.constructor),this.pushInherits())},e.prototype.pushInherits=function(){this.isDerived&&!this.pushedInherits&&(this.pushedInherits=!0,this.body.unshift(h.expressionStatement(h.callExpression(this.file.addHelper("inherits"),[this.classRef,this.superName]))))},e}();r.default=g,t.exports=r.default},{"babel-helper-define-map":103,"babel-helper-optimise-call-expression":106,"babel-helper-replace-supers":107,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-template":139,"babel-traverse":143,"babel-types":178}],119:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e){function t(e){var t=e.node,r=e.scope,n=[],i=t.right;if(!a.isIdentifier(i)||!r.hasBinding(i.name)){var s=r.generateUidIdentifier("arr");n.push(a.variableDeclaration("var",[a.variableDeclarator(s,i)])),i=s}var u=r.generateUidIdentifier("i"),l=o({BODY:t.body,KEY:u,ARR:i});a.inherits(l,t),a.ensureBlock(l);var c=a.memberExpression(i,u,!0),p=t.left;return a.isVariableDeclaration(p)?(p.declarations[0].init=c,l.body.body.unshift(p)):l.body.body.unshift(a.expressionStatement(a.assignmentExpression("=",p,c))),e.parentPath.isLabeledStatement()&&(l=a.labeledStatement(e.parentPath.node.label,l)),n.push(l),n}function r(e,t){var r=e.node,n=e.scope,s=e.parent,o=r.left,l=void 0,c=void 0;if(a.isIdentifier(o)||a.isPattern(o)||a.isMemberExpression(o))c=o;else{if(!a.isVariableDeclaration(o))throw t.buildCodeFrameError(o,i.get("unknownForHead",o.type));c=n.generateUidIdentifier("ref"),l=a.variableDeclaration(o.kind,[a.variableDeclarator(o.declarations[0].id,c)])}var p=n.generateUidIdentifier("iterator"),h=n.generateUidIdentifier("isArray"),f=u({LOOP_OBJECT:p,IS_ARRAY:h,OBJECT:r.right,INDEX:n.generateUidIdentifier("i"),ID:c});l||f.body.body.shift();var d=a.isLabeledStatement(s),m=void 0;return d&&(m=a.labeledStatement(s.label,f)),{replaceParent:d,declar:l,node:m||f,loop:f}}function n(e,t){var r=e.node,n=e.scope,s=e.parent,o=r.left,u=void 0,c=n.generateUidIdentifier("step"),p=a.memberExpression(c,a.identifier("value"));if(a.isIdentifier(o)||a.isPattern(o)||a.isMemberExpression(o))u=a.expressionStatement(a.assignmentExpression("=",o,p));else{if(!a.isVariableDeclaration(o))throw t.buildCodeFrameError(o,i.get("unknownForHead",o.type));u=a.variableDeclaration(o.kind,[a.variableDeclarator(o.declarations[0].id,p)])}var h=n.generateUidIdentifier("iterator"),f=l({ITERATOR_HAD_ERROR_KEY:n.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:n.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:n.generateUidIdentifier("iteratorError"),ITERATOR_KEY:h,STEP_KEY:c,OBJECT:r.right,BODY:null}),d=a.isLabeledStatement(s),m=f[3].block.body,y=m[0];return d&&(m[0]=a.labeledStatement(s.label,y)),{replaceParent:d,declar:u,loop:y,node:f}}var i=e.messages,s=e.template,a=e.types,o=s("\n for (var KEY = 0; KEY < ARR.length; KEY++) BODY;\n "),u=s("\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n var ID;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n "),l=s("\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n ");return{visitor:{ForOfStatement:function(e,i){if(e.get("right").isArrayExpression())return e.parentPath.isLabeledStatement()?e.parentPath.replaceWithMultiple(t(e)):e.replaceWithMultiple(t(e));var s=n;i.opts.loose&&(s=r);var o=e.node,u=s(e,i),l=u.declar,c=u.loop,p=c.body;e.ensureBlock(),l&&p.body.push(l),p.body=p.body.concat(o.body.body),a.inherits(c,o),a.inherits(c.body,o.body),u.replaceParent?(e.parentPath.replaceWithMultiple(u.node),e.remove()):e.replaceWithMultiple(u.node)}}}},t.exports=r.default},{}],120:[function(e,t,r){t.exports={default:e("core-js/library/fn/get-iterator"),__esModule:!0}},{"core-js/library/fn/get-iterator":194}],121:[function(e,t,r){t.exports={default:e("core-js/library/fn/json/stringify"),__esModule:!0}},{"core-js/library/fn/json/stringify":195}],122:[function(e,t,r){t.exports={default:e("core-js/library/fn/map"),__esModule:!0}},{"core-js/library/fn/map":196}],123:[function(e,t,r){t.exports={default:e("core-js/library/fn/number/max-safe-integer"),__esModule:!0}},{"core-js/library/fn/number/max-safe-integer":197}],124:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":198}],125:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":199}],126:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/get-own-property-symbols"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-symbols":200}],127:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":201}],128:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/set-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/set-prototype-of":202}],129:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":204}],130:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol/for"),__esModule:!0}},{"core-js/library/fn/symbol/for":203}],131:[function(e,t,r){t.exports={default:e("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":205}],132:[function(e,t,r){t.exports={default:e("core-js/library/fn/weak-map"),__esModule:!0}},{"core-js/library/fn/weak-map":206}],133:[function(e,t,r){t.exports={default:e("core-js/library/fn/weak-set"),__esModule:!0}},{"core-js/library/fn/weak-set":207}],134:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},{}],135:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("../core-js/object/set-prototype-of")),s=n(e("../core-js/object/create")),a=n(e("../helpers/typeof"));r.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,a.default)(t)));e.prototype=(0,s.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(i.default?(0,i.default)(e,t):e.__proto__=t)}},{"../core-js/object/create":125,"../core-js/object/set-prototype-of":128,"../helpers/typeof":138}],136:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}},{}],137:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("../helpers/typeof"));r.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,n.default)(t))&&"function"!=typeof t?e:t}},{"../helpers/typeof":138}],138:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("../core-js/symbol/iterator")),s=n(e("../core-js/symbol")),a="function"==typeof s.default&&"symbol"==typeof i.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":typeof e};r.default="function"==typeof s.default&&"symbol"===a(i.default)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":void 0===e?"undefined":a(e)}},{"../core-js/symbol":129,"../core-js/symbol/iterator":131}],139:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){var r=(e=(0,o.default)(e)).program;return t.length&&(0,c.default)(e,m,null,t),r.body.length>1?r.body:r.body[0]}r.__esModule=!0;var a=i(e("babel-runtime/core-js/symbol"));r.default=function(e,t){var r=void 0;try{throw new Error}catch(e){e.stack&&(r=e.stack.split("\n").slice(1).join("\n"))}t=(0,u.default)({allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0,preserveComments:!1},t);var n=function(){var i=void 0;try{i=p.parse(e,t),i=c.default.removeProperties(i,{preserveComments:t.preserveComments}),c.default.cheap(i,function(e){e[f]=!0})}catch(e){throw e.stack=e.stack+"from\n"+r,e}return n=function(){return i},i};return function(){for(var e=arguments.length,t=Array(e),r=0;r=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}if(e[o])return!0}return!1},e.prototype.create=function(e,t,r,n){return o.default.get({parentPath:this.parentPath,parent:e,container:t,key:r,listKey:n})},e.prototype.maybeQueue=function(e,t){if(this.trap)throw new Error("Infinite cycle detected");this.queue&&(t?this.queue.push(e):this.priorityQueue.push(e))},e.prototype.visitMultiple=function(e,t,r){if(0===e.length)return!1;for(var n=[],i=0;i=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var u=o;if(u.resync(),0!==u.contexts.length&&u.contexts[u.contexts.length-1]===this||u.pushContext(this),null!==u.key&&(l&&e.length>=1e4&&(this.trap=!0),!(t.indexOf(u.node)>=0))){if(t.push(u.node),u.visit()){r=!0;break}if(this.priorityQueue.length&&(r=this.visitQueue(this.priorityQueue),this.priorityQueue=[],this.queue=e,r))break}}for(var c=e,p=Array.isArray(c),h=0,c=p?c:(0,s.default)(c);;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if((h=c.next()).done)break;f=h.value}f.popContext()}return this.queue=null,r},e.prototype.visit=function(e,t){var r=e[t];return!!r&&(Array.isArray(r)?this.visitMultiple(r,e,t):this.visitSingle(e,t))},e}();r.default=c,t.exports=r.default}).call(this,e("_process"))},{"./path":150,_process:550,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-types":178}],142:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/helpers/classCallCheck"));r.default=function e(t,r){(0,n.default)(this,e),this.file=t,this.options=r},t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134}],143:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r,n,i){if(e){if(t||(t={}),!t.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error(f.get("traverseNeedsParent",e.type));h.explode(t),s.node(e,t,r,n,i)}}function a(e,t){e.node.type===t.type&&(t.has=!0,e.stop())}r.__esModule=!0,r.visitors=r.Hub=r.Scope=r.NodePath=void 0;var o=i(e("babel-runtime/core-js/get-iterator")),u=e("./path");Object.defineProperty(r,"NodePath",{enumerable:!0,get:function(){return i(u).default}});var l=e("./scope");Object.defineProperty(r,"Scope",{enumerable:!0,get:function(){return i(l).default}});var c=e("./hub");Object.defineProperty(r,"Hub",{enumerable:!0,get:function(){return i(c).default}}),r.default=s;var p=i(e("./context")),h=n(e("./visitors")),f=n(e("babel-messages")),d=i(e("lodash/includes")),m=n(e("babel-types")),y=n(e("./cache"));r.visitors=h,s.visitors=h,s.verify=h.verify,s.explode=h.explode,s.NodePath=e("./path"),s.Scope=e("./scope"),s.Hub=e("./hub"),s.cheap=function(e,t){return m.traverseFast(e,t)},s.node=function(e,t,r,n,i,s){var a=m.VISITOR_KEYS[e.type];if(a)for(var u=new p.default(r,t,n,i),l=a,c=Array.isArray(l),h=0,l=c?l:(0,o.default)(l);;){var f;if(c){if(h>=l.length)break;f=l[h++]}else{if((h=l.next()).done)break;f=h.value}var d=f;if((!s||!s[d])&&u.visit(e,d))return}},s.clearNode=function(e,t){m.removeProperties(e,t),y.path.delete(e)},s.removeProperties=function(e,t){return m.traverseFast(e,s.clearNode,t),e},s.hasType=function(e,t,r,n){if((0,d.default)(n,e.type))return!1;if(e.type===r)return!0;var i={has:!1,type:r};return s(e,{blacklist:n,enter:a},t,i),i.has},s.clearCache=function(){y.clear()},s.clearCache.clearPath=y.clearPath,s.clearCache.clearScope=y.clearScope,s.copyCache=function(e,t){y.path.has(e)&&y.path.set(t,y.path.get(e))}},{"./cache":140,"./context":141,"./hub":142,"./path":150,"./scope":162,"./visitors":164,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-types":178,"lodash/includes":507}],144:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator"));r.findParent=function(e){for(var t=this;t=t.parentPath;)if(e(t))return t;return null},r.find=function(e){var t=this;do{if(e(t))return t}while(t=t.parentPath);return null},r.getFunctionParent=function(){return this.findParent(function(e){return e.isFunction()||e.isProgram()})},r.getStatementParent=function(){var e=this;do{if(Array.isArray(e.container))return e}while(e=e.parentPath)},r.getEarliestCommonAncestorFrom=function(e){return this.getDeepestCommonAncestorFrom(e,function(e,t,r){for(var n=void 0,a=s.VISITOR_KEYS[e.type],o=r,u=Array.isArray(o),l=0,o=u?o:(0,i.default)(o);;){var c;if(u){if(l>=o.length)break;c=o[l++]}else{if((l=o.next()).done)break;c=l.value}var p=c[t+1];n?p.listKey&&n.listKey===p.listKey&&p.keya.indexOf(p.parentKey)&&(n=p):n=p}return n})},r.getDeepestCommonAncestorFrom=function(e,t){var r=this;if(!e.length)return this;if(1===e.length)return e[0];var n=1/0,s=void 0,a=void 0,o=e.map(function(e){var t=[];do{t.unshift(e)}while((e=e.parentPath)&&e!==r);return t.length=p.length)break;d=p[f++]}else{if((f=p.next()).done)break;d=f.value}if(d[l]!==c)break e}s=l,a=c}if(a)return t?t(a,s,o):a;throw new Error("Couldn't find intersection")},r.getAncestry=function(){var e=this,t=[];do{t.push(e)}while(e=e.parentPath);return t},r.isAncestor=function(e){return e.isDescendant(this)},r.isDescendant=function(e){return!!this.findParent(function(t){return t===e})},r.inType=function(){for(var e=this;e;){for(var t=arguments,r=Array.isArray(t),n=0,t=r?t:(0,i.default)(t);;){var s;if(r){if(n>=t.length)break;s=t[n++]}else{if((n=t.next()).done)break;s=n.value}var a=s;if(e.node.type===a)return!0}e=e.parentPath}return!1},r.inShadow=function(e){var t=this.isFunction()?this:this.findParent(function(e){return e.isFunction()});if(t){if(t.isFunctionExpression()||t.isFunctionDeclaration()){var r=t.node.shadow;if(r&&(!e||!1!==r[e]))return t}else if(t.isArrowFunctionExpression())return t;return null}};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));n(e("./index"))},{"./index":150,"babel-runtime/core-js/get-iterator":120,"babel-types":178}],145:[function(e,t,r){"use strict";r.__esModule=!0,r.shareCommentsWithSiblings=function(){if("string"!=typeof this.key){var e=this.node;if(e){var t=e.trailingComments,r=e.leadingComments;if(t||r){var n=this.getSibling(this.key-1),i=this.getSibling(this.key+1);n.node||(n=i),i.node||(i=n),n.addComments("trailing",r),i.addComments("leading",t)}}}},r.addComment=function(e,t,r){this.addComments(e,[{type:r?"CommentLine":"CommentBlock",value:t}])},r.addComments=function(e,t){if(t){var r=this.node;if(r){var n=e+"Comments";r[n]?r[n]=r[n].concat(t):r[n]=t}}}},{}],146:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator"));r.call=function(e){var t=this.opts;return this.debug(function(){return e}),!(!this.node||!this._call(t[e]))||!!this.node&&this._call(t[this.node.type]&&t[this.node.type][e])},r._call=function(e){if(!e)return!1;for(var t=e,r=Array.isArray(t),n=0,t=r?t:(0,i.default)(t);;){var s;if(r){if(n>=t.length)break;s=t[n++]}else{if((n=t.next()).done)break;s=n.value}var a=s;if(a){var o=this.node;if(!o)return!0;if(a.call(this.state,this,this.state))throw new Error("Unexpected return value from visitor method "+a);if(this.node!==o)return!0;if(this.shouldStop||this.shouldSkip||this.removed)return!0}}return!1},r.isBlacklisted=function(){var e=this.opts.blacklist;return e&&e.indexOf(this.node.type)>-1},r.visit=function(){return!!this.node&&!this.isBlacklisted()&&(!this.opts.shouldSkip||!this.opts.shouldSkip(this))&&(this.call("enter")||this.shouldSkip?(this.debug(function(){return"Skip..."}),this.shouldStop):(this.debug(function(){return"Recursing into..."}),s.default.node(this.node,this.opts,this.scope,this.state,this,this.skipKeys),this.call("exit"),this.shouldStop))},r.skip=function(){this.shouldSkip=!0},r.skipKey=function(e){this.skipKeys[e]=!0},r.stop=function(){this.shouldStop=!0,this.shouldSkip=!0},r.setScope=function(){if(!this.opts||!this.opts.noScope){var e=this.context&&this.context.scope;if(!e)for(var t=this.parentPath;t&&!e;){if(t.opts&&t.opts.noScope)return;e=t.scope,t=t.parentPath}this.scope=this.getScope(e),this.scope&&this.scope.init()}},r.setContext=function(e){return this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.skipKeys={},e&&(this.context=e,this.state=e.state,this.opts=e.opts),this.setScope(),this},r.resync=function(){this.removed||(this._resyncParent(),this._resyncList(),this._resyncKey())},r._resyncParent=function(){this.parentPath&&(this.parent=this.parentPath.node)},r._resyncKey=function(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:this;if(!e.removed)for(var t=this.contexts,r=Array.isArray(t),n=0,t=r?t:(0,i.default)(t);;){var s;if(r){if(n>=t.length)break;s=t[n++]}else{if((n=t.next()).done)break;s=n.value}s.maybeQueue(e)}},r._getQueueContexts=function(){for(var e=this,t=this.contexts;!t.length;)t=(e=e.parentPath).contexts;return t};var s=n(e("../index"))},{"../index":143,"babel-runtime/core-js/get-iterator":120}],147:[function(e,t,r){"use strict";r.__esModule=!0,r.toComputedKey=function(){var e=this.node,t=void 0;if(this.isMemberExpression())t=e.property;else{if(!this.isProperty()&&!this.isMethod())throw new ReferenceError("todo");t=e.key}return e.computed||n.isIdentifier(t)&&(t=n.stringLiteral(t.name)),t},r.ensureBlock=function(){return n.ensureBlock(this.node)},r.arrowFunctionToShadowed=function(){if(this.isArrowFunctionExpression()){this.ensureBlock();var e=this.node;e.expression=!1,e.type="FunctionExpression",e.shadow=e.shadow||!0}};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))},{"babel-types":178}],148:[function(e,t,r){(function(t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/typeof")),s=n(e("babel-runtime/core-js/get-iterator")),a=n(e("babel-runtime/core-js/map"));r.evaluateTruthy=function(){var e=this.evaluate();if(e.confident)return!!e.value},r.evaluate=function(){function e(e){l&&(c=e,l=!1)}function r(t){var r=t.node;if(p.has(r)){var i=p.get(r);return i.resolved?i.value:void e(t)}var s={resolved:!1};p.set(r,s);var a=n(t);return l&&(s.resolved=!0,s.value=a),a}function n(n){if(l){var a=n.node;if(n.isSequenceExpression()){var c=n.get("expressions");return r(c[c.length-1])}if(n.isStringLiteral()||n.isNumericLiteral()||n.isBooleanLiteral())return a.value;if(n.isNullLiteral())return null;if(n.isTemplateLiteral()){for(var p="",h=0,f=n.get("expressions"),d=a.quasis,m=Array.isArray(d),y=0,d=m?d:(0,s.default)(d);;){var g;if(m){if(y>=d.length)break;g=d[y++]}else{if((y=d.next()).done)break;g=y.value}if(!l)break;p+=g.value.cooked;var b=f[h++];b&&(p+=String(r(b)))}if(!l)return;return p}if(n.isConditionalExpression()){var v=r(n.get("test"));if(!l)return;return r(v?n.get("consequent"):n.get("alternate"))}if(n.isExpressionWrapper())return r(n.get("expression"));if(n.isMemberExpression()&&!n.parentPath.isCallExpression({callee:a})){var x=n.get("property"),E=n.get("object");if(E.isLiteral()&&x.isIdentifier()){var A=E.node.value,D=void 0===A?"undefined":(0,i.default)(A);if("number"===D||"string"===D)return A[x.node.name]}}if(n.isReferencedIdentifier()){var C=n.scope.getBinding(a.name);if(C&&C.constantViolations.length>0)return e(C.path);if(C&&n.node.start=F.length)break;B=F[P++]}else{if((P=F.next()).done)break;B=P.value}var O=B;if(!(O=O.evaluate()).confident)return e(O);k.push(O.value)}return k}if(n.isObjectExpression()){for(var j={},N=n.get("properties"),I=Array.isArray(N),L=0,N=I?N:(0,s.default)(N);;){var M;if(I){if(L>=N.length)break;M=N[L++]}else{if((L=N.next()).done)break;M=L.value}var R=M;if(R.isObjectMethod()||R.isSpreadProperty())return e(R);var V=R.get("key"),U=V;if(R.node.computed){if(!(U=U.evaluate()).confident)return e(V);U=U.value}else U=U.isIdentifier()?U.node.name:U.node.value;var q=R.get("value"),G=q.evaluate();if(!G.confident)return e(q);G=G.value,j[U]=G}return j}if(n.isLogicalExpression()){var X=l,W=r(n.get("left")),J=l;l=X;var K=r(n.get("right")),z=l;switch(l=J&&z,a.operator){case"||":if(W&&J)return l=!0,W;if(!l)return;return W||K;case"&&":if((!W&&J||!K&&z)&&(l=!0),!l)return;return W&&K}}if(n.isBinaryExpression()){var Y=r(n.get("left"));if(!l)return;var H=r(n.get("right"));if(!l)return;switch(a.operator){case"-":return Y-H;case"+":return Y+H;case"/":return Y/H;case"*":return Y*H;case"%":return Y%H;case"**":return Math.pow(Y,H);case"<":return Y":return Y>H;case"<=":return Y<=H;case">=":return Y>=H;case"==":return Y==H;case"!=":return Y!=H;case"===":return Y===H;case"!==":return Y!==H;case"|":return Y|H;case"&":return Y&H;case"^":return Y^H;case"<<":return Y<>":return Y>>H;case">>>":return Y>>>H}}if(n.isCallExpression()){var $=n.get("callee"),Q=void 0,Z=void 0;if($.isIdentifier()&&!n.scope.getBinding($.node.name,!0)&&o.indexOf($.node.name)>=0&&(Z=t[a.callee.name]),$.isMemberExpression()){var ee=$.get("object"),te=$.get("property");if(ee.isIdentifier()&&te.isIdentifier()&&o.indexOf(ee.node.name)>=0&&u.indexOf(te.node.name)<0&&(Z=(Q=t[ee.node.name])[te.node.name]),ee.isLiteral()&&te.isIdentifier()){var re=(0,i.default)(ee.node.value);"string"!==re&&"number"!==re||(Z=(Q=ee.node.value)[te.node.name])}}if(Z){var ne=n.get("arguments").map(r);if(!l)return;return Z.apply(Q,ne)}}e(n)}}var l=!0,c=void 0,p=new a.default,h=r(this);return l||(h=void 0),{confident:l,deopt:c,value:h}};var o=["String","Number","Math"],u=["random"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/map":122,"babel-runtime/helpers/typeof":138}],149:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/object/create")),s=n(e("babel-runtime/core-js/get-iterator"));r.getStatementParent=function(){var e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e},r.getOpposite=function(){return"left"===this.key?this.getSibling("right"):"right"===this.key?this.getSibling("left"):void 0},r.getCompletionRecords=function(){var e=[],t=function(t){t&&(e=e.concat(t.getCompletionRecords()))};if(this.isIfStatement())t(this.get("consequent")),t(this.get("alternate"));else if(this.isDoExpression()||this.isFor()||this.isWhile())t(this.get("body"));else if(this.isProgram()||this.isBlockStatement())t(this.get("body").pop());else{if(this.isFunction())return this.get("body").getCompletionRecords();this.isTryStatement()?(t(this.get("block")),t(this.get("handler")),t(this.get("finalizer"))):e.push(this)}return e},r.getSibling=function(e){return a.default.get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:e})},r.getPrevSibling=function(){return this.getSibling(this.key-1)},r.getNextSibling=function(){return this.getSibling(this.key+1)},r.getAllNextSiblings=function(){for(var e=this.key,t=this.getSibling(++e),r=[];t.node;)r.push(t),t=this.getSibling(++e);return r},r.getAllPrevSiblings=function(){for(var e=this.key,t=this.getSibling(--e),r=[];t.node;)r.push(t),t=this.getSibling(--e);return r},r.get=function(e,t){!0===t&&(t=this.context);var r=e.split(".");return 1===r.length?this._getKey(e,t):this._getPattern(r,t)},r._getKey=function(e,t){var r=this,n=this.node,i=n[e];return Array.isArray(i)?i.map(function(s,o){return a.default.get({listKey:e,parentPath:r,parent:n,container:i,key:o}).setContext(t)}):a.default.get({parentPath:this,parent:n,container:n,key:e}).setContext(t)},r._getPattern=function(e,t){for(var r=this,n=e,i=Array.isArray(n),a=0,n=i?n:(0,s.default)(n);;){var o;if(i){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var u=o;r="."===u?r.parentPath:Array.isArray(r)?r[u]:r.get(u,t)}return r},r.getBindingIdentifiers=function(e){return o.getBindingIdentifiers(this.node,e)},r.getOuterBindingIdentifiers=function(e){return o.getOuterBindingIdentifiers(this.node,e)},r.getBindingIdentifierPaths=function(){for(var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=[].concat(this),n=(0,i.default)(null);r.length;){var s=r.shift();if(s&&s.node){var a=o.getBindingIdentifiers.keys[s.node.type];if(s.isIdentifier())e?(n[s.node.name]=n[s.node.name]||[]).push(s):n[s.node.name]=s;else if(s.isExportDeclaration()){var u=s.get("declaration");u.isDeclaration()&&r.push(u)}else{if(t){if(s.isFunctionDeclaration()){r.push(s.get("id"));continue}if(s.isFunctionExpression())continue}if(a)for(var l=0;l1&&void 0!==arguments[1]?arguments[1]:SyntaxError;return this.hub.file.buildCodeFrameError(this.node,e,t)},e.prototype.traverse=function(e,t){(0,c.default)(this.node,e,this.scope,t,this)},e.prototype.mark=function(e,t){this.hub.file.metadata.marked.push({type:e,message:t,loc:this.node.loc})},e.prototype.set=function(e,t){f.validate(this.node,e,t),this.node[e]=t},e.prototype.getPathLocation=function(){var e=[],t=this;do{var r=t.key;t.inList&&(r=t.listKey+"["+r+"]"),e.unshift(r)}while(t=t.parentPath);return e.join(".")},e.prototype.debug=function(e){m.enabled&&m(this.getPathLocation()+" "+this.type+": "+e())},e}();r.default=y,(0,p.default)(y.prototype,e("./ancestry")),(0,p.default)(y.prototype,e("./inference")),(0,p.default)(y.prototype,e("./replacement")),(0,p.default)(y.prototype,e("./evaluation")),(0,p.default)(y.prototype,e("./conversion")),(0,p.default)(y.prototype,e("./introspection")),(0,p.default)(y.prototype,e("./context")),(0,p.default)(y.prototype,e("./removal")),(0,p.default)(y.prototype,e("./modification")),(0,p.default)(y.prototype,e("./family")),(0,p.default)(y.prototype,e("./comments"));for(var g=f.TYPES,b=Array.isArray(g),v=0,g=b?g:(0,s.default)(g);;){var x;if("break"===function(){if(b){if(v>=g.length)return"break";x=g[v++]}else{if((v=g.next()).done)return"break";x=v.value}var e=x,t="is"+e;y.prototype[t]=function(e){return f[t](this.node,e)},y.prototype["assert"+e]=function(r){if(!this[t](r))throw new TypeError("Expected node path of type "+e)}}())break}for(var E in o){(function(e){if("_"===e[0])return"continue";f.TYPES.indexOf(e)<0&&f.TYPES.push(e);var t=o[e];y.prototype["is"+e]=function(e){return t.checkPath(this,e)}})(E)}t.exports=r.default},{"../cache":140,"../index":143,"../scope":162,"./ancestry":144,"./comments":145,"./context":146,"./conversion":147,"./evaluation":148,"./family":149,"./inference":151,"./introspection":154,"./lib/virtual-types":157,"./modification":158,"./removal":159,"./replacement":160,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-types":178,debug:165,invariant:318,"lodash/assign":488}],151:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e,t,r){if("string"===e)return o.isStringTypeAnnotation(t);if("number"===e)return o.isNumberTypeAnnotation(t);if("boolean"===e)return o.isBooleanTypeAnnotation(t);if("any"===e)return o.isAnyTypeAnnotation(t);if("mixed"===e)return o.isMixedTypeAnnotation(t);if("empty"===e)return o.isEmptyTypeAnnotation(t);if("void"===e)return o.isVoidTypeAnnotation(t);if(r)return!1;throw new Error("Unknown base type "+e)}r.__esModule=!0;var s=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.getTypeAnnotation=function(){if(this.typeAnnotation)return this.typeAnnotation;var e=this._getTypeAnnotation()||o.anyTypeAnnotation();return o.isTypeAnnotation(e)&&(e=e.typeAnnotation),this.typeAnnotation=e},r._getTypeAnnotation=function(){var e=this.node;if(e){if(e.typeAnnotation)return e.typeAnnotation;var t=a[e.type];return t?t.call(this,e):(t=a[this.parentPath.type])&&t.validParent?this.parentPath.getTypeAnnotation():void 0}if("init"===this.key&&this.parentPath.isVariableDeclarator()){var r=this.parentPath.parentPath,n=r.parentPath;return"left"===r.key&&n.isForInStatement()?o.stringTypeAnnotation():"left"===r.key&&n.isForOfStatement()?o.anyTypeAnnotation():o.voidTypeAnnotation()}},r.isBaseType=function(e,t){return i(e,this.getTypeAnnotation(),t)},r.couldBeBaseType=function(e){var t=this.getTypeAnnotation();if(o.isAnyTypeAnnotation(t))return!0;if(o.isUnionTypeAnnotation(t)){for(var r=t.types,n=Array.isArray(r),a=0,r=n?r:(0,s.default)(r);;){var u;if(n){if(a>=r.length)break;u=r[a++]}else{if((a=r.next()).done)break;u=a.value}var l=u;if(o.isAnyTypeAnnotation(l)||i(e,l,!0))return!0}return!1}return i(e,t,!0)},r.baseTypeStrictlyMatches=function(e){var t=this.getTypeAnnotation();if(e=e.getTypeAnnotation(),!o.isAnyTypeAnnotation(t)&&o.isFlowBaseAnnotation(t))return e.type===t.type},r.isGenericType=function(e){var t=this.getTypeAnnotation();return o.isGenericTypeAnnotation(t)&&o.isIdentifier(t.id,{name:e})};var a=n(e("./inferers")),o=n(e("babel-types"))},{"./inferers":153,"babel-runtime/core-js/get-iterator":120,"babel-types":178}],152:[function(e,t,r){"use strict";function n(e,t){var r=e.scope.getBinding(t),n=[];e.typeAnnotation=l.unionTypeAnnotation(n);var s=[],a=i(r,e,s),c=o(e,t);if(c){var p=i(r,c.ifStatement);a=a.filter(function(e){return p.indexOf(e)<0}),n.push(c.typeAnnotation)}if(a.length)for(var h=a=a.concat(s),f=Array.isArray(h),d=0,h=f?h:(0,u.default)(h);;){var m;if(f){if(d>=h.length)break;m=h[d++]}else{if((d=h.next()).done)break;m=d.value}var y=m;n.push(y.getTypeAnnotation())}if(n.length)return l.createUnionTypeAnnotation(n)}function i(e,t,r){var n=e.constantViolations.slice();return n.unshift(e.path),n.filter(function(e){var n=(e=e.resolve())._guessExecutionStatusRelativeTo(t);return r&&"function"===n&&r.push(e),"before"===n})}function s(e,t){var r=t.node.operator,n=t.get("right").resolve(),i=t.get("left").resolve(),s=void 0;if(i.isIdentifier({name:e})?s=n:n.isIdentifier({name:e})&&(s=i),s)return"==="===r?s.getTypeAnnotation():l.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(r)>=0?l.numberTypeAnnotation():void 0;if("==="===r){var a=void 0,o=void 0;if(i.isUnaryExpression({operator:"typeof"})?(a=i,o=n):n.isUnaryExpression({operator:"typeof"})&&(a=n,o=i),(o||a)&&(o=o.resolve()).isLiteral()&&"string"==typeof o.node.value&&a.get("argument").isIdentifier({name:e}))return l.createTypeAnnotationBasedOnTypeof(o.node.value)}}function a(e){for(var t=void 0;t=e.parentPath;){if(t.isIfStatement()||t.isConditionalExpression())return"test"===e.key?void 0:t;e=t}}function o(e,t){var r=a(e);if(r){var n=[r.get("test")],i=[];do{var u=n.shift().resolve();if(u.isLogicalExpression()&&(n.push(u.get("left")),n.push(u.get("right"))),u.isBinaryExpression()){var c=s(t,u);c&&i.push(c)}}while(n.length);return i.length?{typeAnnotation:l.createUnionTypeAnnotation(i),ifStatement:r}:o(r,t)}}r.__esModule=!0;var u=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.default=function(e){if(this.isReferenced()){var t=this.scope.getBinding(e.name);return t?t.identifier.typeAnnotation?t.identifier.typeAnnotation:n(this,e.name):"undefined"===e.name?l.voidTypeAnnotation():"NaN"===e.name||"Infinity"===e.name?l.numberTypeAnnotation():void e.name}};var l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));t.exports=r.default},{"babel-runtime/core-js/get-iterator":120,"babel-types":178}],153:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return e.typeAnnotation}function s(){return c.genericTypeAnnotation(c.identifier("Array"))}function a(){return s()}function o(){return c.genericTypeAnnotation(c.identifier("Function"))}function u(e){if((e=e.resolve()).isFunction()){if(e.is("async"))return e.is("generator")?c.genericTypeAnnotation(c.identifier("AsyncIterator")):c.genericTypeAnnotation(c.identifier("Promise"));if(e.node.returnType)return e.node.returnType}}r.__esModule=!0,r.ClassDeclaration=r.ClassExpression=r.FunctionDeclaration=r.ArrowFunctionExpression=r.FunctionExpression=r.Identifier=void 0;var l=e("./inferer-reference");Object.defineProperty(r,"Identifier",{enumerable:!0,get:function(){return n(l).default}}),r.VariableDeclarator=function(){return this.get("id").isIdentifier()?this.get("init").getTypeAnnotation():void 0},r.TypeCastExpression=i,r.NewExpression=function(e){if(this.get("callee").isIdentifier())return c.genericTypeAnnotation(e.callee)},r.TemplateLiteral=function(){return c.stringTypeAnnotation()},r.UnaryExpression=function(e){var t=e.operator;return"void"===t?c.voidTypeAnnotation():c.NUMBER_UNARY_OPERATORS.indexOf(t)>=0?c.numberTypeAnnotation():c.STRING_UNARY_OPERATORS.indexOf(t)>=0?c.stringTypeAnnotation():c.BOOLEAN_UNARY_OPERATORS.indexOf(t)>=0?c.booleanTypeAnnotation():void 0},r.BinaryExpression=function(e){var t=e.operator;if(c.NUMBER_BINARY_OPERATORS.indexOf(t)>=0)return c.numberTypeAnnotation();if(c.BOOLEAN_BINARY_OPERATORS.indexOf(t)>=0)return c.booleanTypeAnnotation();if("+"===t){var r=this.get("right"),n=this.get("left");return n.isBaseType("number")&&r.isBaseType("number")?c.numberTypeAnnotation():n.isBaseType("string")||r.isBaseType("string")?c.stringTypeAnnotation():c.unionTypeAnnotation([c.stringTypeAnnotation(),c.numberTypeAnnotation()])}},r.LogicalExpression=function(){return c.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(),this.get("right").getTypeAnnotation()])},r.ConditionalExpression=function(){return c.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(),this.get("alternate").getTypeAnnotation()])},r.SequenceExpression=function(){return this.get("expressions").pop().getTypeAnnotation()},r.AssignmentExpression=function(){return this.get("right").getTypeAnnotation()},r.UpdateExpression=function(e){var t=e.operator;if("++"===t||"--"===t)return c.numberTypeAnnotation()},r.StringLiteral=function(){return c.stringTypeAnnotation()},r.NumericLiteral=function(){return c.numberTypeAnnotation()},r.BooleanLiteral=function(){return c.booleanTypeAnnotation()},r.NullLiteral=function(){return c.nullLiteralTypeAnnotation()},r.RegExpLiteral=function(){return c.genericTypeAnnotation(c.identifier("RegExp"))},r.ObjectExpression=function(){return c.genericTypeAnnotation(c.identifier("Object"))},r.ArrayExpression=s,r.RestElement=a,r.CallExpression=function(){return u(this.get("callee"))},r.TaggedTemplateExpression=function(){return u(this.get("tag"))};var c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));i.validParent=!0,a.validParent=!0,r.FunctionExpression=o,r.ArrowFunctionExpression=o,r.FunctionDeclaration=o,r.ClassExpression=o,r.ClassDeclaration=o},{"./inferer-reference":152,"babel-types":178}],154:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=this.node&&this.node[e];return t&&Array.isArray(t)?!!t.length:!!t}r.__esModule=!0,r.is=void 0;var s=n(e("babel-runtime/core-js/get-iterator"));r.matchesPattern=function(e,t){function r(e){var t=n[s];return"*"===t||e===t}if(!this.isMemberExpression())return!1;for(var n=e.split("."),i=[this.node],s=0;i.length;){var a=i.shift();if(t&&s===n.length)return!0;if(o.isIdentifier(a)){if(!r(a.name))return!1}else if(o.isLiteral(a)){if(!r(a.value))return!1}else{if(o.isMemberExpression(a)){if(a.computed&&!o.isLiteral(a.property))return!1;i.unshift(a.property),i.unshift(a.object);continue}if(!o.isThisExpression(a))return!1;if(!r("this"))return!1}if(++s>n.length)return!1}return s===n.length},r.has=i,r.isStatic=function(){return this.scope.isStatic(this.node)},r.isnt=function(e){return!this.has(e)},r.equals=function(e,t){return this.node[e]===t},r.isNodeType=function(e){return o.isType(this.type,e)},r.canHaveVariableDeclarationOrExpression=function(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()},r.canSwapBetweenExpressionAndStatement=function(e){return!("body"!==this.key||!this.parentPath.isArrowFunctionExpression())&&(this.isExpression()?o.isBlockStatement(e):!!this.isBlockStatement()&&o.isExpression(e))},r.isCompletionRecord=function(e){var t=this,r=!0;do{var n=t.container;if(t.isFunction()&&!r)return!!e;if(r=!1,Array.isArray(n)&&t.key!==n.length-1)return!1}while((t=t.parentPath)&&!t.isProgram());return!0},r.isStatementOrBlock=function(){return!this.parentPath.isLabeledStatement()&&!o.isBlockStatement(this.container)&&(0,a.default)(o.STATEMENT_OR_BLOCK_KEYS,this.key)},r.referencesImport=function(e,t){if(!this.isReferencedIdentifier())return!1;var r=this.scope.getBinding(this.node.name);if(!r||"module"!==r.kind)return!1;var n=r.path,i=n.parentPath;return!(!i.isImportDeclaration()||i.node.source.value!==e||t&&(!n.isImportDefaultSpecifier()||"default"!==t)&&(!n.isImportNamespaceSpecifier()||"*"!==t)&&(!n.isImportSpecifier()||n.node.imported.name!==t))},r.getSource=function(){var e=this.node;return e.end?this.hub.file.code.slice(e.start,e.end):""},r.willIMaybeExecuteBefore=function(e){return"after"!==this._guessExecutionStatusRelativeTo(e)},r._guessExecutionStatusRelativeTo=function(e){var t=e.scope.getFunctionParent(),r=this.scope.getFunctionParent();if(t.node!==r.node){var n=this._guessExecutionStatusRelativeToDifferentFunctions(t);if(n)return n;e=t.path}var i=e.getAncestry();if(i.indexOf(this)>=0)return"after";var s=this.getAncestry(),a=void 0,u=void 0,l=void 0;for(l=0;l=0){a=c;break}}if(!a)return"before";var p=i[u-1],h=s[l-1];return p&&h?p.listKey&&p.container===h.container?p.key>h.key?"before":"after":o.VISITOR_KEYS[p.type].indexOf(p.key)>o.VISITOR_KEYS[h.type].indexOf(h.key)?"before":"after":"before"},r._guessExecutionStatusRelativeToDifferentFunctions=function(e){var t=e.path;if(t.isFunctionDeclaration()){var r=t.scope.getBinding(t.node.id.name);if(!r.references)return"before";for(var n=r.referencePaths,i=n,a=Array.isArray(i),o=0,i=a?i:(0,s.default)(i);;){var u;if(a){if(o>=i.length)break;u=i[o++]}else{if((o=i.next()).done)break;u=o.value}var l=u;if("callee"!==l.key||!l.parentPath.isCallExpression())return}for(var c=void 0,p=n,h=Array.isArray(p),f=0,p=h?p:(0,s.default)(p);;){var d;if(h){if(f>=p.length)break;d=p[f++]}else{if((f=p.next()).done)break;d=f.value}var m=d;if(!m.find(function(e){return e.node===t.node})){var y=this._guessExecutionStatusRelativeTo(m);if(c){if(c!==y)return}else c=y}}return c}},r.resolve=function(e,t){return this._resolve(e,t)||this},r._resolve=function(e,t){if(!(t&&t.indexOf(this)>=0))if((t=t||[]).push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(e,t)}else if(this.isReferencedIdentifier()){var r=this.scope.getBinding(this.node.name);if(!r)return;if(!r.constant)return;if("module"===r.kind)return;if(r.path!==this){var n=r.path.resolve(e,t);if(this.find(function(e){return e.node===n.node}))return;return n}}else{if(this.isTypeCastExpression())return this.get("expression").resolve(e,t);if(e&&this.isMemberExpression()){var i=this.toComputedKey();if(!o.isLiteral(i))return;var a=i.value,u=this.get("object").resolve(e,t);if(u.isObjectExpression())for(var l=u.get("properties"),c=Array.isArray(l),p=0,l=c?l:(0,s.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if((p=l.next()).done)break;h=p.value}var f=h;if(f.isProperty()){var d=f.get("key"),m=f.isnt("computed")&&d.isIdentifier({name:a});if(m=m||d.isLiteral({value:a}))return f.get("value").resolve(e,t)}}else if(u.isArrayExpression()&&!isNaN(+a)){var y=u.get("elements")[a];if(y)return y.resolve(e,t)}}}};var a=n(e("lodash/includes")),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"));r.is=i},{"babel-runtime/core-js/get-iterator":120,"babel-types":178,"lodash/includes":507}],155:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator")),s=n(e("babel-runtime/helpers/classCallCheck")),a=e("babel-types"),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(a),u={ReferencedIdentifier:function(e,t){if(!e.isJSXIdentifier()||!a.react.isCompatTag(e.node.name)||e.parentPath.isJSXMemberExpression()){if("this"===e.node.name){var r=e.scope;do{if(r.path.isFunction()&&!r.path.isArrowFunctionExpression())break}while(r=r.parent);r&&t.breakOnScopePaths.push(r.path)}var n=e.scope.getBinding(e.node.name);n&&n===t.scope.getBinding(e.node.name)&&(t.bindings[e.node.name]=n)}}},l=function(){function e(t,r){(0,s.default)(this,e),this.breakOnScopePaths=[],this.bindings={},this.scopes=[],this.scope=r,this.path=t,this.attachAfter=!1}return e.prototype.isCompatibleScope=function(e){for(var t in this.bindings){var r=this.bindings[t];if(!e.bindingIdentifierEquals(t,r.identifier))return!1}return!0},e.prototype.getCompatibleScopes=function(){var e=this.path.scope;do{if(!this.isCompatibleScope(e))break;if(this.scopes.push(e),this.breakOnScopePaths.indexOf(e.path)>=0)break}while(e=e.parent)},e.prototype.getAttachmentPath=function(){var e=this._getAttachmentPath();if(e){var t=e.scope;if(t.path===e&&(t=e.scope.parent),t.path.isProgram()||t.path.isFunction())for(var r in this.bindings)if(t.hasOwnBinding(r)){var n=this.bindings[r];if("param"!==n.kind&&this.getAttachmentParentForPath(n.path).key>e.key){this.attachAfter=!0,e=n.path;for(var s=n.constantViolations,a=Array.isArray(s),o=0,s=a?s:(0,i.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var l=u;this.getAttachmentParentForPath(l).key>e.key&&(e=l)}}}return e.parentPath.isExportDeclaration()&&(e=e.parentPath),e}},e.prototype._getAttachmentPath=function(){var e=this.scopes.pop();if(e){if(e.path.isFunction()){if(this.hasOwnParamBindings(e)){if(this.scope===e)return;return e.path.get("body").get("body")[0]}return this.getNextScopeAttachmentParent()}return e.path.isProgram()?this.getNextScopeAttachmentParent():void 0}},e.prototype.getNextScopeAttachmentParent=function(){var e=this.scopes.pop();if(e)return this.getAttachmentParentForPath(e.path)},e.prototype.getAttachmentParentForPath=function(e){do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement()||e.isVariableDeclarator()&&null!==e.parentPath.node&&e.parentPath.node.declarations.length>1)return e}while(e=e.parentPath)},e.prototype.hasOwnParamBindings=function(e){for(var t in this.bindings)if(e.hasOwnBinding(t)){var r=this.bindings[t];if("param"===r.kind&&r.constant)return!0}return!1},e.prototype.run=function(){var e=this.path.node;if(!e._hoisted){e._hoisted=!0,this.path.traverse(u,this),this.getCompatibleScopes();var t=this.getAttachmentPath();if(t&&t.getFunctionParent()!==this.path.getFunctionParent()){var r=t.scope.generateUidIdentifier("ref"),n=o.variableDeclarator(r,this.path.node);t[this.attachAfter?"insertAfter":"insertBefore"]([t.isVariableDeclarator()?n:o.variableDeclaration("var",[n])]);var i=this.path.parentPath;i.isJSXElement()&&this.path.container===i.node.children&&(r=o.JSXExpressionContainer(r)),this.path.replaceWith(r)}}},e}();r.default=l,t.exports=r.default},{"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/classCallCheck":134,"babel-types":178}],156:[function(e,t,r){"use strict";r.__esModule=!0;r.hooks=[function(e,t){if("test"===e.key&&(t.isWhile()||t.isSwitchCase())||"declaration"===e.key&&t.isExportDeclaration()||"body"===e.key&&t.isLabeledStatement()||"declarations"===e.listKey&&t.isVariableDeclaration()&&1===t.node.declarations.length||"expression"===e.key&&t.isExpressionStatement())return t.remove(),!0},function(e,t){if(t.isSequenceExpression()&&1===t.node.expressions.length)return t.replaceWith(t.node.expressions[0]),!0},function(e,t){if(t.isBinary())return"left"===e.key?t.replaceWith(t.node.right):t.replaceWith(t.node.left),!0},function(e,t){if(t.isIfStatement()&&("consequent"===e.key||"alternate"===e.key)||"body"===e.key&&(t.isLoop()||t.isArrowFunctionExpression()))return e.replaceWith({type:"BlockStatement",body:[]}),!0}]},{}],157:[function(e,t,r){"use strict";r.__esModule=!0,r.Flow=r.Pure=r.Generated=r.User=r.Var=r.BlockScoped=r.Referenced=r.Scope=r.Expression=r.Statement=r.BindingIdentifier=r.ReferencedMemberExpression=r.ReferencedIdentifier=void 0;var n=e("babel-types"),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n);r.ReferencedIdentifier={types:["Identifier","JSXIdentifier"],checkPath:function(e,t){var r=e.node,s=e.parent;if(!i.isIdentifier(r,t)&&!i.isJSXMemberExpression(s,t)){if(!i.isJSXIdentifier(r,t))return!1;if(n.react.isCompatTag(r.name))return!1}return i.isReferenced(r,s)}},r.ReferencedMemberExpression={types:["MemberExpression"],checkPath:function(e){var t=e.node,r=e.parent;return i.isMemberExpression(t)&&i.isReferenced(t,r)}},r.BindingIdentifier={types:["Identifier"],checkPath:function(e){var t=e.node,r=e.parent;return i.isIdentifier(t)&&i.isBinding(t,r)}},r.Statement={types:["Statement"],checkPath:function(e){var t=e.node,r=e.parent;if(i.isStatement(t)){if(i.isVariableDeclaration(t)){if(i.isForXStatement(r,{left:t}))return!1;if(i.isForStatement(r,{init:t}))return!1}return!0}return!1}},r.Expression={types:["Expression"],checkPath:function(e){return e.isIdentifier()?e.isReferencedIdentifier():i.isExpression(e.node)}},r.Scope={types:["Scopable"],checkPath:function(e){return i.isScope(e.node,e.parent)}},r.Referenced={checkPath:function(e){return i.isReferenced(e.node,e.parent)}},r.BlockScoped={checkPath:function(e){return i.isBlockScoped(e.node)}},r.Var={types:["VariableDeclaration"],checkPath:function(e){return i.isVar(e.node)}},r.User={checkPath:function(e){return e.node&&!!e.node.loc}},r.Generated={checkPath:function(e){return!e.isUser()}},r.Pure={checkPath:function(e,t){return e.scope.isPure(e.node,t)}},r.Flow={types:["Flow","ImportDeclaration","ExportDeclaration","ImportSpecifier"],checkPath:function(e){var t=e.node;return!!i.isFlow(t)||(i.isImportDeclaration(t)?"type"===t.importKind||"typeof"===t.importKind:i.isExportDeclaration(t)?"type"===t.exportKind:!!i.isImportSpecifier(t)&&("type"===t.importKind||"typeof"===t.importKind))}}},{"babel-types":178}],158:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/typeof")),s=n(e("babel-runtime/core-js/get-iterator"));r.insertBefore=function(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertBefore(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key)this.node&&e.push(this.node),this.replaceExpressionWithStatements(e);else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertBefore(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.push(this.node),this._replaceWith(l.blockStatement(e))}return[this]},r._containerInsert=function(e,t){this.updateSiblingKeys(e,t.length);for(var r=[],n=0;n=c.length)break;f=c[h++]}else{if((h=c.next()).done)break;f=h.value}var d=f;d.setScope(),d.debug(function(){return"Inserted."});for(var m=l,y=Array.isArray(m),g=0,m=y?m:(0,s.default)(m);;){var b;if(y){if(g>=m.length)break;b=m[g++]}else{if((g=m.next()).done)break;b=g.value}b.maybeQueue(d,!0)}}return r},r._containerInsertBefore=function(e){return this._containerInsert(this.key,e)},r._containerInsertAfter=function(e){return this._containerInsert(this.key+1,e)},r._maybePopFromStatements=function(e){var t=e[e.length-1];(l.isIdentifier(t)||l.isExpressionStatement(t)&&l.isIdentifier(t.expression))&&!this.isCompletionRecord()&&e.pop()},r.insertAfter=function(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertAfter(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key){if(this.node){var t=this.scope.generateDeclaredUidIdentifier();e.unshift(l.expressionStatement(l.assignmentExpression("=",t,this.node))),e.push(l.expressionStatement(t))}this.replaceExpressionWithStatements(e)}else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertAfter(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.unshift(this.node),this._replaceWith(l.blockStatement(e))}return[this]},r.updateSiblingKeys=function(e,t){if(this.parent)for(var r=a.path.get(this.parent),n=0;n=e&&(i.key+=t)}},r._verifyNodeList=function(e){if(!e)return[];e.constructor!==Array&&(e=[e]);for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:this.scope;return new o.default(this,e).run()};var a=e("../cache"),o=n(e("./lib/hoister")),u=n(e("./index")),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))},{"../cache":140,"./index":150,"./lib/hoister":155,"babel-runtime/core-js/get-iterator":120,"babel-runtime/helpers/typeof":138,"babel-types":178}],159:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/get-iterator"));r.remove=function(){this._assertUnremoved(),this.resync(),this._callRemovalHooks()?this._markRemoved():(this.shareCommentsWithSiblings(),this._remove(),this._markRemoved())},r._callRemovalHooks=function(){for(var e=i.hooks,t=Array.isArray(e),r=0,e=t?e:(0,n.default)(e);;){var s;if(t){if(r>=e.length)break;s=e[r++]}else{if((r=e.next()).done)break;s=r.value}if(s(this,this.parentPath))return!0}},r._remove=function(){Array.isArray(this.container)?(this.container.splice(this.key,1),this.updateSiblingKeys(this.key,-1)):this._replaceWith(null)},r._markRemoved=function(){this.shouldSkip=!0,this.removed=!0,this.node=null},r._assertUnremoved=function(){if(this.removed)throw this.buildCodeFrameError("NodePath has been removed so is read-only.")};var i=e("./lib/removal-hooks")},{"./lib/removal-hooks":156,"babel-runtime/core-js/get-iterator":120}],160:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/core-js/get-iterator"));r.replaceWithMultiple=function(e){this.resync(),e=this._verifyNodeList(e),l.inheritLeadingComments(e[0],this.node),l.inheritTrailingComments(e[e.length-1],this.node),this.node=this.container[this.key]=null,this.insertAfter(e),this.node?this.requeue():this.remove()},r.replaceWithSourceString=function(e){this.resync();try{e="("+e+")",e=(0,u.parse)(e)}catch(r){var t=r.loc;throw t&&(r.message+=" - make sure this is an expression.",r.message+="\n"+(0,s.default)(e,t.line,t.column+1)),r}return e=e.program.body[0].expression,a.default.removeProperties(e),this.replaceWith(e)},r.replaceWith=function(e){if(this.resync(),this.removed)throw new Error("You can't replace this node, we've already removed it");if(e instanceof o.default&&(e=e.node),!e)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");if(this.node!==e){if(this.isProgram()&&!l.isProgram(e))throw new Error("You can only replace a Program root node with another Program node");if(Array.isArray(e))throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");if("string"==typeof e)throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");if(this.isNodeType("Statement")&&l.isExpression(e)&&(this.canHaveVariableDeclarationOrExpression()||this.canSwapBetweenExpressionAndStatement(e)||this.parentPath.isExportDefaultDeclaration()||(e=l.expressionStatement(e))),this.isNodeType("Expression")&&l.isStatement(e)&&!this.canHaveVariableDeclarationOrExpression()&&!this.canSwapBetweenExpressionAndStatement(e))return this.replaceExpressionWithStatements([e]);var t=this.node;t&&(l.inheritsComments(e,t),l.removeComments(t)),this._replaceWith(e),this.type=e.type,this.setScope(),this.requeue()}},r._replaceWith=function(e){if(!this.container)throw new ReferenceError("Container is falsy");this.inList?l.validate(this.parent,this.key,[e]):l.validate(this.parent,this.key,e),this.debug(function(){return"Replace with "+(e&&e.type)}),this.node=this.container[this.key]=e},r.replaceExpressionWithStatements=function(e){this.resync();var t=l.toSequenceExpression(e,this.scope);if(l.isSequenceExpression(t)){var r=t.expressions;r.length>=2&&this.parentPath.isExpressionStatement()&&this._maybePopFromStatements(r),1===r.length?this.replaceWith(r[0]):this.replaceWith(t)}else{if(!t){var n=l.functionExpression(null,[],l.blockStatement(e));n.shadow=!0,this.replaceWith(l.callExpression(n,[])),this.traverse(c);for(var s=this.get("callee").getCompletionRecords(),a=Array.isArray(s),o=0,s=a?s:(0,i.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var p=u;if(p.isExpressionStatement()){var h=p.findParent(function(e){return e.isLoop()});if(h){var f=h.getData("expressionReplacementReturnUid");if(f)f=l.identifier(f.name);else{var d=this.get("callee");f=d.scope.generateDeclaredUidIdentifier("ret"),d.get("body").pushContainer("body",l.returnStatement(f)),h.setData("expressionReplacementReturnUid",f)}p.get("expression").replaceWith(l.assignmentExpression("=",f,p.node.expression))}else p.replaceWith(l.returnStatement(p.node.expression))}}return this.node}this.replaceWith(t)}},r.replaceInline=function(e){return this.resync(),Array.isArray(e)?Array.isArray(this.container)?(e=this._verifyNodeList(e),this._containerInsertAfter(e),this.remove()):this.replaceWithMultiple(e):this.replaceWith(e)};var s=n(e("babel-code-frame")),a=n(e("../index")),o=n(e("./index")),u=e("babylon"),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types")),c={Function:function(e){e.skip()},VariableDeclaration:function(e){if("var"===e.node.kind){var t=e.getBindingIdentifiers();for(var r in t)e.scope.push({id:t[r]});for(var n=[],s=e.node.declarations,a=Array.isArray(s),o=0,s=a?s:(0,i.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var c=u;c.init&&n.push(l.expressionStatement(l.assignmentExpression("=",c.id,c.init)))}e.replaceWithMultiple(n)}}}},{"../index":143,"./index":150,"babel-code-frame":21,"babel-runtime/core-js/get-iterator":120,"babel-types":178,babylon:186}],161:[function(e,t,r){"use strict";r.__esModule=!0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/helpers/classCallCheck")),i=function(){function e(t){var r=t.existing,i=t.identifier,s=t.scope,a=t.path,o=t.kind;(0,n.default)(this,e),this.identifier=i,this.scope=s,this.path=a,this.kind=o,this.constantViolations=[],this.constant=!0,this.referencePaths=[],this.referenced=!1,this.references=0,this.clearValue(),r&&(this.constantViolations=[].concat(r.path,r.constantViolations,this.constantViolations))}return e.prototype.deoptValue=function(){this.clearValue(),this.hasDeoptedValue=!0},e.prototype.setValue=function(e){this.hasDeoptedValue||(this.hasValue=!0,this.value=e)},e.prototype.clearValue=function(){this.hasDeoptedValue=!1,this.hasValue=!1,this.value=null},e.prototype.reassign=function(e){this.constant=!1,-1===this.constantViolations.indexOf(e)&&this.constantViolations.push(e)},e.prototype.reference=function(e){-1===this.referencePaths.indexOf(e)&&(this.referenced=!0,this.references++,this.referencePaths.push(e))},e.prototype.dereference=function(){this.references--,this.referenced=!!this.references},e}();r.default=i,t.exports=r.default},{"babel-runtime/helpers/classCallCheck":134}],162:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){for(var n=E.scope.get(e.node)||[],i=n,s=Array.isArray(i),a=0,i=s?i:(0,p.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if((a=i.next()).done)break;o=a.value}var u=o;if(u.parent===t&&u.path===e)return u}n.push(r),E.scope.has(e.node)||E.scope.set(e.node,n)}function a(e,t){if(x.isModuleDeclaration(e))if(e.source)a(e.source,t);else if(e.specifiers&&e.specifiers.length)for(var r=e.specifiers,n=Array.isArray(r),i=0,r=n?r:(0,p.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}a(s,t)}else e.declaration&&a(e.declaration,t);else if(x.isModuleSpecifier(e))a(e.local,t);else if(x.isMemberExpression(e))a(e.object,t),a(e.property,t);else if(x.isIdentifier(e))t.push(e.name);else if(x.isLiteral(e))t.push(e.value);else if(x.isCallExpression(e))a(e.callee,t);else if(x.isObjectExpression(e)||x.isObjectPattern(e))for(var o=e.properties,u=Array.isArray(o),l=0,o=u?o:(0,p.default)(o);;){var c;if(u){if(l>=o.length)break;c=o[l++]}else{if((l=o.next()).done)break;c=l.value}var h=c;a(h.key||h.argument,t)}}r.__esModule=!0;var o=i(e("babel-runtime/core-js/object/keys")),u=i(e("babel-runtime/core-js/object/create")),l=i(e("babel-runtime/core-js/map")),c=i(e("babel-runtime/helpers/classCallCheck")),p=i(e("babel-runtime/core-js/get-iterator")),h=i(e("lodash/includes")),f=i(e("lodash/repeat")),d=i(e("./lib/renamer")),m=i(e("../index")),y=i(e("lodash/defaults")),g=n(e("babel-messages")),b=i(e("./binding")),v=i(e("globals")),x=n(e("babel-types")),E=e("../cache"),A=0,D={For:function(e){for(var t=x.FOR_INIT_KEYS,r=Array.isArray(t),n=0,t=r?t:(0,p.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i,a=e.get(s);a.isVar()&&e.scope.getFunctionParent().registerBinding("var",a)}},Declaration:function(e){e.isBlockScoped()||e.isExportDeclaration()&&e.get("declaration").isDeclaration()||e.scope.getFunctionParent().registerDeclaration(e)},ReferencedIdentifier:function(e,t){t.references.push(e)},ForXStatement:function(e,t){var r=e.get("left");(r.isPattern()||r.isIdentifier())&&t.constantViolations.push(r)},ExportDeclaration:{exit:function(e){var t=e.node,r=e.scope,n=t.declaration;if(x.isClassDeclaration(n)||x.isFunctionDeclaration(n)){var i=n.id;if(!i)return;var s=r.getBinding(i.name);s&&s.reference(e)}else if(x.isVariableDeclaration(n))for(var a=n.declarations,o=Array.isArray(a),u=0,a=o?a:(0,p.default)(a);;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l,h=x.getBindingIdentifiers(c);for(var f in h){var d=r.getBinding(f);d&&d.reference(e)}}}},LabeledStatement:function(e){e.scope.getProgramParent().addGlobal(e.node),e.scope.getBlockParent().registerDeclaration(e)},AssignmentExpression:function(e,t){t.assignments.push(e)},UpdateExpression:function(e,t){t.constantViolations.push(e.get("argument"))},UnaryExpression:function(e,t){"delete"===e.node.operator&&t.constantViolations.push(e.get("argument"))},BlockScoped:function(e){var t=e.scope;t.path===e&&(t=t.parent),t.getBlockParent().registerDeclaration(e)},ClassDeclaration:function(e){var t=e.node.id;if(t){var r=t.name;e.scope.bindings[r]=e.scope.getBinding(r)}},Block:function(e){for(var t=e.get("body"),r=Array.isArray(t),n=0,t=r?t:(0,p.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;s.isFunctionDeclaration()&&e.scope.getBlockParent().registerDeclaration(s)}}},C=0,S=function(){function e(t,r){if((0,c.default)(this,e),r&&r.block===t.node)return r;var n=s(t,r,this);if(n)return n;this.uid=C++,this.parent=r,this.hub=t.hub,this.parentBlock=t.parent,this.block=t.node,this.path=t,this.labels=new l.default}return e.prototype.traverse=function(e,t,r){(0,m.default)(e,t,this,r,this.path)},e.prototype.generateDeclaredUidIdentifier=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp",t=this.generateUidIdentifier(e);return this.push({id:t}),t},e.prototype.generateUidIdentifier=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp";return x.identifier(this.generateUid(e))},e.prototype.generateUid=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"temp";e=x.toIdentifier(e).replace(/^_+/,"").replace(/[0-9]+$/g,"");var t=void 0,r=0;do{t=this._generateUid(e,r),r++}while(this.hasLabel(t)||this.hasBinding(t)||this.hasGlobal(t)||this.hasReference(t));var n=this.getProgramParent();return n.references[t]=!0,n.uids[t]=!0,t},e.prototype._generateUid=function(e,t){var r=e;return t>1&&(r+=t),"_"+r},e.prototype.generateUidIdentifierBasedOnNode=function(e,t){var r=e;x.isAssignmentExpression(e)?r=e.left:x.isVariableDeclarator(e)?r=e.id:(x.isObjectProperty(r)||x.isObjectMethod(r))&&(r=r.key);var n=[];a(r,n);var i=n.join("$");return i=i.replace(/^_/,"")||t||"ref",this.generateUidIdentifier(i.slice(0,20))},e.prototype.isStatic=function(e){if(x.isThisExpression(e)||x.isSuper(e))return!0;if(x.isIdentifier(e)){var t=this.getBinding(e.name);return t?t.constant:this.hasBinding(e.name)}return!1},e.prototype.maybeGenerateMemoised=function(e,t){if(this.isStatic(e))return null;var r=this.generateUidIdentifierBasedOnNode(e);return t||this.push({id:r}),r},e.prototype.checkBlockScopedCollisions=function(e,t,r,n){if("param"!==t&&!("hoisted"===t&&"let"===e.kind||"let"!==t&&"let"!==e.kind&&"const"!==e.kind&&"module"!==e.kind&&("param"!==e.kind||"let"!==t&&"const"!==t)))throw this.hub.file.buildCodeFrameError(n,g.get("scopeDuplicateDeclaration",r),TypeError)},e.prototype.rename=function(e,t,r){var n=this.getBinding(e);if(n)return t=t||this.generateUidIdentifier(e).name,new d.default(n,e,t).rename(r)},e.prototype._renameFromMap=function(e,t,r,n){e[t]&&(e[r]=n,e[t]=null)},e.prototype.dump=function(){var e=(0,f.default)("-",60);console.log(e);var t=this;do{console.log("#",t.block.type);for(var r in t.bindings){var n=t.bindings[r];console.log(" -",r,{constant:n.constant,references:n.references,violations:n.constantViolations.length,kind:n.kind})}}while(t=t.parent);console.log(e)},e.prototype.toArray=function(e,t){var r=this.hub.file;if(x.isIdentifier(e)){var n=this.getBinding(e.name);if(n&&n.constant&&n.path.isGenericType("Array"))return e}if(x.isArrayExpression(e))return e;if(x.isIdentifier(e,{name:"arguments"}))return x.callExpression(x.memberExpression(x.memberExpression(x.memberExpression(x.identifier("Array"),x.identifier("prototype")),x.identifier("slice")),x.identifier("call")),[e]);var i="toArray",s=[e];return!0===t?i="toConsumableArray":t&&(s.push(x.numericLiteral(t)),i="slicedToArray"),x.callExpression(r.addHelper(i),s)},e.prototype.hasLabel=function(e){return!!this.getLabel(e)},e.prototype.getLabel=function(e){return this.labels.get(e)},e.prototype.registerLabel=function(e){this.labels.set(e.node.label.name,e)},e.prototype.registerDeclaration=function(e){if(e.isLabeledStatement())this.registerLabel(e);else if(e.isFunctionDeclaration())this.registerBinding("hoisted",e.get("id"),e);else if(e.isVariableDeclaration())for(var t=e.get("declarations"),r=Array.isArray(t),n=0,t=r?t:(0,p.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;this.registerBinding(e.node.kind,s)}else if(e.isClassDeclaration())this.registerBinding("let",e);else if(e.isImportDeclaration())for(var a=e.get("specifiers"),o=Array.isArray(a),u=0,a=o?a:(0,p.default)(a);;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l;this.registerBinding("module",c)}else if(e.isExportDeclaration()){var h=e.get("declaration");(h.isClassDeclaration()||h.isFunctionDeclaration()||h.isVariableDeclaration())&&this.registerDeclaration(h)}else this.registerBinding("unknown",e)},e.prototype.buildUndefinedNode=function(){return this.hasBinding("undefined")?x.unaryExpression("void",x.numericLiteral(0),!0):x.identifier("undefined")},e.prototype.registerConstantViolation=function(e){var t=e.getBindingIdentifiers();for(var r in t){var n=this.getBinding(r);n&&n.reassign(e)}},e.prototype.registerBinding=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;if(!e)throw new ReferenceError("no `kind`");if(t.isVariableDeclaration())for(var n=t.get("declarations"),i=Array.isArray(n),s=0,n=i?n:(0,p.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a;this.registerBinding(e,o)}else{var u=this.getProgramParent(),l=t.getBindingIdentifiers(!0);for(var c in l)for(var h=l[c],f=Array.isArray(h),d=0,h=f?h:(0,p.default)(h);;){var m;if(f){if(d>=h.length)break;m=h[d++]}else{if((d=h.next()).done)break;m=d.value}var y=m,g=this.getOwnBinding(c);if(g){if(g.identifier===y)continue;this.checkBlockScopedCollisions(g,e,c,y)}g&&g.path.isFlow()&&(g=null),u.references[c]=!0,this.bindings[c]=new b.default({identifier:y,existing:g,scope:this,path:r,kind:e})}}},e.prototype.addGlobal=function(e){this.globals[e.name]=e},e.prototype.hasUid=function(e){var t=this;do{if(t.uids[e])return!0}while(t=t.parent);return!1},e.prototype.hasGlobal=function(e){var t=this;do{if(t.globals[e])return!0}while(t=t.parent);return!1},e.prototype.hasReference=function(e){var t=this;do{if(t.references[e])return!0}while(t=t.parent);return!1},e.prototype.isPure=function(e,t){if(x.isIdentifier(e)){var r=this.getBinding(e.name);return!!r&&(!t||r.constant)}if(x.isClass(e))return!(e.superClass&&!this.isPure(e.superClass,t))&&this.isPure(e.body,t);if(x.isClassBody(e)){for(var n=e.body,i=Array.isArray(n),s=0,n=i?n:(0,p.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a;if(!this.isPure(o,t))return!1}return!0}if(x.isBinary(e))return this.isPure(e.left,t)&&this.isPure(e.right,t);if(x.isArrayExpression(e)){for(var u=e.elements,l=Array.isArray(u),c=0,u=l?u:(0,p.default)(u);;){var h;if(l){if(c>=u.length)break;h=u[c++]}else{if((c=u.next()).done)break;h=c.value}var f=h;if(!this.isPure(f,t))return!1}return!0}if(x.isObjectExpression(e)){for(var d=e.properties,m=Array.isArray(d),y=0,d=m?d:(0,p.default)(d);;){var g;if(m){if(y>=d.length)break;g=d[y++]}else{if((y=d.next()).done)break;g=y.value}var b=g;if(!this.isPure(b,t))return!1}return!0}return x.isClassMethod(e)?!(e.computed&&!this.isPure(e.key,t))&&("get"!==e.kind&&"set"!==e.kind):x.isClassProperty(e)||x.isObjectProperty(e)?!(e.computed&&!this.isPure(e.key,t))&&this.isPure(e.value,t):x.isUnaryExpression(e)?this.isPure(e.argument,t):x.isPureish(e)},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e){var t=this;do{var r=t.data[e];if(null!=r)return r}while(t=t.parent)},e.prototype.removeData=function(e){var t=this;do{null!=t.data[e]&&(t.data[e]=null)}while(t=t.parent)},e.prototype.init=function(){this.references||this.crawl()},e.prototype.crawl=function(){A++,this._crawl(),A--},e.prototype._crawl=function(){var e=this.path;if(this.references=(0,u.default)(null),this.bindings=(0,u.default)(null),this.globals=(0,u.default)(null),this.uids=(0,u.default)(null),this.data=(0,u.default)(null),e.isLoop())for(var t=x.FOR_INIT_KEYS,r=Array.isArray(t),n=0,t=r?t:(0,p.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i,a=e.get(s);a.isBlockScoped()&&this.registerBinding(a.node.kind,a)}if(e.isFunctionExpression()&&e.has("id")&&(e.get("id").node[x.NOT_LOCAL_BINDING]||this.registerBinding("local",e.get("id"),e)),e.isClassExpression()&&e.has("id")&&(e.get("id").node[x.NOT_LOCAL_BINDING]||this.registerBinding("local",e)),e.isFunction())for(var o=e.get("params"),l=Array.isArray(o),c=0,o=l?o:(0,p.default)(o);;){var h;if(l){if(c>=o.length)break;h=o[c++]}else{if((c=o.next()).done)break;h=c.value}var f=h;this.registerBinding("param",f)}if(e.isCatchClause()&&this.registerBinding("let",e),!this.getProgramParent().crawling){var d={references:[],constantViolations:[],assignments:[]};this.crawling=!0,e.traverse(D,d),this.crawling=!1;for(var m=d.assignments,y=Array.isArray(m),g=0,m=y?m:(0,p.default)(m);;){var b;if(y){if(g>=m.length)break;b=m[g++]}else{if((g=m.next()).done)break;b=g.value}var v=b,E=v.getBindingIdentifiers(),A=void 0;for(var C in E)v.scope.getBinding(C)||(A=A||v.scope.getProgramParent()).addGlobal(E[C]);v.scope.registerConstantViolation(v)}for(var S=d.references,_=Array.isArray(S),w=0,S=_?S:(0,p.default)(S);;){var k;if(_){if(w>=S.length)break;k=S[w++]}else{if((w=S.next()).done)break;k=w.value}var F=k,T=F.scope.getBinding(F.node.name);T?T.reference(F):F.scope.getProgramParent().addGlobal(F.node)}for(var P=d.constantViolations,B=Array.isArray(P),O=0,P=B?P:(0,p.default)(P);;){var j;if(B){if(O>=P.length)break;j=P[O++]}else{if((O=P.next()).done)break;j=O.value}var N=j;N.scope.registerConstantViolation(N)}}},e.prototype.push=function(e){var t=this.path;t.isBlockStatement()||t.isProgram()||(t=this.getBlockParent().path),t.isSwitchStatement()&&(t=this.getFunctionParent().path),(t.isLoop()||t.isCatchClause()||t.isFunction())&&(x.ensureBlock(t.node),t=t.get("body"));var r=e.unique,n=e.kind||"var",i=null==e._blockHoist?2:e._blockHoist,s="declaration:"+n+":"+i,a=!r&&t.getData(s);if(!a){var o=x.variableDeclaration(n,[]);o._generated=!0,o._blockHoist=i,a=t.unshiftContainer("body",[o])[0],r||t.setData(s,a)}var u=x.variableDeclarator(e.id,e.init);a.node.declarations.push(u),this.registerBinding(n,a.get("declarations").pop())},e.prototype.getProgramParent=function(){var e=this;do{if(e.path.isProgram())return e}while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getFunctionParent=function(){var e=this;do{if(e.path.isFunctionParent())return e}while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getBlockParent=function(){var e=this;do{if(e.path.isBlockParent())return e}while(e=e.parent);throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...")},e.prototype.getAllBindings=function(){var e=(0,u.default)(null),t=this;do{(0,y.default)(e,t.bindings),t=t.parent}while(t);return e},e.prototype.getAllBindingsOfKind=function(){for(var e=(0,u.default)(null),t=arguments,r=Array.isArray(t),n=0,t=r?t:(0,p.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i,a=this;do{for(var o in a.bindings){var l=a.bindings[o];l.kind===s&&(e[o]=l)}a=a.parent}while(a)}return e},e.prototype.bindingIdentifierEquals=function(e,t){return this.getBindingIdentifier(e)===t},e.prototype.warnOnFlowBinding=function(e){return 0===A&&e&&e.path.isFlow()&&console.warn("\n You or one of the Babel plugins you are using are using Flow declarations as bindings.\n Support for this will be removed in version 7. To find out the caller, grep for this\n message and change it to a `console.trace()`.\n "),e},e.prototype.getBinding=function(e){var t=this;do{var r=t.getOwnBinding(e);if(r)return this.warnOnFlowBinding(r)}while(t=t.parent)},e.prototype.getOwnBinding=function(e){return this.warnOnFlowBinding(this.bindings[e])},e.prototype.getBindingIdentifier=function(e){var t=this.getBinding(e);return t&&t.identifier},e.prototype.getOwnBindingIdentifier=function(e){var t=this.bindings[e];return t&&t.identifier},e.prototype.hasOwnBinding=function(e){return!!this.getOwnBinding(e)},e.prototype.hasBinding=function(t,r){return!!t&&(!!this.hasOwnBinding(t)||(!!this.parentHasBinding(t,r)||(!!this.hasUid(t)||(!(r||!(0,h.default)(e.globals,t))||!(r||!(0,h.default)(e.contextVariables,t))))))},e.prototype.parentHasBinding=function(e,t){return this.parent&&this.parent.hasBinding(e,t)},e.prototype.moveBindingTo=function(e,t){var r=this.getBinding(e);r&&(r.scope.removeOwnBinding(e),r.scope=t,t.bindings[e]=r)},e.prototype.removeOwnBinding=function(e){delete this.bindings[e]},e.prototype.removeBinding=function(e){var t=this.getBinding(e);t&&t.scope.removeOwnBinding(e);var r=this;do{r.uids[e]&&(r.uids[e]=!1)}while(r=r.parent)},e}();S.globals=(0,o.default)(v.default.builtin),S.contextVariables=["arguments","undefined","Infinity","NaN"],r.default=S,t.exports=r.default},{"../cache":140,"../index":143,"./binding":161,"./lib/renamer":163,"babel-messages":110,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/map":122,"babel-runtime/core-js/object/create":125,"babel-runtime/core-js/object/keys":127,"babel-runtime/helpers/classCallCheck":134,"babel-types":178,globals:313,"lodash/defaults":495,"lodash/includes":507,"lodash/repeat":530}],163:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}r.__esModule=!0;var i=n(e("babel-runtime/helpers/classCallCheck")),s=(n(e("../binding")),function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("babel-types"))),a={ReferencedIdentifier:function(e,t){var r=e.node;r.name===t.oldName&&(r.name=t.newName)},Scope:function(e,t){e.scope.bindingIdentifierEquals(t.oldName,t.binding.identifier)||e.skip()},"AssignmentExpression|Declaration":function(e,t){var r=e.getOuterBindingIdentifiers();for(var n in r)n===t.oldName&&(r[n].name=t.newName)}},o=function(){function e(t,r,n){(0,i.default)(this,e),this.newName=n,this.oldName=r,this.binding=t}return e.prototype.maybeConvertFromExportDeclaration=function(e){var t=e.parentPath.isExportDeclaration()&&e.parentPath;if(t){var r=t.isExportDefaultDeclaration();r&&(e.isFunctionDeclaration()||e.isClassDeclaration())&&!e.node.id&&(e.node.id=e.scope.generateUidIdentifier("default"));var n=e.getOuterBindingIdentifiers(),i=[];for(var a in n){var o=a===this.oldName?this.newName:a,u=r?"default":a;i.push(s.exportSpecifier(s.identifier(o),s.identifier(u)))}if(i.length){var l=s.exportNamedDeclaration(null,i);e.isFunctionDeclaration()&&(l._blockHoist=3),t.insertAfter(l),t.replaceWith(e.node)}}},e.prototype.rename=function(e){var t=this.binding,r=this.oldName,n=this.newName,i=t.scope,s=t.path.find(function(e){return e.isDeclaration()||e.isFunctionExpression()});s&&this.maybeConvertFromExportDeclaration(s),i.traverse(e||i.block,a,this),e||(i.removeOwnBinding(r),i.bindings[n]=t,this.binding.identifier.name=n),t.type},e}();r.default=o,t.exports=r.default},{"../binding":161,"babel-runtime/helpers/classCallCheck":134,"babel-types":178}],164:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}function s(e){if(e._exploded)return e;e._exploded=!0;for(var t in e)if(!h(t)){var r=t.split("|");if(1!==r.length){var n=e[t];delete e[t];for(var i=r,s=Array.isArray(i),o=0,i=s?i:(0,y.default)(i);;){var u;if(s){if(o>=i.length)break;u=i[o++]}else{if((o=i.next()).done)break;u=o.value}e[u]=n}}}a(e),delete e.__esModule,l(e),c(e);for(var d=(0,m.default)(e),b=Array.isArray(d),E=0,d=b?d:(0,y.default)(d);;){var A;if(b){if(E>=d.length)break;A=d[E++]}else{if((E=d.next()).done)break;A=E.value}var D=A;if(!h(D)){var C=g[D];if(C){var S=e[D];for(var _ in S)S[_]=p(C,S[_]);if(delete e[D],C.types)for(var w=C.types,k=Array.isArray(w),F=0,w=k?w:(0,y.default)(w);;){var T;if(k){if(F>=w.length)break;T=w[F++]}else{if((F=w.next()).done)break;T=F.value}var P=T;e[P]?f(e[P],S):e[P]=S}else f(e,S)}}}for(var B in e)if(!h(B)){var O=e[B],j=v.FLIPPED_ALIAS_KEYS[B],N=v.DEPRECATED_KEYS[B];if(N&&(console.trace("Visitor defined for "+B+" but it has been renamed to "+N),j=[N]),j){delete e[B];for(var I=j,L=Array.isArray(I),M=0,I=L?I:(0,y.default)(I);;){var R;if(L){if(M>=I.length)break;R=I[M++]}else{if((M=I.next()).done)break;R=M.value}var V=R,U=e[V];U?f(U,O):e[V]=(0,x.default)(O)}}}for(var q in e)h(q)||c(e[q]);return e}function a(e){if(!e._verified){if("function"==typeof e)throw new Error(b.get("traverseVerifyRootFunction"));for(var t in e)if("enter"!==t&&"exit"!==t||o(t,e[t]),!h(t)){if(v.TYPES.indexOf(t)<0)throw new Error(b.get("traverseVerifyNodeType",t));var r=e[t];if("object"===(void 0===r?"undefined":(0,d.default)(r)))for(var n in r){if("enter"!==n&&"exit"!==n)throw new Error(b.get("traverseVerifyVisitorProperty",t,n));o(t+"."+n,r[n])}}e._verified=!0}}function o(e,t){for(var r=[].concat(t),n=Array.isArray(r),i=0,r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;if("function"!=typeof a)throw new TypeError("Non-function found defined in "+e+" with type "+(void 0===a?"undefined":(0,d.default)(a)))}}function u(e,t,r){var n={};for(var i in e){(function(i){var s=e[i];if(!Array.isArray(s))return"continue";s=s.map(function(e){var n=e;return t&&(n=function(r){return e.call(t,r,t)}),r&&(n=r(t.key,i,n)),n}),n[i]=s})(i)}return n}function l(e){for(var t in e)if(!h(t)){var r=e[t];"function"==typeof r&&(e[t]={enter:r})}}function c(e){e.enter&&!Array.isArray(e.enter)&&(e.enter=[e.enter]),e.exit&&!Array.isArray(e.exit)&&(e.exit=[e.exit])}function p(e,t){var r=function(r){if(e.checkPath(r))return t.apply(this,arguments)};return r.toString=function(){return t.toString()},r}function h(e){return"_"===e[0]||("enter"===e||"exit"===e||"shouldSkip"===e||("blacklist"===e||"noScope"===e||"skipKeys"===e))}function f(e,t){for(var r in t)e[r]=[].concat(e[r]||[],t[r])}r.__esModule=!0;var d=i(e("babel-runtime/helpers/typeof")),m=i(e("babel-runtime/core-js/object/keys")),y=i(e("babel-runtime/core-js/get-iterator"));r.explode=s,r.verify=a,r.merge=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2],n={},i=0;i=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},r.enable(i())}).call(this,e("_process"))},{"./debug":166,_process:550}],166:[function(e,t,r){arguments[4][60][0].apply(r,arguments)},{dup:60,ms:543}],167:[function(e,t,r){"use strict";r.__esModule=!0,r.NOT_LOCAL_BINDING=r.BLOCK_SCOPED_SYMBOL=r.INHERIT_KEYS=r.UNARY_OPERATORS=r.STRING_UNARY_OPERATORS=r.NUMBER_UNARY_OPERATORS=r.BOOLEAN_UNARY_OPERATORS=r.BINARY_OPERATORS=r.NUMBER_BINARY_OPERATORS=r.BOOLEAN_BINARY_OPERATORS=r.COMPARISON_BINARY_OPERATORS=r.EQUALITY_BINARY_OPERATORS=r.BOOLEAN_NUMBER_BINARY_OPERATORS=r.UPDATE_OPERATORS=r.LOGICAL_OPERATORS=r.COMMENT_KEYS=r.FOR_INIT_KEYS=r.FLATTENABLE_KEYS=r.STATEMENT_OR_BLOCK_KEYS=void 0;var n=function(e){return e&&e.__esModule?e:{default:e}}(e("babel-runtime/core-js/symbol/for")),i=(r.STATEMENT_OR_BLOCK_KEYS=["consequent","body","alternate"],r.FLATTENABLE_KEYS=["body","expressions"],r.FOR_INIT_KEYS=["left","init"],r.COMMENT_KEYS=["leadingComments","trailingComments","innerComments"],r.LOGICAL_OPERATORS=["||","&&"],r.UPDATE_OPERATORS=["++","--"],r.BOOLEAN_NUMBER_BINARY_OPERATORS=[">","<",">=","<="]),s=r.EQUALITY_BINARY_OPERATORS=["==","===","!=","!=="],a=r.COMPARISON_BINARY_OPERATORS=[].concat(s,["in","instanceof"]),o=r.BOOLEAN_BINARY_OPERATORS=[].concat(a,i),u=r.NUMBER_BINARY_OPERATORS=["-","/","%","*","**","&","|",">>",">>>","<<","^"],l=(r.BINARY_OPERATORS=["+"].concat(u,o),r.BOOLEAN_UNARY_OPERATORS=["delete","!"]),c=r.NUMBER_UNARY_OPERATORS=["+","-","++","--","~"],p=r.STRING_UNARY_OPERATORS=["typeof"];r.UNARY_OPERATORS=["void"].concat(l,c,p),r.INHERIT_KEYS={optional:["typeAnnotation","typeParameters","returnType"],force:["start","loc","end"]},r.BLOCK_SCOPED_SYMBOL=(0,n.default)("var used to be block scoped"),r.NOT_LOCAL_BINDING=(0,n.default)("should not be considered a local binding")},{"babel-runtime/core-js/symbol/for":130}],168:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,r){for(var n=[],s=!0,a=e,o=Array.isArray(a),u=0,a=o?a:(0,l.default)(a);;){var c;if(o){if(u>=a.length)break;c=a[u++]}else{if((u=a.next()).done)break;c=u.value}var p=c;if(s=!1,h.isExpression(p))n.push(p);else if(h.isExpressionStatement(p))n.push(p.expression);else if(h.isVariableDeclaration(p)){if("var"!==p.kind)return;for(var f=p.declarations,d=Array.isArray(f),m=0,f=d?f:(0,l.default)(f);;){var y;if(d){if(m>=f.length)break;y=f[m++]}else{if((m=f.next()).done)break;y=m.value}var g=y,b=h.getBindingIdentifiers(g);for(var v in b)r.push({kind:p.kind,id:b[v]});g.init&&n.push(h.assignmentExpression("=",g.id,g.init))}s=!0}else if(h.isIfStatement(p)){var x=p.consequent?i([p.consequent],t,r):t.buildUndefinedNode(),E=p.alternate?i([p.alternate],t,r):t.buildUndefinedNode();if(!x||!E)return;n.push(h.conditionalExpression(p.test,x,E))}else if(h.isBlockStatement(p)){var A=i(p.body,t,r);if(!A)return;n.push(A)}else{if(!h.isEmptyStatement(p))return;s=!0}}return s&&n.push(t.buildUndefinedNode()),1===n.length?n[0]:h.sequenceExpression(n)}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.key,r=void 0;return"method"===e.kind?s.increment()+"":(r=h.isIdentifier(t)?t.name:h.isStringLiteral(t)?(0,u.default)(t.value):(0,u.default)(h.removePropertiesDeep(h.cloneDeep(t))),e.computed&&(r="["+r+"]"),e.static&&(r="static:"+r),r)}function a(e){return e+="",e=e.replace(/[^a-zA-Z0-9$_]/g,"-"),e=e.replace(/^[-0-9]+/,""),e=e.replace(/[-\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""}),h.isValidIdentifier(e)||(e="_"+e),e||"_"}r.__esModule=!0;var o=n(e("babel-runtime/core-js/number/max-safe-integer")),u=n(e("babel-runtime/core-js/json/stringify")),l=n(e("babel-runtime/core-js/get-iterator"));r.toComputedKey=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.key||e.property;return e.computed||h.isIdentifier(t)&&(t=h.stringLiteral(t.name)),t},r.toSequenceExpression=function(e,t){if(e&&e.length){var r=[],n=i(e,t,r);if(n){for(var s=r,a=Array.isArray(s),o=0,s=a?s:(0,l.default)(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var c=u;t.push(c)}return n}}},r.toKeyAlias=s,r.toIdentifier=a,r.toBindingIdentifierName=function(e){return"eval"!==(e=a(e))&&"arguments"!==e||(e="_"+e),e},r.toStatement=function(e,t){if(h.isStatement(e))return e;var r=!1,n=void 0;if(h.isClass(e))r=!0,n="ClassDeclaration";else if(h.isFunction(e))r=!0,n="FunctionDeclaration";else if(h.isAssignmentExpression(e))return h.expressionStatement(e);if(r&&!e.id&&(n=!1),!n){if(t)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=n,e},r.toExpression=function(e){if(h.isExpressionStatement(e)&&(e=e.expression),h.isExpression(e))return e;if(h.isClass(e)?e.type="ClassExpression":h.isFunction(e)&&(e.type="FunctionExpression"),!h.isExpression(e))throw new Error("cannot turn "+e.type+" to an expression");return e},r.toBlock=function(e,t){return h.isBlockStatement(e)?e:(h.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(h.isStatement(e)||(e=h.isFunction(t)?h.returnStatement(e):h.expressionStatement(e)),e=[e]),h.blockStatement(e))},r.valueToNode=function(e){if(void 0===e)return h.identifier("undefined");if(!0===e||!1===e)return h.booleanLiteral(e);if(null===e)return h.nullLiteral();if("string"==typeof e)return h.stringLiteral(e);if("number"==typeof e)return h.numericLiteral(e);if((0,p.default)(e)){var t=e.source,r=e.toString().match(/\/([a-z]+|)$/)[1];return h.regExpLiteral(t,r)}if(Array.isArray(e))return h.arrayExpression(e.map(h.valueToNode));if((0,c.default)(e)){var n=[];for(var i in e){var s=void 0;s=h.isValidIdentifier(i)?h.identifier(i):h.stringLiteral(i),n.push(h.objectProperty(s,h.valueToNode(e[i])))}return h.objectExpression(n)}throw new Error("don't know how to turn this value into a node")};var c=n(e("lodash/isPlainObject")),p=n(e("lodash/isRegExp")),h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./index"));s.uid=0,s.increment=function(){return s.uid>=o.default?s.uid=0:s.uid++}},{"./index":178,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/core-js/number/max-safe-integer":123,"lodash/isPlainObject":518,"lodash/isRegExp":519}],169:[function(e,t,r){"use strict";var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("../index")),i=e("../constants"),s=e("./index"),a=function(e){return e&&e.__esModule?e:{default:e}}(s);(0,a.default)("ArrayExpression",{fields:{elements:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeOrValueType)("null","Expression","SpreadElement"))),default:[]}},visitor:["elements"],aliases:["Expression"]}),(0,a.default)("AssignmentExpression",{fields:{operator:{validate:(0,s.assertValueType)("string")},left:{validate:(0,s.assertNodeType)("LVal")},right:{validate:(0,s.assertNodeType)("Expression")}},builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]}),(0,a.default)("BinaryExpression",{builder:["operator","left","right"],fields:{operator:{validate:s.assertOneOf.apply(void 0,i.BINARY_OPERATORS)},left:{validate:(0,s.assertNodeType)("Expression")},right:{validate:(0,s.assertNodeType)("Expression")}},visitor:["left","right"],aliases:["Binary","Expression"]}),(0,a.default)("Directive",{visitor:["value"],fields:{value:{validate:(0,s.assertNodeType)("DirectiveLiteral")}}}),(0,a.default)("DirectiveLiteral",{builder:["value"],fields:{value:{validate:(0,s.assertValueType)("string")}}}),(0,a.default)("BlockStatement",{builder:["body","directives"],visitor:["directives","body"],fields:{directives:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Directive"))),default:[]},body:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Statement")))}},aliases:["Scopable","BlockParent","Block","Statement"]}),(0,a.default)("BreakStatement",{visitor:["label"],fields:{label:{validate:(0,s.assertNodeType)("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]}),(0,a.default)("CallExpression",{visitor:["callee","arguments"],fields:{callee:{validate:(0,s.assertNodeType)("Expression")},arguments:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Expression","SpreadElement")))}},aliases:["Expression"]}),(0,a.default)("CatchClause",{visitor:["param","body"],fields:{param:{validate:(0,s.assertNodeType)("Identifier")},body:{validate:(0,s.assertNodeType)("BlockStatement")}},aliases:["Scopable"]}),(0,a.default)("ConditionalExpression",{visitor:["test","consequent","alternate"],fields:{test:{validate:(0,s.assertNodeType)("Expression")},consequent:{validate:(0,s.assertNodeType)("Expression")},alternate:{validate:(0,s.assertNodeType)("Expression")}},aliases:["Expression","Conditional"]}),(0,a.default)("ContinueStatement",{visitor:["label"],fields:{label:{validate:(0,s.assertNodeType)("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]}),(0,a.default)("DebuggerStatement",{aliases:["Statement"]}),(0,a.default)("DoWhileStatement",{visitor:["test","body"],fields:{test:{validate:(0,s.assertNodeType)("Expression")},body:{validate:(0,s.assertNodeType)("Statement")}},aliases:["Statement","BlockParent","Loop","While","Scopable"]}),(0,a.default)("EmptyStatement",{aliases:["Statement"]}),(0,a.default)("ExpressionStatement",{visitor:["expression"],fields:{expression:{validate:(0,s.assertNodeType)("Expression")}},aliases:["Statement","ExpressionWrapper"]}),(0,a.default)("File",{builder:["program","comments","tokens"],visitor:["program"],fields:{program:{validate:(0,s.assertNodeType)("Program")}}}),(0,a.default)("ForInStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,s.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,s.assertNodeType)("Expression")},body:{validate:(0,s.assertNodeType)("Statement")}}}),(0,a.default)("ForStatement",{visitor:["init","test","update","body"],aliases:["Scopable","Statement","For","BlockParent","Loop"],fields:{init:{validate:(0,s.assertNodeType)("VariableDeclaration","Expression"),optional:!0},test:{validate:(0,s.assertNodeType)("Expression"),optional:!0},update:{validate:(0,s.assertNodeType)("Expression"),optional:!0},body:{validate:(0,s.assertNodeType)("Statement")}}}),(0,a.default)("FunctionDeclaration",{builder:["id","params","body","generator","async"],visitor:["id","params","body","returnType","typeParameters"],fields:{id:{validate:(0,s.assertNodeType)("Identifier")},params:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("LVal")))},body:{validate:(0,s.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,s.assertValueType)("boolean")},async:{default:!1,validate:(0,s.assertValueType)("boolean")}},aliases:["Scopable","Function","BlockParent","FunctionParent","Statement","Pureish","Declaration"]}),(0,a.default)("FunctionExpression",{inherits:"FunctionDeclaration",aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{id:{validate:(0,s.assertNodeType)("Identifier"),optional:!0},params:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("LVal")))},body:{validate:(0,s.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,s.assertValueType)("boolean")},async:{default:!1,validate:(0,s.assertValueType)("boolean")}}}),(0,a.default)("Identifier",{builder:["name"],visitor:["typeAnnotation"],aliases:["Expression","LVal"],fields:{name:{validate:function(e,t,r){n.isValidIdentifier(r)}},decorators:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Decorator")))}}}),(0,a.default)("IfStatement",{visitor:["test","consequent","alternate"],aliases:["Statement","Conditional"],fields:{test:{validate:(0,s.assertNodeType)("Expression")},consequent:{validate:(0,s.assertNodeType)("Statement")},alternate:{optional:!0,validate:(0,s.assertNodeType)("Statement")}}}),(0,a.default)("LabeledStatement",{visitor:["label","body"],aliases:["Statement"],fields:{label:{validate:(0,s.assertNodeType)("Identifier")},body:{validate:(0,s.assertNodeType)("Statement")}}}),(0,a.default)("StringLiteral",{builder:["value"],fields:{value:{validate:(0,s.assertValueType)("string")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,a.default)("NumericLiteral",{builder:["value"],deprecatedAlias:"NumberLiteral",fields:{value:{validate:(0,s.assertValueType)("number")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,a.default)("NullLiteral",{aliases:["Expression","Pureish","Literal","Immutable"]}),(0,a.default)("BooleanLiteral",{builder:["value"],fields:{value:{validate:(0,s.assertValueType)("boolean")}},aliases:["Expression","Pureish","Literal","Immutable"]}),(0,a.default)("RegExpLiteral",{builder:["pattern","flags"],deprecatedAlias:"RegexLiteral",aliases:["Expression","Literal"],fields:{pattern:{validate:(0,s.assertValueType)("string")},flags:{validate:(0,s.assertValueType)("string"),default:""}}}),(0,a.default)("LogicalExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"],fields:{operator:{validate:s.assertOneOf.apply(void 0,i.LOGICAL_OPERATORS)},left:{validate:(0,s.assertNodeType)("Expression")},right:{validate:(0,s.assertNodeType)("Expression")}}}),(0,a.default)("MemberExpression",{builder:["object","property","computed"],visitor:["object","property"],aliases:["Expression","LVal"],fields:{object:{validate:(0,s.assertNodeType)("Expression")},property:{validate:function(e,t,r){var n=e.computed?"Expression":"Identifier";(0,s.assertNodeType)(n)(e,t,r)}},computed:{default:!1}}}),(0,a.default)("NewExpression",{visitor:["callee","arguments"],aliases:["Expression"],fields:{callee:{validate:(0,s.assertNodeType)("Expression")},arguments:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Expression","SpreadElement")))}}}),(0,a.default)("Program",{visitor:["directives","body"],builder:["body","directives"],fields:{directives:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Directive"))),default:[]},body:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Statement")))}},aliases:["Scopable","BlockParent","Block","FunctionParent"]}),(0,a.default)("ObjectExpression",{visitor:["properties"],aliases:["Expression"],fields:{properties:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("ObjectMethod","ObjectProperty","SpreadProperty")))}}}),(0,a.default)("ObjectMethod",{builder:["kind","key","params","body","computed"],fields:{kind:{validate:(0,s.chain)((0,s.assertValueType)("string"),(0,s.assertOneOf)("method","get","set")),default:"method"},computed:{validate:(0,s.assertValueType)("boolean"),default:!1},key:{validate:function(e,t,r){var n=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];s.assertNodeType.apply(void 0,n)(e,t,r)}},decorators:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Decorator")))},body:{validate:(0,s.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,s.assertValueType)("boolean")},async:{default:!1,validate:(0,s.assertValueType)("boolean")}},visitor:["key","params","body","decorators","returnType","typeParameters"],aliases:["UserWhitespacable","Function","Scopable","BlockParent","FunctionParent","Method","ObjectMember"]}),(0,a.default)("ObjectProperty",{builder:["key","value","computed","shorthand","decorators"],fields:{computed:{validate:(0,s.assertValueType)("boolean"),default:!1},key:{validate:function(e,t,r){var n=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];s.assertNodeType.apply(void 0,n)(e,t,r)}},value:{validate:(0,s.assertNodeType)("Expression","Pattern","RestElement")},shorthand:{validate:(0,s.assertValueType)("boolean"),default:!1},decorators:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Decorator"))),optional:!0}},visitor:["key","value","decorators"],aliases:["UserWhitespacable","Property","ObjectMember"]}),(0,a.default)("RestElement",{visitor:["argument","typeAnnotation"],aliases:["LVal"],fields:{argument:{validate:(0,s.assertNodeType)("LVal")},decorators:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Decorator")))}}}),(0,a.default)("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:(0,s.assertNodeType)("Expression"),optional:!0}}}),(0,a.default)("SequenceExpression",{visitor:["expressions"],fields:{expressions:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Expression")))}},aliases:["Expression"]}),(0,a.default)("SwitchCase",{visitor:["test","consequent"],fields:{test:{validate:(0,s.assertNodeType)("Expression"),optional:!0},consequent:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("Statement")))}}}),(0,a.default)("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"],fields:{discriminant:{validate:(0,s.assertNodeType)("Expression")},cases:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("SwitchCase")))}}}),(0,a.default)("ThisExpression",{aliases:["Expression"]}),(0,a.default)("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:(0,s.assertNodeType)("Expression")}}}),(0,a.default)("TryStatement",{visitor:["block","handler","finalizer"],aliases:["Statement"],fields:{body:{validate:(0,s.assertNodeType)("BlockStatement")},handler:{optional:!0,handler:(0,s.assertNodeType)("BlockStatement")},finalizer:{optional:!0,validate:(0,s.assertNodeType)("BlockStatement")}}}),(0,a.default)("UnaryExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!0},argument:{validate:(0,s.assertNodeType)("Expression")},operator:{validate:s.assertOneOf.apply(void 0,i.UNARY_OPERATORS)}},visitor:["argument"],aliases:["UnaryLike","Expression"]}),(0,a.default)("UpdateExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!1},argument:{validate:(0,s.assertNodeType)("Expression")},operator:{validate:s.assertOneOf.apply(void 0,i.UPDATE_OPERATORS)}},visitor:["argument"],aliases:["Expression"]}),(0,a.default)("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"],fields:{kind:{validate:(0,s.chain)((0,s.assertValueType)("string"),(0,s.assertOneOf)("var","let","const"))},declarations:{validate:(0,s.chain)((0,s.assertValueType)("array"),(0,s.assertEach)((0,s.assertNodeType)("VariableDeclarator")))}}}),(0,a.default)("VariableDeclarator",{visitor:["id","init"],fields:{id:{validate:(0,s.assertNodeType)("LVal")},init:{optional:!0,validate:(0,s.assertNodeType)("Expression")}}}),(0,a.default)("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"],fields:{test:{validate:(0,s.assertNodeType)("Expression")},body:{validate:(0,s.assertNodeType)("BlockStatement","Statement")}}}),(0,a.default)("WithStatement",{visitor:["object","body"],aliases:["Statement"],fields:{object:{object:(0,s.assertNodeType)("Expression")},body:{validate:(0,s.assertNodeType)("BlockStatement","Statement")}}})},{"../constants":167,"../index":178,"./index":173}],170:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AssignmentPattern",{visitor:["left","right"],aliases:["Pattern","LVal"],fields:{left:{validate:(0,n.assertNodeType)("Identifier")},right:{validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ArrayPattern",{visitor:["elements","typeAnnotation"],aliases:["Pattern","LVal"],fields:{elements:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Identifier","Pattern","RestElement")))},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["params","body","returnType","typeParameters"],aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{params:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("LVal")))},body:{validate:(0,n.assertNodeType)("BlockStatement","Expression")},async:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("ClassBody",{visitor:["body"],fields:{body:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ClassMethod","ClassProperty")))}}}),(0,i.default)("ClassDeclaration",{builder:["id","superClass","body","decorators"],visitor:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Statement","Declaration","Pureish"],fields:{id:{validate:(0,n.assertNodeType)("Identifier")},body:{validate:(0,n.assertNodeType)("ClassBody")},superClass:{optional:!0,validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ClassExpression",{inherits:"ClassDeclaration",aliases:["Scopable","Class","Expression","Pureish"],fields:{id:{optional:!0,validate:(0,n.assertNodeType)("Identifier")},body:{validate:(0,n.assertNodeType)("ClassBody")},superClass:{optional:!0,validate:(0,n.assertNodeType)("Expression")},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("ExportAllDeclaration",{visitor:["source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{source:{validate:(0,n.assertNodeType)("StringLiteral")}}}),(0,i.default)("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{declaration:{validate:(0,n.assertNodeType)("FunctionDeclaration","ClassDeclaration","Expression")}}}),(0,i.default)("ExportNamedDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{declaration:{validate:(0,n.assertNodeType)("Declaration"),optional:!0},specifiers:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ExportSpecifier")))},source:{validate:(0,n.assertNodeType)("StringLiteral"),optional:!0}}}),(0,i.default)("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")},exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ForOfStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,n.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,n.assertNodeType)("Expression")},body:{validate:(0,n.assertNodeType)("Statement")}}}),(0,i.default)("ImportDeclaration",{visitor:["specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration"],fields:{specifiers:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("ImportSpecifier","ImportDefaultSpecifier","ImportNamespaceSpecifier")))},source:{validate:(0,n.assertNodeType)("StringLiteral")}}}),(0,i.default)("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ImportSpecifier",{visitor:["local","imported"],aliases:["ModuleSpecifier"],fields:{local:{validate:(0,n.assertNodeType)("Identifier")},imported:{validate:(0,n.assertNodeType)("Identifier")},importKind:{validate:(0,n.assertOneOf)(null,"type","typeof")}}}),(0,i.default)("MetaProperty",{visitor:["meta","property"],aliases:["Expression"],fields:{meta:{validate:(0,n.assertValueType)("string")},property:{validate:(0,n.assertValueType)("string")}}}),(0,i.default)("ClassMethod",{aliases:["Function","Scopable","BlockParent","FunctionParent","Method"],builder:["kind","key","params","body","computed","static"],visitor:["key","params","body","decorators","returnType","typeParameters"],fields:{kind:{validate:(0,n.chain)((0,n.assertValueType)("string"),(0,n.assertOneOf)("get","set","method","constructor")),default:"method"},computed:{default:!1,validate:(0,n.assertValueType)("boolean")},static:{default:!1,validate:(0,n.assertValueType)("boolean")},key:{validate:function(e,t,r){var i=e.computed?["Expression"]:["Identifier","StringLiteral","NumericLiteral"];n.assertNodeType.apply(void 0,i)(e,t,r)}},params:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("LVal")))},body:{validate:(0,n.assertNodeType)("BlockStatement")},generator:{default:!1,validate:(0,n.assertValueType)("boolean")},async:{default:!1,validate:(0,n.assertValueType)("boolean")}}}),(0,i.default)("ObjectPattern",{visitor:["properties","typeAnnotation"],aliases:["Pattern","LVal"],fields:{properties:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("RestProperty","Property")))},decorators:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Decorator")))}}}),(0,i.default)("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("Super",{aliases:["Expression"]}),(0,i.default)("TaggedTemplateExpression",{visitor:["tag","quasi"],aliases:["Expression"],fields:{tag:{validate:(0,n.assertNodeType)("Expression")},quasi:{validate:(0,n.assertNodeType)("TemplateLiteral")}}}),(0,i.default)("TemplateElement",{builder:["value","tail"],fields:{value:{},tail:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression","Literal"],fields:{quasis:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("TemplateElement")))},expressions:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("Expression")))}}}),(0,i.default)("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{delegate:{validate:(0,n.assertValueType)("boolean"),default:!1},argument:{optional:!0,validate:(0,n.assertNodeType)("Expression")}}})},{"./index":173}],171:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AwaitExpression",{builder:["argument"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("ForAwaitStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(0,n.assertNodeType)("VariableDeclaration","LVal")},right:{validate:(0,n.assertNodeType)("Expression")},body:{validate:(0,n.assertNodeType)("Statement")}}}),(0,i.default)("BindExpression",{visitor:["object","callee"],aliases:["Expression"],fields:{}}),(0,i.default)("Import",{aliases:["Expression"]}),(0,i.default)("Decorator",{visitor:["expression"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("DoExpression",{visitor:["body"],aliases:["Expression"],fields:{body:{validate:(0,n.assertNodeType)("BlockStatement")}}}),(0,i.default)("ExportDefaultSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:(0,n.assertNodeType)("Identifier")}}}),(0,i.default)("RestProperty",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("LVal")}}}),(0,i.default)("SpreadProperty",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}})},{"./index":173}],172:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("AnyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["Flow"],fields:{}}),(0,i.default)("BooleanTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("BooleanLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("NullLiteralTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ClassImplements",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("ClassProperty",{visitor:["key","value","typeAnnotation","decorators"],builder:["key","value","typeAnnotation","decorators","computed"],aliases:["Property"],fields:{computed:{validate:(0,n.assertValueType)("boolean"),default:!1}}}),(0,i.default)("DeclareClass",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareFunction",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareInterface",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareModule",{visitor:["id","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareModuleExports",{visitor:["typeAnnotation"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareTypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareOpaqueType",{visitor:["id","typeParameters","supertype"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareVariable",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("DeclareExportDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("ExistentialTypeParam",{aliases:["Flow"]}),(0,i.default)("FunctionTypeAnnotation",{visitor:["typeParameters","params","rest","returnType"],aliases:["Flow"],fields:{}}),(0,i.default)("FunctionTypeParam",{visitor:["name","typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("InterfaceExtends",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),(0,i.default)("InterfaceDeclaration",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("IntersectionTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("MixedTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),(0,i.default)("EmptyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),(0,i.default)("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("NumericLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("NumberTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("StringLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),(0,i.default)("StringTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("ThisTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),(0,i.default)("TupleTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeofTypeAnnotation",{visitor:["argument"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("OpaqueType",{visitor:["id","typeParameters","impltype","supertype"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),(0,i.default)("TypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["Flow","ExpressionWrapper","Expression"],fields:{}}),(0,i.default)("TypeParameter",{visitor:["bound"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeParameterDeclaration",{visitor:["params"],aliases:["Flow"],fields:{}}),(0,i.default)("TypeParameterInstantiation",{visitor:["params"],aliases:["Flow"],fields:{}}),(0,i.default)("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties"],aliases:["Flow"],fields:{}}),(0,i.default)("ObjectTypeCallProperty",{visitor:["value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("ObjectTypeIndexer",{visitor:["id","key","value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("ObjectTypeProperty",{visitor:["key","value"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("ObjectTypeSpreadProperty",{visitor:["argument"],aliases:["Flow","UserWhitespacable"],fields:{}}),(0,i.default)("QualifiedTypeIdentifier",{visitor:["id","qualification"],aliases:["Flow"],fields:{}}),(0,i.default)("UnionTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),(0,i.default)("VoidTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}})},{"./index":173}],173:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return Array.isArray(e)?"array":null===e?"null":void 0===e?"undefined":void 0===e?"undefined":(0,u.default)(e)}function s(e){function t(t,r,n){if(!(i(n)===e))throw new TypeError("Property "+r+" expected type of "+e+" but got "+i(n))}return t.type=e,t}r.__esModule=!0,r.DEPRECATED_KEYS=r.BUILDER_KEYS=r.NODE_FIELDS=r.ALIAS_KEYS=r.VISITOR_KEYS=void 0;var a=n(e("babel-runtime/core-js/get-iterator")),o=n(e("babel-runtime/core-js/json/stringify")),u=n(e("babel-runtime/helpers/typeof"));r.assertEach=function(e){function t(t,r,n){if(Array.isArray(n))for(var i=0;i=s.length)break;p=s[c++]}else{if((c=s.next()).done)break;p=c.value}var h=p;if(l.is(h,n)){i=!0;break}}if(!i)throw new TypeError("Property "+t+" of "+e.type+" expected node to be of a type "+(0,o.default)(r)+" but instead got "+(0,o.default)(n&&n.type))}for(var t=arguments.length,r=Array(t),n=0;n=u.length)break;h=u[p++]}else{if((p=u.next()).done)break;h=p.value}var f=h;if(i(n)===f||l.is(f,n)){s=!0;break}}if(!s)throw new TypeError("Property "+t+" of "+e.type+" expected node to be of a type "+(0,o.default)(r)+" but instead got "+(0,o.default)(n&&n.type))}for(var t=arguments.length,r=Array(t),n=0;n=e.length)break;i=e[n++]}else{if((n=e.next()).done)break;i=n.value}i.apply(void 0,arguments)}}for(var t=arguments.length,r=Array(t),n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=t.inherits&&m[t.inherits]||{};t.fields=t.fields||r.fields||{},t.visitor=t.visitor||r.visitor||[],t.aliases=t.aliases||r.aliases||[],t.builder=t.builder||r.builder||t.visitor||[],t.deprecatedAlias&&(d[t.deprecatedAlias]=e);for(var n=t.visitor.concat(t.builder),o=Array.isArray(n),u=0,n=o?n:(0,a.default)(n);;){var l;if(o){if(u>=n.length)break;l=n[u++]}else{if((u=n.next()).done)break;l=u.value}var y=l;t.fields[y]=t.fields[y]||{}}for(var g in t.fields){var b=t.fields[g];-1===t.builder.indexOf(g)&&(b.optional=!0),void 0===b.default?b.default=null:b.validate||(b.validate=s(i(b.default)))}c[e]=t.visitor,f[e]=t.builder,h[e]=t.fields,p[e]=t.aliases,m[e]=t};var l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("../index")),c=r.VISITOR_KEYS={},p=r.ALIAS_KEYS={},h=r.NODE_FIELDS={},f=r.BUILDER_KEYS={},d=r.DEPRECATED_KEYS={},m={}},{"../index":178,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/helpers/typeof":138}],174:[function(e,t,r){"use strict";e("./index"),e("./core"),e("./es2015"),e("./flow"),e("./jsx"),e("./misc"),e("./experimental")},{"./core":169,"./es2015":170,"./experimental":171,"./flow":172,"./index":173,"./jsx":175,"./misc":176}],175:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("JSXAttribute",{visitor:["name","value"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXNamespacedName")},value:{optional:!0,validate:(0,n.assertNodeType)("JSXElement","StringLiteral","JSXExpressionContainer")}}}),(0,i.default)("JSXClosingElement",{visitor:["name"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXMemberExpression")}}}),(0,i.default)("JSXElement",{builder:["openingElement","closingElement","children","selfClosing"],visitor:["openingElement","children","closingElement"],aliases:["JSX","Immutable","Expression"],fields:{openingElement:{validate:(0,n.assertNodeType)("JSXOpeningElement")},closingElement:{optional:!0,validate:(0,n.assertNodeType)("JSXClosingElement")},children:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement")))}}}),(0,i.default)("JSXEmptyExpression",{aliases:["JSX","Expression"]}),(0,i.default)("JSXExpressionContainer",{visitor:["expression"],aliases:["JSX","Immutable"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXSpreadChild",{visitor:["expression"],aliases:["JSX","Immutable"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXIdentifier",{builder:["name"],aliases:["JSX","Expression"],fields:{name:{validate:(0,n.assertValueType)("string")}}}),(0,i.default)("JSXMemberExpression",{visitor:["object","property"],aliases:["JSX","Expression"],fields:{object:{validate:(0,n.assertNodeType)("JSXMemberExpression","JSXIdentifier")},property:{validate:(0,n.assertNodeType)("JSXIdentifier")}}}),(0,i.default)("JSXNamespacedName",{visitor:["namespace","name"],aliases:["JSX"],fields:{namespace:{validate:(0,n.assertNodeType)("JSXIdentifier")},name:{validate:(0,n.assertNodeType)("JSXIdentifier")}}}),(0,i.default)("JSXOpeningElement",{builder:["name","attributes","selfClosing"],visitor:["name","attributes"],aliases:["JSX","Immutable"],fields:{name:{validate:(0,n.assertNodeType)("JSXIdentifier","JSXMemberExpression")},selfClosing:{default:!1,validate:(0,n.assertValueType)("boolean")},attributes:{validate:(0,n.chain)((0,n.assertValueType)("array"),(0,n.assertEach)((0,n.assertNodeType)("JSXAttribute","JSXSpreadAttribute")))}}}),(0,i.default)("JSXSpreadAttribute",{visitor:["argument"],aliases:["JSX"],fields:{argument:{validate:(0,n.assertNodeType)("Expression")}}}),(0,i.default)("JSXText",{aliases:["JSX","Immutable"],builder:["value"],fields:{value:{validate:(0,n.assertValueType)("string")}}})},{"./index":173}],176:[function(e,t,r){"use strict";var n=e("./index"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);(0,i.default)("Noop",{visitor:[]}),(0,i.default)("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression","ExpressionWrapper"],fields:{expression:{validate:(0,n.assertNodeType)("Expression")}}})},{"./index":173}],177:[function(e,t,r){"use strict";function n(e){for(var t={},r={},s=[],a=[],o=0;o=0)){if(i.isAnyTypeAnnotation(u))return[u];if(i.isFlowBaseAnnotation(u))r[u.type]=u;else if(i.isUnionTypeAnnotation(u))s.indexOf(u.types)<0&&(e=e.concat(u.types),s.push(u.types));else if(i.isGenericTypeAnnotation(u)){var l=u.id.name;if(t[l]){var c=t[l];c.typeParameters?u.typeParameters&&(c.typeParameters.params=n(c.typeParameters.params.concat(u.typeParameters.params))):c=u.typeParameters}else t[l]=u}else a.push(u)}}for(var p in r)a.push(r[p]);for(var h in t)a.push(t[h]);return a}r.__esModule=!0,r.createUnionTypeAnnotation=function(e){var t=n(e);return 1===t.length?t[0]:i.unionTypeAnnotation(t)},r.removeTypeDuplicates=n,r.createTypeAnnotationBasedOnTypeof=function(e){if("string"===e)return i.stringTypeAnnotation();if("number"===e)return i.numberTypeAnnotation();if("undefined"===e)return i.voidTypeAnnotation();if("boolean"===e)return i.booleanTypeAnnotation();if("function"===e)return i.genericTypeAnnotation(i.identifier("Function"));if("object"===e)return i.genericTypeAnnotation(i.identifier("Object"));if("symbol"===e)return i.genericTypeAnnotation(i.identifier("Symbol"));throw new Error("Invalid typeof value")};var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./index"))},{"./index":178}],178:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=F["is"+e];t||(t=F["is"+e]=function(t,r){return F.is(e,t,r)}),F["assert"+e]=function(r,n){if(n=n||{},!t(r,n))throw new Error("Expected type "+(0,b.default)(e)+" with option "+(0,b.default)(n))}}function s(e,t){if(e===t)return!0;if(F.ALIAS_KEYS[t])return!1;var r=F.FLIPPED_ALIAS_KEYS[t];if(r){if(r[0]===e)return!0;for(var n=r,i=Array.isArray(n),s=0,n=i?n:(0,y.default)(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}if(e===a)return!0}}return!1}function a(e,t,r){if(e){var n=F.NODE_FIELDS[e.type];if(n){var i=n[t];i&&i.validate&&(i.optional&&null==r||i.validate(e,t,r))}}}function o(e){if(!e)return e;var t={};for(var r in e)"_"!==r[0]&&(t[r]=e[r]);return t}function u(e,t){p("trailingComments",e,t)}function l(e,t){p("leadingComments",e,t)}function c(e,t){p("innerComments",e,t)}function p(e,t,r){t&&r&&(t[e]=(0,_.default)([].concat(t[e],r[e]).filter(Boolean)))}function h(e){return!(!e||!w.VISITOR_KEYS[e.type])}function f(e,t,r){if(e){var n=F.VISITOR_KEYS[e.type];if(n){t(e,r=r||{});for(var i=n,s=Array.isArray(i),a=0,i=s?i:(0,y.default)(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if((a=i.next()).done)break;o=a.value}var u=e[o];if(Array.isArray(u))for(var l=u,c=Array.isArray(l),p=0,l=c?l:(0,y.default)(l);;){var h;if(c){if(p>=l.length)break;h=l[p++]}else{if((p=l.next()).done)break;h=p.value}f(h,t,r)}else f(u,t,r)}}}}function d(e,t){for(var r=(t=t||{}).preserveComments?B:O,n=Array.isArray(r),i=0,r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;null!=e[a]&&(e[a]=void 0)}for(var o in e)"_"===o[0]&&null!=e[o]&&(e[o]=void 0);for(var u=(0,m.default)(e),l=Array.isArray(u),c=0,u=l?u:(0,y.default)(u);;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if((c=u.next()).done)break;p=c.value}e[p]=null}}r.__esModule=!0,r.createTypeAnnotationBasedOnTypeof=r.removeTypeDuplicates=r.createUnionTypeAnnotation=r.valueToNode=r.toBlock=r.toExpression=r.toStatement=r.toBindingIdentifierName=r.toIdentifier=r.toKeyAlias=r.toSequenceExpression=r.toComputedKey=r.isNodesEquivalent=r.isImmutable=r.isScope=r.isSpecifierDefault=r.isVar=r.isBlockScoped=r.isLet=r.isValidIdentifier=r.isReferenced=r.isBinding=r.getOuterBindingIdentifiers=r.getBindingIdentifiers=r.TYPES=r.react=r.DEPRECATED_KEYS=r.BUILDER_KEYS=r.NODE_FIELDS=r.ALIAS_KEYS=r.VISITOR_KEYS=r.NOT_LOCAL_BINDING=r.BLOCK_SCOPED_SYMBOL=r.INHERIT_KEYS=r.UNARY_OPERATORS=r.STRING_UNARY_OPERATORS=r.NUMBER_UNARY_OPERATORS=r.BOOLEAN_UNARY_OPERATORS=r.BINARY_OPERATORS=r.NUMBER_BINARY_OPERATORS=r.BOOLEAN_BINARY_OPERATORS=r.COMPARISON_BINARY_OPERATORS=r.EQUALITY_BINARY_OPERATORS=r.BOOLEAN_NUMBER_BINARY_OPERATORS=r.UPDATE_OPERATORS=r.LOGICAL_OPERATORS=r.COMMENT_KEYS=r.FOR_INIT_KEYS=r.FLATTENABLE_KEYS=r.STATEMENT_OR_BLOCK_KEYS=void 0;var m=n(e("babel-runtime/core-js/object/get-own-property-symbols")),y=n(e("babel-runtime/core-js/get-iterator")),g=n(e("babel-runtime/core-js/object/keys")),b=n(e("babel-runtime/core-js/json/stringify")),v=e("./constants");Object.defineProperty(r,"STATEMENT_OR_BLOCK_KEYS",{enumerable:!0,get:function(){return v.STATEMENT_OR_BLOCK_KEYS}}),Object.defineProperty(r,"FLATTENABLE_KEYS",{enumerable:!0,get:function(){return v.FLATTENABLE_KEYS}}),Object.defineProperty(r,"FOR_INIT_KEYS",{enumerable:!0,get:function(){return v.FOR_INIT_KEYS}}),Object.defineProperty(r,"COMMENT_KEYS",{enumerable:!0,get:function(){return v.COMMENT_KEYS}}),Object.defineProperty(r,"LOGICAL_OPERATORS",{enumerable:!0,get:function(){return v.LOGICAL_OPERATORS}}),Object.defineProperty(r,"UPDATE_OPERATORS",{enumerable:!0,get:function(){return v.UPDATE_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_NUMBER_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.BOOLEAN_NUMBER_BINARY_OPERATORS}}),Object.defineProperty(r,"EQUALITY_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.EQUALITY_BINARY_OPERATORS}}),Object.defineProperty(r,"COMPARISON_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.COMPARISON_BINARY_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.BOOLEAN_BINARY_OPERATORS}}),Object.defineProperty(r,"NUMBER_BINARY_OPERATORS",{enumerable:!0,get:function(){return v.NUMBER_BINARY_OPERATORS}}),Object.defineProperty(r,"BINARY_OPERATORS",{enumerable:!0,get:function(){return v.BINARY_OPERATORS}}),Object.defineProperty(r,"BOOLEAN_UNARY_OPERATORS",{enumerable:!0,get:function(){return v.BOOLEAN_UNARY_OPERATORS}}),Object.defineProperty(r,"NUMBER_UNARY_OPERATORS",{enumerable:!0,get:function(){return v.NUMBER_UNARY_OPERATORS}}),Object.defineProperty(r,"STRING_UNARY_OPERATORS",{enumerable:!0,get:function(){return v.STRING_UNARY_OPERATORS}}),Object.defineProperty(r,"UNARY_OPERATORS",{enumerable:!0,get:function(){return v.UNARY_OPERATORS}}),Object.defineProperty(r,"INHERIT_KEYS",{enumerable:!0,get:function(){return v.INHERIT_KEYS}}),Object.defineProperty(r,"BLOCK_SCOPED_SYMBOL",{enumerable:!0,get:function(){return v.BLOCK_SCOPED_SYMBOL}}),Object.defineProperty(r,"NOT_LOCAL_BINDING",{enumerable:!0,get:function(){return v.NOT_LOCAL_BINDING}}),r.is=function(e,t,r){return!!t&&!!s(t.type,e)&&(void 0===r||F.shallowEqual(t,r))},r.isType=s,r.validate=a,r.shallowEqual=function(e,t){for(var r=(0,g.default)(t),n=Array.isArray(r),i=0,r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;if(e[a]!==t[a])return!1}return!0},r.appendToMemberExpression=function(e,t,r){return e.object=F.memberExpression(e.object,e.property,e.computed),e.property=t,e.computed=!!r,e},r.prependToMemberExpression=function(e,t){return e.object=F.memberExpression(t,e.object),e},r.ensureBlock=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"body";return e[t]=F.toBlock(e[t],e)},r.clone=o,r.cloneWithoutLoc=function(e){var t=o(e);return delete t.loc,t},r.cloneDeep=function(e){if(!e)return e;var t={};for(var r in e)if("_"!==r[0]){var n=e[r];n&&(n.type?n=F.cloneDeep(n):Array.isArray(n)&&(n=n.map(F.cloneDeep))),t[r]=n}return t},r.buildMatchMemberExpression=function(e,t){var r=e.split(".");return function(e){if(!F.isMemberExpression(e))return!1;for(var n=[e],i=0;n.length;){var s=n.shift();if(t&&i===r.length)return!0;if(F.isIdentifier(s)){if(r[i]!==s.name)return!1}else{if(!F.isStringLiteral(s)){if(F.isMemberExpression(s)){if(s.computed&&!F.isStringLiteral(s.property))return!1;n.push(s.object),n.push(s.property);continue}return!1}if(r[i]!==s.value)return!1}if(++i>r.length)return!1}return!0}},r.removeComments=function(e){for(var t=F.COMMENT_KEYS,r=Array.isArray(t),n=0,t=r?t:(0,y.default)(t);;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}delete e[i]}return e},r.inheritsComments=function(e,t){return u(e,t),l(e,t),c(e,t),e},r.inheritTrailingComments=u,r.inheritLeadingComments=l,r.inheritInnerComments=c,r.inherits=function(e,t){if(!e||!t)return e;for(var r=F.INHERIT_KEYS.optional,n=Array.isArray(r),i=0,r=n?r:(0,y.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;null==e[a]&&(e[a]=t[a])}for(var o in t)"_"===o[0]&&(e[o]=t[o]);for(var u=F.INHERIT_KEYS.force,l=Array.isArray(u),c=0,u=l?u:(0,y.default)(u);;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if((c=u.next()).done)break;p=c.value}var h=p;e[h]=t[h]}return F.inheritsComments(e,t),e},r.assertNode=function(e){if(!h(e))throw new TypeError("Not a valid node "+(e&&e.type))},r.isNode=h,r.traverseFast=f,r.removeProperties=d,r.removePropertiesDeep=function(e,t){return f(e,d,t),e};var x=e("./retrievers");Object.defineProperty(r,"getBindingIdentifiers",{enumerable:!0,get:function(){return x.getBindingIdentifiers}}),Object.defineProperty(r,"getOuterBindingIdentifiers",{enumerable:!0,get:function(){return x.getOuterBindingIdentifiers}});var E=e("./validators");Object.defineProperty(r,"isBinding",{enumerable:!0,get:function(){return E.isBinding}}),Object.defineProperty(r,"isReferenced",{enumerable:!0,get:function(){return E.isReferenced}}),Object.defineProperty(r,"isValidIdentifier",{enumerable:!0,get:function(){return E.isValidIdentifier}}),Object.defineProperty(r,"isLet",{enumerable:!0,get:function(){return E.isLet}}),Object.defineProperty(r,"isBlockScoped",{enumerable:!0,get:function(){return E.isBlockScoped}}),Object.defineProperty(r,"isVar",{enumerable:!0,get:function(){return E.isVar}}),Object.defineProperty(r,"isSpecifierDefault",{enumerable:!0,get:function(){return E.isSpecifierDefault}}),Object.defineProperty(r,"isScope",{enumerable:!0,get:function(){return E.isScope}}),Object.defineProperty(r,"isImmutable",{enumerable:!0,get:function(){return E.isImmutable}}),Object.defineProperty(r,"isNodesEquivalent",{enumerable:!0,get:function(){return E.isNodesEquivalent}});var A=e("./converters");Object.defineProperty(r,"toComputedKey",{enumerable:!0,get:function(){return A.toComputedKey}}),Object.defineProperty(r,"toSequenceExpression",{enumerable:!0,get:function(){return A.toSequenceExpression}}),Object.defineProperty(r,"toKeyAlias",{enumerable:!0,get:function(){return A.toKeyAlias}}),Object.defineProperty(r,"toIdentifier",{enumerable:!0,get:function(){return A.toIdentifier}}),Object.defineProperty(r,"toBindingIdentifierName",{enumerable:!0,get:function(){return A.toBindingIdentifierName}}),Object.defineProperty(r,"toStatement",{enumerable:!0,get:function(){return A.toStatement}}),Object.defineProperty(r,"toExpression",{enumerable:!0,get:function(){return A.toExpression}}),Object.defineProperty(r,"toBlock",{enumerable:!0,get:function(){return A.toBlock}}),Object.defineProperty(r,"valueToNode",{enumerable:!0,get:function(){return A.valueToNode}});var D=e("./flow");Object.defineProperty(r,"createUnionTypeAnnotation",{enumerable:!0,get:function(){return D.createUnionTypeAnnotation}}),Object.defineProperty(r,"removeTypeDuplicates",{enumerable:!0,get:function(){return D.removeTypeDuplicates}}),Object.defineProperty(r,"createTypeAnnotationBasedOnTypeof",{enumerable:!0,get:function(){return D.createTypeAnnotationBasedOnTypeof}});var C=n(e("to-fast-properties")),S=n(e("lodash/clone")),_=n(e("lodash/uniq"));e("./definitions/init");var w=e("./definitions"),k=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./react")),F=r;r.VISITOR_KEYS=w.VISITOR_KEYS,r.ALIAS_KEYS=w.ALIAS_KEYS,r.NODE_FIELDS=w.NODE_FIELDS,r.BUILDER_KEYS=w.BUILDER_KEYS,r.DEPRECATED_KEYS=w.DEPRECATED_KEYS,r.react=k;for(var T in F.VISITOR_KEYS)i(T);F.FLIPPED_ALIAS_KEYS={},(0,g.default)(F.ALIAS_KEYS).forEach(function(e){F.ALIAS_KEYS[e].forEach(function(t){(F.FLIPPED_ALIAS_KEYS[t]=F.FLIPPED_ALIAS_KEYS[t]||[]).push(e)})}),(0,g.default)(F.FLIPPED_ALIAS_KEYS).forEach(function(e){F[e.toUpperCase()+"_TYPES"]=F.FLIPPED_ALIAS_KEYS[e],i(e)});r.TYPES=(0,g.default)(F.VISITOR_KEYS).concat((0,g.default)(F.FLIPPED_ALIAS_KEYS)).concat((0,g.default)(F.DEPRECATED_KEYS));(0,g.default)(F.BUILDER_KEYS).forEach(function(e){function t(){if(arguments.length>r.length)throw new Error("t."+e+": Too many arguments passed. Received "+arguments.length+" but can receive no more than "+r.length);var t={};t.type=e;for(var n=0,i=r,s=Array.isArray(i),o=0,i=s?i:(0,y.default)(i);;){var u;if(s){if(o>=i.length)break;u=i[o++]}else{if((o=i.next()).done)break;u=o.value}var l=u,c=F.NODE_FIELDS[e][l],p=arguments[n++];void 0===p&&(p=(0,S.default)(c.default)),t[l]=p}for(var h in t)a(t,h,t[h]);return t}var r=F.BUILDER_KEYS[e];F[e]=t,F[e[0].toLowerCase()+e.slice(1)]=t});for(var P in F.DEPRECATED_KEYS)!function(e){function t(t){return function(){return console.trace("The node type "+e+" has been renamed to "+r),t.apply(this,arguments)}}var r=F.DEPRECATED_KEYS[e];F[e]=F[e[0].toLowerCase()+e.slice(1)]=t(F[r]),F["is"+e]=t(F["is"+r]),F["assert"+e]=t(F["assert"+r])}(P);(0,C.default)(F),(0,C.default)(F.VISITOR_KEYS);var B=["tokens","start","end","loc","raw","rawValue"],O=F.COMMENT_KEYS.concat(["comments"]).concat(B)},{"./constants":167,"./converters":168,"./definitions":173,"./definitions/init":174,"./flow":177,"./react":179,"./retrievers":180,"./validators":181,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/json/stringify":121,"babel-runtime/core-js/object/get-own-property-symbols":126,"babel-runtime/core-js/object/keys":127,"lodash/clone":491,"lodash/uniq":540,"to-fast-properties":607}],179:[function(e,t,r){"use strict";function n(e,t){for(var r=e.value.split(/\r\n|\n|\r/),n=0,s=0;s=r.length)break;l=r[u++]}else{if((u=r.next()).done)break;l=u.value}var p=l;if((0,a.default)(e[p])!==(0,a.default)(t[p]))return!1;if(Array.isArray(e[p])){if(!Array.isArray(t[p]))return!1;if(e[p].length!==t[p].length)return!1;for(var h=0;h=0)return!0}else if(i===e)return!0}return!1},r.isReferenced=function(e,t){switch(t.type){case"BindExpression":return t.object===e||t.callee===e;case"MemberExpression":case"JSXMemberExpression":return!(t.property!==e||!t.computed)||t.object===e;case"MetaProperty":return!1;case"ObjectProperty":if(t.key===e)return t.computed;case"VariableDeclarator":return t.id!==e;case"ArrowFunctionExpression":case"FunctionDeclaration":case"FunctionExpression":for(var r=t.params,n=Array.isArray(r),i=0,r=n?r:(0,o.default)(r);;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}if(s===e)return!1}return t.id!==e;case"ExportSpecifier":return!t.source&&t.local===e;case"ExportNamespaceSpecifier":case"ExportDefaultSpecifier":return!1;case"JSXAttribute":return t.name!==e;case"ClassProperty":return t.key===e?t.computed:t.value===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ImportSpecifier":return!1;case"ClassDeclaration":case"ClassExpression":return t.id!==e;case"ClassMethod":case"ObjectMethod":return t.key===e&&t.computed;case"LabeledStatement":return!1;case"CatchClause":return t.param!==e;case"RestElement":return!1;case"AssignmentExpression":case"AssignmentPattern":return t.right===e;case"ObjectPattern":case"ArrayPattern":return!1}return!0},r.isValidIdentifier=function(e){return"string"==typeof e&&!l.default.keyword.isReservedWordES6(e,!0)&&"await"!==e&&l.default.keyword.isIdentifierNameES6(e)},r.isLet=function(e){return c.isVariableDeclaration(e)&&("var"!==e.kind||e[p.BLOCK_SCOPED_SYMBOL])},r.isBlockScoped=function(e){return c.isFunctionDeclaration(e)||c.isClassDeclaration(e)||c.isLet(e)},r.isVar=function(e){return c.isVariableDeclaration(e,{kind:"var"})&&!e[p.BLOCK_SCOPED_SYMBOL]},r.isSpecifierDefault=function(e){return c.isImportDefaultSpecifier(e)||c.isIdentifier(e.imported||e.exported,{name:"default"})},r.isScope=function(e,t){return(!c.isBlockStatement(e)||!c.isFunction(t,{body:e}))&&c.isScopable(e)},r.isImmutable=function(e){return!!c.isType(e.type,"Immutable")||!!c.isIdentifier(e)&&"undefined"===e.name},r.isNodesEquivalent=i;var u=e("./retrievers"),l=n(e("esutils")),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./index")),p=e("./constants")},{"./constants":167,"./index":178,"./retrievers":180,"babel-runtime/core-js/get-iterator":120,"babel-runtime/core-js/object/keys":127,"babel-runtime/helpers/typeof":138,esutils:185}],182:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],183:[function(e,t,r){arguments[4][26][0].apply(r,arguments)},{dup:26}],184:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{"./code":183,dup:27}],185:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{"./ast":182,"./code":183,"./keyword":184,dup:28}],186:[function(e,t,r){"use strict";function n(e){return e=e.split(" "),function(t){return e.indexOf(t)>=0}}function i(e,t){for(var r=65536,n=0;ne)return!1;if((r+=t[n+1])>=e)return!0}}function s(e){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&v.test(String.fromCharCode(e)):i(e,E)))}function a(e){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&x.test(String.fromCharCode(e)):i(e,E)||i(e,A))))}function o(e){var t={};for(var r in D)t[r]=e&&r in e?e[r]:D[r];return t}function u(e){return 10===e||13===e||8232===e||8233===e}function l(e,t){for(var r=1,n=0;;){N.lastIndex=n;var i=N.exec(e);if(!(i&&i.index>10),56320+(e-65536&1023))}function p(e,t,r,n){return e.type=t,e.end=r,e.loc.end=n,this.processComment(e),e}function h(e){return e[e.length-1]}function f(e){return e&&"Property"===e.type&&"init"===e.kind&&!1===e.method}function d(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?d(e.object)+"."+d(e.property):void 0}Object.defineProperty(r,"__esModule",{value:!0});var m={6:n("enum await"),strict:n("implements interface let package private protected public static yield"),strictBind:n("eval arguments")},y=n("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"),g="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿕ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞮꞰ-ꞷꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭥꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",b="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣔ-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",v=new RegExp("["+g+"]"),x=new RegExp("["+g+b+"]");g=b=null;var E=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,785,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,25,391,63,32,0,449,56,264,8,2,36,18,0,50,29,881,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,65,0,32,6124,20,754,9486,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,10591,541],A=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,10,2,4,9,83,11,7,0,161,11,6,9,7,3,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,87,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,423,9,838,7,2,7,17,9,57,21,2,13,19882,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239],D={sourceType:"script",sourceFilename:void 0,startLine:1,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,plugins:[],strictMode:null},C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},_=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},w=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},k=!0,F=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};S(this,e),this.label=t,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.rightAssociative=!!r.rightAssociative,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop||null,this.updateContext=null},T=function(e){function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return S(this,t),n.keyword=r,w(this,e.call(this,r,n))}return _(t,e),t}(F),P=function(e){function t(r,n){return S(this,t),w(this,e.call(this,r,{beforeExpr:k,binop:n}))}return _(t,e),t}(F),B={num:new F("num",{startsExpr:!0}),regexp:new F("regexp",{startsExpr:!0}),string:new F("string",{startsExpr:!0}),name:new F("name",{startsExpr:!0}),eof:new F("eof"),bracketL:new F("[",{beforeExpr:k,startsExpr:!0}),bracketR:new F("]"),braceL:new F("{",{beforeExpr:k,startsExpr:!0}),braceBarL:new F("{|",{beforeExpr:k,startsExpr:!0}),braceR:new F("}"),braceBarR:new F("|}"),parenL:new F("(",{beforeExpr:k,startsExpr:!0}),parenR:new F(")"),comma:new F(",",{beforeExpr:k}),semi:new F(";",{beforeExpr:k}),colon:new F(":",{beforeExpr:k}),doubleColon:new F("::",{beforeExpr:k}),dot:new F("."),question:new F("?",{beforeExpr:k}),arrow:new F("=>",{beforeExpr:k}),template:new F("template"),ellipsis:new F("...",{beforeExpr:k}),backQuote:new F("`",{startsExpr:!0}),dollarBraceL:new F("${",{beforeExpr:k,startsExpr:!0}),at:new F("@"),eq:new F("=",{beforeExpr:k,isAssign:!0}),assign:new F("_=",{beforeExpr:k,isAssign:!0}),incDec:new F("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new F("prefix",{beforeExpr:k,prefix:!0,startsExpr:!0}),logicalOR:new P("||",1),logicalAND:new P("&&",2),bitwiseOR:new P("|",3),bitwiseXOR:new P("^",4),bitwiseAND:new P("&",5),equality:new P("==/!=",6),relational:new P("",7),bitShift:new P("<>",8),plusMin:new F("+/-",{beforeExpr:k,binop:9,prefix:!0,startsExpr:!0}),modulo:new P("%",10),star:new P("*",10),slash:new P("/",10),exponent:new F("**",{beforeExpr:k,binop:11,rightAssociative:!0})},O={break:new T("break"),case:new T("case",{beforeExpr:k}),catch:new T("catch"),continue:new T("continue"),debugger:new T("debugger"),default:new T("default",{beforeExpr:k}),do:new T("do",{isLoop:!0,beforeExpr:k}),else:new T("else",{beforeExpr:k}),finally:new T("finally"),for:new T("for",{isLoop:!0}),function:new T("function",{startsExpr:!0}),if:new T("if"),return:new T("return",{beforeExpr:k}),switch:new T("switch"),throw:new T("throw",{beforeExpr:k}),try:new T("try"),var:new T("var"),let:new T("let"),const:new T("const"),while:new T("while",{isLoop:!0}),with:new T("with"),new:new T("new",{beforeExpr:k,startsExpr:!0}),this:new T("this",{startsExpr:!0}),super:new T("super",{startsExpr:!0}),class:new T("class"),extends:new T("extends",{beforeExpr:k}),export:new T("export"),import:new T("import",{startsExpr:!0}),yield:new T("yield",{beforeExpr:k,startsExpr:!0}),null:new T("null",{startsExpr:!0}),true:new T("true",{startsExpr:!0}),false:new T("false",{startsExpr:!0}),in:new T("in",{beforeExpr:k,binop:7}),instanceof:new T("instanceof",{beforeExpr:k,binop:7}),typeof:new T("typeof",{beforeExpr:k,prefix:!0,startsExpr:!0}),void:new T("void",{beforeExpr:k,prefix:!0,startsExpr:!0}),delete:new T("delete",{beforeExpr:k,prefix:!0,startsExpr:!0})};Object.keys(O).forEach(function(e){B["_"+e]=O[e]});var j=/\r\n?|\n|\u2028|\u2029/,N=new RegExp(j.source,"g"),I=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,L=function e(t,r,n,i){S(this,e),this.token=t,this.isExpr=!!r,this.preserveSpace=!!n,this.override=i},M={braceStatement:new L("{",!1),braceExpression:new L("{",!0),templateQuasi:new L("${",!0),parenStatement:new L("(",!1),parenExpression:new L("(",!0),template:new L("`",!0,!0,function(e){return e.readTmplToken()}),functionExpression:new L("function",!0)};B.parenR.updateContext=B.braceR.updateContext=function(){if(1!==this.state.context.length){var e=this.state.context.pop();e===M.braceStatement&&this.curContext()===M.functionExpression?(this.state.context.pop(),this.state.exprAllowed=!1):e===M.templateQuasi?this.state.exprAllowed=!0:this.state.exprAllowed=!e.isExpr}else this.state.exprAllowed=!0},B.name.updateContext=function(e){this.state.exprAllowed=!1,e!==B._let&&e!==B._const&&e!==B._var||j.test(this.input.slice(this.state.end))&&(this.state.exprAllowed=!0)},B.braceL.updateContext=function(e){this.state.context.push(this.braceIsBlock(e)?M.braceStatement:M.braceExpression),this.state.exprAllowed=!0},B.dollarBraceL.updateContext=function(){this.state.context.push(M.templateQuasi),this.state.exprAllowed=!0},B.parenL.updateContext=function(e){var t=e===B._if||e===B._for||e===B._with||e===B._while;this.state.context.push(t?M.parenStatement:M.parenExpression),this.state.exprAllowed=!0},B.incDec.updateContext=function(){},B._function.updateContext=function(){this.curContext()!==M.braceStatement&&this.state.context.push(M.functionExpression),this.state.exprAllowed=!1},B.backQuote.updateContext=function(){this.curContext()===M.template?this.state.context.pop():this.state.context.push(M.template),this.state.exprAllowed=!1};var R=function e(t,r){S(this,e),this.line=t,this.column=r},V=function e(t,r){S(this,e),this.start=t,this.end=r},U=function(){function e(){S(this,e)}return e.prototype.init=function(e,t){return this.strict=!1!==e.strictMode&&"module"===e.sourceType,this.input=t,this.potentialArrowAt=-1,this.inMethod=this.inFunction=this.inGenerator=this.inAsync=this.inPropertyName=this.inType=this.inClassProperty=this.noAnonFunctionType=!1,this.labels=[],this.decorators=[],this.tokens=[],this.comments=[],this.trailingComments=[],this.leadingComments=[],this.commentStack=[],this.pos=this.lineStart=0,this.curLine=e.startLine,this.type=B.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=[M.braceStatement],this.exprAllowed=!0,this.containsEsc=this.containsOctal=!1,this.octalPosition=null,this.invalidTemplateEscapePosition=null,this.exportedIdentifiers=[],this},e.prototype.curPosition=function(){return new R(this.curLine,this.pos-this.lineStart)},e.prototype.clone=function(t){var r=new e;for(var n in this){var i=this[n];t&&"context"!==n||!Array.isArray(i)||(i=i.slice()),r[n]=i}return r},e}(),q=function e(t){S(this,e),this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,this.loc=new V(t.startLoc,t.endLoc)},G={},X=["jsx","doExpressions","objectRestSpread","decorators","classProperties","exportExtensions","asyncGenerators","functionBind","functionSent","dynamicImport","flow"],W=function(e){function t(r,n){S(this,t),r=o(r);var i=w(this,e.call(this,r,n));return i.options=r,i.inModule="module"===i.options.sourceType,i.input=n,i.plugins=i.loadPlugins(i.options.plugins),i.filename=r.sourceFilename,0===i.state.pos&&"#"===i.input[0]&&"!"===i.input[1]&&i.skipLineComment(2),i}return _(t,e),t.prototype.isReservedWord=function(e){return"await"===e?this.inModule:m[6](e)},t.prototype.hasPlugin=function(e){return!!(this.plugins["*"]&&X.indexOf(e)>-1)||!!this.plugins[e]},t.prototype.extend=function(e,t){this[e]=t(this[e])},t.prototype.loadAllPlugins=function(){var e=this,t=Object.keys(G).filter(function(e){return"flow"!==e&&"estree"!==e});t.push("flow"),t.forEach(function(t){var r=G[t];r&&r(e)})},t.prototype.loadPlugins=function(e){if(e.indexOf("*")>=0)return this.loadAllPlugins(),{"*":!0};var t={};e.indexOf("flow")>=0&&(e=e.filter(function(e){return"flow"!==e})).push("flow"),e.indexOf("estree")>=0&&(e=e.filter(function(e){return"estree"!==e})).unshift("estree");for(var r=e,n=Array.isArray(r),i=0,r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;if(!t[a]){t[a]=!0;var o=G[a];o&&o(this)}}return t},t.prototype.parse=function(){var e=this.startNode(),t=this.startNode();return this.nextToken(),this.parseTopLevel(e,t)},t}(function(){function e(t,r){S(this,e),this.state=new U,this.state.init(t,r)}return e.prototype.next=function(){this.isLookahead||this.state.tokens.push(new q(this.state)),this.state.lastTokEnd=this.state.end,this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},e.prototype.eat=function(e){return!!this.match(e)&&(this.next(),!0)},e.prototype.match=function(e){return this.state.type===e},e.prototype.isKeyword=function(e){return y(e)},e.prototype.lookahead=function(){var e=this.state;this.state=e.clone(!0),this.isLookahead=!0,this.next(),this.isLookahead=!1;var t=this.state.clone(!0);return this.state=e,t},e.prototype.setStrict=function(e){if(this.state.strict=e,this.match(B.num)||this.match(B.string)){for(this.state.pos=this.state.start;this.state.pos=this.input.length?this.finishToken(B.eof):e.override?e.override(this):this.readToken(this.fullCharCodeAtPos())},e.prototype.readToken=function(e){return s(e)||92===e?this.readWord():this.getTokenFromCode(e)},e.prototype.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.state.pos);return e<=55295||e>=57344?e:(e<<10)+this.input.charCodeAt(this.state.pos+1)-56613888},e.prototype.pushComment=function(e,t,r,n,i,s){var a={type:e?"CommentBlock":"CommentLine",value:t,start:r,end:n,loc:new V(i,s)};this.isLookahead||(this.state.tokens.push(a),this.state.comments.push(a),this.addComment(a))},e.prototype.skipBlockComment=function(){var e=this.state.curPosition(),t=this.state.pos,r=this.input.indexOf("*/",this.state.pos+=2);-1===r&&this.raise(this.state.pos-2,"Unterminated comment"),this.state.pos=r+2,N.lastIndex=t;for(var n=void 0;(n=N.exec(this.input))&&n.index8&&e<14||e>=5760&&I.test(String.fromCharCode(e))))break e;++this.state.pos}}},e.prototype.finishToken=function(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var r=this.state.type;this.state.type=e,this.state.value=t,this.updateContext(r)},e.prototype.readToken_dot=function(){var e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.state.pos+2);return 46===e&&46===t?(this.state.pos+=3,this.finishToken(B.ellipsis)):(++this.state.pos,this.finishToken(B.dot))},e.prototype.readToken_slash=function(){return this.state.exprAllowed?(++this.state.pos,this.readRegexp()):61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(B.assign,2):this.finishOp(B.slash,1)},e.prototype.readToken_mult_modulo=function(e){var t=42===e?B.star:B.modulo,r=1,n=this.input.charCodeAt(this.state.pos+1);return 42===n&&(r++,n=this.input.charCodeAt(this.state.pos+2),t=B.exponent),61===n&&(r++,t=B.assign),this.finishOp(t,r)},e.prototype.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?this.finishOp(124===e?B.logicalOR:B.logicalAND,2):61===t?this.finishOp(B.assign,2):124===e&&125===t&&this.hasPlugin("flow")?this.finishOp(B.braceBarR,2):this.finishOp(124===e?B.bitwiseOR:B.bitwiseAND,1)},e.prototype.readToken_caret=function(){return 61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(B.assign,2):this.finishOp(B.bitwiseXOR,1)},e.prototype.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?45===t&&62===this.input.charCodeAt(this.state.pos+2)&&j.test(this.input.slice(this.state.lastTokEnd,this.state.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(B.incDec,2):61===t?this.finishOp(B.assign,2):this.finishOp(B.plusMin,1)},e.prototype.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.state.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.state.pos+2)?3:2,61===this.input.charCodeAt(this.state.pos+r)?this.finishOp(B.assign,r+1):this.finishOp(B.bitShift,r)):33===t&&60===e&&45===this.input.charCodeAt(this.state.pos+2)&&45===this.input.charCodeAt(this.state.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===t&&(r=2),this.finishOp(B.relational,r))},e.prototype.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.state.pos+1);return 61===t?this.finishOp(B.equality,61===this.input.charCodeAt(this.state.pos+2)?3:2):61===e&&62===t?(this.state.pos+=2,this.finishToken(B.arrow)):this.finishOp(61===e?B.eq:B.prefix,1)},e.prototype.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.state.pos,this.finishToken(B.parenL);case 41:return++this.state.pos,this.finishToken(B.parenR);case 59:return++this.state.pos,this.finishToken(B.semi);case 44:return++this.state.pos,this.finishToken(B.comma);case 91:return++this.state.pos,this.finishToken(B.bracketL);case 93:return++this.state.pos,this.finishToken(B.bracketR);case 123:return this.hasPlugin("flow")&&124===this.input.charCodeAt(this.state.pos+1)?this.finishOp(B.braceBarL,2):(++this.state.pos,this.finishToken(B.braceL));case 125:return++this.state.pos,this.finishToken(B.braceR);case 58:return this.hasPlugin("functionBind")&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(B.doubleColon,2):(++this.state.pos,this.finishToken(B.colon));case 63:return++this.state.pos,this.finishToken(B.question);case 64:return++this.state.pos,this.finishToken(B.at);case 96:return++this.state.pos,this.finishToken(B.backQuote);case 48:var t=this.input.charCodeAt(this.state.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(B.prefix,1)}this.raise(this.state.pos,"Unexpected character '"+c(e)+"'")},e.prototype.finishOp=function(e,t){var r=this.input.slice(this.state.pos,this.state.pos+t);return this.state.pos+=t,this.finishToken(e,r)},e.prototype.readRegexp=function(){for(var e=this.state.pos,t=void 0,r=void 0;;){this.state.pos>=this.input.length&&this.raise(e,"Unterminated regular expression");var n=this.input.charAt(this.state.pos);if(j.test(n)&&this.raise(e,"Unterminated regular expression"),t)t=!1;else{if("["===n)r=!0;else if("]"===n&&r)r=!1;else if("/"===n&&!r)break;t="\\"===n}++this.state.pos}var i=this.input.slice(e,this.state.pos);++this.state.pos;var s=this.readWord1();if(s){/^[gmsiyu]*$/.test(s)||this.raise(e,"Invalid regular expression flag")}return this.finishToken(B.regexp,{pattern:i,flags:s})},e.prototype.readInt=function(e,t){for(var r=this.state.pos,n=0,i=0,s=null==t?1/0:t;i=97?a-97+10:a>=65?a-65+10:a>=48&&a<=57?a-48:1/0)>=e)break;++this.state.pos,n=n*e+o}return this.state.pos===r||null!=t&&this.state.pos-r!==t?null:n},e.prototype.readRadixNumber=function(e){this.state.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.state.start+2,"Expected number in radix "+e),s(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number"),this.finishToken(B.num,t)},e.prototype.readNumber=function(e){var t=this.state.pos,r=48===this.input.charCodeAt(t),n=!1;e||null!==this.readInt(10)||this.raise(t,"Invalid number"),r&&this.state.pos==t+1&&(r=!1);var i=this.input.charCodeAt(this.state.pos);46!==i||r||(++this.state.pos,this.readInt(10),n=!0,i=this.input.charCodeAt(this.state.pos)),69!==i&&101!==i||r||(43!==(i=this.input.charCodeAt(++this.state.pos))&&45!==i||++this.state.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),n=!0),s(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number");var a=this.input.slice(t,this.state.pos),o=void 0;return n?o=parseFloat(a):r&&1!==a.length?this.state.strict?this.raise(t,"Invalid number"):o=/[89]/.test(a)?parseInt(a,10):parseInt(a,8):o=parseInt(a,10),this.finishToken(B.num,o)},e.prototype.readCodePoint=function(e){var t=void 0;if(123===this.input.charCodeAt(this.state.pos)){var r=++this.state.pos;if(t=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos,e),++this.state.pos,null===t)--this.state.invalidTemplateEscapePosition;else if(t>1114111){if(!e)return this.state.invalidTemplateEscapePosition=r-2,null;this.raise(r,"Code point out of bounds")}}else t=this.readHexChar(4,e);return t},e.prototype.readString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;92===n?(t+=this.input.slice(r,this.state.pos),t+=this.readEscapedChar(!1),r=this.state.pos):(u(n)&&this.raise(this.state.start,"Unterminated string constant"),++this.state.pos)}return t+=this.input.slice(r,this.state.pos++),this.finishToken(B.string,t)},e.prototype.readTmplToken=function(){for(var e="",t=this.state.pos,r=!1;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated template");var n=this.input.charCodeAt(this.state.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.state.pos+1))return this.state.pos===this.state.start&&this.match(B.template)?36===n?(this.state.pos+=2,this.finishToken(B.dollarBraceL)):(++this.state.pos,this.finishToken(B.backQuote)):(e+=this.input.slice(t,this.state.pos),this.finishToken(B.template,r?null:e));if(92===n){e+=this.input.slice(t,this.state.pos);var i=this.readEscapedChar(!0);null===i?r=!0:e+=i,t=this.state.pos}else if(u(n)){switch(e+=this.input.slice(t,this.state.pos),++this.state.pos,n){case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(n)}++this.state.curLine,this.state.lineStart=this.state.pos,t=this.state.pos}else++this.state.pos}},e.prototype.readEscapedChar=function(e){var t=!e,r=this.input.charCodeAt(++this.state.pos);switch(++this.state.pos,r){case 110:return"\n";case 114:return"\r";case 120:var n=this.readHexChar(2,t);return null===n?null:String.fromCharCode(n);case 117:var i=this.readCodePoint(t);return null===i?null:c(i);case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:return this.state.lineStart=this.state.pos,++this.state.curLine,"";default:if(r>=48&&r<=55){var s=this.state.pos-1,a=this.input.substr(this.state.pos-1,3).match(/^[0-7]+/)[0],o=parseInt(a,8);if(o>255&&(a=a.slice(0,-1),o=parseInt(a,8)),o>0){if(e)return this.state.invalidTemplateEscapePosition=s,null;this.state.strict?this.raise(s,"Octal literal in strict mode"):this.state.containsOctal||(this.state.containsOctal=!0,this.state.octalPosition=s)}return this.state.pos+=a.length-1,String.fromCharCode(o)}return String.fromCharCode(r)}},e.prototype.readHexChar=function(e,t){var r=this.state.pos,n=this.readInt(16,e);return null===n&&(t?this.raise(r,"Bad character escape sequence"):(this.state.pos=r-1,this.state.invalidTemplateEscapePosition=r-1)),n},e.prototype.readWord1=function(){this.state.containsEsc=!1;for(var e="",t=!0,r=this.state.pos;this.state.pos1&&void 0!==arguments[1]?arguments[1]:"Unexpected token";t&&"object"===(void 0===t?"undefined":C(t))&&t.label&&(t="Unexpected token, expected "+t.label),this.raise(null!=e?e:this.state.start,t)};var K=W.prototype;K.parseTopLevel=function(e,t){return t.sourceType=this.options.sourceType,this.parseBlockBody(t,!0,!0,B.eof),e.program=this.finishNode(t,"Program"),e.comments=this.state.comments,e.tokens=this.state.tokens,this.finishNode(e,"File")};var z={kind:"loop"},Y={kind:"switch"};K.stmtToDirective=function(e){var t=e.expression,r=this.startNodeAt(t.start,t.loc.start),n=this.startNodeAt(e.start,e.loc.start),i=this.input.slice(t.start,t.end),s=r.value=i.slice(1,-1);return this.addExtra(r,"raw",i),this.addExtra(r,"rawValue",s),n.value=this.finishNodeAt(r,"DirectiveLiteral",t.end,t.loc.end),this.finishNodeAt(n,"Directive",e.end,e.loc.end)},K.parseStatement=function(e,t){this.match(B.at)&&this.parseDecorators(!0);var r=this.state.type,n=this.startNode();switch(r){case B._break:case B._continue:return this.parseBreakContinueStatement(n,r.keyword);case B._debugger:return this.parseDebuggerStatement(n);case B._do:return this.parseDoStatement(n);case B._for:return this.parseForStatement(n);case B._function:return e||this.unexpected(),this.parseFunctionStatement(n);case B._class:return e||this.unexpected(),this.parseClass(n,!0);case B._if:return this.parseIfStatement(n);case B._return:return this.parseReturnStatement(n);case B._switch:return this.parseSwitchStatement(n);case B._throw:return this.parseThrowStatement(n);case B._try:return this.parseTryStatement(n);case B._let:case B._const:e||this.unexpected();case B._var:return this.parseVarStatement(n,r);case B._while:return this.parseWhileStatement(n);case B._with:return this.parseWithStatement(n);case B.braceL:return this.parseBlock();case B.semi:return this.parseEmptyStatement(n);case B._export:case B._import:if(this.hasPlugin("dynamicImport")&&this.lookahead().type===B.parenL)break;return this.options.allowImportExportEverywhere||(t||this.raise(this.state.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.state.start,"'import' and 'export' may appear only with 'sourceType: \"module\"'")),r===B._import?this.parseImport(n):this.parseExport(n);case B.name:if("async"===this.state.value){var i=this.state.clone();if(this.next(),this.match(B._function)&&!this.canInsertSemicolon())return this.expect(B._function),this.parseFunction(n,!0,!1,!0);this.state=i}}var s=this.state.value,a=this.parseExpression();return r===B.name&&"Identifier"===a.type&&this.eat(B.colon)?this.parseLabeledStatement(n,s,a):this.parseExpressionStatement(n,a)},K.takeDecorators=function(e){this.state.decorators.length&&(e.decorators=this.state.decorators,this.state.decorators=[])},K.parseDecorators=function(e){for(;this.match(B.at);){var t=this.parseDecorator();this.state.decorators.push(t)}e&&this.match(B._export)||this.match(B._class)||this.raise(this.state.start,"Leading decorators must be attached to a class declaration")},K.parseDecorator=function(){this.hasPlugin("decorators")||this.unexpected();var e=this.startNode();return this.next(),e.expression=this.parseMaybeAssign(),this.finishNode(e,"Decorator")},K.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.isLineTerminator()?e.label=null:this.match(B.name)?(e.label=this.parseIdentifier(),this.semicolon()):this.unexpected();var n=void 0;for(n=0;n=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}a.name===t&&this.raise(r.start,"Label '"+t+"' is already declared")}for(var o=this.state.type.isLoop?"loop":this.match(B._switch)?"switch":null,u=this.state.labels.length-1;u>=0;u--){var l=this.state.labels[u];if(l.statementStart!==e.start)break;l.statementStart=this.state.start,l.kind=o}return this.state.labels.push({name:t,kind:o,statementStart:this.state.start}),e.body=this.parseStatement(!0),this.state.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},K.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},K.parseBlock=function(e){var t=this.startNode();return this.expect(B.braceL),this.parseBlockBody(t,e,!1,B.braceR),this.finishNode(t,"BlockStatement")},K.isValidDirective=function(e){return"ExpressionStatement"===e.type&&"StringLiteral"===e.expression.type&&!e.expression.extra.parenthesized},K.parseBlockBody=function(e,t,r,n){e.body=[],e.directives=[];for(var i=!1,s=void 0,a=void 0;!this.eat(n);){i||!this.state.containsOctal||a||(a=this.state.octalPosition);var o=this.parseStatement(!0,r);if(t&&!i&&this.isValidDirective(o)){var u=this.stmtToDirective(o);e.directives.push(u),void 0===s&&"use strict"===u.value.value&&(s=this.state.strict,this.setStrict(!0),a&&this.raise(a,"Octal literal in strict mode"))}else i=!0,e.body.push(o)}!1===s&&this.setStrict(!1)},K.parseFor=function(e,t){return e.init=t,this.expect(B.semi),e.test=this.match(B.semi)?null:this.parseExpression(),this.expect(B.semi),e.update=this.match(B.parenR)?null:this.parseExpression(),this.expect(B.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"ForStatement")},K.parseForIn=function(e,t,r){var n=void 0;return r?(this.eatContextual("of"),n="ForAwaitStatement"):(n=this.match(B._in)?"ForInStatement":"ForOfStatement",this.next()),e.left=t,e.right=this.parseExpression(),this.expect(B.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,n)},K.parseVar=function(e,t,r){for(e.declarations=[],e.kind=r.keyword;;){var n=this.startNode();if(this.parseVarHead(n),this.eat(B.eq)?n.init=this.parseMaybeAssign(t):r!==B._const||this.match(B._in)||this.isContextual("of")?"Identifier"===n.id.type||t&&(this.match(B._in)||this.isContextual("of"))?n.init=null:this.raise(this.state.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(B.comma))break}return e},K.parseVarHead=function(e){e.id=this.parseBindingAtom(),this.checkLVal(e.id,!0,void 0,"variable declaration")},K.parseFunction=function(e,t,r,n,i){var s=this.state.inMethod;return this.state.inMethod=!1,this.initFunction(e,n),this.match(B.star)&&(e.async&&!this.hasPlugin("asyncGenerators")?this.unexpected():(e.generator=!0,this.next())),!t||i||this.match(B.name)||this.match(B._yield)||this.unexpected(),(this.match(B.name)||this.match(B._yield))&&(e.id=this.parseBindingIdentifier()),this.parseFunctionParams(e),this.parseFunctionBody(e,r),this.state.inMethod=s,this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},K.parseFunctionParams=function(e){this.expect(B.parenL),e.params=this.parseBindingList(B.parenR)},K.parseClass=function(e,t,r){return this.next(),this.takeDecorators(e),this.parseClassId(e,t,r),this.parseClassSuper(e),this.parseClassBody(e),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},K.isClassProperty=function(){return this.match(B.eq)||this.match(B.semi)||this.match(B.braceR)},K.isClassMethod=function(){return this.match(B.parenL)},K.isNonstaticConstructor=function(e){return!(e.computed||e.static||"constructor"!==e.key.name&&"constructor"!==e.key.value)},K.parseClassBody=function(e){var t=this.state.strict;this.state.strict=!0;var r=!1,n=!1,i=[],s=this.startNode();for(s.body=[],this.expect(B.braceL);!this.eat(B.braceR);)if(this.eat(B.semi))i.length>0&&this.raise(this.state.lastTokEnd,"Decorators must not be followed by a semicolon");else if(this.match(B.at))i.push(this.parseDecorator());else{var a=this.startNode();if(i.length&&(a.decorators=i,i=[]),a.static=!1,this.match(B.name)&&"static"===this.state.value){var o=this.parseIdentifier(!0);if(this.isClassMethod()){a.kind="method",a.computed=!1,a.key=o,this.parseClassMethod(s,a,!1,!1);continue}if(this.isClassProperty()){a.computed=!1,a.key=o,s.body.push(this.parseClassProperty(a));continue}a.static=!0}if(this.eat(B.star))a.kind="method",this.parsePropertyName(a),this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Constructor can't be a generator"),a.computed||!a.static||"prototype"!==a.key.name&&"prototype"!==a.key.value||this.raise(a.key.start,"Classes may not have static property named prototype"),this.parseClassMethod(s,a,!0,!1);else{var u=this.match(B.name),l=this.parsePropertyName(a);if(a.computed||!a.static||"prototype"!==a.key.name&&"prototype"!==a.key.value||this.raise(a.key.start,"Classes may not have static property named prototype"),this.isClassMethod())this.isNonstaticConstructor(a)?(n?this.raise(l.start,"Duplicate constructor in the same class"):a.decorators&&this.raise(a.start,"You can't attach decorators to a class constructor"),n=!0,a.kind="constructor"):a.kind="method",this.parseClassMethod(s,a,!1,!1);else if(this.isClassProperty())this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Classes may not have a non-static field named 'constructor'"),s.body.push(this.parseClassProperty(a));else if(u&&"async"===l.name&&!this.isLineTerminator()){var c=this.hasPlugin("asyncGenerators")&&this.eat(B.star);a.kind="method",this.parsePropertyName(a),this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Constructor can't be an async function"),this.parseClassMethod(s,a,c,!0)}else!u||"get"!==l.name&&"set"!==l.name||this.isLineTerminator()&&this.match(B.star)?this.hasPlugin("classConstructorCall")&&u&&"call"===l.name&&this.match(B.name)&&"constructor"===this.state.value?(r?this.raise(a.start,"Duplicate constructor call in the same class"):a.decorators&&this.raise(a.start,"You can't attach decorators to a class constructor"),r=!0,a.kind="constructorCall",this.parsePropertyName(a),this.parseClassMethod(s,a,!1,!1)):this.isLineTerminator()?(this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Classes may not have a non-static field named 'constructor'"),s.body.push(this.parseClassProperty(a))):this.unexpected():(a.kind=l.name,this.parsePropertyName(a),this.isNonstaticConstructor(a)&&this.raise(a.key.start,"Constructor can't have get/set modifier"),this.parseClassMethod(s,a,!1,!1),this.checkGetterSetterParamCount(a))}}i.length&&this.raise(this.state.start,"You have trailing decorators with no method"),e.body=this.finishNode(s,"ClassBody"),this.state.strict=t},K.parseClassProperty=function(e){return this.state.inClassProperty=!0,this.match(B.eq)?(this.hasPlugin("classProperties")||this.unexpected(),this.next(),e.value=this.parseMaybeAssign()):e.value=null,this.semicolon(),this.state.inClassProperty=!1,this.finishNode(e,"ClassProperty")},K.parseClassMethod=function(e,t,r,n){this.parseMethod(t,r,n),e.body.push(this.finishNode(t,"ClassMethod"))},K.parseClassId=function(e,t,r){this.match(B.name)?e.id=this.parseIdentifier():r||!t?e.id=null:this.unexpected()},K.parseClassSuper=function(e){e.superClass=this.eat(B._extends)?this.parseExprSubscripts():null},K.parseExport=function(e){if(this.next(),this.match(B.star)){var t=this.startNode();if(this.next(),!this.hasPlugin("exportExtensions")||!this.eatContextual("as"))return this.parseExportFrom(e,!0),this.finishNode(e,"ExportAllDeclaration");t.exported=this.parseIdentifier(),e.specifiers=[this.finishNode(t,"ExportNamespaceSpecifier")],this.parseExportSpecifiersMaybe(e),this.parseExportFrom(e,!0)}else if(this.hasPlugin("exportExtensions")&&this.isExportDefaultSpecifier()){var r=this.startNode();if(r.exported=this.parseIdentifier(!0),e.specifiers=[this.finishNode(r,"ExportDefaultSpecifier")],this.match(B.comma)&&this.lookahead().type===B.star){this.expect(B.comma);var n=this.startNode();this.expect(B.star),this.expectContextual("as"),n.exported=this.parseIdentifier(),e.specifiers.push(this.finishNode(n,"ExportNamespaceSpecifier"))}else this.parseExportSpecifiersMaybe(e);this.parseExportFrom(e,!0)}else{if(this.eat(B._default)){var i=this.startNode(),s=!1;return this.eat(B._function)?i=this.parseFunction(i,!0,!1,!1,!0):this.match(B._class)?i=this.parseClass(i,!0,!0):(s=!0,i=this.parseMaybeAssign()),e.declaration=i,s&&this.semicolon(),this.checkExport(e,!0,!0),this.finishNode(e,"ExportDefaultDeclaration")}this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,e.declaration=this.parseExportDeclaration(e)):(e.declaration=null,e.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(e))}return this.checkExport(e,!0),this.finishNode(e,"ExportNamedDeclaration")},K.parseExportDeclaration=function(){return this.parseStatement(!0)},K.isExportDefaultSpecifier=function(){if(this.match(B.name))return"async"!==this.state.value;if(!this.match(B._default))return!1;var e=this.lookahead();return e.type===B.comma||e.type===B.name&&"from"===e.value},K.parseExportSpecifiersMaybe=function(e){this.eat(B.comma)&&(e.specifiers=e.specifiers.concat(this.parseExportSpecifiers()))},K.parseExportFrom=function(e,t){this.eatContextual("from")?(e.source=this.match(B.string)?this.parseExprAtom():this.unexpected(),this.checkExport(e)):t?this.unexpected():e.source=null,this.semicolon()},K.shouldParseExportDeclaration=function(){return"var"===this.state.type.keyword||"const"===this.state.type.keyword||"let"===this.state.type.keyword||"function"===this.state.type.keyword||"class"===this.state.type.keyword||this.isContextual("async")},K.checkExport=function(e,t,r){if(t)if(r)this.checkDuplicateExports(e,"default");else if(e.specifiers&&e.specifiers.length)for(var n=e.specifiers,i=Array.isArray(n),s=0,n=i?n:n[Symbol.iterator]();;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a;this.checkDuplicateExports(o,o.exported.name)}else if(e.declaration)if("FunctionDeclaration"===e.declaration.type||"ClassDeclaration"===e.declaration.type)this.checkDuplicateExports(e,e.declaration.id.name);else if("VariableDeclaration"===e.declaration.type)for(var u=e.declaration.declarations,l=Array.isArray(u),c=0,u=l?u:u[Symbol.iterator]();;){var p;if(l){if(c>=u.length)break;p=u[c++]}else{if((c=u.next()).done)break;p=c.value}var h=p;this.checkDeclaration(h.id)}if(this.state.decorators.length){var f=e.declaration&&("ClassDeclaration"===e.declaration.type||"ClassExpression"===e.declaration.type);e.declaration&&f||this.raise(e.start,"You can only use decorators on an export when exporting a class"),this.takeDecorators(e.declaration)}},K.checkDeclaration=function(e){if("ObjectPattern"===e.type)for(var t=e.properties,r=Array.isArray(t),n=0,t=r?t:t[Symbol.iterator]();;){var i;if(r){if(n>=t.length)break;i=t[n++]}else{if((n=t.next()).done)break;i=n.value}var s=i;this.checkDeclaration(s)}else if("ArrayPattern"===e.type)for(var a=e.elements,o=Array.isArray(a),u=0,a=o?a:a[Symbol.iterator]();;){var l;if(o){if(u>=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l;c&&this.checkDeclaration(c)}else"ObjectProperty"===e.type?this.checkDeclaration(e.value):"RestElement"===e.type||"RestProperty"===e.type?this.checkDeclaration(e.argument):"Identifier"===e.type&&this.checkDuplicateExports(e,e.name)},K.checkDuplicateExports=function(e,t){this.state.exportedIdentifiers.indexOf(t)>-1&&this.raiseDuplicateExportError(e,t),this.state.exportedIdentifiers.push(t)},K.raiseDuplicateExportError=function(e,t){this.raise(e.start,"default"===t?"Only one default export allowed per module.":"`"+t+"` has already been exported. Exported identifiers must be unique.")},K.parseExportSpecifiers=function(){var e=[],t=!0,r=void 0;for(this.expect(B.braceL);!this.eat(B.braceR);){if(t)t=!1;else if(this.expect(B.comma),this.eat(B.braceR))break;var n=this.match(B._default);n&&!r&&(r=!0);var i=this.startNode();i.local=this.parseIdentifier(n),i.exported=this.eatContextual("as")?this.parseIdentifier(!0):i.local.__clone(),e.push(this.finishNode(i,"ExportSpecifier"))}return r&&!this.isContextual("from")&&this.unexpected(),e},K.parseImport=function(e){return this.eat(B._import),this.match(B.string)?(e.specifiers=[],e.source=this.parseExprAtom()):(e.specifiers=[],this.parseImportSpecifiers(e),this.expectContextual("from"),e.source=this.match(B.string)?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},K.parseImportSpecifiers=function(e){var t=!0;if(this.match(B.name)){var r=this.state.start,n=this.state.startLoc;if(e.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(),r,n)),!this.eat(B.comma))return}if(this.match(B.star)){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdentifier(),this.checkLVal(i.local,!0,void 0,"import namespace specifier"),void e.specifiers.push(this.finishNode(i,"ImportNamespaceSpecifier"))}for(this.expect(B.braceL);!this.eat(B.braceR);){if(t)t=!1;else if(this.eat(B.colon)&&this.unexpected(null,"ES2015 named imports do not destructure. Use another statement for destructuring after the import."),this.expect(B.comma),this.eat(B.braceR))break;this.parseImportSpecifier(e)}},K.parseImportSpecifier=function(e){var t=this.startNode();t.imported=this.parseIdentifier(!0),this.eatContextual("as")?t.local=this.parseIdentifier():(this.checkReservedWord(t.imported.name,t.start,!0,!0),t.local=t.imported.__clone()),this.checkLVal(t.local,!0,void 0,"import specifier"),e.specifiers.push(this.finishNode(t,"ImportSpecifier"))},K.parseImportSpecifierDefault=function(e,t,r){var n=this.startNodeAt(t,r);return n.local=e,this.checkLVal(n.local,!0,void 0,"default import specifier"),this.finishNode(n,"ImportDefaultSpecifier")};var $=W.prototype;$.toAssignable=function(e,t,r){if(e)switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var n=e.properties,i=Array.isArray(n),s=0,n=i?n:n[Symbol.iterator]();;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if((s=n.next()).done)break;a=s.value}var o=a;"ObjectMethod"===o.type?"get"===o.kind||"set"===o.kind?this.raise(o.key.start,"Object pattern can't contain getter or setter"):this.raise(o.key.start,"Object pattern can't contain methods"):this.toAssignable(o,t,"object destructuring pattern")}break;case"ObjectProperty":this.toAssignable(e.value,t,r);break;case"SpreadProperty":e.type="RestProperty";var u=e.argument;this.toAssignable(u,t,r);break;case"ArrayExpression":e.type="ArrayPattern",this.toAssignableList(e.elements,t,r);break;case"AssignmentExpression":"="===e.operator?(e.type="AssignmentPattern",delete e.operator):this.raise(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!t)break;default:var l="Invalid left-hand side"+(r?" in "+r:"expression");this.raise(e.start,l)}return e},$.toAssignableList=function(e,t,r){var n=e.length;if(n){var i=e[n-1];if(i&&"RestElement"===i.type)--n;else if(i&&"SpreadElement"===i.type){i.type="RestElement";var s=i.argument;this.toAssignable(s,t,r),"Identifier"!==s.type&&"MemberExpression"!==s.type&&"ArrayPattern"!==s.type&&this.unexpected(s.start),--n}}for(var a=0;a=s.length)break;u=s[o++]}else{if((o=s.next()).done)break;u=o.value}var l=u;"ObjectProperty"===l.type&&(l=l.value),this.checkLVal(l,t,r,"object destructuring pattern")}break;case"ArrayPattern":for(var c=e.elements,p=Array.isArray(c),h=0,c=p?c:c[Symbol.iterator]();;){var f;if(p){if(h>=c.length)break;f=c[h++]}else{if((h=c.next()).done)break;f=h.value}var d=f;d&&this.checkLVal(d,t,r,"array destructuring pattern")}break;case"AssignmentPattern":this.checkLVal(e.left,t,r,"assignment pattern");break;case"RestProperty":this.checkLVal(e.argument,t,r,"rest property");break;case"RestElement":this.checkLVal(e.argument,t,r,"rest element");break;default:var m=(t?"Binding invalid":"Invalid")+" left-hand side"+(n?" in "+n:"expression");this.raise(e.start,m)}};var Q=W.prototype;Q.checkPropClash=function(e,t){if(!e.computed&&!e.kind){var r=e.key;"__proto__"===("Identifier"===r.type?r.name:String(r.value))&&(t.proto&&this.raise(r.start,"Redefinition of __proto__ property"),t.proto=!0)}},Q.getExpression=function(){this.nextToken();var e=this.parseExpression();return this.match(B.eof)||this.unexpected(),e},Q.parseExpression=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeAssign(e,t);if(this.match(B.comma)){var s=this.startNodeAt(r,n);for(s.expressions=[i];this.eat(B.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.toReferencedList(s.expressions),this.finishNode(s,"SequenceExpression")}return i},Q.parseMaybeAssign=function(e,t,r,n){var i=this.state.start,s=this.state.startLoc;if(this.match(B._yield)&&this.state.inGenerator){var a=this.parseYield();return r&&(a=r.call(this,a,i,s)),a}var o=void 0;t?o=!1:(t={start:0},o=!0),(this.match(B.parenL)||this.match(B.name))&&(this.state.potentialArrowAt=this.state.start);var u=this.parseMaybeConditional(e,t,n);if(r&&(u=r.call(this,u,i,s)),this.state.type.isAssign){var l=this.startNodeAt(i,s);if(l.operator=this.state.value,l.left=this.match(B.eq)?this.toAssignable(u,void 0,"assignment expression"):u,t.start=0,this.checkLVal(u,void 0,void 0,"assignment expression"),u.extra&&u.extra.parenthesized){var c=void 0;"ObjectPattern"===u.type?c="`({a}) = 0` use `({a} = 0)`":"ArrayPattern"===u.type&&(c="`([a]) = 0` use `([a] = 0)`"),c&&this.raise(u.start,"You're trying to assign to a parenthesized expression, eg. instead of "+c)}return this.next(),l.right=this.parseMaybeAssign(e),this.finishNode(l,"AssignmentExpression")}return o&&t.start&&this.unexpected(t.start),u},Q.parseMaybeConditional=function(e,t,r){var n=this.state.start,i=this.state.startLoc,s=this.parseExprOps(e,t);return t&&t.start?s:this.parseConditional(s,e,n,i,r)},Q.parseConditional=function(e,t,r,n){if(this.eat(B.question)){var i=this.startNodeAt(r,n);return i.test=e,i.consequent=this.parseMaybeAssign(),this.expect(B.colon),i.alternate=this.parseMaybeAssign(t),this.finishNode(i,"ConditionalExpression")}return e},Q.parseExprOps=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeUnary(t);return t&&t.start?i:this.parseExprOp(i,r,n,-1,e)},Q.parseExprOp=function(e,t,r,n,i){var s=this.state.type.binop;if(!(null==s||i&&this.match(B._in))&&s>n){var a=this.startNodeAt(t,r);a.left=e,a.operator=this.state.value,"**"!==a.operator||"UnaryExpression"!==e.type||!e.extra||e.extra.parenthesizedArgument||e.extra.parenthesized||this.raise(e.argument.start,"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");var o=this.state.type;this.next();var u=this.state.start,l=this.state.startLoc;return a.right=this.parseExprOp(this.parseMaybeUnary(),u,l,o.rightAssociative?s-1:s,i),this.finishNode(a,o===B.logicalOR||o===B.logicalAND?"LogicalExpression":"BinaryExpression"),this.parseExprOp(a,t,r,n,i)}return e},Q.parseMaybeUnary=function(e){if(this.state.type.prefix){var t=this.startNode(),r=this.match(B.incDec);t.operator=this.state.value,t.prefix=!0,this.next();var n=this.state.type;return t.argument=this.parseMaybeUnary(),this.addExtra(t,"parenthesizedArgument",!(n!==B.parenL||t.argument.extra&&t.argument.extra.parenthesized)),e&&e.start&&this.unexpected(e.start),r?this.checkLVal(t.argument,void 0,void 0,"prefix operation"):this.state.strict&&"delete"===t.operator&&"Identifier"===t.argument.type&&this.raise(t.start,"Deleting local variable in strict mode"),this.finishNode(t,r?"UpdateExpression":"UnaryExpression")}var i=this.state.start,s=this.state.startLoc,a=this.parseExprSubscripts(e);if(e&&e.start)return a;for(;this.state.type.postfix&&!this.canInsertSemicolon();){var o=this.startNodeAt(i,s);o.operator=this.state.value,o.prefix=!1,o.argument=a,this.checkLVal(a,void 0,void 0,"postfix operation"),this.next(),a=this.finishNode(o,"UpdateExpression")}return a},Q.parseExprSubscripts=function(e){var t=this.state.start,r=this.state.startLoc,n=this.state.potentialArrowAt,i=this.parseExprAtom(e);return"ArrowFunctionExpression"===i.type&&i.start===n?i:e&&e.start?i:this.parseSubscripts(i,t,r)},Q.parseSubscripts=function(e,t,r,n){for(;;){if(!n&&this.eat(B.doubleColon)){var i=this.startNodeAt(t,r);return i.object=e,i.callee=this.parseNoCallExpr(),this.parseSubscripts(this.finishNode(i,"BindExpression"),t,r,n)}if(this.eat(B.dot)){var s=this.startNodeAt(t,r);s.object=e,s.property=this.parseIdentifier(!0),s.computed=!1,e=this.finishNode(s,"MemberExpression")}else if(this.eat(B.bracketL)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseExpression(),a.computed=!0,this.expect(B.bracketR),e=this.finishNode(a,"MemberExpression")}else if(!n&&this.match(B.parenL)){var o=this.state.potentialArrowAt===e.start&&"Identifier"===e.type&&"async"===e.name&&!this.canInsertSemicolon();this.next();var u=this.startNodeAt(t,r);if(u.callee=e,u.arguments=this.parseCallExpressionArguments(B.parenR,o),"Import"===u.callee.type&&1!==u.arguments.length&&this.raise(u.start,"import() requires exactly one argument"),e=this.finishNode(u,"CallExpression"),o&&this.shouldParseAsyncArrow())return this.parseAsyncArrowFromCallExpression(this.startNodeAt(t,r),u);this.toReferencedList(u.arguments)}else{if(!this.match(B.backQuote))return e;var l=this.startNodeAt(t,r);l.tag=e,l.quasi=this.parseTemplate(!0),e=this.finishNode(l,"TaggedTemplateExpression")}}},Q.parseCallExpressionArguments=function(e,t){for(var r=[],n=void 0,i=!0;!this.eat(e);){if(i)i=!1;else if(this.expect(B.comma),this.eat(e))break;this.match(B.parenL)&&!n&&(n=this.state.start),r.push(this.parseExprListItem(!1,t?{start:0}:void 0,t?{start:0}:void 0))}return t&&n&&this.shouldParseAsyncArrow()&&this.unexpected(),r},Q.shouldParseAsyncArrow=function(){return this.match(B.arrow)},Q.parseAsyncArrowFromCallExpression=function(e,t){return this.expect(B.arrow),this.parseArrowExpression(e,t.arguments,!0)},Q.parseNoCallExpr=function(){var e=this.state.start,t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,t,!0)},Q.parseExprAtom=function(e){var t=this.state.potentialArrowAt===this.state.start,r=void 0;switch(this.state.type){case B._super:return this.state.inMethod||this.state.inClassProperty||this.options.allowSuperOutsideMethod||this.raise(this.state.start,"'super' outside of function or class"),r=this.startNode(),this.next(),this.match(B.parenL)||this.match(B.bracketL)||this.match(B.dot)||this.unexpected(),this.match(B.parenL)&&"constructor"!==this.state.inMethod&&!this.options.allowSuperOutsideMethod&&this.raise(r.start,"super() outside of class constructor"),this.finishNode(r,"Super");case B._import:return this.hasPlugin("dynamicImport")||this.unexpected(),r=this.startNode(),this.next(),this.match(B.parenL)||this.unexpected(null,B.parenL),this.finishNode(r,"Import");case B._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case B._yield:this.state.inGenerator&&this.unexpected();case B.name:r=this.startNode();var n="await"===this.state.value&&this.state.inAsync,i=this.shouldAllowYieldIdentifier(),s=this.parseIdentifier(n||i);if("await"===s.name){if(this.state.inAsync||this.inModule)return this.parseAwait(r)}else{if("async"===s.name&&this.match(B._function)&&!this.canInsertSemicolon())return this.next(),this.parseFunction(r,!1,!1,!0);if(t&&"async"===s.name&&this.match(B.name)){var a=[this.parseIdentifier()];return this.expect(B.arrow),this.parseArrowExpression(r,a,!0)}}return t&&!this.canInsertSemicolon()&&this.eat(B.arrow)?this.parseArrowExpression(r,[s]):s;case B._do:if(this.hasPlugin("doExpressions")){var o=this.startNode();this.next();var u=this.state.inFunction,l=this.state.labels;return this.state.labels=[],this.state.inFunction=!1,o.body=this.parseBlock(!1,!0),this.state.inFunction=u,this.state.labels=l,this.finishNode(o,"DoExpression")}case B.regexp:var c=this.state.value;return r=this.parseLiteral(c.value,"RegExpLiteral"),r.pattern=c.pattern,r.flags=c.flags,r;case B.num:return this.parseLiteral(this.state.value,"NumericLiteral");case B.string:return this.parseLiteral(this.state.value,"StringLiteral");case B._null:return r=this.startNode(),this.next(),this.finishNode(r,"NullLiteral");case B._true:case B._false:return r=this.startNode(),r.value=this.match(B._true),this.next(),this.finishNode(r,"BooleanLiteral");case B.parenL:return this.parseParenAndDistinguishExpression(null,null,t);case B.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(B.bracketR,!0,e),this.toReferencedList(r.elements),this.finishNode(r,"ArrayExpression");case B.braceL:return this.parseObj(!1,e);case B._function:return this.parseFunctionExpression();case B.at:this.parseDecorators();case B._class:return r=this.startNode(),this.takeDecorators(r),this.parseClass(r,!1);case B._new:return this.parseNew();case B.backQuote:return this.parseTemplate(!1);case B.doubleColon:r=this.startNode(),this.next(),r.object=null;var p=r.callee=this.parseNoCallExpr();if("MemberExpression"===p.type)return this.finishNode(r,"BindExpression");this.raise(p.start,"Binding should be performed on object property.");default:this.unexpected()}},Q.parseFunctionExpression=function(){var e=this.startNode(),t=this.parseIdentifier(!0);return this.state.inGenerator&&this.eat(B.dot)&&this.hasPlugin("functionSent")?this.parseMetaProperty(e,t,"sent"):this.parseFunction(e,!1)},Q.parseMetaProperty=function(e,t,r){return e.meta=t,e.property=this.parseIdentifier(!0),e.property.name!==r&&this.raise(e.property.start,"The only valid meta property for new is "+t.name+"."+r),this.finishNode(e,"MetaProperty")},Q.parseLiteral=function(e,t,r,n){r=r||this.state.start,n=n||this.state.startLoc;var i=this.startNodeAt(r,n);return this.addExtra(i,"rawValue",e),this.addExtra(i,"raw",this.input.slice(r,this.state.end)),i.value=e,this.next(),this.finishNode(i,t)},Q.parseParenExpression=function(){this.expect(B.parenL);var e=this.parseExpression();return this.expect(B.parenR),e},Q.parseParenAndDistinguishExpression=function(e,t,r){e=e||this.state.start,t=t||this.state.startLoc;var n=void 0;this.expect(B.parenL);for(var i=this.state.start,s=this.state.startLoc,a=[],o={start:0},u={start:0},l=!0,c=void 0,p=void 0;!this.match(B.parenR);){if(l)l=!1;else if(this.expect(B.comma,u.start||null),this.match(B.parenR)){p=this.state.start;break}if(this.match(B.ellipsis)){var h=this.state.start,f=this.state.startLoc;c=this.state.start,a.push(this.parseParenItem(this.parseRest(),h,f));break}a.push(this.parseMaybeAssign(!1,o,this.parseParenItem,u))}var d=this.state.start,m=this.state.startLoc;this.expect(B.parenR);var y=this.startNodeAt(e,t);if(r&&this.shouldParseArrow()&&(y=this.parseArrow(y))){for(var g=a,b=Array.isArray(g),v=0,g=b?g:g[Symbol.iterator]();;){var x;if(b){if(v>=g.length)break;x=g[v++]}else{if((v=g.next()).done)break;x=v.value}var E=x;E.extra&&E.extra.parenthesized&&this.unexpected(E.extra.parenStart)}return this.parseArrowExpression(y,a)}return a.length||this.unexpected(this.state.lastTokStart),p&&this.unexpected(p),c&&this.unexpected(c),o.start&&this.unexpected(o.start),u.start&&this.unexpected(u.start),a.length>1?((n=this.startNodeAt(i,s)).expressions=a,this.toReferencedList(n.expressions),this.finishNodeAt(n,"SequenceExpression",d,m)):n=a[0],this.addExtra(n,"parenthesized",!0),this.addExtra(n,"parenStart",e),n},Q.shouldParseArrow=function(){return!this.canInsertSemicolon()},Q.parseArrow=function(e){if(this.eat(B.arrow))return e},Q.parseParenItem=function(e){return e},Q.parseNew=function(){var e=this.startNode(),t=this.parseIdentifier(!0);if(this.eat(B.dot)){var r=this.parseMetaProperty(e,t,"target");return this.state.inFunction||this.raise(r.property.start,"new.target can only be used in functions"),r}return e.callee=this.parseNoCallExpr(),this.eat(B.parenL)?(e.arguments=this.parseExprList(B.parenR),this.toReferencedList(e.arguments)):e.arguments=[],this.finishNode(e,"NewExpression")},Q.parseTemplateElement=function(e){var t=this.startNode();return null===this.state.value&&(e&&this.hasPlugin("templateInvalidEscapes")?this.state.invalidTemplateEscapePosition=null:this.raise(this.state.invalidTemplateEscapePosition,"Invalid escape sequence in template")),t.value={raw:this.input.slice(this.state.start,this.state.end).replace(/\r\n?/g,"\n"),cooked:this.state.value},this.next(),t.tail=this.match(B.backQuote),this.finishNode(t,"TemplateElement")},Q.parseTemplate=function(e){var t=this.startNode();this.next(),t.expressions=[];var r=this.parseTemplateElement(e);for(t.quasis=[r];!r.tail;)this.expect(B.dollarBraceL),t.expressions.push(this.parseExpression()),this.expect(B.braceR),t.quasis.push(r=this.parseTemplateElement(e));return this.next(),this.finishNode(t,"TemplateLiteral")},Q.parseObj=function(e,t){var r=[],n=Object.create(null),i=!0,s=this.startNode();s.properties=[],this.next();for(var a=null;!this.eat(B.braceR);){if(i)i=!1;else if(this.expect(B.comma),this.eat(B.braceR))break;for(;this.match(B.at);)r.push(this.parseDecorator());var o=this.startNode(),u=!1,l=!1,c=void 0,p=void 0;if(r.length&&(o.decorators=r,r=[]),this.hasPlugin("objectRestSpread")&&this.match(B.ellipsis)){if(o=this.parseSpread(e?{start:0}:void 0),o.type=e?"RestProperty":"SpreadProperty",e&&this.toAssignable(o.argument,!0,"object pattern"),s.properties.push(o),!e)continue;var h=this.state.start;if(null===a){if(this.eat(B.braceR))break;if(this.match(B.comma)&&this.lookahead().type===B.braceR)continue;a=h;continue}this.unexpected(a,"Cannot have multiple rest elements when destructuring")}if(o.method=!1,o.shorthand=!1,(e||t)&&(c=this.state.start,p=this.state.startLoc),e||(u=this.eat(B.star)),!e&&this.isContextual("async")){u&&this.unexpected();var f=this.parseIdentifier();this.match(B.colon)||this.match(B.parenL)||this.match(B.braceR)||this.match(B.eq)||this.match(B.comma)?(o.key=f,o.computed=!1):(l=!0,this.hasPlugin("asyncGenerators")&&(u=this.eat(B.star)),this.parsePropertyName(o))}else this.parsePropertyName(o);this.parseObjPropValue(o,c,p,u,l,e,t),this.checkPropClash(o,n),o.shorthand&&this.addExtra(o,"shorthand",!0),s.properties.push(o)}return null!==a&&this.unexpected(a,"The rest element has to be the last element when destructuring"),r.length&&this.raise(this.state.start,"You have trailing decorators with no property"),this.finishNode(s,e?"ObjectPattern":"ObjectExpression")},Q.isGetterOrSetterMethod=function(e,t){return!t&&!e.computed&&"Identifier"===e.key.type&&("get"===e.key.name||"set"===e.key.name)&&(this.match(B.string)||this.match(B.num)||this.match(B.bracketL)||this.match(B.name)||this.state.type.keyword)},Q.checkGetterSetterParamCount=function(e){var t="get"===e.kind?0:1;if(e.params.length!==t){var r=e.start;"get"===e.kind?this.raise(r,"getter should have no params"):this.raise(r,"setter should have exactly one param")}},Q.parseObjectMethod=function(e,t,r,n){return r||t||this.match(B.parenL)?(n&&this.unexpected(),e.kind="method",e.method=!0,this.parseMethod(e,t,r),this.finishNode(e,"ObjectMethod")):this.isGetterOrSetterMethod(e,n)?((t||r)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),this.parseMethod(e),this.checkGetterSetterParamCount(e),this.finishNode(e,"ObjectMethod")):void 0},Q.parseObjectProperty=function(e,t,r,n,i){return this.eat(B.colon)?(e.value=n?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssign(!1,i),this.finishNode(e,"ObjectProperty")):e.computed||"Identifier"!==e.key.type?void 0:(this.checkReservedWord(e.key.name,e.key.start,!0,!0),n?e.value=this.parseMaybeDefault(t,r,e.key.__clone()):this.match(B.eq)&&i?(i.start||(i.start=this.state.start),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):e.value=e.key.__clone(),e.shorthand=!0,this.finishNode(e,"ObjectProperty"))},Q.parseObjPropValue=function(e,t,r,n,i,s,a){var o=this.parseObjectMethod(e,n,i,s)||this.parseObjectProperty(e,t,r,s,a);return o||this.unexpected(),o},Q.parsePropertyName=function(e){if(this.eat(B.bracketL))e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(B.bracketR);else{e.computed=!1;var t=this.state.inPropertyName;this.state.inPropertyName=!0,e.key=this.match(B.num)||this.match(B.string)?this.parseExprAtom():this.parseIdentifier(!0),this.state.inPropertyName=t}return e.key},Q.initFunction=function(e,t){e.id=null,e.generator=!1,e.expression=!1,e.async=!!t},Q.parseMethod=function(e,t,r){var n=this.state.inMethod;return this.state.inMethod=e.kind||!0,this.initFunction(e,r),this.expect(B.parenL),e.params=this.parseBindingList(B.parenR),e.generator=!!t,this.parseFunctionBody(e),this.state.inMethod=n,e},Q.parseArrowExpression=function(e,t,r){return this.initFunction(e,r),e.params=this.toAssignableList(t,!0,"arrow function parameters"),this.parseFunctionBody(e,!0),this.finishNode(e,"ArrowFunctionExpression")},Q.isStrictBody=function(e,t){if(!t&&e.body.directives.length)for(var r=e.body.directives,n=Array.isArray(r),i=0,r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}if("use strict"===s.value.value)return!0}return!1},Q.parseFunctionBody=function(e,t){var r=t&&!this.match(B.braceL),n=this.state.inAsync;if(this.state.inAsync=e.async,r)e.body=this.parseMaybeAssign(),e.expression=!0;else{var i=this.state.inFunction,s=this.state.inGenerator,a=this.state.labels;this.state.inFunction=!0,this.state.inGenerator=e.generator,this.state.labels=[],e.body=this.parseBlock(!0),e.expression=!1,this.state.inFunction=i,this.state.inGenerator=s,this.state.labels=a}this.state.inAsync=n;var o=this.isStrictBody(e,r),u=this.state.strict||t||o;if(o&&e.id&&"Identifier"===e.id.type&&"yield"===e.id.name&&this.raise(e.id.start,"Binding yield in strict mode"),u){var l=Object.create(null),c=this.state.strict;o&&(this.state.strict=!0),e.id&&this.checkLVal(e.id,!0,void 0,"function name");for(var p=e.params,h=Array.isArray(p),f=0,p=h?p:p[Symbol.iterator]();;){var d;if(h){if(f>=p.length)break;d=p[f++]}else{if((f=p.next()).done)break;d=f.value}var m=d;o&&"Identifier"!==m.type&&this.raise(m.start,"Non-simple parameter in strict mode"),this.checkLVal(m,!0,l,"function parameter list")}this.state.strict=c}},Q.parseExprList=function(e,t,r){for(var n=[],i=!0;!this.eat(e);){if(i)i=!1;else if(this.expect(B.comma),this.eat(e))break;n.push(this.parseExprListItem(t,r))}return n},Q.parseExprListItem=function(e,t,r){return e&&this.match(B.comma)?null:this.match(B.ellipsis)?this.parseSpread(t):this.parseMaybeAssign(!1,t,this.parseParenItem,r)},Q.parseIdentifier=function(e){var t=this.startNode();return e||this.checkReservedWord(this.state.value,this.state.start,!!this.state.type.keyword,!1),this.match(B.name)?t.name=this.state.value:this.state.type.keyword?t.name=this.state.type.keyword:this.unexpected(),!e&&"await"===t.name&&this.state.inAsync&&this.raise(t.start,"invalid use of await inside of an async function"),t.loc.identifierName=t.name,this.next(),this.finishNode(t,"Identifier")},Q.checkReservedWord=function(e,t,r,n){(this.isReservedWord(e)||r&&this.isKeyword(e))&&this.raise(t,e+" is a reserved word"),this.state.strict&&(m.strict(e)||n&&m.strictBind(e))&&this.raise(t,e+" is a reserved word in strict mode")},Q.parseAwait=function(e){return this.state.inAsync||this.unexpected(),this.match(B.star)&&this.raise(e.start,"await* has been removed from the async functions proposal. Use Promise.all() instead."),e.argument=this.parseMaybeUnary(),this.finishNode(e,"AwaitExpression")},Q.parseYield=function(){var e=this.startNode();return this.next(),this.match(B.semi)||this.canInsertSemicolon()||!this.match(B.star)&&!this.state.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(B.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")};var Z=W.prototype,ee=["leadingComments","trailingComments","innerComments"],te=function(){function e(t,r,n){S(this,e),this.type="",this.start=t,this.end=0,this.loc=new V(r),n&&(this.loc.filename=n)}return e.prototype.__clone=function(){var t=new e;for(var r in this)ee.indexOf(r)<0&&(t[r]=this[r]);return t},e}();Z.startNode=function(){return new te(this.state.start,this.state.startLoc,this.filename)},Z.startNodeAt=function(e,t){return new te(e,t,this.filename)},Z.finishNode=function(e,t){return p.call(this,e,t,this.state.lastTokEnd,this.state.lastTokEndLoc)},Z.finishNodeAt=function(e,t,r,n){return p.call(this,e,t,r,n)},W.prototype.raise=function(e,t){var r=l(this.input,e);t+=" ("+r.line+":"+r.column+")";var n=new SyntaxError(t);throw n.pos=e,n.loc=r,n};var re=W.prototype;re.addComment=function(e){this.filename&&(e.loc.filename=this.filename),this.state.trailingComments.push(e),this.state.leadingComments.push(e)},re.processComment=function(e){if(!("Program"===e.type&&e.body.length>0)){var t=this.state.commentStack,r=void 0,n=void 0,i=void 0,s=void 0,a=void 0;if(this.state.trailingComments.length>0)this.state.trailingComments[0].start>=e.end?(i=this.state.trailingComments,this.state.trailingComments=[]):this.state.trailingComments.length=0;else{var o=h(t);t.length>0&&o.trailingComments&&o.trailingComments[0].start>=e.end&&(i=o.trailingComments,o.trailingComments=null)}for(t.length>0&&h(t).start>=e.start&&(r=t.pop());t.length>0&&h(t).start>=e.start;)n=t.pop();if(!n&&r&&(n=r),r&&this.state.leadingComments.length>0){var u=h(this.state.leadingComments);if("ObjectProperty"===r.type){if(u.start>=e.start&&this.state.commentPreviousNode){for(a=0;a0&&(r.trailingComments=this.state.leadingComments,this.state.leadingComments=[])}}else if("CallExpression"===e.type&&e.arguments&&e.arguments.length){var l=h(e.arguments);l&&u.start>=l.start&&u.end<=e.end&&this.state.commentPreviousNode&&this.state.leadingComments.length>0&&(l.trailingComments=this.state.leadingComments,this.state.leadingComments=[])}}if(n){if(n.leadingComments)if(n!==e&&h(n.leadingComments).end<=e.start)e.leadingComments=n.leadingComments,n.leadingComments=null;else for(s=n.leadingComments.length-2;s>=0;--s)if(n.leadingComments[s].end<=e.start){e.leadingComments=n.leadingComments.splice(0,s+1);break}}else if(this.state.leadingComments.length>0)if(h(this.state.leadingComments).end<=e.start){if(this.state.commentPreviousNode)for(a=0;a0&&(e.leadingComments=this.state.leadingComments,this.state.leadingComments=[])}else{for(s=0;se.start);s++);e.leadingComments=this.state.leadingComments.slice(0,s),0===e.leadingComments.length&&(e.leadingComments=null),0===(i=this.state.leadingComments.slice(s)).length&&(i=null)}this.state.commentPreviousNode=e,i&&(i.length&&i[0].start>=e.start&&h(i).end<=e.end?e.innerComments=i:e.trailingComments=i),t.push(e)}};var ne=W.prototype;ne.estreeParseRegExpLiteral=function(e){var t=e.pattern,r=e.flags,n=null;try{n=new RegExp(t,r)}catch(e){}var i=this.estreeParseLiteral(n);return i.regex={pattern:t,flags:r},i},ne.estreeParseLiteral=function(e){return this.parseLiteral(e,"Literal")},ne.directiveToStmt=function(e){var t=e.value,r=this.startNodeAt(e.start,e.loc.start),n=this.startNodeAt(t.start,t.loc.start);return n.value=t.value,n.raw=t.extra.raw,r.expression=this.finishNodeAt(n,"Literal",t.end,t.loc.end),r.directive=t.extra.raw.slice(1,-1),this.finishNodeAt(r,"ExpressionStatement",e.end,e.loc.end)};var ie=["any","mixed","empty","bool","boolean","number","string","void","null"],se=W.prototype;se.flowParseTypeInitialiser=function(e){var t=this.state.inType;this.state.inType=!0,this.expect(e||B.colon);var r=this.flowParseType();return this.state.inType=t,r},se.flowParsePredicate=function(){var e=this.startNode(),t=this.state.startLoc,r=this.state.start;this.expect(B.modulo);var n=this.state.startLoc;return this.expectContextual("checks"),t.line===n.line&&t.column===n.column-1||this.raise(r,"Spaces between ´%´ and ´checks´ are not allowed here."),this.eat(B.parenL)?(e.expression=this.parseExpression(),this.expect(B.parenR),this.finishNode(e,"DeclaredPredicate")):this.finishNode(e,"InferredPredicate")},se.flowParseTypeAndPredicateInitialiser=function(){var e=this.state.inType;this.state.inType=!0,this.expect(B.colon);var t=null,r=null;return this.match(B.modulo)?(this.state.inType=e,r=this.flowParsePredicate()):(t=this.flowParseType(),this.state.inType=e,this.match(B.modulo)&&(r=this.flowParsePredicate())),[t,r]},se.flowParseDeclareClass=function(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},se.flowParseDeclareFunction=function(e){this.next();var t=e.id=this.parseIdentifier(),r=this.startNode(),n=this.startNode();this.isRelational("<")?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,this.expect(B.parenL);var i=this.flowParseFunctionTypeParams();r.params=i.params,r.rest=i.rest,this.expect(B.parenR);var s=null,a=this.flowParseTypeAndPredicateInitialiser();return r.returnType=a[0],s=a[1],n.typeAnnotation=this.finishNode(r,"FunctionTypeAnnotation"),n.predicate=s,t.typeAnnotation=this.finishNode(n,"TypeAnnotation"),this.finishNode(t,t.type),this.semicolon(),this.finishNode(e,"DeclareFunction")},se.flowParseDeclare=function(e){return this.match(B._class)?this.flowParseDeclareClass(e):this.match(B._function)?this.flowParseDeclareFunction(e):this.match(B._var)?this.flowParseDeclareVariable(e):this.isContextual("module")?this.lookahead().type===B.dot?this.flowParseDeclareModuleExports(e):this.flowParseDeclareModule(e):this.isContextual("type")?this.flowParseDeclareTypeAlias(e):this.isContextual("opaque")?this.flowParseDeclareOpaqueType(e):this.isContextual("interface")?this.flowParseDeclareInterface(e):this.match(B._export)?this.flowParseDeclareExportDeclaration(e):void this.unexpected()},se.flowParseDeclareExportDeclaration=function(e){if(this.expect(B._export),this.isContextual("opaque"))return e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,"DeclareExportDeclaration");throw this.unexpected()},se.flowParseDeclareVariable=function(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(),this.semicolon(),this.finishNode(e,"DeclareVariable")},se.flowParseDeclareModule=function(e){this.next(),this.match(B.string)?e.id=this.parseExprAtom():e.id=this.parseIdentifier();var t=e.body=this.startNode(),r=t.body=[];for(this.expect(B.braceL);!this.match(B.braceR);){var n=this.startNode();if(this.match(B._import)){var i=this.lookahead();"type"!==i.value&&"typeof"!==i.value&&this.unexpected(null,"Imports within a `declare module` body must always be `import type` or `import typeof`"),this.parseImport(n)}else this.expectContextual("declare","Only declares and type imports are allowed inside declare module"),n=this.flowParseDeclare(n,!0);r.push(n)}return this.expect(B.braceR),this.finishNode(t,"BlockStatement"),this.finishNode(e,"DeclareModule")},se.flowParseDeclareModuleExports=function(e){return this.expectContextual("module"),this.expect(B.dot),this.expectContextual("exports"),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")},se.flowParseDeclareTypeAlias=function(e){return this.next(),this.flowParseTypeAlias(e),this.finishNode(e,"DeclareTypeAlias")},se.flowParseDeclareOpaqueType=function(e){return this.next(),this.flowParseOpaqueType(e,!0),this.finishNode(e,"DeclareOpaqueType")},se.flowParseDeclareInterface=function(e){return this.next(),this.flowParseInterfaceish(e),this.finishNode(e,"DeclareInterface")},se.flowParseInterfaceish=function(e){if(e.id=this.parseIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],e.mixins=[],this.eat(B._extends))do{e.extends.push(this.flowParseInterfaceExtends())}while(this.eat(B.comma));if(this.isContextual("mixins")){this.next();do{e.mixins.push(this.flowParseInterfaceExtends())}while(this.eat(B.comma))}e.body=this.flowParseObjectType(!0,!1,!1)},se.flowParseInterfaceExtends=function(){var e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")},se.flowParseInterface=function(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},se.flowParseRestrictedIdentifier=function(e){return ie.indexOf(this.state.value)>-1&&this.raise(this.state.start,"Cannot overwrite primitive type "+this.state.value),this.parseIdentifier(e)},se.flowParseTypeAlias=function(e){return e.id=this.flowParseRestrictedIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(B.eq),this.semicolon(),this.finishNode(e,"TypeAlias")},se.flowParseOpaqueType=function(e,t){return this.expectContextual("type"),e.id=this.flowParseRestrictedIdentifier(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.supertype=null,this.match(B.colon)&&(e.supertype=this.flowParseTypeInitialiser(B.colon)),e.impltype=null,t||(e.impltype=this.flowParseTypeInitialiser(B.eq)),this.semicolon(),this.finishNode(e,"OpaqueType")},se.flowParseTypeParameter=function(){var e=this.startNode(),t=this.flowParseVariance(),r=this.flowParseTypeAnnotatableIdentifier();return e.name=r.name,e.variance=t,e.bound=r.typeAnnotation,this.match(B.eq)&&(this.eat(B.eq),e.default=this.flowParseType()),this.finishNode(e,"TypeParameter")},se.flowParseTypeParameterDeclaration=function(){var e=this.state.inType,t=this.startNode();t.params=[],this.state.inType=!0,this.isRelational("<")||this.match(B.jsxTagStart)?this.next():this.unexpected();do{t.params.push(this.flowParseTypeParameter()),this.isRelational(">")||this.expect(B.comma)}while(!this.isRelational(">"));return this.expectRelational(">"),this.state.inType=e,this.finishNode(t,"TypeParameterDeclaration")},se.flowParseTypeParameterInstantiation=function(){var e=this.startNode(),t=this.state.inType;for(e.params=[],this.state.inType=!0,this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseType()),this.isRelational(">")||this.expect(B.comma);return this.expectRelational(">"),this.state.inType=t,this.finishNode(e,"TypeParameterInstantiation")},se.flowParseObjectPropertyKey=function(){return this.match(B.num)||this.match(B.string)?this.parseExprAtom():this.parseIdentifier(!0)},se.flowParseObjectTypeIndexer=function(e,t,r){return e.static=t,this.expect(B.bracketL),this.lookahead().type===B.colon?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(B.bracketR),e.value=this.flowParseTypeInitialiser(),e.variance=r,this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeIndexer")},se.flowParseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(B.parenL);!this.match(B.parenR)&&!this.match(B.ellipsis);)e.params.push(this.flowParseFunctionTypeParam()),this.match(B.parenR)||this.expect(B.comma);return this.eat(B.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),this.expect(B.parenR),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")},se.flowParseObjectTypeMethod=function(e,t,r,n){var i=this.startNodeAt(e,t);return i.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e,t)),i.static=r,i.key=n,i.optional=!1,this.flowObjectTypeSemicolon(),this.finishNode(i,"ObjectTypeProperty")},se.flowParseObjectTypeCallProperty=function(e,t){var r=this.startNode();return e.static=t,e.value=this.flowParseObjectTypeMethodish(r),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeCallProperty")},se.flowParseObjectType=function(e,t,r){var n=this.state.inType;this.state.inType=!0;var i=this.startNode(),s=void 0,a=void 0,o=!1;i.callProperties=[],i.properties=[],i.indexers=[];var u=void 0,l=void 0;for(t&&this.match(B.braceBarL)?(this.expect(B.braceBarL),u=B.braceBarR,l=!0):(this.expect(B.braceL),u=B.braceR,l=!1),i.exact=l;!this.match(u);){var c=!1,p=this.state.start,h=this.state.startLoc;s=this.startNode(),e&&this.isContextual("static")&&this.lookahead().type!==B.colon&&(this.next(),o=!0);var f=this.state.start,d=this.flowParseVariance();this.match(B.bracketL)?i.indexers.push(this.flowParseObjectTypeIndexer(s,o,d)):this.match(B.parenL)||this.isRelational("<")?(d&&this.unexpected(f),i.callProperties.push(this.flowParseObjectTypeCallProperty(s,o))):this.match(B.ellipsis)?(r||this.unexpected(null,"Spread operator cannot appear in class or interface definitions"),d&&this.unexpected(d.start,"Spread properties cannot have variance"),this.expect(B.ellipsis),s.argument=this.flowParseType(),this.flowObjectTypeSemicolon(),i.properties.push(this.finishNode(s,"ObjectTypeSpreadProperty"))):(a=this.flowParseObjectPropertyKey(),this.isRelational("<")||this.match(B.parenL)?(d&&this.unexpected(d.start),i.properties.push(this.flowParseObjectTypeMethod(p,h,o,a))):(this.eat(B.question)&&(c=!0),s.key=a,s.value=this.flowParseTypeInitialiser(),s.optional=c,s.static=o,s.variance=d,this.flowObjectTypeSemicolon(),i.properties.push(this.finishNode(s,"ObjectTypeProperty")))),o=!1}this.expect(u);var m=this.finishNode(i,"ObjectTypeAnnotation");return this.state.inType=n,m},se.flowObjectTypeSemicolon=function(){this.eat(B.semi)||this.eat(B.comma)||this.match(B.braceR)||this.match(B.braceBarR)||this.unexpected()},se.flowParseQualifiedTypeIdentifier=function(e,t,r){e=e||this.state.start,t=t||this.state.startLoc;for(var n=r||this.parseIdentifier();this.eat(B.dot);){var i=this.startNodeAt(e,t);i.qualification=n,i.id=this.parseIdentifier(),n=this.finishNode(i,"QualifiedTypeIdentifier")}return n},se.flowParseGenericType=function(e,t,r){var n=this.startNodeAt(e,t);return n.typeParameters=null,n.id=this.flowParseQualifiedTypeIdentifier(e,t,r),this.isRelational("<")&&(n.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(n,"GenericTypeAnnotation")},se.flowParseTypeofType=function(){var e=this.startNode();return this.expect(B._typeof),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},se.flowParseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(B.bracketL);this.state.pos0&&void 0!==arguments[0]?arguments[0]:[],rest:null};!this.match(B.parenR)&&!this.match(B.ellipsis);)e.params.push(this.flowParseFunctionTypeParam()),this.match(B.parenR)||this.expect(B.comma);return this.eat(B.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),e},se.flowIdentToTypeAnnotation=function(e,t,r,n){switch(n.name){case"any":return this.finishNode(r,"AnyTypeAnnotation");case"void":return this.finishNode(r,"VoidTypeAnnotation");case"bool":case"boolean":return this.finishNode(r,"BooleanTypeAnnotation");case"mixed":return this.finishNode(r,"MixedTypeAnnotation");case"empty":return this.finishNode(r,"EmptyTypeAnnotation");case"number":return this.finishNode(r,"NumberTypeAnnotation");case"string":return this.finishNode(r,"StringTypeAnnotation");default:return this.flowParseGenericType(e,t,n)}},se.flowParsePrimaryType=function(){var e=this.state.start,t=this.state.startLoc,r=this.startNode(),n=void 0,i=void 0,s=!1,a=this.state.noAnonFunctionType;switch(this.state.type){case B.name:return this.flowIdentToTypeAnnotation(e,t,r,this.parseIdentifier());case B.braceL:return this.flowParseObjectType(!1,!1,!0);case B.braceBarL:return this.flowParseObjectType(!1,!0,!0);case B.bracketL:return this.flowParseTupleType();case B.relational:if("<"===this.state.value)return r.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(B.parenL),n=this.flowParseFunctionTypeParams(),r.params=n.params,r.rest=n.rest,this.expect(B.parenR),this.expect(B.arrow),r.returnType=this.flowParseType(),this.finishNode(r,"FunctionTypeAnnotation");break;case B.parenL:if(this.next(),!this.match(B.parenR)&&!this.match(B.ellipsis))if(this.match(B.name)){var o=this.lookahead().type;s=o!==B.question&&o!==B.colon}else s=!0;if(s){if(this.state.noAnonFunctionType=!1,i=this.flowParseType(),this.state.noAnonFunctionType=a,this.state.noAnonFunctionType||!(this.match(B.comma)||this.match(B.parenR)&&this.lookahead().type===B.arrow))return this.expect(B.parenR),i;this.eat(B.comma)}return n=i?this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(i)]):this.flowParseFunctionTypeParams(),r.params=n.params,r.rest=n.rest,this.expect(B.parenR),this.expect(B.arrow),r.returnType=this.flowParseType(),r.typeParameters=null,this.finishNode(r,"FunctionTypeAnnotation");case B.string:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case B._true:case B._false:return r.value=this.match(B._true),this.next(),this.finishNode(r,"BooleanLiteralTypeAnnotation");case B.plusMin:if("-"===this.state.value)return this.next(),this.match(B.num)||this.unexpected(null,"Unexpected token, expected number"),this.parseLiteral(-this.state.value,"NumericLiteralTypeAnnotation",r.start,r.loc.start);this.unexpected();case B.num:return this.parseLiteral(this.state.value,"NumericLiteralTypeAnnotation");case B._null:return r.value=this.match(B._null),this.next(),this.finishNode(r,"NullLiteralTypeAnnotation");case B._this:return r.value=this.match(B._this),this.next(),this.finishNode(r,"ThisTypeAnnotation");case B.star:return this.next(),this.finishNode(r,"ExistentialTypeParam");default:if("typeof"===this.state.type.keyword)return this.flowParseTypeofType()}this.unexpected()},se.flowParsePostfixType=function(){for(var e=this.state.start,t=this.state.startLoc,r=this.flowParsePrimaryType();!this.canInsertSemicolon()&&this.match(B.bracketL);){var n=this.startNodeAt(e,t);n.elementType=r,this.expect(B.bracketL),this.expect(B.bracketR),r=this.finishNode(n,"ArrayTypeAnnotation")}return r},se.flowParsePrefixType=function(){var e=this.startNode();return this.eat(B.question)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()},se.flowParseAnonFunctionWithoutParens=function(){var e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(B.arrow)){var t=this.startNodeAt(e.start,e.loc.start);return t.params=[this.reinterpretTypeAsFunctionTypeParam(e)],t.rest=null,t.returnType=this.flowParseType(),t.typeParameters=null,this.finishNode(t,"FunctionTypeAnnotation")}return e},se.flowParseIntersectionType=function(){var e=this.startNode();this.eat(B.bitwiseAND);var t=this.flowParseAnonFunctionWithoutParens();for(e.types=[t];this.eat(B.bitwiseAND);)e.types.push(this.flowParseAnonFunctionWithoutParens());return 1===e.types.length?t:this.finishNode(e,"IntersectionTypeAnnotation")},se.flowParseUnionType=function(){var e=this.startNode();this.eat(B.bitwiseOR);var t=this.flowParseIntersectionType();for(e.types=[t];this.eat(B.bitwiseOR);)e.types.push(this.flowParseIntersectionType());return 1===e.types.length?t:this.finishNode(e,"UnionTypeAnnotation")},se.flowParseType=function(){var e=this.state.inType;this.state.inType=!0;var t=this.flowParseUnionType();return this.state.inType=e,t},se.flowParseTypeAnnotation=function(){var e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")},se.flowParseTypeAndPredicateAnnotation=function(){var e=this.startNode(),t=this.flowParseTypeAndPredicateInitialiser();return e.typeAnnotation=t[0],e.predicate=t[1],this.finishNode(e,"TypeAnnotation")},se.flowParseTypeAnnotatableIdentifier=function(){var e=this.flowParseRestrictedIdentifier();return this.match(B.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(e,e.type)),e},se.typeCastToParameter=function(e){return e.expression.typeAnnotation=e.typeAnnotation,this.finishNodeAt(e.expression,e.expression.type,e.typeAnnotation.end,e.typeAnnotation.loc.end)},se.flowParseVariance=function(){var e=null;return this.match(B.plusMin)&&("+"===this.state.value?e="plus":"-"===this.state.value&&(e="minus"),this.next()),e};var ae=String.fromCodePoint;if(!ae){var oe=String.fromCharCode,ue=Math.floor;ae=function(){var e=[],t=void 0,r=void 0,n=-1,i=arguments.length;if(!i)return"";for(var s="";++n1114111||ue(a)!=a)throw RangeError("Invalid code point: "+a);a<=65535?e.push(a):(t=55296+((a-=65536)>>10),r=a%1024+56320,e.push(t,r)),(n+1==i||e.length>16384)&&(s+=oe.apply(null,e),e.length=0)}return s}}var le=ae,ce={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},pe=/^[\da-fA-F]+$/,he=/^\d+$/;M.j_oTag=new L("...",!0,!0),B.jsxName=new F("jsxName"),B.jsxText=new F("jsxText",{beforeExpr:!0}),B.jsxTagStart=new F("jsxTagStart",{startsExpr:!0}),B.jsxTagEnd=new F("jsxTagEnd"),B.jsxTagStart.updateContext=function(){this.state.context.push(M.j_expr),this.state.context.push(M.j_oTag),this.state.exprAllowed=!1},B.jsxTagEnd.updateContext=function(e){var t=this.state.context.pop();t===M.j_oTag&&e===B.slash||t===M.j_cTag?(this.state.context.pop(),this.state.exprAllowed=this.curContext()===M.j_expr):this.state.exprAllowed=!0};var fe=W.prototype;fe.jsxReadToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated JSX contents");var r=this.input.charCodeAt(this.state.pos);switch(r){case 60:case 123:return this.state.pos===this.state.start?60===r&&this.state.exprAllowed?(++this.state.pos,this.finishToken(B.jsxTagStart)):this.getTokenFromCode(r):(e+=this.input.slice(t,this.state.pos),this.finishToken(B.jsxText,e));case 38:e+=this.input.slice(t,this.state.pos),e+=this.jsxReadEntity(),t=this.state.pos;break;default:u(r)?(e+=this.input.slice(t,this.state.pos),e+=this.jsxReadNewLine(!0),t=this.state.pos):++this.state.pos}}},fe.jsxReadNewLine=function(e){var t=this.input.charCodeAt(this.state.pos),r=void 0;return++this.state.pos,13===t&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,r=e?"\n":"\r\n"):r=String.fromCharCode(t),++this.state.curLine,this.state.lineStart=this.state.pos,r},fe.jsxReadString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;38===n?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos):u(n)?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!1),r=this.state.pos):++this.state.pos}return t+=this.input.slice(r,this.state.pos++),this.finishToken(B.string,t)},fe.jsxReadEntity=function(){for(var e="",t=0,r=void 0,n=this.input[this.state.pos],i=++this.state.pos;this.state.pos")}return r.openingElement=i,r.closingElement=s,r.children=n,this.match(B.relational)&&"<"===this.state.value&&this.raise(this.state.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(r,"JSXElement")},fe.jsxParseElement=function(){var e=this.state.start,t=this.state.startLoc;return this.next(),this.jsxParseElementAt(e,t)};G.estree=function(e){e.extend("checkDeclaration",function(e){return function(t){f(t)?this.checkDeclaration(t.value):e.call(this,t)}}),e.extend("checkGetterSetterParamCount",function(){return function(e){var t="get"===e.kind?0:1;if(e.value.params.length!==t){var r=e.start;"get"===e.kind?this.raise(r,"getter should have no params"):this.raise(r,"setter should have exactly one param")}}}),e.extend("checkLVal",function(e){return function(t,r,n){var i=this;switch(t.type){case"ObjectPattern":t.properties.forEach(function(e){i.checkLVal("Property"===e.type?e.value:e,r,n,"object destructuring pattern")});break;default:for(var s=arguments.length,a=Array(s>3?s-3:0),o=3;o0)for(var r=e.body.body,n=Array.isArray(r),i=0,r=n?r:r[Symbol.iterator]();;){var s;if(n){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s;if("ExpressionStatement"!==a.type||"Literal"!==a.expression.type)break;if("use strict"===a.expression.value)return!0}return!1}}),e.extend("isValidDirective",function(){return function(e){return!("ExpressionStatement"!==e.type||"Literal"!==e.expression.type||"string"!=typeof e.expression.value||e.expression.extra&&e.expression.extra.parenthesized)}}),e.extend("stmtToDirective",function(e){return function(t){var r=e.call(this,t),n=t.expression.value;return r.value.value=n,r}}),e.extend("parseBlockBody",function(e){return function(t){for(var r=this,n=arguments.length,i=Array(n>1?n-1:0),s=1;s1?n-1:0),s=1;s2?n-2:0),s=2;s=a.length)break;l=a[u++]}else{if((u=a.next()).done)break;l=u.value}var c=l;"get"===c.kind||"set"===c.kind?this.raise(c.key.start,"Object pattern can't contain getter or setter"):c.method?this.raise(c.key.start,"Object pattern can't contain methods"):this.toAssignable(c,r,"object destructuring pattern")}return t}return e.call.apply(e,[this,t,r].concat(i))}})},G.flow=function(e){e.extend("parseFunctionBody",function(e){return function(t,r){return this.match(B.colon)&&!r&&(t.returnType=this.flowParseTypeAndPredicateAnnotation()),e.call(this,t,r)}}),e.extend("parseStatement",function(e){return function(t,r){if(this.state.strict&&this.match(B.name)&&"interface"===this.state.value){var n=this.startNode();return this.next(),this.flowParseInterface(n)}return e.call(this,t,r)}}),e.extend("parseExpressionStatement",function(e){return function(t,r){if("Identifier"===r.type)if("declare"===r.name){if(this.match(B._class)||this.match(B.name)||this.match(B._function)||this.match(B._var)||this.match(B._export))return this.flowParseDeclare(t)}else if(this.match(B.name)){if("interface"===r.name)return this.flowParseInterface(t);if("type"===r.name)return this.flowParseTypeAlias(t);if("opaque"===r.name)return this.flowParseOpaqueType(t,!1)}return e.call(this,t,r)}}),e.extend("shouldParseExportDeclaration",function(e){return function(){return this.isContextual("type")||this.isContextual("interface")||this.isContextual("opaque")||e.call(this)}}),e.extend("isExportDefaultSpecifier",function(e){return function(){return(!this.match(B.name)||"type"!==this.state.value&&"interface"!==this.state.value&&"opaque"!==this.state.value)&&e.call(this)}}),e.extend("parseConditional",function(e){return function(t,r,n,i,s){if(s&&this.match(B.question)){var a=this.state.clone();try{return e.call(this,t,r,n,i)}catch(e){if(e instanceof SyntaxError)return this.state=a,s.start=e.pos||this.state.start,t;throw e}}return e.call(this,t,r,n,i)}}),e.extend("parseParenItem",function(e){return function(t,r,n){if(t=e.call(this,t,r,n),this.eat(B.question)&&(t.optional=!0),this.match(B.colon)){var i=this.startNodeAt(r,n);return i.expression=t,i.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(i,"TypeCastExpression")}return t}}),e.extend("parseExport",function(e){return function(t){return"ExportNamedDeclaration"===(t=e.call(this,t)).type&&(t.exportKind=t.exportKind||"value"),t}}),e.extend("parseExportDeclaration",function(e){return function(t){if(this.isContextual("type")){t.exportKind="type";var r=this.startNode();return this.next(),this.match(B.braceL)?(t.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(t),null):this.flowParseTypeAlias(r)}if(this.isContextual("opaque")){t.exportKind="type";var n=this.startNode();return this.next(),this.flowParseOpaqueType(n,!1)}if(this.isContextual("interface")){t.exportKind="type";var i=this.startNode();return this.next(),this.flowParseInterface(i)}return e.call(this,t)}}),e.extend("parseClassId",function(e){return function(t){e.apply(this,arguments),this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}}),e.extend("isKeyword",function(e){return function(t){return(!this.state.inType||"void"!==t)&&e.call(this,t)}}),e.extend("readToken",function(e){return function(t){return!this.state.inType||62!==t&&60!==t?e.call(this,t):this.finishOp(B.relational,1)}}),e.extend("jsx_readToken",function(e){return function(){if(!this.state.inType)return e.call(this)}}),e.extend("toAssignable",function(e){return function(t,r,n){return"TypeCastExpression"===t.type?e.call(this,this.typeCastToParameter(t),r,n):e.call(this,t,r,n)}}),e.extend("toAssignableList",function(e){return function(t,r,n){for(var i=0;i2?n-2:0),s=2;s=0&&l>0){for(n=[],s=r.length;c>=0&&!o;)c==u?(n.push(c),u=r.indexOf(e,c+1)):1==n.length?o=[n.pop(),l]:((i=n.pop())=0?u:l;n.length&&(o=[s,a])}return o}t.exports=n,n.range=s},{}],188:[function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function i(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function s(e,t,r){for(var n,s=[],a=t;a0?l-4:l;var c=0;for(t=0;t>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===s?(i=o[e.charCodeAt(t)]<<2|o[e.charCodeAt(t+1)]>>4,a[c++]=255&i):1===s&&(i=o[e.charCodeAt(t)]<<10|o[e.charCodeAt(t+1)]<<4|o[e.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",o=[],u=0,l=r-n;ul?l:u+16383));return 1===n?(t=e[r-1],i+=a[t>>2],i+=a[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=a[t>>10],i+=a[t>>4&63],i+=a[t<<2&63],i+="="),o.push(i),o.join("")};for(var a=[],o=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,p=l.length;c=t}function p(e,t){var r=[],i=f("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),m=s||d,g=i.body.indexOf(",")>=0;if(!m&&!g)return i.post.match(/,.*\}/)?(e=i.pre+"{"+i.body+y+i.post,p(e)):[e];var b;if(m)b=i.body.split(/\.\./);else if(1===(b=a(i.body)).length&&1===(b=p(b[0],!1).map(o)).length)return(E=i.post.length?p(i.post,!1):[""]).map(function(e){return i.pre+b[0]+e});var v,x=i.pre,E=i.post.length?p(i.post,!1):[""];if(m){var A=n(b[0]),D=n(b[1]),C=Math.max(b[0].length,b[1].length),S=3==b.length?Math.abs(n(b[2])):1,_=l;D0){var P=new Array(T+1).join("0");F=k<0?"-"+P+F.slice(1):P+F}}v.push(F)}}else v=h(b,function(e){return p(e,!1)});for(var B=0;BY)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(e)}return s(e,t,r)}function s(e,t,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return X(e)?p(e,t,r):"string"==typeof e?l(e,t):h(e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function o(e,t,r){return a(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}function u(e){return a(e),n(e<0?0:0|f(e))}function l(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(e,t),s=n(r),a=s.write(e,t);return a!==r&&(s=s.slice(0,a)),s}function c(e){for(var t=e.length<0?0:0|f(e.length),r=n(t),i=0;i=Y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y.toString(16)+" bytes");return 0|e}function d(e,t){if(i.isBuffer(e))return e.length;if(W(e)||X(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(n)return R(e).length;t=(""+t).toLowerCase(),n=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return _(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return F(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,J(r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){function s(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,u/=2,r/=2}var l;if(i){var c=-1;for(l=r;lo&&(r=o-u),l=r;l>=0;l--){for(var p=!0,h=0;hi&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var a=0;a239?4:s>223?3:s>191?2:1;if(i+o<=r){var u,l,c,p;switch(o){case 1:s<128&&(a=s);break;case 2:128==(192&(u=e[i+1]))&&(p=(31&s)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&s)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&s)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=o}return w(n)}function w(e){var t=e.length;if(t<=H)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",s=t;sr)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,r,n,s,a){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,i){return t=+t,r>>>=0,i||j(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),z.write(e,t,r,n,23,4),r+4}function I(e,t,r,n,i){return t=+t,r>>>=0,i||j(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),z.write(e,t,r,n,52,8),r+8}function L(e){if((e=e.trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function M(e){return e<16?"0"+e.toString(16):e.toString(16)}function R(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(e){for(var t=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function q(e){return K.toByteArray(L(e))}function G(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function X(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function W(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function J(e){return e!==e}var K=e("base64-js"),z=e("ieee754");r.Buffer=i,r.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},r.INSPECT_MAX_BYTES=50;var Y=2147483647;r.kMaxLength=Y,i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,r){return s(e,t,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,r){return o(e,t,r)},i.allocUnsafe=function(e){return u(e)},i.allocUnsafeSlow=function(e){return u(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,s=0,a=Math.min(r,n);s0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,s){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var a=s-n,o=r-t,u=Math.min(a,o),l=this.slice(n,s),c=e.slice(t,r),p=0;p>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return E(this,e,t,r);case"latin1":case"binary":return A(this,e,t,r);case"base64":return D(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var H=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e],i=1,s=0;++s>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},i.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e],i=1,s=0;++s=i&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},i.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),z.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),z.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),z.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),z.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,n||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(s<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;ac;)if((o=u[c++])!=o)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===r)return e||c||0;return!e&&-1}}},{"./_to-absolute-index":273,"./_to-iobject":275,"./_to-length":276}],214:[function(e,t,r){var n=e("./_ctx"),i=e("./_iobject"),s=e("./_to-object"),a=e("./_to-length"),o=e("./_array-species-create");t.exports=function(e,t){var r=1==e,u=2==e,l=3==e,c=4==e,p=6==e,h=5==e||p,f=t||o;return function(t,o,d){for(var m,y,g=s(t),b=i(g),v=n(o,d,3),x=a(b.length),E=0,A=r?f(t,x):u?f(t,0):void 0;x>E;E++)if((h||E in b)&&(m=b[E],y=v(m,E,g),e))if(r)A[E]=y;else if(y)switch(e){case 3:return!0;case 5:return m;case 6:return E;case 2:A.push(m)}else if(c)return!1;return p?-1:l||c?c:A}}},{"./_array-species-create":216,"./_ctx":224,"./_iobject":238,"./_to-length":276,"./_to-object":277}],215:[function(e,t,r){var n=e("./_is-object"),i=e("./_is-array"),s=e("./_wks")("species");t.exports=function(e){var t;return i(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0),n(t)&&null===(t=t[s])&&(t=void 0)),void 0===t?Array:t}},{"./_is-array":240,"./_is-object":241,"./_wks":283}],216:[function(e,t,r){var n=e("./_array-species-constructor");t.exports=function(e,t){return new(n(e))(t)}},{"./_array-species-constructor":215}],217:[function(e,t,r){var n=e("./_cof"),i=e("./_wks")("toStringTag"),s="Arguments"==n(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};t.exports=function(e){var t,r,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=a(t=Object(e),i))?r:s?n(t):"Object"==(o=n(t))&&"function"==typeof t.callee?"Arguments":o}},{"./_cof":218,"./_wks":283}],218:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],219:[function(e,t,r){"use strict";var n=e("./_object-dp").f,i=e("./_object-create"),s=e("./_redefine-all"),a=e("./_ctx"),o=e("./_an-instance"),u=e("./_for-of"),l=e("./_iter-define"),c=e("./_iter-step"),p=e("./_set-species"),h=e("./_descriptors"),f=e("./_meta").fastKey,d=e("./_validate-collection"),m=h?"_s":"size",y=function(e,t){var r,n=f(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};t.exports={getConstructor:function(e,t,r,l){var c=e(function(e,n){o(e,c,t,"_i"),e._t=t,e._i=i(null),e._f=void 0,e._l=void 0,e[m]=0,void 0!=n&&u(n,r,e[l],e)});return s(c.prototype,{clear:function(){for(var e=d(this,t),r=e._i,n=e._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete r[n.i];e._f=e._l=void 0,e[m]=0},delete:function(e){var r=d(this,t),n=y(r,e);if(n){var i=n.n,s=n.p;delete r._i[n.i],n.r=!0,s&&(s.n=i),i&&(i.p=s),r._f==n&&(r._f=i),r._l==n&&(r._l=s),r[m]--}return!!n},forEach:function(e){d(this,t);for(var r,n=a(e,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(n(r.v,r.k,this);r&&r.r;)r=r.p},has:function(e){return!!y(d(this,t),e)}}),h&&n(c.prototype,"size",{get:function(){return d(this,t)[m]}}),c},def:function(e,t,r){var n,i,s=y(e,t);return s?s.v=r:(e._l=s={i:i=f(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=s),n&&(n.n=s),e[m]++,"F"!==i&&(e._i[i]=s)),e},getEntry:y,setStrong:function(e,t,r){l(e,t,function(e,r){this._t=d(e,t),this._k=r,this._l=void 0},function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?"keys"==t?c(0,r.k):"values"==t?c(0,r.v):c(0,[r.k,r.v]):(e._t=void 0,c(1))},r?"entries":"values",!r,!0),p(t)}}},{"./_an-instance":210,"./_ctx":224,"./_descriptors":226,"./_for-of":232,"./_iter-define":244,"./_iter-step":245,"./_meta":248,"./_object-create":250,"./_object-dp":251,"./_redefine-all":263,"./_set-species":268,"./_validate-collection":280}],220:[function(e,t,r){var n=e("./_classof"),i=e("./_array-from-iterable");t.exports=function(e){return function(){if(n(this)!=e)throw TypeError(e+"#toJSON isn't generic");return i(this)}}},{"./_array-from-iterable":212,"./_classof":217}],221:[function(e,t,r){"use strict";var n=e("./_redefine-all"),i=e("./_meta").getWeak,s=e("./_an-object"),a=e("./_is-object"),o=e("./_an-instance"),u=e("./_for-of"),l=e("./_array-methods"),c=e("./_has"),p=e("./_validate-collection"),h=l(5),f=l(6),d=0,m=function(e){return e._l||(e._l=new y)},y=function(){this.a=[]},g=function(e,t){return h(e.a,function(e){return e[0]===t})};y.prototype={get:function(e){var t=g(this,e);if(t)return t[1]},has:function(e){return!!g(this,e)},set:function(e,t){var r=g(this,e);r?r[1]=t:this.a.push([e,t])},delete:function(e){var t=f(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},t.exports={getConstructor:function(e,t,r,s){var l=e(function(e,n){o(e,l,t,"_i"),e._t=t,e._i=d++,e._l=void 0,void 0!=n&&u(n,r,e[s],e)});return n(l.prototype,{delete:function(e){if(!a(e))return!1;var r=i(e);return!0===r?m(p(this,t)).delete(e):r&&c(r,this._i)&&delete r[this._i]},has:function(e){if(!a(e))return!1;var r=i(e);return!0===r?m(p(this,t)).has(e):r&&c(r,this._i)}}),l},def:function(e,t,r){var n=i(s(t),!0);return!0===n?m(e).set(t,r):n[e._i]=r,e},ufstore:m}},{"./_an-instance":210,"./_an-object":211,"./_array-methods":214,"./_for-of":232,"./_has":234,"./_is-object":241,"./_meta":248,"./_redefine-all":263,"./_validate-collection":280}],222:[function(e,t,r){"use strict";var n=e("./_global"),i=e("./_export"),s=e("./_meta"),a=e("./_fails"),o=e("./_hide"),u=e("./_redefine-all"),l=e("./_for-of"),c=e("./_an-instance"),p=e("./_is-object"),h=e("./_set-to-string-tag"),f=e("./_object-dp").f,d=e("./_array-methods")(0),m=e("./_descriptors");t.exports=function(e,t,r,y,g,b){var v=n[e],x=v,E=g?"set":"add",A=x&&x.prototype,D={};return m&&"function"==typeof x&&(b||A.forEach&&!a(function(){(new x).entries().next()}))?(x=t(function(t,r){c(t,x,e,"_c"),t._c=new v,void 0!=r&&l(r,g,t[E],t)}),d("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(e){var t="add"==e||"set"==e;e in A&&(!b||"clear"!=e)&&o(x.prototype,e,function(r,n){if(c(this,x,e),!t&&b&&!p(r))return"get"==e&&void 0;var i=this._c[e](0===r?0:r,n);return t?this:i})}),b||f(x.prototype,"size",{get:function(){return this._c.size}})):(x=y.getConstructor(t,e,g,E),u(x.prototype,r),s.NEED=!0),h(x,e),D[e]=x,i(i.G+i.W+i.F,D),b||y.setStrong(x,e,g),x}},{"./_an-instance":210,"./_array-methods":214,"./_descriptors":226,"./_export":230,"./_fails":231,"./_for-of":232,"./_global":233,"./_hide":235,"./_is-object":241,"./_meta":248,"./_object-dp":251,"./_redefine-all":263,"./_set-to-string-tag":269}],223:[function(e,t,r){var n=t.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)},{}],224:[function(e,t,r){var n=e("./_a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":208}],225:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],226:[function(e,t,r){t.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":231}],227:[function(e,t,r){var n=e("./_is-object"),i=e("./_global").document,s=n(i)&&n(i.createElement);t.exports=function(e){return s?i.createElement(e):{}}},{"./_global":233,"./_is-object":241}],228:[function(e,t,r){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],229:[function(e,t,r){var n=e("./_object-keys"),i=e("./_object-gops"),s=e("./_object-pie");t.exports=function(e){var t=n(e),r=i.f;if(r)for(var a,o=r(e),u=s.f,l=0;o.length>l;)u.call(e,a=o[l++])&&t.push(a);return t}},{"./_object-gops":256,"./_object-keys":259,"./_object-pie":260}],230:[function(e,t,r){var n=e("./_global"),i=e("./_core"),s=e("./_ctx"),a=e("./_hide"),o=function(e,t,r){var u,l,c,p=e&o.F,h=e&o.G,f=e&o.S,d=e&o.P,m=e&o.B,y=e&o.W,g=h?i:i[t]||(i[t]={}),b=g.prototype,v=h?n:f?n[t]:(n[t]||{}).prototype;h&&(r=t);for(u in r)(l=!p&&v&&void 0!==v[u])&&u in g||(c=l?v[u]:r[u],g[u]=h&&"function"!=typeof v[u]?r[u]:m&&l?s(c,n):y&&v[u]==c?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(c):d&&"function"==typeof c?s(Function.call,c):c,d&&((g.virtual||(g.virtual={}))[u]=c,e&o.R&&b&&!b[u]&&a(b,u,c)))};o.F=1,o.G=2,o.S=4,o.P=8,o.B=16,o.W=32,o.U=64,o.R=128,t.exports=o},{"./_core":223,"./_ctx":224,"./_global":233,"./_hide":235}],231:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],232:[function(e,t,r){var n=e("./_ctx"),i=e("./_iter-call"),s=e("./_is-array-iter"),a=e("./_an-object"),o=e("./_to-length"),u=e("./core.get-iterator-method"),l={},c={};(r=t.exports=function(e,t,r,p,h){var f,d,m,y,g=h?function(){return e}:u(e),b=n(r,p,t?2:1),v=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(s(g)){for(f=o(e.length);f>v;v++)if((y=t?b(a(d=e[v])[0],d[1]):b(e[v]))===l||y===c)return y}else for(m=g.call(e);!(d=m.next()).done;)if((y=i(m,b,d.value,t))===l||y===c)return y}).BREAK=l,r.RETURN=c},{"./_an-object":211,"./_ctx":224,"./_is-array-iter":239,"./_iter-call":242,"./_to-length":276,"./core.get-iterator-method":284}],233:[function(e,t,r){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],234:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],235:[function(e,t,r){var n=e("./_object-dp"),i=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},{"./_descriptors":226,"./_object-dp":251,"./_property-desc":262}],236:[function(e,t,r){var n=e("./_global").document;t.exports=n&&n.documentElement},{"./_global":233}],237:[function(e,t,r){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return 7!=Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":226,"./_dom-create":227,"./_fails":231}],238:[function(e,t,r){var n=e("./_cof");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},{"./_cof":218}],239:[function(e,t,r){var n=e("./_iterators"),i=e("./_wks")("iterator"),s=Array.prototype;t.exports=function(e){return void 0!==e&&(n.Array===e||s[i]===e)}},{"./_iterators":246,"./_wks":283}],240:[function(e,t,r){var n=e("./_cof");t.exports=Array.isArray||function(e){return"Array"==n(e)}},{"./_cof":218}],241:[function(e,t,r){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],242:[function(e,t,r){var n=e("./_an-object");t.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(t){var s=e.return;throw void 0!==s&&n(s.call(e)),t}}},{"./_an-object":211}],243:[function(e,t,r){"use strict";var n=e("./_object-create"),i=e("./_property-desc"),s=e("./_set-to-string-tag"),a={};e("./_hide")(a,e("./_wks")("iterator"),function(){return this}),t.exports=function(e,t,r){e.prototype=n(a,{next:i(1,r)}),s(e,t+" Iterator")}},{"./_hide":235,"./_object-create":250,"./_property-desc":262,"./_set-to-string-tag":269,"./_wks":283}],244:[function(e,t,r){"use strict";var n=e("./_library"),i=e("./_export"),s=e("./_redefine"),a=e("./_hide"),o=e("./_has"),u=e("./_iterators"),l=e("./_iter-create"),c=e("./_set-to-string-tag"),p=e("./_object-gpo"),h=e("./_wks")("iterator"),f=!([].keys&&"next"in[].keys()),d=function(){return this};t.exports=function(e,t,r,m,y,g,b){l(r,t,m);var v,x,E,A=function(e){if(!f&&e in _)return _[e];switch(e){case"keys":case"values":return function(){return new r(this,e)}}return function(){return new r(this,e)}},D=t+" Iterator",C="values"==y,S=!1,_=e.prototype,w=_[h]||_["@@iterator"]||y&&_[y],k=w||A(y),F=y?C?A("entries"):k:void 0,T="Array"==t?_.entries||w:w;if(T&&(E=p(T.call(new e)))!==Object.prototype&&E.next&&(c(E,D,!0),n||o(E,h)||a(E,h,d)),C&&w&&"values"!==w.name&&(S=!0,k=function(){return w.call(this)}),n&&!b||!f&&!S&&_[h]||a(_,h,k),u[t]=k,u[D]=d,y)if(v={values:C?k:A("values"),keys:g?k:A("keys"),entries:F},b)for(x in v)x in _||s(_,x,v[x]);else i(i.P+i.F*(f||S),t,v);return v}},{"./_export":230,"./_has":234,"./_hide":235,"./_iter-create":243,"./_iterators":246,"./_library":247,"./_object-gpo":257,"./_redefine":264,"./_set-to-string-tag":269,"./_wks":283}],245:[function(e,t,r){t.exports=function(e,t){return{value:t,done:!!e}}},{}],246:[function(e,t,r){t.exports={}},{}],247:[function(e,t,r){t.exports=!0},{}],248:[function(e,t,r){var n=e("./_uid")("meta"),i=e("./_is-object"),s=e("./_has"),a=e("./_object-dp").f,o=0,u=Object.isExtensible||function(){return!0},l=!e("./_fails")(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,n,{value:{i:"O"+ ++o,w:{}}})},p=t.exports={KEY:n,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,n)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[n].i},getWeak:function(e,t){if(!s(e,n)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[n].w},onFreeze:function(e){return l&&p.NEED&&u(e)&&!s(e,n)&&c(e),e}}},{"./_fails":231,"./_has":234,"./_is-object":241,"./_object-dp":251,"./_uid":279}],249:[function(e,t,r){"use strict";var n=e("./_object-keys"),i=e("./_object-gops"),s=e("./_object-pie"),a=e("./_to-object"),o=e("./_iobject"),u=Object.assign;t.exports=!u||e("./_fails")(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n})?function(e,t){for(var r=a(e),u=arguments.length,l=1,c=i.f,p=s.f;u>l;)for(var h,f=o(arguments[l++]),d=c?n(f).concat(c(f)):n(f),m=d.length,y=0;m>y;)p.call(f,h=d[y++])&&(r[h]=f[h]);return r}:u},{"./_fails":231,"./_iobject":238,"./_object-gops":256,"./_object-keys":259,"./_object-pie":260,"./_to-object":277}],250:[function(e,t,r){var n=e("./_an-object"),i=e("./_object-dps"),s=e("./_enum-bug-keys"),a=e("./_shared-key")("IE_PROTO"),o=function(){},u=function(){var t,r=e("./_dom-create")("iframe"),n=s.length;for(r.style.display="none",e("./_html").appendChild(r),r.src="javascript:",(t=r.contentWindow.document).open(),t.write("