vscode-css-languageservice 5.1.12 → 5.3.0

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.
@@ -0,0 +1,1628 @@
1
+ // copied from js-beautify/js/lib/beautify-css.js
2
+ // version: 1.14.0
3
+ /* AUTO-GENERATED. DO NOT MODIFY. */
4
+ /*
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
9
+
10
+ Permission is hereby granted, free of charge, to any person
11
+ obtaining a copy of this software and associated documentation files
12
+ (the "Software"), to deal in the Software without restriction,
13
+ including without limitation the rights to use, copy, modify, merge,
14
+ publish, distribute, sublicense, and/or sell copies of the Software,
15
+ and to permit persons to whom the Software is furnished to do so,
16
+ subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be
19
+ included in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
25
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
26
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+
30
+
31
+ CSS Beautifier
32
+ ---------------
33
+
34
+ Written by Harutyun Amirjanyan, (amirjanyan@gmail.com)
35
+
36
+ Based on code initially developed by: Einar Lielmanis, <einar@beautifier.io>
37
+ https://beautifier.io/
38
+
39
+ Usage:
40
+ css_beautify(source_text);
41
+ css_beautify(source_text, options);
42
+
43
+ The options are (default in brackets):
44
+ indent_size (4) — indentation size,
45
+ indent_char (space) — character to indent with,
46
+ selector_separator_newline (true) - separate selectors with newline or
47
+ not (e.g. "a,\nbr" or "a, br")
48
+ end_with_newline (false) - end with a newline
49
+ newline_between_rules (true) - add a new line after every css rule
50
+ space_around_selector_separator (false) - ensure space around selector separators:
51
+ '>', '+', '~' (e.g. "a>b" -> "a > b")
52
+ e.g
53
+
54
+ css_beautify(css_source_text, {
55
+ 'indent_size': 1,
56
+ 'indent_char': '\t',
57
+ 'selector_separator': ' ',
58
+ 'end_with_newline': false,
59
+ 'newline_between_rules': true,
60
+ 'space_around_selector_separator': true
61
+ });
62
+ */
63
+
64
+ // http://www.w3.org/TR/CSS21/syndata.html#tokenization
65
+ // http://www.w3.org/TR/css3-syntax/
66
+
67
+ (function() {
68
+
69
+ /* GENERATED_BUILD_OUTPUT */
70
+ var legacy_beautify_css;
71
+ /******/ (function() { // webpackBootstrap
72
+ /******/ "use strict";
73
+ /******/ var __webpack_modules__ = ([
74
+ /* 0 */,
75
+ /* 1 */,
76
+ /* 2 */
77
+ /***/ (function(module) {
78
+
79
+ /*jshint node:true */
80
+ /*
81
+ The MIT License (MIT)
82
+
83
+ Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
84
+
85
+ Permission is hereby granted, free of charge, to any person
86
+ obtaining a copy of this software and associated documentation files
87
+ (the "Software"), to deal in the Software without restriction,
88
+ including without limitation the rights to use, copy, modify, merge,
89
+ publish, distribute, sublicense, and/or sell copies of the Software,
90
+ and to permit persons to whom the Software is furnished to do so,
91
+ subject to the following conditions:
92
+
93
+ The above copyright notice and this permission notice shall be
94
+ included in all copies or substantial portions of the Software.
95
+
96
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
97
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
98
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
99
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
100
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
101
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
102
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
103
+ SOFTWARE.
104
+ */
105
+
106
+
107
+
108
+ function OutputLine(parent) {
109
+ this.__parent = parent;
110
+ this.__character_count = 0;
111
+ // use indent_count as a marker for this.__lines that have preserved indentation
112
+ this.__indent_count = -1;
113
+ this.__alignment_count = 0;
114
+ this.__wrap_point_index = 0;
115
+ this.__wrap_point_character_count = 0;
116
+ this.__wrap_point_indent_count = -1;
117
+ this.__wrap_point_alignment_count = 0;
118
+
119
+ this.__items = [];
120
+ }
121
+
122
+ OutputLine.prototype.clone_empty = function() {
123
+ var line = new OutputLine(this.__parent);
124
+ line.set_indent(this.__indent_count, this.__alignment_count);
125
+ return line;
126
+ };
127
+
128
+ OutputLine.prototype.item = function(index) {
129
+ if (index < 0) {
130
+ return this.__items[this.__items.length + index];
131
+ } else {
132
+ return this.__items[index];
133
+ }
134
+ };
135
+
136
+ OutputLine.prototype.has_match = function(pattern) {
137
+ for (var lastCheckedOutput = this.__items.length - 1; lastCheckedOutput >= 0; lastCheckedOutput--) {
138
+ if (this.__items[lastCheckedOutput].match(pattern)) {
139
+ return true;
140
+ }
141
+ }
142
+ return false;
143
+ };
144
+
145
+ OutputLine.prototype.set_indent = function(indent, alignment) {
146
+ if (this.is_empty()) {
147
+ this.__indent_count = indent || 0;
148
+ this.__alignment_count = alignment || 0;
149
+ this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count);
150
+ }
151
+ };
152
+
153
+ OutputLine.prototype._set_wrap_point = function() {
154
+ if (this.__parent.wrap_line_length) {
155
+ this.__wrap_point_index = this.__items.length;
156
+ this.__wrap_point_character_count = this.__character_count;
157
+ this.__wrap_point_indent_count = this.__parent.next_line.__indent_count;
158
+ this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count;
159
+ }
160
+ };
161
+
162
+ OutputLine.prototype._should_wrap = function() {
163
+ return this.__wrap_point_index &&
164
+ this.__character_count > this.__parent.wrap_line_length &&
165
+ this.__wrap_point_character_count > this.__parent.next_line.__character_count;
166
+ };
167
+
168
+ OutputLine.prototype._allow_wrap = function() {
169
+ if (this._should_wrap()) {
170
+ this.__parent.add_new_line();
171
+ var next = this.__parent.current_line;
172
+ next.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count);
173
+ next.__items = this.__items.slice(this.__wrap_point_index);
174
+ this.__items = this.__items.slice(0, this.__wrap_point_index);
175
+
176
+ next.__character_count += this.__character_count - this.__wrap_point_character_count;
177
+ this.__character_count = this.__wrap_point_character_count;
178
+
179
+ if (next.__items[0] === " ") {
180
+ next.__items.splice(0, 1);
181
+ next.__character_count -= 1;
182
+ }
183
+ return true;
184
+ }
185
+ return false;
186
+ };
187
+
188
+ OutputLine.prototype.is_empty = function() {
189
+ return this.__items.length === 0;
190
+ };
191
+
192
+ OutputLine.prototype.last = function() {
193
+ if (!this.is_empty()) {
194
+ return this.__items[this.__items.length - 1];
195
+ } else {
196
+ return null;
197
+ }
198
+ };
199
+
200
+ OutputLine.prototype.push = function(item) {
201
+ this.__items.push(item);
202
+ var last_newline_index = item.lastIndexOf('\n');
203
+ if (last_newline_index !== -1) {
204
+ this.__character_count = item.length - last_newline_index;
205
+ } else {
206
+ this.__character_count += item.length;
207
+ }
208
+ };
209
+
210
+ OutputLine.prototype.pop = function() {
211
+ var item = null;
212
+ if (!this.is_empty()) {
213
+ item = this.__items.pop();
214
+ this.__character_count -= item.length;
215
+ }
216
+ return item;
217
+ };
218
+
219
+
220
+ OutputLine.prototype._remove_indent = function() {
221
+ if (this.__indent_count > 0) {
222
+ this.__indent_count -= 1;
223
+ this.__character_count -= this.__parent.indent_size;
224
+ }
225
+ };
226
+
227
+ OutputLine.prototype._remove_wrap_indent = function() {
228
+ if (this.__wrap_point_indent_count > 0) {
229
+ this.__wrap_point_indent_count -= 1;
230
+ }
231
+ };
232
+ OutputLine.prototype.trim = function() {
233
+ while (this.last() === ' ') {
234
+ this.__items.pop();
235
+ this.__character_count -= 1;
236
+ }
237
+ };
238
+
239
+ OutputLine.prototype.toString = function() {
240
+ var result = '';
241
+ if (this.is_empty()) {
242
+ if (this.__parent.indent_empty_lines) {
243
+ result = this.__parent.get_indent_string(this.__indent_count);
244
+ }
245
+ } else {
246
+ result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count);
247
+ result += this.__items.join('');
248
+ }
249
+ return result;
250
+ };
251
+
252
+ function IndentStringCache(options, baseIndentString) {
253
+ this.__cache = [''];
254
+ this.__indent_size = options.indent_size;
255
+ this.__indent_string = options.indent_char;
256
+ if (!options.indent_with_tabs) {
257
+ this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char);
258
+ }
259
+
260
+ // Set to null to continue support for auto detection of base indent
261
+ baseIndentString = baseIndentString || '';
262
+ if (options.indent_level > 0) {
263
+ baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string);
264
+ }
265
+
266
+ this.__base_string = baseIndentString;
267
+ this.__base_string_length = baseIndentString.length;
268
+ }
269
+
270
+ IndentStringCache.prototype.get_indent_size = function(indent, column) {
271
+ var result = this.__base_string_length;
272
+ column = column || 0;
273
+ if (indent < 0) {
274
+ result = 0;
275
+ }
276
+ result += indent * this.__indent_size;
277
+ result += column;
278
+ return result;
279
+ };
280
+
281
+ IndentStringCache.prototype.get_indent_string = function(indent_level, column) {
282
+ var result = this.__base_string;
283
+ column = column || 0;
284
+ if (indent_level < 0) {
285
+ indent_level = 0;
286
+ result = '';
287
+ }
288
+ column += indent_level * this.__indent_size;
289
+ this.__ensure_cache(column);
290
+ result += this.__cache[column];
291
+ return result;
292
+ };
293
+
294
+ IndentStringCache.prototype.__ensure_cache = function(column) {
295
+ while (column >= this.__cache.length) {
296
+ this.__add_column();
297
+ }
298
+ };
299
+
300
+ IndentStringCache.prototype.__add_column = function() {
301
+ var column = this.__cache.length;
302
+ var indent = 0;
303
+ var result = '';
304
+ if (this.__indent_size && column >= this.__indent_size) {
305
+ indent = Math.floor(column / this.__indent_size);
306
+ column -= indent * this.__indent_size;
307
+ result = new Array(indent + 1).join(this.__indent_string);
308
+ }
309
+ if (column) {
310
+ result += new Array(column + 1).join(' ');
311
+ }
312
+
313
+ this.__cache.push(result);
314
+ };
315
+
316
+ function Output(options, baseIndentString) {
317
+ this.__indent_cache = new IndentStringCache(options, baseIndentString);
318
+ this.raw = false;
319
+ this._end_with_newline = options.end_with_newline;
320
+ this.indent_size = options.indent_size;
321
+ this.wrap_line_length = options.wrap_line_length;
322
+ this.indent_empty_lines = options.indent_empty_lines;
323
+ this.__lines = [];
324
+ this.previous_line = null;
325
+ this.current_line = null;
326
+ this.next_line = new OutputLine(this);
327
+ this.space_before_token = false;
328
+ this.non_breaking_space = false;
329
+ this.previous_token_wrapped = false;
330
+ // initialize
331
+ this.__add_outputline();
332
+ }
333
+
334
+ Output.prototype.__add_outputline = function() {
335
+ this.previous_line = this.current_line;
336
+ this.current_line = this.next_line.clone_empty();
337
+ this.__lines.push(this.current_line);
338
+ };
339
+
340
+ Output.prototype.get_line_number = function() {
341
+ return this.__lines.length;
342
+ };
343
+
344
+ Output.prototype.get_indent_string = function(indent, column) {
345
+ return this.__indent_cache.get_indent_string(indent, column);
346
+ };
347
+
348
+ Output.prototype.get_indent_size = function(indent, column) {
349
+ return this.__indent_cache.get_indent_size(indent, column);
350
+ };
351
+
352
+ Output.prototype.is_empty = function() {
353
+ return !this.previous_line && this.current_line.is_empty();
354
+ };
355
+
356
+ Output.prototype.add_new_line = function(force_newline) {
357
+ // never newline at the start of file
358
+ // otherwise, newline only if we didn't just add one or we're forced
359
+ if (this.is_empty() ||
360
+ (!force_newline && this.just_added_newline())) {
361
+ return false;
362
+ }
363
+
364
+ // if raw output is enabled, don't print additional newlines,
365
+ // but still return True as though you had
366
+ if (!this.raw) {
367
+ this.__add_outputline();
368
+ }
369
+ return true;
370
+ };
371
+
372
+ Output.prototype.get_code = function(eol) {
373
+ this.trim(true);
374
+
375
+ // handle some edge cases where the last tokens
376
+ // has text that ends with newline(s)
377
+ var last_item = this.current_line.pop();
378
+ if (last_item) {
379
+ if (last_item[last_item.length - 1] === '\n') {
380
+ last_item = last_item.replace(/\n+$/g, '');
381
+ }
382
+ this.current_line.push(last_item);
383
+ }
384
+
385
+ if (this._end_with_newline) {
386
+ this.__add_outputline();
387
+ }
388
+
389
+ var sweet_code = this.__lines.join('\n');
390
+
391
+ if (eol !== '\n') {
392
+ sweet_code = sweet_code.replace(/[\n]/g, eol);
393
+ }
394
+ return sweet_code;
395
+ };
396
+
397
+ Output.prototype.set_wrap_point = function() {
398
+ this.current_line._set_wrap_point();
399
+ };
400
+
401
+ Output.prototype.set_indent = function(indent, alignment) {
402
+ indent = indent || 0;
403
+ alignment = alignment || 0;
404
+
405
+ // Next line stores alignment values
406
+ this.next_line.set_indent(indent, alignment);
407
+
408
+ // Never indent your first output indent at the start of the file
409
+ if (this.__lines.length > 1) {
410
+ this.current_line.set_indent(indent, alignment);
411
+ return true;
412
+ }
413
+
414
+ this.current_line.set_indent();
415
+ return false;
416
+ };
417
+
418
+ Output.prototype.add_raw_token = function(token) {
419
+ for (var x = 0; x < token.newlines; x++) {
420
+ this.__add_outputline();
421
+ }
422
+ this.current_line.set_indent(-1);
423
+ this.current_line.push(token.whitespace_before);
424
+ this.current_line.push(token.text);
425
+ this.space_before_token = false;
426
+ this.non_breaking_space = false;
427
+ this.previous_token_wrapped = false;
428
+ };
429
+
430
+ Output.prototype.add_token = function(printable_token) {
431
+ this.__add_space_before_token();
432
+ this.current_line.push(printable_token);
433
+ this.space_before_token = false;
434
+ this.non_breaking_space = false;
435
+ this.previous_token_wrapped = this.current_line._allow_wrap();
436
+ };
437
+
438
+ Output.prototype.__add_space_before_token = function() {
439
+ if (this.space_before_token && !this.just_added_newline()) {
440
+ if (!this.non_breaking_space) {
441
+ this.set_wrap_point();
442
+ }
443
+ this.current_line.push(' ');
444
+ }
445
+ };
446
+
447
+ Output.prototype.remove_indent = function(index) {
448
+ var output_length = this.__lines.length;
449
+ while (index < output_length) {
450
+ this.__lines[index]._remove_indent();
451
+ index++;
452
+ }
453
+ this.current_line._remove_wrap_indent();
454
+ };
455
+
456
+ Output.prototype.trim = function(eat_newlines) {
457
+ eat_newlines = (eat_newlines === undefined) ? false : eat_newlines;
458
+
459
+ this.current_line.trim();
460
+
461
+ while (eat_newlines && this.__lines.length > 1 &&
462
+ this.current_line.is_empty()) {
463
+ this.__lines.pop();
464
+ this.current_line = this.__lines[this.__lines.length - 1];
465
+ this.current_line.trim();
466
+ }
467
+
468
+ this.previous_line = this.__lines.length > 1 ?
469
+ this.__lines[this.__lines.length - 2] : null;
470
+ };
471
+
472
+ Output.prototype.just_added_newline = function() {
473
+ return this.current_line.is_empty();
474
+ };
475
+
476
+ Output.prototype.just_added_blankline = function() {
477
+ return this.is_empty() ||
478
+ (this.current_line.is_empty() && this.previous_line.is_empty());
479
+ };
480
+
481
+ Output.prototype.ensure_empty_line_above = function(starts_with, ends_with) {
482
+ var index = this.__lines.length - 2;
483
+ while (index >= 0) {
484
+ var potentialEmptyLine = this.__lines[index];
485
+ if (potentialEmptyLine.is_empty()) {
486
+ break;
487
+ } else if (potentialEmptyLine.item(0).indexOf(starts_with) !== 0 &&
488
+ potentialEmptyLine.item(-1) !== ends_with) {
489
+ this.__lines.splice(index + 1, 0, new OutputLine(this));
490
+ this.previous_line = this.__lines[this.__lines.length - 2];
491
+ break;
492
+ }
493
+ index--;
494
+ }
495
+ };
496
+
497
+ module.exports.Output = Output;
498
+
499
+
500
+ /***/ }),
501
+ /* 3 */,
502
+ /* 4 */,
503
+ /* 5 */,
504
+ /* 6 */
505
+ /***/ (function(module) {
506
+
507
+ /*jshint node:true */
508
+ /*
509
+
510
+ The MIT License (MIT)
511
+
512
+ Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
513
+
514
+ Permission is hereby granted, free of charge, to any person
515
+ obtaining a copy of this software and associated documentation files
516
+ (the "Software"), to deal in the Software without restriction,
517
+ including without limitation the rights to use, copy, modify, merge,
518
+ publish, distribute, sublicense, and/or sell copies of the Software,
519
+ and to permit persons to whom the Software is furnished to do so,
520
+ subject to the following conditions:
521
+
522
+ The above copyright notice and this permission notice shall be
523
+ included in all copies or substantial portions of the Software.
524
+
525
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
526
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
527
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
528
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
529
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
530
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
531
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
532
+ SOFTWARE.
533
+ */
534
+
535
+
536
+
537
+ function Options(options, merge_child_field) {
538
+ this.raw_options = _mergeOpts(options, merge_child_field);
539
+
540
+ // Support passing the source text back with no change
541
+ this.disabled = this._get_boolean('disabled');
542
+
543
+ this.eol = this._get_characters('eol', 'auto');
544
+ this.end_with_newline = this._get_boolean('end_with_newline');
545
+ this.indent_size = this._get_number('indent_size', 4);
546
+ this.indent_char = this._get_characters('indent_char', ' ');
547
+ this.indent_level = this._get_number('indent_level');
548
+
549
+ this.preserve_newlines = this._get_boolean('preserve_newlines', true);
550
+ this.max_preserve_newlines = this._get_number('max_preserve_newlines', 32786);
551
+ if (!this.preserve_newlines) {
552
+ this.max_preserve_newlines = 0;
553
+ }
554
+
555
+ this.indent_with_tabs = this._get_boolean('indent_with_tabs', this.indent_char === '\t');
556
+ if (this.indent_with_tabs) {
557
+ this.indent_char = '\t';
558
+
559
+ // indent_size behavior changed after 1.8.6
560
+ // It used to be that indent_size would be
561
+ // set to 1 for indent_with_tabs. That is no longer needed and
562
+ // actually doesn't make sense - why not use spaces? Further,
563
+ // that might produce unexpected behavior - tabs being used
564
+ // for single-column alignment. So, when indent_with_tabs is true
565
+ // and indent_size is 1, reset indent_size to 4.
566
+ if (this.indent_size === 1) {
567
+ this.indent_size = 4;
568
+ }
569
+ }
570
+
571
+ // Backwards compat with 1.3.x
572
+ this.wrap_line_length = this._get_number('wrap_line_length', this._get_number('max_char'));
573
+
574
+ this.indent_empty_lines = this._get_boolean('indent_empty_lines');
575
+
576
+ // valid templating languages ['django', 'erb', 'handlebars', 'php', 'smarty']
577
+ // For now, 'auto' = all off for javascript, all on for html (and inline javascript).
578
+ // other values ignored
579
+ this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php', 'smarty'], ['auto']);
580
+ }
581
+
582
+ Options.prototype._get_array = function(name, default_value) {
583
+ var option_value = this.raw_options[name];
584
+ var result = default_value || [];
585
+ if (typeof option_value === 'object') {
586
+ if (option_value !== null && typeof option_value.concat === 'function') {
587
+ result = option_value.concat();
588
+ }
589
+ } else if (typeof option_value === 'string') {
590
+ result = option_value.split(/[^a-zA-Z0-9_\/\-]+/);
591
+ }
592
+ return result;
593
+ };
594
+
595
+ Options.prototype._get_boolean = function(name, default_value) {
596
+ var option_value = this.raw_options[name];
597
+ var result = option_value === undefined ? !!default_value : !!option_value;
598
+ return result;
599
+ };
600
+
601
+ Options.prototype._get_characters = function(name, default_value) {
602
+ var option_value = this.raw_options[name];
603
+ var result = default_value || '';
604
+ if (typeof option_value === 'string') {
605
+ result = option_value.replace(/\\r/, '\r').replace(/\\n/, '\n').replace(/\\t/, '\t');
606
+ }
607
+ return result;
608
+ };
609
+
610
+ Options.prototype._get_number = function(name, default_value) {
611
+ var option_value = this.raw_options[name];
612
+ default_value = parseInt(default_value, 10);
613
+ if (isNaN(default_value)) {
614
+ default_value = 0;
615
+ }
616
+ var result = parseInt(option_value, 10);
617
+ if (isNaN(result)) {
618
+ result = default_value;
619
+ }
620
+ return result;
621
+ };
622
+
623
+ Options.prototype._get_selection = function(name, selection_list, default_value) {
624
+ var result = this._get_selection_list(name, selection_list, default_value);
625
+ if (result.length !== 1) {
626
+ throw new Error(
627
+ "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" +
628
+ selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
629
+ }
630
+
631
+ return result[0];
632
+ };
633
+
634
+
635
+ Options.prototype._get_selection_list = function(name, selection_list, default_value) {
636
+ if (!selection_list || selection_list.length === 0) {
637
+ throw new Error("Selection list cannot be empty.");
638
+ }
639
+
640
+ default_value = default_value || [selection_list[0]];
641
+ if (!this._is_valid_selection(default_value, selection_list)) {
642
+ throw new Error("Invalid Default Value!");
643
+ }
644
+
645
+ var result = this._get_array(name, default_value);
646
+ if (!this._is_valid_selection(result, selection_list)) {
647
+ throw new Error(
648
+ "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" +
649
+ selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
650
+ }
651
+
652
+ return result;
653
+ };
654
+
655
+ Options.prototype._is_valid_selection = function(result, selection_list) {
656
+ return result.length && selection_list.length &&
657
+ !result.some(function(item) { return selection_list.indexOf(item) === -1; });
658
+ };
659
+
660
+
661
+ // merges child options up with the parent options object
662
+ // Example: obj = {a: 1, b: {a: 2}}
663
+ // mergeOpts(obj, 'b')
664
+ //
665
+ // Returns: {a: 2}
666
+ function _mergeOpts(allOptions, childFieldName) {
667
+ var finalOpts = {};
668
+ allOptions = _normalizeOpts(allOptions);
669
+ var name;
670
+
671
+ for (name in allOptions) {
672
+ if (name !== childFieldName) {
673
+ finalOpts[name] = allOptions[name];
674
+ }
675
+ }
676
+
677
+ //merge in the per type settings for the childFieldName
678
+ if (childFieldName && allOptions[childFieldName]) {
679
+ for (name in allOptions[childFieldName]) {
680
+ finalOpts[name] = allOptions[childFieldName][name];
681
+ }
682
+ }
683
+ return finalOpts;
684
+ }
685
+
686
+ function _normalizeOpts(options) {
687
+ var convertedOpts = {};
688
+ var key;
689
+
690
+ for (key in options) {
691
+ var newKey = key.replace(/-/g, "_");
692
+ convertedOpts[newKey] = options[key];
693
+ }
694
+ return convertedOpts;
695
+ }
696
+
697
+ module.exports.Options = Options;
698
+ module.exports.normalizeOpts = _normalizeOpts;
699
+ module.exports.mergeOpts = _mergeOpts;
700
+
701
+
702
+ /***/ }),
703
+ /* 7 */,
704
+ /* 8 */
705
+ /***/ (function(module) {
706
+
707
+ /*jshint node:true */
708
+ /*
709
+
710
+ The MIT License (MIT)
711
+
712
+ Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
713
+
714
+ Permission is hereby granted, free of charge, to any person
715
+ obtaining a copy of this software and associated documentation files
716
+ (the "Software"), to deal in the Software without restriction,
717
+ including without limitation the rights to use, copy, modify, merge,
718
+ publish, distribute, sublicense, and/or sell copies of the Software,
719
+ and to permit persons to whom the Software is furnished to do so,
720
+ subject to the following conditions:
721
+
722
+ The above copyright notice and this permission notice shall be
723
+ included in all copies or substantial portions of the Software.
724
+
725
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
726
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
727
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
728
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
729
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
730
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
731
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
732
+ SOFTWARE.
733
+ */
734
+
735
+
736
+
737
+ var regexp_has_sticky = RegExp.prototype.hasOwnProperty('sticky');
738
+
739
+ function InputScanner(input_string) {
740
+ this.__input = input_string || '';
741
+ this.__input_length = this.__input.length;
742
+ this.__position = 0;
743
+ }
744
+
745
+ InputScanner.prototype.restart = function() {
746
+ this.__position = 0;
747
+ };
748
+
749
+ InputScanner.prototype.back = function() {
750
+ if (this.__position > 0) {
751
+ this.__position -= 1;
752
+ }
753
+ };
754
+
755
+ InputScanner.prototype.hasNext = function() {
756
+ return this.__position < this.__input_length;
757
+ };
758
+
759
+ InputScanner.prototype.next = function() {
760
+ var val = null;
761
+ if (this.hasNext()) {
762
+ val = this.__input.charAt(this.__position);
763
+ this.__position += 1;
764
+ }
765
+ return val;
766
+ };
767
+
768
+ InputScanner.prototype.peek = function(index) {
769
+ var val = null;
770
+ index = index || 0;
771
+ index += this.__position;
772
+ if (index >= 0 && index < this.__input_length) {
773
+ val = this.__input.charAt(index);
774
+ }
775
+ return val;
776
+ };
777
+
778
+ // This is a JavaScript only helper function (not in python)
779
+ // Javascript doesn't have a match method
780
+ // and not all implementation support "sticky" flag.
781
+ // If they do not support sticky then both this.match() and this.test() method
782
+ // must get the match and check the index of the match.
783
+ // If sticky is supported and set, this method will use it.
784
+ // Otherwise it will check that global is set, and fall back to the slower method.
785
+ InputScanner.prototype.__match = function(pattern, index) {
786
+ pattern.lastIndex = index;
787
+ var pattern_match = pattern.exec(this.__input);
788
+
789
+ if (pattern_match && !(regexp_has_sticky && pattern.sticky)) {
790
+ if (pattern_match.index !== index) {
791
+ pattern_match = null;
792
+ }
793
+ }
794
+
795
+ return pattern_match;
796
+ };
797
+
798
+ InputScanner.prototype.test = function(pattern, index) {
799
+ index = index || 0;
800
+ index += this.__position;
801
+
802
+ if (index >= 0 && index < this.__input_length) {
803
+ return !!this.__match(pattern, index);
804
+ } else {
805
+ return false;
806
+ }
807
+ };
808
+
809
+ InputScanner.prototype.testChar = function(pattern, index) {
810
+ // test one character regex match
811
+ var val = this.peek(index);
812
+ pattern.lastIndex = 0;
813
+ return val !== null && pattern.test(val);
814
+ };
815
+
816
+ InputScanner.prototype.match = function(pattern) {
817
+ var pattern_match = this.__match(pattern, this.__position);
818
+ if (pattern_match) {
819
+ this.__position += pattern_match[0].length;
820
+ } else {
821
+ pattern_match = null;
822
+ }
823
+ return pattern_match;
824
+ };
825
+
826
+ InputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) {
827
+ var val = '';
828
+ var match;
829
+ if (starting_pattern) {
830
+ match = this.match(starting_pattern);
831
+ if (match) {
832
+ val += match[0];
833
+ }
834
+ }
835
+ if (until_pattern && (match || !starting_pattern)) {
836
+ val += this.readUntil(until_pattern, until_after);
837
+ }
838
+ return val;
839
+ };
840
+
841
+ InputScanner.prototype.readUntil = function(pattern, until_after) {
842
+ var val = '';
843
+ var match_index = this.__position;
844
+ pattern.lastIndex = this.__position;
845
+ var pattern_match = pattern.exec(this.__input);
846
+ if (pattern_match) {
847
+ match_index = pattern_match.index;
848
+ if (until_after) {
849
+ match_index += pattern_match[0].length;
850
+ }
851
+ } else {
852
+ match_index = this.__input_length;
853
+ }
854
+
855
+ val = this.__input.substring(this.__position, match_index);
856
+ this.__position = match_index;
857
+ return val;
858
+ };
859
+
860
+ InputScanner.prototype.readUntilAfter = function(pattern) {
861
+ return this.readUntil(pattern, true);
862
+ };
863
+
864
+ InputScanner.prototype.get_regexp = function(pattern, match_from) {
865
+ var result = null;
866
+ var flags = 'g';
867
+ if (match_from && regexp_has_sticky) {
868
+ flags = 'y';
869
+ }
870
+ // strings are converted to regexp
871
+ if (typeof pattern === "string" && pattern !== '') {
872
+ // result = new RegExp(pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), flags);
873
+ result = new RegExp(pattern, flags);
874
+ } else if (pattern) {
875
+ result = new RegExp(pattern.source, flags);
876
+ }
877
+ return result;
878
+ };
879
+
880
+ InputScanner.prototype.get_literal_regexp = function(literal_string) {
881
+ return RegExp(literal_string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'));
882
+ };
883
+
884
+ /* css beautifier legacy helpers */
885
+ InputScanner.prototype.peekUntilAfter = function(pattern) {
886
+ var start = this.__position;
887
+ var val = this.readUntilAfter(pattern);
888
+ this.__position = start;
889
+ return val;
890
+ };
891
+
892
+ InputScanner.prototype.lookBack = function(testVal) {
893
+ var start = this.__position - 1;
894
+ return start >= testVal.length && this.__input.substring(start - testVal.length, start)
895
+ .toLowerCase() === testVal;
896
+ };
897
+
898
+ module.exports.InputScanner = InputScanner;
899
+
900
+
901
+ /***/ }),
902
+ /* 9 */,
903
+ /* 10 */,
904
+ /* 11 */,
905
+ /* 12 */,
906
+ /* 13 */
907
+ /***/ (function(module) {
908
+
909
+ /*jshint node:true */
910
+ /*
911
+
912
+ The MIT License (MIT)
913
+
914
+ Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
915
+
916
+ Permission is hereby granted, free of charge, to any person
917
+ obtaining a copy of this software and associated documentation files
918
+ (the "Software"), to deal in the Software without restriction,
919
+ including without limitation the rights to use, copy, modify, merge,
920
+ publish, distribute, sublicense, and/or sell copies of the Software,
921
+ and to permit persons to whom the Software is furnished to do so,
922
+ subject to the following conditions:
923
+
924
+ The above copyright notice and this permission notice shall be
925
+ included in all copies or substantial portions of the Software.
926
+
927
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
928
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
929
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
930
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
931
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
932
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
933
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
934
+ SOFTWARE.
935
+ */
936
+
937
+
938
+
939
+ function Directives(start_block_pattern, end_block_pattern) {
940
+ start_block_pattern = typeof start_block_pattern === 'string' ? start_block_pattern : start_block_pattern.source;
941
+ end_block_pattern = typeof end_block_pattern === 'string' ? end_block_pattern : end_block_pattern.source;
942
+ this.__directives_block_pattern = new RegExp(start_block_pattern + / beautify( \w+[:]\w+)+ /.source + end_block_pattern, 'g');
943
+ this.__directive_pattern = / (\w+)[:](\w+)/g;
944
+
945
+ this.__directives_end_ignore_pattern = new RegExp(start_block_pattern + /\sbeautify\signore:end\s/.source + end_block_pattern, 'g');
946
+ }
947
+
948
+ Directives.prototype.get_directives = function(text) {
949
+ if (!text.match(this.__directives_block_pattern)) {
950
+ return null;
951
+ }
952
+
953
+ var directives = {};
954
+ this.__directive_pattern.lastIndex = 0;
955
+ var directive_match = this.__directive_pattern.exec(text);
956
+
957
+ while (directive_match) {
958
+ directives[directive_match[1]] = directive_match[2];
959
+ directive_match = this.__directive_pattern.exec(text);
960
+ }
961
+
962
+ return directives;
963
+ };
964
+
965
+ Directives.prototype.readIgnored = function(input) {
966
+ return input.readUntilAfter(this.__directives_end_ignore_pattern);
967
+ };
968
+
969
+
970
+ module.exports.Directives = Directives;
971
+
972
+
973
+ /***/ }),
974
+ /* 14 */,
975
+ /* 15 */
976
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
977
+
978
+ /*jshint node:true */
979
+ /*
980
+
981
+ The MIT License (MIT)
982
+
983
+ Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
984
+
985
+ Permission is hereby granted, free of charge, to any person
986
+ obtaining a copy of this software and associated documentation files
987
+ (the "Software"), to deal in the Software without restriction,
988
+ including without limitation the rights to use, copy, modify, merge,
989
+ publish, distribute, sublicense, and/or sell copies of the Software,
990
+ and to permit persons to whom the Software is furnished to do so,
991
+ subject to the following conditions:
992
+
993
+ The above copyright notice and this permission notice shall be
994
+ included in all copies or substantial portions of the Software.
995
+
996
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
997
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
998
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
999
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
1000
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
1001
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1002
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1003
+ SOFTWARE.
1004
+ */
1005
+
1006
+
1007
+
1008
+ var Beautifier = __webpack_require__(16).Beautifier,
1009
+ Options = __webpack_require__(17).Options;
1010
+
1011
+ function css_beautify(source_text, options) {
1012
+ var beautifier = new Beautifier(source_text, options);
1013
+ return beautifier.beautify();
1014
+ }
1015
+
1016
+ module.exports = css_beautify;
1017
+ module.exports.defaultOptions = function() {
1018
+ return new Options();
1019
+ };
1020
+
1021
+
1022
+ /***/ }),
1023
+ /* 16 */
1024
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1025
+
1026
+ /*jshint node:true */
1027
+ /*
1028
+
1029
+ The MIT License (MIT)
1030
+
1031
+ Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
1032
+
1033
+ Permission is hereby granted, free of charge, to any person
1034
+ obtaining a copy of this software and associated documentation files
1035
+ (the "Software"), to deal in the Software without restriction,
1036
+ including without limitation the rights to use, copy, modify, merge,
1037
+ publish, distribute, sublicense, and/or sell copies of the Software,
1038
+ and to permit persons to whom the Software is furnished to do so,
1039
+ subject to the following conditions:
1040
+
1041
+ The above copyright notice and this permission notice shall be
1042
+ included in all copies or substantial portions of the Software.
1043
+
1044
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1045
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1046
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1047
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
1048
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
1049
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1050
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1051
+ SOFTWARE.
1052
+ */
1053
+
1054
+
1055
+
1056
+ var Options = __webpack_require__(17).Options;
1057
+ var Output = __webpack_require__(2).Output;
1058
+ var InputScanner = __webpack_require__(8).InputScanner;
1059
+ var Directives = __webpack_require__(13).Directives;
1060
+
1061
+ var directives_core = new Directives(/\/\*/, /\*\//);
1062
+
1063
+ var lineBreak = /\r\n|[\r\n]/;
1064
+ var allLineBreaks = /\r\n|[\r\n]/g;
1065
+
1066
+ // tokenizer
1067
+ var whitespaceChar = /\s/;
1068
+ var whitespacePattern = /(?:\s|\n)+/g;
1069
+ var block_comment_pattern = /\/\*(?:[\s\S]*?)((?:\*\/)|$)/g;
1070
+ var comment_pattern = /\/\/(?:[^\n\r\u2028\u2029]*)/g;
1071
+
1072
+ function Beautifier(source_text, options) {
1073
+ this._source_text = source_text || '';
1074
+ // Allow the setting of language/file-type specific options
1075
+ // with inheritance of overall settings
1076
+ this._options = new Options(options);
1077
+ this._ch = null;
1078
+ this._input = null;
1079
+
1080
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule
1081
+ this.NESTED_AT_RULE = {
1082
+ "@page": true,
1083
+ "@font-face": true,
1084
+ "@keyframes": true,
1085
+ // also in CONDITIONAL_GROUP_RULE below
1086
+ "@media": true,
1087
+ "@supports": true,
1088
+ "@document": true
1089
+ };
1090
+ this.CONDITIONAL_GROUP_RULE = {
1091
+ "@media": true,
1092
+ "@supports": true,
1093
+ "@document": true
1094
+ };
1095
+
1096
+ }
1097
+
1098
+ Beautifier.prototype.eatString = function(endChars) {
1099
+ var result = '';
1100
+ this._ch = this._input.next();
1101
+ while (this._ch) {
1102
+ result += this._ch;
1103
+ if (this._ch === "\\") {
1104
+ result += this._input.next();
1105
+ } else if (endChars.indexOf(this._ch) !== -1 || this._ch === "\n") {
1106
+ break;
1107
+ }
1108
+ this._ch = this._input.next();
1109
+ }
1110
+ return result;
1111
+ };
1112
+
1113
+ // Skips any white space in the source text from the current position.
1114
+ // When allowAtLeastOneNewLine is true, will output new lines for each
1115
+ // newline character found; if the user has preserve_newlines off, only
1116
+ // the first newline will be output
1117
+ Beautifier.prototype.eatWhitespace = function(allowAtLeastOneNewLine) {
1118
+ var result = whitespaceChar.test(this._input.peek());
1119
+ var newline_count = 0;
1120
+ while (whitespaceChar.test(this._input.peek())) {
1121
+ this._ch = this._input.next();
1122
+ if (allowAtLeastOneNewLine && this._ch === '\n') {
1123
+ if (newline_count === 0 || newline_count < this._options.max_preserve_newlines) {
1124
+ newline_count++;
1125
+ this._output.add_new_line(true);
1126
+ }
1127
+ }
1128
+ }
1129
+ return result;
1130
+ };
1131
+
1132
+ // Nested pseudo-class if we are insideRule
1133
+ // and the next special character found opens
1134
+ // a new block
1135
+ Beautifier.prototype.foundNestedPseudoClass = function() {
1136
+ var openParen = 0;
1137
+ var i = 1;
1138
+ var ch = this._input.peek(i);
1139
+ while (ch) {
1140
+ if (ch === "{") {
1141
+ return true;
1142
+ } else if (ch === '(') {
1143
+ // pseudoclasses can contain ()
1144
+ openParen += 1;
1145
+ } else if (ch === ')') {
1146
+ if (openParen === 0) {
1147
+ return false;
1148
+ }
1149
+ openParen -= 1;
1150
+ } else if (ch === ";" || ch === "}") {
1151
+ return false;
1152
+ }
1153
+ i++;
1154
+ ch = this._input.peek(i);
1155
+ }
1156
+ return false;
1157
+ };
1158
+
1159
+ Beautifier.prototype.print_string = function(output_string) {
1160
+ this._output.set_indent(this._indentLevel);
1161
+ this._output.non_breaking_space = true;
1162
+ this._output.add_token(output_string);
1163
+ };
1164
+
1165
+ Beautifier.prototype.preserveSingleSpace = function(isAfterSpace) {
1166
+ if (isAfterSpace) {
1167
+ this._output.space_before_token = true;
1168
+ }
1169
+ };
1170
+
1171
+ Beautifier.prototype.indent = function() {
1172
+ this._indentLevel++;
1173
+ };
1174
+
1175
+ Beautifier.prototype.outdent = function() {
1176
+ if (this._indentLevel > 0) {
1177
+ this._indentLevel--;
1178
+ }
1179
+ };
1180
+
1181
+ /*_____________________--------------------_____________________*/
1182
+
1183
+ Beautifier.prototype.beautify = function() {
1184
+ if (this._options.disabled) {
1185
+ return this._source_text;
1186
+ }
1187
+
1188
+ var source_text = this._source_text;
1189
+ var eol = this._options.eol;
1190
+ if (eol === 'auto') {
1191
+ eol = '\n';
1192
+ if (source_text && lineBreak.test(source_text || '')) {
1193
+ eol = source_text.match(lineBreak)[0];
1194
+ }
1195
+ }
1196
+
1197
+
1198
+ // HACK: newline parsing inconsistent. This brute force normalizes the this._input.
1199
+ source_text = source_text.replace(allLineBreaks, '\n');
1200
+
1201
+ // reset
1202
+ var baseIndentString = source_text.match(/^[\t ]*/)[0];
1203
+
1204
+ this._output = new Output(this._options, baseIndentString);
1205
+ this._input = new InputScanner(source_text);
1206
+ this._indentLevel = 0;
1207
+ this._nestedLevel = 0;
1208
+
1209
+ this._ch = null;
1210
+ var parenLevel = 0;
1211
+
1212
+ var insideRule = false;
1213
+ // This is the value side of a property value pair (blue in the following ex)
1214
+ // label { content: blue }
1215
+ var insidePropertyValue = false;
1216
+ var enteringConditionalGroup = false;
1217
+ var insideAtExtend = false;
1218
+ var insideAtImport = false;
1219
+ var topCharacter = this._ch;
1220
+ var whitespace;
1221
+ var isAfterSpace;
1222
+ var previous_ch;
1223
+
1224
+ while (true) {
1225
+ whitespace = this._input.read(whitespacePattern);
1226
+ isAfterSpace = whitespace !== '';
1227
+ previous_ch = topCharacter;
1228
+ this._ch = this._input.next();
1229
+ if (this._ch === '\\' && this._input.hasNext()) {
1230
+ this._ch += this._input.next();
1231
+ }
1232
+ topCharacter = this._ch;
1233
+
1234
+ if (!this._ch) {
1235
+ break;
1236
+ } else if (this._ch === '/' && this._input.peek() === '*') {
1237
+ // /* css comment */
1238
+ // Always start block comments on a new line.
1239
+ // This handles scenarios where a block comment immediately
1240
+ // follows a property definition on the same line or where
1241
+ // minified code is being beautified.
1242
+ this._output.add_new_line();
1243
+ this._input.back();
1244
+
1245
+ var comment = this._input.read(block_comment_pattern);
1246
+
1247
+ // Handle ignore directive
1248
+ var directives = directives_core.get_directives(comment);
1249
+ if (directives && directives.ignore === 'start') {
1250
+ comment += directives_core.readIgnored(this._input);
1251
+ }
1252
+
1253
+ this.print_string(comment);
1254
+
1255
+ // Ensures any new lines following the comment are preserved
1256
+ this.eatWhitespace(true);
1257
+
1258
+ // Block comments are followed by a new line so they don't
1259
+ // share a line with other properties
1260
+ this._output.add_new_line();
1261
+ } else if (this._ch === '/' && this._input.peek() === '/') {
1262
+ // // single line comment
1263
+ // Preserves the space before a comment
1264
+ // on the same line as a rule
1265
+ this._output.space_before_token = true;
1266
+ this._input.back();
1267
+ this.print_string(this._input.read(comment_pattern));
1268
+
1269
+ // Ensures any new lines following the comment are preserved
1270
+ this.eatWhitespace(true);
1271
+ } else if (this._ch === '@') {
1272
+ this.preserveSingleSpace(isAfterSpace);
1273
+
1274
+ // deal with less propery mixins @{...}
1275
+ if (this._input.peek() === '{') {
1276
+ this.print_string(this._ch + this.eatString('}'));
1277
+ } else {
1278
+ this.print_string(this._ch);
1279
+
1280
+ // strip trailing space, if present, for hash property checks
1281
+ var variableOrRule = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
1282
+
1283
+ if (variableOrRule.match(/[ :]$/)) {
1284
+ // we have a variable or pseudo-class, add it and insert one space before continuing
1285
+ variableOrRule = this.eatString(": ").replace(/\s$/, '');
1286
+ this.print_string(variableOrRule);
1287
+ this._output.space_before_token = true;
1288
+ }
1289
+
1290
+ variableOrRule = variableOrRule.replace(/\s$/, '');
1291
+
1292
+ if (variableOrRule === 'extend') {
1293
+ insideAtExtend = true;
1294
+ } else if (variableOrRule === 'import') {
1295
+ insideAtImport = true;
1296
+ }
1297
+
1298
+ // might be a nesting at-rule
1299
+ if (variableOrRule in this.NESTED_AT_RULE) {
1300
+ this._nestedLevel += 1;
1301
+ if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {
1302
+ enteringConditionalGroup = true;
1303
+ }
1304
+ // might be less variable
1305
+ } else if (!insideRule && parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
1306
+ insidePropertyValue = true;
1307
+ this.indent();
1308
+ }
1309
+ }
1310
+ } else if (this._ch === '#' && this._input.peek() === '{') {
1311
+ this.preserveSingleSpace(isAfterSpace);
1312
+ this.print_string(this._ch + this.eatString('}'));
1313
+ } else if (this._ch === '{') {
1314
+ if (insidePropertyValue) {
1315
+ insidePropertyValue = false;
1316
+ this.outdent();
1317
+ }
1318
+
1319
+ // when entering conditional groups, only rulesets are allowed
1320
+ if (enteringConditionalGroup) {
1321
+ enteringConditionalGroup = false;
1322
+ insideRule = (this._indentLevel >= this._nestedLevel);
1323
+ } else {
1324
+ // otherwise, declarations are also allowed
1325
+ insideRule = (this._indentLevel >= this._nestedLevel - 1);
1326
+ }
1327
+ if (this._options.newline_between_rules && insideRule) {
1328
+ if (this._output.previous_line && this._output.previous_line.item(-1) !== '{') {
1329
+ this._output.ensure_empty_line_above('/', ',');
1330
+ }
1331
+ }
1332
+
1333
+ this._output.space_before_token = true;
1334
+
1335
+ // The difference in print_string and indent order is necessary to indent the '{' correctly
1336
+ if (this._options.brace_style === 'expand') {
1337
+ this._output.add_new_line();
1338
+ this.print_string(this._ch);
1339
+ this.indent();
1340
+ this._output.set_indent(this._indentLevel);
1341
+ } else {
1342
+ this.indent();
1343
+ this.print_string(this._ch);
1344
+ }
1345
+
1346
+ this.eatWhitespace(true);
1347
+ this._output.add_new_line();
1348
+ } else if (this._ch === '}') {
1349
+ this.outdent();
1350
+ this._output.add_new_line();
1351
+ if (previous_ch === '{') {
1352
+ this._output.trim(true);
1353
+ }
1354
+ insideAtImport = false;
1355
+ insideAtExtend = false;
1356
+ if (insidePropertyValue) {
1357
+ this.outdent();
1358
+ insidePropertyValue = false;
1359
+ }
1360
+ this.print_string(this._ch);
1361
+ insideRule = false;
1362
+ if (this._nestedLevel) {
1363
+ this._nestedLevel--;
1364
+ }
1365
+
1366
+ this.eatWhitespace(true);
1367
+ this._output.add_new_line();
1368
+
1369
+ if (this._options.newline_between_rules && !this._output.just_added_blankline()) {
1370
+ if (this._input.peek() !== '}') {
1371
+ this._output.add_new_line(true);
1372
+ }
1373
+ }
1374
+ } else if (this._ch === ":") {
1375
+ if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
1376
+ // 'property: value' delimiter
1377
+ // which could be in a conditional group query
1378
+ this.print_string(':');
1379
+ if (!insidePropertyValue) {
1380
+ insidePropertyValue = true;
1381
+ this._output.space_before_token = true;
1382
+ this.eatWhitespace(true);
1383
+ this.indent();
1384
+ }
1385
+ } else {
1386
+ // sass/less parent reference don't use a space
1387
+ // sass nested pseudo-class don't use a space
1388
+
1389
+ // preserve space before pseudoclasses/pseudoelements, as it means "in any child"
1390
+ if (this._input.lookBack(" ")) {
1391
+ this._output.space_before_token = true;
1392
+ }
1393
+ if (this._input.peek() === ":") {
1394
+ // pseudo-element
1395
+ this._ch = this._input.next();
1396
+ this.print_string("::");
1397
+ } else {
1398
+ // pseudo-class
1399
+ this.print_string(':');
1400
+ }
1401
+ }
1402
+ } else if (this._ch === '"' || this._ch === '\'') {
1403
+ this.preserveSingleSpace(isAfterSpace);
1404
+ this.print_string(this._ch + this.eatString(this._ch));
1405
+ this.eatWhitespace(true);
1406
+ } else if (this._ch === ';') {
1407
+ if (parenLevel === 0) {
1408
+ if (insidePropertyValue) {
1409
+ this.outdent();
1410
+ insidePropertyValue = false;
1411
+ }
1412
+ insideAtExtend = false;
1413
+ insideAtImport = false;
1414
+ this.print_string(this._ch);
1415
+ this.eatWhitespace(true);
1416
+
1417
+ // This maintains single line comments on the same
1418
+ // line. Block comments are also affected, but
1419
+ // a new line is always output before one inside
1420
+ // that section
1421
+ if (this._input.peek() !== '/') {
1422
+ this._output.add_new_line();
1423
+ }
1424
+ } else {
1425
+ this.print_string(this._ch);
1426
+ this.eatWhitespace(true);
1427
+ this._output.space_before_token = true;
1428
+ }
1429
+ } else if (this._ch === '(') { // may be a url
1430
+ if (this._input.lookBack("url")) {
1431
+ this.print_string(this._ch);
1432
+ this.eatWhitespace();
1433
+ parenLevel++;
1434
+ this.indent();
1435
+ this._ch = this._input.next();
1436
+ if (this._ch === ')' || this._ch === '"' || this._ch === '\'') {
1437
+ this._input.back();
1438
+ } else if (this._ch) {
1439
+ this.print_string(this._ch + this.eatString(')'));
1440
+ if (parenLevel) {
1441
+ parenLevel--;
1442
+ this.outdent();
1443
+ }
1444
+ }
1445
+ } else {
1446
+ this.preserveSingleSpace(isAfterSpace);
1447
+ this.print_string(this._ch);
1448
+ this.eatWhitespace();
1449
+ parenLevel++;
1450
+ this.indent();
1451
+ }
1452
+ } else if (this._ch === ')') {
1453
+ if (parenLevel) {
1454
+ parenLevel--;
1455
+ this.outdent();
1456
+ }
1457
+ this.print_string(this._ch);
1458
+ } else if (this._ch === ',') {
1459
+ this.print_string(this._ch);
1460
+ this.eatWhitespace(true);
1461
+ if (this._options.selector_separator_newline && !insidePropertyValue && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
1462
+ this._output.add_new_line();
1463
+ } else {
1464
+ this._output.space_before_token = true;
1465
+ }
1466
+ } else if ((this._ch === '>' || this._ch === '+' || this._ch === '~') && !insidePropertyValue && parenLevel === 0) {
1467
+ //handle combinator spacing
1468
+ if (this._options.space_around_combinator) {
1469
+ this._output.space_before_token = true;
1470
+ this.print_string(this._ch);
1471
+ this._output.space_before_token = true;
1472
+ } else {
1473
+ this.print_string(this._ch);
1474
+ this.eatWhitespace();
1475
+ // squash extra whitespace
1476
+ if (this._ch && whitespaceChar.test(this._ch)) {
1477
+ this._ch = '';
1478
+ }
1479
+ }
1480
+ } else if (this._ch === ']') {
1481
+ this.print_string(this._ch);
1482
+ } else if (this._ch === '[') {
1483
+ this.preserveSingleSpace(isAfterSpace);
1484
+ this.print_string(this._ch);
1485
+ } else if (this._ch === '=') { // no whitespace before or after
1486
+ this.eatWhitespace();
1487
+ this.print_string('=');
1488
+ if (whitespaceChar.test(this._ch)) {
1489
+ this._ch = '';
1490
+ }
1491
+ } else if (this._ch === '!' && !this._input.lookBack("\\")) { // !important
1492
+ this.print_string(' ');
1493
+ this.print_string(this._ch);
1494
+ } else {
1495
+ this.preserveSingleSpace(isAfterSpace);
1496
+ this.print_string(this._ch);
1497
+ }
1498
+ }
1499
+
1500
+ var sweetCode = this._output.get_code(eol);
1501
+
1502
+ return sweetCode;
1503
+ };
1504
+
1505
+ module.exports.Beautifier = Beautifier;
1506
+
1507
+
1508
+ /***/ }),
1509
+ /* 17 */
1510
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1511
+
1512
+ /*jshint node:true */
1513
+ /*
1514
+
1515
+ The MIT License (MIT)
1516
+
1517
+ Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
1518
+
1519
+ Permission is hereby granted, free of charge, to any person
1520
+ obtaining a copy of this software and associated documentation files
1521
+ (the "Software"), to deal in the Software without restriction,
1522
+ including without limitation the rights to use, copy, modify, merge,
1523
+ publish, distribute, sublicense, and/or sell copies of the Software,
1524
+ and to permit persons to whom the Software is furnished to do so,
1525
+ subject to the following conditions:
1526
+
1527
+ The above copyright notice and this permission notice shall be
1528
+ included in all copies or substantial portions of the Software.
1529
+
1530
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1531
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1532
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1533
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
1534
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
1535
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1536
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1537
+ SOFTWARE.
1538
+ */
1539
+
1540
+
1541
+
1542
+ var BaseOptions = __webpack_require__(6).Options;
1543
+
1544
+ function Options(options) {
1545
+ BaseOptions.call(this, options, 'css');
1546
+
1547
+ this.selector_separator_newline = this._get_boolean('selector_separator_newline', true);
1548
+ this.newline_between_rules = this._get_boolean('newline_between_rules', true);
1549
+ var space_around_selector_separator = this._get_boolean('space_around_selector_separator');
1550
+ this.space_around_combinator = this._get_boolean('space_around_combinator') || space_around_selector_separator;
1551
+
1552
+ var brace_style_split = this._get_selection_list('brace_style', ['collapse', 'expand', 'end-expand', 'none', 'preserve-inline']);
1553
+ this.brace_style = 'collapse';
1554
+ for (var bs = 0; bs < brace_style_split.length; bs++) {
1555
+ if (brace_style_split[bs] !== 'expand') {
1556
+ // default to collapse, as only collapse|expand is implemented for now
1557
+ this.brace_style = 'collapse';
1558
+ } else {
1559
+ this.brace_style = brace_style_split[bs];
1560
+ }
1561
+ }
1562
+ }
1563
+ Options.prototype = new BaseOptions();
1564
+
1565
+
1566
+
1567
+ module.exports.Options = Options;
1568
+
1569
+
1570
+ /***/ })
1571
+ /******/ ]);
1572
+ /************************************************************************/
1573
+ /******/ // The module cache
1574
+ /******/ var __webpack_module_cache__ = {};
1575
+ /******/
1576
+ /******/ // The require function
1577
+ /******/ function __webpack_require__(moduleId) {
1578
+ /******/ // Check if module is in cache
1579
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
1580
+ /******/ if (cachedModule !== undefined) {
1581
+ /******/ return cachedModule.exports;
1582
+ /******/ }
1583
+ /******/ // Create a new module (and put it into the cache)
1584
+ /******/ var module = __webpack_module_cache__[moduleId] = {
1585
+ /******/ // no module.id needed
1586
+ /******/ // no module.loaded needed
1587
+ /******/ exports: {}
1588
+ /******/ };
1589
+ /******/
1590
+ /******/ // Execute the module function
1591
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1592
+ /******/
1593
+ /******/ // Return the exports of the module
1594
+ /******/ return module.exports;
1595
+ /******/ }
1596
+ /******/
1597
+ /************************************************************************/
1598
+ /******/
1599
+ /******/ // startup
1600
+ /******/ // Load entry module and return exports
1601
+ /******/ // This entry module is referenced by other modules so it can't be inlined
1602
+ /******/ var __webpack_exports__ = __webpack_require__(15);
1603
+ /******/ legacy_beautify_css = __webpack_exports__;
1604
+ /******/
1605
+ /******/ })()
1606
+ ;
1607
+ var css_beautify = legacy_beautify_css;
1608
+ /* Footer */
1609
+ if (typeof define === "function" && define.amd) {
1610
+ // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
1611
+ define([], function() {
1612
+ return {
1613
+ css_beautify: css_beautify
1614
+ };
1615
+ });
1616
+ } else if (typeof exports !== "undefined") {
1617
+ // Add support for CommonJS. Just put this file somewhere on your require.paths
1618
+ // and you will be able to `var html_beautify = require("beautify").html_beautify`.
1619
+ exports.css_beautify = css_beautify;
1620
+ } else if (typeof window !== "undefined") {
1621
+ // If we're running a web page and don't have either of the above, add our one global
1622
+ window.css_beautify = css_beautify;
1623
+ } else if (typeof global !== "undefined") {
1624
+ // If we don't even have window, try global.
1625
+ global.css_beautify = css_beautify;
1626
+ }
1627
+
1628
+ }());