1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | module.exports = function (cssWithMappingToString) {
|
8 | var list = [];
|
9 |
|
10 | list.toString = function toString() {
|
11 | return this.map(function (item) {
|
12 | var content = "";
|
13 | var needLayer = typeof item[5] !== "undefined";
|
14 |
|
15 | if (item[4]) {
|
16 | content += "@supports (".concat(item[4], ") {");
|
17 | }
|
18 |
|
19 | if (item[2]) {
|
20 | content += "@media ".concat(item[2], " {");
|
21 | }
|
22 |
|
23 | if (needLayer) {
|
24 | content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
|
25 | }
|
26 |
|
27 | content += cssWithMappingToString(item);
|
28 |
|
29 | if (needLayer) {
|
30 | content += "}";
|
31 | }
|
32 |
|
33 | if (item[2]) {
|
34 | content += "}";
|
35 | }
|
36 |
|
37 | if (item[4]) {
|
38 | content += "}";
|
39 | }
|
40 |
|
41 | return content;
|
42 | }).join("");
|
43 | };
|
44 |
|
45 |
|
46 | list.i = function i(modules, media, dedupe, supports, layer) {
|
47 | if (typeof modules === "string") {
|
48 | modules = [[null, modules, undefined]];
|
49 | }
|
50 |
|
51 | var alreadyImportedModules = {};
|
52 |
|
53 | if (dedupe) {
|
54 | for (var _i = 0; _i < this.length; _i++) {
|
55 | var id = this[_i][0];
|
56 |
|
57 | if (id != null) {
|
58 | alreadyImportedModules[id] = true;
|
59 | }
|
60 | }
|
61 | }
|
62 |
|
63 | for (var _i2 = 0; _i2 < modules.length; _i2++) {
|
64 | var item = [].concat(modules[_i2]);
|
65 |
|
66 | if (dedupe && alreadyImportedModules[item[0]]) {
|
67 | continue;
|
68 | }
|
69 |
|
70 | if (typeof layer !== "undefined") {
|
71 | if (typeof item[5] === "undefined") {
|
72 | item[5] = layer;
|
73 | } else {
|
74 | item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
|
75 | item[5] = layer;
|
76 | }
|
77 | }
|
78 |
|
79 | if (media) {
|
80 | if (!item[2]) {
|
81 | item[2] = media;
|
82 | } else {
|
83 | item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
|
84 | item[2] = media;
|
85 | }
|
86 | }
|
87 |
|
88 | if (supports) {
|
89 | if (!item[4]) {
|
90 | item[4] = "".concat(supports);
|
91 | } else {
|
92 | item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
|
93 | item[4] = supports;
|
94 | }
|
95 | }
|
96 |
|
97 | list.push(item);
|
98 | }
|
99 | };
|
100 |
|
101 | return list;
|
102 | }; |
\ | No newline at end of file |