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