less 4.0.1-alpha.0 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/.eslintignore +2 -1
  2. package/.eslintrc.json +70 -2
  3. package/Gruntfile.js +8 -23
  4. package/dist/less.js +1161 -1132
  5. package/dist/less.min.js +3 -3
  6. package/dist/less.min.js.map +1 -1
  7. package/lib/less/constants.js +2 -1
  8. package/lib/less/constants.js.map +1 -1
  9. package/lib/less/contexts.js +2 -20
  10. package/lib/less/contexts.js.map +1 -1
  11. package/lib/less/data/index.js +3 -5
  12. package/lib/less/data/index.js.map +1 -1
  13. package/lib/less/environment/abstract-plugin-loader.js +3 -5
  14. package/lib/less/environment/abstract-plugin-loader.js.map +1 -1
  15. package/lib/less/environment/environment.js +2 -4
  16. package/lib/less/environment/environment.js.map +1 -1
  17. package/lib/less/functions/boolean.js +14 -6
  18. package/lib/less/functions/boolean.js.map +1 -1
  19. package/lib/less/functions/color-blending.js +2 -4
  20. package/lib/less/functions/color-blending.js.map +1 -1
  21. package/lib/less/functions/color.js +7 -9
  22. package/lib/less/functions/color.js.map +1 -1
  23. package/lib/less/functions/data-uri.js +5 -26
  24. package/lib/less/functions/data-uri.js.map +1 -1
  25. package/lib/less/functions/default.js +2 -4
  26. package/lib/less/functions/default.js.map +1 -1
  27. package/lib/less/functions/function-caller.js +7 -12
  28. package/lib/less/functions/function-caller.js.map +1 -1
  29. package/lib/less/functions/index.js +14 -16
  30. package/lib/less/functions/index.js.map +1 -1
  31. package/lib/less/functions/list.js +11 -13
  32. package/lib/less/functions/list.js.map +1 -1
  33. package/lib/less/functions/math-helper.js +2 -4
  34. package/lib/less/functions/math-helper.js.map +1 -1
  35. package/lib/less/functions/math.js +2 -4
  36. package/lib/less/functions/math.js.map +1 -1
  37. package/lib/less/functions/number.js +4 -6
  38. package/lib/less/functions/number.js.map +1 -1
  39. package/lib/less/functions/string.js +4 -6
  40. package/lib/less/functions/string.js.map +1 -1
  41. package/lib/less/functions/svg.js +6 -8
  42. package/lib/less/functions/svg.js.map +1 -1
  43. package/lib/less/functions/types.js +11 -12
  44. package/lib/less/functions/types.js.map +1 -1
  45. package/lib/less/import-manager.js +6 -27
  46. package/lib/less/import-manager.js.map +1 -1
  47. package/lib/less/index.js +25 -43
  48. package/lib/less/index.js.map +1 -1
  49. package/lib/less/less-error.js +2 -20
  50. package/lib/less/less-error.js.map +1 -1
  51. package/lib/less/parse-tree.js +4 -6
  52. package/lib/less/parse-tree.js.map +1 -1
  53. package/lib/less/parse.js +6 -27
  54. package/lib/less/parse.js.map +1 -1
  55. package/lib/less/parser/parser-input.js +2 -4
  56. package/lib/less/parser/parser-input.js.map +1 -1
  57. package/lib/less/parser/parser.js +10 -31
  58. package/lib/less/parser/parser.js.map +1 -1
  59. package/lib/less/render.js +2 -20
  60. package/lib/less/render.js.map +1 -1
  61. package/lib/less/source-map-output.js +5 -1
  62. package/lib/less/source-map-output.js.map +1 -1
  63. package/lib/less/transform-tree.js +4 -6
  64. package/lib/less/transform-tree.js.map +1 -1
  65. package/lib/less/tree/anonymous.js +22 -41
  66. package/lib/less/tree/anonymous.js.map +1 -1
  67. package/lib/less/tree/assignment.js +15 -34
  68. package/lib/less/tree/assignment.js.map +1 -1
  69. package/lib/less/tree/atrule.js +49 -68
  70. package/lib/less/tree/atrule.js.map +1 -1
  71. package/lib/less/tree/attribute.js +16 -35
  72. package/lib/less/tree/attribute.js.map +1 -1
  73. package/lib/less/tree/call.js +20 -39
  74. package/lib/less/tree/call.js.map +1 -1
  75. package/lib/less/tree/color.js +75 -94
  76. package/lib/less/tree/color.js.map +1 -1
  77. package/lib/less/tree/combinator.js +16 -35
  78. package/lib/less/tree/combinator.js.map +1 -1
  79. package/lib/less/tree/comment.js +17 -36
  80. package/lib/less/tree/comment.js.map +1 -1
  81. package/lib/less/tree/condition.js +16 -35
  82. package/lib/less/tree/condition.js.map +1 -1
  83. package/lib/less/tree/debug-info.js.map +1 -1
  84. package/lib/less/tree/declaration.js +36 -74
  85. package/lib/less/tree/declaration.js.map +1 -1
  86. package/lib/less/tree/detached-ruleset.js +19 -57
  87. package/lib/less/tree/detached-ruleset.js.map +1 -1
  88. package/lib/less/tree/dimension.js +36 -53
  89. package/lib/less/tree/dimension.js.map +1 -1
  90. package/lib/less/tree/element.js +34 -53
  91. package/lib/less/tree/element.js.map +1 -1
  92. package/lib/less/tree/expression.js +23 -61
  93. package/lib/less/tree/expression.js.map +1 -1
  94. package/lib/less/tree/extend.js +34 -53
  95. package/lib/less/tree/extend.js.map +1 -1
  96. package/lib/less/tree/import.js +46 -84
  97. package/lib/less/tree/import.js.map +1 -1
  98. package/lib/less/tree/index.js +71 -46
  99. package/lib/less/tree/index.js.map +1 -1
  100. package/lib/less/tree/javascript.js +16 -35
  101. package/lib/less/tree/javascript.js.map +1 -1
  102. package/lib/less/tree/js-eval-node.js +14 -31
  103. package/lib/less/tree/js-eval-node.js.map +1 -1
  104. package/lib/less/tree/keyword.js +10 -29
  105. package/lib/less/tree/keyword.js.map +1 -1
  106. package/lib/less/tree/media.js +40 -78
  107. package/lib/less/tree/media.js.map +1 -1
  108. package/lib/less/tree/mixin-call.js +34 -47
  109. package/lib/less/tree/mixin-call.js.map +1 -1
  110. package/lib/less/tree/mixin-definition.js +51 -89
  111. package/lib/less/tree/mixin-definition.js.map +1 -1
  112. package/lib/less/tree/namespace-value.js +22 -37
  113. package/lib/less/tree/namespace-value.js.map +1 -1
  114. package/lib/less/tree/negative.js +14 -33
  115. package/lib/less/tree/negative.js.map +1 -1
  116. package/lib/less/tree/node.js +20 -7
  117. package/lib/less/tree/node.js.map +1 -1
  118. package/lib/less/tree/operation.js +22 -59
  119. package/lib/less/tree/operation.js.map +1 -1
  120. package/lib/less/tree/paren.js +12 -31
  121. package/lib/less/tree/paren.js.map +1 -1
  122. package/lib/less/tree/property.js +21 -36
  123. package/lib/less/tree/property.js.map +1 -1
  124. package/lib/less/tree/quoted.js +25 -44
  125. package/lib/less/tree/quoted.js.map +1 -1
  126. package/lib/less/tree/ruleset.js +69 -107
  127. package/lib/less/tree/ruleset.js.map +1 -1
  128. package/lib/less/tree/selector.js +38 -57
  129. package/lib/less/tree/selector.js.map +1 -1
  130. package/lib/less/tree/unicode-descriptor.js +8 -27
  131. package/lib/less/tree/unicode-descriptor.js.map +1 -1
  132. package/lib/less/tree/unit.js +38 -76
  133. package/lib/less/tree/unit.js.map +1 -1
  134. package/lib/less/tree/url.js +20 -39
  135. package/lib/less/tree/url.js.map +1 -1
  136. package/lib/less/tree/value.js +21 -40
  137. package/lib/less/tree/value.js.map +1 -1
  138. package/lib/less/tree/variable-call.js +17 -36
  139. package/lib/less/tree/variable-call.js.map +1 -1
  140. package/lib/less/tree/variable.js +21 -36
  141. package/lib/less/tree/variable.js.map +1 -1
  142. package/lib/less/utils.js +5 -33
  143. package/lib/less/utils.js.map +1 -1
  144. package/lib/less/visitors/extend-visitor.js +5 -26
  145. package/lib/less/visitors/extend-visitor.js.map +1 -1
  146. package/lib/less/visitors/import-sequencer.js.map +1 -1
  147. package/lib/less/visitors/import-visitor.js +5 -26
  148. package/lib/less/visitors/import-visitor.js.map +1 -1
  149. package/lib/less/visitors/index.js +7 -9
  150. package/lib/less/visitors/index.js.map +1 -1
  151. package/lib/less/visitors/join-selector-visitor.js +2 -4
  152. package/lib/less/visitors/join-selector-visitor.js.map +1 -1
  153. package/lib/less/visitors/to-css-visitor.js +7 -7
  154. package/lib/less/visitors/to-css-visitor.js.map +1 -1
  155. package/lib/less/visitors/visitor.js +2 -4
  156. package/lib/less/visitors/visitor.js.map +1 -1
  157. package/lib/less-browser/add-default-options.js +2 -4
  158. package/lib/less-browser/add-default-options.js.map +1 -1
  159. package/lib/less-browser/bootstrap.js +4 -6
  160. package/lib/less-browser/bootstrap.js.map +1 -1
  161. package/lib/less-browser/browser.js +2 -20
  162. package/lib/less-browser/browser.js.map +1 -1
  163. package/lib/less-browser/error-reporting.js +3 -24
  164. package/lib/less-browser/error-reporting.js.map +1 -1
  165. package/lib/less-browser/file-manager.js +17 -36
  166. package/lib/less-browser/file-manager.js.map +1 -1
  167. package/lib/less-browser/image-size.js +2 -4
  168. package/lib/less-browser/image-size.js.map +1 -1
  169. package/lib/less-browser/index.js +9 -11
  170. package/lib/less-browser/index.js.map +1 -1
  171. package/lib/less-browser/plugin-loader.js +10 -29
  172. package/lib/less-browser/plugin-loader.js.map +1 -1
  173. package/lib/less-node/file-manager.js +15 -34
  174. package/lib/less-node/file-manager.js.map +1 -1
  175. package/lib/less-node/image-size.js +4 -6
  176. package/lib/less-node/image-size.js.map +1 -1
  177. package/lib/less-node/index.js +6 -8
  178. package/lib/less-node/index.js.map +1 -1
  179. package/lib/less-node/plugin-loader.js +23 -42
  180. package/lib/less-node/plugin-loader.js.map +1 -1
  181. package/lib/less-node/url-file-manager.js +24 -39
  182. package/lib/less-node/url-file-manager.js.map +1 -1
  183. package/package.json +20 -17
  184. package/test/index.js +20 -2
  185. package/test/less-test.js +36 -16
  186. package/tsconfig.json +6 -0
  187. package/LICENSE +0 -177
package/dist/less.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Less - Leaner CSS v4.0.1-alpha.0+70e242c5
2
+ * Less - Leaner CSS v4.1.2
3
3
  * http://lesscss.org
4
4
  *
5
- * Copyright (c) 2009-2020, Alexis Sellier <self@cloudhead.net>
5
+ * Copyright (c) 2009-2021, Alexis Sellier <self@cloudhead.net>
6
6
  * Licensed under the Apache-2.0 License.
7
7
  *
8
8
  * @license Apache-2.0
@@ -11,7 +11,7 @@
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
13
13
  typeof define === 'function' && define.amd ? define(factory) :
14
- (global = global || self, global.less = factory());
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.less = factory());
15
15
  }(this, (function () { 'use strict';
16
16
 
17
17
  // Export a new default each time
@@ -191,7 +191,7 @@
191
191
  }
192
192
  });
193
193
 
194
- var logger = {
194
+ var logger$1 = {
195
195
  error: function (msg) {
196
196
  this._fireEvent('error', msg);
197
197
  },
@@ -250,10 +250,10 @@
250
250
  }
251
251
  Environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) {
252
252
  if (!filename) {
253
- logger.warn('getFileManager called with no filename.. Please report this issue. continuing.');
253
+ logger$1.warn('getFileManager called with no filename.. Please report this issue. continuing.');
254
254
  }
255
255
  if (currentDirectory == null) {
256
- logger.warn('getFileManager called with null directory.. Please report this issue. continuing.');
256
+ logger$1.warn('getFileManager called with null directory.. Please report this issue. continuing.');
257
257
  }
258
258
  var fileManagers = this.fileManagers;
259
259
  if (options.pluginManager) {
@@ -451,6 +451,12 @@
451
451
 
452
452
  var data = { colors: colors, unitConversions: unitConversions };
453
453
 
454
+ /**
455
+ * The reason why Node is a class and other nodes simply do not extend
456
+ * from Node (since we're transpiling) is due to this issue:
457
+ *
458
+ * https://github.com/less/less.js/issues/3434
459
+ */
454
460
  var Node = /** @class */ (function () {
455
461
  function Node() {
456
462
  this.parent = null;
@@ -458,14 +464,21 @@
458
464
  this.nodeVisible = undefined;
459
465
  this.rootNode = null;
460
466
  this.parsed = null;
461
- var self = this;
462
- Object.defineProperty(this, 'currentFileInfo', {
463
- get: function () { return self.fileInfo(); }
464
- });
465
- Object.defineProperty(this, 'index', {
466
- get: function () { return self.getIndex(); }
467
- });
468
467
  }
468
+ Object.defineProperty(Node.prototype, "currentFileInfo", {
469
+ get: function () {
470
+ return this.fileInfo();
471
+ },
472
+ enumerable: false,
473
+ configurable: true
474
+ });
475
+ Object.defineProperty(Node.prototype, "index", {
476
+ get: function () {
477
+ return this.getIndex();
478
+ },
479
+ enumerable: false,
480
+ configurable: true
481
+ });
469
482
  Node.prototype.setParent = function (nodes, parent) {
470
483
  function set(node) {
471
484
  if (node && node instanceof Node) {
@@ -608,111 +621,60 @@
608
621
  return Node;
609
622
  }());
610
623
 
611
- /*! *****************************************************************************
612
- Copyright (c) Microsoft Corporation.
613
-
614
- Permission to use, copy, modify, and/or distribute this software for any
615
- purpose with or without fee is hereby granted.
616
-
617
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
618
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
619
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
620
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
621
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
622
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
623
- PERFORMANCE OF THIS SOFTWARE.
624
- ***************************************************************************** */
625
- /* global Reflect, Promise */
626
- var extendStatics = function (d, b) {
627
- extendStatics = Object.setPrototypeOf ||
628
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
629
- function (d, b) { for (var p in b)
630
- if (b.hasOwnProperty(p))
631
- d[p] = b[p]; };
632
- return extendStatics(d, b);
633
- };
634
- function __extends(d, b) {
635
- extendStatics(d, b);
636
- function __() { this.constructor = d; }
637
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
638
- }
639
- var __assign = function () {
640
- __assign = Object.assign || function __assign(t) {
641
- for (var s, i = 1, n = arguments.length; i < n; i++) {
642
- s = arguments[i];
643
- for (var p in s)
644
- if (Object.prototype.hasOwnProperty.call(s, p))
645
- t[p] = s[p];
646
- }
647
- return t;
648
- };
649
- return __assign.apply(this, arguments);
650
- };
651
- function __spreadArrays() {
652
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
653
- s += arguments[i].length;
654
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
655
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
656
- r[k] = a[j];
657
- return r;
658
- }
659
-
660
624
  //
661
625
  // RGB Colors - #ff0014, #eee
662
626
  //
663
- var Color = /** @class */ (function (_super) {
664
- __extends(Color, _super);
665
- function Color(rgb, a, originalForm) {
666
- var _this = _super.call(this) || this;
667
- var self = _this;
668
- //
669
- // The end goal here, is to parse the arguments
670
- // into an integer triplet, such as `128, 255, 0`
671
- //
672
- // This facilitates operations and conversions.
673
- //
674
- if (Array.isArray(rgb)) {
675
- _this.rgb = rgb;
676
- }
677
- else if (rgb.length >= 6) {
678
- _this.rgb = [];
679
- rgb.match(/.{2}/g).map(function (c, i) {
680
- if (i < 3) {
681
- self.rgb.push(parseInt(c, 16));
682
- }
683
- else {
684
- self.alpha = (parseInt(c, 16)) / 255;
685
- }
686
- });
687
- }
688
- else {
689
- _this.rgb = [];
690
- rgb.split('').map(function (c, i) {
691
- if (i < 3) {
692
- self.rgb.push(parseInt(c + c, 16));
693
- }
694
- else {
695
- self.alpha = (parseInt(c + c, 16)) / 255;
696
- }
697
- });
698
- }
699
- _this.alpha = _this.alpha || (typeof a === 'number' ? a : 1);
700
- if (typeof originalForm !== 'undefined') {
701
- _this.value = originalForm;
702
- }
703
- return _this;
627
+ var Color = function (rgb, a, originalForm) {
628
+ var self = this;
629
+ //
630
+ // The end goal here, is to parse the arguments
631
+ // into an integer triplet, such as `128, 255, 0`
632
+ //
633
+ // This facilitates operations and conversions.
634
+ //
635
+ if (Array.isArray(rgb)) {
636
+ this.rgb = rgb;
637
+ }
638
+ else if (rgb.length >= 6) {
639
+ this.rgb = [];
640
+ rgb.match(/.{2}/g).map(function (c, i) {
641
+ if (i < 3) {
642
+ self.rgb.push(parseInt(c, 16));
643
+ }
644
+ else {
645
+ self.alpha = (parseInt(c, 16)) / 255;
646
+ }
647
+ });
704
648
  }
705
- Color.prototype.luma = function () {
649
+ else {
650
+ this.rgb = [];
651
+ rgb.split('').map(function (c, i) {
652
+ if (i < 3) {
653
+ self.rgb.push(parseInt(c + c, 16));
654
+ }
655
+ else {
656
+ self.alpha = (parseInt(c + c, 16)) / 255;
657
+ }
658
+ });
659
+ }
660
+ this.alpha = this.alpha || (typeof a === 'number' ? a : 1);
661
+ if (typeof originalForm !== 'undefined') {
662
+ this.value = originalForm;
663
+ }
664
+ };
665
+ Color.prototype = Object.assign(new Node(), {
666
+ type: 'Color',
667
+ luma: function () {
706
668
  var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255;
707
669
  r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);
708
670
  g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);
709
671
  b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4);
710
672
  return 0.2126 * r + 0.7152 * g + 0.0722 * b;
711
- };
712
- Color.prototype.genCSS = function (context, output) {
673
+ },
674
+ genCSS: function (context, output) {
713
675
  output.add(this.toCSS(context));
714
- };
715
- Color.prototype.toCSS = function (context, doNotCompress) {
676
+ },
677
+ toCSS: function (context, doNotCompress) {
716
678
  var compress = context && context.compress && !doNotCompress;
717
679
  var color;
718
680
  var alpha;
@@ -748,11 +710,11 @@
748
710
  switch (colorFunction) {
749
711
  case 'rgba':
750
712
  args = this.rgb.map(function (c) {
751
- return clamp(Math.round(c), 255);
752
- }).concat(clamp(alpha, 1));
713
+ return clamp$1(Math.round(c), 255);
714
+ }).concat(clamp$1(alpha, 1));
753
715
  break;
754
716
  case 'hsla':
755
- args.push(clamp(alpha, 1));
717
+ args.push(clamp$1(alpha, 1));
756
718
  case 'hsl':
757
719
  color = this.toHSL();
758
720
  args = [
@@ -774,25 +736,25 @@
774
736
  }
775
737
  }
776
738
  return color;
777
- };
739
+ },
778
740
  //
779
741
  // Operations have to be done per-channel, if not,
780
742
  // channels will spill onto each other. Once we have
781
743
  // our result, in the form of an integer triplet,
782
744
  // we create a new Color node to hold the result.
783
745
  //
784
- Color.prototype.operate = function (context, op, other) {
746
+ operate: function (context, op, other) {
785
747
  var rgb = new Array(3);
786
748
  var alpha = this.alpha * (1 - other.alpha) + other.alpha;
787
749
  for (var c = 0; c < 3; c++) {
788
750
  rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]);
789
751
  }
790
752
  return new Color(rgb, alpha);
791
- };
792
- Color.prototype.toRGB = function () {
753
+ },
754
+ toRGB: function () {
793
755
  return toHex(this.rgb);
794
- };
795
- Color.prototype.toHSL = function () {
756
+ },
757
+ toHSL: function () {
796
758
  var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;
797
759
  var max = Math.max(r, g, b), min = Math.min(r, g, b);
798
760
  var h;
@@ -818,9 +780,9 @@
818
780
  h /= 6;
819
781
  }
820
782
  return { h: h * 360, s: s, l: l, a: a };
821
- };
783
+ },
822
784
  // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
823
- Color.prototype.toHSV = function () {
785
+ toHSV: function () {
824
786
  var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;
825
787
  var max = Math.max(r, g, b), min = Math.min(r, g, b);
826
788
  var h;
@@ -851,129 +813,117 @@
851
813
  h /= 6;
852
814
  }
853
815
  return { h: h * 360, s: s, v: v, a: a };
854
- };
855
- Color.prototype.toARGB = function () {
816
+ },
817
+ toARGB: function () {
856
818
  return toHex([this.alpha * 255].concat(this.rgb));
857
- };
858
- Color.prototype.compare = function (x) {
819
+ },
820
+ compare: function (x) {
859
821
  return (x.rgb &&
860
822
  x.rgb[0] === this.rgb[0] &&
861
823
  x.rgb[1] === this.rgb[1] &&
862
824
  x.rgb[2] === this.rgb[2] &&
863
825
  x.alpha === this.alpha) ? 0 : undefined;
864
- };
865
- Color.fromKeyword = function (keyword) {
866
- var c;
867
- var key = keyword.toLowerCase();
868
- if (colors.hasOwnProperty(key)) {
869
- c = new Color(colors[key].slice(1));
870
- }
871
- else if (key === 'transparent') {
872
- c = new Color([0, 0, 0], 0);
873
- }
874
- if (c) {
875
- c.value = keyword;
876
- return c;
877
- }
878
- };
879
- return Color;
880
- }(Node));
881
- Color.prototype.type = 'Color';
882
- function clamp(v, max) {
826
+ }
827
+ });
828
+ Color.fromKeyword = function (keyword) {
829
+ var c;
830
+ var key = keyword.toLowerCase();
831
+ if (colors.hasOwnProperty(key)) {
832
+ c = new Color(colors[key].slice(1));
833
+ }
834
+ else if (key === 'transparent') {
835
+ c = new Color([0, 0, 0], 0);
836
+ }
837
+ if (c) {
838
+ c.value = keyword;
839
+ return c;
840
+ }
841
+ };
842
+ function clamp$1(v, max) {
883
843
  return Math.min(Math.max(v, 0), max);
884
844
  }
885
845
  function toHex(v) {
886
846
  return "#" + v.map(function (c) {
887
- c = clamp(Math.round(c), 255);
847
+ c = clamp$1(Math.round(c), 255);
888
848
  return (c < 16 ? '0' : '') + c.toString(16);
889
849
  }).join('');
890
850
  }
891
851
 
892
- var Paren = /** @class */ (function (_super) {
893
- __extends(Paren, _super);
894
- function Paren(node) {
895
- var _this = _super.call(this) || this;
896
- _this.value = node;
897
- return _this;
898
- }
899
- Paren.prototype.genCSS = function (context, output) {
852
+ var Paren = function (node) {
853
+ this.value = node;
854
+ };
855
+ Paren.prototype = Object.assign(new Node(), {
856
+ type: 'Paren',
857
+ genCSS: function (context, output) {
900
858
  output.add('(');
901
859
  this.value.genCSS(context, output);
902
860
  output.add(')');
903
- };
904
- Paren.prototype.eval = function (context) {
861
+ },
862
+ eval: function (context) {
905
863
  return new Paren(this.value.eval(context));
906
- };
907
- return Paren;
908
- }(Node));
909
- Paren.prototype.type = 'Paren';
864
+ }
865
+ });
910
866
 
911
867
  var _noSpaceCombinators = {
912
868
  '': true,
913
869
  ' ': true,
914
870
  '|': true
915
871
  };
916
- var Combinator = /** @class */ (function (_super) {
917
- __extends(Combinator, _super);
918
- function Combinator(value) {
919
- var _this = _super.call(this) || this;
920
- if (value === ' ') {
921
- _this.value = ' ';
922
- _this.emptyOrWhitespace = true;
923
- }
924
- else {
925
- _this.value = value ? value.trim() : '';
926
- _this.emptyOrWhitespace = _this.value === '';
927
- }
928
- return _this;
872
+ var Combinator = function (value) {
873
+ if (value === ' ') {
874
+ this.value = ' ';
875
+ this.emptyOrWhitespace = true;
929
876
  }
930
- Combinator.prototype.genCSS = function (context, output) {
877
+ else {
878
+ this.value = value ? value.trim() : '';
879
+ this.emptyOrWhitespace = this.value === '';
880
+ }
881
+ };
882
+ Combinator.prototype = Object.assign(new Node(), {
883
+ type: 'Combinator',
884
+ genCSS: function (context, output) {
931
885
  var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' ';
932
886
  output.add(spaceOrEmpty + this.value + spaceOrEmpty);
933
- };
934
- return Combinator;
935
- }(Node));
936
- Combinator.prototype.type = 'Combinator';
887
+ }
888
+ });
937
889
 
938
- var Element = /** @class */ (function (_super) {
939
- __extends(Element, _super);
940
- function Element(combinator, value, isVariable, index, currentFileInfo, visibilityInfo) {
941
- var _this = _super.call(this) || this;
942
- _this.combinator = combinator instanceof Combinator ?
943
- combinator : new Combinator(combinator);
944
- if (typeof value === 'string') {
945
- _this.value = value.trim();
946
- }
947
- else if (value) {
948
- _this.value = value;
949
- }
950
- else {
951
- _this.value = '';
952
- }
953
- _this.isVariable = isVariable;
954
- _this._index = index;
955
- _this._fileInfo = currentFileInfo;
956
- _this.copyVisibilityInfo(visibilityInfo);
957
- _this.setParent(_this.combinator, _this);
958
- return _this;
890
+ var Element = function (combinator, value, isVariable, index, currentFileInfo, visibilityInfo) {
891
+ this.combinator = combinator instanceof Combinator ?
892
+ combinator : new Combinator(combinator);
893
+ if (typeof value === 'string') {
894
+ this.value = value.trim();
959
895
  }
960
- Element.prototype.accept = function (visitor) {
896
+ else if (value) {
897
+ this.value = value;
898
+ }
899
+ else {
900
+ this.value = '';
901
+ }
902
+ this.isVariable = isVariable;
903
+ this._index = index;
904
+ this._fileInfo = currentFileInfo;
905
+ this.copyVisibilityInfo(visibilityInfo);
906
+ this.setParent(this.combinator, this);
907
+ };
908
+ Element.prototype = Object.assign(new Node(), {
909
+ type: 'Element',
910
+ accept: function (visitor) {
961
911
  var value = this.value;
962
912
  this.combinator = visitor.visit(this.combinator);
963
913
  if (typeof value === 'object') {
964
914
  this.value = visitor.visit(value);
965
915
  }
966
- };
967
- Element.prototype.eval = function (context) {
916
+ },
917
+ eval: function (context) {
968
918
  return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo());
969
- };
970
- Element.prototype.clone = function () {
919
+ },
920
+ clone: function () {
971
921
  return new Element(this.combinator, this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo());
972
- };
973
- Element.prototype.genCSS = function (context, output) {
922
+ },
923
+ genCSS: function (context, output) {
974
924
  output.add(this.toCSS(context), this.fileInfo(), this.getIndex());
975
- };
976
- Element.prototype.toCSS = function (context) {
925
+ },
926
+ toCSS: function (context) {
977
927
  context = context || {};
978
928
  var value = this.value;
979
929
  var firstSelector = context.firstSelector;
@@ -990,15 +940,14 @@
990
940
  else {
991
941
  return this.combinator.toCSS(context) + value;
992
942
  }
993
- };
994
- return Element;
995
- }(Node));
996
- Element.prototype.type = 'Element';
943
+ }
944
+ });
997
945
 
998
946
  var Math$1 = {
999
947
  ALWAYS: 0,
1000
948
  PARENS_DIVISION: 1,
1001
- PARENS: 2,
949
+ PARENS: 2
950
+ // removed - STRICT_LEGACY: 3
1002
951
  };
1003
952
  var RewriteUrls = {
1004
953
  OFF: 0,
@@ -1006,6 +955,104 @@
1006
955
  ALL: 2
1007
956
  };
1008
957
 
958
+ /**
959
+ * Returns the object type of the given payload
960
+ *
961
+ * @param {*} payload
962
+ * @returns {string}
963
+ */
964
+ function getType(payload) {
965
+ return Object.prototype.toString.call(payload).slice(8, -1);
966
+ }
967
+ /**
968
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
969
+ *
970
+ * @param {*} payload
971
+ * @returns {payload is Record<string, any>}
972
+ */
973
+ function isPlainObject(payload) {
974
+ if (getType(payload) !== 'Object')
975
+ return false;
976
+ return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
977
+ }
978
+ /**
979
+ * Returns whether the payload is an array
980
+ *
981
+ * @param {any} payload
982
+ * @returns {payload is any[]}
983
+ */
984
+ function isArray(payload) {
985
+ return getType(payload) === 'Array';
986
+ }
987
+
988
+ /*! *****************************************************************************
989
+ Copyright (c) Microsoft Corporation. All rights reserved.
990
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
991
+ this file except in compliance with the License. You may obtain a copy of the
992
+ License at http://www.apache.org/licenses/LICENSE-2.0
993
+
994
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
995
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
996
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
997
+ MERCHANTABLITY OR NON-INFRINGEMENT.
998
+
999
+ See the Apache Version 2.0 License for specific language governing permissions
1000
+ and limitations under the License.
1001
+ ***************************************************************************** */
1002
+
1003
+ function __spreadArrays() {
1004
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1005
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
1006
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
1007
+ r[k] = a[j];
1008
+ return r;
1009
+ }
1010
+
1011
+ function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
1012
+ var propType = {}.propertyIsEnumerable.call(originalObject, key)
1013
+ ? 'enumerable'
1014
+ : 'nonenumerable';
1015
+ if (propType === 'enumerable')
1016
+ carry[key] = newVal;
1017
+ if (includeNonenumerable && propType === 'nonenumerable') {
1018
+ Object.defineProperty(carry, key, {
1019
+ value: newVal,
1020
+ enumerable: false,
1021
+ writable: true,
1022
+ configurable: true,
1023
+ });
1024
+ }
1025
+ }
1026
+ /**
1027
+ * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked.
1028
+ *
1029
+ * @export
1030
+ * @template T
1031
+ * @param {T} target Target can be anything
1032
+ * @param {Options} [options={}] Options can be `props` or `nonenumerable`
1033
+ * @returns {T} the target with replaced values
1034
+ * @export
1035
+ */
1036
+ function copy(target, options) {
1037
+ if (options === void 0) { options = {}; }
1038
+ if (isArray(target))
1039
+ return target.map(function (i) { return copy(i, options); });
1040
+ if (!isPlainObject(target))
1041
+ return target;
1042
+ var props = Object.getOwnPropertyNames(target);
1043
+ var symbols = Object.getOwnPropertySymbols(target);
1044
+ return __spreadArrays(props, symbols).reduce(function (carry, key) {
1045
+ if (isArray(options.props) && !options.props.includes(key)) {
1046
+ return carry;
1047
+ }
1048
+ var val = target[key];
1049
+ var newVal = copy(val, options);
1050
+ assignProp(carry, key, newVal, target, options.nonenumerable);
1051
+ return carry;
1052
+ }, {});
1053
+ }
1054
+
1055
+ /* jshint proto: true */
1009
1056
  function getLocation(index, inputStream) {
1010
1057
  var n = index + 1;
1011
1058
  var line = null;
@@ -1043,9 +1090,9 @@
1043
1090
  var newObj = obj2 || {};
1044
1091
  if (!obj2._defaults) {
1045
1092
  newObj = {};
1046
- var defaults_1 = __assign({}, obj1);
1093
+ var defaults_1 = copy(obj1);
1047
1094
  newObj._defaults = defaults_1;
1048
- var cloned = obj2 ? __assign({}, obj2) : {};
1095
+ var cloned = obj2 ? copy(obj2) : {};
1049
1096
  Object.assign(newObj, defaults_1, cloned);
1050
1097
  }
1051
1098
  return newObj;
@@ -1267,22 +1314,20 @@
1267
1314
  return message;
1268
1315
  };
1269
1316
 
1270
- var Selector = /** @class */ (function (_super) {
1271
- __extends(Selector, _super);
1272
- function Selector(elements, extendList, condition, index, currentFileInfo, visibilityInfo) {
1273
- var _this = _super.call(this) || this;
1274
- _this.extendList = extendList;
1275
- _this.condition = condition;
1276
- _this.evaldCondition = !condition;
1277
- _this._index = index;
1278
- _this._fileInfo = currentFileInfo;
1279
- _this.elements = _this.getElements(elements);
1280
- _this.mixinElements_ = undefined;
1281
- _this.copyVisibilityInfo(visibilityInfo);
1282
- _this.setParent(_this.elements, _this);
1283
- return _this;
1284
- }
1285
- Selector.prototype.accept = function (visitor) {
1317
+ var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) {
1318
+ this.extendList = extendList;
1319
+ this.condition = condition;
1320
+ this.evaldCondition = !condition;
1321
+ this._index = index;
1322
+ this._fileInfo = currentFileInfo;
1323
+ this.elements = this.getElements(elements);
1324
+ this.mixinElements_ = undefined;
1325
+ this.copyVisibilityInfo(visibilityInfo);
1326
+ this.setParent(this.elements, this);
1327
+ };
1328
+ Selector.prototype = Object.assign(new Node(), {
1329
+ type: 'Selector',
1330
+ accept: function (visitor) {
1286
1331
  if (this.elements) {
1287
1332
  this.elements = visitor.visitArray(this.elements);
1288
1333
  }
@@ -1292,15 +1337,15 @@
1292
1337
  if (this.condition) {
1293
1338
  this.condition = visitor.visit(this.condition);
1294
1339
  }
1295
- };
1296
- Selector.prototype.createDerived = function (elements, extendList, evaldCondition) {
1340
+ },
1341
+ createDerived: function (elements, extendList, evaldCondition) {
1297
1342
  elements = this.getElements(elements);
1298
1343
  var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), this.visibilityInfo());
1299
1344
  newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition;
1300
1345
  newSelector.mediaEmpty = this.mediaEmpty;
1301
1346
  return newSelector;
1302
- };
1303
- Selector.prototype.getElements = function (els) {
1347
+ },
1348
+ getElements: function (els) {
1304
1349
  if (!els) {
1305
1350
  return [new Element('', '&', false, this._index, this._fileInfo)];
1306
1351
  }
@@ -1316,13 +1361,13 @@
1316
1361
  });
1317
1362
  }
1318
1363
  return els;
1319
- };
1320
- Selector.prototype.createEmptySelectors = function () {
1364
+ },
1365
+ createEmptySelectors: function () {
1321
1366
  var el = new Element('', '&', false, this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)];
1322
1367
  sels[0].mediaEmpty = true;
1323
1368
  return sels;
1324
- };
1325
- Selector.prototype.match = function (other) {
1369
+ },
1370
+ match: function (other) {
1326
1371
  var elements = this.elements;
1327
1372
  var len = elements.length;
1328
1373
  var olen;
@@ -1340,8 +1385,8 @@
1340
1385
  }
1341
1386
  }
1342
1387
  return olen; // return number of matched elements
1343
- };
1344
- Selector.prototype.mixinElements = function () {
1388
+ },
1389
+ mixinElements: function () {
1345
1390
  if (this.mixinElements_) {
1346
1391
  return this.mixinElements_;
1347
1392
  }
@@ -1357,22 +1402,22 @@
1357
1402
  elements = [];
1358
1403
  }
1359
1404
  return (this.mixinElements_ = elements);
1360
- };
1361
- Selector.prototype.isJustParentSelector = function () {
1405
+ },
1406
+ isJustParentSelector: function () {
1362
1407
  return !this.mediaEmpty &&
1363
1408
  this.elements.length === 1 &&
1364
1409
  this.elements[0].value === '&' &&
1365
1410
  (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === '');
1366
- };
1367
- Selector.prototype.eval = function (context) {
1411
+ },
1412
+ eval: function (context) {
1368
1413
  var evaldCondition = this.condition && this.condition.eval(context);
1369
1414
  var elements = this.elements;
1370
1415
  var extendList = this.extendList;
1371
1416
  elements = elements && elements.map(function (e) { return e.eval(context); });
1372
1417
  extendList = extendList && extendList.map(function (extend) { return extend.eval(context); });
1373
1418
  return this.createDerived(elements, extendList, evaldCondition);
1374
- };
1375
- Selector.prototype.genCSS = function (context, output) {
1419
+ },
1420
+ genCSS: function (context, output) {
1376
1421
  var i, element;
1377
1422
  if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') {
1378
1423
  output.add(' ', this.fileInfo(), this.getIndex());
@@ -1381,35 +1426,31 @@
1381
1426
  element = this.elements[i];
1382
1427
  element.genCSS(context, output);
1383
1428
  }
1384
- };
1385
- Selector.prototype.getIsOutput = function () {
1429
+ },
1430
+ getIsOutput: function () {
1386
1431
  return this.evaldCondition;
1387
- };
1388
- return Selector;
1389
- }(Node));
1390
- Selector.prototype.type = 'Selector';
1432
+ }
1433
+ });
1391
1434
 
1392
- var Value = /** @class */ (function (_super) {
1393
- __extends(Value, _super);
1394
- function Value(value) {
1395
- var _this = _super.call(this) || this;
1396
- if (!value) {
1397
- throw new Error('Value requires an array argument');
1398
- }
1399
- if (!Array.isArray(value)) {
1400
- _this.value = [value];
1401
- }
1402
- else {
1403
- _this.value = value;
1404
- }
1405
- return _this;
1435
+ var Value = function (value) {
1436
+ if (!value) {
1437
+ throw new Error('Value requires an array argument');
1406
1438
  }
1407
- Value.prototype.accept = function (visitor) {
1439
+ if (!Array.isArray(value)) {
1440
+ this.value = [value];
1441
+ }
1442
+ else {
1443
+ this.value = value;
1444
+ }
1445
+ };
1446
+ Value.prototype = Object.assign(new Node(), {
1447
+ type: 'Value',
1448
+ accept: function (visitor) {
1408
1449
  if (this.value) {
1409
1450
  this.value = visitor.visitArray(this.value);
1410
1451
  }
1411
- };
1412
- Value.prototype.eval = function (context) {
1452
+ },
1453
+ eval: function (context) {
1413
1454
  if (this.value.length === 1) {
1414
1455
  return this.value[0].eval(context);
1415
1456
  }
@@ -1418,8 +1459,8 @@
1418
1459
  return v.eval(context);
1419
1460
  }));
1420
1461
  }
1421
- };
1422
- Value.prototype.genCSS = function (context, output) {
1462
+ },
1463
+ genCSS: function (context, output) {
1423
1464
  var i;
1424
1465
  for (i = 0; i < this.value.length; i++) {
1425
1466
  this.value[i].genCSS(context, output);
@@ -1427,81 +1468,79 @@
1427
1468
  output.add((context && context.compress) ? ',' : ', ');
1428
1469
  }
1429
1470
  }
1430
- };
1431
- return Value;
1432
- }(Node));
1433
- Value.prototype.type = 'Value';
1471
+ }
1472
+ });
1434
1473
 
1435
- var Keyword = /** @class */ (function (_super) {
1436
- __extends(Keyword, _super);
1437
- function Keyword(value) {
1438
- var _this = _super.call(this) || this;
1439
- _this.value = value;
1440
- return _this;
1441
- }
1442
- Keyword.prototype.genCSS = function (context, output) {
1474
+ var Keyword = function (value) {
1475
+ this.value = value;
1476
+ };
1477
+ Keyword.prototype = Object.assign(new Node(), {
1478
+ type: 'Keyword',
1479
+ genCSS: function (context, output) {
1443
1480
  if (this.value === '%') {
1444
1481
  throw { type: 'Syntax', message: 'Invalid % without number' };
1445
1482
  }
1446
1483
  output.add(this.value);
1447
- };
1448
- return Keyword;
1449
- }(Node));
1450
- Keyword.prototype.type = 'Keyword';
1484
+ }
1485
+ });
1451
1486
  Keyword.True = new Keyword('true');
1452
1487
  Keyword.False = new Keyword('false');
1453
1488
 
1454
- var Anonymous = /** @class */ (function (_super) {
1455
- __extends(Anonymous, _super);
1456
- function Anonymous(value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) {
1457
- var _this = _super.call(this) || this;
1458
- _this.value = value;
1459
- _this._index = index;
1460
- _this._fileInfo = currentFileInfo;
1461
- _this.mapLines = mapLines;
1462
- _this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike;
1463
- _this.allowRoot = true;
1464
- _this.copyVisibilityInfo(visibilityInfo);
1465
- return _this;
1466
- }
1467
- Anonymous.prototype.eval = function () {
1489
+ var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) {
1490
+ this.value = value;
1491
+ this._index = index;
1492
+ this._fileInfo = currentFileInfo;
1493
+ this.mapLines = mapLines;
1494
+ this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike;
1495
+ this.allowRoot = true;
1496
+ this.copyVisibilityInfo(visibilityInfo);
1497
+ };
1498
+ Anonymous.prototype = Object.assign(new Node(), {
1499
+ type: 'Anonymous',
1500
+ eval: function () {
1468
1501
  return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());
1469
- };
1470
- Anonymous.prototype.compare = function (other) {
1502
+ },
1503
+ compare: function (other) {
1471
1504
  return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;
1472
- };
1473
- Anonymous.prototype.isRulesetLike = function () {
1505
+ },
1506
+ isRulesetLike: function () {
1474
1507
  return this.rulesetLike;
1475
- };
1476
- Anonymous.prototype.genCSS = function (context, output) {
1508
+ },
1509
+ genCSS: function (context, output) {
1477
1510
  this.nodeVisible = Boolean(this.value);
1478
1511
  if (this.nodeVisible) {
1479
1512
  output.add(this.value, this._fileInfo, this._index, this.mapLines);
1480
1513
  }
1481
- };
1482
- return Anonymous;
1483
- }(Node));
1484
- Anonymous.prototype.type = 'Anonymous';
1514
+ }
1515
+ });
1485
1516
 
1486
- var MATH = Math$1;
1487
- var Declaration = /** @class */ (function (_super) {
1488
- __extends(Declaration, _super);
1489
- function Declaration(name, value, important, merge, index, currentFileInfo, inline, variable) {
1490
- var _this = _super.call(this) || this;
1491
- _this.name = name;
1492
- _this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]);
1493
- _this.important = important ? " " + important.trim() : '';
1494
- _this.merge = merge;
1495
- _this._index = index;
1496
- _this._fileInfo = currentFileInfo;
1497
- _this.inline = inline || false;
1498
- _this.variable = (variable !== undefined) ? variable
1499
- : (name.charAt && (name.charAt(0) === '@'));
1500
- _this.allowRoot = true;
1501
- _this.setParent(_this.value, _this);
1502
- return _this;
1503
- }
1504
- Declaration.prototype.genCSS = function (context, output) {
1517
+ var MATH$1 = Math$1;
1518
+ function evalName(context, name) {
1519
+ var value = '';
1520
+ var i;
1521
+ var n = name.length;
1522
+ var output = { add: function (s) { value += s; } };
1523
+ for (i = 0; i < n; i++) {
1524
+ name[i].eval(context).genCSS(context, output);
1525
+ }
1526
+ return value;
1527
+ }
1528
+ var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) {
1529
+ this.name = name;
1530
+ this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]);
1531
+ this.important = important ? " " + important.trim() : '';
1532
+ this.merge = merge;
1533
+ this._index = index;
1534
+ this._fileInfo = currentFileInfo;
1535
+ this.inline = inline || false;
1536
+ this.variable = (variable !== undefined) ? variable
1537
+ : (name.charAt && (name.charAt(0) === '@'));
1538
+ this.allowRoot = true;
1539
+ this.setParent(this.value, this);
1540
+ };
1541
+ Declaration.prototype = Object.assign(new Node(), {
1542
+ type: 'Declaration',
1543
+ genCSS: function (context, output) {
1505
1544
  output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());
1506
1545
  try {
1507
1546
  this.value.genCSS(context, output);
@@ -1512,8 +1551,8 @@
1512
1551
  throw e;
1513
1552
  }
1514
1553
  output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);
1515
- };
1516
- Declaration.prototype.eval = function (context) {
1554
+ },
1555
+ eval: function (context) {
1517
1556
  var mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable;
1518
1557
  if (typeof name !== 'string') {
1519
1558
  // expand 'primitive' name directly to get
@@ -1523,10 +1562,10 @@
1523
1562
  variable = false; // never treat expanded interpolation as new variable name
1524
1563
  }
1525
1564
  // @todo remove when parens-division is default
1526
- if (name === 'font' && context.math === MATH.ALWAYS) {
1565
+ if (name === 'font' && context.math === MATH$1.ALWAYS) {
1527
1566
  mathBypass = true;
1528
1567
  prevMath = context.math;
1529
- context.math = MATH.PARENS_DIVISION;
1568
+ context.math = MATH$1.PARENS_DIVISION;
1530
1569
  }
1531
1570
  try {
1532
1571
  context.importantScope.push({});
@@ -1554,23 +1593,11 @@
1554
1593
  context.math = prevMath;
1555
1594
  }
1556
1595
  }
1557
- };
1558
- Declaration.prototype.makeImportant = function () {
1596
+ },
1597
+ makeImportant: function () {
1559
1598
  return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline);
1560
- };
1561
- return Declaration;
1562
- }(Node));
1563
- function evalName(context, name) {
1564
- var value = '';
1565
- var i;
1566
- var n = name.length;
1567
- var output = { add: function (s) { value += s; } };
1568
- for (i = 0; i < n; i++) {
1569
- name[i].eval(context).genCSS(context, output);
1570
1599
  }
1571
- return value;
1572
- }
1573
- Declaration.prototype.type = 'Declaration';
1600
+ });
1574
1601
 
1575
1602
  var debugInfo = /** @class */ (function () {
1576
1603
  function debugInfo(context, ctx, lineSeparator) {
@@ -1608,30 +1635,26 @@
1608
1635
  return debugInfo;
1609
1636
  }());
1610
1637
 
1611
- var Comment = /** @class */ (function (_super) {
1612
- __extends(Comment, _super);
1613
- function Comment(value, isLineComment, index, currentFileInfo) {
1614
- var _this = _super.call(this) || this;
1615
- _this.value = value;
1616
- _this.isLineComment = isLineComment;
1617
- _this._index = index;
1618
- _this._fileInfo = currentFileInfo;
1619
- _this.allowRoot = true;
1620
- return _this;
1621
- }
1622
- Comment.prototype.genCSS = function (context, output) {
1638
+ var Comment = function (value, isLineComment, index, currentFileInfo) {
1639
+ this.value = value;
1640
+ this.isLineComment = isLineComment;
1641
+ this._index = index;
1642
+ this._fileInfo = currentFileInfo;
1643
+ this.allowRoot = true;
1644
+ };
1645
+ Comment.prototype = Object.assign(new Node(), {
1646
+ type: 'Comment',
1647
+ genCSS: function (context, output) {
1623
1648
  if (this.debugInfo) {
1624
1649
  output.add(debugInfo(context, this), this.fileInfo(), this.getIndex());
1625
1650
  }
1626
1651
  output.add(this.value);
1627
- };
1628
- Comment.prototype.isSilent = function (context) {
1652
+ },
1653
+ isSilent: function (context) {
1629
1654
  var isCompressed = context.compress && this.value[2] !== '!';
1630
1655
  return this.isLineComment || isCompressed;
1631
- };
1632
- return Comment;
1633
- }(Node));
1634
- Comment.prototype.type = 'Comment';
1656
+ }
1657
+ });
1635
1658
 
1636
1659
  var contexts = {};
1637
1660
  var copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) {
@@ -1831,24 +1854,23 @@
1831
1854
  }
1832
1855
  };
1833
1856
 
1834
- var Ruleset = /** @class */ (function (_super) {
1835
- __extends(Ruleset, _super);
1836
- function Ruleset(selectors, rules, strictImports, visibilityInfo) {
1837
- var _this = _super.call(this) || this;
1838
- _this.selectors = selectors;
1839
- _this.rules = rules;
1840
- _this._lookups = {};
1841
- _this._variables = null;
1842
- _this._properties = null;
1843
- _this.strictImports = strictImports;
1844
- _this.copyVisibilityInfo(visibilityInfo);
1845
- _this.allowRoot = true;
1846
- _this.setParent(_this.selectors, _this);
1847
- _this.setParent(_this.rules, _this);
1848
- return _this;
1849
- }
1850
- Ruleset.prototype.isRulesetLike = function () { return true; };
1851
- Ruleset.prototype.accept = function (visitor) {
1857
+ var Ruleset = function (selectors, rules, strictImports, visibilityInfo) {
1858
+ this.selectors = selectors;
1859
+ this.rules = rules;
1860
+ this._lookups = {};
1861
+ this._variables = null;
1862
+ this._properties = null;
1863
+ this.strictImports = strictImports;
1864
+ this.copyVisibilityInfo(visibilityInfo);
1865
+ this.allowRoot = true;
1866
+ this.setParent(this.selectors, this);
1867
+ this.setParent(this.rules, this);
1868
+ };
1869
+ Ruleset.prototype = Object.assign(new Node(), {
1870
+ type: 'Ruleset',
1871
+ isRuleset: true,
1872
+ isRulesetLike: function () { return true; },
1873
+ accept: function (visitor) {
1852
1874
  if (this.paths) {
1853
1875
  this.paths = visitor.visitArray(this.paths, true);
1854
1876
  }
@@ -1858,8 +1880,8 @@
1858
1880
  if (this.rules && this.rules.length) {
1859
1881
  this.rules = visitor.visitArray(this.rules);
1860
1882
  }
1861
- };
1862
- Ruleset.prototype.eval = function (context) {
1883
+ },
1884
+ eval: function (context) {
1863
1885
  var selectors;
1864
1886
  var selCnt;
1865
1887
  var selector;
@@ -2016,8 +2038,8 @@
2016
2038
  }
2017
2039
  }
2018
2040
  return ruleset;
2019
- };
2020
- Ruleset.prototype.evalImports = function (context) {
2041
+ },
2042
+ evalImports: function (context) {
2021
2043
  var rules = this.rules;
2022
2044
  var i;
2023
2045
  var importRules;
@@ -2037,8 +2059,8 @@
2037
2059
  this.resetCache();
2038
2060
  }
2039
2061
  }
2040
- };
2041
- Ruleset.prototype.makeImportant = function () {
2062
+ },
2063
+ makeImportant: function () {
2042
2064
  var result = new Ruleset(this.selectors, this.rules.map(function (r) {
2043
2065
  if (r.makeImportant) {
2044
2066
  return r.makeImportant();
@@ -2048,12 +2070,12 @@
2048
2070
  }
2049
2071
  }), this.strictImports, this.visibilityInfo());
2050
2072
  return result;
2051
- };
2052
- Ruleset.prototype.matchArgs = function (args) {
2073
+ },
2074
+ matchArgs: function (args) {
2053
2075
  return !args || args.length === 0;
2054
- };
2076
+ },
2055
2077
  // lets you call a css selector with a guard
2056
- Ruleset.prototype.matchCondition = function (args, context) {
2078
+ matchCondition: function (args, context) {
2057
2079
  var lastSelector = this.selectors[this.selectors.length - 1];
2058
2080
  if (!lastSelector.evaldCondition) {
2059
2081
  return false;
@@ -2063,14 +2085,14 @@
2063
2085
  return false;
2064
2086
  }
2065
2087
  return true;
2066
- };
2067
- Ruleset.prototype.resetCache = function () {
2088
+ },
2089
+ resetCache: function () {
2068
2090
  this._rulesets = null;
2069
2091
  this._variables = null;
2070
2092
  this._properties = null;
2071
2093
  this._lookups = {};
2072
- };
2073
- Ruleset.prototype.variables = function () {
2094
+ },
2095
+ variables: function () {
2074
2096
  if (!this._variables) {
2075
2097
  this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) {
2076
2098
  if (r instanceof Declaration && r.variable === true) {
@@ -2091,8 +2113,8 @@
2091
2113
  }, {});
2092
2114
  }
2093
2115
  return this._variables;
2094
- };
2095
- Ruleset.prototype.properties = function () {
2116
+ },
2117
+ properties: function () {
2096
2118
  if (!this._properties) {
2097
2119
  this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) {
2098
2120
  if (r instanceof Declaration && r.variable !== true) {
@@ -2110,28 +2132,28 @@
2110
2132
  }, {});
2111
2133
  }
2112
2134
  return this._properties;
2113
- };
2114
- Ruleset.prototype.variable = function (name) {
2135
+ },
2136
+ variable: function (name) {
2115
2137
  var decl = this.variables()[name];
2116
2138
  if (decl) {
2117
2139
  return this.parseValue(decl);
2118
2140
  }
2119
- };
2120
- Ruleset.prototype.property = function (name) {
2141
+ },
2142
+ property: function (name) {
2121
2143
  var decl = this.properties()[name];
2122
2144
  if (decl) {
2123
2145
  return this.parseValue(decl);
2124
2146
  }
2125
- };
2126
- Ruleset.prototype.lastDeclaration = function () {
2147
+ },
2148
+ lastDeclaration: function () {
2127
2149
  for (var i = this.rules.length; i > 0; i--) {
2128
2150
  var decl = this.rules[i - 1];
2129
2151
  if (decl instanceof Declaration) {
2130
2152
  return this.parseValue(decl);
2131
2153
  }
2132
2154
  }
2133
- };
2134
- Ruleset.prototype.parseValue = function (toParse) {
2155
+ },
2156
+ parseValue: function (toParse) {
2135
2157
  var self = this;
2136
2158
  function transformDeclaration(decl) {
2137
2159
  if (decl.value instanceof Anonymous && !decl.parsed) {
@@ -2166,8 +2188,8 @@
2166
2188
  });
2167
2189
  return nodes_1;
2168
2190
  }
2169
- };
2170
- Ruleset.prototype.rulesets = function () {
2191
+ },
2192
+ rulesets: function () {
2171
2193
  if (!this.rules) {
2172
2194
  return [];
2173
2195
  }
@@ -2181,8 +2203,8 @@
2181
2203
  }
2182
2204
  }
2183
2205
  return filtRules;
2184
- };
2185
- Ruleset.prototype.prependRule = function (rule) {
2206
+ },
2207
+ prependRule: function (rule) {
2186
2208
  var rules = this.rules;
2187
2209
  if (rules) {
2188
2210
  rules.unshift(rule);
@@ -2191,8 +2213,8 @@
2191
2213
  this.rules = [rule];
2192
2214
  }
2193
2215
  this.setParent(rule, this);
2194
- };
2195
- Ruleset.prototype.find = function (selector, self, filter) {
2216
+ },
2217
+ find: function (selector, self, filter) {
2196
2218
  self = self || this;
2197
2219
  var rules = [];
2198
2220
  var match;
@@ -2225,8 +2247,8 @@
2225
2247
  });
2226
2248
  this._lookups[key] = rules;
2227
2249
  return rules;
2228
- };
2229
- Ruleset.prototype.genCSS = function (context, output) {
2250
+ },
2251
+ genCSS: function (context, output) {
2230
2252
  var i;
2231
2253
  var j;
2232
2254
  var charsetRuleNodes = [];
@@ -2324,13 +2346,13 @@
2324
2346
  if (!output.isEmpty() && !context.compress && this.firstRoot) {
2325
2347
  output.add('\n');
2326
2348
  }
2327
- };
2328
- Ruleset.prototype.joinSelectors = function (paths, context, selectors) {
2349
+ },
2350
+ joinSelectors: function (paths, context, selectors) {
2329
2351
  for (var s = 0; s < selectors.length; s++) {
2330
2352
  this.joinSelector(paths, context, selectors[s]);
2331
2353
  }
2332
- };
2333
- Ruleset.prototype.joinSelector = function (paths, context, selector) {
2354
+ },
2355
+ joinSelector: function (paths, context, selector) {
2334
2356
  function createParenthesis(elementsToPak, originalElement) {
2335
2357
  var replacementParen, j;
2336
2358
  if (elementsToPak.length === 0) {
@@ -2560,41 +2582,36 @@
2560
2582
  for (i = 0; i < newPaths.length; i++) {
2561
2583
  paths.push(newPaths[i]);
2562
2584
  }
2563
- };
2564
- return Ruleset;
2565
- }(Node));
2566
- Ruleset.prototype.type = 'Ruleset';
2567
- Ruleset.prototype.isRuleset = true;
2585
+ }
2586
+ });
2568
2587
 
2569
- var AtRule = /** @class */ (function (_super) {
2570
- __extends(AtRule, _super);
2571
- function AtRule(name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) {
2572
- var _this = _super.call(this) || this;
2573
- var i;
2574
- _this.name = name;
2575
- _this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value);
2576
- if (rules) {
2577
- if (Array.isArray(rules)) {
2578
- _this.rules = rules;
2579
- }
2580
- else {
2581
- _this.rules = [rules];
2582
- _this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors();
2583
- }
2584
- for (i = 0; i < _this.rules.length; i++) {
2585
- _this.rules[i].allowImports = true;
2586
- }
2587
- _this.setParent(_this.rules, _this);
2588
+ var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) {
2589
+ var i;
2590
+ this.name = name;
2591
+ this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value);
2592
+ if (rules) {
2593
+ if (Array.isArray(rules)) {
2594
+ this.rules = rules;
2588
2595
  }
2589
- _this._index = index;
2590
- _this._fileInfo = currentFileInfo;
2591
- _this.debugInfo = debugInfo;
2592
- _this.isRooted = isRooted || false;
2593
- _this.copyVisibilityInfo(visibilityInfo);
2594
- _this.allowRoot = true;
2595
- return _this;
2596
+ else {
2597
+ this.rules = [rules];
2598
+ this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors();
2599
+ }
2600
+ for (i = 0; i < this.rules.length; i++) {
2601
+ this.rules[i].allowImports = true;
2602
+ }
2603
+ this.setParent(this.rules, this);
2596
2604
  }
2597
- AtRule.prototype.accept = function (visitor) {
2605
+ this._index = index;
2606
+ this._fileInfo = currentFileInfo;
2607
+ this.debugInfo = debugInfo;
2608
+ this.isRooted = isRooted || false;
2609
+ this.copyVisibilityInfo(visibilityInfo);
2610
+ this.allowRoot = true;
2611
+ };
2612
+ AtRule.prototype = Object.assign(new Node(), {
2613
+ type: 'AtRule',
2614
+ accept: function (visitor) {
2598
2615
  var value = this.value, rules = this.rules;
2599
2616
  if (rules) {
2600
2617
  this.rules = visitor.visitArray(rules);
@@ -2602,14 +2619,14 @@
2602
2619
  if (value) {
2603
2620
  this.value = visitor.visit(value);
2604
2621
  }
2605
- };
2606
- AtRule.prototype.isRulesetLike = function () {
2622
+ },
2623
+ isRulesetLike: function () {
2607
2624
  return this.rules || !this.isCharset();
2608
- };
2609
- AtRule.prototype.isCharset = function () {
2625
+ },
2626
+ isCharset: function () {
2610
2627
  return '@charset' === this.name;
2611
- };
2612
- AtRule.prototype.genCSS = function (context, output) {
2628
+ },
2629
+ genCSS: function (context, output) {
2613
2630
  var value = this.value, rules = this.rules;
2614
2631
  output.add(this.name, this.fileInfo(), this.getIndex());
2615
2632
  if (value) {
@@ -2622,8 +2639,8 @@
2622
2639
  else {
2623
2640
  output.add(';');
2624
2641
  }
2625
- };
2626
- AtRule.prototype.eval = function (context) {
2642
+ },
2643
+ eval: function (context) {
2627
2644
  var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules;
2628
2645
  // media stored inside other atrule should not bubble over it
2629
2646
  // backpup media bubbling information
@@ -2644,26 +2661,26 @@
2644
2661
  context.mediaPath = mediaPathBackup;
2645
2662
  context.mediaBlocks = mediaBlocksBackup;
2646
2663
  return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());
2647
- };
2648
- AtRule.prototype.variable = function (name) {
2664
+ },
2665
+ variable: function (name) {
2649
2666
  if (this.rules) {
2650
2667
  // assuming that there is only one rule at this point - that is how parser constructs the rule
2651
2668
  return Ruleset.prototype.variable.call(this.rules[0], name);
2652
2669
  }
2653
- };
2654
- AtRule.prototype.find = function () {
2670
+ },
2671
+ find: function () {
2655
2672
  if (this.rules) {
2656
2673
  // assuming that there is only one rule at this point - that is how parser constructs the rule
2657
2674
  return Ruleset.prototype.find.apply(this.rules[0], arguments);
2658
2675
  }
2659
- };
2660
- AtRule.prototype.rulesets = function () {
2676
+ },
2677
+ rulesets: function () {
2661
2678
  if (this.rules) {
2662
2679
  // assuming that there is only one rule at this point - that is how parser constructs the rule
2663
2680
  return Ruleset.prototype.rulesets.apply(this.rules[0]);
2664
2681
  }
2665
- };
2666
- AtRule.prototype.outputRuleset = function (context, output, rules) {
2682
+ },
2683
+ outputRuleset: function (context, output, rules) {
2667
2684
  var ruleCnt = rules.length;
2668
2685
  var i;
2669
2686
  context.tabLevel = (context.tabLevel | 0) + 1;
@@ -2692,53 +2709,45 @@
2692
2709
  output.add(tabSetStr + "}");
2693
2710
  }
2694
2711
  context.tabLevel--;
2695
- };
2696
- return AtRule;
2697
- }(Node));
2698
- AtRule.prototype.type = 'AtRule';
2712
+ }
2713
+ });
2699
2714
 
2700
- var DetachedRuleset = /** @class */ (function (_super) {
2701
- __extends(DetachedRuleset, _super);
2702
- function DetachedRuleset(ruleset, frames) {
2703
- var _this = _super.call(this) || this;
2704
- _this.ruleset = ruleset;
2705
- _this.frames = frames;
2706
- _this.setParent(_this.ruleset, _this);
2707
- return _this;
2708
- }
2709
- DetachedRuleset.prototype.accept = function (visitor) {
2715
+ var DetachedRuleset = function (ruleset, frames) {
2716
+ this.ruleset = ruleset;
2717
+ this.frames = frames;
2718
+ this.setParent(this.ruleset, this);
2719
+ };
2720
+ DetachedRuleset.prototype = Object.assign(new Node(), {
2721
+ type: 'DetachedRuleset',
2722
+ evalFirst: true,
2723
+ accept: function (visitor) {
2710
2724
  this.ruleset = visitor.visit(this.ruleset);
2711
- };
2712
- DetachedRuleset.prototype.eval = function (context) {
2725
+ },
2726
+ eval: function (context) {
2713
2727
  var frames = this.frames || copyArray(context.frames);
2714
2728
  return new DetachedRuleset(this.ruleset, frames);
2715
- };
2716
- DetachedRuleset.prototype.callEval = function (context) {
2729
+ },
2730
+ callEval: function (context) {
2717
2731
  return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context);
2718
- };
2719
- return DetachedRuleset;
2720
- }(Node));
2721
- DetachedRuleset.prototype.type = 'DetachedRuleset';
2722
- DetachedRuleset.prototype.evalFirst = true;
2732
+ }
2733
+ });
2723
2734
 
2724
- var Unit = /** @class */ (function (_super) {
2725
- __extends(Unit, _super);
2726
- function Unit(numerator, denominator, backupUnit) {
2727
- var _this = _super.call(this) || this;
2728
- _this.numerator = numerator ? copyArray(numerator).sort() : [];
2729
- _this.denominator = denominator ? copyArray(denominator).sort() : [];
2730
- if (backupUnit) {
2731
- _this.backupUnit = backupUnit;
2732
- }
2733
- else if (numerator && numerator.length) {
2734
- _this.backupUnit = numerator[0];
2735
- }
2736
- return _this;
2735
+ var Unit = function (numerator, denominator, backupUnit) {
2736
+ this.numerator = numerator ? copyArray(numerator).sort() : [];
2737
+ this.denominator = denominator ? copyArray(denominator).sort() : [];
2738
+ if (backupUnit) {
2739
+ this.backupUnit = backupUnit;
2737
2740
  }
2738
- Unit.prototype.clone = function () {
2741
+ else if (numerator && numerator.length) {
2742
+ this.backupUnit = numerator[0];
2743
+ }
2744
+ };
2745
+ Unit.prototype = Object.assign(new Node(), {
2746
+ type: 'Unit',
2747
+ clone: function () {
2739
2748
  return new Unit(copyArray(this.numerator), copyArray(this.denominator), this.backupUnit);
2740
- };
2741
- Unit.prototype.genCSS = function (context, output) {
2749
+ },
2750
+ genCSS: function (context, output) {
2742
2751
  // Dimension checks the unit is singular and throws an error if in strict math mode.
2743
2752
  var strictUnits = context && context.strictUnits;
2744
2753
  if (this.numerator.length === 1) {
@@ -2750,30 +2759,30 @@
2750
2759
  else if (!strictUnits && this.denominator.length) {
2751
2760
  output.add(this.denominator[0]);
2752
2761
  }
2753
- };
2754
- Unit.prototype.toString = function () {
2762
+ },
2763
+ toString: function () {
2755
2764
  var i, returnStr = this.numerator.join('*');
2756
2765
  for (i = 0; i < this.denominator.length; i++) {
2757
2766
  returnStr += "/" + this.denominator[i];
2758
2767
  }
2759
2768
  return returnStr;
2760
- };
2761
- Unit.prototype.compare = function (other) {
2769
+ },
2770
+ compare: function (other) {
2762
2771
  return this.is(other.toString()) ? 0 : undefined;
2763
- };
2764
- Unit.prototype.is = function (unitString) {
2772
+ },
2773
+ is: function (unitString) {
2765
2774
  return this.toString().toUpperCase() === unitString.toUpperCase();
2766
- };
2767
- Unit.prototype.isLength = function () {
2775
+ },
2776
+ isLength: function () {
2768
2777
  return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS());
2769
- };
2770
- Unit.prototype.isEmpty = function () {
2778
+ },
2779
+ isEmpty: function () {
2771
2780
  return this.numerator.length === 0 && this.denominator.length === 0;
2772
- };
2773
- Unit.prototype.isSingular = function () {
2781
+ },
2782
+ isSingular: function () {
2774
2783
  return this.numerator.length <= 1 && this.denominator.length === 0;
2775
- };
2776
- Unit.prototype.map = function (callback) {
2784
+ },
2785
+ map: function (callback) {
2777
2786
  var i;
2778
2787
  for (i = 0; i < this.numerator.length; i++) {
2779
2788
  this.numerator[i] = callback(this.numerator[i], false);
@@ -2781,8 +2790,8 @@
2781
2790
  for (i = 0; i < this.denominator.length; i++) {
2782
2791
  this.denominator[i] = callback(this.denominator[i], true);
2783
2792
  }
2784
- };
2785
- Unit.prototype.usedUnits = function () {
2793
+ },
2794
+ usedUnits: function () {
2786
2795
  var group;
2787
2796
  var result = {};
2788
2797
  var mapUnit;
@@ -2801,8 +2810,8 @@
2801
2810
  }
2802
2811
  }
2803
2812
  return result;
2804
- };
2805
- Unit.prototype.cancel = function () {
2813
+ },
2814
+ cancel: function () {
2806
2815
  var counter = {};
2807
2816
  var atomicUnit;
2808
2817
  var i;
@@ -2833,37 +2842,33 @@
2833
2842
  }
2834
2843
  this.numerator.sort();
2835
2844
  this.denominator.sort();
2836
- };
2837
- return Unit;
2838
- }(Node));
2839
- Unit.prototype.type = 'Unit';
2845
+ }
2846
+ });
2840
2847
 
2841
2848
  //
2842
2849
  // A number with a unit
2843
2850
  //
2844
- var Dimension = /** @class */ (function (_super) {
2845
- __extends(Dimension, _super);
2846
- function Dimension(value, unit) {
2847
- var _this = _super.call(this) || this;
2848
- _this.value = parseFloat(value);
2849
- if (isNaN(_this.value)) {
2850
- throw new Error('Dimension is not a number.');
2851
- }
2852
- _this.unit = (unit && unit instanceof Unit) ? unit :
2853
- new Unit(unit ? [unit] : undefined);
2854
- _this.setParent(_this.unit, _this);
2855
- return _this;
2856
- }
2857
- Dimension.prototype.accept = function (visitor) {
2851
+ var Dimension = function (value, unit) {
2852
+ this.value = parseFloat(value);
2853
+ if (isNaN(this.value)) {
2854
+ throw new Error('Dimension is not a number.');
2855
+ }
2856
+ this.unit = (unit && unit instanceof Unit) ? unit :
2857
+ new Unit(unit ? [unit] : undefined);
2858
+ this.setParent(this.unit, this);
2859
+ };
2860
+ Dimension.prototype = Object.assign(new Node(), {
2861
+ type: 'Dimension',
2862
+ accept: function (visitor) {
2858
2863
  this.unit = visitor.visit(this.unit);
2859
- };
2860
- Dimension.prototype.eval = function (context) {
2864
+ },
2865
+ eval: function (context) {
2861
2866
  return this;
2862
- };
2863
- Dimension.prototype.toColor = function () {
2867
+ },
2868
+ toColor: function () {
2864
2869
  return new Color([this.value, this.value, this.value]);
2865
- };
2866
- Dimension.prototype.genCSS = function (context, output) {
2870
+ },
2871
+ genCSS: function (context, output) {
2867
2872
  if ((context && context.strictUnits) && !this.unit.isSingular()) {
2868
2873
  throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: " + this.unit.toString());
2869
2874
  }
@@ -2886,13 +2891,14 @@
2886
2891
  }
2887
2892
  output.add(strValue);
2888
2893
  this.unit.genCSS(context, output);
2889
- };
2894
+ },
2890
2895
  // In an operation between two Dimensions,
2891
2896
  // we default to the first Dimension's unit,
2892
2897
  // so `1px + 2` will yield `3px`.
2893
- Dimension.prototype.operate = function (context, op, other) {
2898
+ operate: function (context, op, other) {
2894
2899
  /* jshint noempty:false */
2895
- var value = this._operate(context, op, this.value, other.value), unit = this.unit.clone();
2900
+ var value = this._operate(context, op, this.value, other.value);
2901
+ var unit = this.unit.clone();
2896
2902
  if (op === '+' || op === '-') {
2897
2903
  if (unit.numerator.length === 0 && unit.denominator.length === 0) {
2898
2904
  unit = other.unit.clone();
@@ -2904,7 +2910,8 @@
2904
2910
  else {
2905
2911
  other = other.convertTo(this.unit.usedUnits());
2906
2912
  if (context.strictUnits && other.unit.toString() !== unit.toString()) {
2907
- throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '" + unit.toString() + "' and '" + other.unit.toString() + "'.");
2913
+ throw new Error("Incompatible units. Change the units or use the unit function. "
2914
+ + ("Bad units: '" + unit.toString() + "' and '" + other.unit.toString() + "'."));
2908
2915
  }
2909
2916
  value = this._operate(context, op, this.value, other.value);
2910
2917
  }
@@ -2920,8 +2927,8 @@
2920
2927
  unit.cancel();
2921
2928
  }
2922
2929
  return new Dimension(value, unit);
2923
- };
2924
- Dimension.prototype.compare = function (other) {
2930
+ },
2931
+ compare: function (other) {
2925
2932
  var a, b;
2926
2933
  if (!(other instanceof Dimension)) {
2927
2934
  return undefined;
@@ -2938,11 +2945,11 @@
2938
2945
  }
2939
2946
  }
2940
2947
  return Node.numericCompare(a.value, b.value);
2941
- };
2942
- Dimension.prototype.unify = function () {
2948
+ },
2949
+ unify: function () {
2943
2950
  return this.convertTo({ length: 'px', duration: 's', angle: 'rad' });
2944
- };
2945
- Dimension.prototype.convertTo = function (conversions) {
2951
+ },
2952
+ convertTo: function (conversions) {
2946
2953
  var value = this.value;
2947
2954
  var unit = this.unit.clone();
2948
2955
  var i;
@@ -2982,25 +2989,21 @@
2982
2989
  }
2983
2990
  unit.cancel();
2984
2991
  return new Dimension(value, unit);
2985
- };
2986
- return Dimension;
2987
- }(Node));
2988
- Dimension.prototype.type = 'Dimension';
2992
+ }
2993
+ });
2989
2994
 
2990
- var MATH$1 = Math$1;
2991
- var Operation = /** @class */ (function (_super) {
2992
- __extends(Operation, _super);
2993
- function Operation(op, operands, isSpaced) {
2994
- var _this = _super.call(this) || this;
2995
- _this.op = op.trim();
2996
- _this.operands = operands;
2997
- _this.isSpaced = isSpaced;
2998
- return _this;
2999
- }
3000
- Operation.prototype.accept = function (visitor) {
2995
+ var MATH = Math$1;
2996
+ var Operation = function (op, operands, isSpaced) {
2997
+ this.op = op.trim();
2998
+ this.operands = operands;
2999
+ this.isSpaced = isSpaced;
3000
+ };
3001
+ Operation.prototype = Object.assign(new Node(), {
3002
+ type: 'Operation',
3003
+ accept: function (visitor) {
3001
3004
  this.operands = visitor.visitArray(this.operands);
3002
- };
3003
- Operation.prototype.eval = function (context) {
3005
+ },
3006
+ eval: function (context) {
3004
3007
  var a = this.operands[0].eval(context), b = this.operands[1].eval(context), op;
3005
3008
  if (context.isMathOn(this.op)) {
3006
3009
  op = this.op === './' ? '/' : this.op;
@@ -3010,8 +3013,9 @@
3010
3013
  if (b instanceof Dimension && a instanceof Color) {
3011
3014
  b = b.toColor();
3012
3015
  }
3013
- if (!a.operate) {
3014
- if (a instanceof Operation && a.op === '/' && context.math === MATH$1.PARENS_DIVISION) {
3016
+ if (!a.operate || !b.operate) {
3017
+ if ((a instanceof Operation || b instanceof Operation)
3018
+ && a.op === '/' && context.math === MATH.PARENS_DIVISION) {
3015
3019
  return new Operation(this.op, [a, b], this.isSpaced);
3016
3020
  }
3017
3021
  throw { type: 'Operation',
@@ -3022,8 +3026,8 @@
3022
3026
  else {
3023
3027
  return new Operation(this.op, [a, b], this.isSpaced);
3024
3028
  }
3025
- };
3026
- Operation.prototype.genCSS = function (context, output) {
3029
+ },
3030
+ genCSS: function (context, output) {
3027
3031
  this.operands[0].genCSS(context, output);
3028
3032
  if (this.isSpaced) {
3029
3033
  output.add(' ');
@@ -3033,26 +3037,47 @@
3033
3037
  output.add(' ');
3034
3038
  }
3035
3039
  this.operands[1].genCSS(context, output);
3036
- };
3037
- return Operation;
3038
- }(Node));
3039
- Operation.prototype.type = 'Operation';
3040
+ }
3041
+ });
3042
+
3043
+ /*! *****************************************************************************
3044
+ Copyright (c) Microsoft Corporation.
3045
+
3046
+ Permission to use, copy, modify, and/or distribute this software for any
3047
+ purpose with or without fee is hereby granted.
3048
+
3049
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3050
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3051
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3052
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3053
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3054
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3055
+ PERFORMANCE OF THIS SOFTWARE.
3056
+ ***************************************************************************** */
3057
+
3058
+ function __spreadArray(to, from, pack) {
3059
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3060
+ if (ar || !(i in from)) {
3061
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
3062
+ ar[i] = from[i];
3063
+ }
3064
+ }
3065
+ return to.concat(ar || from);
3066
+ }
3040
3067
 
3041
- var Expression = /** @class */ (function (_super) {
3042
- __extends(Expression, _super);
3043
- function Expression(value, noSpacing) {
3044
- var _this = _super.call(this) || this;
3045
- _this.value = value;
3046
- _this.noSpacing = noSpacing;
3047
- if (!value) {
3048
- throw new Error('Expression requires an array parameter');
3049
- }
3050
- return _this;
3051
- }
3052
- Expression.prototype.accept = function (visitor) {
3068
+ var Expression = function (value, noSpacing) {
3069
+ this.value = value;
3070
+ this.noSpacing = noSpacing;
3071
+ if (!value) {
3072
+ throw new Error('Expression requires an array parameter');
3073
+ }
3074
+ };
3075
+ Expression.prototype = Object.assign(new Node(), {
3076
+ type: 'Expression',
3077
+ accept: function (visitor) {
3053
3078
  this.value = visitor.visitArray(this.value);
3054
- };
3055
- Expression.prototype.eval = function (context) {
3079
+ },
3080
+ eval: function (context) {
3056
3081
  var returnValue;
3057
3082
  var mathOn = context.isMathOn();
3058
3083
  var inParenthesis = this.parens;
@@ -3085,23 +3110,21 @@
3085
3110
  returnValue = new Paren(returnValue);
3086
3111
  }
3087
3112
  return returnValue;
3088
- };
3089
- Expression.prototype.genCSS = function (context, output) {
3113
+ },
3114
+ genCSS: function (context, output) {
3090
3115
  for (var i = 0; i < this.value.length; i++) {
3091
3116
  this.value[i].genCSS(context, output);
3092
3117
  if (!this.noSpacing && i + 1 < this.value.length) {
3093
3118
  output.add(' ');
3094
3119
  }
3095
3120
  }
3096
- };
3097
- Expression.prototype.throwAwayComments = function () {
3121
+ },
3122
+ throwAwayComments: function () {
3098
3123
  this.value = this.value.filter(function (v) {
3099
3124
  return !(v instanceof Comment);
3100
3125
  });
3101
- };
3102
- return Expression;
3103
- }(Node));
3104
- Expression.prototype.type = 'Expression';
3126
+ }
3127
+ });
3105
3128
 
3106
3129
  var functionCaller = /** @class */ (function () {
3107
3130
  function functionCaller(name, context, index, currentFileInfo) {
@@ -3132,6 +3155,10 @@
3132
3155
  if (item.type === 'Expression') {
3133
3156
  var subNodes = item.value.filter(commentFilter);
3134
3157
  if (subNodes.length === 1) {
3158
+ // https://github.com/less/less.js/issues/3616
3159
+ if (item.parens && subNodes[0].op === '/') {
3160
+ return item;
3161
+ }
3135
3162
  return subNodes[0];
3136
3163
  }
3137
3164
  else {
@@ -3141,7 +3168,7 @@
3141
3168
  return item;
3142
3169
  });
3143
3170
  if (evalArgs === false) {
3144
- return this.func.apply(this, __spreadArrays([this.context], args));
3171
+ return this.func.apply(this, __spreadArray([this.context], args));
3145
3172
  }
3146
3173
  return this.func.apply(this, args);
3147
3174
  };
@@ -3151,22 +3178,20 @@
3151
3178
  //
3152
3179
  // A function call node.
3153
3180
  //
3154
- var Call = /** @class */ (function (_super) {
3155
- __extends(Call, _super);
3156
- function Call(name, args, index, currentFileInfo) {
3157
- var _this = _super.call(this) || this;
3158
- _this.name = name;
3159
- _this.args = args;
3160
- _this.calc = name === 'calc';
3161
- _this._index = index;
3162
- _this._fileInfo = currentFileInfo;
3163
- return _this;
3164
- }
3165
- Call.prototype.accept = function (visitor) {
3181
+ var Call = function (name, args, index, currentFileInfo) {
3182
+ this.name = name;
3183
+ this.args = args;
3184
+ this.calc = name === 'calc';
3185
+ this._index = index;
3186
+ this._fileInfo = currentFileInfo;
3187
+ };
3188
+ Call.prototype = Object.assign(new Node(), {
3189
+ type: 'Call',
3190
+ accept: function (visitor) {
3166
3191
  if (this.args) {
3167
3192
  this.args = visitor.visitArray(this.args);
3168
3193
  }
3169
- };
3194
+ },
3170
3195
  //
3171
3196
  // When evaluating a function call,
3172
3197
  // we either find the function in the functionRegistry,
@@ -3178,7 +3203,7 @@
3178
3203
  // we try to pass a variable to a function, like: `saturate(@color)`.
3179
3204
  // The function should receive the value, not the variable.
3180
3205
  //
3181
- Call.prototype.eval = function (context) {
3206
+ eval: function (context) {
3182
3207
  var _this = this;
3183
3208
  /**
3184
3209
  * Turn off math for calc(), and switch back on for evaluating nested functions
@@ -3233,8 +3258,8 @@
3233
3258
  var args = this.args.map(function (a) { return a.eval(context); });
3234
3259
  exitCalc();
3235
3260
  return new Call(this.name, args, this.getIndex(), this.fileInfo());
3236
- };
3237
- Call.prototype.genCSS = function (context, output) {
3261
+ },
3262
+ genCSS: function (context, output) {
3238
3263
  output.add(this.name + "(", this.fileInfo(), this.getIndex());
3239
3264
  for (var i = 0; i < this.args.length; i++) {
3240
3265
  this.args[i].genCSS(context, output);
@@ -3243,27 +3268,25 @@
3243
3268
  }
3244
3269
  }
3245
3270
  output.add(')');
3246
- };
3247
- return Call;
3248
- }(Node));
3249
- Call.prototype.type = 'Call';
3271
+ }
3272
+ });
3250
3273
 
3251
- var Variable = /** @class */ (function (_super) {
3252
- __extends(Variable, _super);
3253
- function Variable(name, index, currentFileInfo) {
3254
- var _this = _super.call(this) || this;
3255
- _this.name = name;
3256
- _this._index = index;
3257
- _this._fileInfo = currentFileInfo;
3258
- return _this;
3259
- }
3260
- Variable.prototype.eval = function (context) {
3274
+ var Variable = function (name, index, currentFileInfo) {
3275
+ this.name = name;
3276
+ this._index = index;
3277
+ this._fileInfo = currentFileInfo;
3278
+ };
3279
+ Variable.prototype = Object.assign(new Node(), {
3280
+ type: 'Variable',
3281
+ eval: function (context) {
3261
3282
  var variable, name = this.name;
3262
3283
  if (name.indexOf('@@') === 0) {
3263
3284
  name = "@" + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value;
3264
3285
  }
3265
3286
  if (this.evaluating) {
3266
- throw { type: 'Name', message: "Recursive variable definition for " + name, filename: this.fileInfo().filename,
3287
+ throw { type: 'Name',
3288
+ message: "Recursive variable definition for " + name,
3289
+ filename: this.fileInfo().filename,
3267
3290
  index: this.getIndex() };
3268
3291
  }
3269
3292
  this.evaluating = true;
@@ -3288,11 +3311,13 @@
3288
3311
  return variable;
3289
3312
  }
3290
3313
  else {
3291
- throw { type: 'Name', message: "variable " + name + " is undefined", filename: this.fileInfo().filename,
3314
+ throw { type: 'Name',
3315
+ message: "variable " + name + " is undefined",
3316
+ filename: this.fileInfo().filename,
3292
3317
  index: this.getIndex() };
3293
3318
  }
3294
- };
3295
- Variable.prototype.find = function (obj, fun) {
3319
+ },
3320
+ find: function (obj, fun) {
3296
3321
  for (var i = 0, r = void 0; i < obj.length; i++) {
3297
3322
  r = fun.call(obj, obj[i]);
3298
3323
  if (r) {
@@ -3300,27 +3325,25 @@
3300
3325
  }
3301
3326
  }
3302
3327
  return null;
3303
- };
3304
- return Variable;
3305
- }(Node));
3306
- Variable.prototype.type = 'Variable';
3328
+ }
3329
+ });
3307
3330
 
3308
- var Property = /** @class */ (function (_super) {
3309
- __extends(Property, _super);
3310
- function Property(name, index, currentFileInfo) {
3311
- var _this = _super.call(this) || this;
3312
- _this.name = name;
3313
- _this._index = index;
3314
- _this._fileInfo = currentFileInfo;
3315
- return _this;
3316
- }
3317
- Property.prototype.eval = function (context) {
3331
+ var Property = function (name, index, currentFileInfo) {
3332
+ this.name = name;
3333
+ this._index = index;
3334
+ this._fileInfo = currentFileInfo;
3335
+ };
3336
+ Property.prototype = Object.assign(new Node(), {
3337
+ type: 'Property',
3338
+ eval: function (context) {
3318
3339
  var property;
3319
3340
  var name = this.name;
3320
3341
  // TODO: shorten this reference
3321
3342
  var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;
3322
3343
  if (this.evaluating) {
3323
- throw { type: 'Name', message: "Recursive property reference for " + name, filename: this.fileInfo().filename,
3344
+ throw { type: 'Name',
3345
+ message: "Recursive property reference for " + name,
3346
+ filename: this.fileInfo().filename,
3324
3347
  index: this.getIndex() };
3325
3348
  }
3326
3349
  this.evaluating = true;
@@ -3347,11 +3370,13 @@
3347
3370
  return property;
3348
3371
  }
3349
3372
  else {
3350
- throw { type: 'Name', message: "Property '" + name + "' is undefined", filename: this.currentFileInfo.filename,
3373
+ throw { type: 'Name',
3374
+ message: "Property '" + name + "' is undefined",
3375
+ filename: this.currentFileInfo.filename,
3351
3376
  index: this.index };
3352
3377
  }
3353
- };
3354
- Property.prototype.find = function (obj, fun) {
3378
+ },
3379
+ find: function (obj, fun) {
3355
3380
  for (var i = 0, r = void 0; i < obj.length; i++) {
3356
3381
  r = fun.call(obj, obj[i]);
3357
3382
  if (r) {
@@ -3359,53 +3384,45 @@
3359
3384
  }
3360
3385
  }
3361
3386
  return null;
3362
- };
3363
- return Property;
3364
- }(Node));
3365
- Property.prototype.type = 'Property';
3387
+ }
3388
+ });
3366
3389
 
3367
- var Attribute = /** @class */ (function (_super) {
3368
- __extends(Attribute, _super);
3369
- function Attribute(key, op, value) {
3370
- var _this = _super.call(this) || this;
3371
- _this.key = key;
3372
- _this.op = op;
3373
- _this.value = value;
3374
- return _this;
3375
- }
3376
- Attribute.prototype.eval = function (context) {
3390
+ var Attribute = function (key, op, value) {
3391
+ this.key = key;
3392
+ this.op = op;
3393
+ this.value = value;
3394
+ };
3395
+ Attribute.prototype = Object.assign(new Node(), {
3396
+ type: 'Attribute',
3397
+ eval: function (context) {
3377
3398
  return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value);
3378
- };
3379
- Attribute.prototype.genCSS = function (context, output) {
3399
+ },
3400
+ genCSS: function (context, output) {
3380
3401
  output.add(this.toCSS(context));
3381
- };
3382
- Attribute.prototype.toCSS = function (context) {
3402
+ },
3403
+ toCSS: function (context) {
3383
3404
  var value = this.key.toCSS ? this.key.toCSS(context) : this.key;
3384
3405
  if (this.op) {
3385
3406
  value += this.op;
3386
3407
  value += (this.value.toCSS ? this.value.toCSS(context) : this.value);
3387
3408
  }
3388
3409
  return "[" + value + "]";
3389
- };
3390
- return Attribute;
3391
- }(Node));
3392
- Attribute.prototype.type = 'Attribute';
3410
+ }
3411
+ });
3393
3412
 
3394
- var Quoted = /** @class */ (function (_super) {
3395
- __extends(Quoted, _super);
3396
- function Quoted(str, content, escaped, index, currentFileInfo) {
3397
- var _this = _super.call(this) || this;
3398
- _this.escaped = (escaped == null) ? true : escaped;
3399
- _this.value = content || '';
3400
- _this.quote = str.charAt(0);
3401
- _this._index = index;
3402
- _this._fileInfo = currentFileInfo;
3403
- _this.variableRegex = /@\{([\w-]+)\}/g;
3404
- _this.propRegex = /\$\{([\w-]+)\}/g;
3405
- _this.allowRoot = escaped;
3406
- return _this;
3407
- }
3408
- Quoted.prototype.genCSS = function (context, output) {
3413
+ var Quoted = function (str, content, escaped, index, currentFileInfo) {
3414
+ this.escaped = (escaped == null) ? true : escaped;
3415
+ this.value = content || '';
3416
+ this.quote = str.charAt(0);
3417
+ this._index = index;
3418
+ this._fileInfo = currentFileInfo;
3419
+ this.variableRegex = /@\{([\w-]+)\}/g;
3420
+ this.propRegex = /\$\{([\w-]+)\}/g;
3421
+ this.allowRoot = escaped;
3422
+ };
3423
+ Quoted.prototype = Object.assign(new Node(), {
3424
+ type: 'Quoted',
3425
+ genCSS: function (context, output) {
3409
3426
  if (!this.escaped) {
3410
3427
  output.add(this.quote, this.fileInfo(), this.getIndex());
3411
3428
  }
@@ -3413,11 +3430,11 @@
3413
3430
  if (!this.escaped) {
3414
3431
  output.add(this.quote);
3415
3432
  }
3416
- };
3417
- Quoted.prototype.containsVariables = function () {
3433
+ },
3434
+ containsVariables: function () {
3418
3435
  return this.value.match(this.variableRegex);
3419
- };
3420
- Quoted.prototype.eval = function (context) {
3436
+ },
3437
+ eval: function (context) {
3421
3438
  var that = this;
3422
3439
  var value = this.value;
3423
3440
  var variableReplacement = function (_, name) {
@@ -3439,8 +3456,8 @@
3439
3456
  value = iterativeReplace(value, this.variableRegex, variableReplacement);
3440
3457
  value = iterativeReplace(value, this.propRegex, propertyReplacement);
3441
3458
  return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());
3442
- };
3443
- Quoted.prototype.compare = function (other) {
3459
+ },
3460
+ compare: function (other) {
3444
3461
  // when comparing quoted strings allow the quote to differ
3445
3462
  if (other.type === 'Quoted' && !this.escaped && !other.escaped) {
3446
3463
  return Node.numericCompare(this.value, other.value);
@@ -3448,30 +3465,29 @@
3448
3465
  else {
3449
3466
  return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;
3450
3467
  }
3451
- };
3452
- return Quoted;
3453
- }(Node));
3454
- Quoted.prototype.type = 'Quoted';
3468
+ }
3469
+ });
3455
3470
 
3456
- var URL = /** @class */ (function (_super) {
3457
- __extends(URL, _super);
3458
- function URL(val, index, currentFileInfo, isEvald) {
3459
- var _this = _super.call(this) || this;
3460
- _this.value = val;
3461
- _this._index = index;
3462
- _this._fileInfo = currentFileInfo;
3463
- _this.isEvald = isEvald;
3464
- return _this;
3465
- }
3466
- URL.prototype.accept = function (visitor) {
3471
+ function escapePath(path) {
3472
+ return path.replace(/[\(\)'"\s]/g, function (match) { return "\\" + match; });
3473
+ }
3474
+ var URL = function (val, index, currentFileInfo, isEvald) {
3475
+ this.value = val;
3476
+ this._index = index;
3477
+ this._fileInfo = currentFileInfo;
3478
+ this.isEvald = isEvald;
3479
+ };
3480
+ URL.prototype = Object.assign(new Node(), {
3481
+ type: 'Url',
3482
+ accept: function (visitor) {
3467
3483
  this.value = visitor.visit(this.value);
3468
- };
3469
- URL.prototype.genCSS = function (context, output) {
3484
+ },
3485
+ genCSS: function (context, output) {
3470
3486
  output.add('url(');
3471
3487
  this.value.genCSS(context, output);
3472
3488
  output.add(')');
3473
- };
3474
- URL.prototype.eval = function (context) {
3489
+ },
3490
+ eval: function (context) {
3475
3491
  var val = this.value.eval(context);
3476
3492
  var rootpath;
3477
3493
  if (!this.isEvald) {
@@ -3503,48 +3519,41 @@
3503
3519
  }
3504
3520
  }
3505
3521
  return new URL(val, this.getIndex(), this.fileInfo(), true);
3506
- };
3507
- return URL;
3508
- }(Node));
3509
- URL.prototype.type = 'Url';
3510
- function escapePath(path) {
3511
- return path.replace(/[\(\)'"\s]/g, function (match) { return "\\" + match; });
3512
- }
3522
+ }
3523
+ });
3513
3524
 
3514
- var Media = /** @class */ (function (_super) {
3515
- __extends(Media, _super);
3516
- function Media(value, features, index, currentFileInfo, visibilityInfo) {
3517
- var _this = _super.call(this) || this;
3518
- _this._index = index;
3519
- _this._fileInfo = currentFileInfo;
3520
- var selectors = (new Selector([], null, null, _this._index, _this._fileInfo)).createEmptySelectors();
3521
- _this.features = new Value(features);
3522
- _this.rules = [new Ruleset(selectors, value)];
3523
- _this.rules[0].allowImports = true;
3524
- _this.copyVisibilityInfo(visibilityInfo);
3525
- _this.allowRoot = true;
3526
- _this.setParent(selectors, _this);
3527
- _this.setParent(_this.features, _this);
3528
- _this.setParent(_this.rules, _this);
3529
- return _this;
3530
- }
3531
- Media.prototype.isRulesetLike = function () {
3525
+ var Media = function (value, features, index, currentFileInfo, visibilityInfo) {
3526
+ this._index = index;
3527
+ this._fileInfo = currentFileInfo;
3528
+ var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();
3529
+ this.features = new Value(features);
3530
+ this.rules = [new Ruleset(selectors, value)];
3531
+ this.rules[0].allowImports = true;
3532
+ this.copyVisibilityInfo(visibilityInfo);
3533
+ this.allowRoot = true;
3534
+ this.setParent(selectors, this);
3535
+ this.setParent(this.features, this);
3536
+ this.setParent(this.rules, this);
3537
+ };
3538
+ Media.prototype = Object.assign(new AtRule(), {
3539
+ type: 'Media',
3540
+ isRulesetLike: function () {
3532
3541
  return true;
3533
- };
3534
- Media.prototype.accept = function (visitor) {
3542
+ },
3543
+ accept: function (visitor) {
3535
3544
  if (this.features) {
3536
3545
  this.features = visitor.visit(this.features);
3537
3546
  }
3538
3547
  if (this.rules) {
3539
3548
  this.rules = visitor.visitArray(this.rules);
3540
3549
  }
3541
- };
3542
- Media.prototype.genCSS = function (context, output) {
3550
+ },
3551
+ genCSS: function (context, output) {
3543
3552
  output.add('@media ', this._fileInfo, this._index);
3544
3553
  this.features.genCSS(context, output);
3545
3554
  this.outputRuleset(context, output, this.rules);
3546
- };
3547
- Media.prototype.eval = function (context) {
3555
+ },
3556
+ eval: function (context) {
3548
3557
  if (!context.mediaBlocks) {
3549
3558
  context.mediaBlocks = [];
3550
3559
  context.mediaPath = [];
@@ -3564,8 +3573,8 @@
3564
3573
  context.mediaPath.pop();
3565
3574
  return context.mediaPath.length === 0 ? media.evalTop(context) :
3566
3575
  media.evalNested(context);
3567
- };
3568
- Media.prototype.evalTop = function (context) {
3576
+ },
3577
+ evalTop: function (context) {
3569
3578
  var result = this;
3570
3579
  // Render all dependent Media blocks.
3571
3580
  if (context.mediaBlocks.length > 1) {
@@ -3578,8 +3587,8 @@
3578
3587
  delete context.mediaBlocks;
3579
3588
  delete context.mediaPath;
3580
3589
  return result;
3581
- };
3582
- Media.prototype.evalNested = function (context) {
3590
+ },
3591
+ evalNested: function (context) {
3583
3592
  var i;
3584
3593
  var value;
3585
3594
  var path = context.mediaPath.concat([this]);
@@ -3606,8 +3615,8 @@
3606
3615
  this.setParent(this.features, this);
3607
3616
  // Fake a tree-node that doesn't output anything.
3608
3617
  return new Ruleset([], []);
3609
- };
3610
- Media.prototype.permute = function (arr) {
3618
+ },
3619
+ permute: function (arr) {
3611
3620
  if (arr.length === 0) {
3612
3621
  return [];
3613
3622
  }
@@ -3624,17 +3633,15 @@
3624
3633
  }
3625
3634
  return result;
3626
3635
  }
3627
- };
3628
- Media.prototype.bubbleSelectors = function (selectors) {
3636
+ },
3637
+ bubbleSelectors: function (selectors) {
3629
3638
  if (!selectors) {
3630
3639
  return;
3631
3640
  }
3632
3641
  this.rules = [new Ruleset(copyArray(selectors), [this.rules[0]])];
3633
3642
  this.setParent(this.rules, this);
3634
- };
3635
- return Media;
3636
- }(AtRule));
3637
- Media.prototype.type = 'Media';
3643
+ }
3644
+ });
3638
3645
 
3639
3646
  //
3640
3647
  // CSS @import node
@@ -3648,31 +3655,29 @@
3648
3655
  // `import,push`, we also pass it a callback, which it'll call once
3649
3656
  // the file has been fetched, and parsed.
3650
3657
  //
3651
- var Import = /** @class */ (function (_super) {
3652
- __extends(Import, _super);
3653
- function Import(path, features, options, index, currentFileInfo, visibilityInfo) {
3654
- var _this = _super.call(this) || this;
3655
- _this.options = options;
3656
- _this._index = index;
3657
- _this._fileInfo = currentFileInfo;
3658
- _this.path = path;
3659
- _this.features = features;
3660
- _this.allowRoot = true;
3661
- if (_this.options.less !== undefined || _this.options.inline) {
3662
- _this.css = !_this.options.less || _this.options.inline;
3663
- }
3664
- else {
3665
- var pathValue = _this.getPath();
3666
- if (pathValue && /[#\.\&\?]css([\?;].*)?$/.test(pathValue)) {
3667
- _this.css = true;
3668
- }
3658
+ var Import = function (path, features, options, index, currentFileInfo, visibilityInfo) {
3659
+ this.options = options;
3660
+ this._index = index;
3661
+ this._fileInfo = currentFileInfo;
3662
+ this.path = path;
3663
+ this.features = features;
3664
+ this.allowRoot = true;
3665
+ if (this.options.less !== undefined || this.options.inline) {
3666
+ this.css = !this.options.less || this.options.inline;
3667
+ }
3668
+ else {
3669
+ var pathValue = this.getPath();
3670
+ if (pathValue && /[#\.\&\?]css([\?;].*)?$/.test(pathValue)) {
3671
+ this.css = true;
3669
3672
  }
3670
- _this.copyVisibilityInfo(visibilityInfo);
3671
- _this.setParent(_this.features, _this);
3672
- _this.setParent(_this.path, _this);
3673
- return _this;
3674
3673
  }
3675
- Import.prototype.accept = function (visitor) {
3674
+ this.copyVisibilityInfo(visibilityInfo);
3675
+ this.setParent(this.features, this);
3676
+ this.setParent(this.path, this);
3677
+ };
3678
+ Import.prototype = Object.assign(new Node(), {
3679
+ type: 'Import',
3680
+ accept: function (visitor) {
3676
3681
  if (this.features) {
3677
3682
  this.features = visitor.visit(this.features);
3678
3683
  }
@@ -3680,8 +3685,8 @@
3680
3685
  if (!this.options.isPlugin && !this.options.inline && this.root) {
3681
3686
  this.root = visitor.visit(this.root);
3682
3687
  }
3683
- };
3684
- Import.prototype.genCSS = function (context, output) {
3688
+ },
3689
+ genCSS: function (context, output) {
3685
3690
  if (this.css && this.path._fileInfo.reference === undefined) {
3686
3691
  output.add('@import ', this._fileInfo, this._index);
3687
3692
  this.path.genCSS(context, output);
@@ -3691,12 +3696,12 @@
3691
3696
  }
3692
3697
  output.add(';');
3693
3698
  }
3694
- };
3695
- Import.prototype.getPath = function () {
3699
+ },
3700
+ getPath: function () {
3696
3701
  return (this.path instanceof URL) ?
3697
3702
  this.path.value.value : this.path.value;
3698
- };
3699
- Import.prototype.isVariableImport = function () {
3703
+ },
3704
+ isVariableImport: function () {
3700
3705
  var path = this.path;
3701
3706
  if (path instanceof URL) {
3702
3707
  path = path.value;
@@ -3705,15 +3710,15 @@
3705
3710
  return path.containsVariables();
3706
3711
  }
3707
3712
  return true;
3708
- };
3709
- Import.prototype.evalForImport = function (context) {
3713
+ },
3714
+ evalForImport: function (context) {
3710
3715
  var path = this.path;
3711
3716
  if (path instanceof URL) {
3712
3717
  path = path.value;
3713
3718
  }
3714
3719
  return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo());
3715
- };
3716
- Import.prototype.evalPath = function (context) {
3720
+ },
3721
+ evalPath: function (context) {
3717
3722
  var path = this.path.eval(context);
3718
3723
  var fileInfo = this._fileInfo;
3719
3724
  if (!(path instanceof URL)) {
@@ -3729,8 +3734,8 @@
3729
3734
  }
3730
3735
  }
3731
3736
  return path;
3732
- };
3733
- Import.prototype.eval = function (context) {
3737
+ },
3738
+ eval: function (context) {
3734
3739
  var result = this.doEval(context);
3735
3740
  if (this.options.reference || this.blocksVisibility()) {
3736
3741
  if (result.length || result.length === 0) {
@@ -3743,8 +3748,8 @@
3743
3748
  }
3744
3749
  }
3745
3750
  return result;
3746
- };
3747
- Import.prototype.doEval = function (context) {
3751
+ },
3752
+ doEval: function (context) {
3748
3753
  var ruleset;
3749
3754
  var registry;
3750
3755
  var features = this.features && this.features.eval(context);
@@ -3794,17 +3799,12 @@
3794
3799
  else {
3795
3800
  return [];
3796
3801
  }
3797
- };
3798
- return Import;
3799
- }(Node));
3800
- Import.prototype.type = 'Import';
3801
-
3802
- var JsEvalNode = /** @class */ (function (_super) {
3803
- __extends(JsEvalNode, _super);
3804
- function JsEvalNode() {
3805
- return _super !== null && _super.apply(this, arguments) || this;
3806
3802
  }
3807
- JsEvalNode.prototype.evaluateJavaScript = function (expression, context) {
3803
+ });
3804
+
3805
+ var JsEvalNode = function () { };
3806
+ JsEvalNode.prototype = Object.assign(new Node(), {
3807
+ evaluateJavaScript: function (expression, context) {
3808
3808
  var result;
3809
3809
  var that = this;
3810
3810
  var evalContext = {};
@@ -3820,7 +3820,8 @@
3820
3820
  expression = new Function("return (" + expression + ")");
3821
3821
  }
3822
3822
  catch (e) {
3823
- throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`", filename: this.fileInfo().filename,
3823
+ throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`",
3824
+ filename: this.fileInfo().filename,
3824
3825
  index: this.getIndex() };
3825
3826
  }
3826
3827
  var variables = context.frames[0].variables();
@@ -3839,33 +3840,31 @@
3839
3840
  result = expression.call(evalContext);
3840
3841
  }
3841
3842
  catch (e) {
3842
- throw { message: "JavaScript evaluation error: '" + e.name + ": " + e.message.replace(/["]/g, '\'') + "'", filename: this.fileInfo().filename,
3843
+ throw { message: "JavaScript evaluation error: '" + e.name + ": " + e.message.replace(/["]/g, '\'') + "'",
3844
+ filename: this.fileInfo().filename,
3843
3845
  index: this.getIndex() };
3844
3846
  }
3845
3847
  return result;
3846
- };
3847
- JsEvalNode.prototype.jsify = function (obj) {
3848
+ },
3849
+ jsify: function (obj) {
3848
3850
  if (Array.isArray(obj.value) && (obj.value.length > 1)) {
3849
3851
  return "[" + obj.value.map(function (v) { return v.toCSS(); }).join(', ') + "]";
3850
3852
  }
3851
3853
  else {
3852
3854
  return obj.toCSS();
3853
3855
  }
3854
- };
3855
- return JsEvalNode;
3856
- }(Node));
3856
+ }
3857
+ });
3857
3858
 
3858
- var JavaScript = /** @class */ (function (_super) {
3859
- __extends(JavaScript, _super);
3860
- function JavaScript(string, escaped, index, currentFileInfo) {
3861
- var _this = _super.call(this) || this;
3862
- _this.escaped = escaped;
3863
- _this.expression = string;
3864
- _this._index = index;
3865
- _this._fileInfo = currentFileInfo;
3866
- return _this;
3867
- }
3868
- JavaScript.prototype.eval = function (context) {
3859
+ var JavaScript = function (string, escaped, index, currentFileInfo) {
3860
+ this.escaped = escaped;
3861
+ this.expression = string;
3862
+ this._index = index;
3863
+ this._fileInfo = currentFileInfo;
3864
+ };
3865
+ JavaScript.prototype = Object.assign(new JsEvalNode(), {
3866
+ type: 'JavaScript',
3867
+ eval: function (context) {
3869
3868
  var result = this.evaluateJavaScript(this.expression, context);
3870
3869
  var type = typeof result;
3871
3870
  if (type === 'number' && !isNaN(result)) {
@@ -3880,29 +3879,25 @@
3880
3879
  else {
3881
3880
  return new Anonymous(result);
3882
3881
  }
3883
- };
3884
- return JavaScript;
3885
- }(JsEvalNode));
3886
- JavaScript.prototype.type = 'JavaScript';
3882
+ }
3883
+ });
3887
3884
 
3888
- var Assignment = /** @class */ (function (_super) {
3889
- __extends(Assignment, _super);
3890
- function Assignment(key, val) {
3891
- var _this = _super.call(this) || this;
3892
- _this.key = key;
3893
- _this.value = val;
3894
- return _this;
3895
- }
3896
- Assignment.prototype.accept = function (visitor) {
3885
+ var Assignment = function (key, val) {
3886
+ this.key = key;
3887
+ this.value = val;
3888
+ };
3889
+ Assignment.prototype = Object.assign(new Node(), {
3890
+ type: 'Assignment',
3891
+ accept: function (visitor) {
3897
3892
  this.value = visitor.visit(this.value);
3898
- };
3899
- Assignment.prototype.eval = function (context) {
3893
+ },
3894
+ eval: function (context) {
3900
3895
  if (this.value.eval) {
3901
3896
  return new Assignment(this.key, this.value.eval(context));
3902
3897
  }
3903
3898
  return this;
3904
- };
3905
- Assignment.prototype.genCSS = function (context, output) {
3899
+ },
3900
+ genCSS: function (context, output) {
3906
3901
  output.add(this.key + "=");
3907
3902
  if (this.value.genCSS) {
3908
3903
  this.value.genCSS(context, output);
@@ -3910,27 +3905,23 @@
3910
3905
  else {
3911
3906
  output.add(this.value);
3912
3907
  }
3913
- };
3914
- return Assignment;
3915
- }(Node));
3916
- Assignment.prototype.type = 'Assignment';
3908
+ }
3909
+ });
3917
3910
 
3918
- var Condition = /** @class */ (function (_super) {
3919
- __extends(Condition, _super);
3920
- function Condition(op, l, r, i, negate) {
3921
- var _this = _super.call(this) || this;
3922
- _this.op = op.trim();
3923
- _this.lvalue = l;
3924
- _this.rvalue = r;
3925
- _this._index = i;
3926
- _this.negate = negate;
3927
- return _this;
3928
- }
3929
- Condition.prototype.accept = function (visitor) {
3911
+ var Condition = function (op, l, r, i, negate) {
3912
+ this.op = op.trim();
3913
+ this.lvalue = l;
3914
+ this.rvalue = r;
3915
+ this._index = i;
3916
+ this.negate = negate;
3917
+ };
3918
+ Condition.prototype = Object.assign(new Node(), {
3919
+ type: 'Condition',
3920
+ accept: function (visitor) {
3930
3921
  this.lvalue = visitor.visit(this.lvalue);
3931
3922
  this.rvalue = visitor.visit(this.rvalue);
3932
- };
3933
- Condition.prototype.eval = function (context) {
3923
+ },
3924
+ eval: function (context) {
3934
3925
  var result = (function (op, a, b) {
3935
3926
  switch (op) {
3936
3927
  case 'and': return a && b;
@@ -3949,79 +3940,67 @@
3949
3940
  }
3950
3941
  })(this.op, this.lvalue.eval(context), this.rvalue.eval(context));
3951
3942
  return this.negate ? !result : result;
3952
- };
3953
- return Condition;
3954
- }(Node));
3955
- Condition.prototype.type = 'Condition';
3943
+ }
3944
+ });
3956
3945
 
3957
- var UnicodeDescriptor = /** @class */ (function (_super) {
3958
- __extends(UnicodeDescriptor, _super);
3959
- function UnicodeDescriptor(value) {
3960
- var _this = _super.call(this) || this;
3961
- _this.value = value;
3962
- return _this;
3963
- }
3964
- return UnicodeDescriptor;
3965
- }(Node));
3966
- UnicodeDescriptor.prototype.type = 'UnicodeDescriptor';
3946
+ var UnicodeDescriptor = function (value) {
3947
+ this.value = value;
3948
+ };
3949
+ UnicodeDescriptor.prototype = Object.assign(new Node(), {
3950
+ type: 'UnicodeDescriptor'
3951
+ });
3967
3952
 
3968
- var Negative = /** @class */ (function (_super) {
3969
- __extends(Negative, _super);
3970
- function Negative(node) {
3971
- var _this = _super.call(this) || this;
3972
- _this.value = node;
3973
- return _this;
3974
- }
3975
- Negative.prototype.genCSS = function (context, output) {
3953
+ var Negative = function (node) {
3954
+ this.value = node;
3955
+ };
3956
+ Negative.prototype = Object.assign(new Node(), {
3957
+ type: 'Negative',
3958
+ genCSS: function (context, output) {
3976
3959
  output.add('-');
3977
3960
  this.value.genCSS(context, output);
3978
- };
3979
- Negative.prototype.eval = function (context) {
3961
+ },
3962
+ eval: function (context) {
3980
3963
  if (context.isMathOn()) {
3981
3964
  return (new Operation('*', [new Dimension(-1), this.value])).eval(context);
3982
3965
  }
3983
3966
  return new Negative(this.value.eval(context));
3984
- };
3985
- return Negative;
3986
- }(Node));
3987
- Negative.prototype.type = 'Negative';
3988
-
3989
- var Extend = /** @class */ (function (_super) {
3990
- __extends(Extend, _super);
3991
- function Extend(selector, option, index, currentFileInfo, visibilityInfo) {
3992
- var _this = _super.call(this) || this;
3993
- _this.selector = selector;
3994
- _this.option = option;
3995
- _this.object_id = Extend.next_id++;
3996
- _this.parent_ids = [_this.object_id];
3997
- _this._index = index;
3998
- _this._fileInfo = currentFileInfo;
3999
- _this.copyVisibilityInfo(visibilityInfo);
4000
- _this.allowRoot = true;
4001
- switch (option) {
4002
- case 'all':
4003
- _this.allowBefore = true;
4004
- _this.allowAfter = true;
4005
- break;
4006
- default:
4007
- _this.allowBefore = false;
4008
- _this.allowAfter = false;
4009
- break;
4010
- }
4011
- _this.setParent(_this.selector, _this);
4012
- return _this;
4013
3967
  }
4014
- Extend.prototype.accept = function (visitor) {
3968
+ });
3969
+
3970
+ var Extend = function (selector, option, index, currentFileInfo, visibilityInfo) {
3971
+ this.selector = selector;
3972
+ this.option = option;
3973
+ this.object_id = Extend.next_id++;
3974
+ this.parent_ids = [this.object_id];
3975
+ this._index = index;
3976
+ this._fileInfo = currentFileInfo;
3977
+ this.copyVisibilityInfo(visibilityInfo);
3978
+ this.allowRoot = true;
3979
+ switch (option) {
3980
+ case 'all':
3981
+ this.allowBefore = true;
3982
+ this.allowAfter = true;
3983
+ break;
3984
+ default:
3985
+ this.allowBefore = false;
3986
+ this.allowAfter = false;
3987
+ break;
3988
+ }
3989
+ this.setParent(this.selector, this);
3990
+ };
3991
+ Extend.prototype = Object.assign(new Node(), {
3992
+ type: 'Extend',
3993
+ accept: function (visitor) {
4015
3994
  this.selector = visitor.visit(this.selector);
4016
- };
4017
- Extend.prototype.eval = function (context) {
3995
+ },
3996
+ eval: function (context) {
4018
3997
  return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
4019
- };
4020
- Extend.prototype.clone = function (context) {
3998
+ },
3999
+ clone: function (context) {
4021
4000
  return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());
4022
- };
4001
+ },
4023
4002
  // it concatenates (joins) all selectors in selector array
4024
- Extend.prototype.findSelfSelectors = function (selectors) {
4003
+ findSelfSelectors: function (selectors) {
4025
4004
  var selfElements = [], i, selectorElements;
4026
4005
  for (i = 0; i < selectors.length; i++) {
4027
4006
  selectorElements = selectors[i].elements;
@@ -4034,23 +4013,19 @@
4034
4013
  }
4035
4014
  this.selfSelectors = [new Selector(selfElements)];
4036
4015
  this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());
4037
- };
4038
- return Extend;
4039
- }(Node));
4040
- Extend.next_id = 0;
4041
- Extend.prototype.type = 'Extend';
4016
+ }
4017
+ });
4018
+ Extend.next_id = 0;
4042
4019
 
4043
- var VariableCall = /** @class */ (function (_super) {
4044
- __extends(VariableCall, _super);
4045
- function VariableCall(variable, index, currentFileInfo) {
4046
- var _this = _super.call(this) || this;
4047
- _this.variable = variable;
4048
- _this._index = index;
4049
- _this._fileInfo = currentFileInfo;
4050
- _this.allowRoot = true;
4051
- return _this;
4052
- }
4053
- VariableCall.prototype.eval = function (context) {
4020
+ var VariableCall = function (variable, index, currentFileInfo) {
4021
+ this.variable = variable;
4022
+ this._index = index;
4023
+ this._fileInfo = currentFileInfo;
4024
+ this.allowRoot = true;
4025
+ };
4026
+ VariableCall.prototype = Object.assign(new Node(), {
4027
+ type: 'VariableCall',
4028
+ eval: function (context) {
4054
4029
  var rules;
4055
4030
  var detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context);
4056
4031
  var error = new LessError({ message: "Could not evaluate variable call " + this.variable });
@@ -4073,22 +4048,18 @@
4073
4048
  return detachedRuleset.callEval(context);
4074
4049
  }
4075
4050
  throw error;
4076
- };
4077
- return VariableCall;
4078
- }(Node));
4079
- VariableCall.prototype.type = 'VariableCall';
4051
+ }
4052
+ });
4080
4053
 
4081
- var NamespaceValue = /** @class */ (function (_super) {
4082
- __extends(NamespaceValue, _super);
4083
- function NamespaceValue(ruleCall, lookups, index, fileInfo) {
4084
- var _this = _super.call(this) || this;
4085
- _this.value = ruleCall;
4086
- _this.lookups = lookups;
4087
- _this._index = index;
4088
- _this._fileInfo = fileInfo;
4089
- return _this;
4090
- }
4091
- NamespaceValue.prototype.eval = function (context) {
4054
+ var NamespaceValue = function (ruleCall, lookups, index, fileInfo) {
4055
+ this.value = ruleCall;
4056
+ this.lookups = lookups;
4057
+ this._index = index;
4058
+ this._fileInfo = fileInfo;
4059
+ };
4060
+ NamespaceValue.prototype = Object.assign(new Node(), {
4061
+ type: 'NamespaceValue',
4062
+ eval: function (context) {
4092
4063
  var i, name, rules = this.value.eval(context);
4093
4064
  for (i = 0; i < this.lookups.length; i++) {
4094
4065
  name = this.lookups[i];
@@ -4111,7 +4082,9 @@
4111
4082
  rules = rules.variable(name);
4112
4083
  }
4113
4084
  if (!rules) {
4114
- throw { type: 'Name', message: "variable " + name + " not found", filename: this.fileInfo().filename,
4085
+ throw { type: 'Name',
4086
+ message: "variable " + name + " not found",
4087
+ filename: this.fileInfo().filename,
4115
4088
  index: this.getIndex() };
4116
4089
  }
4117
4090
  }
@@ -4126,7 +4099,9 @@
4126
4099
  rules = rules.property(name);
4127
4100
  }
4128
4101
  if (!rules) {
4129
- throw { type: 'Name', message: "property \"" + name.substr(1) + "\" not found", filename: this.fileInfo().filename,
4102
+ throw { type: 'Name',
4103
+ message: "property \"" + name.substr(1) + "\" not found",
4104
+ filename: this.fileInfo().filename,
4130
4105
  index: this.getIndex() };
4131
4106
  }
4132
4107
  // Properties are an array of values, since a ruleset can have multiple props.
@@ -4141,40 +4116,37 @@
4141
4116
  }
4142
4117
  }
4143
4118
  return rules;
4144
- };
4145
- return NamespaceValue;
4146
- }(Node));
4147
- NamespaceValue.prototype.type = 'NamespaceValue';
4148
-
4149
- var Definition = /** @class */ (function (_super) {
4150
- __extends(Definition, _super);
4151
- function Definition(name, params, rules, condition, variadic, frames, visibilityInfo) {
4152
- var _this = _super.call(this) || this;
4153
- _this.name = name || 'anonymous mixin';
4154
- _this.selectors = [new Selector([new Element(null, name, false, _this._index, _this._fileInfo)])];
4155
- _this.params = params;
4156
- _this.condition = condition;
4157
- _this.variadic = variadic;
4158
- _this.arity = params.length;
4159
- _this.rules = rules;
4160
- _this._lookups = {};
4161
- var optionalParameters = [];
4162
- _this.required = params.reduce(function (count, p) {
4163
- if (!p.name || (p.name && !p.value)) {
4164
- return count + 1;
4165
- }
4166
- else {
4167
- optionalParameters.push(p.name);
4168
- return count;
4169
- }
4170
- }, 0);
4171
- _this.optionalParameters = optionalParameters;
4172
- _this.frames = frames;
4173
- _this.copyVisibilityInfo(visibilityInfo);
4174
- _this.allowRoot = true;
4175
- return _this;
4176
4119
  }
4177
- Definition.prototype.accept = function (visitor) {
4120
+ });
4121
+
4122
+ var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) {
4123
+ this.name = name || 'anonymous mixin';
4124
+ this.selectors = [new Selector([new Element(null, name, false, this._index, this._fileInfo)])];
4125
+ this.params = params;
4126
+ this.condition = condition;
4127
+ this.variadic = variadic;
4128
+ this.arity = params.length;
4129
+ this.rules = rules;
4130
+ this._lookups = {};
4131
+ var optionalParameters = [];
4132
+ this.required = params.reduce(function (count, p) {
4133
+ if (!p.name || (p.name && !p.value)) {
4134
+ return count + 1;
4135
+ }
4136
+ else {
4137
+ optionalParameters.push(p.name);
4138
+ return count;
4139
+ }
4140
+ }, 0);
4141
+ this.optionalParameters = optionalParameters;
4142
+ this.frames = frames;
4143
+ this.copyVisibilityInfo(visibilityInfo);
4144
+ this.allowRoot = true;
4145
+ };
4146
+ Definition.prototype = Object.assign(new Ruleset(), {
4147
+ type: 'MixinDefinition',
4148
+ evalFirst: true,
4149
+ accept: function (visitor) {
4178
4150
  if (this.params && this.params.length) {
4179
4151
  this.params = visitor.visitArray(this.params);
4180
4152
  }
@@ -4182,8 +4154,8 @@
4182
4154
  if (this.condition) {
4183
4155
  this.condition = visitor.visit(this.condition);
4184
4156
  }
4185
- };
4186
- Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArguments) {
4157
+ },
4158
+ evalParams: function (context, mixinEnv, args, evaldArguments) {
4187
4159
  /* jshint boss:true */
4188
4160
  var frame = new Ruleset(null, null);
4189
4161
  var varargs;
@@ -4270,8 +4242,8 @@
4270
4242
  argIndex++;
4271
4243
  }
4272
4244
  return frame;
4273
- };
4274
- Definition.prototype.makeImportant = function () {
4245
+ },
4246
+ makeImportant: function () {
4275
4247
  var rules = !this.rules ? this.rules : this.rules.map(function (r) {
4276
4248
  if (r.makeImportant) {
4277
4249
  return r.makeImportant(true);
@@ -4282,11 +4254,11 @@
4282
4254
  });
4283
4255
  var result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames);
4284
4256
  return result;
4285
- };
4286
- Definition.prototype.eval = function (context) {
4257
+ },
4258
+ eval: function (context) {
4287
4259
  return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || copyArray(context.frames));
4288
- };
4289
- Definition.prototype.evalCall = function (context, args, important) {
4260
+ },
4261
+ evalCall: function (context, args, important) {
4290
4262
  var _arguments = [];
4291
4263
  var mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames;
4292
4264
  var frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments);
@@ -4301,16 +4273,16 @@
4301
4273
  ruleset = ruleset.makeImportant();
4302
4274
  }
4303
4275
  return ruleset;
4304
- };
4305
- Definition.prototype.matchCondition = function (args, context) {
4276
+ },
4277
+ matchCondition: function (args, context) {
4306
4278
  if (this.condition && !this.condition.eval(new contexts.Eval(context, [this.evalParams(context, /* the parameter variables */ new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]
4307
4279
  .concat(this.frames || []) // the parent namespace/mixin frames
4308
4280
  .concat(context.frames)))) { // the current environment frames
4309
4281
  return false;
4310
4282
  }
4311
4283
  return true;
4312
- };
4313
- Definition.prototype.matchArgs = function (args, context) {
4284
+ },
4285
+ matchArgs: function (args, context) {
4314
4286
  var allArgsCnt = (args && args.length) || 0;
4315
4287
  var len;
4316
4288
  var optionalParameters = this.optionalParameters;
@@ -4345,34 +4317,29 @@
4345
4317
  }
4346
4318
  }
4347
4319
  return true;
4348
- };
4349
- return Definition;
4350
- }(Ruleset));
4351
- Definition.prototype.type = 'MixinDefinition';
4352
- Definition.prototype.evalFirst = true;
4320
+ }
4321
+ });
4353
4322
 
4354
- var MixinCall = /** @class */ (function (_super) {
4355
- __extends(MixinCall, _super);
4356
- function MixinCall(elements, args, index, currentFileInfo, important) {
4357
- var _this = _super.call(this) || this;
4358
- _this.selector = new Selector(elements);
4359
- _this.arguments = args || [];
4360
- _this._index = index;
4361
- _this._fileInfo = currentFileInfo;
4362
- _this.important = important;
4363
- _this.allowRoot = true;
4364
- _this.setParent(_this.selector, _this);
4365
- return _this;
4366
- }
4367
- MixinCall.prototype.accept = function (visitor) {
4323
+ var MixinCall = function (elements, args, index, currentFileInfo, important) {
4324
+ this.selector = new Selector(elements);
4325
+ this.arguments = args || [];
4326
+ this._index = index;
4327
+ this._fileInfo = currentFileInfo;
4328
+ this.important = important;
4329
+ this.allowRoot = true;
4330
+ this.setParent(this.selector, this);
4331
+ };
4332
+ MixinCall.prototype = Object.assign(new Node(), {
4333
+ type: 'MixinCall',
4334
+ accept: function (visitor) {
4368
4335
  if (this.selector) {
4369
4336
  this.selector = visitor.visit(this.selector);
4370
4337
  }
4371
4338
  if (this.arguments.length) {
4372
4339
  this.arguments = visitor.visitArray(this.arguments);
4373
4340
  }
4374
- };
4375
- MixinCall.prototype.eval = function (context) {
4341
+ },
4342
+ eval: function (context) {
4376
4343
  var mixins;
4377
4344
  var mixin;
4378
4345
  var mixinPath;
@@ -4475,7 +4442,9 @@
4475
4442
  else {
4476
4443
  defaultResult = defTrue;
4477
4444
  if ((count[defTrue] + count[defFalse]) > 1) {
4478
- throw { type: 'Runtime', message: "Ambiguous use of `default()` found when matching for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename };
4445
+ throw { type: 'Runtime',
4446
+ message: "Ambiguous use of `default()` found when matching for `" + this.format(args) + "`",
4447
+ index: this.getIndex(), filename: this.fileInfo().filename };
4479
4448
  }
4480
4449
  }
4481
4450
  for (m = 0; m < candidates.length; m++) {
@@ -4503,13 +4472,17 @@
4503
4472
  }
4504
4473
  }
4505
4474
  if (isOneFound) {
4506
- throw { type: 'Runtime', message: "No matching definition was found for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename };
4475
+ throw { type: 'Runtime',
4476
+ message: "No matching definition was found for `" + this.format(args) + "`",
4477
+ index: this.getIndex(), filename: this.fileInfo().filename };
4507
4478
  }
4508
4479
  else {
4509
- throw { type: 'Name', message: this.selector.toCSS().trim() + " is undefined", index: this.getIndex(), filename: this.fileInfo().filename };
4480
+ throw { type: 'Name',
4481
+ message: this.selector.toCSS().trim() + " is undefined",
4482
+ index: this.getIndex(), filename: this.fileInfo().filename };
4510
4483
  }
4511
- };
4512
- MixinCall.prototype._setVisibilityToReplacement = function (replacement) {
4484
+ },
4485
+ _setVisibilityToReplacement: function (replacement) {
4513
4486
  var i, rule;
4514
4487
  if (this.blocksVisibility()) {
4515
4488
  for (i = 0; i < replacement.length; i++) {
@@ -4517,8 +4490,8 @@
4517
4490
  rule.addVisibilityBlock();
4518
4491
  }
4519
4492
  }
4520
- };
4521
- MixinCall.prototype.format = function (args) {
4493
+ },
4494
+ format: function (args) {
4522
4495
  return this.selector.toCSS().trim() + "(" + (args ? args.map(function (a) {
4523
4496
  var argValue = '';
4524
4497
  if (a.name) {
@@ -4532,19 +4505,44 @@
4532
4505
  }
4533
4506
  return argValue;
4534
4507
  }).join(', ') : '') + ")";
4535
- };
4536
- return MixinCall;
4537
- }(Node));
4538
- MixinCall.prototype.type = 'MixinCall';
4508
+ }
4509
+ });
4539
4510
 
4540
4511
  var tree = {
4541
- Node: Node, Color: Color, AtRule: AtRule, DetachedRuleset: DetachedRuleset, Operation: Operation,
4542
- Dimension: Dimension, Unit: Unit, Keyword: Keyword, Variable: Variable, Property: Property,
4543
- Ruleset: Ruleset, Element: Element, Attribute: Attribute, Combinator: Combinator, Selector: Selector,
4544
- Quoted: Quoted, Expression: Expression, Declaration: Declaration, Call: Call, URL: URL, Import: Import,
4545
- Comment: Comment, Anonymous: Anonymous, Value: Value, JavaScript: JavaScript, Assignment: Assignment,
4546
- Condition: Condition, Paren: Paren, Media: Media, UnicodeDescriptor: UnicodeDescriptor, Negative: Negative,
4547
- Extend: Extend, VariableCall: VariableCall, NamespaceValue: NamespaceValue,
4512
+ Node: Node,
4513
+ Color: Color,
4514
+ AtRule: AtRule,
4515
+ DetachedRuleset: DetachedRuleset,
4516
+ Operation: Operation,
4517
+ Dimension: Dimension,
4518
+ Unit: Unit,
4519
+ Keyword: Keyword,
4520
+ Variable: Variable,
4521
+ Property: Property,
4522
+ Ruleset: Ruleset,
4523
+ Element: Element,
4524
+ Attribute: Attribute,
4525
+ Combinator: Combinator,
4526
+ Selector: Selector,
4527
+ Quoted: Quoted,
4528
+ Expression: Expression,
4529
+ Declaration: Declaration,
4530
+ Call: Call,
4531
+ URL: URL,
4532
+ Import: Import,
4533
+ Comment: Comment,
4534
+ Anonymous: Anonymous,
4535
+ Value: Value,
4536
+ JavaScript: JavaScript,
4537
+ Assignment: Assignment,
4538
+ Condition: Condition,
4539
+ Paren: Paren,
4540
+ Media: Media,
4541
+ UnicodeDescriptor: UnicodeDescriptor,
4542
+ Negative: Negative,
4543
+ Extend: Extend,
4544
+ VariableCall: VariableCall,
4545
+ NamespaceValue: NamespaceValue,
4548
4546
  mixin: {
4549
4547
  Call: MixinCall,
4550
4548
  Definition: Definition
@@ -5342,7 +5340,7 @@
5342
5340
  catch (_) { }
5343
5341
  if (!indices[extend.index + " " + selector]) {
5344
5342
  indices[extend.index + " " + selector] = true;
5345
- logger.warn("extend '" + selector + "' has no matches");
5343
+ logger$1.warn("extend '" + selector + "' has no matches");
5346
5344
  }
5347
5345
  });
5348
5346
  };
@@ -5883,10 +5881,12 @@
5883
5881
  index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
5884
5882
  }
5885
5883
  if (ruleNode instanceof tree.Call) {
5886
- throw { message: "Function '" + ruleNode.name + "' did not return a root node", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
5884
+ throw { message: "Function '" + ruleNode.name + "' did not return a root node",
5885
+ index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
5887
5886
  }
5888
5887
  if (ruleNode.type && !ruleNode.allowRoot) {
5889
- throw { message: ruleNode.type + " node returned by a function is not valid here", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
5888
+ throw { message: ruleNode.type + " node returned by a function is not valid here",
5889
+ index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename };
5890
5890
  }
5891
5891
  }
5892
5892
  },
@@ -7330,9 +7330,9 @@
7330
7330
  parserInput.restore();
7331
7331
  return;
7332
7332
  }
7333
- if (!lookups && !hasParens) {
7334
- // This isn't a valid mixin call
7335
- parserInput.restore('Unrecognized input. Possibly missing \'(\' in mixin call.');
7333
+ if (inValue && !lookups && !hasParens) {
7334
+ // This isn't a valid in-value mixin call
7335
+ parserInput.restore();
7336
7336
  return;
7337
7337
  }
7338
7338
  if (!inValue && parsers.important()) {
@@ -8763,10 +8763,20 @@
8763
8763
  : (falseValue ? falseValue.eval(context) : new Anonymous);
8764
8764
  }
8765
8765
  If.evalArgs = false;
8766
- var boolean$1 = { boolean: boolean, 'if': If };
8766
+ function isdefined(context, variable) {
8767
+ try {
8768
+ variable.eval(context);
8769
+ return Keyword.True;
8770
+ }
8771
+ catch (e) {
8772
+ return Keyword.False;
8773
+ }
8774
+ }
8775
+ isdefined.evalArgs = false;
8776
+ var boolean$1 = { isdefined: isdefined, boolean: boolean, 'if': If };
8767
8777
 
8768
8778
  var colorFunctions;
8769
- function clamp$1(val) {
8779
+ function clamp(val) {
8770
8780
  return Math.min(1, Math.max(0, val));
8771
8781
  }
8772
8782
  function hsla(origColor, hsl) {
@@ -8798,7 +8808,7 @@
8798
8808
  throw new Error('Argument cannot be evaluated to a color');
8799
8809
  }
8800
8810
  }
8801
- function number(n) {
8811
+ function number$1(n) {
8802
8812
  if (n instanceof Dimension) {
8803
8813
  return parseFloat(n.unit.is('%') ? n.value / 100 : n.value);
8804
8814
  }
@@ -8817,7 +8827,7 @@
8817
8827
  return parseFloat(n.value * size / 100);
8818
8828
  }
8819
8829
  else {
8820
- return number(n);
8830
+ return number$1(n);
8821
8831
  }
8822
8832
  }
8823
8833
  colorFunctions = {
@@ -8852,7 +8862,7 @@
8852
8862
  try {
8853
8863
  if (r instanceof Color) {
8854
8864
  if (g) {
8855
- a = number(g);
8865
+ a = number$1(g);
8856
8866
  }
8857
8867
  else {
8858
8868
  a = r.alpha;
@@ -8860,7 +8870,7 @@
8860
8870
  return new Color(r.rgb, a, 'rgba');
8861
8871
  }
8862
8872
  var rgb = [r, g, b].map(function (c) { return scaled(c, 255); });
8863
- a = number(a);
8873
+ a = number$1(a);
8864
8874
  return new Color(rgb, a, 'rgba');
8865
8875
  }
8866
8876
  catch (e) { }
@@ -8888,7 +8898,7 @@
8888
8898
  try {
8889
8899
  if (h instanceof Color) {
8890
8900
  if (s) {
8891
- a = number(s);
8901
+ a = number$1(s);
8892
8902
  }
8893
8903
  else {
8894
8904
  a = h.alpha;
@@ -8912,10 +8922,10 @@
8912
8922
  return m1_1;
8913
8923
  }
8914
8924
  }
8915
- h = (number(h) % 360) / 360;
8916
- s = clamp$1(number(s));
8917
- l = clamp$1(number(l));
8918
- a = clamp$1(number(a));
8925
+ h = (number$1(h) % 360) / 360;
8926
+ s = clamp(number$1(s));
8927
+ l = clamp(number$1(l));
8928
+ a = clamp(number$1(a));
8919
8929
  m2_1 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
8920
8930
  m1_1 = l * 2 - m2_1;
8921
8931
  var rgb = [
@@ -8923,7 +8933,7 @@
8923
8933
  hue(h) * 255,
8924
8934
  hue(h - 1 / 3) * 255
8925
8935
  ];
8926
- a = number(a);
8936
+ a = number$1(a);
8927
8937
  return new Color(rgb, a, 'hsla');
8928
8938
  }
8929
8939
  catch (e) { }
@@ -8932,10 +8942,10 @@
8932
8942
  return colorFunctions.hsva(h, s, v, 1.0);
8933
8943
  },
8934
8944
  hsva: function (h, s, v, a) {
8935
- h = ((number(h) % 360) / 360) * 360;
8936
- s = number(s);
8937
- v = number(v);
8938
- a = number(a);
8945
+ h = ((number$1(h) % 360) / 360) * 360;
8946
+ s = number$1(s);
8947
+ v = number$1(v);
8948
+ a = number$1(a);
8939
8949
  var i;
8940
8950
  var f;
8941
8951
  i = Math.floor((h / 60) % 6);
@@ -9004,7 +9014,7 @@
9004
9014
  else {
9005
9015
  hsl.s += amount.value / 100;
9006
9016
  }
9007
- hsl.s = clamp$1(hsl.s);
9017
+ hsl.s = clamp(hsl.s);
9008
9018
  return hsla(color, hsl);
9009
9019
  },
9010
9020
  desaturate: function (color, amount, method) {
@@ -9015,7 +9025,7 @@
9015
9025
  else {
9016
9026
  hsl.s -= amount.value / 100;
9017
9027
  }
9018
- hsl.s = clamp$1(hsl.s);
9028
+ hsl.s = clamp(hsl.s);
9019
9029
  return hsla(color, hsl);
9020
9030
  },
9021
9031
  lighten: function (color, amount, method) {
@@ -9026,7 +9036,7 @@
9026
9036
  else {
9027
9037
  hsl.l += amount.value / 100;
9028
9038
  }
9029
- hsl.l = clamp$1(hsl.l);
9039
+ hsl.l = clamp(hsl.l);
9030
9040
  return hsla(color, hsl);
9031
9041
  },
9032
9042
  darken: function (color, amount, method) {
@@ -9037,7 +9047,7 @@
9037
9047
  else {
9038
9048
  hsl.l -= amount.value / 100;
9039
9049
  }
9040
- hsl.l = clamp$1(hsl.l);
9050
+ hsl.l = clamp(hsl.l);
9041
9051
  return hsla(color, hsl);
9042
9052
  },
9043
9053
  fadein: function (color, amount, method) {
@@ -9048,7 +9058,7 @@
9048
9058
  else {
9049
9059
  hsl.a += amount.value / 100;
9050
9060
  }
9051
- hsl.a = clamp$1(hsl.a);
9061
+ hsl.a = clamp(hsl.a);
9052
9062
  return hsla(color, hsl);
9053
9063
  },
9054
9064
  fadeout: function (color, amount, method) {
@@ -9059,13 +9069,13 @@
9059
9069
  else {
9060
9070
  hsl.a -= amount.value / 100;
9061
9071
  }
9062
- hsl.a = clamp$1(hsl.a);
9072
+ hsl.a = clamp(hsl.a);
9063
9073
  return hsla(color, hsl);
9064
9074
  },
9065
9075
  fade: function (color, amount) {
9066
9076
  var hsl = toHSL(color);
9067
9077
  hsl.a = amount.value / 100;
9068
- hsl.a = clamp$1(hsl.a);
9078
+ hsl.a = clamp(hsl.a);
9069
9079
  return hsla(color, hsl);
9070
9080
  },
9071
9081
  spin: function (color, amount) {
@@ -9118,7 +9128,7 @@
9118
9128
  threshold = 0.43;
9119
9129
  }
9120
9130
  else {
9121
- threshold = number(threshold);
9131
+ threshold = number$1(threshold);
9122
9132
  }
9123
9133
  if (color.luma() < threshold) {
9124
9134
  return light;
@@ -9257,9 +9267,9 @@
9257
9267
  return 1 - Math.abs(cb + cs - 1);
9258
9268
  }
9259
9269
  };
9260
- for (var f in colorBlendModeFunctions) {
9261
- if (colorBlendModeFunctions.hasOwnProperty(f)) {
9262
- colorBlend[f] = colorBlend.bind(null, colorBlendModeFunctions[f]);
9270
+ for (var f$1 in colorBlendModeFunctions) {
9271
+ if (colorBlendModeFunctions.hasOwnProperty(f$1)) {
9272
+ colorBlend[f$1] = colorBlend.bind(null, colorBlendModeFunctions[f$1]);
9263
9273
  }
9264
9274
  }
9265
9275
 
@@ -9308,7 +9318,7 @@
9308
9318
  }
9309
9319
  var fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment);
9310
9320
  if (!fileSync.contents) {
9311
- logger.warn("Skipped data-uri embedding of " + filePath + " because file not found");
9321
+ logger$1.warn("Skipped data-uri embedding of " + filePath + " because file not found");
9312
9322
  return fallback(this, filePathNode || mimetypeNode);
9313
9323
  }
9314
9324
  var buf = fileSync.contents;
@@ -9479,9 +9489,9 @@
9479
9489
  asin: 'rad',
9480
9490
  acos: 'rad'
9481
9491
  };
9482
- for (var f$1 in mathFunctions) {
9483
- if (mathFunctions.hasOwnProperty(f$1)) {
9484
- mathFunctions[f$1] = MathHelper.bind(null, Math[f$1], mathFunctions[f$1]);
9492
+ for (var f in mathFunctions) {
9493
+ if (mathFunctions.hasOwnProperty(f)) {
9494
+ mathFunctions[f] = MathHelper.bind(null, Math[f], mathFunctions[f]);
9485
9495
  }
9486
9496
  }
9487
9497
  mathFunctions.round = function (n, f) {
@@ -9539,7 +9549,7 @@
9539
9549
  args = order.map(function (a) { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', ');
9540
9550
  return new Anonymous((isMin ? 'min' : 'max') + "(" + args + ")");
9541
9551
  };
9542
- var number$1 = {
9552
+ var number = {
9543
9553
  min: function () {
9544
9554
  var args = [];
9545
9555
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -9739,7 +9749,8 @@
9739
9749
  isunit: isunit,
9740
9750
  unit: function (val, unit) {
9741
9751
  if (!(val instanceof Dimension)) {
9742
- throw { type: 'Argument', message: "the first argument to unit must be a number" + (val instanceof Operation ? '. Have you forgotten parenthesis?' : '') };
9752
+ throw { type: 'Argument',
9753
+ message: "the first argument to unit must be a number" + (val instanceof Operation ? '. Have you forgotten parenthesis?' : '') };
9743
9754
  }
9744
9755
  if (unit) {
9745
9756
  if (unit instanceof Keyword) {
@@ -9769,7 +9780,7 @@
9769
9780
  functionRegistry.addMultiple(dataUri(environment));
9770
9781
  functionRegistry.addMultiple(list);
9771
9782
  functionRegistry.addMultiple(mathFunctions);
9772
- functionRegistry.addMultiple(number$1);
9783
+ functionRegistry.addMultiple(number);
9773
9784
  functionRegistry.addMultiple(string);
9774
9785
  functionRegistry.addMultiple(svg());
9775
9786
  functionRegistry.addMultiple(types);
@@ -10075,8 +10086,12 @@
10075
10086
  // adjust the source
10076
10087
  inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]);
10077
10088
  }
10078
- // ignore empty content
10089
+ /**
10090
+ * ignore empty content, or failsafe
10091
+ * if contents map is incorrect
10092
+ */
10079
10093
  if (inputSource === undefined) {
10094
+ this._css.push(chunk);
10080
10095
  return;
10081
10096
  }
10082
10097
  inputSource = inputSource.substring(0, index);
@@ -10233,7 +10248,7 @@
10233
10248
  try {
10234
10249
  var compress = Boolean(options.compress);
10235
10250
  if (compress) {
10236
- logger.warn('The compress option has been deprecated. ' +
10251
+ logger$1.warn('The compress option has been deprecated. ' +
10237
10252
  'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.');
10238
10253
  }
10239
10254
  var toCSSOptions = {
@@ -10314,7 +10329,7 @@
10314
10329
  var importedEqualsRoot = fullPath === importManager.rootFilename;
10315
10330
  if (importOptions.optional && e) {
10316
10331
  callback(null, { rules: [] }, false, null);
10317
- logger.info("The file " + fullPath + " was skipped because it was not found and the import was marked optional.");
10332
+ logger$1.info("The file " + fullPath + " was skipped because it was not found and the import was marked optional.");
10318
10333
  }
10319
10334
  else {
10320
10335
  // Inline imports aren't cached here.
@@ -10560,6 +10575,27 @@
10560
10575
  return render;
10561
10576
  }
10562
10577
 
10578
+ var version = "4.1.2";
10579
+
10580
+ function parseNodeVersion(version) {
10581
+ var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len
10582
+ if (!match) {
10583
+ throw new Error('Unable to parse: ' + version);
10584
+ }
10585
+
10586
+ var res = {
10587
+ major: parseInt(match[1], 10),
10588
+ minor: parseInt(match[2], 10),
10589
+ patch: parseInt(match[3], 10),
10590
+ pre: match[4] || '',
10591
+ build: match[5] || '',
10592
+ };
10593
+
10594
+ return res;
10595
+ }
10596
+
10597
+ var parseNodeVersion_1 = parseNodeVersion;
10598
+
10563
10599
  function lessRoot (environment, fileManagers) {
10564
10600
  var sourceMapOutput, sourceMapBuilder, parseTree, importManager;
10565
10601
  environment = new Environment(environment, fileManagers);
@@ -10569,8 +10605,9 @@
10569
10605
  importManager = ImportManager(environment);
10570
10606
  var render = Render(environment, parseTree);
10571
10607
  var parse = Parse(environment, parseTree, importManager);
10608
+ var v = parseNodeVersion_1("v" + version);
10572
10609
  var initial = {
10573
- version: [4, 0, 0],
10610
+ version: [v.major, v.minor, v.patch],
10574
10611
  data: data,
10575
10612
  tree: tree,
10576
10613
  Environment: Environment,
@@ -10591,7 +10628,7 @@
10591
10628
  transformTree: transformTree,
10592
10629
  utils: utils,
10593
10630
  PluginManager: PluginManagerFactory,
10594
- logger: logger
10631
+ logger: logger$1
10595
10632
  };
10596
10633
  // Create a public API
10597
10634
  var ctor = function (t) {
@@ -10629,31 +10666,28 @@
10629
10666
  }
10630
10667
 
10631
10668
  /* global window, XMLHttpRequest */
10632
- var options;
10633
- var logger$1;
10669
+ var options$1;
10670
+ var logger;
10634
10671
  var fileCache = {};
10635
10672
  // TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load
10636
- var FileManager = /** @class */ (function (_super) {
10637
- __extends(FileManager, _super);
10638
- function FileManager() {
10639
- return _super !== null && _super.apply(this, arguments) || this;
10640
- }
10641
- FileManager.prototype.alwaysMakePathsAbsolute = function () {
10673
+ var FileManager = function () { };
10674
+ FileManager.prototype = Object.assign(new AbstractFileManager(), {
10675
+ alwaysMakePathsAbsolute: function () {
10642
10676
  return true;
10643
- };
10644
- FileManager.prototype.join = function (basePath, laterPath) {
10677
+ },
10678
+ join: function (basePath, laterPath) {
10645
10679
  if (!basePath) {
10646
10680
  return laterPath;
10647
10681
  }
10648
10682
  return this.extractUrlParts(laterPath, basePath).path;
10649
- };
10650
- FileManager.prototype.doXHR = function (url, type, callback, errback) {
10683
+ },
10684
+ doXHR: function (url, type, callback, errback) {
10651
10685
  var xhr = new XMLHttpRequest();
10652
- var async = options.isFileProtocol ? options.fileAsync : true;
10686
+ var async = options$1.isFileProtocol ? options$1.fileAsync : true;
10653
10687
  if (typeof xhr.overrideMimeType === 'function') {
10654
10688
  xhr.overrideMimeType('text/css');
10655
10689
  }
10656
- logger$1.debug("XHR: Getting '" + url + "'");
10690
+ logger.debug("XHR: Getting '" + url + "'");
10657
10691
  xhr.open('GET', url, async);
10658
10692
  xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5');
10659
10693
  xhr.send(null);
@@ -10665,7 +10699,7 @@
10665
10699
  errback(xhr.status, url);
10666
10700
  }
10667
10701
  }
10668
- if (options.isFileProtocol && !options.fileAsync) {
10702
+ if (options$1.isFileProtocol && !options$1.fileAsync) {
10669
10703
  if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) {
10670
10704
  callback(xhr.responseText);
10671
10705
  }
@@ -10683,14 +10717,14 @@
10683
10717
  else {
10684
10718
  handleResponse(xhr, callback, errback);
10685
10719
  }
10686
- };
10687
- FileManager.prototype.supports = function () {
10720
+ },
10721
+ supports: function () {
10688
10722
  return true;
10689
- };
10690
- FileManager.prototype.clearFileCache = function () {
10723
+ },
10724
+ clearFileCache: function () {
10691
10725
  fileCache = {};
10692
- };
10693
- FileManager.prototype.loadFile = function (filename, currentDirectory, options, environment) {
10726
+ },
10727
+ loadFile: function (filename, currentDirectory, options, environment) {
10694
10728
  // TODO: Add prefix support like less-node?
10695
10729
  // What about multiple paths?
10696
10730
  if (currentDirectory && !this.isPathAbsolute(filename)) {
@@ -10722,12 +10756,11 @@
10722
10756
  reject({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href });
10723
10757
  });
10724
10758
  });
10725
- };
10726
- return FileManager;
10727
- }(AbstractFileManager));
10759
+ }
10760
+ });
10728
10761
  var FM = (function (opts, log) {
10729
- options = opts;
10730
- logger$1 = log;
10762
+ options$1 = opts;
10763
+ logger = log;
10731
10764
  return FileManager;
10732
10765
  });
10733
10766
 
@@ -10735,22 +10768,18 @@
10735
10768
  /**
10736
10769
  * Browser Plugin Loader
10737
10770
  */
10738
- var PluginLoader = /** @class */ (function (_super) {
10739
- __extends(PluginLoader, _super);
10740
- function PluginLoader(less) {
10741
- var _this = _super.call(this) || this;
10742
- _this.less = less;
10743
- return _this;
10744
- // Should we shim this.require for browser? Probably not?
10745
- }
10746
- PluginLoader.prototype.loadPlugin = function (filename, basePath, context, environment, fileManager) {
10771
+ var PluginLoader = function (less) {
10772
+ this.less = less;
10773
+ // Should we shim this.require for browser? Probably not?
10774
+ };
10775
+ PluginLoader.prototype = Object.assign(new AbstractPluginLoader(), {
10776
+ loadPlugin: function (filename, basePath, context, environment, fileManager) {
10747
10777
  return new Promise(function (fulfill, reject) {
10748
10778
  fileManager.loadFile(filename, basePath, context, environment)
10749
10779
  .then(fulfill).catch(reject);
10750
10780
  });
10751
- };
10752
- return PluginLoader;
10753
- }(AbstractPluginLoader));
10781
+ }
10782
+ });
10754
10783
 
10755
10784
  var LogListener = (function (less, options) {
10756
10785
  var logLevel_debug = 4;
@@ -11256,20 +11285,20 @@
11256
11285
  * used in the browser distributed version of less
11257
11286
  * to kick-start less using the browser api
11258
11287
  */
11259
- var options$1 = defaultOptions();
11288
+ var options = defaultOptions();
11260
11289
  if (window.less) {
11261
11290
  for (var key in window.less) {
11262
11291
  if (window.less.hasOwnProperty(key)) {
11263
- options$1[key] = window.less[key];
11292
+ options[key] = window.less[key];
11264
11293
  }
11265
11294
  }
11266
11295
  }
11267
- addDefaultOptions(window, options$1);
11268
- options$1.plugins = options$1.plugins || [];
11296
+ addDefaultOptions(window, options);
11297
+ options.plugins = options.plugins || [];
11269
11298
  if (window.LESS_PLUGINS) {
11270
- options$1.plugins = options$1.plugins.concat(window.LESS_PLUGINS);
11299
+ options.plugins = options.plugins.concat(window.LESS_PLUGINS);
11271
11300
  }
11272
- var less = root(window, options$1);
11301
+ var less = root(window, options);
11273
11302
  window.less = less;
11274
11303
  var css;
11275
11304
  var head;
@@ -11279,16 +11308,16 @@
11279
11308
  if (data.filename) {
11280
11309
  console.warn(data);
11281
11310
  }
11282
- if (!options$1.async) {
11311
+ if (!options.async) {
11283
11312
  head.removeChild(style);
11284
11313
  }
11285
11314
  }
11286
- if (options$1.onReady) {
11315
+ if (options.onReady) {
11287
11316
  if (/!watch/.test(window.location.hash)) {
11288
11317
  less.watch();
11289
11318
  }
11290
11319
  // Simulate synchronous stylesheet loading by hiding page rendering
11291
- if (!options$1.async) {
11320
+ if (!options.async) {
11292
11321
  css = 'body { display: none !important }';
11293
11322
  head = document.head || document.getElementsByTagName('head')[0];
11294
11323
  style = document.createElement('style');