diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 41b5b1b8..ec978060 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Cached node_modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: node_modules key: ${{ runner.os }}-node-${{ hashFiles('**/package*.json') }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 08fec423..ac752c37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.15.1 +* Turn new angular templating off by default in html ([#2247](https://github.com/beautifier/js-beautify/pull/2247)) +* Perf regression in latest release (1.15.0) ([#2246](https://github.com/beautifier/js-beautify/issues/2246)) + ## v1.15.0 * Fixed #2219 - formatting of new Angular control flow syntax ([#2221](https://github.com/beautifier/js-beautify/pull/2221)) diff --git a/README.md b/README.md index 58e5943c..d7a583a4 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,13 @@ JS Beautifier is hosted on two CDN services: [cdnjs](https://cdnjs.com/libraries To pull the latest version from one of these services include one set of the script tags below in your document: ```html - - - + + + - - - + + + ``` Example usage of a JS tag in html: @@ -76,7 +76,7 @@ Example usage of a JS tag in html: . . . - + @@ -434,4 +434,4 @@ Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, D Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull, Mathias Bynens, Vittorio Gambaletta and others. -(README.md: js-beautify@1.15.0) +(README.md: js-beautify@1.15.1) diff --git a/js/lib/beautifier.js b/js/lib/beautifier.js index 0b389f6f..8c69e219 100644 --- a/js/lib/beautifier.js +++ b/js/lib/beautifier.js @@ -2316,9 +2316,9 @@ function Options(options, merge_child_field) { this.indent_empty_lines = this._get_boolean('indent_empty_lines'); // valid templating languages ['django', 'erb', 'handlebars', 'php', 'smarty', 'angular'] - // For now, 'auto' = all off for javascript, all on for html (and inline javascript). + // For now, 'auto' = all off for javascript, all except angular on for html (and inline javascript/css). // other values ignored - this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php', 'smarty', 'angular'], ['auto']); + this.templating = this._get_selection_list('templating', ['auto', 'none', 'angular', 'django', 'erb', 'handlebars', 'php', 'smarty'], ['auto']); } Options.prototype._get_array = function(name, default_value) { @@ -5633,7 +5633,7 @@ var BaseOptions = (__webpack_require__(7).Options); function Options(options) { BaseOptions.call(this, options, 'html'); if (this.templating.length === 1 && this.templating[0] === 'auto') { - this.templating = ['django', 'erb', 'handlebars', 'php', 'angular']; + this.templating = ['django', 'erb', 'handlebars', 'php']; } this.indent_inner_html = this._get_boolean('indent_inner_html'); diff --git a/js/lib/beautifier.js.map b/js/lib/beautifier.js.map index f3bbed3a..539c8deb 100644 --- a/js/lib/beautifier.js.map +++ b/js/lib/beautifier.js.map @@ -1 +1 @@ -{"version":3,"file":"beautifier.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;ACVA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,kBAAkB,mBAAO,CAAC,CAAoB;AAC9C,mBAAmB,mBAAO,CAAC,EAAa;AACxC,oBAAoB,mBAAO,CAAC,EAAc;;AAE1C;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;AACjB,kBAAkB;AAClB,mBAAmB;;;;;;;AC3CnB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,iBAAiB,mCAAkC;AACnD,YAAY,gCAA4B;;AAExC;AACA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B;AACA;;;;;;;ACzCA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,aAAa,+BAAgC;AAC7C,YAAY,8BAA8B;AAC1C,YAAY,mBAAO,CAAC,CAAS;AAC7B,cAAc,gCAA4B;AAC1C,gBAAgB,kCAAgC;AAChD,oBAAoB,sCAAoC;AACxD,6BAA6B,+CAA6C;AAC1E,YAAY,8BAA4B;;;AAGxC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS,SAAS;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,cAAc,uBAAuB;AAChF;AACA;AACA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,6BAA6B;AAC7B;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;AACA,iFAAiF;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,cAAc;AACtC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,gCAAgC,UAAU;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4GAA4G;AAC5G;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,oBAAoB;AACpB,qBAAqB,QAAQ,eAAe;AAC5C,qBAAqB,UAAU,eAAe;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,wCAAwC;AACxC,uEAAuE;AACvE;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF;AACxF;AACA;AACA;;AAEA,wCAAwC;AACxC;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,WAAW;AACX;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ,6CAA6C;AAC7C;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,0EAA0E;AAC1E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI,OAAO;AACX;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,mDAAmD;AACnD;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,eAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4DAA4D,UAAU;AACtE;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iDAAiD,KAAK;AACtD,iGAAiG;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA,sFAAsF;AACtF;AACA,IAAI;AACJ;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,4CAA4C;AAC5C,4BAA4B;AAC5B;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,8BAA8B;AAC9B;AACA,UAAU;AACV;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI,wIAAwI;AAC5I,0BAA0B,IAAI;AAC9B,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA,UAAU;AACV;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAA0C;AAC1C,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,yCAAyC,uCAAuC;AAChF,WAAW,KAAK;AAChB,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB;;;;;;;ACv8CzB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA,wDAAwD,wBAAwB;AAChF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;;;;;;;AClarB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+BAA+B;;;AAG/B,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,oBAAoB;;;;;;;ACrDpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;AAGa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAiD,EAAE,SAAS,eAAe;AAC3E;AACA;;AAEA,kBAAkB;AAClB,uBAAuB;AACvB,uBAAuB;;AAEvB,gFAAgF;;AAEhF;;AAEA,eAAe;;AAEf;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB,qBAAqB;;;;;;;ACzDrB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,kBAAkB,gCAAkC;;AAEpD;;AAEA;AACA;;AAEA;AACA;AACA,6CAA6C;AAC7C;AACA,IAAI,2DAA2D;AAC/D;AACA,IAAI,8DAA8D;AAClE;AACA,SAAS,6BAA6B;AACtC;AACA;;AAEA;AACA;;AAEA;;AAEA,sCAAsC;AACtC;;AAEA,mBAAmB,+BAA+B;AAClD;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;AAIA,sBAAsB;;;;;;;AC5FtB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kCAAkC,6CAA6C;AAC/E;;;AAGA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB;AACtB,4BAA4B;AAC5B,wBAAwB;;;;;;;AChMxB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,mBAAmB,qCAA4C;AAC/D,oBAAoB,mCAAsC;AAC1D,gBAAgB,+BAAkC;AAClD,iBAAiB,oCAAwC;AACzD,YAAY,mBAAO,CAAC,CAAS;AAC7B,cAAc,iCAAkC;AAChD,yBAAyB,4CAAwD;;;AAGjF;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8BAA8B;AAC9B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,GAAG,IAAI,6BAA6B,GAAG,IAAI,iEAAiE,KAAK,GAAG,GAAG,IAAI,IAAI;AAClM;AACA;AACA;AACA,+CAA+C;AAC/C;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gCAAgC,2BAA2B;AAC3D;;AAEA;AACA;AACA;;AAEA,6EAA6E;AAC7E;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,4DAA4D,uCAAuC;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF;AACxF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI,iBAAiB;AACrB;AACA,IAAI,iBAAiB;AACrB;AACA,IAAI,iBAAiB;AACrB;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B;AAC3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ,kCAAkC,+BAA+B;AACzE,oBAAoB;AACpB;AACA;AACA;AACA;AACA;;AAEA;;AAEA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oEAAoE;AACpE,MAAM;AACN;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,QAAQ,gBAAgB,MAAM;AACtE,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,QAAQ,gBAAgB,MAAM;AACnG;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,oCAAoC,EAAE;AACtC;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAkD,EAAE;AACpD,QAAQ;AACR,kDAAkD,EAAE;AACpD;AACA,yCAAyC,gBAAgB;AACzD;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI,yBAAyB;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN,2BAA2B,8CAA8C;AACzE;AACA;;AAEA;AACA;AACA,gDAAgD;AAChD,UAAU;AACV,gFAAgF;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,wBAAwB;AACxB,oBAAoB;AACpB,qCAAqC;AACrC,4BAA4B;;;;;;;ACzkB5B;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE;AAChE;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA,4DAA4D;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B;;;;;;;AC/L3B;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,mBAAmB,qCAA4C;AAC/D,YAAY,8BAA8B;AAC1C,kBAAkB,qCAA0C;AAC5D,wBAAwB,2CAAgD;;AAExE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA,6EAA6E;AAC7E;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA,4DAA4D;AAC5D;AACA;;AAEA,4DAA4D;AAC5D;AACA;;AAEA,wEAAwE;AACxE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA,wBAAwB;AACxB,oBAAoB;;;;;;;AC3IpB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;;;;;;;AC7E1B;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,cAAc,iCAAkC;;AAEhD;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;;;AAIA,gCAAgC;;;;;;;ACxGhC;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,sBAAsB;;;;;;;AC7FtB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA,yBAAyB;;;;;;;AC7DzB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,cAAc,iCAA4B;;;AAG1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,uBAAuB;AACxE,oDAAoD,mBAAmB;AACvE,yCAAyC,kBAAkB;AAC3D;AACA;AACA;AACA,oCAAoC,mBAAmB;AACvD,2CAA2C,kBAAkB;AAC7D,4CAA4C,mBAAmB;AAC/D,oCAAoC,OAAO,8BAA8B;AACzE,4CAA4C,qBAAqB;AACjE,4CAA4C,QAAQ,iBAAiB,UAAU;AAC/E;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iBAAiB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,iCAAiC;;;;;;;ACnNjC;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,iBAAiB,oCAAkC;AACnD,YAAY,iCAA4B;;AAExC;AACA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B;AACA;;;;;;;ACzCA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,cAAc,iCAA4B;AAC1C,aAAa,+BAAgC;AAC7C,mBAAmB,qCAA4C;AAC/D,iBAAiB,oCAAwC;;AAEzD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,MAAM,kBAAkB,cAAc;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;;AAEA;;AAEA;AACA,wDAAwD;;AAExD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA,0CAA0C;AAC1C,mCAAmC;AACnC,sDAAsD;AACtD,QAAQ;AACR;;AAEA;AACA,gEAAgE;;AAEhE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA,MAAM,sDAAsD;AAC5D;AACA,oDAAoD;AACpD,MAAM,wBAAwB;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,oFAAoF;AACpF;AACA;AACA;;AAEA;;AAEA,sFAAsF;AACtF;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,wBAAwB;AAC9B;AACA;AACA,4BAA4B;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN,sBAAsB,gDAAgD;AACtE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,MAAM,wBAAwB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,MAAM,6BAA6B;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA,MAAM,6BAA6B;AACnC;AACA;AACA;AACA;AACA;AACA,MAAM,4DAA4D;AAClE;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,yBAAyB;;;;;;;ACliBzB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,kBAAkB,gCAAkC;;AAEpD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,+BAA+B;AAClD;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;;;AAIA,sBAAsB;;;;;;;ACvDtB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,iBAAiB,oCAAkC;AACnD,YAAY,iCAA4B;;AAExC;AACA;AACA;AACA;;AAEA;AACA,6BAA6B;AAC7B;AACA;;;;;;;ACzCA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,cAAc,iCAAkC;AAChD,aAAa,+BAAgC;AAC7C,gBAAgB,mCAAsC;AACtD,YAAY,+BAAkC;;AAE9C;AACA;;AAEA,sDAAsD;;AAEtD;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,yDAAyD;AACzD;AACA;AACA;;AAEA,sDAAsD;AACtD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,gEAAgE;AAChE;;AAEA,kBAAkB;AAClB,8CAA8C;AAC9C;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,wDAAwD;AACxD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA,uEAAuE;AACvE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI,6CAA6C;AACjD;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA,MAAM,4CAA4C;AAClD;AACA,MAAM,uFAAuF;AAC7F;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN,iDAAiD,sBAAsB;AACvE;;AAEA,mBAAmB,cAAc,QAAQ,eAAe;AACxD,wCAAwC,qCAAqC;AAC7E;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gDAAgD,WAAW;AAC3D;AACA,kCAAkC;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA,iCAAiC;AACjC;AACA;;AAEA,iEAAiE;AACjE;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,+MAA+M;;AAE/M;AACA;;AAEA;;AAEA;AACA,mCAAmC;AACnC,qFAAqF;AACrF,MAAM,OAAO;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gDAAgD;;AAEhD;AACA;AACA;AACA;AACA;AACA;;AAEA,sEAAsE;AACtE;AACA;AACA;AACA;AACA;;AAEA,uCAAuC;;AAEvC;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,0CAA0C,MAAM;AAChD,mEAAmE;AACnE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,IAAI,oCAAoC;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI,OAAO;AACX;;AAEA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,QAAQ;AACR;;AAEA,IAAI;AACJ;AACA;;AAEA,IAAI;AACJ;AACA;AACA;AACA;;;AAGA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA,IAAI;AACJ;AACA;AACA;AACA;;AAEA,IAAI;AACJ;AACA;;AAEA,IAAI;AACJ;AACA;AACA;;AAEA,IAAI;AACJ;AACA;AACA;AACA;;AAEA,QAAQ;AACR;;AAEA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ;AACR;;AAEA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,yBAAyB;;;;;;;ACt5BzB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,kBAAkB,gCAAkC;;AAEpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;AAIA,sBAAsB;;;;;;;AC5FtB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,oBAAoB,mCAAsC;AAC1D,gBAAgB,+BAAkC;AAClD,iBAAiB,oCAAwC;AACzD,yBAAyB,4CAAwD;AACjF,cAAc,iCAAkC;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,0EAA0E;AAC1E;AACA;AACA;AACA;;AAEA,wEAAwE,KAAK;AAC7E,wDAAwD,uBAAuB;AAC/E,gDAAgD,kBAAkB;AAClE,oDAAoD;AACpD,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4DAA4D;AAC5D,gBAAgB;AAChB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAiC,8BAA8B,8BAA8B;AAC7F;AACA,8BAA8B,gCAAgC;AAC9D;;AAEA;AACA;AACA;;AAEA,6EAA6E;AAC7E;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,2DAA2D;AAC3D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,qDAAqD;AACrD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mDAAmD,+BAA+B;AAClF;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,aAAa;AAC9B,yCAAyC;AACzC;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,IAAI,iBAAiB;AACrB;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA,MAAM,kCAAkC,aAAa,+BAA+B;AACpF;AACA;AACA,qDAAqD;AACrD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,kFAAkF;AAClF;AACA,6CAA6C;AAC7C;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;;AAEN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB;AACxB,oBAAoB;;;;;;UCxXpB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://beautifier/webpack/universalModuleDefinition","webpack://beautifier/./js/src/index.js","webpack://beautifier/./js/src/javascript/index.js","webpack://beautifier/./js/src/javascript/beautifier.js","webpack://beautifier/./js/src/core/output.js","webpack://beautifier/./js/src/core/token.js","webpack://beautifier/./js/src/javascript/acorn.js","webpack://beautifier/./js/src/javascript/options.js","webpack://beautifier/./js/src/core/options.js","webpack://beautifier/./js/src/javascript/tokenizer.js","webpack://beautifier/./js/src/core/inputscanner.js","webpack://beautifier/./js/src/core/tokenizer.js","webpack://beautifier/./js/src/core/tokenstream.js","webpack://beautifier/./js/src/core/whitespacepattern.js","webpack://beautifier/./js/src/core/pattern.js","webpack://beautifier/./js/src/core/directives.js","webpack://beautifier/./js/src/core/templatablepattern.js","webpack://beautifier/./js/src/css/index.js","webpack://beautifier/./js/src/css/beautifier.js","webpack://beautifier/./js/src/css/options.js","webpack://beautifier/./js/src/html/index.js","webpack://beautifier/./js/src/html/beautifier.js","webpack://beautifier/./js/src/html/options.js","webpack://beautifier/./js/src/html/tokenizer.js","webpack://beautifier/webpack/bootstrap","webpack://beautifier/webpack/before-startup","webpack://beautifier/webpack/startup","webpack://beautifier/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"beautifier\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"beautifier\"] = factory();\n\telse\n\t\troot[\"beautifier\"] = factory();\n})(typeof self !== 'undefined' ? self : typeof windows !== 'undefined' ? window : typeof global !== 'undefined' ? global : this, function() {\nreturn ","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar js_beautify = require('./javascript/index');\nvar css_beautify = require('./css/index');\nvar html_beautify = require('./html/index');\n\nfunction style_html(html_source, options, js, css) {\n js = js || js_beautify;\n css = css || css_beautify;\n return html_beautify(html_source, options, js, css);\n}\nstyle_html.defaultOptions = html_beautify.defaultOptions;\n\nmodule.exports.js = js_beautify;\nmodule.exports.css = css_beautify;\nmodule.exports.html = style_html;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar Beautifier = require('./beautifier').Beautifier,\n Options = require('./options').Options;\n\nfunction js_beautify(js_source_text, options) {\n var beautifier = new Beautifier(js_source_text, options);\n return beautifier.beautify();\n}\n\nmodule.exports = js_beautify;\nmodule.exports.defaultOptions = function() {\n return new Options();\n};\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar Output = require('../core/output').Output;\nvar Token = require('../core/token').Token;\nvar acorn = require('./acorn');\nvar Options = require('./options').Options;\nvar Tokenizer = require('./tokenizer').Tokenizer;\nvar line_starters = require('./tokenizer').line_starters;\nvar positionable_operators = require('./tokenizer').positionable_operators;\nvar TOKEN = require('./tokenizer').TOKEN;\n\n\nfunction in_array(what, arr) {\n return arr.indexOf(what) !== -1;\n}\n\nfunction ltrim(s) {\n return s.replace(/^\\s+/g, '');\n}\n\nfunction generateMapFromStrings(list) {\n var result = {};\n for (var x = 0; x < list.length; x++) {\n // make the mapped names underscored instead of dash\n result[list[x].replace(/-/g, '_')] = list[x];\n }\n return result;\n}\n\nfunction reserved_word(token, word) {\n return token && token.type === TOKEN.RESERVED && token.text === word;\n}\n\nfunction reserved_array(token, words) {\n return token && token.type === TOKEN.RESERVED && in_array(token.text, words);\n}\n// Unsure of what they mean, but they work. Worth cleaning up in future.\nvar special_words = ['case', 'return', 'do', 'if', 'throw', 'else', 'await', 'break', 'continue', 'async'];\n\nvar validPositionValues = ['before-newline', 'after-newline', 'preserve-newline'];\n\n// Generate map from array\nvar OPERATOR_POSITION = generateMapFromStrings(validPositionValues);\n\nvar OPERATOR_POSITION_BEFORE_OR_PRESERVE = [OPERATOR_POSITION.before_newline, OPERATOR_POSITION.preserve_newline];\n\nvar MODE = {\n BlockStatement: 'BlockStatement', // 'BLOCK'\n Statement: 'Statement', // 'STATEMENT'\n ObjectLiteral: 'ObjectLiteral', // 'OBJECT',\n ArrayLiteral: 'ArrayLiteral', //'[EXPRESSION]',\n ForInitializer: 'ForInitializer', //'(FOR-EXPRESSION)',\n Conditional: 'Conditional', //'(COND-EXPRESSION)',\n Expression: 'Expression' //'(EXPRESSION)'\n};\n\nfunction remove_redundant_indentation(output, frame) {\n // This implementation is effective but has some issues:\n // - can cause line wrap to happen too soon due to indent removal\n // after wrap points are calculated\n // These issues are minor compared to ugly indentation.\n\n if (frame.multiline_frame ||\n frame.mode === MODE.ForInitializer ||\n frame.mode === MODE.Conditional) {\n return;\n }\n\n // remove one indent from each line inside this section\n output.remove_indent(frame.start_line_index);\n}\n\n// we could use just string.split, but\n// IE doesn't like returning empty strings\nfunction split_linebreaks(s) {\n //return s.split(/\\x0d\\x0a|\\x0a/);\n\n s = s.replace(acorn.allLineBreaks, '\\n');\n var out = [],\n idx = s.indexOf(\"\\n\");\n while (idx !== -1) {\n out.push(s.substring(0, idx));\n s = s.substring(idx + 1);\n idx = s.indexOf(\"\\n\");\n }\n if (s.length) {\n out.push(s);\n }\n return out;\n}\n\nfunction is_array(mode) {\n return mode === MODE.ArrayLiteral;\n}\n\nfunction is_expression(mode) {\n return in_array(mode, [MODE.Expression, MODE.ForInitializer, MODE.Conditional]);\n}\n\nfunction all_lines_start_with(lines, c) {\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i].trim();\n if (line.charAt(0) !== c) {\n return false;\n }\n }\n return true;\n}\n\nfunction each_line_matches_indent(lines, indent) {\n var i = 0,\n len = lines.length,\n line;\n for (; i < len; i++) {\n line = lines[i];\n // allow empty lines to pass through\n if (line && line.indexOf(indent) !== 0) {\n return false;\n }\n }\n return true;\n}\n\n\nfunction Beautifier(source_text, options) {\n options = options || {};\n this._source_text = source_text || '';\n\n this._output = null;\n this._tokens = null;\n this._last_last_text = null;\n this._flags = null;\n this._previous_flags = null;\n\n this._flag_store = null;\n this._options = new Options(options);\n}\n\nBeautifier.prototype.create_flags = function(flags_base, mode) {\n var next_indent_level = 0;\n if (flags_base) {\n next_indent_level = flags_base.indentation_level;\n if (!this._output.just_added_newline() &&\n flags_base.line_indent_level > next_indent_level) {\n next_indent_level = flags_base.line_indent_level;\n }\n }\n\n var next_flags = {\n mode: mode,\n parent: flags_base,\n last_token: flags_base ? flags_base.last_token : new Token(TOKEN.START_BLOCK, ''), // last token text\n last_word: flags_base ? flags_base.last_word : '', // last TOKEN.WORD passed\n declaration_statement: false,\n declaration_assignment: false,\n multiline_frame: false,\n inline_frame: false,\n if_block: false,\n else_block: false,\n class_start_block: false, // class A { INSIDE HERE } or class B extends C { INSIDE HERE }\n do_block: false,\n do_while: false,\n import_block: false,\n in_case_statement: false, // switch(..){ INSIDE HERE }\n in_case: false, // we're on the exact line with \"case 0:\"\n case_body: false, // the indented case-action block\n case_block: false, // the indented case-action block is wrapped with {}\n indentation_level: next_indent_level,\n alignment: 0,\n line_indent_level: flags_base ? flags_base.line_indent_level : next_indent_level,\n start_line_index: this._output.get_line_number(),\n ternary_depth: 0\n };\n return next_flags;\n};\n\nBeautifier.prototype._reset = function(source_text) {\n var baseIndentString = source_text.match(/^[\\t ]*/)[0];\n\n this._last_last_text = ''; // pre-last token text\n this._output = new Output(this._options, baseIndentString);\n\n // If testing the ignore directive, start with output disable set to true\n this._output.raw = this._options.test_output_raw;\n\n\n // Stack of parsing/formatting states, including MODE.\n // We tokenize, parse, and output in an almost purely a forward-only stream of token input\n // and formatted output. This makes the beautifier less accurate than full parsers\n // but also far more tolerant of syntax errors.\n //\n // For example, the default mode is MODE.BlockStatement. If we see a '{' we push a new frame of type\n // MODE.BlockStatement on the the stack, even though it could be object literal. If we later\n // encounter a \":\", we'll switch to to MODE.ObjectLiteral. If we then see a \";\",\n // most full parsers would die, but the beautifier gracefully falls back to\n // MODE.BlockStatement and continues on.\n this._flag_store = [];\n this.set_mode(MODE.BlockStatement);\n var tokenizer = new Tokenizer(source_text, this._options);\n this._tokens = tokenizer.tokenize();\n return source_text;\n};\n\nBeautifier.prototype.beautify = function() {\n // if disabled, return the input unchanged.\n if (this._options.disabled) {\n return this._source_text;\n }\n\n var sweet_code;\n var source_text = this._reset(this._source_text);\n\n var eol = this._options.eol;\n if (this._options.eol === 'auto') {\n eol = '\\n';\n if (source_text && acorn.lineBreak.test(source_text || '')) {\n eol = source_text.match(acorn.lineBreak)[0];\n }\n }\n\n var current_token = this._tokens.next();\n while (current_token) {\n this.handle_token(current_token);\n\n this._last_last_text = this._flags.last_token.text;\n this._flags.last_token = current_token;\n\n current_token = this._tokens.next();\n }\n\n sweet_code = this._output.get_code(eol);\n\n return sweet_code;\n};\n\nBeautifier.prototype.handle_token = function(current_token, preserve_statement_flags) {\n if (current_token.type === TOKEN.START_EXPR) {\n this.handle_start_expr(current_token);\n } else if (current_token.type === TOKEN.END_EXPR) {\n this.handle_end_expr(current_token);\n } else if (current_token.type === TOKEN.START_BLOCK) {\n this.handle_start_block(current_token);\n } else if (current_token.type === TOKEN.END_BLOCK) {\n this.handle_end_block(current_token);\n } else if (current_token.type === TOKEN.WORD) {\n this.handle_word(current_token);\n } else if (current_token.type === TOKEN.RESERVED) {\n this.handle_word(current_token);\n } else if (current_token.type === TOKEN.SEMICOLON) {\n this.handle_semicolon(current_token);\n } else if (current_token.type === TOKEN.STRING) {\n this.handle_string(current_token);\n } else if (current_token.type === TOKEN.EQUALS) {\n this.handle_equals(current_token);\n } else if (current_token.type === TOKEN.OPERATOR) {\n this.handle_operator(current_token);\n } else if (current_token.type === TOKEN.COMMA) {\n this.handle_comma(current_token);\n } else if (current_token.type === TOKEN.BLOCK_COMMENT) {\n this.handle_block_comment(current_token, preserve_statement_flags);\n } else if (current_token.type === TOKEN.COMMENT) {\n this.handle_comment(current_token, preserve_statement_flags);\n } else if (current_token.type === TOKEN.DOT) {\n this.handle_dot(current_token);\n } else if (current_token.type === TOKEN.EOF) {\n this.handle_eof(current_token);\n } else if (current_token.type === TOKEN.UNKNOWN) {\n this.handle_unknown(current_token, preserve_statement_flags);\n } else {\n this.handle_unknown(current_token, preserve_statement_flags);\n }\n};\n\nBeautifier.prototype.handle_whitespace_and_comments = function(current_token, preserve_statement_flags) {\n var newlines = current_token.newlines;\n var keep_whitespace = this._options.keep_array_indentation && is_array(this._flags.mode);\n\n if (current_token.comments_before) {\n var comment_token = current_token.comments_before.next();\n while (comment_token) {\n // The cleanest handling of inline comments is to treat them as though they aren't there.\n // Just continue formatting and the behavior should be logical.\n // Also ignore unknown tokens. Again, this should result in better behavior.\n this.handle_whitespace_and_comments(comment_token, preserve_statement_flags);\n this.handle_token(comment_token, preserve_statement_flags);\n comment_token = current_token.comments_before.next();\n }\n }\n\n if (keep_whitespace) {\n for (var i = 0; i < newlines; i += 1) {\n this.print_newline(i > 0, preserve_statement_flags);\n }\n } else {\n if (this._options.max_preserve_newlines && newlines > this._options.max_preserve_newlines) {\n newlines = this._options.max_preserve_newlines;\n }\n\n if (this._options.preserve_newlines) {\n if (newlines > 1) {\n this.print_newline(false, preserve_statement_flags);\n for (var j = 1; j < newlines; j += 1) {\n this.print_newline(true, preserve_statement_flags);\n }\n }\n }\n }\n\n};\n\nvar newline_restricted_tokens = ['async', 'break', 'continue', 'return', 'throw', 'yield'];\n\nBeautifier.prototype.allow_wrap_or_preserved_newline = function(current_token, force_linewrap) {\n force_linewrap = (force_linewrap === undefined) ? false : force_linewrap;\n\n // Never wrap the first token on a line\n if (this._output.just_added_newline()) {\n return;\n }\n\n var shouldPreserveOrForce = (this._options.preserve_newlines && current_token.newlines) || force_linewrap;\n var operatorLogicApplies = in_array(this._flags.last_token.text, positionable_operators) ||\n in_array(current_token.text, positionable_operators);\n\n if (operatorLogicApplies) {\n var shouldPrintOperatorNewline = (\n in_array(this._flags.last_token.text, positionable_operators) &&\n in_array(this._options.operator_position, OPERATOR_POSITION_BEFORE_OR_PRESERVE)\n ) ||\n in_array(current_token.text, positionable_operators);\n shouldPreserveOrForce = shouldPreserveOrForce && shouldPrintOperatorNewline;\n }\n\n if (shouldPreserveOrForce) {\n this.print_newline(false, true);\n } else if (this._options.wrap_line_length) {\n if (reserved_array(this._flags.last_token, newline_restricted_tokens)) {\n // These tokens should never have a newline inserted\n // between them and the following expression.\n return;\n }\n this._output.set_wrap_point();\n }\n};\n\nBeautifier.prototype.print_newline = function(force_newline, preserve_statement_flags) {\n if (!preserve_statement_flags) {\n if (this._flags.last_token.text !== ';' && this._flags.last_token.text !== ',' && this._flags.last_token.text !== '=' && (this._flags.last_token.type !== TOKEN.OPERATOR || this._flags.last_token.text === '--' || this._flags.last_token.text === '++')) {\n var next_token = this._tokens.peek();\n while (this._flags.mode === MODE.Statement &&\n !(this._flags.if_block && reserved_word(next_token, 'else')) &&\n !this._flags.do_block) {\n this.restore_mode();\n }\n }\n }\n\n if (this._output.add_new_line(force_newline)) {\n this._flags.multiline_frame = true;\n }\n};\n\nBeautifier.prototype.print_token_line_indentation = function(current_token) {\n if (this._output.just_added_newline()) {\n if (this._options.keep_array_indentation &&\n current_token.newlines &&\n (current_token.text === '[' || is_array(this._flags.mode))) {\n this._output.current_line.set_indent(-1);\n this._output.current_line.push(current_token.whitespace_before);\n this._output.space_before_token = false;\n } else if (this._output.set_indent(this._flags.indentation_level, this._flags.alignment)) {\n this._flags.line_indent_level = this._flags.indentation_level;\n }\n }\n};\n\nBeautifier.prototype.print_token = function(current_token) {\n if (this._output.raw) {\n this._output.add_raw_token(current_token);\n return;\n }\n\n if (this._options.comma_first && current_token.previous && current_token.previous.type === TOKEN.COMMA &&\n this._output.just_added_newline()) {\n if (this._output.previous_line.last() === ',') {\n var popped = this._output.previous_line.pop();\n // if the comma was already at the start of the line,\n // pull back onto that line and reprint the indentation\n if (this._output.previous_line.is_empty()) {\n this._output.previous_line.push(popped);\n this._output.trim(true);\n this._output.current_line.pop();\n this._output.trim();\n }\n\n // add the comma in front of the next token\n this.print_token_line_indentation(current_token);\n this._output.add_token(',');\n this._output.space_before_token = true;\n }\n }\n\n this.print_token_line_indentation(current_token);\n this._output.non_breaking_space = true;\n this._output.add_token(current_token.text);\n if (this._output.previous_token_wrapped) {\n this._flags.multiline_frame = true;\n }\n};\n\nBeautifier.prototype.indent = function() {\n this._flags.indentation_level += 1;\n this._output.set_indent(this._flags.indentation_level, this._flags.alignment);\n};\n\nBeautifier.prototype.deindent = function() {\n if (this._flags.indentation_level > 0 &&\n ((!this._flags.parent) || this._flags.indentation_level > this._flags.parent.indentation_level)) {\n this._flags.indentation_level -= 1;\n this._output.set_indent(this._flags.indentation_level, this._flags.alignment);\n }\n};\n\nBeautifier.prototype.set_mode = function(mode) {\n if (this._flags) {\n this._flag_store.push(this._flags);\n this._previous_flags = this._flags;\n } else {\n this._previous_flags = this.create_flags(null, mode);\n }\n\n this._flags = this.create_flags(this._previous_flags, mode);\n this._output.set_indent(this._flags.indentation_level, this._flags.alignment);\n};\n\n\nBeautifier.prototype.restore_mode = function() {\n if (this._flag_store.length > 0) {\n this._previous_flags = this._flags;\n this._flags = this._flag_store.pop();\n if (this._previous_flags.mode === MODE.Statement) {\n remove_redundant_indentation(this._output, this._previous_flags);\n }\n this._output.set_indent(this._flags.indentation_level, this._flags.alignment);\n }\n};\n\nBeautifier.prototype.start_of_object_property = function() {\n return this._flags.parent.mode === MODE.ObjectLiteral && this._flags.mode === MODE.Statement && (\n (this._flags.last_token.text === ':' && this._flags.ternary_depth === 0) || (reserved_array(this._flags.last_token, ['get', 'set'])));\n};\n\nBeautifier.prototype.start_of_statement = function(current_token) {\n var start = false;\n start = start || reserved_array(this._flags.last_token, ['var', 'let', 'const']) && current_token.type === TOKEN.WORD;\n start = start || reserved_word(this._flags.last_token, 'do');\n start = start || (!(this._flags.parent.mode === MODE.ObjectLiteral && this._flags.mode === MODE.Statement)) && reserved_array(this._flags.last_token, newline_restricted_tokens) && !current_token.newlines;\n start = start || reserved_word(this._flags.last_token, 'else') &&\n !(reserved_word(current_token, 'if') && !current_token.comments_before);\n start = start || (this._flags.last_token.type === TOKEN.END_EXPR && (this._previous_flags.mode === MODE.ForInitializer || this._previous_flags.mode === MODE.Conditional));\n start = start || (this._flags.last_token.type === TOKEN.WORD && this._flags.mode === MODE.BlockStatement &&\n !this._flags.in_case &&\n !(current_token.text === '--' || current_token.text === '++') &&\n this._last_last_text !== 'function' &&\n current_token.type !== TOKEN.WORD && current_token.type !== TOKEN.RESERVED);\n start = start || (this._flags.mode === MODE.ObjectLiteral && (\n (this._flags.last_token.text === ':' && this._flags.ternary_depth === 0) || reserved_array(this._flags.last_token, ['get', 'set'])));\n\n if (start) {\n this.set_mode(MODE.Statement);\n this.indent();\n\n this.handle_whitespace_and_comments(current_token, true);\n\n // Issue #276:\n // If starting a new statement with [if, for, while, do], push to a new line.\n // if (a) if (b) if(c) d(); else e(); else f();\n if (!this.start_of_object_property()) {\n this.allow_wrap_or_preserved_newline(current_token,\n reserved_array(current_token, ['do', 'for', 'if', 'while']));\n }\n return true;\n }\n return false;\n};\n\nBeautifier.prototype.handle_start_expr = function(current_token) {\n // The conditional starts the statement if appropriate.\n if (!this.start_of_statement(current_token)) {\n this.handle_whitespace_and_comments(current_token);\n }\n\n var next_mode = MODE.Expression;\n if (current_token.text === '[') {\n\n if (this._flags.last_token.type === TOKEN.WORD || this._flags.last_token.text === ')') {\n // this is array index specifier, break immediately\n // a[x], fn()[x]\n if (reserved_array(this._flags.last_token, line_starters)) {\n this._output.space_before_token = true;\n }\n this.print_token(current_token);\n this.set_mode(next_mode);\n this.indent();\n if (this._options.space_in_paren) {\n this._output.space_before_token = true;\n }\n return;\n }\n\n next_mode = MODE.ArrayLiteral;\n if (is_array(this._flags.mode)) {\n if (this._flags.last_token.text === '[' ||\n (this._flags.last_token.text === ',' && (this._last_last_text === ']' || this._last_last_text === '}'))) {\n // ], [ goes to new line\n // }, [ goes to new line\n if (!this._options.keep_array_indentation) {\n this.print_newline();\n }\n }\n }\n\n if (!in_array(this._flags.last_token.type, [TOKEN.START_EXPR, TOKEN.END_EXPR, TOKEN.WORD, TOKEN.OPERATOR, TOKEN.DOT])) {\n this._output.space_before_token = true;\n }\n } else {\n if (this._flags.last_token.type === TOKEN.RESERVED) {\n if (this._flags.last_token.text === 'for') {\n this._output.space_before_token = this._options.space_before_conditional;\n next_mode = MODE.ForInitializer;\n } else if (in_array(this._flags.last_token.text, ['if', 'while', 'switch'])) {\n this._output.space_before_token = this._options.space_before_conditional;\n next_mode = MODE.Conditional;\n } else if (in_array(this._flags.last_word, ['await', 'async'])) {\n // Should be a space between await and an IIFE, or async and an arrow function\n this._output.space_before_token = true;\n } else if (this._flags.last_token.text === 'import' && current_token.whitespace_before === '') {\n this._output.space_before_token = false;\n } else if (in_array(this._flags.last_token.text, line_starters) || this._flags.last_token.text === 'catch') {\n this._output.space_before_token = true;\n }\n } else if (this._flags.last_token.type === TOKEN.EQUALS || this._flags.last_token.type === TOKEN.OPERATOR) {\n // Support of this kind of newline preservation.\n // a = (b &&\n // (c || d));\n if (!this.start_of_object_property()) {\n this.allow_wrap_or_preserved_newline(current_token);\n }\n } else if (this._flags.last_token.type === TOKEN.WORD) {\n this._output.space_before_token = false;\n\n // function name() vs function name ()\n // function* name() vs function* name ()\n // async name() vs async name ()\n // In ES6, you can also define the method properties of an object\n // var obj = {a: function() {}}\n // It can be abbreviated\n // var obj = {a() {}}\n // var obj = { a() {}} vs var obj = { a () {}}\n // var obj = { * a() {}} vs var obj = { * a () {}}\n var peek_back_two = this._tokens.peek(-3);\n if (this._options.space_after_named_function && peek_back_two) {\n // peek starts at next character so -1 is current token\n var peek_back_three = this._tokens.peek(-4);\n if (reserved_array(peek_back_two, ['async', 'function']) ||\n (peek_back_two.text === '*' && reserved_array(peek_back_three, ['async', 'function']))) {\n this._output.space_before_token = true;\n } else if (this._flags.mode === MODE.ObjectLiteral) {\n if ((peek_back_two.text === '{' || peek_back_two.text === ',') ||\n (peek_back_two.text === '*' && (peek_back_three.text === '{' || peek_back_three.text === ','))) {\n this._output.space_before_token = true;\n }\n } else if (this._flags.parent && this._flags.parent.class_start_block) {\n this._output.space_before_token = true;\n }\n }\n } else {\n // Support preserving wrapped arrow function expressions\n // a.b('c',\n // () => d.e\n // )\n this.allow_wrap_or_preserved_newline(current_token);\n }\n\n // function() vs function ()\n // yield*() vs yield* ()\n // function*() vs function* ()\n if ((this._flags.last_token.type === TOKEN.RESERVED && (this._flags.last_word === 'function' || this._flags.last_word === 'typeof')) ||\n (this._flags.last_token.text === '*' &&\n (in_array(this._last_last_text, ['function', 'yield']) ||\n (this._flags.mode === MODE.ObjectLiteral && in_array(this._last_last_text, ['{', ',']))))) {\n this._output.space_before_token = this._options.space_after_anon_function;\n }\n }\n\n if (this._flags.last_token.text === ';' || this._flags.last_token.type === TOKEN.START_BLOCK) {\n this.print_newline();\n } else if (this._flags.last_token.type === TOKEN.END_EXPR || this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.END_BLOCK || this._flags.last_token.text === '.' || this._flags.last_token.type === TOKEN.COMMA) {\n // do nothing on (( and )( and ][ and ]( and .(\n // TODO: Consider whether forcing this is required. Review failing tests when removed.\n this.allow_wrap_or_preserved_newline(current_token, current_token.newlines);\n }\n\n this.print_token(current_token);\n this.set_mode(next_mode);\n if (this._options.space_in_paren) {\n this._output.space_before_token = true;\n }\n\n // In all cases, if we newline while inside an expression it should be indented.\n this.indent();\n};\n\nBeautifier.prototype.handle_end_expr = function(current_token) {\n // statements inside expressions are not valid syntax, but...\n // statements must all be closed when their container closes\n while (this._flags.mode === MODE.Statement) {\n this.restore_mode();\n }\n\n this.handle_whitespace_and_comments(current_token);\n\n if (this._flags.multiline_frame) {\n this.allow_wrap_or_preserved_newline(current_token,\n current_token.text === ']' && is_array(this._flags.mode) && !this._options.keep_array_indentation);\n }\n\n if (this._options.space_in_paren) {\n if (this._flags.last_token.type === TOKEN.START_EXPR && !this._options.space_in_empty_paren) {\n // () [] no inner space in empty parens like these, ever, ref #320\n this._output.trim();\n this._output.space_before_token = false;\n } else {\n this._output.space_before_token = true;\n }\n }\n this.deindent();\n this.print_token(current_token);\n this.restore_mode();\n\n remove_redundant_indentation(this._output, this._previous_flags);\n\n // do {} while () // no statement required after\n if (this._flags.do_while && this._previous_flags.mode === MODE.Conditional) {\n this._previous_flags.mode = MODE.Expression;\n this._flags.do_block = false;\n this._flags.do_while = false;\n\n }\n};\n\nBeautifier.prototype.handle_start_block = function(current_token) {\n this.handle_whitespace_and_comments(current_token);\n\n // Check if this is should be treated as a ObjectLiteral\n var next_token = this._tokens.peek();\n var second_token = this._tokens.peek(1);\n if (this._flags.last_word === 'switch' && this._flags.last_token.type === TOKEN.END_EXPR) {\n this.set_mode(MODE.BlockStatement);\n this._flags.in_case_statement = true;\n } else if (this._flags.case_body) {\n this.set_mode(MODE.BlockStatement);\n } else if (second_token && (\n (in_array(second_token.text, [':', ',']) && in_array(next_token.type, [TOKEN.STRING, TOKEN.WORD, TOKEN.RESERVED])) ||\n (in_array(next_token.text, ['get', 'set', '...']) && in_array(second_token.type, [TOKEN.WORD, TOKEN.RESERVED]))\n )) {\n // We don't support TypeScript,but we didn't break it for a very long time.\n // We'll try to keep not breaking it.\n if (in_array(this._last_last_text, ['class', 'interface']) && !in_array(second_token.text, [':', ','])) {\n this.set_mode(MODE.BlockStatement);\n } else {\n this.set_mode(MODE.ObjectLiteral);\n }\n } else if (this._flags.last_token.type === TOKEN.OPERATOR && this._flags.last_token.text === '=>') {\n // arrow function: (param1, paramN) => { statements }\n this.set_mode(MODE.BlockStatement);\n } else if (in_array(this._flags.last_token.type, [TOKEN.EQUALS, TOKEN.START_EXPR, TOKEN.COMMA, TOKEN.OPERATOR]) ||\n reserved_array(this._flags.last_token, ['return', 'throw', 'import', 'default'])\n ) {\n // Detecting shorthand function syntax is difficult by scanning forward,\n // so check the surrounding context.\n // If the block is being returned, imported, export default, passed as arg,\n // assigned with = or assigned in a nested object, treat as an ObjectLiteral.\n this.set_mode(MODE.ObjectLiteral);\n } else {\n this.set_mode(MODE.BlockStatement);\n }\n\n if (this._flags.last_token) {\n if (reserved_array(this._flags.last_token.previous, ['class', 'extends'])) {\n this._flags.class_start_block = true;\n }\n }\n\n var empty_braces = !next_token.comments_before && next_token.text === '}';\n var empty_anonymous_function = empty_braces && this._flags.last_word === 'function' &&\n this._flags.last_token.type === TOKEN.END_EXPR;\n\n if (this._options.brace_preserve_inline) // check for inline, set inline_frame if so\n {\n // search forward for a newline wanted inside this block\n var index = 0;\n var check_token = null;\n this._flags.inline_frame = true;\n do {\n index += 1;\n check_token = this._tokens.peek(index - 1);\n if (check_token.newlines) {\n this._flags.inline_frame = false;\n break;\n }\n } while (check_token.type !== TOKEN.EOF &&\n !(check_token.type === TOKEN.END_BLOCK && check_token.opened === current_token));\n }\n\n if ((this._options.brace_style === \"expand\" ||\n (this._options.brace_style === \"none\" && current_token.newlines)) &&\n !this._flags.inline_frame) {\n if (this._flags.last_token.type !== TOKEN.OPERATOR &&\n (empty_anonymous_function ||\n this._flags.last_token.type === TOKEN.EQUALS ||\n (reserved_array(this._flags.last_token, special_words) && this._flags.last_token.text !== 'else'))) {\n this._output.space_before_token = true;\n } else {\n this.print_newline(false, true);\n }\n } else { // collapse || inline_frame\n if (is_array(this._previous_flags.mode) && (this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.COMMA)) {\n if (this._flags.last_token.type === TOKEN.COMMA || this._options.space_in_paren) {\n this._output.space_before_token = true;\n }\n\n if (this._flags.last_token.type === TOKEN.COMMA || (this._flags.last_token.type === TOKEN.START_EXPR && this._flags.inline_frame)) {\n this.allow_wrap_or_preserved_newline(current_token);\n this._previous_flags.multiline_frame = this._previous_flags.multiline_frame || this._flags.multiline_frame;\n this._flags.multiline_frame = false;\n }\n }\n if (this._flags.last_token.type !== TOKEN.OPERATOR && this._flags.last_token.type !== TOKEN.START_EXPR) {\n if (in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.SEMICOLON]) && !this._flags.inline_frame) {\n this.print_newline();\n } else {\n this._output.space_before_token = true;\n }\n }\n }\n this.print_token(current_token);\n this.indent();\n\n // Except for specific cases, open braces are followed by a new line.\n if (!empty_braces && !(this._options.brace_preserve_inline && this._flags.inline_frame)) {\n this.print_newline();\n }\n};\n\nBeautifier.prototype.handle_end_block = function(current_token) {\n // statements must all be closed when their container closes\n this.handle_whitespace_and_comments(current_token);\n\n while (this._flags.mode === MODE.Statement) {\n this.restore_mode();\n }\n\n var empty_braces = this._flags.last_token.type === TOKEN.START_BLOCK;\n\n if (this._flags.inline_frame && !empty_braces) { // try inline_frame (only set if this._options.braces-preserve-inline) first\n this._output.space_before_token = true;\n } else if (this._options.brace_style === \"expand\") {\n if (!empty_braces) {\n this.print_newline();\n }\n } else {\n // skip {}\n if (!empty_braces) {\n if (is_array(this._flags.mode) && this._options.keep_array_indentation) {\n // we REALLY need a newline here, but newliner would skip that\n this._options.keep_array_indentation = false;\n this.print_newline();\n this._options.keep_array_indentation = true;\n\n } else {\n this.print_newline();\n }\n }\n }\n this.restore_mode();\n this.print_token(current_token);\n};\n\nBeautifier.prototype.handle_word = function(current_token) {\n if (current_token.type === TOKEN.RESERVED) {\n if (in_array(current_token.text, ['set', 'get']) && this._flags.mode !== MODE.ObjectLiteral) {\n current_token.type = TOKEN.WORD;\n } else if (current_token.text === 'import' && in_array(this._tokens.peek().text, ['(', '.'])) {\n current_token.type = TOKEN.WORD;\n } else if (in_array(current_token.text, ['as', 'from']) && !this._flags.import_block) {\n current_token.type = TOKEN.WORD;\n } else if (this._flags.mode === MODE.ObjectLiteral) {\n var next_token = this._tokens.peek();\n if (next_token.text === ':') {\n current_token.type = TOKEN.WORD;\n }\n }\n }\n\n if (this.start_of_statement(current_token)) {\n // The conditional starts the statement if appropriate.\n if (reserved_array(this._flags.last_token, ['var', 'let', 'const']) && current_token.type === TOKEN.WORD) {\n this._flags.declaration_statement = true;\n }\n } else if (current_token.newlines && !is_expression(this._flags.mode) &&\n (this._flags.last_token.type !== TOKEN.OPERATOR || (this._flags.last_token.text === '--' || this._flags.last_token.text === '++')) &&\n this._flags.last_token.type !== TOKEN.EQUALS &&\n (this._options.preserve_newlines || !reserved_array(this._flags.last_token, ['var', 'let', 'const', 'set', 'get']))) {\n this.handle_whitespace_and_comments(current_token);\n this.print_newline();\n } else {\n this.handle_whitespace_and_comments(current_token);\n }\n\n if (this._flags.do_block && !this._flags.do_while) {\n if (reserved_word(current_token, 'while')) {\n // do {} ## while ()\n this._output.space_before_token = true;\n this.print_token(current_token);\n this._output.space_before_token = true;\n this._flags.do_while = true;\n return;\n } else {\n // do {} should always have while as the next word.\n // if we don't see the expected while, recover\n this.print_newline();\n this._flags.do_block = false;\n }\n }\n\n // if may be followed by else, or not\n // Bare/inline ifs are tricky\n // Need to unwind the modes correctly: if (a) if (b) c(); else d(); else e();\n if (this._flags.if_block) {\n if (!this._flags.else_block && reserved_word(current_token, 'else')) {\n this._flags.else_block = true;\n } else {\n while (this._flags.mode === MODE.Statement) {\n this.restore_mode();\n }\n this._flags.if_block = false;\n this._flags.else_block = false;\n }\n }\n\n if (this._flags.in_case_statement && reserved_array(current_token, ['case', 'default'])) {\n this.print_newline();\n if (!this._flags.case_block && (this._flags.case_body || this._options.jslint_happy)) {\n // switch cases following one another\n this.deindent();\n }\n this._flags.case_body = false;\n\n this.print_token(current_token);\n this._flags.in_case = true;\n return;\n }\n\n if (this._flags.last_token.type === TOKEN.COMMA || this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.EQUALS || this._flags.last_token.type === TOKEN.OPERATOR) {\n if (!this.start_of_object_property() && !(\n // start of object property is different for numeric values with +/- prefix operators\n in_array(this._flags.last_token.text, ['+', '-']) && this._last_last_text === ':' && this._flags.parent.mode === MODE.ObjectLiteral)) {\n this.allow_wrap_or_preserved_newline(current_token);\n }\n }\n\n if (reserved_word(current_token, 'function')) {\n if (in_array(this._flags.last_token.text, ['}', ';']) ||\n (this._output.just_added_newline() && !(in_array(this._flags.last_token.text, ['(', '[', '{', ':', '=', ',']) || this._flags.last_token.type === TOKEN.OPERATOR))) {\n // make sure there is a nice clean space of at least one blank line\n // before a new function definition\n if (!this._output.just_added_blankline() && !current_token.comments_before) {\n this.print_newline();\n this.print_newline(true);\n }\n }\n if (this._flags.last_token.type === TOKEN.RESERVED || this._flags.last_token.type === TOKEN.WORD) {\n if (reserved_array(this._flags.last_token, ['get', 'set', 'new', 'export']) ||\n reserved_array(this._flags.last_token, newline_restricted_tokens)) {\n this._output.space_before_token = true;\n } else if (reserved_word(this._flags.last_token, 'default') && this._last_last_text === 'export') {\n this._output.space_before_token = true;\n } else if (this._flags.last_token.text === 'declare') {\n // accomodates Typescript declare function formatting\n this._output.space_before_token = true;\n } else {\n this.print_newline();\n }\n } else if (this._flags.last_token.type === TOKEN.OPERATOR || this._flags.last_token.text === '=') {\n // foo = function\n this._output.space_before_token = true;\n } else if (!this._flags.multiline_frame && (is_expression(this._flags.mode) || is_array(this._flags.mode))) {\n // (function\n } else {\n this.print_newline();\n }\n\n this.print_token(current_token);\n this._flags.last_word = current_token.text;\n return;\n }\n\n var prefix = 'NONE';\n\n if (this._flags.last_token.type === TOKEN.END_BLOCK) {\n\n if (this._previous_flags.inline_frame) {\n prefix = 'SPACE';\n } else if (!reserved_array(current_token, ['else', 'catch', 'finally', 'from'])) {\n prefix = 'NEWLINE';\n } else {\n if (this._options.brace_style === \"expand\" ||\n this._options.brace_style === \"end-expand\" ||\n (this._options.brace_style === \"none\" && current_token.newlines)) {\n prefix = 'NEWLINE';\n } else {\n prefix = 'SPACE';\n this._output.space_before_token = true;\n }\n }\n } else if (this._flags.last_token.type === TOKEN.SEMICOLON && this._flags.mode === MODE.BlockStatement) {\n // TODO: Should this be for STATEMENT as well?\n prefix = 'NEWLINE';\n } else if (this._flags.last_token.type === TOKEN.SEMICOLON && is_expression(this._flags.mode)) {\n prefix = 'SPACE';\n } else if (this._flags.last_token.type === TOKEN.STRING) {\n prefix = 'NEWLINE';\n } else if (this._flags.last_token.type === TOKEN.RESERVED || this._flags.last_token.type === TOKEN.WORD ||\n (this._flags.last_token.text === '*' &&\n (in_array(this._last_last_text, ['function', 'yield']) ||\n (this._flags.mode === MODE.ObjectLiteral && in_array(this._last_last_text, ['{', ',']))))) {\n prefix = 'SPACE';\n } else if (this._flags.last_token.type === TOKEN.START_BLOCK) {\n if (this._flags.inline_frame) {\n prefix = 'SPACE';\n } else {\n prefix = 'NEWLINE';\n }\n } else if (this._flags.last_token.type === TOKEN.END_EXPR) {\n this._output.space_before_token = true;\n prefix = 'NEWLINE';\n }\n\n if (reserved_array(current_token, line_starters) && this._flags.last_token.text !== ')') {\n if (this._flags.inline_frame || this._flags.last_token.text === 'else' || this._flags.last_token.text === 'export') {\n prefix = 'SPACE';\n } else {\n prefix = 'NEWLINE';\n }\n\n }\n\n if (reserved_array(current_token, ['else', 'catch', 'finally'])) {\n if ((!(this._flags.last_token.type === TOKEN.END_BLOCK && this._previous_flags.mode === MODE.BlockStatement) ||\n this._options.brace_style === \"expand\" ||\n this._options.brace_style === \"end-expand\" ||\n (this._options.brace_style === \"none\" && current_token.newlines)) &&\n !this._flags.inline_frame) {\n this.print_newline();\n } else {\n this._output.trim(true);\n var line = this._output.current_line;\n // If we trimmed and there's something other than a close block before us\n // put a newline back in. Handles '} // comment' scenario.\n if (line.last() !== '}') {\n this.print_newline();\n }\n this._output.space_before_token = true;\n }\n } else if (prefix === 'NEWLINE') {\n if (reserved_array(this._flags.last_token, special_words)) {\n // no newline between 'return nnn'\n this._output.space_before_token = true;\n } else if (this._flags.last_token.text === 'declare' && reserved_array(current_token, ['var', 'let', 'const'])) {\n // accomodates Typescript declare formatting\n this._output.space_before_token = true;\n } else if (this._flags.last_token.type !== TOKEN.END_EXPR) {\n if ((this._flags.last_token.type !== TOKEN.START_EXPR || !reserved_array(current_token, ['var', 'let', 'const'])) && this._flags.last_token.text !== ':') {\n // no need to force newline on 'var': for (var x = 0...)\n if (reserved_word(current_token, 'if') && reserved_word(current_token.previous, 'else')) {\n // no newline for } else if {\n this._output.space_before_token = true;\n } else {\n this.print_newline();\n }\n }\n } else if (reserved_array(current_token, line_starters) && this._flags.last_token.text !== ')') {\n this.print_newline();\n }\n } else if (this._flags.multiline_frame && is_array(this._flags.mode) && this._flags.last_token.text === ',' && this._last_last_text === '}') {\n this.print_newline(); // }, in lists get a newline treatment\n } else if (prefix === 'SPACE') {\n this._output.space_before_token = true;\n }\n if (current_token.previous && (current_token.previous.type === TOKEN.WORD || current_token.previous.type === TOKEN.RESERVED)) {\n this._output.space_before_token = true;\n }\n this.print_token(current_token);\n this._flags.last_word = current_token.text;\n\n if (current_token.type === TOKEN.RESERVED) {\n if (current_token.text === 'do') {\n this._flags.do_block = true;\n } else if (current_token.text === 'if') {\n this._flags.if_block = true;\n } else if (current_token.text === 'import') {\n this._flags.import_block = true;\n } else if (this._flags.import_block && reserved_word(current_token, 'from')) {\n this._flags.import_block = false;\n }\n }\n};\n\nBeautifier.prototype.handle_semicolon = function(current_token) {\n if (this.start_of_statement(current_token)) {\n // The conditional starts the statement if appropriate.\n // Semicolon can be the start (and end) of a statement\n this._output.space_before_token = false;\n } else {\n this.handle_whitespace_and_comments(current_token);\n }\n\n var next_token = this._tokens.peek();\n while (this._flags.mode === MODE.Statement &&\n !(this._flags.if_block && reserved_word(next_token, 'else')) &&\n !this._flags.do_block) {\n this.restore_mode();\n }\n\n // hacky but effective for the moment\n if (this._flags.import_block) {\n this._flags.import_block = false;\n }\n this.print_token(current_token);\n};\n\nBeautifier.prototype.handle_string = function(current_token) {\n if (current_token.text.startsWith(\"`\") && current_token.newlines === 0 && current_token.whitespace_before === '' && (current_token.previous.text === ')' || this._flags.last_token.type === TOKEN.WORD)) {\n //Conditional for detectign backtick strings\n } else if (this.start_of_statement(current_token)) {\n // The conditional starts the statement if appropriate.\n // One difference - strings want at least a space before\n this._output.space_before_token = true;\n } else {\n this.handle_whitespace_and_comments(current_token);\n if (this._flags.last_token.type === TOKEN.RESERVED || this._flags.last_token.type === TOKEN.WORD || this._flags.inline_frame) {\n this._output.space_before_token = true;\n } else if (this._flags.last_token.type === TOKEN.COMMA || this._flags.last_token.type === TOKEN.START_EXPR || this._flags.last_token.type === TOKEN.EQUALS || this._flags.last_token.type === TOKEN.OPERATOR) {\n if (!this.start_of_object_property()) {\n this.allow_wrap_or_preserved_newline(current_token);\n }\n } else if ((current_token.text.startsWith(\"`\") && this._flags.last_token.type === TOKEN.END_EXPR && (current_token.previous.text === ']' || current_token.previous.text === ')') && current_token.newlines === 0)) {\n this._output.space_before_token = true;\n } else {\n this.print_newline();\n }\n }\n this.print_token(current_token);\n};\n\nBeautifier.prototype.handle_equals = function(current_token) {\n if (this.start_of_statement(current_token)) {\n // The conditional starts the statement if appropriate.\n } else {\n this.handle_whitespace_and_comments(current_token);\n }\n\n if (this._flags.declaration_statement) {\n // just got an '=' in a var-line, different formatting/line-breaking, etc will now be done\n this._flags.declaration_assignment = true;\n }\n this._output.space_before_token = true;\n this.print_token(current_token);\n this._output.space_before_token = true;\n};\n\nBeautifier.prototype.handle_comma = function(current_token) {\n this.handle_whitespace_and_comments(current_token, true);\n\n this.print_token(current_token);\n this._output.space_before_token = true;\n if (this._flags.declaration_statement) {\n if (is_expression(this._flags.parent.mode)) {\n // do not break on comma, for(var a = 1, b = 2)\n this._flags.declaration_assignment = false;\n }\n\n if (this._flags.declaration_assignment) {\n this._flags.declaration_assignment = false;\n this.print_newline(false, true);\n } else if (this._options.comma_first) {\n // for comma-first, we want to allow a newline before the comma\n // to turn into a newline after the comma, which we will fixup later\n this.allow_wrap_or_preserved_newline(current_token);\n }\n } else if (this._flags.mode === MODE.ObjectLiteral ||\n (this._flags.mode === MODE.Statement && this._flags.parent.mode === MODE.ObjectLiteral)) {\n if (this._flags.mode === MODE.Statement) {\n this.restore_mode();\n }\n\n if (!this._flags.inline_frame) {\n this.print_newline();\n }\n } else if (this._options.comma_first) {\n // EXPR or DO_BLOCK\n // for comma-first, we want to allow a newline before the comma\n // to turn into a newline after the comma, which we will fixup later\n this.allow_wrap_or_preserved_newline(current_token);\n }\n};\n\nBeautifier.prototype.handle_operator = function(current_token) {\n var isGeneratorAsterisk = current_token.text === '*' &&\n (reserved_array(this._flags.last_token, ['function', 'yield']) ||\n (in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.COMMA, TOKEN.END_BLOCK, TOKEN.SEMICOLON]))\n );\n var isUnary = in_array(current_token.text, ['-', '+']) && (\n in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.START_EXPR, TOKEN.EQUALS, TOKEN.OPERATOR]) ||\n in_array(this._flags.last_token.text, line_starters) ||\n this._flags.last_token.text === ','\n );\n\n if (this.start_of_statement(current_token)) {\n // The conditional starts the statement if appropriate.\n } else {\n var preserve_statement_flags = !isGeneratorAsterisk;\n this.handle_whitespace_and_comments(current_token, preserve_statement_flags);\n }\n\n // hack for actionscript's import .*;\n if (current_token.text === '*' && this._flags.last_token.type === TOKEN.DOT) {\n this.print_token(current_token);\n return;\n }\n\n if (current_token.text === '::') {\n // no spaces around exotic namespacing syntax operator\n this.print_token(current_token);\n return;\n }\n\n if (in_array(current_token.text, ['-', '+']) && this.start_of_object_property()) {\n // numeric value with +/- symbol in front as a property\n this.print_token(current_token);\n return;\n }\n\n // Allow line wrapping between operators when operator_position is\n // set to before or preserve\n if (this._flags.last_token.type === TOKEN.OPERATOR && in_array(this._options.operator_position, OPERATOR_POSITION_BEFORE_OR_PRESERVE)) {\n this.allow_wrap_or_preserved_newline(current_token);\n }\n\n if (current_token.text === ':' && this._flags.in_case) {\n this.print_token(current_token);\n\n this._flags.in_case = false;\n this._flags.case_body = true;\n if (this._tokens.peek().type !== TOKEN.START_BLOCK) {\n this.indent();\n this.print_newline();\n this._flags.case_block = false;\n } else {\n this._flags.case_block = true;\n this._output.space_before_token = true;\n }\n return;\n }\n\n var space_before = true;\n var space_after = true;\n var in_ternary = false;\n if (current_token.text === ':') {\n if (this._flags.ternary_depth === 0) {\n // Colon is invalid javascript outside of ternary and object, but do our best to guess what was meant.\n space_before = false;\n } else {\n this._flags.ternary_depth -= 1;\n in_ternary = true;\n }\n } else if (current_token.text === '?') {\n this._flags.ternary_depth += 1;\n }\n\n // let's handle the operator_position option prior to any conflicting logic\n if (!isUnary && !isGeneratorAsterisk && this._options.preserve_newlines && in_array(current_token.text, positionable_operators)) {\n var isColon = current_token.text === ':';\n var isTernaryColon = (isColon && in_ternary);\n var isOtherColon = (isColon && !in_ternary);\n\n switch (this._options.operator_position) {\n case OPERATOR_POSITION.before_newline:\n // if the current token is : and it's not a ternary statement then we set space_before to false\n this._output.space_before_token = !isOtherColon;\n\n this.print_token(current_token);\n\n if (!isColon || isTernaryColon) {\n this.allow_wrap_or_preserved_newline(current_token);\n }\n\n this._output.space_before_token = true;\n return;\n\n case OPERATOR_POSITION.after_newline:\n // if the current token is anything but colon, or (via deduction) it's a colon and in a ternary statement,\n // then print a newline.\n\n this._output.space_before_token = true;\n\n if (!isColon || isTernaryColon) {\n if (this._tokens.peek().newlines) {\n this.print_newline(false, true);\n } else {\n this.allow_wrap_or_preserved_newline(current_token);\n }\n } else {\n this._output.space_before_token = false;\n }\n\n this.print_token(current_token);\n\n this._output.space_before_token = true;\n return;\n\n case OPERATOR_POSITION.preserve_newline:\n if (!isOtherColon) {\n this.allow_wrap_or_preserved_newline(current_token);\n }\n\n // if we just added a newline, or the current token is : and it's not a ternary statement,\n // then we set space_before to false\n space_before = !(this._output.just_added_newline() || isOtherColon);\n\n this._output.space_before_token = space_before;\n this.print_token(current_token);\n this._output.space_before_token = true;\n return;\n }\n }\n\n if (isGeneratorAsterisk) {\n this.allow_wrap_or_preserved_newline(current_token);\n space_before = false;\n var next_token = this._tokens.peek();\n space_after = next_token && in_array(next_token.type, [TOKEN.WORD, TOKEN.RESERVED]);\n } else if (current_token.text === '...') {\n this.allow_wrap_or_preserved_newline(current_token);\n space_before = this._flags.last_token.type === TOKEN.START_BLOCK;\n space_after = false;\n } else if (in_array(current_token.text, ['--', '++', '!', '~']) || isUnary) {\n // unary operators (and binary +/- pretending to be unary) special cases\n if (this._flags.last_token.type === TOKEN.COMMA || this._flags.last_token.type === TOKEN.START_EXPR) {\n this.allow_wrap_or_preserved_newline(current_token);\n }\n\n space_before = false;\n space_after = false;\n\n // http://www.ecma-international.org/ecma-262/5.1/#sec-7.9.1\n // if there is a newline between -- or ++ and anything else we should preserve it.\n if (current_token.newlines && (current_token.text === '--' || current_token.text === '++' || current_token.text === '~')) {\n var new_line_needed = reserved_array(this._flags.last_token, special_words) && current_token.newlines;\n if (new_line_needed && (this._previous_flags.if_block || this._previous_flags.else_block)) {\n this.restore_mode();\n }\n this.print_newline(new_line_needed, true);\n }\n\n if (this._flags.last_token.text === ';' && is_expression(this._flags.mode)) {\n // for (;; ++i)\n // ^^^\n space_before = true;\n }\n\n if (this._flags.last_token.type === TOKEN.RESERVED) {\n space_before = true;\n } else if (this._flags.last_token.type === TOKEN.END_EXPR) {\n space_before = !(this._flags.last_token.text === ']' && (current_token.text === '--' || current_token.text === '++'));\n } else if (this._flags.last_token.type === TOKEN.OPERATOR) {\n // a++ + ++b;\n // a - -b\n space_before = in_array(current_token.text, ['--', '-', '++', '+']) && in_array(this._flags.last_token.text, ['--', '-', '++', '+']);\n // + and - are not unary when preceeded by -- or ++ operator\n // a-- + b\n // a * +b\n // a - -b\n if (in_array(current_token.text, ['+', '-']) && in_array(this._flags.last_token.text, ['--', '++'])) {\n space_after = true;\n }\n }\n\n\n if (((this._flags.mode === MODE.BlockStatement && !this._flags.inline_frame) || this._flags.mode === MODE.Statement) &&\n (this._flags.last_token.text === '{' || this._flags.last_token.text === ';')) {\n // { foo; --i }\n // foo(); --bar;\n this.print_newline();\n }\n }\n\n this._output.space_before_token = this._output.space_before_token || space_before;\n this.print_token(current_token);\n this._output.space_before_token = space_after;\n};\n\nBeautifier.prototype.handle_block_comment = function(current_token, preserve_statement_flags) {\n if (this._output.raw) {\n this._output.add_raw_token(current_token);\n if (current_token.directives && current_token.directives.preserve === 'end') {\n // If we're testing the raw output behavior, do not allow a directive to turn it off.\n this._output.raw = this._options.test_output_raw;\n }\n return;\n }\n\n if (current_token.directives) {\n this.print_newline(false, preserve_statement_flags);\n this.print_token(current_token);\n if (current_token.directives.preserve === 'start') {\n this._output.raw = true;\n }\n this.print_newline(false, true);\n return;\n }\n\n // inline block\n if (!acorn.newline.test(current_token.text) && !current_token.newlines) {\n this._output.space_before_token = true;\n this.print_token(current_token);\n this._output.space_before_token = true;\n return;\n } else {\n this.print_block_commment(current_token, preserve_statement_flags);\n }\n};\n\nBeautifier.prototype.print_block_commment = function(current_token, preserve_statement_flags) {\n var lines = split_linebreaks(current_token.text);\n var j; // iterator for this case\n var javadoc = false;\n var starless = false;\n var lastIndent = current_token.whitespace_before;\n var lastIndentLength = lastIndent.length;\n\n // block comment starts with a new line\n this.print_newline(false, preserve_statement_flags);\n\n // first line always indented\n this.print_token_line_indentation(current_token);\n this._output.add_token(lines[0]);\n this.print_newline(false, preserve_statement_flags);\n\n\n if (lines.length > 1) {\n lines = lines.slice(1);\n javadoc = all_lines_start_with(lines, '*');\n starless = each_line_matches_indent(lines, lastIndent);\n\n if (javadoc) {\n this._flags.alignment = 1;\n }\n\n for (j = 0; j < lines.length; j++) {\n if (javadoc) {\n // javadoc: reformat and re-indent\n this.print_token_line_indentation(current_token);\n this._output.add_token(ltrim(lines[j]));\n } else if (starless && lines[j]) {\n // starless: re-indent non-empty content, avoiding trim\n this.print_token_line_indentation(current_token);\n this._output.add_token(lines[j].substring(lastIndentLength));\n } else {\n // normal comments output raw\n this._output.current_line.set_indent(-1);\n this._output.add_token(lines[j]);\n }\n\n // for comments on their own line or more than one line, make sure there's a new line after\n this.print_newline(false, preserve_statement_flags);\n }\n\n this._flags.alignment = 0;\n }\n};\n\n\nBeautifier.prototype.handle_comment = function(current_token, preserve_statement_flags) {\n if (current_token.newlines) {\n this.print_newline(false, preserve_statement_flags);\n } else {\n this._output.trim(true);\n }\n\n this._output.space_before_token = true;\n this.print_token(current_token);\n this.print_newline(false, preserve_statement_flags);\n};\n\nBeautifier.prototype.handle_dot = function(current_token) {\n if (this.start_of_statement(current_token)) {\n // The conditional starts the statement if appropriate.\n } else {\n this.handle_whitespace_and_comments(current_token, true);\n }\n\n if (this._flags.last_token.text.match('^[0-9]+$')) {\n this._output.space_before_token = true;\n }\n\n if (reserved_array(this._flags.last_token, special_words)) {\n this._output.space_before_token = false;\n } else {\n // allow preserved newlines before dots in general\n // force newlines on dots after close paren when break_chained - for bar().baz()\n this.allow_wrap_or_preserved_newline(current_token,\n this._flags.last_token.text === ')' && this._options.break_chained_methods);\n }\n\n // Only unindent chained method dot if this dot starts a new line.\n // Otherwise the automatic extra indentation removal will handle the over indent\n if (this._options.unindent_chained_methods && this._output.just_added_newline()) {\n this.deindent();\n }\n\n this.print_token(current_token);\n};\n\nBeautifier.prototype.handle_unknown = function(current_token, preserve_statement_flags) {\n this.print_token(current_token);\n\n if (current_token.text[current_token.text.length - 1] === '\\n') {\n this.print_newline(false, preserve_statement_flags);\n }\n};\n\nBeautifier.prototype.handle_eof = function(current_token) {\n // Unwind any open statements\n while (this._flags.mode === MODE.Statement) {\n this.restore_mode();\n }\n this.handle_whitespace_and_comments(current_token);\n};\n\nmodule.exports.Beautifier = Beautifier;\n","/*jshint node:true */\n/*\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nfunction OutputLine(parent) {\n this.__parent = parent;\n this.__character_count = 0;\n // use indent_count as a marker for this.__lines that have preserved indentation\n this.__indent_count = -1;\n this.__alignment_count = 0;\n this.__wrap_point_index = 0;\n this.__wrap_point_character_count = 0;\n this.__wrap_point_indent_count = -1;\n this.__wrap_point_alignment_count = 0;\n\n this.__items = [];\n}\n\nOutputLine.prototype.clone_empty = function() {\n var line = new OutputLine(this.__parent);\n line.set_indent(this.__indent_count, this.__alignment_count);\n return line;\n};\n\nOutputLine.prototype.item = function(index) {\n if (index < 0) {\n return this.__items[this.__items.length + index];\n } else {\n return this.__items[index];\n }\n};\n\nOutputLine.prototype.has_match = function(pattern) {\n for (var lastCheckedOutput = this.__items.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) {\n if (this.__items[lastCheckedOutput].match(pattern)) {\n return true;\n }\n }\n return false;\n};\n\nOutputLine.prototype.set_indent = function(indent, alignment) {\n if (this.is_empty()) {\n this.__indent_count = indent || 0;\n this.__alignment_count = alignment || 0;\n this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count);\n }\n};\n\nOutputLine.prototype._set_wrap_point = function() {\n if (this.__parent.wrap_line_length) {\n this.__wrap_point_index = this.__items.length;\n this.__wrap_point_character_count = this.__character_count;\n this.__wrap_point_indent_count = this.__parent.next_line.__indent_count;\n this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count;\n }\n};\n\nOutputLine.prototype._should_wrap = function() {\n return this.__wrap_point_index &&\n this.__character_count > this.__parent.wrap_line_length &&\n this.__wrap_point_character_count > this.__parent.next_line.__character_count;\n};\n\nOutputLine.prototype._allow_wrap = function() {\n if (this._should_wrap()) {\n this.__parent.add_new_line();\n var next = this.__parent.current_line;\n next.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count);\n next.__items = this.__items.slice(this.__wrap_point_index);\n this.__items = this.__items.slice(0, this.__wrap_point_index);\n\n next.__character_count += this.__character_count - this.__wrap_point_character_count;\n this.__character_count = this.__wrap_point_character_count;\n\n if (next.__items[0] === \" \") {\n next.__items.splice(0, 1);\n next.__character_count -= 1;\n }\n return true;\n }\n return false;\n};\n\nOutputLine.prototype.is_empty = function() {\n return this.__items.length === 0;\n};\n\nOutputLine.prototype.last = function() {\n if (!this.is_empty()) {\n return this.__items[this.__items.length - 1];\n } else {\n return null;\n }\n};\n\nOutputLine.prototype.push = function(item) {\n this.__items.push(item);\n var last_newline_index = item.lastIndexOf('\\n');\n if (last_newline_index !== -1) {\n this.__character_count = item.length - last_newline_index;\n } else {\n this.__character_count += item.length;\n }\n};\n\nOutputLine.prototype.pop = function() {\n var item = null;\n if (!this.is_empty()) {\n item = this.__items.pop();\n this.__character_count -= item.length;\n }\n return item;\n};\n\n\nOutputLine.prototype._remove_indent = function() {\n if (this.__indent_count > 0) {\n this.__indent_count -= 1;\n this.__character_count -= this.__parent.indent_size;\n }\n};\n\nOutputLine.prototype._remove_wrap_indent = function() {\n if (this.__wrap_point_indent_count > 0) {\n this.__wrap_point_indent_count -= 1;\n }\n};\nOutputLine.prototype.trim = function() {\n while (this.last() === ' ') {\n this.__items.pop();\n this.__character_count -= 1;\n }\n};\n\nOutputLine.prototype.toString = function() {\n var result = '';\n if (this.is_empty()) {\n if (this.__parent.indent_empty_lines) {\n result = this.__parent.get_indent_string(this.__indent_count);\n }\n } else {\n result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count);\n result += this.__items.join('');\n }\n return result;\n};\n\nfunction IndentStringCache(options, baseIndentString) {\n this.__cache = [''];\n this.__indent_size = options.indent_size;\n this.__indent_string = options.indent_char;\n if (!options.indent_with_tabs) {\n this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char);\n }\n\n // Set to null to continue support for auto detection of base indent\n baseIndentString = baseIndentString || '';\n if (options.indent_level > 0) {\n baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string);\n }\n\n this.__base_string = baseIndentString;\n this.__base_string_length = baseIndentString.length;\n}\n\nIndentStringCache.prototype.get_indent_size = function(indent, column) {\n var result = this.__base_string_length;\n column = column || 0;\n if (indent < 0) {\n result = 0;\n }\n result += indent * this.__indent_size;\n result += column;\n return result;\n};\n\nIndentStringCache.prototype.get_indent_string = function(indent_level, column) {\n var result = this.__base_string;\n column = column || 0;\n if (indent_level < 0) {\n indent_level = 0;\n result = '';\n }\n column += indent_level * this.__indent_size;\n this.__ensure_cache(column);\n result += this.__cache[column];\n return result;\n};\n\nIndentStringCache.prototype.__ensure_cache = function(column) {\n while (column >= this.__cache.length) {\n this.__add_column();\n }\n};\n\nIndentStringCache.prototype.__add_column = function() {\n var column = this.__cache.length;\n var indent = 0;\n var result = '';\n if (this.__indent_size && column >= this.__indent_size) {\n indent = Math.floor(column / this.__indent_size);\n column -= indent * this.__indent_size;\n result = new Array(indent + 1).join(this.__indent_string);\n }\n if (column) {\n result += new Array(column + 1).join(' ');\n }\n\n this.__cache.push(result);\n};\n\nfunction Output(options, baseIndentString) {\n this.__indent_cache = new IndentStringCache(options, baseIndentString);\n this.raw = false;\n this._end_with_newline = options.end_with_newline;\n this.indent_size = options.indent_size;\n this.wrap_line_length = options.wrap_line_length;\n this.indent_empty_lines = options.indent_empty_lines;\n this.__lines = [];\n this.previous_line = null;\n this.current_line = null;\n this.next_line = new OutputLine(this);\n this.space_before_token = false;\n this.non_breaking_space = false;\n this.previous_token_wrapped = false;\n // initialize\n this.__add_outputline();\n}\n\nOutput.prototype.__add_outputline = function() {\n this.previous_line = this.current_line;\n this.current_line = this.next_line.clone_empty();\n this.__lines.push(this.current_line);\n};\n\nOutput.prototype.get_line_number = function() {\n return this.__lines.length;\n};\n\nOutput.prototype.get_indent_string = function(indent, column) {\n return this.__indent_cache.get_indent_string(indent, column);\n};\n\nOutput.prototype.get_indent_size = function(indent, column) {\n return this.__indent_cache.get_indent_size(indent, column);\n};\n\nOutput.prototype.is_empty = function() {\n return !this.previous_line && this.current_line.is_empty();\n};\n\nOutput.prototype.add_new_line = function(force_newline) {\n // never newline at the start of file\n // otherwise, newline only if we didn't just add one or we're forced\n if (this.is_empty() ||\n (!force_newline && this.just_added_newline())) {\n return false;\n }\n\n // if raw output is enabled, don't print additional newlines,\n // but still return True as though you had\n if (!this.raw) {\n this.__add_outputline();\n }\n return true;\n};\n\nOutput.prototype.get_code = function(eol) {\n this.trim(true);\n\n // handle some edge cases where the last tokens\n // has text that ends with newline(s)\n var last_item = this.current_line.pop();\n if (last_item) {\n if (last_item[last_item.length - 1] === '\\n') {\n last_item = last_item.replace(/\\n+$/g, '');\n }\n this.current_line.push(last_item);\n }\n\n if (this._end_with_newline) {\n this.__add_outputline();\n }\n\n var sweet_code = this.__lines.join('\\n');\n\n if (eol !== '\\n') {\n sweet_code = sweet_code.replace(/[\\n]/g, eol);\n }\n return sweet_code;\n};\n\nOutput.prototype.set_wrap_point = function() {\n this.current_line._set_wrap_point();\n};\n\nOutput.prototype.set_indent = function(indent, alignment) {\n indent = indent || 0;\n alignment = alignment || 0;\n\n // Next line stores alignment values\n this.next_line.set_indent(indent, alignment);\n\n // Never indent your first output indent at the start of the file\n if (this.__lines.length > 1) {\n this.current_line.set_indent(indent, alignment);\n return true;\n }\n\n this.current_line.set_indent();\n return false;\n};\n\nOutput.prototype.add_raw_token = function(token) {\n for (var x = 0; x < token.newlines; x++) {\n this.__add_outputline();\n }\n this.current_line.set_indent(-1);\n this.current_line.push(token.whitespace_before);\n this.current_line.push(token.text);\n this.space_before_token = false;\n this.non_breaking_space = false;\n this.previous_token_wrapped = false;\n};\n\nOutput.prototype.add_token = function(printable_token) {\n this.__add_space_before_token();\n this.current_line.push(printable_token);\n this.space_before_token = false;\n this.non_breaking_space = false;\n this.previous_token_wrapped = this.current_line._allow_wrap();\n};\n\nOutput.prototype.__add_space_before_token = function() {\n if (this.space_before_token && !this.just_added_newline()) {\n if (!this.non_breaking_space) {\n this.set_wrap_point();\n }\n this.current_line.push(' ');\n }\n};\n\nOutput.prototype.remove_indent = function(index) {\n var output_length = this.__lines.length;\n while (index < output_length) {\n this.__lines[index]._remove_indent();\n index++;\n }\n this.current_line._remove_wrap_indent();\n};\n\nOutput.prototype.trim = function(eat_newlines) {\n eat_newlines = (eat_newlines === undefined) ? false : eat_newlines;\n\n this.current_line.trim();\n\n while (eat_newlines && this.__lines.length > 1 &&\n this.current_line.is_empty()) {\n this.__lines.pop();\n this.current_line = this.__lines[this.__lines.length - 1];\n this.current_line.trim();\n }\n\n this.previous_line = this.__lines.length > 1 ?\n this.__lines[this.__lines.length - 2] : null;\n};\n\nOutput.prototype.just_added_newline = function() {\n return this.current_line.is_empty();\n};\n\nOutput.prototype.just_added_blankline = function() {\n return this.is_empty() ||\n (this.current_line.is_empty() && this.previous_line.is_empty());\n};\n\nOutput.prototype.ensure_empty_line_above = function(starts_with, ends_with) {\n var index = this.__lines.length - 2;\n while (index >= 0) {\n var potentialEmptyLine = this.__lines[index];\n if (potentialEmptyLine.is_empty()) {\n break;\n } else if (potentialEmptyLine.item(0).indexOf(starts_with) !== 0 &&\n potentialEmptyLine.item(-1) !== ends_with) {\n this.__lines.splice(index + 1, 0, new OutputLine(this));\n this.previous_line = this.__lines[this.__lines.length - 2];\n break;\n }\n index--;\n }\n};\n\nmodule.exports.Output = Output;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nfunction Token(type, text, newlines, whitespace_before) {\n this.type = type;\n this.text = text;\n\n // comments_before are\n // comments that have a new line before them\n // and may or may not have a newline after\n // this is a set of comments before\n this.comments_before = null; /* inline comment*/\n\n\n // this.comments_after = new TokenStream(); // no new line before and newline after\n this.newlines = newlines || 0;\n this.whitespace_before = whitespace_before || '';\n this.parent = null;\n this.next = null;\n this.previous = null;\n this.opened = null;\n this.closed = null;\n this.directives = null;\n}\n\n\nmodule.exports.Token = Token;\n","/* jshint node: true, curly: false */\n// Parts of this section of code is taken from acorn.\n//\n// Acorn was written by Marijn Haverbeke and released under an MIT\n// license. The Unicode regexps (for identifiers and whitespace) were\n// taken from [Esprima](http://esprima.org) by Ariya Hidayat.\n//\n// Git repositories for Acorn are available at\n//\n// http://marijnhaverbeke.nl/git/acorn\n// https://github.com/marijnh/acorn.git\n\n// ## Character categories\n\n\n'use strict';\n\n// acorn used char codes to squeeze the last bit of performance out\n// Beautifier is okay without that, so we're using regex\n// permit # (23), $ (36), and @ (64). @ is used in ES7 decorators.\n// 65 through 91 are uppercase letters.\n// permit _ (95).\n// 97 through 123 are lowercase letters.\nvar baseASCIIidentifierStartChars = \"\\\\x23\\\\x24\\\\x40\\\\x41-\\\\x5a\\\\x5f\\\\x61-\\\\x7a\";\n\n// inside an identifier @ is not allowed but 0-9 are.\nvar baseASCIIidentifierChars = \"\\\\x24\\\\x30-\\\\x39\\\\x41-\\\\x5a\\\\x5f\\\\x61-\\\\x7a\";\n\n// Big ugly regular expressions that match characters in the\n// whitespace, identifier, and identifier-start categories. These\n// are only applied when a character is found to actually have a\n// code point above 128.\nvar nonASCIIidentifierStartChars = \"\\\\xaa\\\\xb5\\\\xba\\\\xc0-\\\\xd6\\\\xd8-\\\\xf6\\\\xf8-\\\\u02c1\\\\u02c6-\\\\u02d1\\\\u02e0-\\\\u02e4\\\\u02ec\\\\u02ee\\\\u0370-\\\\u0374\\\\u0376\\\\u0377\\\\u037a-\\\\u037d\\\\u0386\\\\u0388-\\\\u038a\\\\u038c\\\\u038e-\\\\u03a1\\\\u03a3-\\\\u03f5\\\\u03f7-\\\\u0481\\\\u048a-\\\\u0527\\\\u0531-\\\\u0556\\\\u0559\\\\u0561-\\\\u0587\\\\u05d0-\\\\u05ea\\\\u05f0-\\\\u05f2\\\\u0620-\\\\u064a\\\\u066e\\\\u066f\\\\u0671-\\\\u06d3\\\\u06d5\\\\u06e5\\\\u06e6\\\\u06ee\\\\u06ef\\\\u06fa-\\\\u06fc\\\\u06ff\\\\u0710\\\\u0712-\\\\u072f\\\\u074d-\\\\u07a5\\\\u07b1\\\\u07ca-\\\\u07ea\\\\u07f4\\\\u07f5\\\\u07fa\\\\u0800-\\\\u0815\\\\u081a\\\\u0824\\\\u0828\\\\u0840-\\\\u0858\\\\u08a0\\\\u08a2-\\\\u08ac\\\\u0904-\\\\u0939\\\\u093d\\\\u0950\\\\u0958-\\\\u0961\\\\u0971-\\\\u0977\\\\u0979-\\\\u097f\\\\u0985-\\\\u098c\\\\u098f\\\\u0990\\\\u0993-\\\\u09a8\\\\u09aa-\\\\u09b0\\\\u09b2\\\\u09b6-\\\\u09b9\\\\u09bd\\\\u09ce\\\\u09dc\\\\u09dd\\\\u09df-\\\\u09e1\\\\u09f0\\\\u09f1\\\\u0a05-\\\\u0a0a\\\\u0a0f\\\\u0a10\\\\u0a13-\\\\u0a28\\\\u0a2a-\\\\u0a30\\\\u0a32\\\\u0a33\\\\u0a35\\\\u0a36\\\\u0a38\\\\u0a39\\\\u0a59-\\\\u0a5c\\\\u0a5e\\\\u0a72-\\\\u0a74\\\\u0a85-\\\\u0a8d\\\\u0a8f-\\\\u0a91\\\\u0a93-\\\\u0aa8\\\\u0aaa-\\\\u0ab0\\\\u0ab2\\\\u0ab3\\\\u0ab5-\\\\u0ab9\\\\u0abd\\\\u0ad0\\\\u0ae0\\\\u0ae1\\\\u0b05-\\\\u0b0c\\\\u0b0f\\\\u0b10\\\\u0b13-\\\\u0b28\\\\u0b2a-\\\\u0b30\\\\u0b32\\\\u0b33\\\\u0b35-\\\\u0b39\\\\u0b3d\\\\u0b5c\\\\u0b5d\\\\u0b5f-\\\\u0b61\\\\u0b71\\\\u0b83\\\\u0b85-\\\\u0b8a\\\\u0b8e-\\\\u0b90\\\\u0b92-\\\\u0b95\\\\u0b99\\\\u0b9a\\\\u0b9c\\\\u0b9e\\\\u0b9f\\\\u0ba3\\\\u0ba4\\\\u0ba8-\\\\u0baa\\\\u0bae-\\\\u0bb9\\\\u0bd0\\\\u0c05-\\\\u0c0c\\\\u0c0e-\\\\u0c10\\\\u0c12-\\\\u0c28\\\\u0c2a-\\\\u0c33\\\\u0c35-\\\\u0c39\\\\u0c3d\\\\u0c58\\\\u0c59\\\\u0c60\\\\u0c61\\\\u0c85-\\\\u0c8c\\\\u0c8e-\\\\u0c90\\\\u0c92-\\\\u0ca8\\\\u0caa-\\\\u0cb3\\\\u0cb5-\\\\u0cb9\\\\u0cbd\\\\u0cde\\\\u0ce0\\\\u0ce1\\\\u0cf1\\\\u0cf2\\\\u0d05-\\\\u0d0c\\\\u0d0e-\\\\u0d10\\\\u0d12-\\\\u0d3a\\\\u0d3d\\\\u0d4e\\\\u0d60\\\\u0d61\\\\u0d7a-\\\\u0d7f\\\\u0d85-\\\\u0d96\\\\u0d9a-\\\\u0db1\\\\u0db3-\\\\u0dbb\\\\u0dbd\\\\u0dc0-\\\\u0dc6\\\\u0e01-\\\\u0e30\\\\u0e32\\\\u0e33\\\\u0e40-\\\\u0e46\\\\u0e81\\\\u0e82\\\\u0e84\\\\u0e87\\\\u0e88\\\\u0e8a\\\\u0e8d\\\\u0e94-\\\\u0e97\\\\u0e99-\\\\u0e9f\\\\u0ea1-\\\\u0ea3\\\\u0ea5\\\\u0ea7\\\\u0eaa\\\\u0eab\\\\u0ead-\\\\u0eb0\\\\u0eb2\\\\u0eb3\\\\u0ebd\\\\u0ec0-\\\\u0ec4\\\\u0ec6\\\\u0edc-\\\\u0edf\\\\u0f00\\\\u0f40-\\\\u0f47\\\\u0f49-\\\\u0f6c\\\\u0f88-\\\\u0f8c\\\\u1000-\\\\u102a\\\\u103f\\\\u1050-\\\\u1055\\\\u105a-\\\\u105d\\\\u1061\\\\u1065\\\\u1066\\\\u106e-\\\\u1070\\\\u1075-\\\\u1081\\\\u108e\\\\u10a0-\\\\u10c5\\\\u10c7\\\\u10cd\\\\u10d0-\\\\u10fa\\\\u10fc-\\\\u1248\\\\u124a-\\\\u124d\\\\u1250-\\\\u1256\\\\u1258\\\\u125a-\\\\u125d\\\\u1260-\\\\u1288\\\\u128a-\\\\u128d\\\\u1290-\\\\u12b0\\\\u12b2-\\\\u12b5\\\\u12b8-\\\\u12be\\\\u12c0\\\\u12c2-\\\\u12c5\\\\u12c8-\\\\u12d6\\\\u12d8-\\\\u1310\\\\u1312-\\\\u1315\\\\u1318-\\\\u135a\\\\u1380-\\\\u138f\\\\u13a0-\\\\u13f4\\\\u1401-\\\\u166c\\\\u166f-\\\\u167f\\\\u1681-\\\\u169a\\\\u16a0-\\\\u16ea\\\\u16ee-\\\\u16f0\\\\u1700-\\\\u170c\\\\u170e-\\\\u1711\\\\u1720-\\\\u1731\\\\u1740-\\\\u1751\\\\u1760-\\\\u176c\\\\u176e-\\\\u1770\\\\u1780-\\\\u17b3\\\\u17d7\\\\u17dc\\\\u1820-\\\\u1877\\\\u1880-\\\\u18a8\\\\u18aa\\\\u18b0-\\\\u18f5\\\\u1900-\\\\u191c\\\\u1950-\\\\u196d\\\\u1970-\\\\u1974\\\\u1980-\\\\u19ab\\\\u19c1-\\\\u19c7\\\\u1a00-\\\\u1a16\\\\u1a20-\\\\u1a54\\\\u1aa7\\\\u1b05-\\\\u1b33\\\\u1b45-\\\\u1b4b\\\\u1b83-\\\\u1ba0\\\\u1bae\\\\u1baf\\\\u1bba-\\\\u1be5\\\\u1c00-\\\\u1c23\\\\u1c4d-\\\\u1c4f\\\\u1c5a-\\\\u1c7d\\\\u1ce9-\\\\u1cec\\\\u1cee-\\\\u1cf1\\\\u1cf5\\\\u1cf6\\\\u1d00-\\\\u1dbf\\\\u1e00-\\\\u1f15\\\\u1f18-\\\\u1f1d\\\\u1f20-\\\\u1f45\\\\u1f48-\\\\u1f4d\\\\u1f50-\\\\u1f57\\\\u1f59\\\\u1f5b\\\\u1f5d\\\\u1f5f-\\\\u1f7d\\\\u1f80-\\\\u1fb4\\\\u1fb6-\\\\u1fbc\\\\u1fbe\\\\u1fc2-\\\\u1fc4\\\\u1fc6-\\\\u1fcc\\\\u1fd0-\\\\u1fd3\\\\u1fd6-\\\\u1fdb\\\\u1fe0-\\\\u1fec\\\\u1ff2-\\\\u1ff4\\\\u1ff6-\\\\u1ffc\\\\u2071\\\\u207f\\\\u2090-\\\\u209c\\\\u2102\\\\u2107\\\\u210a-\\\\u2113\\\\u2115\\\\u2119-\\\\u211d\\\\u2124\\\\u2126\\\\u2128\\\\u212a-\\\\u212d\\\\u212f-\\\\u2139\\\\u213c-\\\\u213f\\\\u2145-\\\\u2149\\\\u214e\\\\u2160-\\\\u2188\\\\u2c00-\\\\u2c2e\\\\u2c30-\\\\u2c5e\\\\u2c60-\\\\u2ce4\\\\u2ceb-\\\\u2cee\\\\u2cf2\\\\u2cf3\\\\u2d00-\\\\u2d25\\\\u2d27\\\\u2d2d\\\\u2d30-\\\\u2d67\\\\u2d6f\\\\u2d80-\\\\u2d96\\\\u2da0-\\\\u2da6\\\\u2da8-\\\\u2dae\\\\u2db0-\\\\u2db6\\\\u2db8-\\\\u2dbe\\\\u2dc0-\\\\u2dc6\\\\u2dc8-\\\\u2dce\\\\u2dd0-\\\\u2dd6\\\\u2dd8-\\\\u2dde\\\\u2e2f\\\\u3005-\\\\u3007\\\\u3021-\\\\u3029\\\\u3031-\\\\u3035\\\\u3038-\\\\u303c\\\\u3041-\\\\u3096\\\\u309d-\\\\u309f\\\\u30a1-\\\\u30fa\\\\u30fc-\\\\u30ff\\\\u3105-\\\\u312d\\\\u3131-\\\\u318e\\\\u31a0-\\\\u31ba\\\\u31f0-\\\\u31ff\\\\u3400-\\\\u4db5\\\\u4e00-\\\\u9fcc\\\\ua000-\\\\ua48c\\\\ua4d0-\\\\ua4fd\\\\ua500-\\\\ua60c\\\\ua610-\\\\ua61f\\\\ua62a\\\\ua62b\\\\ua640-\\\\ua66e\\\\ua67f-\\\\ua697\\\\ua6a0-\\\\ua6ef\\\\ua717-\\\\ua71f\\\\ua722-\\\\ua788\\\\ua78b-\\\\ua78e\\\\ua790-\\\\ua793\\\\ua7a0-\\\\ua7aa\\\\ua7f8-\\\\ua801\\\\ua803-\\\\ua805\\\\ua807-\\\\ua80a\\\\ua80c-\\\\ua822\\\\ua840-\\\\ua873\\\\ua882-\\\\ua8b3\\\\ua8f2-\\\\ua8f7\\\\ua8fb\\\\ua90a-\\\\ua925\\\\ua930-\\\\ua946\\\\ua960-\\\\ua97c\\\\ua984-\\\\ua9b2\\\\ua9cf\\\\uaa00-\\\\uaa28\\\\uaa40-\\\\uaa42\\\\uaa44-\\\\uaa4b\\\\uaa60-\\\\uaa76\\\\uaa7a\\\\uaa80-\\\\uaaaf\\\\uaab1\\\\uaab5\\\\uaab6\\\\uaab9-\\\\uaabd\\\\uaac0\\\\uaac2\\\\uaadb-\\\\uaadd\\\\uaae0-\\\\uaaea\\\\uaaf2-\\\\uaaf4\\\\uab01-\\\\uab06\\\\uab09-\\\\uab0e\\\\uab11-\\\\uab16\\\\uab20-\\\\uab26\\\\uab28-\\\\uab2e\\\\uabc0-\\\\uabe2\\\\uac00-\\\\ud7a3\\\\ud7b0-\\\\ud7c6\\\\ud7cb-\\\\ud7fb\\\\uf900-\\\\ufa6d\\\\ufa70-\\\\ufad9\\\\ufb00-\\\\ufb06\\\\ufb13-\\\\ufb17\\\\ufb1d\\\\ufb1f-\\\\ufb28\\\\ufb2a-\\\\ufb36\\\\ufb38-\\\\ufb3c\\\\ufb3e\\\\ufb40\\\\ufb41\\\\ufb43\\\\ufb44\\\\ufb46-\\\\ufbb1\\\\ufbd3-\\\\ufd3d\\\\ufd50-\\\\ufd8f\\\\ufd92-\\\\ufdc7\\\\ufdf0-\\\\ufdfb\\\\ufe70-\\\\ufe74\\\\ufe76-\\\\ufefc\\\\uff21-\\\\uff3a\\\\uff41-\\\\uff5a\\\\uff66-\\\\uffbe\\\\uffc2-\\\\uffc7\\\\uffca-\\\\uffcf\\\\uffd2-\\\\uffd7\\\\uffda-\\\\uffdc\";\nvar nonASCIIidentifierChars = \"\\\\u0300-\\\\u036f\\\\u0483-\\\\u0487\\\\u0591-\\\\u05bd\\\\u05bf\\\\u05c1\\\\u05c2\\\\u05c4\\\\u05c5\\\\u05c7\\\\u0610-\\\\u061a\\\\u0620-\\\\u0649\\\\u0672-\\\\u06d3\\\\u06e7-\\\\u06e8\\\\u06fb-\\\\u06fc\\\\u0730-\\\\u074a\\\\u0800-\\\\u0814\\\\u081b-\\\\u0823\\\\u0825-\\\\u0827\\\\u0829-\\\\u082d\\\\u0840-\\\\u0857\\\\u08e4-\\\\u08fe\\\\u0900-\\\\u0903\\\\u093a-\\\\u093c\\\\u093e-\\\\u094f\\\\u0951-\\\\u0957\\\\u0962-\\\\u0963\\\\u0966-\\\\u096f\\\\u0981-\\\\u0983\\\\u09bc\\\\u09be-\\\\u09c4\\\\u09c7\\\\u09c8\\\\u09d7\\\\u09df-\\\\u09e0\\\\u0a01-\\\\u0a03\\\\u0a3c\\\\u0a3e-\\\\u0a42\\\\u0a47\\\\u0a48\\\\u0a4b-\\\\u0a4d\\\\u0a51\\\\u0a66-\\\\u0a71\\\\u0a75\\\\u0a81-\\\\u0a83\\\\u0abc\\\\u0abe-\\\\u0ac5\\\\u0ac7-\\\\u0ac9\\\\u0acb-\\\\u0acd\\\\u0ae2-\\\\u0ae3\\\\u0ae6-\\\\u0aef\\\\u0b01-\\\\u0b03\\\\u0b3c\\\\u0b3e-\\\\u0b44\\\\u0b47\\\\u0b48\\\\u0b4b-\\\\u0b4d\\\\u0b56\\\\u0b57\\\\u0b5f-\\\\u0b60\\\\u0b66-\\\\u0b6f\\\\u0b82\\\\u0bbe-\\\\u0bc2\\\\u0bc6-\\\\u0bc8\\\\u0bca-\\\\u0bcd\\\\u0bd7\\\\u0be6-\\\\u0bef\\\\u0c01-\\\\u0c03\\\\u0c46-\\\\u0c48\\\\u0c4a-\\\\u0c4d\\\\u0c55\\\\u0c56\\\\u0c62-\\\\u0c63\\\\u0c66-\\\\u0c6f\\\\u0c82\\\\u0c83\\\\u0cbc\\\\u0cbe-\\\\u0cc4\\\\u0cc6-\\\\u0cc8\\\\u0cca-\\\\u0ccd\\\\u0cd5\\\\u0cd6\\\\u0ce2-\\\\u0ce3\\\\u0ce6-\\\\u0cef\\\\u0d02\\\\u0d03\\\\u0d46-\\\\u0d48\\\\u0d57\\\\u0d62-\\\\u0d63\\\\u0d66-\\\\u0d6f\\\\u0d82\\\\u0d83\\\\u0dca\\\\u0dcf-\\\\u0dd4\\\\u0dd6\\\\u0dd8-\\\\u0ddf\\\\u0df2\\\\u0df3\\\\u0e34-\\\\u0e3a\\\\u0e40-\\\\u0e45\\\\u0e50-\\\\u0e59\\\\u0eb4-\\\\u0eb9\\\\u0ec8-\\\\u0ecd\\\\u0ed0-\\\\u0ed9\\\\u0f18\\\\u0f19\\\\u0f20-\\\\u0f29\\\\u0f35\\\\u0f37\\\\u0f39\\\\u0f41-\\\\u0f47\\\\u0f71-\\\\u0f84\\\\u0f86-\\\\u0f87\\\\u0f8d-\\\\u0f97\\\\u0f99-\\\\u0fbc\\\\u0fc6\\\\u1000-\\\\u1029\\\\u1040-\\\\u1049\\\\u1067-\\\\u106d\\\\u1071-\\\\u1074\\\\u1082-\\\\u108d\\\\u108f-\\\\u109d\\\\u135d-\\\\u135f\\\\u170e-\\\\u1710\\\\u1720-\\\\u1730\\\\u1740-\\\\u1750\\\\u1772\\\\u1773\\\\u1780-\\\\u17b2\\\\u17dd\\\\u17e0-\\\\u17e9\\\\u180b-\\\\u180d\\\\u1810-\\\\u1819\\\\u1920-\\\\u192b\\\\u1930-\\\\u193b\\\\u1951-\\\\u196d\\\\u19b0-\\\\u19c0\\\\u19c8-\\\\u19c9\\\\u19d0-\\\\u19d9\\\\u1a00-\\\\u1a15\\\\u1a20-\\\\u1a53\\\\u1a60-\\\\u1a7c\\\\u1a7f-\\\\u1a89\\\\u1a90-\\\\u1a99\\\\u1b46-\\\\u1b4b\\\\u1b50-\\\\u1b59\\\\u1b6b-\\\\u1b73\\\\u1bb0-\\\\u1bb9\\\\u1be6-\\\\u1bf3\\\\u1c00-\\\\u1c22\\\\u1c40-\\\\u1c49\\\\u1c5b-\\\\u1c7d\\\\u1cd0-\\\\u1cd2\\\\u1d00-\\\\u1dbe\\\\u1e01-\\\\u1f15\\\\u200c\\\\u200d\\\\u203f\\\\u2040\\\\u2054\\\\u20d0-\\\\u20dc\\\\u20e1\\\\u20e5-\\\\u20f0\\\\u2d81-\\\\u2d96\\\\u2de0-\\\\u2dff\\\\u3021-\\\\u3028\\\\u3099\\\\u309a\\\\ua640-\\\\ua66d\\\\ua674-\\\\ua67d\\\\ua69f\\\\ua6f0-\\\\ua6f1\\\\ua7f8-\\\\ua800\\\\ua806\\\\ua80b\\\\ua823-\\\\ua827\\\\ua880-\\\\ua881\\\\ua8b4-\\\\ua8c4\\\\ua8d0-\\\\ua8d9\\\\ua8f3-\\\\ua8f7\\\\ua900-\\\\ua909\\\\ua926-\\\\ua92d\\\\ua930-\\\\ua945\\\\ua980-\\\\ua983\\\\ua9b3-\\\\ua9c0\\\\uaa00-\\\\uaa27\\\\uaa40-\\\\uaa41\\\\uaa4c-\\\\uaa4d\\\\uaa50-\\\\uaa59\\\\uaa7b\\\\uaae0-\\\\uaae9\\\\uaaf2-\\\\uaaf3\\\\uabc0-\\\\uabe1\\\\uabec\\\\uabed\\\\uabf0-\\\\uabf9\\\\ufb20-\\\\ufb28\\\\ufe00-\\\\ufe0f\\\\ufe20-\\\\ufe26\\\\ufe33\\\\ufe34\\\\ufe4d-\\\\ufe4f\\\\uff10-\\\\uff19\\\\uff3f\";\n//var nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\");\n//var nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\");\n\nvar unicodeEscapeOrCodePoint = \"\\\\\\\\u[0-9a-fA-F]{4}|\\\\\\\\u\\\\{[0-9a-fA-F]+\\\\}\";\nvar identifierStart = \"(?:\" + unicodeEscapeOrCodePoint + \"|[\" + baseASCIIidentifierStartChars + nonASCIIidentifierStartChars + \"])\";\nvar identifierChars = \"(?:\" + unicodeEscapeOrCodePoint + \"|[\" + baseASCIIidentifierChars + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"])*\";\n\nexports.identifier = new RegExp(identifierStart + identifierChars, 'g');\nexports.identifierStart = new RegExp(identifierStart);\nexports.identifierMatch = new RegExp(\"(?:\" + unicodeEscapeOrCodePoint + \"|[\" + baseASCIIidentifierChars + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"])+\");\n\nvar nonASCIIwhitespace = /[\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/; // jshint ignore:line\n\n// Whether a single character denotes a newline.\n\nexports.newline = /[\\n\\r\\u2028\\u2029]/;\n\n// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\n\n// in javascript, these two differ\n// in python they are the same, different methods are called on them\nexports.lineBreak = new RegExp('\\r\\n|' + exports.newline.source);\nexports.allLineBreaks = new RegExp(exports.lineBreak.source, 'g');\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar BaseOptions = require('../core/options').Options;\n\nvar validPositionValues = ['before-newline', 'after-newline', 'preserve-newline'];\n\nfunction Options(options) {\n BaseOptions.call(this, options, 'js');\n\n // compatibility, re\n var raw_brace_style = this.raw_options.brace_style || null;\n if (raw_brace_style === \"expand-strict\") { //graceful handling of deprecated option\n this.raw_options.brace_style = \"expand\";\n } else if (raw_brace_style === \"collapse-preserve-inline\") { //graceful handling of deprecated option\n this.raw_options.brace_style = \"collapse,preserve-inline\";\n } else if (this.raw_options.braces_on_own_line !== undefined) { //graceful handling of deprecated option\n this.raw_options.brace_style = this.raw_options.braces_on_own_line ? \"expand\" : \"collapse\";\n // } else if (!raw_brace_style) { //Nothing exists to set it\n // raw_brace_style = \"collapse\";\n }\n\n //preserve-inline in delimited string will trigger brace_preserve_inline, everything\n //else is considered a brace_style and the last one only will have an effect\n\n var brace_style_split = this._get_selection_list('brace_style', ['collapse', 'expand', 'end-expand', 'none', 'preserve-inline']);\n\n this.brace_preserve_inline = false; //Defaults in case one or other was not specified in meta-option\n this.brace_style = \"collapse\";\n\n for (var bs = 0; bs < brace_style_split.length; bs++) {\n if (brace_style_split[bs] === \"preserve-inline\") {\n this.brace_preserve_inline = true;\n } else {\n this.brace_style = brace_style_split[bs];\n }\n }\n\n this.unindent_chained_methods = this._get_boolean('unindent_chained_methods');\n this.break_chained_methods = this._get_boolean('break_chained_methods');\n this.space_in_paren = this._get_boolean('space_in_paren');\n this.space_in_empty_paren = this._get_boolean('space_in_empty_paren');\n this.jslint_happy = this._get_boolean('jslint_happy');\n this.space_after_anon_function = this._get_boolean('space_after_anon_function');\n this.space_after_named_function = this._get_boolean('space_after_named_function');\n this.keep_array_indentation = this._get_boolean('keep_array_indentation');\n this.space_before_conditional = this._get_boolean('space_before_conditional', true);\n this.unescape_strings = this._get_boolean('unescape_strings');\n this.e4x = this._get_boolean('e4x');\n this.comma_first = this._get_boolean('comma_first');\n this.operator_position = this._get_selection('operator_position', validPositionValues);\n\n // For testing of beautify preserve:start directive\n this.test_output_raw = this._get_boolean('test_output_raw');\n\n // force this._options.space_after_anon_function to true if this._options.jslint_happy\n if (this.jslint_happy) {\n this.space_after_anon_function = true;\n }\n\n}\nOptions.prototype = new BaseOptions();\n\n\n\nmodule.exports.Options = Options;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nfunction Options(options, merge_child_field) {\n this.raw_options = _mergeOpts(options, merge_child_field);\n\n // Support passing the source text back with no change\n this.disabled = this._get_boolean('disabled');\n\n this.eol = this._get_characters('eol', 'auto');\n this.end_with_newline = this._get_boolean('end_with_newline');\n this.indent_size = this._get_number('indent_size', 4);\n this.indent_char = this._get_characters('indent_char', ' ');\n this.indent_level = this._get_number('indent_level');\n\n this.preserve_newlines = this._get_boolean('preserve_newlines', true);\n this.max_preserve_newlines = this._get_number('max_preserve_newlines', 32786);\n if (!this.preserve_newlines) {\n this.max_preserve_newlines = 0;\n }\n\n this.indent_with_tabs = this._get_boolean('indent_with_tabs', this.indent_char === '\\t');\n if (this.indent_with_tabs) {\n this.indent_char = '\\t';\n\n // indent_size behavior changed after 1.8.6\n // It used to be that indent_size would be\n // set to 1 for indent_with_tabs. That is no longer needed and\n // actually doesn't make sense - why not use spaces? Further,\n // that might produce unexpected behavior - tabs being used\n // for single-column alignment. So, when indent_with_tabs is true\n // and indent_size is 1, reset indent_size to 4.\n if (this.indent_size === 1) {\n this.indent_size = 4;\n }\n }\n\n // Backwards compat with 1.3.x\n this.wrap_line_length = this._get_number('wrap_line_length', this._get_number('max_char'));\n\n this.indent_empty_lines = this._get_boolean('indent_empty_lines');\n\n // valid templating languages ['django', 'erb', 'handlebars', 'php', 'smarty', 'angular']\n // For now, 'auto' = all off for javascript, all on for html (and inline javascript).\n // other values ignored\n this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php', 'smarty', 'angular'], ['auto']);\n}\n\nOptions.prototype._get_array = function(name, default_value) {\n var option_value = this.raw_options[name];\n var result = default_value || [];\n if (typeof option_value === 'object') {\n if (option_value !== null && typeof option_value.concat === 'function') {\n result = option_value.concat();\n }\n } else if (typeof option_value === 'string') {\n result = option_value.split(/[^a-zA-Z0-9_\\/\\-]+/);\n }\n return result;\n};\n\nOptions.prototype._get_boolean = function(name, default_value) {\n var option_value = this.raw_options[name];\n var result = option_value === undefined ? !!default_value : !!option_value;\n return result;\n};\n\nOptions.prototype._get_characters = function(name, default_value) {\n var option_value = this.raw_options[name];\n var result = default_value || '';\n if (typeof option_value === 'string') {\n result = option_value.replace(/\\\\r/, '\\r').replace(/\\\\n/, '\\n').replace(/\\\\t/, '\\t');\n }\n return result;\n};\n\nOptions.prototype._get_number = function(name, default_value) {\n var option_value = this.raw_options[name];\n default_value = parseInt(default_value, 10);\n if (isNaN(default_value)) {\n default_value = 0;\n }\n var result = parseInt(option_value, 10);\n if (isNaN(result)) {\n result = default_value;\n }\n return result;\n};\n\nOptions.prototype._get_selection = function(name, selection_list, default_value) {\n var result = this._get_selection_list(name, selection_list, default_value);\n if (result.length !== 1) {\n throw new Error(\n \"Invalid Option Value: The option '\" + name + \"' can only be one of the following values:\\n\" +\n selection_list + \"\\nYou passed in: '\" + this.raw_options[name] + \"'\");\n }\n\n return result[0];\n};\n\n\nOptions.prototype._get_selection_list = function(name, selection_list, default_value) {\n if (!selection_list || selection_list.length === 0) {\n throw new Error(\"Selection list cannot be empty.\");\n }\n\n default_value = default_value || [selection_list[0]];\n if (!this._is_valid_selection(default_value, selection_list)) {\n throw new Error(\"Invalid Default Value!\");\n }\n\n var result = this._get_array(name, default_value);\n if (!this._is_valid_selection(result, selection_list)) {\n throw new Error(\n \"Invalid Option Value: The option '\" + name + \"' can contain only the following values:\\n\" +\n selection_list + \"\\nYou passed in: '\" + this.raw_options[name] + \"'\");\n }\n\n return result;\n};\n\nOptions.prototype._is_valid_selection = function(result, selection_list) {\n return result.length && selection_list.length &&\n !result.some(function(item) { return selection_list.indexOf(item) === -1; });\n};\n\n\n// merges child options up with the parent options object\n// Example: obj = {a: 1, b: {a: 2}}\n// mergeOpts(obj, 'b')\n//\n// Returns: {a: 2}\nfunction _mergeOpts(allOptions, childFieldName) {\n var finalOpts = {};\n allOptions = _normalizeOpts(allOptions);\n var name;\n\n for (name in allOptions) {\n if (name !== childFieldName) {\n finalOpts[name] = allOptions[name];\n }\n }\n\n //merge in the per type settings for the childFieldName\n if (childFieldName && allOptions[childFieldName]) {\n for (name in allOptions[childFieldName]) {\n finalOpts[name] = allOptions[childFieldName][name];\n }\n }\n return finalOpts;\n}\n\nfunction _normalizeOpts(options) {\n var convertedOpts = {};\n var key;\n\n for (key in options) {\n var newKey = key.replace(/-/g, \"_\");\n convertedOpts[newKey] = options[key];\n }\n return convertedOpts;\n}\n\nmodule.exports.Options = Options;\nmodule.exports.normalizeOpts = _normalizeOpts;\nmodule.exports.mergeOpts = _mergeOpts;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar InputScanner = require('../core/inputscanner').InputScanner;\nvar BaseTokenizer = require('../core/tokenizer').Tokenizer;\nvar BASETOKEN = require('../core/tokenizer').TOKEN;\nvar Directives = require('../core/directives').Directives;\nvar acorn = require('./acorn');\nvar Pattern = require('../core/pattern').Pattern;\nvar TemplatablePattern = require('../core/templatablepattern').TemplatablePattern;\n\n\nfunction in_array(what, arr) {\n return arr.indexOf(what) !== -1;\n}\n\n\nvar TOKEN = {\n START_EXPR: 'TK_START_EXPR',\n END_EXPR: 'TK_END_EXPR',\n START_BLOCK: 'TK_START_BLOCK',\n END_BLOCK: 'TK_END_BLOCK',\n WORD: 'TK_WORD',\n RESERVED: 'TK_RESERVED',\n SEMICOLON: 'TK_SEMICOLON',\n STRING: 'TK_STRING',\n EQUALS: 'TK_EQUALS',\n OPERATOR: 'TK_OPERATOR',\n COMMA: 'TK_COMMA',\n BLOCK_COMMENT: 'TK_BLOCK_COMMENT',\n COMMENT: 'TK_COMMENT',\n DOT: 'TK_DOT',\n UNKNOWN: 'TK_UNKNOWN',\n START: BASETOKEN.START,\n RAW: BASETOKEN.RAW,\n EOF: BASETOKEN.EOF\n};\n\n\nvar directives_core = new Directives(/\\/\\*/, /\\*\\//);\n\nvar number_pattern = /0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\\d[\\d_]*n|(?:\\.\\d[\\d_]*|\\d[\\d_]*\\.?[\\d_]*)(?:[eE][+-]?[\\d_]+)?/;\n\nvar digit = /[0-9]/;\n\n// Dot \".\" must be distinguished from \"...\" and decimal\nvar dot_pattern = /[^\\d\\.]/;\n\nvar positionable_operators = (\n \">>> === !== &&= ??= ||= \" +\n \"<< && >= ** != == <= >> || ?? |> \" +\n \"< / - + > : & % ? ^ | *\").split(' ');\n\n// IMPORTANT: this must be sorted longest to shortest or tokenizing many not work.\n// Also, you must update possitionable operators separately from punct\nvar punct =\n \">>>= \" +\n \"... >>= <<= === >>> !== **= &&= ??= ||= \" +\n \"=> ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> \" +\n \"= ! ? > < : / ^ - + * & % ~ |\";\n\npunct = punct.replace(/[-[\\]{}()*+?.,\\\\^$|#]/g, \"\\\\$&\");\n// ?. but not if followed by a number \npunct = '\\\\?\\\\.(?!\\\\d) ' + punct;\npunct = punct.replace(/ /g, '|');\n\nvar punct_pattern = new RegExp(punct);\n\n// words which should always start on new line.\nvar line_starters = 'continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export'.split(',');\nvar reserved_words = line_starters.concat(['do', 'in', 'of', 'else', 'get', 'set', 'new', 'catch', 'finally', 'typeof', 'yield', 'async', 'await', 'from', 'as', 'class', 'extends']);\nvar reserved_word_pattern = new RegExp('^(?:' + reserved_words.join('|') + ')$');\n\n// var template_pattern = /(?:(?:<\\?php|<\\?=)[\\s\\S]*?\\?>)|(?:<%[\\s\\S]*?%>)/g;\n\nvar in_html_comment;\n\nvar Tokenizer = function(input_string, options) {\n BaseTokenizer.call(this, input_string, options);\n\n this._patterns.whitespace = this._patterns.whitespace.matching(\n /\\u00A0\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff/.source,\n /\\u2028\\u2029/.source);\n\n var pattern_reader = new Pattern(this._input);\n var templatable = new TemplatablePattern(this._input)\n .read_options(this._options);\n\n this.__patterns = {\n template: templatable,\n identifier: templatable.starting_with(acorn.identifier).matching(acorn.identifierMatch),\n number: pattern_reader.matching(number_pattern),\n punct: pattern_reader.matching(punct_pattern),\n // comment ends just before nearest linefeed or end of file\n comment: pattern_reader.starting_with(/\\/\\//).until(/[\\n\\r\\u2028\\u2029]/),\n // /* ... */ comment ends with nearest */ or end of file\n block_comment: pattern_reader.starting_with(/\\/\\*/).until_after(/\\*\\//),\n html_comment_start: pattern_reader.matching(//),\n include: pattern_reader.starting_with(/#include/).until_after(acorn.lineBreak),\n shebang: pattern_reader.starting_with(/#!/).until_after(acorn.lineBreak),\n xml: pattern_reader.matching(/[\\s\\S]*?<(\\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\\[CDATA\\[[^\\]]*?\\]\\]|)(\\s*{[^}]+?}|\\s+[-a-zA-Z:0-9_.]+|\\s+[-a-zA-Z:0-9_.]+\\s*=\\s*('[^']*'|\"[^\"]*\"|{([^{}]|{[^}]+?})+?}))*\\s*(\\/?)\\s*>/),\n single_quote: templatable.until(/['\\\\\\n\\r\\u2028\\u2029]/),\n double_quote: templatable.until(/[\"\\\\\\n\\r\\u2028\\u2029]/),\n template_text: templatable.until(/[`\\\\$]/),\n template_expression: templatable.until(/[`}\\\\]/)\n };\n\n};\nTokenizer.prototype = new BaseTokenizer();\n\nTokenizer.prototype._is_comment = function(current_token) {\n return current_token.type === TOKEN.COMMENT || current_token.type === TOKEN.BLOCK_COMMENT || current_token.type === TOKEN.UNKNOWN;\n};\n\nTokenizer.prototype._is_opening = function(current_token) {\n return current_token.type === TOKEN.START_BLOCK || current_token.type === TOKEN.START_EXPR;\n};\n\nTokenizer.prototype._is_closing = function(current_token, open_token) {\n return (current_token.type === TOKEN.END_BLOCK || current_token.type === TOKEN.END_EXPR) &&\n (open_token && (\n (current_token.text === ']' && open_token.text === '[') ||\n (current_token.text === ')' && open_token.text === '(') ||\n (current_token.text === '}' && open_token.text === '{')));\n};\n\nTokenizer.prototype._reset = function() {\n in_html_comment = false;\n};\n\nTokenizer.prototype._get_next_token = function(previous_token, open_token) { // jshint unused:false\n var token = null;\n this._readWhitespace();\n var c = this._input.peek();\n\n if (c === null) {\n return this._create_token(TOKEN.EOF, '');\n }\n\n token = token || this._read_non_javascript(c);\n token = token || this._read_string(c);\n token = token || this._read_pair(c, this._input.peek(1)); // Issue #2062 hack for record type '#{'\n token = token || this._read_word(previous_token);\n token = token || this._read_singles(c);\n token = token || this._read_comment(c);\n token = token || this._read_regexp(c, previous_token);\n token = token || this._read_xml(c, previous_token);\n token = token || this._read_punctuation();\n token = token || this._create_token(TOKEN.UNKNOWN, this._input.next());\n\n return token;\n};\n\nTokenizer.prototype._read_word = function(previous_token) {\n var resulting_string;\n resulting_string = this.__patterns.identifier.read();\n if (resulting_string !== '') {\n resulting_string = resulting_string.replace(acorn.allLineBreaks, '\\n');\n if (!(previous_token.type === TOKEN.DOT ||\n (previous_token.type === TOKEN.RESERVED && (previous_token.text === 'set' || previous_token.text === 'get'))) &&\n reserved_word_pattern.test(resulting_string)) {\n if ((resulting_string === 'in' || resulting_string === 'of') &&\n (previous_token.type === TOKEN.WORD || previous_token.type === TOKEN.STRING)) { // hack for 'in' and 'of' operators\n return this._create_token(TOKEN.OPERATOR, resulting_string);\n }\n return this._create_token(TOKEN.RESERVED, resulting_string);\n }\n return this._create_token(TOKEN.WORD, resulting_string);\n }\n\n resulting_string = this.__patterns.number.read();\n if (resulting_string !== '') {\n return this._create_token(TOKEN.WORD, resulting_string);\n }\n};\n\nTokenizer.prototype._read_singles = function(c) {\n var token = null;\n if (c === '(' || c === '[') {\n token = this._create_token(TOKEN.START_EXPR, c);\n } else if (c === ')' || c === ']') {\n token = this._create_token(TOKEN.END_EXPR, c);\n } else if (c === '{') {\n token = this._create_token(TOKEN.START_BLOCK, c);\n } else if (c === '}') {\n token = this._create_token(TOKEN.END_BLOCK, c);\n } else if (c === ';') {\n token = this._create_token(TOKEN.SEMICOLON, c);\n } else if (c === '.' && dot_pattern.test(this._input.peek(1))) {\n token = this._create_token(TOKEN.DOT, c);\n } else if (c === ',') {\n token = this._create_token(TOKEN.COMMA, c);\n }\n\n if (token) {\n this._input.next();\n }\n return token;\n};\n\nTokenizer.prototype._read_pair = function(c, d) {\n var token = null;\n if (c === '#' && d === '{') {\n token = this._create_token(TOKEN.START_BLOCK, c + d);\n }\n\n if (token) {\n this._input.next();\n this._input.next();\n }\n return token;\n};\n\nTokenizer.prototype._read_punctuation = function() {\n var resulting_string = this.__patterns.punct.read();\n\n if (resulting_string !== '') {\n if (resulting_string === '=') {\n return this._create_token(TOKEN.EQUALS, resulting_string);\n } else if (resulting_string === '?.') {\n return this._create_token(TOKEN.DOT, resulting_string);\n } else {\n return this._create_token(TOKEN.OPERATOR, resulting_string);\n }\n }\n};\n\nTokenizer.prototype._read_non_javascript = function(c) {\n var resulting_string = '';\n\n if (c === '#') {\n if (this._is_first_token()) {\n resulting_string = this.__patterns.shebang.read();\n\n if (resulting_string) {\n return this._create_token(TOKEN.UNKNOWN, resulting_string.trim() + '\\n');\n }\n }\n\n // handles extendscript #includes\n resulting_string = this.__patterns.include.read();\n\n if (resulting_string) {\n return this._create_token(TOKEN.UNKNOWN, resulting_string.trim() + '\\n');\n }\n\n c = this._input.next();\n\n // Spidermonkey-specific sharp variables for circular references. Considered obsolete.\n var sharp = '#';\n if (this._input.hasNext() && this._input.testChar(digit)) {\n do {\n c = this._input.next();\n sharp += c;\n } while (this._input.hasNext() && c !== '#' && c !== '=');\n if (c === '#') {\n //\n } else if (this._input.peek() === '[' && this._input.peek(1) === ']') {\n sharp += '[]';\n this._input.next();\n this._input.next();\n } else if (this._input.peek() === '{' && this._input.peek(1) === '}') {\n sharp += '{}';\n this._input.next();\n this._input.next();\n }\n return this._create_token(TOKEN.WORD, sharp);\n }\n\n this._input.back();\n\n } else if (c === '<' && this._is_first_token()) {\n resulting_string = this.__patterns.html_comment_start.read();\n if (resulting_string) {\n while (this._input.hasNext() && !this._input.testChar(acorn.newline)) {\n resulting_string += this._input.next();\n }\n in_html_comment = true;\n return this._create_token(TOKEN.COMMENT, resulting_string);\n }\n } else if (in_html_comment && c === '-') {\n resulting_string = this.__patterns.html_comment_end.read();\n if (resulting_string) {\n in_html_comment = false;\n return this._create_token(TOKEN.COMMENT, resulting_string);\n }\n }\n\n return null;\n};\n\nTokenizer.prototype._read_comment = function(c) {\n var token = null;\n if (c === '/') {\n var comment = '';\n if (this._input.peek(1) === '*') {\n // peek for comment /* ... */\n comment = this.__patterns.block_comment.read();\n var directives = directives_core.get_directives(comment);\n if (directives && directives.ignore === 'start') {\n comment += directives_core.readIgnored(this._input);\n }\n comment = comment.replace(acorn.allLineBreaks, '\\n');\n token = this._create_token(TOKEN.BLOCK_COMMENT, comment);\n token.directives = directives;\n } else if (this._input.peek(1) === '/') {\n // peek for comment // ...\n comment = this.__patterns.comment.read();\n token = this._create_token(TOKEN.COMMENT, comment);\n }\n }\n return token;\n};\n\nTokenizer.prototype._read_string = function(c) {\n if (c === '`' || c === \"'\" || c === '\"') {\n var resulting_string = this._input.next();\n this.has_char_escapes = false;\n\n if (c === '`') {\n resulting_string += this._read_string_recursive('`', true, '${');\n } else {\n resulting_string += this._read_string_recursive(c);\n }\n\n if (this.has_char_escapes && this._options.unescape_strings) {\n resulting_string = unescape_string(resulting_string);\n }\n\n if (this._input.peek() === c) {\n resulting_string += this._input.next();\n }\n\n resulting_string = resulting_string.replace(acorn.allLineBreaks, '\\n');\n\n return this._create_token(TOKEN.STRING, resulting_string);\n }\n\n return null;\n};\n\nTokenizer.prototype._allow_regexp_or_xml = function(previous_token) {\n // regex and xml can only appear in specific locations during parsing\n return (previous_token.type === TOKEN.RESERVED && in_array(previous_token.text, ['return', 'case', 'throw', 'else', 'do', 'typeof', 'yield'])) ||\n (previous_token.type === TOKEN.END_EXPR && previous_token.text === ')' &&\n previous_token.opened.previous.type === TOKEN.RESERVED && in_array(previous_token.opened.previous.text, ['if', 'while', 'for'])) ||\n (in_array(previous_token.type, [TOKEN.COMMENT, TOKEN.START_EXPR, TOKEN.START_BLOCK, TOKEN.START,\n TOKEN.END_BLOCK, TOKEN.OPERATOR, TOKEN.EQUALS, TOKEN.EOF, TOKEN.SEMICOLON, TOKEN.COMMA\n ]));\n};\n\nTokenizer.prototype._read_regexp = function(c, previous_token) {\n\n if (c === '/' && this._allow_regexp_or_xml(previous_token)) {\n // handle regexp\n //\n var resulting_string = this._input.next();\n var esc = false;\n\n var in_char_class = false;\n while (this._input.hasNext() &&\n ((esc || in_char_class || this._input.peek() !== c) &&\n !this._input.testChar(acorn.newline))) {\n resulting_string += this._input.peek();\n if (!esc) {\n esc = this._input.peek() === '\\\\';\n if (this._input.peek() === '[') {\n in_char_class = true;\n } else if (this._input.peek() === ']') {\n in_char_class = false;\n }\n } else {\n esc = false;\n }\n this._input.next();\n }\n\n if (this._input.peek() === c) {\n resulting_string += this._input.next();\n\n // regexps may have modifiers /regexp/MOD , so fetch those, too\n // Only [gim] are valid, but if the user puts in garbage, do what we can to take it.\n resulting_string += this._input.read(acorn.identifier);\n }\n return this._create_token(TOKEN.STRING, resulting_string);\n }\n return null;\n};\n\nTokenizer.prototype._read_xml = function(c, previous_token) {\n\n if (this._options.e4x && c === \"<\" && this._allow_regexp_or_xml(previous_token)) {\n var xmlStr = '';\n var match = this.__patterns.xml.read_match();\n // handle e4x xml literals\n //\n if (match) {\n // Trim root tag to attempt to\n var rootTag = match[2].replace(/^{\\s+/, '{').replace(/\\s+}$/, '}');\n var isCurlyRoot = rootTag.indexOf('{') === 0;\n var depth = 0;\n while (match) {\n var isEndTag = !!match[1];\n var tagName = match[2];\n var isSingletonTag = (!!match[match.length - 1]) || (tagName.slice(0, 8) === \"![CDATA[\");\n if (!isSingletonTag &&\n (tagName === rootTag || (isCurlyRoot && tagName.replace(/^{\\s+/, '{').replace(/\\s+}$/, '}')))) {\n if (isEndTag) {\n --depth;\n } else {\n ++depth;\n }\n }\n xmlStr += match[0];\n if (depth <= 0) {\n break;\n }\n match = this.__patterns.xml.read_match();\n }\n // if we didn't close correctly, keep unformatted.\n if (!match) {\n xmlStr += this._input.match(/[\\s\\S]*/g)[0];\n }\n xmlStr = xmlStr.replace(acorn.allLineBreaks, '\\n');\n return this._create_token(TOKEN.STRING, xmlStr);\n }\n }\n\n return null;\n};\n\nfunction unescape_string(s) {\n // You think that a regex would work for this\n // return s.replace(/\\\\x([0-9a-f]{2})/gi, function(match, val) {\n // return String.fromCharCode(parseInt(val, 16));\n // })\n // However, dealing with '\\xff', '\\\\xff', '\\\\\\xff' makes this more fun.\n var out = '',\n escaped = 0;\n\n var input_scan = new InputScanner(s);\n var matched = null;\n\n while (input_scan.hasNext()) {\n // Keep any whitespace, non-slash characters\n // also keep slash pairs.\n matched = input_scan.match(/([\\s]|[^\\\\]|\\\\\\\\)+/g);\n\n if (matched) {\n out += matched[0];\n }\n\n if (input_scan.peek() === '\\\\') {\n input_scan.next();\n if (input_scan.peek() === 'x') {\n matched = input_scan.match(/x([0-9A-Fa-f]{2})/g);\n } else if (input_scan.peek() === 'u') {\n matched = input_scan.match(/u([0-9A-Fa-f]{4})/g);\n if (!matched) {\n matched = input_scan.match(/u\\{([0-9A-Fa-f]+)\\}/g);\n }\n } else {\n out += '\\\\';\n if (input_scan.hasNext()) {\n out += input_scan.next();\n }\n continue;\n }\n\n // If there's some error decoding, return the original string\n if (!matched) {\n return s;\n }\n\n escaped = parseInt(matched[1], 16);\n\n if (escaped > 0x7e && escaped <= 0xff && matched[0].indexOf('x') === 0) {\n // we bail out on \\x7f..\\xff,\n // leaving whole string escaped,\n // as it's probably completely binary\n return s;\n } else if (escaped >= 0x00 && escaped < 0x20) {\n // leave 0x00...0x1f escaped\n out += '\\\\' + matched[0];\n } else if (escaped > 0x10FFFF) {\n // If the escape sequence is out of bounds, keep the original sequence and continue conversion\n out += '\\\\' + matched[0];\n } else if (escaped === 0x22 || escaped === 0x27 || escaped === 0x5c) {\n // single-quote, apostrophe, backslash - escape these\n out += '\\\\' + String.fromCharCode(escaped);\n } else {\n out += String.fromCharCode(escaped);\n }\n }\n }\n\n return out;\n}\n\n// handle string\n//\nTokenizer.prototype._read_string_recursive = function(delimiter, allow_unescaped_newlines, start_sub) {\n var current_char;\n var pattern;\n if (delimiter === '\\'') {\n pattern = this.__patterns.single_quote;\n } else if (delimiter === '\"') {\n pattern = this.__patterns.double_quote;\n } else if (delimiter === '`') {\n pattern = this.__patterns.template_text;\n } else if (delimiter === '}') {\n pattern = this.__patterns.template_expression;\n }\n\n var resulting_string = pattern.read();\n var next = '';\n while (this._input.hasNext()) {\n next = this._input.next();\n if (next === delimiter ||\n (!allow_unescaped_newlines && acorn.newline.test(next))) {\n this._input.back();\n break;\n } else if (next === '\\\\' && this._input.hasNext()) {\n current_char = this._input.peek();\n\n if (current_char === 'x' || current_char === 'u') {\n this.has_char_escapes = true;\n } else if (current_char === '\\r' && this._input.peek(1) === '\\n') {\n this._input.next();\n }\n next += this._input.next();\n } else if (start_sub) {\n if (start_sub === '${' && next === '$' && this._input.peek() === '{') {\n next += this._input.next();\n }\n\n if (start_sub === next) {\n if (delimiter === '`') {\n next += this._read_string_recursive('}', allow_unescaped_newlines, '`');\n } else {\n next += this._read_string_recursive('`', allow_unescaped_newlines, '${');\n }\n if (this._input.hasNext()) {\n next += this._input.next();\n }\n }\n }\n next += pattern.read();\n resulting_string += next;\n }\n\n return resulting_string;\n};\n\nmodule.exports.Tokenizer = Tokenizer;\nmodule.exports.TOKEN = TOKEN;\nmodule.exports.positionable_operators = positionable_operators.slice();\nmodule.exports.line_starters = line_starters.slice();\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar regexp_has_sticky = RegExp.prototype.hasOwnProperty('sticky');\n\nfunction InputScanner(input_string) {\n this.__input = input_string || '';\n this.__input_length = this.__input.length;\n this.__position = 0;\n}\n\nInputScanner.prototype.restart = function() {\n this.__position = 0;\n};\n\nInputScanner.prototype.back = function() {\n if (this.__position > 0) {\n this.__position -= 1;\n }\n};\n\nInputScanner.prototype.hasNext = function() {\n return this.__position < this.__input_length;\n};\n\nInputScanner.prototype.next = function() {\n var val = null;\n if (this.hasNext()) {\n val = this.__input.charAt(this.__position);\n this.__position += 1;\n }\n return val;\n};\n\nInputScanner.prototype.peek = function(index) {\n var val = null;\n index = index || 0;\n index += this.__position;\n if (index >= 0 && index < this.__input_length) {\n val = this.__input.charAt(index);\n }\n return val;\n};\n\n// This is a JavaScript only helper function (not in python)\n// Javascript doesn't have a match method\n// and not all implementation support \"sticky\" flag.\n// If they do not support sticky then both this.match() and this.test() method\n// must get the match and check the index of the match.\n// If sticky is supported and set, this method will use it.\n// Otherwise it will check that global is set, and fall back to the slower method.\nInputScanner.prototype.__match = function(pattern, index) {\n pattern.lastIndex = index;\n var pattern_match = pattern.exec(this.__input);\n\n if (pattern_match && !(regexp_has_sticky && pattern.sticky)) {\n if (pattern_match.index !== index) {\n pattern_match = null;\n }\n }\n\n return pattern_match;\n};\n\nInputScanner.prototype.test = function(pattern, index) {\n index = index || 0;\n index += this.__position;\n\n if (index >= 0 && index < this.__input_length) {\n return !!this.__match(pattern, index);\n } else {\n return false;\n }\n};\n\nInputScanner.prototype.testChar = function(pattern, index) {\n // test one character regex match\n var val = this.peek(index);\n pattern.lastIndex = 0;\n return val !== null && pattern.test(val);\n};\n\nInputScanner.prototype.match = function(pattern) {\n var pattern_match = this.__match(pattern, this.__position);\n if (pattern_match) {\n this.__position += pattern_match[0].length;\n } else {\n pattern_match = null;\n }\n return pattern_match;\n};\n\nInputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) {\n var val = '';\n var match;\n if (starting_pattern) {\n match = this.match(starting_pattern);\n if (match) {\n val += match[0];\n }\n }\n if (until_pattern && (match || !starting_pattern)) {\n val += this.readUntil(until_pattern, until_after);\n }\n return val;\n};\n\nInputScanner.prototype.readUntil = function(pattern, until_after) {\n var val = '';\n var match_index = this.__position;\n pattern.lastIndex = this.__position;\n var pattern_match = pattern.exec(this.__input);\n if (pattern_match) {\n match_index = pattern_match.index;\n if (until_after) {\n match_index += pattern_match[0].length;\n }\n } else {\n match_index = this.__input_length;\n }\n\n val = this.__input.substring(this.__position, match_index);\n this.__position = match_index;\n return val;\n};\n\nInputScanner.prototype.readUntilAfter = function(pattern) {\n return this.readUntil(pattern, true);\n};\n\nInputScanner.prototype.get_regexp = function(pattern, match_from) {\n var result = null;\n var flags = 'g';\n if (match_from && regexp_has_sticky) {\n flags = 'y';\n }\n // strings are converted to regexp\n if (typeof pattern === \"string\" && pattern !== '') {\n // result = new RegExp(pattern.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), flags);\n result = new RegExp(pattern, flags);\n } else if (pattern) {\n result = new RegExp(pattern.source, flags);\n }\n return result;\n};\n\nInputScanner.prototype.get_literal_regexp = function(literal_string) {\n return RegExp(literal_string.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'));\n};\n\n/* css beautifier legacy helpers */\nInputScanner.prototype.peekUntilAfter = function(pattern) {\n var start = this.__position;\n var val = this.readUntilAfter(pattern);\n this.__position = start;\n return val;\n};\n\nInputScanner.prototype.lookBack = function(testVal) {\n var start = this.__position - 1;\n return start >= testVal.length && this.__input.substring(start - testVal.length, start)\n .toLowerCase() === testVal;\n};\n\nmodule.exports.InputScanner = InputScanner;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar InputScanner = require('../core/inputscanner').InputScanner;\nvar Token = require('../core/token').Token;\nvar TokenStream = require('../core/tokenstream').TokenStream;\nvar WhitespacePattern = require('./whitespacepattern').WhitespacePattern;\n\nvar TOKEN = {\n START: 'TK_START',\n RAW: 'TK_RAW',\n EOF: 'TK_EOF'\n};\n\nvar Tokenizer = function(input_string, options) {\n this._input = new InputScanner(input_string);\n this._options = options || {};\n this.__tokens = null;\n\n this._patterns = {};\n this._patterns.whitespace = new WhitespacePattern(this._input);\n};\n\nTokenizer.prototype.tokenize = function() {\n this._input.restart();\n this.__tokens = new TokenStream();\n\n this._reset();\n\n var current;\n var previous = new Token(TOKEN.START, '');\n var open_token = null;\n var open_stack = [];\n var comments = new TokenStream();\n\n while (previous.type !== TOKEN.EOF) {\n current = this._get_next_token(previous, open_token);\n while (this._is_comment(current)) {\n comments.add(current);\n current = this._get_next_token(previous, open_token);\n }\n\n if (!comments.isEmpty()) {\n current.comments_before = comments;\n comments = new TokenStream();\n }\n\n current.parent = open_token;\n\n if (this._is_opening(current)) {\n open_stack.push(open_token);\n open_token = current;\n } else if (open_token && this._is_closing(current, open_token)) {\n current.opened = open_token;\n open_token.closed = current;\n open_token = open_stack.pop();\n current.parent = open_token;\n }\n\n current.previous = previous;\n previous.next = current;\n\n this.__tokens.add(current);\n previous = current;\n }\n\n return this.__tokens;\n};\n\n\nTokenizer.prototype._is_first_token = function() {\n return this.__tokens.isEmpty();\n};\n\nTokenizer.prototype._reset = function() {};\n\nTokenizer.prototype._get_next_token = function(previous_token, open_token) { // jshint unused:false\n this._readWhitespace();\n var resulting_string = this._input.read(/.+/g);\n if (resulting_string) {\n return this._create_token(TOKEN.RAW, resulting_string);\n } else {\n return this._create_token(TOKEN.EOF, '');\n }\n};\n\nTokenizer.prototype._is_comment = function(current_token) { // jshint unused:false\n return false;\n};\n\nTokenizer.prototype._is_opening = function(current_token) { // jshint unused:false\n return false;\n};\n\nTokenizer.prototype._is_closing = function(current_token, open_token) { // jshint unused:false\n return false;\n};\n\nTokenizer.prototype._create_token = function(type, text) {\n var token = new Token(type, text,\n this._patterns.whitespace.newline_count,\n this._patterns.whitespace.whitespace_before_token);\n return token;\n};\n\nTokenizer.prototype._readWhitespace = function() {\n return this._patterns.whitespace.read();\n};\n\n\n\nmodule.exports.Tokenizer = Tokenizer;\nmodule.exports.TOKEN = TOKEN;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nfunction TokenStream(parent_token) {\n // private\n this.__tokens = [];\n this.__tokens_length = this.__tokens.length;\n this.__position = 0;\n this.__parent_token = parent_token;\n}\n\nTokenStream.prototype.restart = function() {\n this.__position = 0;\n};\n\nTokenStream.prototype.isEmpty = function() {\n return this.__tokens_length === 0;\n};\n\nTokenStream.prototype.hasNext = function() {\n return this.__position < this.__tokens_length;\n};\n\nTokenStream.prototype.next = function() {\n var val = null;\n if (this.hasNext()) {\n val = this.__tokens[this.__position];\n this.__position += 1;\n }\n return val;\n};\n\nTokenStream.prototype.peek = function(index) {\n var val = null;\n index = index || 0;\n index += this.__position;\n if (index >= 0 && index < this.__tokens_length) {\n val = this.__tokens[index];\n }\n return val;\n};\n\nTokenStream.prototype.add = function(token) {\n if (this.__parent_token) {\n token.parent = this.__parent_token;\n }\n this.__tokens.push(token);\n this.__tokens_length += 1;\n};\n\nmodule.exports.TokenStream = TokenStream;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar Pattern = require('../core/pattern').Pattern;\n\nfunction WhitespacePattern(input_scanner, parent) {\n Pattern.call(this, input_scanner, parent);\n if (parent) {\n this._line_regexp = this._input.get_regexp(parent._line_regexp);\n } else {\n this.__set_whitespace_patterns('', '');\n }\n\n this.newline_count = 0;\n this.whitespace_before_token = '';\n}\nWhitespacePattern.prototype = new Pattern();\n\nWhitespacePattern.prototype.__set_whitespace_patterns = function(whitespace_chars, newline_chars) {\n whitespace_chars += '\\\\t ';\n newline_chars += '\\\\n\\\\r';\n\n this._match_pattern = this._input.get_regexp(\n '[' + whitespace_chars + newline_chars + ']+', true);\n this._newline_regexp = this._input.get_regexp(\n '\\\\r\\\\n|[' + newline_chars + ']');\n};\n\nWhitespacePattern.prototype.read = function() {\n this.newline_count = 0;\n this.whitespace_before_token = '';\n\n var resulting_string = this._input.read(this._match_pattern);\n if (resulting_string === ' ') {\n this.whitespace_before_token = ' ';\n } else if (resulting_string) {\n var matches = this.__split(this._newline_regexp, resulting_string);\n this.newline_count = matches.length - 1;\n this.whitespace_before_token = matches[this.newline_count];\n }\n\n return resulting_string;\n};\n\nWhitespacePattern.prototype.matching = function(whitespace_chars, newline_chars) {\n var result = this._create();\n result.__set_whitespace_patterns(whitespace_chars, newline_chars);\n result._update();\n return result;\n};\n\nWhitespacePattern.prototype._create = function() {\n return new WhitespacePattern(this._input, this);\n};\n\nWhitespacePattern.prototype.__split = function(regexp, input_string) {\n regexp.lastIndex = 0;\n var start_index = 0;\n var result = [];\n var next_match = regexp.exec(input_string);\n while (next_match) {\n result.push(input_string.substring(start_index, next_match.index));\n start_index = next_match.index + next_match[0].length;\n next_match = regexp.exec(input_string);\n }\n\n if (start_index < input_string.length) {\n result.push(input_string.substring(start_index, input_string.length));\n } else {\n result.push('');\n }\n\n return result;\n};\n\n\n\nmodule.exports.WhitespacePattern = WhitespacePattern;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nfunction Pattern(input_scanner, parent) {\n this._input = input_scanner;\n this._starting_pattern = null;\n this._match_pattern = null;\n this._until_pattern = null;\n this._until_after = false;\n\n if (parent) {\n this._starting_pattern = this._input.get_regexp(parent._starting_pattern, true);\n this._match_pattern = this._input.get_regexp(parent._match_pattern, true);\n this._until_pattern = this._input.get_regexp(parent._until_pattern);\n this._until_after = parent._until_after;\n }\n}\n\nPattern.prototype.read = function() {\n var result = this._input.read(this._starting_pattern);\n if (!this._starting_pattern || result) {\n result += this._input.read(this._match_pattern, this._until_pattern, this._until_after);\n }\n return result;\n};\n\nPattern.prototype.read_match = function() {\n return this._input.match(this._match_pattern);\n};\n\nPattern.prototype.until_after = function(pattern) {\n var result = this._create();\n result._until_after = true;\n result._until_pattern = this._input.get_regexp(pattern);\n result._update();\n return result;\n};\n\nPattern.prototype.until = function(pattern) {\n var result = this._create();\n result._until_after = false;\n result._until_pattern = this._input.get_regexp(pattern);\n result._update();\n return result;\n};\n\nPattern.prototype.starting_with = function(pattern) {\n var result = this._create();\n result._starting_pattern = this._input.get_regexp(pattern, true);\n result._update();\n return result;\n};\n\nPattern.prototype.matching = function(pattern) {\n var result = this._create();\n result._match_pattern = this._input.get_regexp(pattern, true);\n result._update();\n return result;\n};\n\nPattern.prototype._create = function() {\n return new Pattern(this._input, this);\n};\n\nPattern.prototype._update = function() {};\n\nmodule.exports.Pattern = Pattern;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nfunction Directives(start_block_pattern, end_block_pattern) {\n start_block_pattern = typeof start_block_pattern === 'string' ? start_block_pattern : start_block_pattern.source;\n end_block_pattern = typeof end_block_pattern === 'string' ? end_block_pattern : end_block_pattern.source;\n this.__directives_block_pattern = new RegExp(start_block_pattern + / beautify( \\w+[:]\\w+)+ /.source + end_block_pattern, 'g');\n this.__directive_pattern = / (\\w+)[:](\\w+)/g;\n\n this.__directives_end_ignore_pattern = new RegExp(start_block_pattern + /\\sbeautify\\signore:end\\s/.source + end_block_pattern, 'g');\n}\n\nDirectives.prototype.get_directives = function(text) {\n if (!text.match(this.__directives_block_pattern)) {\n return null;\n }\n\n var directives = {};\n this.__directive_pattern.lastIndex = 0;\n var directive_match = this.__directive_pattern.exec(text);\n\n while (directive_match) {\n directives[directive_match[1]] = directive_match[2];\n directive_match = this.__directive_pattern.exec(text);\n }\n\n return directives;\n};\n\nDirectives.prototype.readIgnored = function(input) {\n return input.readUntilAfter(this.__directives_end_ignore_pattern);\n};\n\n\nmodule.exports.Directives = Directives;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar Pattern = require('./pattern').Pattern;\n\n\nvar template_names = {\n django: false,\n erb: false,\n handlebars: false,\n php: false,\n smarty: false,\n angular: false\n};\n\n// This lets templates appear anywhere we would do a readUntil\n// The cost is higher but it is pay to play.\nfunction TemplatablePattern(input_scanner, parent) {\n Pattern.call(this, input_scanner, parent);\n this.__template_pattern = null;\n this._disabled = Object.assign({}, template_names);\n this._excluded = Object.assign({}, template_names);\n\n if (parent) {\n this.__template_pattern = this._input.get_regexp(parent.__template_pattern);\n this._excluded = Object.assign(this._excluded, parent._excluded);\n this._disabled = Object.assign(this._disabled, parent._disabled);\n }\n var pattern = new Pattern(input_scanner);\n this.__patterns = {\n handlebars_comment: pattern.starting_with(/{{!--/).until_after(/--}}/),\n handlebars_unescaped: pattern.starting_with(/{{{/).until_after(/}}}/),\n handlebars: pattern.starting_with(/{{/).until_after(/}}/),\n php: pattern.starting_with(/<\\?(?:[= ]|php)/).until_after(/\\?>/),\n erb: pattern.starting_with(/<%[^%]/).until_after(/[^%]%>/),\n // django coflicts with handlebars a bit.\n django: pattern.starting_with(/{%/).until_after(/%}/),\n django_value: pattern.starting_with(/{{/).until_after(/}}/),\n django_comment: pattern.starting_with(/{#/).until_after(/#}/),\n smarty: pattern.starting_with(/{(?=[^}{\\s\\n])/).until_after(/[^\\s\\n]}/),\n smarty_comment: pattern.starting_with(/{\\*/).until_after(/\\*}/),\n smarty_literal: pattern.starting_with(/{literal}/).until_after(/{\\/literal}/)\n };\n}\nTemplatablePattern.prototype = new Pattern();\n\nTemplatablePattern.prototype._create = function() {\n return new TemplatablePattern(this._input, this);\n};\n\nTemplatablePattern.prototype._update = function() {\n this.__set_templated_pattern();\n};\n\nTemplatablePattern.prototype.disable = function(language) {\n var result = this._create();\n result._disabled[language] = true;\n result._update();\n return result;\n};\n\nTemplatablePattern.prototype.read_options = function(options) {\n var result = this._create();\n for (var language in template_names) {\n result._disabled[language] = options.templating.indexOf(language) === -1;\n }\n result._update();\n return result;\n};\n\nTemplatablePattern.prototype.exclude = function(language) {\n var result = this._create();\n result._excluded[language] = true;\n result._update();\n return result;\n};\n\nTemplatablePattern.prototype.read = function() {\n var result = '';\n if (this._match_pattern) {\n result = this._input.read(this._starting_pattern);\n } else {\n result = this._input.read(this._starting_pattern, this.__template_pattern);\n }\n var next = this._read_template();\n while (next) {\n if (this._match_pattern) {\n next += this._input.read(this._match_pattern);\n } else {\n next += this._input.readUntil(this.__template_pattern);\n }\n result += next;\n next = this._read_template();\n }\n\n if (this._until_after) {\n result += this._input.readUntilAfter(this._until_pattern);\n }\n return result;\n};\n\nTemplatablePattern.prototype.__set_templated_pattern = function() {\n var items = [];\n\n if (!this._disabled.php) {\n items.push(this.__patterns.php._starting_pattern.source);\n }\n if (!this._disabled.handlebars) {\n items.push(this.__patterns.handlebars._starting_pattern.source);\n }\n if (!this._disabled.erb) {\n items.push(this.__patterns.erb._starting_pattern.source);\n }\n if (!this._disabled.django) {\n items.push(this.__patterns.django._starting_pattern.source);\n // The starting pattern for django is more complex because it has different\n // patterns for value, comment, and other sections\n items.push(this.__patterns.django_value._starting_pattern.source);\n items.push(this.__patterns.django_comment._starting_pattern.source);\n }\n if (!this._disabled.smarty) {\n items.push(this.__patterns.smarty._starting_pattern.source);\n }\n\n if (this._until_pattern) {\n items.push(this._until_pattern.source);\n }\n this.__template_pattern = this._input.get_regexp('(?:' + items.join('|') + ')');\n};\n\nTemplatablePattern.prototype._read_template = function() {\n var resulting_string = '';\n var c = this._input.peek();\n if (c === '<') {\n var peek1 = this._input.peek(1);\n //if we're in a comment, do something special\n // We treat all comments as literals, even more than preformatted tags\n // we just look for the appropriate close tag\n if (!this._disabled.php && !this._excluded.php && peek1 === '?') {\n resulting_string = resulting_string ||\n this.__patterns.php.read();\n }\n if (!this._disabled.erb && !this._excluded.erb && peek1 === '%') {\n resulting_string = resulting_string ||\n this.__patterns.erb.read();\n }\n } else if (c === '{') {\n if (!this._disabled.handlebars && !this._excluded.handlebars) {\n resulting_string = resulting_string ||\n this.__patterns.handlebars_comment.read();\n resulting_string = resulting_string ||\n this.__patterns.handlebars_unescaped.read();\n resulting_string = resulting_string ||\n this.__patterns.handlebars.read();\n }\n if (!this._disabled.django) {\n // django coflicts with handlebars a bit.\n if (!this._excluded.django && !this._excluded.handlebars) {\n resulting_string = resulting_string ||\n this.__patterns.django_value.read();\n }\n if (!this._excluded.django) {\n resulting_string = resulting_string ||\n this.__patterns.django_comment.read();\n resulting_string = resulting_string ||\n this.__patterns.django.read();\n }\n }\n if (!this._disabled.smarty) {\n // smarty cannot be enabled with django or handlebars enabled\n if (this._disabled.django && this._disabled.handlebars) {\n resulting_string = resulting_string ||\n this.__patterns.smarty_comment.read();\n resulting_string = resulting_string ||\n this.__patterns.smarty_literal.read();\n resulting_string = resulting_string ||\n this.__patterns.smarty.read();\n }\n }\n }\n return resulting_string;\n};\n\n\nmodule.exports.TemplatablePattern = TemplatablePattern;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar Beautifier = require('./beautifier').Beautifier,\n Options = require('./options').Options;\n\nfunction css_beautify(source_text, options) {\n var beautifier = new Beautifier(source_text, options);\n return beautifier.beautify();\n}\n\nmodule.exports = css_beautify;\nmodule.exports.defaultOptions = function() {\n return new Options();\n};\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar Options = require('./options').Options;\nvar Output = require('../core/output').Output;\nvar InputScanner = require('../core/inputscanner').InputScanner;\nvar Directives = require('../core/directives').Directives;\n\nvar directives_core = new Directives(/\\/\\*/, /\\*\\//);\n\nvar lineBreak = /\\r\\n|[\\r\\n]/;\nvar allLineBreaks = /\\r\\n|[\\r\\n]/g;\n\n// tokenizer\nvar whitespaceChar = /\\s/;\nvar whitespacePattern = /(?:\\s|\\n)+/g;\nvar block_comment_pattern = /\\/\\*(?:[\\s\\S]*?)((?:\\*\\/)|$)/g;\nvar comment_pattern = /\\/\\/(?:[^\\n\\r\\u2028\\u2029]*)/g;\n\nfunction Beautifier(source_text, options) {\n this._source_text = source_text || '';\n // Allow the setting of language/file-type specific options\n // with inheritance of overall settings\n this._options = new Options(options);\n this._ch = null;\n this._input = null;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule\n this.NESTED_AT_RULE = {\n \"page\": true,\n \"font-face\": true,\n \"keyframes\": true,\n // also in CONDITIONAL_GROUP_RULE below\n \"media\": true,\n \"supports\": true,\n \"document\": true\n };\n this.CONDITIONAL_GROUP_RULE = {\n \"media\": true,\n \"supports\": true,\n \"document\": true\n };\n this.NON_SEMICOLON_NEWLINE_PROPERTY = [\n \"grid-template-areas\",\n \"grid-template\"\n ];\n\n}\n\nBeautifier.prototype.eatString = function(endChars) {\n var result = '';\n this._ch = this._input.next();\n while (this._ch) {\n result += this._ch;\n if (this._ch === \"\\\\\") {\n result += this._input.next();\n } else if (endChars.indexOf(this._ch) !== -1 || this._ch === \"\\n\") {\n break;\n }\n this._ch = this._input.next();\n }\n return result;\n};\n\n// Skips any white space in the source text from the current position.\n// When allowAtLeastOneNewLine is true, will output new lines for each\n// newline character found; if the user has preserve_newlines off, only\n// the first newline will be output\nBeautifier.prototype.eatWhitespace = function(allowAtLeastOneNewLine) {\n var result = whitespaceChar.test(this._input.peek());\n var newline_count = 0;\n while (whitespaceChar.test(this._input.peek())) {\n this._ch = this._input.next();\n if (allowAtLeastOneNewLine && this._ch === '\\n') {\n if (newline_count === 0 || newline_count < this._options.max_preserve_newlines) {\n newline_count++;\n this._output.add_new_line(true);\n }\n }\n }\n return result;\n};\n\n// Nested pseudo-class if we are insideRule\n// and the next special character found opens\n// a new block\nBeautifier.prototype.foundNestedPseudoClass = function() {\n var openParen = 0;\n var i = 1;\n var ch = this._input.peek(i);\n while (ch) {\n if (ch === \"{\") {\n return true;\n } else if (ch === '(') {\n // pseudoclasses can contain ()\n openParen += 1;\n } else if (ch === ')') {\n if (openParen === 0) {\n return false;\n }\n openParen -= 1;\n } else if (ch === \";\" || ch === \"}\") {\n return false;\n }\n i++;\n ch = this._input.peek(i);\n }\n return false;\n};\n\nBeautifier.prototype.print_string = function(output_string) {\n this._output.set_indent(this._indentLevel);\n this._output.non_breaking_space = true;\n this._output.add_token(output_string);\n};\n\nBeautifier.prototype.preserveSingleSpace = function(isAfterSpace) {\n if (isAfterSpace) {\n this._output.space_before_token = true;\n }\n};\n\nBeautifier.prototype.indent = function() {\n this._indentLevel++;\n};\n\nBeautifier.prototype.outdent = function() {\n if (this._indentLevel > 0) {\n this._indentLevel--;\n }\n};\n\n/*_____________________--------------------_____________________*/\n\nBeautifier.prototype.beautify = function() {\n if (this._options.disabled) {\n return this._source_text;\n }\n\n var source_text = this._source_text;\n var eol = this._options.eol;\n if (eol === 'auto') {\n eol = '\\n';\n if (source_text && lineBreak.test(source_text || '')) {\n eol = source_text.match(lineBreak)[0];\n }\n }\n\n\n // HACK: newline parsing inconsistent. This brute force normalizes the this._input.\n source_text = source_text.replace(allLineBreaks, '\\n');\n\n // reset\n var baseIndentString = source_text.match(/^[\\t ]*/)[0];\n\n this._output = new Output(this._options, baseIndentString);\n this._input = new InputScanner(source_text);\n this._indentLevel = 0;\n this._nestedLevel = 0;\n\n this._ch = null;\n var parenLevel = 0;\n\n var insideRule = false;\n // This is the value side of a property value pair (blue in the following ex)\n // label { content: blue }\n var insidePropertyValue = false;\n var enteringConditionalGroup = false;\n var insideNonNestedAtRule = false;\n var insideScssMap = false;\n var topCharacter = this._ch;\n var insideNonSemiColonValues = false;\n var whitespace;\n var isAfterSpace;\n var previous_ch;\n\n while (true) {\n whitespace = this._input.read(whitespacePattern);\n isAfterSpace = whitespace !== '';\n previous_ch = topCharacter;\n this._ch = this._input.next();\n if (this._ch === '\\\\' && this._input.hasNext()) {\n this._ch += this._input.next();\n }\n topCharacter = this._ch;\n\n if (!this._ch) {\n break;\n } else if (this._ch === '/' && this._input.peek() === '*') {\n // /* css comment */\n // Always start block comments on a new line.\n // This handles scenarios where a block comment immediately\n // follows a property definition on the same line or where\n // minified code is being beautified.\n this._output.add_new_line();\n this._input.back();\n\n var comment = this._input.read(block_comment_pattern);\n\n // Handle ignore directive\n var directives = directives_core.get_directives(comment);\n if (directives && directives.ignore === 'start') {\n comment += directives_core.readIgnored(this._input);\n }\n\n this.print_string(comment);\n\n // Ensures any new lines following the comment are preserved\n this.eatWhitespace(true);\n\n // Block comments are followed by a new line so they don't\n // share a line with other properties\n this._output.add_new_line();\n } else if (this._ch === '/' && this._input.peek() === '/') {\n // // single line comment\n // Preserves the space before a comment\n // on the same line as a rule\n this._output.space_before_token = true;\n this._input.back();\n this.print_string(this._input.read(comment_pattern));\n\n // Ensures any new lines following the comment are preserved\n this.eatWhitespace(true);\n } else if (this._ch === '$') {\n this.preserveSingleSpace(isAfterSpace);\n\n this.print_string(this._ch);\n\n // strip trailing space, if present, for hash property checks\n var variable = this._input.peekUntilAfter(/[: ,;{}()[\\]\\/='\"]/g);\n\n if (variable.match(/[ :]$/)) {\n // we have a variable or pseudo-class, add it and insert one space before continuing\n variable = this.eatString(\": \").replace(/\\s+$/, '');\n this.print_string(variable);\n this._output.space_before_token = true;\n }\n\n // might be sass variable\n if (parenLevel === 0 && variable.indexOf(':') !== -1) {\n insidePropertyValue = true;\n this.indent();\n }\n } else if (this._ch === '@') {\n this.preserveSingleSpace(isAfterSpace);\n\n // deal with less property mixins @{...}\n if (this._input.peek() === '{') {\n this.print_string(this._ch + this.eatString('}'));\n } else {\n this.print_string(this._ch);\n\n // strip trailing space, if present, for hash property checks\n var variableOrRule = this._input.peekUntilAfter(/[: ,;{}()[\\]\\/='\"]/g);\n\n if (variableOrRule.match(/[ :]$/)) {\n // we have a variable or pseudo-class, add it and insert one space before continuing\n variableOrRule = this.eatString(\": \").replace(/\\s+$/, '');\n this.print_string(variableOrRule);\n this._output.space_before_token = true;\n }\n\n // might be less variable\n if (parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {\n insidePropertyValue = true;\n this.indent();\n\n // might be a nesting at-rule\n } else if (variableOrRule in this.NESTED_AT_RULE) {\n this._nestedLevel += 1;\n if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {\n enteringConditionalGroup = true;\n }\n\n // might be a non-nested at-rule\n } else if (parenLevel === 0 && !insidePropertyValue) {\n insideNonNestedAtRule = true;\n }\n }\n } else if (this._ch === '#' && this._input.peek() === '{') {\n this.preserveSingleSpace(isAfterSpace);\n this.print_string(this._ch + this.eatString('}'));\n } else if (this._ch === '{') {\n if (insidePropertyValue) {\n insidePropertyValue = false;\n this.outdent();\n }\n\n // non nested at rule becomes nested\n insideNonNestedAtRule = false;\n\n // when entering conditional groups, only rulesets are allowed\n if (enteringConditionalGroup) {\n enteringConditionalGroup = false;\n insideRule = (this._indentLevel >= this._nestedLevel);\n } else {\n // otherwise, declarations are also allowed\n insideRule = (this._indentLevel >= this._nestedLevel - 1);\n }\n if (this._options.newline_between_rules && insideRule) {\n if (this._output.previous_line && this._output.previous_line.item(-1) !== '{') {\n this._output.ensure_empty_line_above('/', ',');\n }\n }\n\n this._output.space_before_token = true;\n\n // The difference in print_string and indent order is necessary to indent the '{' correctly\n if (this._options.brace_style === 'expand') {\n this._output.add_new_line();\n this.print_string(this._ch);\n this.indent();\n this._output.set_indent(this._indentLevel);\n } else {\n // inside mixin and first param is object\n if (previous_ch === '(') {\n this._output.space_before_token = false;\n } else if (previous_ch !== ',') {\n this.indent();\n }\n this.print_string(this._ch);\n }\n\n this.eatWhitespace(true);\n this._output.add_new_line();\n } else if (this._ch === '}') {\n this.outdent();\n this._output.add_new_line();\n if (previous_ch === '{') {\n this._output.trim(true);\n }\n\n if (insidePropertyValue) {\n this.outdent();\n insidePropertyValue = false;\n }\n this.print_string(this._ch);\n insideRule = false;\n if (this._nestedLevel) {\n this._nestedLevel--;\n }\n\n this.eatWhitespace(true);\n this._output.add_new_line();\n\n if (this._options.newline_between_rules && !this._output.just_added_blankline()) {\n if (this._input.peek() !== '}') {\n this._output.add_new_line(true);\n }\n }\n if (this._input.peek() === ')') {\n this._output.trim(true);\n if (this._options.brace_style === \"expand\") {\n this._output.add_new_line(true);\n }\n }\n } else if (this._ch === \":\") {\n\n for (var i = 0; i < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; i++) {\n if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[i])) {\n insideNonSemiColonValues = true;\n break;\n }\n }\n\n if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack(\"&\") || this.foundNestedPseudoClass()) && !this._input.lookBack(\"(\") && !insideNonNestedAtRule && parenLevel === 0) {\n // 'property: value' delimiter\n // which could be in a conditional group query\n\n this.print_string(':');\n if (!insidePropertyValue) {\n insidePropertyValue = true;\n this._output.space_before_token = true;\n this.eatWhitespace(true);\n this.indent();\n }\n } else {\n // sass/less parent reference don't use a space\n // sass nested pseudo-class don't use a space\n\n // preserve space before pseudoclasses/pseudoelements, as it means \"in any child\"\n if (this._input.lookBack(\" \")) {\n this._output.space_before_token = true;\n }\n if (this._input.peek() === \":\") {\n // pseudo-element\n this._ch = this._input.next();\n this.print_string(\"::\");\n } else {\n // pseudo-class\n this.print_string(':');\n }\n }\n } else if (this._ch === '\"' || this._ch === '\\'') {\n var preserveQuoteSpace = previous_ch === '\"' || previous_ch === '\\'';\n this.preserveSingleSpace(preserveQuoteSpace || isAfterSpace);\n this.print_string(this._ch + this.eatString(this._ch));\n this.eatWhitespace(true);\n } else if (this._ch === ';') {\n insideNonSemiColonValues = false;\n if (parenLevel === 0) {\n if (insidePropertyValue) {\n this.outdent();\n insidePropertyValue = false;\n }\n insideNonNestedAtRule = false;\n this.print_string(this._ch);\n this.eatWhitespace(true);\n\n // This maintains single line comments on the same\n // line. Block comments are also affected, but\n // a new line is always output before one inside\n // that section\n if (this._input.peek() !== '/') {\n this._output.add_new_line();\n }\n } else {\n this.print_string(this._ch);\n this.eatWhitespace(true);\n this._output.space_before_token = true;\n }\n } else if (this._ch === '(') { // may be a url\n if (this._input.lookBack(\"url\")) {\n this.print_string(this._ch);\n this.eatWhitespace();\n parenLevel++;\n this.indent();\n this._ch = this._input.next();\n if (this._ch === ')' || this._ch === '\"' || this._ch === '\\'') {\n this._input.back();\n } else if (this._ch) {\n this.print_string(this._ch + this.eatString(')'));\n if (parenLevel) {\n parenLevel--;\n this.outdent();\n }\n }\n } else {\n var space_needed = false;\n if (this._input.lookBack(\"with\")) {\n // look back is not an accurate solution, we need tokens to confirm without whitespaces\n space_needed = true;\n }\n this.preserveSingleSpace(isAfterSpace || space_needed);\n this.print_string(this._ch);\n\n // handle scss/sass map\n if (insidePropertyValue && previous_ch === \"$\" && this._options.selector_separator_newline) {\n this._output.add_new_line();\n insideScssMap = true;\n } else {\n this.eatWhitespace();\n parenLevel++;\n this.indent();\n }\n }\n } else if (this._ch === ')') {\n if (parenLevel) {\n parenLevel--;\n this.outdent();\n }\n if (insideScssMap && this._input.peek() === \";\" && this._options.selector_separator_newline) {\n insideScssMap = false;\n this.outdent();\n this._output.add_new_line();\n }\n this.print_string(this._ch);\n } else if (this._ch === ',') {\n this.print_string(this._ch);\n this.eatWhitespace(true);\n if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideNonNestedAtRule) {\n this._output.add_new_line();\n } else {\n this._output.space_before_token = true;\n }\n } else if ((this._ch === '>' || this._ch === '+' || this._ch === '~') && !insidePropertyValue && parenLevel === 0) {\n //handle combinator spacing\n if (this._options.space_around_combinator) {\n this._output.space_before_token = true;\n this.print_string(this._ch);\n this._output.space_before_token = true;\n } else {\n this.print_string(this._ch);\n this.eatWhitespace();\n // squash extra whitespace\n if (this._ch && whitespaceChar.test(this._ch)) {\n this._ch = '';\n }\n }\n } else if (this._ch === ']') {\n this.print_string(this._ch);\n } else if (this._ch === '[') {\n this.preserveSingleSpace(isAfterSpace);\n this.print_string(this._ch);\n } else if (this._ch === '=') { // no whitespace before or after\n this.eatWhitespace();\n this.print_string('=');\n if (whitespaceChar.test(this._ch)) {\n this._ch = '';\n }\n } else if (this._ch === '!' && !this._input.lookBack(\"\\\\\")) { // !important\n this._output.space_before_token = true;\n this.print_string(this._ch);\n } else {\n var preserveAfterSpace = previous_ch === '\"' || previous_ch === '\\'';\n this.preserveSingleSpace(preserveAfterSpace || isAfterSpace);\n this.print_string(this._ch);\n\n if (!this._output.just_added_newline() && this._input.peek() === '\\n' && insideNonSemiColonValues) {\n this._output.add_new_line();\n }\n }\n }\n\n var sweetCode = this._output.get_code(eol);\n\n return sweetCode;\n};\n\nmodule.exports.Beautifier = Beautifier;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar BaseOptions = require('../core/options').Options;\n\nfunction Options(options) {\n BaseOptions.call(this, options, 'css');\n\n this.selector_separator_newline = this._get_boolean('selector_separator_newline', true);\n this.newline_between_rules = this._get_boolean('newline_between_rules', true);\n var space_around_selector_separator = this._get_boolean('space_around_selector_separator');\n this.space_around_combinator = this._get_boolean('space_around_combinator') || space_around_selector_separator;\n\n var brace_style_split = this._get_selection_list('brace_style', ['collapse', 'expand', 'end-expand', 'none', 'preserve-inline']);\n this.brace_style = 'collapse';\n for (var bs = 0; bs < brace_style_split.length; bs++) {\n if (brace_style_split[bs] !== 'expand') {\n // default to collapse, as only collapse|expand is implemented for now\n this.brace_style = 'collapse';\n } else {\n this.brace_style = brace_style_split[bs];\n }\n }\n}\nOptions.prototype = new BaseOptions();\n\n\n\nmodule.exports.Options = Options;\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar Beautifier = require('./beautifier').Beautifier,\n Options = require('./options').Options;\n\nfunction style_html(html_source, options, js_beautify, css_beautify) {\n var beautifier = new Beautifier(html_source, options, js_beautify, css_beautify);\n return beautifier.beautify();\n}\n\nmodule.exports = style_html;\nmodule.exports.defaultOptions = function() {\n return new Options();\n};\n","/*jshint node:true */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\n'use strict';\n\nvar Options = require('../html/options').Options;\nvar Output = require('../core/output').Output;\nvar Tokenizer = require('../html/tokenizer').Tokenizer;\nvar TOKEN = require('../html/tokenizer').TOKEN;\n\nvar lineBreak = /\\r\\n|[\\r\\n]/;\nvar allLineBreaks = /\\r\\n|[\\r\\n]/g;\n\nvar Printer = function(options, base_indent_string) { //handles input/output and some other printing functions\n\n this.indent_level = 0;\n this.alignment_size = 0;\n this.max_preserve_newlines = options.max_preserve_newlines;\n this.preserve_newlines = options.preserve_newlines;\n\n this._output = new Output(options, base_indent_string);\n\n};\n\nPrinter.prototype.current_line_has_match = function(pattern) {\n return this._output.current_line.has_match(pattern);\n};\n\nPrinter.prototype.set_space_before_token = function(value, non_breaking) {\n this._output.space_before_token = value;\n this._output.non_breaking_space = non_breaking;\n};\n\nPrinter.prototype.set_wrap_point = function() {\n this._output.set_indent(this.indent_level, this.alignment_size);\n this._output.set_wrap_point();\n};\n\n\nPrinter.prototype.add_raw_token = function(token) {\n this._output.add_raw_token(token);\n};\n\nPrinter.prototype.print_preserved_newlines = function(raw_token) {\n var newlines = 0;\n if (raw_token.type !== TOKEN.TEXT && raw_token.previous.type !== TOKEN.TEXT) {\n newlines = raw_token.newlines ? 1 : 0;\n }\n\n if (this.preserve_newlines) {\n newlines = raw_token.newlines < this.max_preserve_newlines + 1 ? raw_token.newlines : this.max_preserve_newlines + 1;\n }\n for (var n = 0; n < newlines; n++) {\n this.print_newline(n > 0);\n }\n\n return newlines !== 0;\n};\n\nPrinter.prototype.traverse_whitespace = function(raw_token) {\n if (raw_token.whitespace_before || raw_token.newlines) {\n if (!this.print_preserved_newlines(raw_token)) {\n this._output.space_before_token = true;\n }\n return true;\n }\n return false;\n};\n\nPrinter.prototype.previous_token_wrapped = function() {\n return this._output.previous_token_wrapped;\n};\n\nPrinter.prototype.print_newline = function(force) {\n this._output.add_new_line(force);\n};\n\nPrinter.prototype.print_token = function(token) {\n if (token.text) {\n this._output.set_indent(this.indent_level, this.alignment_size);\n this._output.add_token(token.text);\n }\n};\n\nPrinter.prototype.indent = function() {\n this.indent_level++;\n};\n\nPrinter.prototype.deindent = function() {\n if (this.indent_level > 0) {\n this.indent_level--;\n this._output.set_indent(this.indent_level, this.alignment_size);\n }\n};\n\nPrinter.prototype.get_full_indent = function(level) {\n level = this.indent_level + (level || 0);\n if (level < 1) {\n return '';\n }\n\n return this._output.get_indent_string(level);\n};\n\nvar get_type_attribute = function(start_token) {\n var result = null;\n var raw_token = start_token.next;\n\n // Search attributes for a type attribute\n while (raw_token.type !== TOKEN.EOF && start_token.closed !== raw_token) {\n if (raw_token.type === TOKEN.ATTRIBUTE && raw_token.text === 'type') {\n if (raw_token.next && raw_token.next.type === TOKEN.EQUALS &&\n raw_token.next.next && raw_token.next.next.type === TOKEN.VALUE) {\n result = raw_token.next.next.text;\n }\n break;\n }\n raw_token = raw_token.next;\n }\n\n return result;\n};\n\nvar get_custom_beautifier_name = function(tag_check, raw_token) {\n var typeAttribute = null;\n var result = null;\n\n if (!raw_token.closed) {\n return null;\n }\n\n if (tag_check === 'script') {\n typeAttribute = 'text/javascript';\n } else if (tag_check === 'style') {\n typeAttribute = 'text/css';\n }\n\n typeAttribute = get_type_attribute(raw_token) || typeAttribute;\n\n // For script and style tags that have a type attribute, only enable custom beautifiers for matching values\n // For those without a type attribute use default;\n if (typeAttribute.search('text/css') > -1) {\n result = 'css';\n } else if (typeAttribute.search(/module|((text|application|dojo)\\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\\+)?json|method|aspect))/) > -1) {\n result = 'javascript';\n } else if (typeAttribute.search(/(text|application|dojo)\\/(x-)?(html)/) > -1) {\n result = 'html';\n } else if (typeAttribute.search(/test\\/null/) > -1) {\n // Test only mime-type for testing the beautifier when null is passed as beautifing function\n result = 'null';\n }\n\n return result;\n};\n\nfunction in_array(what, arr) {\n return arr.indexOf(what) !== -1;\n}\n\nfunction TagFrame(parent, parser_token, indent_level) {\n this.parent = parent || null;\n this.tag = parser_token ? parser_token.tag_name : '';\n this.indent_level = indent_level || 0;\n this.parser_token = parser_token || null;\n}\n\nfunction TagStack(printer) {\n this._printer = printer;\n this._current_frame = null;\n}\n\nTagStack.prototype.get_parser_token = function() {\n return this._current_frame ? this._current_frame.parser_token : null;\n};\n\nTagStack.prototype.record_tag = function(parser_token) { //function to record a tag and its parent in this.tags Object\n var new_frame = new TagFrame(this._current_frame, parser_token, this._printer.indent_level);\n this._current_frame = new_frame;\n};\n\nTagStack.prototype._try_pop_frame = function(frame) { //function to retrieve the opening tag to the corresponding closer\n var parser_token = null;\n\n if (frame) {\n parser_token = frame.parser_token;\n this._printer.indent_level = frame.indent_level;\n this._current_frame = frame.parent;\n }\n\n return parser_token;\n};\n\nTagStack.prototype._get_frame = function(tag_list, stop_list) { //function to retrieve the opening tag to the corresponding closer\n var frame = this._current_frame;\n\n while (frame) { //till we reach '' (the initial value);\n if (tag_list.indexOf(frame.tag) !== -1) { //if this is it use it\n break;\n } else if (stop_list && stop_list.indexOf(frame.tag) !== -1) {\n frame = null;\n break;\n }\n frame = frame.parent;\n }\n\n return frame;\n};\n\nTagStack.prototype.try_pop = function(tag, stop_list) { //function to retrieve the opening tag to the corresponding closer\n var frame = this._get_frame([tag], stop_list);\n return this._try_pop_frame(frame);\n};\n\nTagStack.prototype.indent_to_tag = function(tag_list) {\n var frame = this._get_frame(tag_list);\n if (frame) {\n this._printer.indent_level = frame.indent_level;\n }\n};\n\nfunction Beautifier(source_text, options, js_beautify, css_beautify) {\n //Wrapper function to invoke all the necessary constructors and deal with the output.\n this._source_text = source_text || '';\n options = options || {};\n this._js_beautify = js_beautify;\n this._css_beautify = css_beautify;\n this._tag_stack = null;\n\n // Allow the setting of language/file-type specific options\n // with inheritance of overall settings\n var optionHtml = new Options(options, 'html');\n\n this._options = optionHtml;\n\n this._is_wrap_attributes_force = this._options.wrap_attributes.substr(0, 'force'.length) === 'force';\n this._is_wrap_attributes_force_expand_multiline = (this._options.wrap_attributes === 'force-expand-multiline');\n this._is_wrap_attributes_force_aligned = (this._options.wrap_attributes === 'force-aligned');\n this._is_wrap_attributes_aligned_multiple = (this._options.wrap_attributes === 'aligned-multiple');\n this._is_wrap_attributes_preserve = this._options.wrap_attributes.substr(0, 'preserve'.length) === 'preserve';\n this._is_wrap_attributes_preserve_aligned = (this._options.wrap_attributes === 'preserve-aligned');\n}\n\nBeautifier.prototype.beautify = function() {\n\n // if disabled, return the input unchanged.\n if (this._options.disabled) {\n return this._source_text;\n }\n\n var source_text = this._source_text;\n var eol = this._options.eol;\n if (this._options.eol === 'auto') {\n eol = '\\n';\n if (source_text && lineBreak.test(source_text)) {\n eol = source_text.match(lineBreak)[0];\n }\n }\n\n // HACK: newline parsing inconsistent. This brute force normalizes the input.\n source_text = source_text.replace(allLineBreaks, '\\n');\n\n var baseIndentString = source_text.match(/^[\\t ]*/)[0];\n\n var last_token = {\n text: '',\n type: ''\n };\n\n var last_tag_token = new TagOpenParserToken();\n\n var printer = new Printer(this._options, baseIndentString);\n var tokens = new Tokenizer(source_text, this._options).tokenize();\n\n this._tag_stack = new TagStack(printer);\n\n var parser_token = null;\n var raw_token = tokens.next();\n while (raw_token.type !== TOKEN.EOF) {\n\n if (raw_token.type === TOKEN.TAG_OPEN || raw_token.type === TOKEN.COMMENT) {\n parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token, tokens);\n last_tag_token = parser_token;\n } else if ((raw_token.type === TOKEN.ATTRIBUTE || raw_token.type === TOKEN.EQUALS || raw_token.type === TOKEN.VALUE) ||\n (raw_token.type === TOKEN.TEXT && !last_tag_token.tag_complete)) {\n parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, last_token);\n } else if (raw_token.type === TOKEN.TAG_CLOSE) {\n parser_token = this._handle_tag_close(printer, raw_token, last_tag_token);\n } else if (raw_token.type === TOKEN.TEXT) {\n parser_token = this._handle_text(printer, raw_token, last_tag_token);\n } else if (raw_token.type === TOKEN.CONTROL_FLOW_OPEN) {\n parser_token = this._handle_control_flow_open(printer, raw_token);\n } else if (raw_token.type === TOKEN.CONTROL_FLOW_CLOSE) {\n parser_token = this._handle_control_flow_close(printer, raw_token);\n } else {\n // This should never happen, but if it does. Print the raw token\n printer.add_raw_token(raw_token);\n }\n\n last_token = parser_token;\n\n raw_token = tokens.next();\n }\n var sweet_code = printer._output.get_code(eol);\n\n return sweet_code;\n};\n\nBeautifier.prototype._handle_control_flow_open = function(printer, raw_token) {\n var parser_token = {\n text: raw_token.text,\n type: raw_token.type\n };\n printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);\n if (raw_token.newlines) {\n printer.print_preserved_newlines(raw_token);\n } else {\n printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);\n }\n printer.print_token(raw_token);\n printer.indent();\n return parser_token;\n};\n\nBeautifier.prototype._handle_control_flow_close = function(printer, raw_token) {\n var parser_token = {\n text: raw_token.text,\n type: raw_token.type\n };\n\n printer.deindent();\n if (raw_token.newlines) {\n printer.print_preserved_newlines(raw_token);\n } else {\n printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);\n }\n printer.print_token(raw_token);\n return parser_token;\n};\n\nBeautifier.prototype._handle_tag_close = function(printer, raw_token, last_tag_token) {\n var parser_token = {\n text: raw_token.text,\n type: raw_token.type\n };\n printer.alignment_size = 0;\n last_tag_token.tag_complete = true;\n\n printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);\n if (last_tag_token.is_unformatted) {\n printer.add_raw_token(raw_token);\n } else {\n if (last_tag_token.tag_start_char === '<') {\n printer.set_space_before_token(raw_token.text[0] === '/', true); // space before />, no space before >\n if (this._is_wrap_attributes_force_expand_multiline && last_tag_token.has_wrapped_attrs) {\n printer.print_newline(false);\n }\n }\n printer.print_token(raw_token);\n\n }\n\n if (last_tag_token.indent_content &&\n !(last_tag_token.is_unformatted || last_tag_token.is_content_unformatted)) {\n printer.indent();\n\n // only indent once per opened tag\n last_tag_token.indent_content = false;\n }\n\n if (!last_tag_token.is_inline_element &&\n !(last_tag_token.is_unformatted || last_tag_token.is_content_unformatted)) {\n printer.set_wrap_point();\n }\n\n return parser_token;\n};\n\nBeautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, last_token) {\n var wrapped = last_tag_token.has_wrapped_attrs;\n var parser_token = {\n text: raw_token.text,\n type: raw_token.type\n };\n\n printer.set_space_before_token(raw_token.newlines || raw_token.whitespace_before !== '', true);\n if (last_tag_token.is_unformatted) {\n printer.add_raw_token(raw_token);\n } else if (last_tag_token.tag_start_char === '{' && raw_token.type === TOKEN.TEXT) {\n // For the insides of handlebars allow newlines or a single space between open and contents\n if (printer.print_preserved_newlines(raw_token)) {\n raw_token.newlines = 0;\n printer.add_raw_token(raw_token);\n } else {\n printer.print_token(raw_token);\n }\n } else {\n if (raw_token.type === TOKEN.ATTRIBUTE) {\n printer.set_space_before_token(true);\n } else if (raw_token.type === TOKEN.EQUALS) { //no space before =\n printer.set_space_before_token(false);\n } else if (raw_token.type === TOKEN.VALUE && raw_token.previous.type === TOKEN.EQUALS) { //no space before value\n printer.set_space_before_token(false);\n }\n\n if (raw_token.type === TOKEN.ATTRIBUTE && last_tag_token.tag_start_char === '<') {\n if (this._is_wrap_attributes_preserve || this._is_wrap_attributes_preserve_aligned) {\n printer.traverse_whitespace(raw_token);\n wrapped = wrapped || raw_token.newlines !== 0;\n }\n\n // Wrap for 'force' options, and if the number of attributes is at least that specified in 'wrap_attributes_min_attrs':\n // 1. always wrap the second and beyond attributes\n // 2. wrap the first attribute only if 'force-expand-multiline' is specified\n if (this._is_wrap_attributes_force &&\n last_tag_token.attr_count >= this._options.wrap_attributes_min_attrs &&\n (last_token.type !== TOKEN.TAG_OPEN || // ie. second attribute and beyond\n this._is_wrap_attributes_force_expand_multiline)) {\n printer.print_newline(false);\n wrapped = true;\n }\n }\n printer.print_token(raw_token);\n wrapped = wrapped || printer.previous_token_wrapped();\n last_tag_token.has_wrapped_attrs = wrapped;\n }\n return parser_token;\n};\n\nBeautifier.prototype._handle_text = function(printer, raw_token, last_tag_token) {\n var parser_token = {\n text: raw_token.text,\n type: 'TK_CONTENT'\n };\n if (last_tag_token.custom_beautifier_name) { //check if we need to format javascript\n this._print_custom_beatifier_text(printer, raw_token, last_tag_token);\n } else if (last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) {\n printer.add_raw_token(raw_token);\n } else {\n printer.traverse_whitespace(raw_token);\n printer.print_token(raw_token);\n }\n return parser_token;\n};\n\nBeautifier.prototype._print_custom_beatifier_text = function(printer, raw_token, last_tag_token) {\n var local = this;\n if (raw_token.text !== '') {\n\n var text = raw_token.text,\n _beautifier,\n script_indent_level = 1,\n pre = '',\n post = '';\n if (last_tag_token.custom_beautifier_name === 'javascript' && typeof this._js_beautify === 'function') {\n _beautifier = this._js_beautify;\n } else if (last_tag_token.custom_beautifier_name === 'css' && typeof this._css_beautify === 'function') {\n _beautifier = this._css_beautify;\n } else if (last_tag_token.custom_beautifier_name === 'html') {\n _beautifier = function(html_source, options) {\n var beautifier = new Beautifier(html_source, options, local._js_beautify, local._css_beautify);\n return beautifier.beautify();\n };\n }\n\n if (this._options.indent_scripts === \"keep\") {\n script_indent_level = 0;\n } else if (this._options.indent_scripts === \"separate\") {\n script_indent_level = -printer.indent_level;\n }\n\n var indentation = printer.get_full_indent(script_indent_level);\n\n // if there is at least one empty line at the end of this text, strip it\n // we'll be adding one back after the text but before the containing tag.\n text = text.replace(/\\n[ \\t]*$/, '');\n\n // Handle the case where content is wrapped in a comment or cdata.\n if (last_tag_token.custom_beautifier_name !== 'html' &&\n text[0] === '<' && text.match(/^(|]]>)$/.exec(text);\n\n // if we start to wrap but don't finish, print raw\n if (!matched) {\n printer.add_raw_token(raw_token);\n return;\n }\n\n pre = indentation + matched[1] + '\\n';\n text = matched[4];\n if (matched[5]) {\n post = indentation + matched[5];\n }\n\n // if there is at least one empty line at the end of this text, strip it\n // we'll be adding one back after the text but before the containing tag.\n text = text.replace(/\\n[ \\t]*$/, '');\n\n if (matched[2] || matched[3].indexOf('\\n') !== -1) {\n // if the first line of the non-comment text has spaces\n // use that as the basis for indenting in null case.\n matched = matched[3].match(/[ \\t]+$/);\n if (matched) {\n raw_token.whitespace_before = matched[0];\n }\n }\n }\n\n if (text) {\n if (_beautifier) {\n\n // call the Beautifier if avaliable\n var Child_options = function() {\n this.eol = '\\n';\n };\n Child_options.prototype = this._options.raw_options;\n var child_options = new Child_options();\n text = _beautifier(indentation + text, child_options);\n } else {\n // simply indent the string otherwise\n var white = raw_token.whitespace_before;\n if (white) {\n text = text.replace(new RegExp('\\n(' + white + ')?', 'g'), '\\n');\n }\n\n text = indentation + text.replace(/\\n/g, '\\n' + indentation);\n }\n }\n\n if (pre) {\n if (!text) {\n text = pre + post;\n } else {\n text = pre + text + '\\n' + post;\n }\n }\n\n printer.print_newline(false);\n if (text) {\n raw_token.text = text;\n raw_token.whitespace_before = '';\n raw_token.newlines = 0;\n printer.add_raw_token(raw_token);\n printer.print_newline(true);\n }\n }\n};\n\nBeautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token, tokens) {\n var parser_token = this._get_tag_open_token(raw_token);\n\n if ((last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) &&\n !last_tag_token.is_empty_element &&\n raw_token.type === TOKEN.TAG_OPEN && !parser_token.is_start_tag) {\n // End element tags for unformatted or content_unformatted elements\n // are printed raw to keep any newlines inside them exactly the same.\n printer.add_raw_token(raw_token);\n parser_token.start_tag_token = this._tag_stack.try_pop(parser_token.tag_name);\n } else {\n printer.traverse_whitespace(raw_token);\n this._set_tag_position(printer, raw_token, parser_token, last_tag_token, last_token);\n if (!parser_token.is_inline_element) {\n printer.set_wrap_point();\n }\n printer.print_token(raw_token);\n }\n\n // count the number of attributes\n if (parser_token.is_start_tag && this._is_wrap_attributes_force) {\n var peek_index = 0;\n var peek_token;\n do {\n peek_token = tokens.peek(peek_index);\n if (peek_token.type === TOKEN.ATTRIBUTE) {\n parser_token.attr_count += 1;\n }\n peek_index += 1;\n } while (peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);\n }\n\n //indent attributes an auto, forced, aligned or forced-align line-wrap\n if (this._is_wrap_attributes_force_aligned || this._is_wrap_attributes_aligned_multiple || this._is_wrap_attributes_preserve_aligned) {\n parser_token.alignment_size = raw_token.text.length + 1;\n }\n\n if (!parser_token.tag_complete && !parser_token.is_unformatted) {\n printer.alignment_size = parser_token.alignment_size;\n }\n\n return parser_token;\n};\n\nvar TagOpenParserToken = function(parent, raw_token) {\n this.parent = parent || null;\n this.text = '';\n this.type = 'TK_TAG_OPEN';\n this.tag_name = '';\n this.is_inline_element = false;\n this.is_unformatted = false;\n this.is_content_unformatted = false;\n this.is_empty_element = false;\n this.is_start_tag = false;\n this.is_end_tag = false;\n this.indent_content = false;\n this.multiline_content = false;\n this.custom_beautifier_name = null;\n this.start_tag_token = null;\n this.attr_count = 0;\n this.has_wrapped_attrs = false;\n this.alignment_size = 0;\n this.tag_complete = false;\n this.tag_start_char = '';\n this.tag_check = '';\n\n if (!raw_token) {\n this.tag_complete = true;\n } else {\n var tag_check_match;\n\n this.tag_start_char = raw_token.text[0];\n this.text = raw_token.text;\n\n if (this.tag_start_char === '<') {\n tag_check_match = raw_token.text.match(/^<([^\\s>]*)/);\n this.tag_check = tag_check_match ? tag_check_match[1] : '';\n } else {\n tag_check_match = raw_token.text.match(/^{{~?(?:[\\^]|#\\*?)?([^\\s}]+)/);\n this.tag_check = tag_check_match ? tag_check_match[1] : '';\n\n // handle \"{{#> myPartial}}\" or \"{{~#> myPartial}}\"\n if ((raw_token.text.startsWith('{{#>') || raw_token.text.startsWith('{{~#>')) && this.tag_check[0] === '>') {\n if (this.tag_check === '>' && raw_token.next !== null) {\n this.tag_check = raw_token.next.text.split(' ')[0];\n } else {\n this.tag_check = raw_token.text.split('>')[1];\n }\n }\n }\n\n this.tag_check = this.tag_check.toLowerCase();\n\n if (raw_token.type === TOKEN.COMMENT) {\n this.tag_complete = true;\n }\n\n this.is_start_tag = this.tag_check.charAt(0) !== '/';\n this.tag_name = !this.is_start_tag ? this.tag_check.substr(1) : this.tag_check;\n this.is_end_tag = !this.is_start_tag ||\n (raw_token.closed && raw_token.closed.text === '/>');\n\n // if whitespace handler ~ included (i.e. {{~#if true}}), handlebars tags start at pos 3 not pos 2\n var handlebar_starts = 2;\n if (this.tag_start_char === '{' && this.text.length >= 3) {\n if (this.text.charAt(2) === '~') {\n handlebar_starts = 3;\n }\n }\n\n // handlebars tags that don't start with # or ^ are single_tags, and so also start and end.\n this.is_end_tag = this.is_end_tag ||\n (this.tag_start_char === '{' && (this.text.length < 3 || (/[^#\\^]/.test(this.text.charAt(handlebar_starts)))));\n }\n};\n\nBeautifier.prototype._get_tag_open_token = function(raw_token) { //function to get a full tag and parse its type\n var parser_token = new TagOpenParserToken(this._tag_stack.get_parser_token(), raw_token);\n\n parser_token.alignment_size = this._options.wrap_attributes_indent_size;\n\n parser_token.is_end_tag = parser_token.is_end_tag ||\n in_array(parser_token.tag_check, this._options.void_elements);\n\n parser_token.is_empty_element = parser_token.tag_complete ||\n (parser_token.is_start_tag && parser_token.is_end_tag);\n\n parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);\n parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);\n parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || (this._options.inline_custom_elements && parser_token.tag_name.includes(\"-\")) || parser_token.tag_start_char === '{';\n\n return parser_token;\n};\n\nBeautifier.prototype._set_tag_position = function(printer, raw_token, parser_token, last_tag_token, last_token) {\n\n if (!parser_token.is_empty_element) {\n if (parser_token.is_end_tag) { //this tag is a double tag so check for tag-ending\n parser_token.start_tag_token = this._tag_stack.try_pop(parser_token.tag_name); //remove it and all ancestors\n } else { // it's a start-tag\n // check if this tag is starting an element that has optional end element\n // and do an ending needed\n if (this._do_optional_end_element(parser_token)) {\n if (!parser_token.is_inline_element) {\n printer.print_newline(false);\n }\n }\n\n this._tag_stack.record_tag(parser_token); //push it on the tag stack\n\n if ((parser_token.tag_name === 'script' || parser_token.tag_name === 'style') &&\n !(parser_token.is_unformatted || parser_token.is_content_unformatted)) {\n parser_token.custom_beautifier_name = get_custom_beautifier_name(parser_token.tag_check, raw_token);\n }\n }\n }\n\n if (in_array(parser_token.tag_check, this._options.extra_liners)) { //check if this double needs an extra line\n printer.print_newline(false);\n if (!printer._output.just_added_blankline()) {\n printer.print_newline(true);\n }\n }\n\n if (parser_token.is_empty_element) { //if this tag name is a single tag type (either in the list or has a closing /)\n\n // if you hit an else case, reset the indent level if you are inside an:\n // 'if', 'unless', or 'each' block.\n if (parser_token.tag_start_char === '{' && parser_token.tag_check === 'else') {\n this._tag_stack.indent_to_tag(['if', 'unless', 'each']);\n parser_token.indent_content = true;\n // Don't add a newline if opening {{#if}} tag is on the current line\n var foundIfOnCurrentLine = printer.current_line_has_match(/{{#if/);\n if (!foundIfOnCurrentLine) {\n printer.print_newline(false);\n }\n }\n\n // Don't add a newline before elements that should remain where they are.\n if (parser_token.tag_name === '!--' && last_token.type === TOKEN.TAG_CLOSE &&\n last_tag_token.is_end_tag && parser_token.text.indexOf('\\n') === -1) {\n //Do nothing. Leave comments on same line.\n } else {\n if (!(parser_token.is_inline_element || parser_token.is_unformatted)) {\n printer.print_newline(false);\n }\n this._calcluate_parent_multiline(printer, parser_token);\n }\n } else if (parser_token.is_end_tag) { //this tag is a double tag so check for tag-ending\n var do_end_expand = false;\n\n // deciding whether a block is multiline should not be this hard\n do_end_expand = parser_token.start_tag_token && parser_token.start_tag_token.multiline_content;\n do_end_expand = do_end_expand || (!parser_token.is_inline_element &&\n !(last_tag_token.is_inline_element || last_tag_token.is_unformatted) &&\n !(last_token.type === TOKEN.TAG_CLOSE && parser_token.start_tag_token === last_tag_token) &&\n last_token.type !== 'TK_CONTENT'\n );\n\n if (parser_token.is_content_unformatted || parser_token.is_unformatted) {\n do_end_expand = false;\n }\n\n if (do_end_expand) {\n printer.print_newline(false);\n }\n } else { // it's a start-tag\n parser_token.indent_content = !parser_token.custom_beautifier_name;\n\n if (parser_token.tag_start_char === '<') {\n if (parser_token.tag_name === 'html') {\n parser_token.indent_content = this._options.indent_inner_html;\n } else if (parser_token.tag_name === 'head') {\n parser_token.indent_content = this._options.indent_head_inner_html;\n } else if (parser_token.tag_name === 'body') {\n parser_token.indent_content = this._options.indent_body_inner_html;\n }\n }\n\n if (!(parser_token.is_inline_element || parser_token.is_unformatted) &&\n (last_token.type !== 'TK_CONTENT' || parser_token.is_content_unformatted)) {\n printer.print_newline(false);\n }\n\n this._calcluate_parent_multiline(printer, parser_token);\n }\n};\n\nBeautifier.prototype._calcluate_parent_multiline = function(printer, parser_token) {\n if (parser_token.parent && printer._output.just_added_newline() &&\n !((parser_token.is_inline_element || parser_token.is_unformatted) && parser_token.parent.is_inline_element)) {\n parser_token.parent.multiline_content = true;\n }\n};\n\n//To be used for

tag special case:\nvar p_closers = ['address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'main', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'];\nvar p_parent_excludes = ['a', 'audio', 'del', 'ins', 'map', 'noscript', 'video'];\n\nBeautifier.prototype._do_optional_end_element = function(parser_token) {\n var result = null;\n // NOTE: cases of \"if there is no more content in the parent element\"\n // are handled automatically by the beautifier.\n // It assumes parent or ancestor close tag closes all children.\n // https://www.w3.org/TR/html5/syntax.html#optional-tags\n if (parser_token.is_empty_element || !parser_token.is_start_tag || !parser_token.parent) {\n return;\n\n }\n\n if (parser_token.tag_name === 'body') {\n // A head element’s end tag may be omitted if the head element is not immediately followed by a space character or a comment.\n result = result || this._tag_stack.try_pop('head');\n\n //} else if (parser_token.tag_name === 'body') {\n // DONE: A body element’s end tag may be omitted if the body element is not immediately followed by a comment.\n\n } else if (parser_token.tag_name === 'li') {\n // An li element’s end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.\n result = result || this._tag_stack.try_pop('li', ['ol', 'ul', 'menu']);\n\n } else if (parser_token.tag_name === 'dd' || parser_token.tag_name === 'dt') {\n // A dd element’s end tag may be omitted if the dd element is immediately followed by another dd element or a dt element, or if there is no more content in the parent element.\n // A dt element’s end tag may be omitted if the dt element is immediately followed by another dt element or a dd element.\n result = result || this._tag_stack.try_pop('dt', ['dl']);\n result = result || this._tag_stack.try_pop('dd', ['dl']);\n\n\n } else if (parser_token.parent.tag_name === 'p' && p_closers.indexOf(parser_token.tag_name) !== -1) {\n // IMPORTANT: this else-if works because p_closers has no overlap with any other element we look for in this method\n // check for the parent element is an HTML element that is not an ,

tag special case:\nvar p_closers = ['address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'main', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'];\nvar p_parent_excludes = ['a', 'audio', 'del', 'ins', 'map', 'noscript', 'video'];\n\nBeautifier.prototype._do_optional_end_element = function(parser_token) {\n var result = null;\n // NOTE: cases of \"if there is no more content in the parent element\"\n // are handled automatically by the beautifier.\n // It assumes parent or ancestor close tag closes all children.\n // https://www.w3.org/TR/html5/syntax.html#optional-tags\n if (parser_token.is_empty_element || !parser_token.is_start_tag || !parser_token.parent) {\n return;\n\n }\n\n if (parser_token.tag_name === 'body') {\n // A head element’s end tag may be omitted if the head element is not immediately followed by a space character or a comment.\n result = result || this._tag_stack.try_pop('head');\n\n //} else if (parser_token.tag_name === 'body') {\n // DONE: A body element’s end tag may be omitted if the body element is not immediately followed by a comment.\n\n } else if (parser_token.tag_name === 'li') {\n // An li element’s end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.\n result = result || this._tag_stack.try_pop('li', ['ol', 'ul', 'menu']);\n\n } else if (parser_token.tag_name === 'dd' || parser_token.tag_name === 'dt') {\n // A dd element’s end tag may be omitted if the dd element is immediately followed by another dd element or a dt element, or if there is no more content in the parent element.\n // A dt element’s end tag may be omitted if the dt element is immediately followed by another dt element or a dd element.\n result = result || this._tag_stack.try_pop('dt', ['dl']);\n result = result || this._tag_stack.try_pop('dd', ['dl']);\n\n\n } else if (parser_token.parent.tag_name === 'p' && p_closers.indexOf(parser_token.tag_name) !== -1) {\n // IMPORTANT: this else-if works because p_closers has no overlap with any other element we look for in this method\n // check for the parent element is an HTML element that is not an ,

tag special case:\nvar p_closers = ['address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'main', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'];\nvar p_parent_excludes = ['a', 'audio', 'del', 'ins', 'map', 'noscript', 'video'];\n\nBeautifier.prototype._do_optional_end_element = function(parser_token) {\n var result = null;\n // NOTE: cases of \"if there is no more content in the parent element\"\n // are handled automatically by the beautifier.\n // It assumes parent or ancestor close tag closes all children.\n // https://www.w3.org/TR/html5/syntax.html#optional-tags\n if (parser_token.is_empty_element || !parser_token.is_start_tag || !parser_token.parent) {\n return;\n\n }\n\n if (parser_token.tag_name === 'body') {\n // A head element’s end tag may be omitted if the head element is not immediately followed by a space character or a comment.\n result = result || this._tag_stack.try_pop('head');\n\n //} else if (parser_token.tag_name === 'body') {\n // DONE: A body element’s end tag may be omitted if the body element is not immediately followed by a comment.\n\n } else if (parser_token.tag_name === 'li') {\n // An li element’s end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.\n result = result || this._tag_stack.try_pop('li', ['ol', 'ul', 'menu']);\n\n } else if (parser_token.tag_name === 'dd' || parser_token.tag_name === 'dt') {\n // A dd element’s end tag may be omitted if the dd element is immediately followed by another dd element or a dt element, or if there is no more content in the parent element.\n // A dt element’s end tag may be omitted if the dt element is immediately followed by another dt element or a dd element.\n result = result || this._tag_stack.try_pop('dt', ['dl']);\n result = result || this._tag_stack.try_pop('dd', ['dl']);\n\n\n } else if (parser_token.parent.tag_name === 'p' && p_closers.indexOf(parser_token.tag_name) !== -1) {\n // IMPORTANT: this else-if works because p_closers has no overlap with any other element we look for in this method\n // check for the parent element is an HTML element that is not an ,

tag special case:\nvar p_closers = ['address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'main', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'];\nvar p_parent_excludes = ['a', 'audio', 'del', 'ins', 'map', 'noscript', 'video'];\n\nBeautifier.prototype._do_optional_end_element = function(parser_token) {\n var result = null;\n // NOTE: cases of \"if there is no more content in the parent element\"\n // are handled automatically by the beautifier.\n // It assumes parent or ancestor close tag closes all children.\n // https://www.w3.org/TR/html5/syntax.html#optional-tags\n if (parser_token.is_empty_element || !parser_token.is_start_tag || !parser_token.parent) {\n return;\n\n }\n\n if (parser_token.tag_name === 'body') {\n // A head element’s end tag may be omitted if the head element is not immediately followed by a space character or a comment.\n result = result || this._tag_stack.try_pop('head');\n\n //} else if (parser_token.tag_name === 'body') {\n // DONE: A body element’s end tag may be omitted if the body element is not immediately followed by a comment.\n\n } else if (parser_token.tag_name === 'li') {\n // An li element’s end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.\n result = result || this._tag_stack.try_pop('li', ['ol', 'ul', 'menu']);\n\n } else if (parser_token.tag_name === 'dd' || parser_token.tag_name === 'dt') {\n // A dd element’s end tag may be omitted if the dd element is immediately followed by another dd element or a dt element, or if there is no more content in the parent element.\n // A dt element’s end tag may be omitted if the dt element is immediately followed by another dt element or a dd element.\n result = result || this._tag_stack.try_pop('dt', ['dl']);\n result = result || this._tag_stack.try_pop('dd', ['dl']);\n\n\n } else if (parser_token.parent.tag_name === 'p' && p_closers.indexOf(parser_token.tag_name) !== -1) {\n // IMPORTANT: this else-if works because p_closers has no overlap with any other element we look for in this method\n // check for the parent element is an HTML element that is not an ,

\n' + ' }\n' + ''); + + // CSS @media should remain unchanged + bth( + ''); //============================================================ diff --git a/package-lock.json b/package-lock.json index 6f185f91..41fecac9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "js-beautify", - "version": "1.15.0", + "version": "1.15.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "js-beautify", - "version": "1.15.0", + "version": "1.15.1", "license": "MIT", "dependencies": { "config-chain": "^1.1.13", @@ -79,9 +79,9 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, "engines": { "node": ">=6.0.0" @@ -97,9 +97,9 @@ } }, "node_modules/@jridgewell/source-map": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz", - "integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", "dev": true, "dependencies": { "@jridgewell/gen-mapping": "^0.3.0", @@ -107,19 +107,19 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", + "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@one-ini/wasm": { @@ -157,9 +157,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, "node_modules/@types/json-schema": { @@ -169,10 +169,13 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.16.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.1.tgz", - "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA==", - "dev": true + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@webassemblyjs/ast": { "version": "1.11.5", @@ -654,9 +657,9 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.21.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", - "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz", + "integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==", "dev": true, "funding": [ { @@ -666,13 +669,17 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], "dependencies": { - "caniuse-lite": "^1.0.30001449", - "electron-to-chromium": "^1.4.284", - "node-releases": "^2.0.8", - "update-browserslist-db": "^1.0.10" + "caniuse-lite": "^1.0.30001587", + "electron-to-chromium": "^1.4.668", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" }, "bin": { "browserslist": "cli.js" @@ -709,9 +716,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001481", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", - "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==", + "version": "1.0.30001587", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", + "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", "dev": true, "funding": [ { @@ -1271,9 +1278,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.374", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.374.tgz", - "integrity": "sha512-dNP9tQNTrjgVlSXMqGaj0BdrCS+9pcUvy5/emB6x8kh0YwCoDZ0Z4ce1+7aod+KhybHUd5o5LgKrc5al4kVmzQ==", + "version": "1.4.670", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.670.tgz", + "integrity": "sha512-hcijYOWjOtjKrKPtNA6tuLlA/bTLO3heFG8pQA6mLpq7dRydSWicXova5lyxDzp1iVJaYhK7J2OQlGE52KYn7A==", "dev": true }, "node_modules/emoji-regex": { @@ -2118,9 +2125,9 @@ } }, "node_modules/mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz", + "integrity": "sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==", "dev": true, "dependencies": { "ansi-colors": "4.1.1", @@ -2130,13 +2137,12 @@ "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", - "glob": "7.2.0", + "glob": "8.1.0", "he": "1.2.0", "js-yaml": "4.1.0", "log-symbols": "4.1.0", "minimatch": "5.0.1", "ms": "2.1.3", - "nanoid": "3.3.3", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", @@ -2151,54 +2157,27 @@ }, "engines": { "node": ">= 14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" } }, "node_modules/mocha/node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "minimatch": "^5.0.1", + "once": "^1.3.0" }, "engines": { - "node": "*" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/mocha/node_modules/glob/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/mocha/node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/mocha/node_modules/minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", @@ -2238,18 +2217,6 @@ "mustache": "bin/mustache" } }, - "node_modules/nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -2266,9 +2233,9 @@ "dev": true }, "node_modules/node-releases": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", - "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, "node_modules/nopt": { @@ -3109,13 +3076,13 @@ } }, "node_modules/terser": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz", - "integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==", + "version": "5.27.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.1.tgz", + "integrity": "sha512-29wAr6UU/oQpnTw5HoadwjUZnFQXGdOfj0LjZ4sVxzqwHh/QVkvr7m8y9WoR4iN3FRitVduTc6KdjcW38Npsug==", "dev": true, "dependencies": { - "@jridgewell/source-map": "^0.3.2", - "acorn": "^8.5.0", + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, @@ -3127,16 +3094,16 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.7.tgz", - "integrity": "sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==", + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", + "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", "dev": true, "dependencies": { - "@jridgewell/trace-mapping": "^0.3.17", + "@jridgewell/trace-mapping": "^0.3.20", "jest-worker": "^27.4.5", "schema-utils": "^3.1.1", "serialize-javascript": "^6.0.1", - "terser": "^5.16.5" + "terser": "^5.26.0" }, "engines": { "node": ">= 10.13.0" @@ -3161,9 +3128,9 @@ } }, "node_modules/terser-webpack-plugin/node_modules/serialize-javascript": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", - "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "dependencies": { "randombytes": "^2.1.0" @@ -3193,10 +3160,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "dev": true, "funding": [ { @@ -3274,19 +3247,19 @@ } }, "node_modules/webpack": { - "version": "5.89.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", - "integrity": "sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==", + "version": "5.90.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.2.tgz", + "integrity": "sha512-ziXu8ABGr0InCMEYFnHrYweinHK2PWrMqnwdHk2oK3rRhv/1B+2FnfwYv5oD+RrknK/Pp/Hmyvu+eAsaMYhzCw==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", + "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.11.5", "@webassemblyjs/wasm-edit": "^1.11.5", "@webassemblyjs/wasm-parser": "^1.11.5", "acorn": "^8.7.1", "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", + "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.15.0", "es-module-lexer": "^1.2.1", @@ -3300,7 +3273,7 @@ "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", + "terser-webpack-plugin": "^5.3.10", "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, diff --git a/package.json b/package.json index 4d0e04f0..7e5316d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "js-beautify", - "version": "1.15.0", + "version": "1.15.1", "description": "beautifier.io for node", "main": "js/index.js", "bin": { diff --git a/python/cssbeautifier/__version__.py b/python/cssbeautifier/__version__.py index 6b0872cb..8b0c9156 100644 --- a/python/cssbeautifier/__version__.py +++ b/python/cssbeautifier/__version__.py @@ -1 +1 @@ -__version__ = "1.15.0" +__version__ = "1.15.1" diff --git a/python/jsbeautifier/__version__.py b/python/jsbeautifier/__version__.py index 6b0872cb..8b0c9156 100644 --- a/python/jsbeautifier/__version__.py +++ b/python/jsbeautifier/__version__.py @@ -1 +1 @@ -__version__ = "1.15.0" +__version__ = "1.15.1" diff --git a/python/jsbeautifier/core/options.py b/python/jsbeautifier/core/options.py index 126da5e4..16c90e6e 100644 --- a/python/jsbeautifier/core/options.py +++ b/python/jsbeautifier/core/options.py @@ -77,11 +77,11 @@ def __init__(self, options=None, merge_child_field=None): self.indent_empty_lines = self._get_boolean("indent_empty_lines") # valid templating languages ['django', 'erb', 'handlebars', 'php', 'smarty', 'angular'] - # For now, 'auto' = all off for javascript, all on for html (and inline javascript). + # For now, 'auto' = all off for javascript, all except angular on for html (and inline javascript/css). # other values ignored self.templating = self._get_selection_list( "templating", - ["auto", "none", "django", "erb", "handlebars", "php", "smarty", "angular"], + ["auto", "none", "angular", "django", "erb", "handlebars", "php", "smarty"], ["auto"], ) diff --git a/python/jsbeautifier/tests/core/test_options.py b/python/jsbeautifier/tests/core/test_options.py index e528e4e3..5358aeaa 100644 --- a/python/jsbeautifier/tests/core/test_options.py +++ b/python/jsbeautifier/tests/core/test_options.py @@ -102,15 +102,13 @@ def test__is_valid_selection(self): def test__get_selection_list(self): # should raise error with empty selection - with self.assertRaisesRegexp( - ValueError, "Selection list cannot" + " be empty." - ): + with self.assertRaisesRegex(ValueError, "Selection list cannot" + " be empty."): Options()._get_selection_list("a", []) # should raise error with invalid default - with self.assertRaisesRegexp(ValueError, "Invalid Default Value!"): + with self.assertRaisesRegex(ValueError, "Invalid Default Value!"): Options()._get_selection_list("a", ["a", "b"], ["c"]) # should raise error with invalid option - with self.assertRaisesRegexp( + with self.assertRaisesRegex( ValueError, "^Invalid Option Value:" + " The option" ): Options({"a": ["c", "d"]})._get_selection_list("a", ["a", "b"], ["a", "b"]) @@ -120,7 +118,7 @@ def test__get_selection_list(self): def test__get_selection(self): # should raise error with multiple selection - with self.assertRaisesRegexp( + with self.assertRaisesRegex( ValueError, "^Invalid Option" + " Value: The option" ): Options({"a": ["a", "b"]})._get_selection("a", ["a", "b"], ["a"]) diff --git a/test/data/html/tests.js b/test/data/html/tests.js index ed407180..6e3d59ac 100644 --- a/test/data/html/tests.js +++ b/test/data/html/tests.js @@ -4238,6 +4238,43 @@ exports.test_data = { ' ', '}' ] + }, { + comment: 'CSS @media should remain unchanged', + // This behavior is currently incorrect. This codifies the way it fails. + // unchanged: [ + // '' + // ] + input: [ + '' + ], + output: [ + '' + ] }] }, { name: "No indenting for angular control flow should be done if indent_handlebars is false", @@ -4329,6 +4366,18 @@ exports.test_data = { ' }', '' ] + }, { + comment: 'CSS @media should remain unchanged', + unchanged: [ + '' + ] }] }, { name: "New Test Suite"