hlrender 0.0.1
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.
- package/_commonjsHelpers-e7ea1525.js +36 -0
- package/_plugin-vue_export-helper-dad06003.js +9 -0
- package/affix-widget-b6cdaf6f.js +35 -0
- package/anchor-link-widget-919ac0ee.js +5 -0
- package/anchor-link-widget.vue_vue_type_script_setup_true_name_anchor-link-widget_lang-7df7e7c1.js +35 -0
- package/anchor-widget-403fe70f.js +54 -0
- package/auto-complete-widget-597d8400.js +71 -0
- package/avatar-widget-c56add2d.js +35 -0
- package/backtop-widget-65d711e3.js +35 -0
- package/badge-widget-f6a08422.js +41 -0
- package/baseImp-70f1a9c5.js +11003 -0
- package/breadcrumb-widget-3791fbcf.js +76 -0
- package/button-widget-b539a793.js +45 -0
- package/cache-widget-89624589.js +50 -0
- package/card-widget-2890042f.js +109 -0
- package/carousel-widget-730618e4.js +72 -0
- package/cascader-widget-a364f226.js +94 -0
- package/chart-widget-d0b5993c.js +44282 -0
- package/checkbox-widget-5f87a8e5.js +76 -0
- package/collapse-widget-a654ac45.js +86 -0
- package/color-picker-widget-b5b274dd.js +53 -0
- package/cont-cell-widget-475412c6.js +8 -0
- package/cont-cell-widget.vue_vue_type_script_setup_true_name_cont-cell-widget_lang-9aac0112.js +59 -0
- package/cont-widget-defa7dd6.js +42 -0
- package/content-wrapper-7ba06bbc.js +14 -0
- package/content-wrapper.vue_vue_type_script_setup_true_lang-56dfcc0b.js +37 -0
- package/date-picker-range-widget-e528dab6.js +69 -0
- package/date-picker-widget-a5d3e5ff.js +75 -0
- package/default-slot-widget-09d11567.js +22 -0
- package/default-slot-widget.vue_vue_type_script_setup_true_name_default-slot-widget_lang-af9e9fc7.js +59 -0
- package/descriptions-widget-9711a62b.js +80 -0
- package/dialog-333d3421.js +124 -0
- package/dialog-widget-94d8ab5a.js +30 -0
- package/divider-widget-b835bbc3.js +35 -0
- package/drag-wrapper-227f198f.js +258 -0
- package/drawer-widget-3906d028.js +30 -0
- package/dropdown-widget-74696f3c.js +89 -0
- package/empty-widget-ba5e0039.js +61 -0
- package/enum-type-92806e9d.js +207 -0
- package/enum-type-be3a0b8b.js +2048 -0
- package/expression-63a787db.js +2181 -0
- package/feedback-widget-3140f73d.js +23 -0
- package/feedback-widget.vue_vue_type_script_setup_true_name_feedback-widget_lang-f8da09d0.js +82 -0
- package/field-base-5547436d.js +7 -0
- package/file-upload-widget-dcc0425c.js +95 -0
- package/form-item-wrapper-849d8a21.js +111 -0
- package/form-widget-1dcffd59.js +183 -0
- package/grid-col-widget-e6b1455d.js +8 -0
- package/grid-col-widget.vue_vue_type_script_setup_true_name_grid-col-widget_lang-ed554759.js +41 -0
- package/grid-widget-d7974890.js +43 -0
- package/html-text-widget-e13171fa.js +47 -0
- package/icon-e9532b43.js +119 -0
- package/iframe-widget-dee326a7.js +74 -0
- package/image-widget-d417c681.js +61 -0
- package/index-28e4bcfb.js +99 -0
- package/index-2d29f8d3.js +7233 -0
- package/index-ddd23411.js +4884 -0
- package/index-f54403db.js +65 -0
- package/index-fa19f5d9.js +10568 -0
- package/input-number-widget-548743d9.js +63 -0
- package/input-widget-81153a08.js +68 -0
- package/label-wrapper-13267254.js +12 -0
- package/label-wrapper.vue_vue_type_style_index_0_lang-5b455ef8.js +80 -0
- package/link-widget-e2aeac9f.js +53 -0
- package/ltable-col-widget-ecfe9f02.js +8 -0
- package/ltable-col-widget.vue_vue_type_script_setup_true_name_ltable-col-widget_lang-6c231f2e.js +256 -0
- package/ltable-widget-d5d81ac2.js +69 -0
- package/menu-widget-101389ec.js +93 -0
- package/model-widget-84277d11.js +119 -0
- package/multirow-3ade8c6e.js +341 -0
- package/multirow-widget copy-efbb1e00.js +855 -0
- package/multirow-widget-a73fd2b8.js +691 -0
- package/package.json +13 -0
- package/pagination-widget-12edf5f4.js +78 -0
- package/picture-upload-widget-bcef9cc8.js +99 -0
- package/progress-widget-f515a118.js +49 -0
- package/propresult-e424ed73.js +22 -0
- package/radio-widget-78f9cab9.js +76 -0
- package/range-widget-904ed0d6.js +71 -0
- package/rate-widget-efdab26c.js +53 -0
- package/render.es.js +4434 -0
- package/render.style.css +11 -0
- package/render.umd.js +160496 -0
- package/result-widget-b1688641.js +64 -0
- package/rich-editor-widget-f1bb90c7.js +74 -0
- package/router-widget-920b11e4.js +51 -0
- package/select-widget-f3a43687.js +285 -0
- package/sfc-b5fb0bca.js +2568 -0
- package/share-field-9834aef6.js +688 -0
- package/share-file-329736c4.js +121 -0
- package/slider-widget-5146c0c3.js +59 -0
- package/slot-c6523e8c.js +17 -0
- package/static-text-widget-307cd047.js +48 -0
- package/steps-widget-70c08c51.js +88 -0
- package/subMenu-widget-c1a614ad.js +16 -0
- package/subMenu-widget.vue_vue_type_script_setup_true_lang-1896e25e.js +69 -0
- package/switch-widget-a103faaa.js +53 -0
- package/tab-pane-widget-e7c83114.js +8 -0
- package/tab-pane-widget.vue_vue_type_script_setup_true_name_tab-pane-widget_lang-12fa9f12.js +35 -0
- package/table-col-widget-f177b82e.js +20 -0
- package/table-col-widget.vue_vue_type_script_setup_true_name_table-col-widget_lang-5a1b4f92.js +80 -0
- package/table-widget-500902fd.js +160 -0
- package/tabs-widget-5e612fc0.js +68 -0
- package/tag-widget-8b945443.js +35 -0
- package/template-9ade074e.js +251730 -0
- package/text-widget-0d93ae9a.js +35 -0
- package/textarea-widget-d2464e70.js +53 -0
- package/time-picker-range-widget-7d92f5f0.js +55 -0
- package/time-picker-widget-3e0cc2c5.js +54 -0
- package/time-select-widget-b0b17501.js +54 -0
- package/tmpl-widget-b2402ddc.js +89 -0
- package/tree-select-widget-13f054e9.js +91 -0
- package/tree-widget-8bee698c.js +87 -0
- package/uuid-b302db3f.js +192 -0
- package/vue3-sfc-loader-b70bdce4.js +34688 -0
- package/widget-base-4c2d6265.js +27 -0
- package/widget-wrapper.vue_vue_type_script_setup_true_name_form-item-wrapper_lang-d0e116ac.js +277 -0
- package/wrapper-widget-4d87e124.js +78 -0
package/sfc-b5fb0bca.js
ADDED
|
@@ -0,0 +1,2568 @@
|
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var We = (t, i, s) => i in t ? Me(t, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[i] = s;
|
|
3
|
+
var Y = (t, i, s) => (We(t, typeof i != "symbol" ? i + "" : i, s), s);
|
|
4
|
+
import { d as I, t as H, o as _t, H as Ke, h as Bt, I as Ue, J as q, f as ze, K as qe, k as Oe, b as Ve } from "./enum-type-be3a0b8b.js";
|
|
5
|
+
import { B as w, P as B, F as Fe, A as Xe, C as Ge, b as mt, D as Qe } from "./baseImp-70f1a9c5.js";
|
|
6
|
+
import { d as E, e as He, H as Ht, f as Jt, a9 as Je } from "./enum-type-92806e9d.js";
|
|
7
|
+
import { c as Mt } from "./uuid-b302db3f.js";
|
|
8
|
+
import { t as Ye, l as Te, m as Ee } from "./index-fa19f5d9.js";
|
|
9
|
+
import { b as J, o as F, s as rt, q as ke } from "./template-9ade074e.js";
|
|
10
|
+
import { a as Re } from "./slot-c6523e8c.js";
|
|
11
|
+
import "./icon-e9532b43.js";
|
|
12
|
+
import "vue";
|
|
13
|
+
import "./dialog-333d3421.js";
|
|
14
|
+
import "element-plus";
|
|
15
|
+
import "./_commonjsHelpers-e7ea1525.js";
|
|
16
|
+
const Ze = (t) => {
|
|
17
|
+
let i = {};
|
|
18
|
+
const s = t.type, e = w.getName(t);
|
|
19
|
+
s === E.tabs ? t.tabs.length > 0 && I(i, {
|
|
20
|
+
[`${e}ActiveTab`]: w.getName(t.tabs[0])
|
|
21
|
+
}) : [
|
|
22
|
+
E.radio,
|
|
23
|
+
E.checkbox,
|
|
24
|
+
E.select,
|
|
25
|
+
E.cascader,
|
|
26
|
+
E.breadcrumb,
|
|
27
|
+
E.descriptions,
|
|
28
|
+
E.dropdown,
|
|
29
|
+
E.steps,
|
|
30
|
+
E.collapse
|
|
31
|
+
].includes(s) ? I(i, {
|
|
32
|
+
[`${e}Options`]: B.getValue(w.getOrgOption(t, J.optionItems))
|
|
33
|
+
}) : [E.pictureUpload, E.fileUpload].includes(s) && I(i, {
|
|
34
|
+
[`${e}FileList`]: [],
|
|
35
|
+
[`${e}UploadHeaders`]: {},
|
|
36
|
+
[`${e}UploadData`]: {}
|
|
37
|
+
});
|
|
38
|
+
let a = Ae(t);
|
|
39
|
+
return !a && e && (a = Se(t)), a && I(i, a), i;
|
|
40
|
+
}, Ae = (t) => {
|
|
41
|
+
const i = w.getName(t);
|
|
42
|
+
if (t.formItemFlag) {
|
|
43
|
+
const s = w.getOptions(t, "defaultValue");
|
|
44
|
+
return { [i]: Bt(s) ? null : s };
|
|
45
|
+
}
|
|
46
|
+
}, Se = (t) => {
|
|
47
|
+
var i = Ee(t);
|
|
48
|
+
return Ce(i);
|
|
49
|
+
}, Ce = (t) => {
|
|
50
|
+
let i = {};
|
|
51
|
+
var s = Te(t, E.form);
|
|
52
|
+
const e = s == null ? void 0 : s.map((a) => w.getName(a));
|
|
53
|
+
return s == null || s.map((a) => {
|
|
54
|
+
var l;
|
|
55
|
+
let r = {};
|
|
56
|
+
const u = w.getName(a), o = w.getOptions(a, "modelName") || u;
|
|
57
|
+
(l = a.widgetList) == null || l.map((v) => {
|
|
58
|
+
const x = w.getName(v);
|
|
59
|
+
let b = Ae(v);
|
|
60
|
+
e != null && e.includes(x) && (b = Se(v)), I(r, b);
|
|
61
|
+
}), I(i, { [o]: r });
|
|
62
|
+
}), i;
|
|
63
|
+
}, Wt = (t) => {
|
|
64
|
+
var a;
|
|
65
|
+
let i = {};
|
|
66
|
+
Ye(t, (r) => {
|
|
67
|
+
I(i, Ze(r));
|
|
68
|
+
});
|
|
69
|
+
const s = Ce(t);
|
|
70
|
+
I(i, s);
|
|
71
|
+
const e = Ke(s, !0);
|
|
72
|
+
return (a = _t(i)) == null || a.forEach((r) => {
|
|
73
|
+
e != null && e.includes(r) && delete i[r];
|
|
74
|
+
}), i;
|
|
75
|
+
}, ti = (t) => {
|
|
76
|
+
t.options;
|
|
77
|
+
let i = [];
|
|
78
|
+
var s = w.getOptions(t, "required");
|
|
79
|
+
s && i.push({
|
|
80
|
+
required: !0,
|
|
81
|
+
message: `${Ue("render.hint.fieldRequired")}`
|
|
82
|
+
});
|
|
83
|
+
var e = w.getOptions(t, "expValidate", !0);
|
|
84
|
+
const a = Mt(e == null ? void 0 : e.options);
|
|
85
|
+
if (e && a && a.enable) {
|
|
86
|
+
let r = a == null ? void 0 : a.expression;
|
|
87
|
+
const u = Fe[r] ? Xe(r) : new RegExp(r);
|
|
88
|
+
i.push({
|
|
89
|
+
pattern: `${u}`,
|
|
90
|
+
trigger: ["blur", "change"],
|
|
91
|
+
message: `${a.errorMsg}`
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return i;
|
|
95
|
+
}, Kt = (t) => {
|
|
96
|
+
let i = {};
|
|
97
|
+
var s = Te(t, E.form);
|
|
98
|
+
return s == null || s.map((e) => {
|
|
99
|
+
var u;
|
|
100
|
+
let a = {};
|
|
101
|
+
const r = w.getOptions(e, "rulesName") || name + "_rules";
|
|
102
|
+
(u = e.widgetList) == null || u.map((o) => {
|
|
103
|
+
const l = w.getOptions(o, "name");
|
|
104
|
+
let v = {};
|
|
105
|
+
if (o.formItemFlag)
|
|
106
|
+
v = { [l]: ti(o) };
|
|
107
|
+
else if (o.type !== E.form) {
|
|
108
|
+
var x = Ee(o);
|
|
109
|
+
v = Kt(x);
|
|
110
|
+
}
|
|
111
|
+
I(a, v);
|
|
112
|
+
}), I(i, { [r]: a });
|
|
113
|
+
}), i;
|
|
114
|
+
}, ei = function(t) {
|
|
115
|
+
const i = Wt(t), s = Kt(t), e = I(i, s);
|
|
116
|
+
return `
|
|
117
|
+
export default {
|
|
118
|
+
components: {},
|
|
119
|
+
props: {},
|
|
120
|
+
data() {
|
|
121
|
+
return
|
|
122
|
+
${H(e)};
|
|
123
|
+
},
|
|
124
|
+
computed: {},
|
|
125
|
+
watch: {},
|
|
126
|
+
created() {},
|
|
127
|
+
mounted() {},
|
|
128
|
+
methods: {}
|
|
129
|
+
}`;
|
|
130
|
+
}, ii = function(t) {
|
|
131
|
+
var o, l;
|
|
132
|
+
const i = Wt(t), s = Kt(t), e = I(i, s), a = (o = _t(e)) == null ? void 0 : o.map((v) => `const ${v} = reactive(${H(e == null ? void 0 : e[v])});`);
|
|
133
|
+
return `
|
|
134
|
+
${((l = _t(e)) == null ? void 0 : l.length) > 0 ? "import { reactive } from 'vue';" : ""}
|
|
135
|
+
${a.join(`
|
|
136
|
+
`)}
|
|
137
|
+
`;
|
|
138
|
+
};
|
|
139
|
+
var it = {}, si = {
|
|
140
|
+
get exports() {
|
|
141
|
+
return it;
|
|
142
|
+
},
|
|
143
|
+
set exports(t) {
|
|
144
|
+
it = t;
|
|
145
|
+
}
|
|
146
|
+
}, Z = {}, st = {}, ni = {
|
|
147
|
+
get exports() {
|
|
148
|
+
return st;
|
|
149
|
+
},
|
|
150
|
+
set exports(t) {
|
|
151
|
+
st = t;
|
|
152
|
+
}
|
|
153
|
+
}, wt = {}, Ot = {}, Yt;
|
|
154
|
+
function Ut() {
|
|
155
|
+
if (Yt)
|
|
156
|
+
return Ot;
|
|
157
|
+
Yt = 1;
|
|
158
|
+
function t(e) {
|
|
159
|
+
this.__parent = e, this.__character_count = 0, this.__indent_count = -1, this.__alignment_count = 0, this.__wrap_point_index = 0, this.__wrap_point_character_count = 0, this.__wrap_point_indent_count = -1, this.__wrap_point_alignment_count = 0, this.__items = [];
|
|
160
|
+
}
|
|
161
|
+
t.prototype.clone_empty = function() {
|
|
162
|
+
var e = new t(this.__parent);
|
|
163
|
+
return e.set_indent(this.__indent_count, this.__alignment_count), e;
|
|
164
|
+
}, t.prototype.item = function(e) {
|
|
165
|
+
return e < 0 ? this.__items[this.__items.length + e] : this.__items[e];
|
|
166
|
+
}, t.prototype.has_match = function(e) {
|
|
167
|
+
for (var a = this.__items.length - 1; a >= 0; a--)
|
|
168
|
+
if (this.__items[a].match(e))
|
|
169
|
+
return !0;
|
|
170
|
+
return !1;
|
|
171
|
+
}, t.prototype.set_indent = function(e, a) {
|
|
172
|
+
this.is_empty() && (this.__indent_count = e || 0, this.__alignment_count = a || 0, this.__character_count = this.__parent.get_indent_size(this.__indent_count, this.__alignment_count));
|
|
173
|
+
}, t.prototype._set_wrap_point = function() {
|
|
174
|
+
this.__parent.wrap_line_length && (this.__wrap_point_index = this.__items.length, this.__wrap_point_character_count = this.__character_count, this.__wrap_point_indent_count = this.__parent.next_line.__indent_count, this.__wrap_point_alignment_count = this.__parent.next_line.__alignment_count);
|
|
175
|
+
}, t.prototype._should_wrap = function() {
|
|
176
|
+
return this.__wrap_point_index && this.__character_count > this.__parent.wrap_line_length && this.__wrap_point_character_count > this.__parent.next_line.__character_count;
|
|
177
|
+
}, t.prototype._allow_wrap = function() {
|
|
178
|
+
if (this._should_wrap()) {
|
|
179
|
+
this.__parent.add_new_line();
|
|
180
|
+
var e = this.__parent.current_line;
|
|
181
|
+
return e.set_indent(this.__wrap_point_indent_count, this.__wrap_point_alignment_count), e.__items = this.__items.slice(this.__wrap_point_index), this.__items = this.__items.slice(0, this.__wrap_point_index), e.__character_count += this.__character_count - this.__wrap_point_character_count, this.__character_count = this.__wrap_point_character_count, e.__items[0] === " " && (e.__items.splice(0, 1), e.__character_count -= 1), !0;
|
|
182
|
+
}
|
|
183
|
+
return !1;
|
|
184
|
+
}, t.prototype.is_empty = function() {
|
|
185
|
+
return this.__items.length === 0;
|
|
186
|
+
}, t.prototype.last = function() {
|
|
187
|
+
return this.is_empty() ? null : this.__items[this.__items.length - 1];
|
|
188
|
+
}, t.prototype.push = function(e) {
|
|
189
|
+
this.__items.push(e);
|
|
190
|
+
var a = e.lastIndexOf(`
|
|
191
|
+
`);
|
|
192
|
+
a !== -1 ? this.__character_count = e.length - a : this.__character_count += e.length;
|
|
193
|
+
}, t.prototype.pop = function() {
|
|
194
|
+
var e = null;
|
|
195
|
+
return this.is_empty() || (e = this.__items.pop(), this.__character_count -= e.length), e;
|
|
196
|
+
}, t.prototype._remove_indent = function() {
|
|
197
|
+
this.__indent_count > 0 && (this.__indent_count -= 1, this.__character_count -= this.__parent.indent_size);
|
|
198
|
+
}, t.prototype._remove_wrap_indent = function() {
|
|
199
|
+
this.__wrap_point_indent_count > 0 && (this.__wrap_point_indent_count -= 1);
|
|
200
|
+
}, t.prototype.trim = function() {
|
|
201
|
+
for (; this.last() === " "; )
|
|
202
|
+
this.__items.pop(), this.__character_count -= 1;
|
|
203
|
+
}, t.prototype.toString = function() {
|
|
204
|
+
var e = "";
|
|
205
|
+
return this.is_empty() ? this.__parent.indent_empty_lines && (e = this.__parent.get_indent_string(this.__indent_count)) : (e = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count), e += this.__items.join("")), e;
|
|
206
|
+
};
|
|
207
|
+
function i(e, a) {
|
|
208
|
+
this.__cache = [""], this.__indent_size = e.indent_size, this.__indent_string = e.indent_char, e.indent_with_tabs || (this.__indent_string = new Array(e.indent_size + 1).join(e.indent_char)), a = a || "", e.indent_level > 0 && (a = new Array(e.indent_level + 1).join(this.__indent_string)), this.__base_string = a, this.__base_string_length = a.length;
|
|
209
|
+
}
|
|
210
|
+
i.prototype.get_indent_size = function(e, a) {
|
|
211
|
+
var r = this.__base_string_length;
|
|
212
|
+
return a = a || 0, e < 0 && (r = 0), r += e * this.__indent_size, r += a, r;
|
|
213
|
+
}, i.prototype.get_indent_string = function(e, a) {
|
|
214
|
+
var r = this.__base_string;
|
|
215
|
+
return a = a || 0, e < 0 && (e = 0, r = ""), a += e * this.__indent_size, this.__ensure_cache(a), r += this.__cache[a], r;
|
|
216
|
+
}, i.prototype.__ensure_cache = function(e) {
|
|
217
|
+
for (; e >= this.__cache.length; )
|
|
218
|
+
this.__add_column();
|
|
219
|
+
}, i.prototype.__add_column = function() {
|
|
220
|
+
var e = this.__cache.length, a = 0, r = "";
|
|
221
|
+
this.__indent_size && e >= this.__indent_size && (a = Math.floor(e / this.__indent_size), e -= a * this.__indent_size, r = new Array(a + 1).join(this.__indent_string)), e && (r += new Array(e + 1).join(" ")), this.__cache.push(r);
|
|
222
|
+
};
|
|
223
|
+
function s(e, a) {
|
|
224
|
+
this.__indent_cache = new i(e, a), this.raw = !1, this._end_with_newline = e.end_with_newline, this.indent_size = e.indent_size, this.wrap_line_length = e.wrap_line_length, this.indent_empty_lines = e.indent_empty_lines, this.__lines = [], this.previous_line = null, this.current_line = null, this.next_line = new t(this), this.space_before_token = !1, this.non_breaking_space = !1, this.previous_token_wrapped = !1, this.__add_outputline();
|
|
225
|
+
}
|
|
226
|
+
return s.prototype.__add_outputline = function() {
|
|
227
|
+
this.previous_line = this.current_line, this.current_line = this.next_line.clone_empty(), this.__lines.push(this.current_line);
|
|
228
|
+
}, s.prototype.get_line_number = function() {
|
|
229
|
+
return this.__lines.length;
|
|
230
|
+
}, s.prototype.get_indent_string = function(e, a) {
|
|
231
|
+
return this.__indent_cache.get_indent_string(e, a);
|
|
232
|
+
}, s.prototype.get_indent_size = function(e, a) {
|
|
233
|
+
return this.__indent_cache.get_indent_size(e, a);
|
|
234
|
+
}, s.prototype.is_empty = function() {
|
|
235
|
+
return !this.previous_line && this.current_line.is_empty();
|
|
236
|
+
}, s.prototype.add_new_line = function(e) {
|
|
237
|
+
return this.is_empty() || !e && this.just_added_newline() ? !1 : (this.raw || this.__add_outputline(), !0);
|
|
238
|
+
}, s.prototype.get_code = function(e) {
|
|
239
|
+
this.trim(!0);
|
|
240
|
+
var a = this.current_line.pop();
|
|
241
|
+
a && (a[a.length - 1] === `
|
|
242
|
+
` && (a = a.replace(/\n+$/g, "")), this.current_line.push(a)), this._end_with_newline && this.__add_outputline();
|
|
243
|
+
var r = this.__lines.join(`
|
|
244
|
+
`);
|
|
245
|
+
return e !== `
|
|
246
|
+
` && (r = r.replace(/[\n]/g, e)), r;
|
|
247
|
+
}, s.prototype.set_wrap_point = function() {
|
|
248
|
+
this.current_line._set_wrap_point();
|
|
249
|
+
}, s.prototype.set_indent = function(e, a) {
|
|
250
|
+
return e = e || 0, a = a || 0, this.next_line.set_indent(e, a), this.__lines.length > 1 ? (this.current_line.set_indent(e, a), !0) : (this.current_line.set_indent(), !1);
|
|
251
|
+
}, s.prototype.add_raw_token = function(e) {
|
|
252
|
+
for (var a = 0; a < e.newlines; a++)
|
|
253
|
+
this.__add_outputline();
|
|
254
|
+
this.current_line.set_indent(-1), this.current_line.push(e.whitespace_before), this.current_line.push(e.text), this.space_before_token = !1, this.non_breaking_space = !1, this.previous_token_wrapped = !1;
|
|
255
|
+
}, s.prototype.add_token = function(e) {
|
|
256
|
+
this.__add_space_before_token(), this.current_line.push(e), this.space_before_token = !1, this.non_breaking_space = !1, this.previous_token_wrapped = this.current_line._allow_wrap();
|
|
257
|
+
}, s.prototype.__add_space_before_token = function() {
|
|
258
|
+
this.space_before_token && !this.just_added_newline() && (this.non_breaking_space || this.set_wrap_point(), this.current_line.push(" "));
|
|
259
|
+
}, s.prototype.remove_indent = function(e) {
|
|
260
|
+
for (var a = this.__lines.length; e < a; )
|
|
261
|
+
this.__lines[e]._remove_indent(), e++;
|
|
262
|
+
this.current_line._remove_wrap_indent();
|
|
263
|
+
}, s.prototype.trim = function(e) {
|
|
264
|
+
for (e = e === void 0 ? !1 : e, this.current_line.trim(); e && this.__lines.length > 1 && this.current_line.is_empty(); )
|
|
265
|
+
this.__lines.pop(), this.current_line = this.__lines[this.__lines.length - 1], this.current_line.trim();
|
|
266
|
+
this.previous_line = this.__lines.length > 1 ? this.__lines[this.__lines.length - 2] : null;
|
|
267
|
+
}, s.prototype.just_added_newline = function() {
|
|
268
|
+
return this.current_line.is_empty();
|
|
269
|
+
}, s.prototype.just_added_blankline = function() {
|
|
270
|
+
return this.is_empty() || this.current_line.is_empty() && this.previous_line.is_empty();
|
|
271
|
+
}, s.prototype.ensure_empty_line_above = function(e, a) {
|
|
272
|
+
for (var r = this.__lines.length - 2; r >= 0; ) {
|
|
273
|
+
var u = this.__lines[r];
|
|
274
|
+
if (u.is_empty())
|
|
275
|
+
break;
|
|
276
|
+
if (u.item(0).indexOf(e) !== 0 && u.item(-1) !== a) {
|
|
277
|
+
this.__lines.splice(r + 1, 0, new t(this)), this.previous_line = this.__lines[this.__lines.length - 2];
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
r--;
|
|
281
|
+
}
|
|
282
|
+
}, Ot.Output = s, Ot;
|
|
283
|
+
}
|
|
284
|
+
var Tt = {}, Zt;
|
|
285
|
+
function Ne() {
|
|
286
|
+
if (Zt)
|
|
287
|
+
return Tt;
|
|
288
|
+
Zt = 1;
|
|
289
|
+
function t(i, s, e, a) {
|
|
290
|
+
this.type = i, this.text = s, this.comments_before = null, this.newlines = e || 0, this.whitespace_before = a || "", this.parent = null, this.next = null, this.previous = null, this.opened = null, this.closed = null, this.directives = null;
|
|
291
|
+
}
|
|
292
|
+
return Tt.Token = t, Tt;
|
|
293
|
+
}
|
|
294
|
+
var Et = {}, te;
|
|
295
|
+
function $e() {
|
|
296
|
+
return te || (te = 1, function(t) {
|
|
297
|
+
var i = "\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a", s = "\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a", e = "\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc", a = "\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f", r = "(?:\\\\u[0-9a-fA-F]{4}|[" + i + e + "])", u = "(?:\\\\u[0-9a-fA-F]{4}|[" + s + e + a + "])*";
|
|
298
|
+
t.identifier = new RegExp(r + u, "g"), t.identifierStart = new RegExp(r), t.identifierMatch = new RegExp("(?:\\\\u[0-9a-fA-F]{4}|[" + s + e + a + "])+"), t.newline = /[\n\r\u2028\u2029]/, t.lineBreak = new RegExp(`\r
|
|
299
|
+
|` + t.newline.source), t.allLineBreaks = new RegExp(t.lineBreak.source, "g");
|
|
300
|
+
}(Et)), Et;
|
|
301
|
+
}
|
|
302
|
+
var kt = {}, tt = {}, ee;
|
|
303
|
+
function zt() {
|
|
304
|
+
if (ee)
|
|
305
|
+
return tt;
|
|
306
|
+
ee = 1;
|
|
307
|
+
function t(e, a) {
|
|
308
|
+
this.raw_options = i(e, a), this.disabled = this._get_boolean("disabled"), this.eol = this._get_characters("eol", "auto"), this.end_with_newline = this._get_boolean("end_with_newline"), this.indent_size = this._get_number("indent_size", 4), this.indent_char = this._get_characters("indent_char", " "), this.indent_level = this._get_number("indent_level"), this.preserve_newlines = this._get_boolean("preserve_newlines", !0), this.max_preserve_newlines = this._get_number("max_preserve_newlines", 32786), this.preserve_newlines || (this.max_preserve_newlines = 0), this.indent_with_tabs = this._get_boolean("indent_with_tabs", this.indent_char === " "), this.indent_with_tabs && (this.indent_char = " ", this.indent_size === 1 && (this.indent_size = 4)), this.wrap_line_length = this._get_number("wrap_line_length", this._get_number("max_char")), this.indent_empty_lines = this._get_boolean("indent_empty_lines"), this.templating = this._get_selection_list("templating", ["auto", "none", "django", "erb", "handlebars", "php", "smarty"], ["auto"]);
|
|
309
|
+
}
|
|
310
|
+
t.prototype._get_array = function(e, a) {
|
|
311
|
+
var r = this.raw_options[e], u = a || [];
|
|
312
|
+
return typeof r == "object" ? r !== null && typeof r.concat == "function" && (u = r.concat()) : typeof r == "string" && (u = r.split(/[^a-zA-Z0-9_\/\-]+/)), u;
|
|
313
|
+
}, t.prototype._get_boolean = function(e, a) {
|
|
314
|
+
var r = this.raw_options[e], u = r === void 0 ? !!a : !!r;
|
|
315
|
+
return u;
|
|
316
|
+
}, t.prototype._get_characters = function(e, a) {
|
|
317
|
+
var r = this.raw_options[e], u = a || "";
|
|
318
|
+
return typeof r == "string" && (u = r.replace(/\\r/, "\r").replace(/\\n/, `
|
|
319
|
+
`).replace(/\\t/, " ")), u;
|
|
320
|
+
}, t.prototype._get_number = function(e, a) {
|
|
321
|
+
var r = this.raw_options[e];
|
|
322
|
+
a = parseInt(a, 10), isNaN(a) && (a = 0);
|
|
323
|
+
var u = parseInt(r, 10);
|
|
324
|
+
return isNaN(u) && (u = a), u;
|
|
325
|
+
}, t.prototype._get_selection = function(e, a, r) {
|
|
326
|
+
var u = this._get_selection_list(e, a, r);
|
|
327
|
+
if (u.length !== 1)
|
|
328
|
+
throw new Error(
|
|
329
|
+
"Invalid Option Value: The option '" + e + `' can only be one of the following values:
|
|
330
|
+
` + a + `
|
|
331
|
+
You passed in: '` + this.raw_options[e] + "'"
|
|
332
|
+
);
|
|
333
|
+
return u[0];
|
|
334
|
+
}, t.prototype._get_selection_list = function(e, a, r) {
|
|
335
|
+
if (!a || a.length === 0)
|
|
336
|
+
throw new Error("Selection list cannot be empty.");
|
|
337
|
+
if (r = r || [a[0]], !this._is_valid_selection(r, a))
|
|
338
|
+
throw new Error("Invalid Default Value!");
|
|
339
|
+
var u = this._get_array(e, r);
|
|
340
|
+
if (!this._is_valid_selection(u, a))
|
|
341
|
+
throw new Error(
|
|
342
|
+
"Invalid Option Value: The option '" + e + `' can contain only the following values:
|
|
343
|
+
` + a + `
|
|
344
|
+
You passed in: '` + this.raw_options[e] + "'"
|
|
345
|
+
);
|
|
346
|
+
return u;
|
|
347
|
+
}, t.prototype._is_valid_selection = function(e, a) {
|
|
348
|
+
return e.length && a.length && !e.some(function(r) {
|
|
349
|
+
return a.indexOf(r) === -1;
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
function i(e, a) {
|
|
353
|
+
var r = {};
|
|
354
|
+
e = s(e);
|
|
355
|
+
var u;
|
|
356
|
+
for (u in e)
|
|
357
|
+
u !== a && (r[u] = e[u]);
|
|
358
|
+
if (a && e[a])
|
|
359
|
+
for (u in e[a])
|
|
360
|
+
r[u] = e[a][u];
|
|
361
|
+
return r;
|
|
362
|
+
}
|
|
363
|
+
function s(e) {
|
|
364
|
+
var a = {}, r;
|
|
365
|
+
for (r in e) {
|
|
366
|
+
var u = r.replace(/-/g, "_");
|
|
367
|
+
a[u] = e[r];
|
|
368
|
+
}
|
|
369
|
+
return a;
|
|
370
|
+
}
|
|
371
|
+
return tt.Options = t, tt.normalizeOpts = s, tt.mergeOpts = i, tt;
|
|
372
|
+
}
|
|
373
|
+
var ie;
|
|
374
|
+
function Pe() {
|
|
375
|
+
if (ie)
|
|
376
|
+
return kt;
|
|
377
|
+
ie = 1;
|
|
378
|
+
var t = zt().Options, i = ["before-newline", "after-newline", "preserve-newline"];
|
|
379
|
+
function s(e) {
|
|
380
|
+
t.call(this, e, "js");
|
|
381
|
+
var a = this.raw_options.brace_style || null;
|
|
382
|
+
a === "expand-strict" ? this.raw_options.brace_style = "expand" : a === "collapse-preserve-inline" ? this.raw_options.brace_style = "collapse,preserve-inline" : this.raw_options.braces_on_own_line !== void 0 && (this.raw_options.brace_style = this.raw_options.braces_on_own_line ? "expand" : "collapse");
|
|
383
|
+
var r = this._get_selection_list("brace_style", ["collapse", "expand", "end-expand", "none", "preserve-inline"]);
|
|
384
|
+
this.brace_preserve_inline = !1, this.brace_style = "collapse";
|
|
385
|
+
for (var u = 0; u < r.length; u++)
|
|
386
|
+
r[u] === "preserve-inline" ? this.brace_preserve_inline = !0 : this.brace_style = r[u];
|
|
387
|
+
this.unindent_chained_methods = this._get_boolean("unindent_chained_methods"), this.break_chained_methods = this._get_boolean("break_chained_methods"), this.space_in_paren = this._get_boolean("space_in_paren"), this.space_in_empty_paren = this._get_boolean("space_in_empty_paren"), this.jslint_happy = this._get_boolean("jslint_happy"), this.space_after_anon_function = this._get_boolean("space_after_anon_function"), this.space_after_named_function = this._get_boolean("space_after_named_function"), this.keep_array_indentation = this._get_boolean("keep_array_indentation"), this.space_before_conditional = this._get_boolean("space_before_conditional", !0), this.unescape_strings = this._get_boolean("unescape_strings"), this.e4x = this._get_boolean("e4x"), this.comma_first = this._get_boolean("comma_first"), this.operator_position = this._get_selection("operator_position", i), this.test_output_raw = this._get_boolean("test_output_raw"), this.jslint_happy && (this.space_after_anon_function = !0);
|
|
388
|
+
}
|
|
389
|
+
return s.prototype = new t(), kt.Options = s, kt;
|
|
390
|
+
}
|
|
391
|
+
var Q = {}, Rt = {}, se;
|
|
392
|
+
function qt() {
|
|
393
|
+
if (se)
|
|
394
|
+
return Rt;
|
|
395
|
+
se = 1;
|
|
396
|
+
var t = RegExp.prototype.hasOwnProperty("sticky");
|
|
397
|
+
function i(s) {
|
|
398
|
+
this.__input = s || "", this.__input_length = this.__input.length, this.__position = 0;
|
|
399
|
+
}
|
|
400
|
+
return i.prototype.restart = function() {
|
|
401
|
+
this.__position = 0;
|
|
402
|
+
}, i.prototype.back = function() {
|
|
403
|
+
this.__position > 0 && (this.__position -= 1);
|
|
404
|
+
}, i.prototype.hasNext = function() {
|
|
405
|
+
return this.__position < this.__input_length;
|
|
406
|
+
}, i.prototype.next = function() {
|
|
407
|
+
var s = null;
|
|
408
|
+
return this.hasNext() && (s = this.__input.charAt(this.__position), this.__position += 1), s;
|
|
409
|
+
}, i.prototype.peek = function(s) {
|
|
410
|
+
var e = null;
|
|
411
|
+
return s = s || 0, s += this.__position, s >= 0 && s < this.__input_length && (e = this.__input.charAt(s)), e;
|
|
412
|
+
}, i.prototype.__match = function(s, e) {
|
|
413
|
+
s.lastIndex = e;
|
|
414
|
+
var a = s.exec(this.__input);
|
|
415
|
+
return a && !(t && s.sticky) && a.index !== e && (a = null), a;
|
|
416
|
+
}, i.prototype.test = function(s, e) {
|
|
417
|
+
return e = e || 0, e += this.__position, e >= 0 && e < this.__input_length ? !!this.__match(s, e) : !1;
|
|
418
|
+
}, i.prototype.testChar = function(s, e) {
|
|
419
|
+
var a = this.peek(e);
|
|
420
|
+
return s.lastIndex = 0, a !== null && s.test(a);
|
|
421
|
+
}, i.prototype.match = function(s) {
|
|
422
|
+
var e = this.__match(s, this.__position);
|
|
423
|
+
return e ? this.__position += e[0].length : e = null, e;
|
|
424
|
+
}, i.prototype.read = function(s, e, a) {
|
|
425
|
+
var r = "", u;
|
|
426
|
+
return s && (u = this.match(s), u && (r += u[0])), e && (u || !s) && (r += this.readUntil(e, a)), r;
|
|
427
|
+
}, i.prototype.readUntil = function(s, e) {
|
|
428
|
+
var a = "", r = this.__position;
|
|
429
|
+
s.lastIndex = this.__position;
|
|
430
|
+
var u = s.exec(this.__input);
|
|
431
|
+
return u ? (r = u.index, e && (r += u[0].length)) : r = this.__input_length, a = this.__input.substring(this.__position, r), this.__position = r, a;
|
|
432
|
+
}, i.prototype.readUntilAfter = function(s) {
|
|
433
|
+
return this.readUntil(s, !0);
|
|
434
|
+
}, i.prototype.get_regexp = function(s, e) {
|
|
435
|
+
var a = null, r = "g";
|
|
436
|
+
return e && t && (r = "y"), typeof s == "string" && s !== "" ? a = new RegExp(s, r) : s && (a = new RegExp(s.source, r)), a;
|
|
437
|
+
}, i.prototype.get_literal_regexp = function(s) {
|
|
438
|
+
return RegExp(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
|
|
439
|
+
}, i.prototype.peekUntilAfter = function(s) {
|
|
440
|
+
var e = this.__position, a = this.readUntilAfter(s);
|
|
441
|
+
return this.__position = e, a;
|
|
442
|
+
}, i.prototype.lookBack = function(s) {
|
|
443
|
+
var e = this.__position - 1;
|
|
444
|
+
return e >= s.length && this.__input.substring(e - s.length, e).toLowerCase() === s;
|
|
445
|
+
}, Rt.InputScanner = i, Rt;
|
|
446
|
+
}
|
|
447
|
+
var ut = {}, At = {}, ne;
|
|
448
|
+
function ai() {
|
|
449
|
+
if (ne)
|
|
450
|
+
return At;
|
|
451
|
+
ne = 1;
|
|
452
|
+
function t(i) {
|
|
453
|
+
this.__tokens = [], this.__tokens_length = this.__tokens.length, this.__position = 0, this.__parent_token = i;
|
|
454
|
+
}
|
|
455
|
+
return t.prototype.restart = function() {
|
|
456
|
+
this.__position = 0;
|
|
457
|
+
}, t.prototype.isEmpty = function() {
|
|
458
|
+
return this.__tokens_length === 0;
|
|
459
|
+
}, t.prototype.hasNext = function() {
|
|
460
|
+
return this.__position < this.__tokens_length;
|
|
461
|
+
}, t.prototype.next = function() {
|
|
462
|
+
var i = null;
|
|
463
|
+
return this.hasNext() && (i = this.__tokens[this.__position], this.__position += 1), i;
|
|
464
|
+
}, t.prototype.peek = function(i) {
|
|
465
|
+
var s = null;
|
|
466
|
+
return i = i || 0, i += this.__position, i >= 0 && i < this.__tokens_length && (s = this.__tokens[i]), s;
|
|
467
|
+
}, t.prototype.add = function(i) {
|
|
468
|
+
this.__parent_token && (i.parent = this.__parent_token), this.__tokens.push(i), this.__tokens_length += 1;
|
|
469
|
+
}, At.TokenStream = t, At;
|
|
470
|
+
}
|
|
471
|
+
var St = {}, Ct = {}, ae;
|
|
472
|
+
function gt() {
|
|
473
|
+
if (ae)
|
|
474
|
+
return Ct;
|
|
475
|
+
ae = 1;
|
|
476
|
+
function t(i, s) {
|
|
477
|
+
this._input = i, this._starting_pattern = null, this._match_pattern = null, this._until_pattern = null, this._until_after = !1, s && (this._starting_pattern = this._input.get_regexp(s._starting_pattern, !0), this._match_pattern = this._input.get_regexp(s._match_pattern, !0), this._until_pattern = this._input.get_regexp(s._until_pattern), this._until_after = s._until_after);
|
|
478
|
+
}
|
|
479
|
+
return t.prototype.read = function() {
|
|
480
|
+
var i = this._input.read(this._starting_pattern);
|
|
481
|
+
return (!this._starting_pattern || i) && (i += this._input.read(this._match_pattern, this._until_pattern, this._until_after)), i;
|
|
482
|
+
}, t.prototype.read_match = function() {
|
|
483
|
+
return this._input.match(this._match_pattern);
|
|
484
|
+
}, t.prototype.until_after = function(i) {
|
|
485
|
+
var s = this._create();
|
|
486
|
+
return s._until_after = !0, s._until_pattern = this._input.get_regexp(i), s._update(), s;
|
|
487
|
+
}, t.prototype.until = function(i) {
|
|
488
|
+
var s = this._create();
|
|
489
|
+
return s._until_after = !1, s._until_pattern = this._input.get_regexp(i), s._update(), s;
|
|
490
|
+
}, t.prototype.starting_with = function(i) {
|
|
491
|
+
var s = this._create();
|
|
492
|
+
return s._starting_pattern = this._input.get_regexp(i, !0), s._update(), s;
|
|
493
|
+
}, t.prototype.matching = function(i) {
|
|
494
|
+
var s = this._create();
|
|
495
|
+
return s._match_pattern = this._input.get_regexp(i, !0), s._update(), s;
|
|
496
|
+
}, t.prototype._create = function() {
|
|
497
|
+
return new t(this._input, this);
|
|
498
|
+
}, t.prototype._update = function() {
|
|
499
|
+
}, Ct.Pattern = t, Ct;
|
|
500
|
+
}
|
|
501
|
+
var _e;
|
|
502
|
+
function _i() {
|
|
503
|
+
if (_e)
|
|
504
|
+
return St;
|
|
505
|
+
_e = 1;
|
|
506
|
+
var t = gt().Pattern;
|
|
507
|
+
function i(s, e) {
|
|
508
|
+
t.call(this, s, e), e ? this._line_regexp = this._input.get_regexp(e._line_regexp) : this.__set_whitespace_patterns("", ""), this.newline_count = 0, this.whitespace_before_token = "";
|
|
509
|
+
}
|
|
510
|
+
return i.prototype = new t(), i.prototype.__set_whitespace_patterns = function(s, e) {
|
|
511
|
+
s += "\\t ", e += "\\n\\r", this._match_pattern = this._input.get_regexp(
|
|
512
|
+
"[" + s + e + "]+",
|
|
513
|
+
!0
|
|
514
|
+
), this._newline_regexp = this._input.get_regexp(
|
|
515
|
+
"\\r\\n|[" + e + "]"
|
|
516
|
+
);
|
|
517
|
+
}, i.prototype.read = function() {
|
|
518
|
+
this.newline_count = 0, this.whitespace_before_token = "";
|
|
519
|
+
var s = this._input.read(this._match_pattern);
|
|
520
|
+
if (s === " ")
|
|
521
|
+
this.whitespace_before_token = " ";
|
|
522
|
+
else if (s) {
|
|
523
|
+
var e = this.__split(this._newline_regexp, s);
|
|
524
|
+
this.newline_count = e.length - 1, this.whitespace_before_token = e[this.newline_count];
|
|
525
|
+
}
|
|
526
|
+
return s;
|
|
527
|
+
}, i.prototype.matching = function(s, e) {
|
|
528
|
+
var a = this._create();
|
|
529
|
+
return a.__set_whitespace_patterns(s, e), a._update(), a;
|
|
530
|
+
}, i.prototype._create = function() {
|
|
531
|
+
return new i(this._input, this);
|
|
532
|
+
}, i.prototype.__split = function(s, e) {
|
|
533
|
+
s.lastIndex = 0;
|
|
534
|
+
for (var a = 0, r = [], u = s.exec(e); u; )
|
|
535
|
+
r.push(e.substring(a, u.index)), a = u.index + u[0].length, u = s.exec(e);
|
|
536
|
+
return a < e.length ? r.push(e.substring(a, e.length)) : r.push(""), r;
|
|
537
|
+
}, St.WhitespacePattern = i, St;
|
|
538
|
+
}
|
|
539
|
+
var re;
|
|
540
|
+
function dt() {
|
|
541
|
+
if (re)
|
|
542
|
+
return ut;
|
|
543
|
+
re = 1;
|
|
544
|
+
var t = qt().InputScanner, i = Ne().Token, s = ai().TokenStream, e = _i().WhitespacePattern, a = {
|
|
545
|
+
START: "TK_START",
|
|
546
|
+
RAW: "TK_RAW",
|
|
547
|
+
EOF: "TK_EOF"
|
|
548
|
+
}, r = function(u, o) {
|
|
549
|
+
this._input = new t(u), this._options = o || {}, this.__tokens = null, this._patterns = {}, this._patterns.whitespace = new e(this._input);
|
|
550
|
+
};
|
|
551
|
+
return r.prototype.tokenize = function() {
|
|
552
|
+
this._input.restart(), this.__tokens = new s(), this._reset();
|
|
553
|
+
for (var u, o = new i(a.START, ""), l = null, v = [], x = new s(); o.type !== a.EOF; ) {
|
|
554
|
+
for (u = this._get_next_token(o, l); this._is_comment(u); )
|
|
555
|
+
x.add(u), u = this._get_next_token(o, l);
|
|
556
|
+
x.isEmpty() || (u.comments_before = x, x = new s()), u.parent = l, this._is_opening(u) ? (v.push(l), l = u) : l && this._is_closing(u, l) && (u.opened = l, l.closed = u, l = v.pop(), u.parent = l), u.previous = o, o.next = u, this.__tokens.add(u), o = u;
|
|
557
|
+
}
|
|
558
|
+
return this.__tokens;
|
|
559
|
+
}, r.prototype._is_first_token = function() {
|
|
560
|
+
return this.__tokens.isEmpty();
|
|
561
|
+
}, r.prototype._reset = function() {
|
|
562
|
+
}, r.prototype._get_next_token = function(u, o) {
|
|
563
|
+
this._readWhitespace();
|
|
564
|
+
var l = this._input.read(/.+/g);
|
|
565
|
+
return l ? this._create_token(a.RAW, l) : this._create_token(a.EOF, "");
|
|
566
|
+
}, r.prototype._is_comment = function(u) {
|
|
567
|
+
return !1;
|
|
568
|
+
}, r.prototype._is_opening = function(u) {
|
|
569
|
+
return !1;
|
|
570
|
+
}, r.prototype._is_closing = function(u, o) {
|
|
571
|
+
return !1;
|
|
572
|
+
}, r.prototype._create_token = function(u, o) {
|
|
573
|
+
var l = new i(
|
|
574
|
+
u,
|
|
575
|
+
o,
|
|
576
|
+
this._patterns.whitespace.newline_count,
|
|
577
|
+
this._patterns.whitespace.whitespace_before_token
|
|
578
|
+
);
|
|
579
|
+
return l;
|
|
580
|
+
}, r.prototype._readWhitespace = function() {
|
|
581
|
+
return this._patterns.whitespace.read();
|
|
582
|
+
}, ut.Tokenizer = r, ut.TOKEN = a, ut;
|
|
583
|
+
}
|
|
584
|
+
var Nt = {}, oe;
|
|
585
|
+
function Vt() {
|
|
586
|
+
if (oe)
|
|
587
|
+
return Nt;
|
|
588
|
+
oe = 1;
|
|
589
|
+
function t(i, s) {
|
|
590
|
+
i = typeof i == "string" ? i : i.source, s = typeof s == "string" ? s : s.source, this.__directives_block_pattern = new RegExp(i + / beautify( \w+[:]\w+)+ /.source + s, "g"), this.__directive_pattern = / (\w+)[:](\w+)/g, this.__directives_end_ignore_pattern = new RegExp(i + /\sbeautify\signore:end\s/.source + s, "g");
|
|
591
|
+
}
|
|
592
|
+
return t.prototype.get_directives = function(i) {
|
|
593
|
+
if (!i.match(this.__directives_block_pattern))
|
|
594
|
+
return null;
|
|
595
|
+
var s = {};
|
|
596
|
+
this.__directive_pattern.lastIndex = 0;
|
|
597
|
+
for (var e = this.__directive_pattern.exec(i); e; )
|
|
598
|
+
s[e[1]] = e[2], e = this.__directive_pattern.exec(i);
|
|
599
|
+
return s;
|
|
600
|
+
}, t.prototype.readIgnored = function(i) {
|
|
601
|
+
return i.readUntilAfter(this.__directives_end_ignore_pattern);
|
|
602
|
+
}, Nt.Directives = t, Nt;
|
|
603
|
+
}
|
|
604
|
+
var $t = {}, le;
|
|
605
|
+
function je() {
|
|
606
|
+
if (le)
|
|
607
|
+
return $t;
|
|
608
|
+
le = 1;
|
|
609
|
+
var t = gt().Pattern, i = {
|
|
610
|
+
django: !1,
|
|
611
|
+
erb: !1,
|
|
612
|
+
handlebars: !1,
|
|
613
|
+
php: !1,
|
|
614
|
+
smarty: !1
|
|
615
|
+
};
|
|
616
|
+
function s(e, a) {
|
|
617
|
+
t.call(this, e, a), this.__template_pattern = null, this._disabled = Object.assign({}, i), this._excluded = Object.assign({}, i), a && (this.__template_pattern = this._input.get_regexp(a.__template_pattern), this._excluded = Object.assign(this._excluded, a._excluded), this._disabled = Object.assign(this._disabled, a._disabled));
|
|
618
|
+
var r = new t(e);
|
|
619
|
+
this.__patterns = {
|
|
620
|
+
handlebars_comment: r.starting_with(/{{!--/).until_after(/--}}/),
|
|
621
|
+
handlebars_unescaped: r.starting_with(/{{{/).until_after(/}}}/),
|
|
622
|
+
handlebars: r.starting_with(/{{/).until_after(/}}/),
|
|
623
|
+
php: r.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),
|
|
624
|
+
erb: r.starting_with(/<%[^%]/).until_after(/[^%]%>/),
|
|
625
|
+
// django coflicts with handlebars a bit.
|
|
626
|
+
django: r.starting_with(/{%/).until_after(/%}/),
|
|
627
|
+
django_value: r.starting_with(/{{/).until_after(/}}/),
|
|
628
|
+
django_comment: r.starting_with(/{#/).until_after(/#}/),
|
|
629
|
+
smarty: r.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),
|
|
630
|
+
smarty_comment: r.starting_with(/{\*/).until_after(/\*}/),
|
|
631
|
+
smarty_literal: r.starting_with(/{literal}/).until_after(/{\/literal}/)
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
return s.prototype = new t(), s.prototype._create = function() {
|
|
635
|
+
return new s(this._input, this);
|
|
636
|
+
}, s.prototype._update = function() {
|
|
637
|
+
this.__set_templated_pattern();
|
|
638
|
+
}, s.prototype.disable = function(e) {
|
|
639
|
+
var a = this._create();
|
|
640
|
+
return a._disabled[e] = !0, a._update(), a;
|
|
641
|
+
}, s.prototype.read_options = function(e) {
|
|
642
|
+
var a = this._create();
|
|
643
|
+
for (var r in i)
|
|
644
|
+
a._disabled[r] = e.templating.indexOf(r) === -1;
|
|
645
|
+
return a._update(), a;
|
|
646
|
+
}, s.prototype.exclude = function(e) {
|
|
647
|
+
var a = this._create();
|
|
648
|
+
return a._excluded[e] = !0, a._update(), a;
|
|
649
|
+
}, s.prototype.read = function() {
|
|
650
|
+
var e = "";
|
|
651
|
+
this._match_pattern ? e = this._input.read(this._starting_pattern) : e = this._input.read(this._starting_pattern, this.__template_pattern);
|
|
652
|
+
for (var a = this._read_template(); a; )
|
|
653
|
+
this._match_pattern ? a += this._input.read(this._match_pattern) : a += this._input.readUntil(this.__template_pattern), e += a, a = this._read_template();
|
|
654
|
+
return this._until_after && (e += this._input.readUntilAfter(this._until_pattern)), e;
|
|
655
|
+
}, s.prototype.__set_templated_pattern = function() {
|
|
656
|
+
var e = [];
|
|
657
|
+
this._disabled.php || e.push(this.__patterns.php._starting_pattern.source), this._disabled.handlebars || e.push(this.__patterns.handlebars._starting_pattern.source), this._disabled.erb || e.push(this.__patterns.erb._starting_pattern.source), this._disabled.django || (e.push(this.__patterns.django._starting_pattern.source), e.push(this.__patterns.django_value._starting_pattern.source), e.push(this.__patterns.django_comment._starting_pattern.source)), this._disabled.smarty || e.push(this.__patterns.smarty._starting_pattern.source), this._until_pattern && e.push(this._until_pattern.source), this.__template_pattern = this._input.get_regexp("(?:" + e.join("|") + ")");
|
|
658
|
+
}, s.prototype._read_template = function() {
|
|
659
|
+
var e = "", a = this._input.peek();
|
|
660
|
+
if (a === "<") {
|
|
661
|
+
var r = this._input.peek(1);
|
|
662
|
+
!this._disabled.php && !this._excluded.php && r === "?" && (e = e || this.__patterns.php.read()), !this._disabled.erb && !this._excluded.erb && r === "%" && (e = e || this.__patterns.erb.read());
|
|
663
|
+
} else
|
|
664
|
+
a === "{" && (!this._disabled.handlebars && !this._excluded.handlebars && (e = e || this.__patterns.handlebars_comment.read(), e = e || this.__patterns.handlebars_unescaped.read(), e = e || this.__patterns.handlebars.read()), this._disabled.django || (!this._excluded.django && !this._excluded.handlebars && (e = e || this.__patterns.django_value.read()), this._excluded.django || (e = e || this.__patterns.django_comment.read(), e = e || this.__patterns.django.read())), this._disabled.smarty || this._disabled.django && this._disabled.handlebars && (e = e || this.__patterns.smarty_comment.read(), e = e || this.__patterns.smarty_literal.read(), e = e || this.__patterns.smarty.read()));
|
|
665
|
+
return e;
|
|
666
|
+
}, $t.TemplatablePattern = s, $t;
|
|
667
|
+
}
|
|
668
|
+
var ue;
|
|
669
|
+
function pt() {
|
|
670
|
+
if (ue)
|
|
671
|
+
return Q;
|
|
672
|
+
ue = 1;
|
|
673
|
+
var t = qt().InputScanner, i = dt().Tokenizer, s = dt().TOKEN, e = Vt().Directives, a = $e(), r = gt().Pattern, u = je().TemplatablePattern;
|
|
674
|
+
function o(c, g) {
|
|
675
|
+
return g.indexOf(c) !== -1;
|
|
676
|
+
}
|
|
677
|
+
var l = {
|
|
678
|
+
START_EXPR: "TK_START_EXPR",
|
|
679
|
+
END_EXPR: "TK_END_EXPR",
|
|
680
|
+
START_BLOCK: "TK_START_BLOCK",
|
|
681
|
+
END_BLOCK: "TK_END_BLOCK",
|
|
682
|
+
WORD: "TK_WORD",
|
|
683
|
+
RESERVED: "TK_RESERVED",
|
|
684
|
+
SEMICOLON: "TK_SEMICOLON",
|
|
685
|
+
STRING: "TK_STRING",
|
|
686
|
+
EQUALS: "TK_EQUALS",
|
|
687
|
+
OPERATOR: "TK_OPERATOR",
|
|
688
|
+
COMMA: "TK_COMMA",
|
|
689
|
+
BLOCK_COMMENT: "TK_BLOCK_COMMENT",
|
|
690
|
+
COMMENT: "TK_COMMENT",
|
|
691
|
+
DOT: "TK_DOT",
|
|
692
|
+
UNKNOWN: "TK_UNKNOWN",
|
|
693
|
+
START: s.START,
|
|
694
|
+
RAW: s.RAW,
|
|
695
|
+
EOF: s.EOF
|
|
696
|
+
}, v = new e(/\/\*/, /\*\//), x = /0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/, b = /[0-9]/, y = /[^\d\.]/, S = ">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "), N = ">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";
|
|
697
|
+
N = N.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&"), N = "\\?\\.(?!\\d) " + N, N = N.replace(/ /g, "|");
|
|
698
|
+
var $ = new RegExp(N), p = "continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","), _ = p.concat(["do", "in", "of", "else", "get", "set", "new", "catch", "finally", "typeof", "yield", "async", "await", "from", "as", "class", "extends"]), h = new RegExp("^(?:" + _.join("|") + ")$"), k, O = function(c, g) {
|
|
699
|
+
i.call(this, c, g), this._patterns.whitespace = this._patterns.whitespace.matching(
|
|
700
|
+
/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,
|
|
701
|
+
/\u2028\u2029/.source
|
|
702
|
+
);
|
|
703
|
+
var f = new r(this._input), T = new u(this._input).read_options(this._options);
|
|
704
|
+
this.__patterns = {
|
|
705
|
+
template: T,
|
|
706
|
+
identifier: T.starting_with(a.identifier).matching(a.identifierMatch),
|
|
707
|
+
number: f.matching(x),
|
|
708
|
+
punct: f.matching($),
|
|
709
|
+
// comment ends just before nearest linefeed or end of file
|
|
710
|
+
comment: f.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),
|
|
711
|
+
// /* ... */ comment ends with nearest */ or end of file
|
|
712
|
+
block_comment: f.starting_with(/\/\*/).until_after(/\*\//),
|
|
713
|
+
html_comment_start: f.matching(/<!--/),
|
|
714
|
+
html_comment_end: f.matching(/-->/),
|
|
715
|
+
include: f.starting_with(/#include/).until_after(a.lineBreak),
|
|
716
|
+
shebang: f.starting_with(/#!/).until_after(a.lineBreak),
|
|
717
|
+
xml: f.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),
|
|
718
|
+
single_quote: T.until(/['\\\n\r\u2028\u2029]/),
|
|
719
|
+
double_quote: T.until(/["\\\n\r\u2028\u2029]/),
|
|
720
|
+
template_text: T.until(/[`\\$]/),
|
|
721
|
+
template_expression: T.until(/[`}\\]/)
|
|
722
|
+
};
|
|
723
|
+
};
|
|
724
|
+
O.prototype = new i(), O.prototype._is_comment = function(c) {
|
|
725
|
+
return c.type === l.COMMENT || c.type === l.BLOCK_COMMENT || c.type === l.UNKNOWN;
|
|
726
|
+
}, O.prototype._is_opening = function(c) {
|
|
727
|
+
return c.type === l.START_BLOCK || c.type === l.START_EXPR;
|
|
728
|
+
}, O.prototype._is_closing = function(c, g) {
|
|
729
|
+
return (c.type === l.END_BLOCK || c.type === l.END_EXPR) && g && (c.text === "]" && g.text === "[" || c.text === ")" && g.text === "(" || c.text === "}" && g.text === "{");
|
|
730
|
+
}, O.prototype._reset = function() {
|
|
731
|
+
k = !1;
|
|
732
|
+
}, O.prototype._get_next_token = function(c, g) {
|
|
733
|
+
var f = null;
|
|
734
|
+
this._readWhitespace();
|
|
735
|
+
var T = this._input.peek();
|
|
736
|
+
return T === null ? this._create_token(l.EOF, "") : (f = f || this._read_non_javascript(T), f = f || this._read_string(T), f = f || this._read_pair(T, this._input.peek(1)), f = f || this._read_word(c), f = f || this._read_singles(T), f = f || this._read_comment(T), f = f || this._read_regexp(T, c), f = f || this._read_xml(T, c), f = f || this._read_punctuation(), f = f || this._create_token(l.UNKNOWN, this._input.next()), f);
|
|
737
|
+
}, O.prototype._read_word = function(c) {
|
|
738
|
+
var g;
|
|
739
|
+
if (g = this.__patterns.identifier.read(), g !== "")
|
|
740
|
+
return g = g.replace(a.allLineBreaks, `
|
|
741
|
+
`), !(c.type === l.DOT || c.type === l.RESERVED && (c.text === "set" || c.text === "get")) && h.test(g) ? (g === "in" || g === "of") && (c.type === l.WORD || c.type === l.STRING) ? this._create_token(l.OPERATOR, g) : this._create_token(l.RESERVED, g) : this._create_token(l.WORD, g);
|
|
742
|
+
if (g = this.__patterns.number.read(), g !== "")
|
|
743
|
+
return this._create_token(l.WORD, g);
|
|
744
|
+
}, O.prototype._read_singles = function(c) {
|
|
745
|
+
var g = null;
|
|
746
|
+
return c === "(" || c === "[" ? g = this._create_token(l.START_EXPR, c) : c === ")" || c === "]" ? g = this._create_token(l.END_EXPR, c) : c === "{" ? g = this._create_token(l.START_BLOCK, c) : c === "}" ? g = this._create_token(l.END_BLOCK, c) : c === ";" ? g = this._create_token(l.SEMICOLON, c) : c === "." && y.test(this._input.peek(1)) ? g = this._create_token(l.DOT, c) : c === "," && (g = this._create_token(l.COMMA, c)), g && this._input.next(), g;
|
|
747
|
+
}, O.prototype._read_pair = function(c, g) {
|
|
748
|
+
var f = null;
|
|
749
|
+
return c === "#" && g === "{" && (f = this._create_token(l.START_BLOCK, c + g)), f && (this._input.next(), this._input.next()), f;
|
|
750
|
+
}, O.prototype._read_punctuation = function() {
|
|
751
|
+
var c = this.__patterns.punct.read();
|
|
752
|
+
if (c !== "")
|
|
753
|
+
return c === "=" ? this._create_token(l.EQUALS, c) : c === "?." ? this._create_token(l.DOT, c) : this._create_token(l.OPERATOR, c);
|
|
754
|
+
}, O.prototype._read_non_javascript = function(c) {
|
|
755
|
+
var g = "";
|
|
756
|
+
if (c === "#") {
|
|
757
|
+
if (this._is_first_token() && (g = this.__patterns.shebang.read(), g))
|
|
758
|
+
return this._create_token(l.UNKNOWN, g.trim() + `
|
|
759
|
+
`);
|
|
760
|
+
if (g = this.__patterns.include.read(), g)
|
|
761
|
+
return this._create_token(l.UNKNOWN, g.trim() + `
|
|
762
|
+
`);
|
|
763
|
+
c = this._input.next();
|
|
764
|
+
var f = "#";
|
|
765
|
+
if (this._input.hasNext() && this._input.testChar(b)) {
|
|
766
|
+
do
|
|
767
|
+
c = this._input.next(), f += c;
|
|
768
|
+
while (this._input.hasNext() && c !== "#" && c !== "=");
|
|
769
|
+
return c === "#" || (this._input.peek() === "[" && this._input.peek(1) === "]" ? (f += "[]", this._input.next(), this._input.next()) : this._input.peek() === "{" && this._input.peek(1) === "}" && (f += "{}", this._input.next(), this._input.next())), this._create_token(l.WORD, f);
|
|
770
|
+
}
|
|
771
|
+
this._input.back();
|
|
772
|
+
} else if (c === "<" && this._is_first_token()) {
|
|
773
|
+
if (g = this.__patterns.html_comment_start.read(), g) {
|
|
774
|
+
for (; this._input.hasNext() && !this._input.testChar(a.newline); )
|
|
775
|
+
g += this._input.next();
|
|
776
|
+
return k = !0, this._create_token(l.COMMENT, g);
|
|
777
|
+
}
|
|
778
|
+
} else if (k && c === "-" && (g = this.__patterns.html_comment_end.read(), g))
|
|
779
|
+
return k = !1, this._create_token(l.COMMENT, g);
|
|
780
|
+
return null;
|
|
781
|
+
}, O.prototype._read_comment = function(c) {
|
|
782
|
+
var g = null;
|
|
783
|
+
if (c === "/") {
|
|
784
|
+
var f = "";
|
|
785
|
+
if (this._input.peek(1) === "*") {
|
|
786
|
+
f = this.__patterns.block_comment.read();
|
|
787
|
+
var T = v.get_directives(f);
|
|
788
|
+
T && T.ignore === "start" && (f += v.readIgnored(this._input)), f = f.replace(a.allLineBreaks, `
|
|
789
|
+
`), g = this._create_token(l.BLOCK_COMMENT, f), g.directives = T;
|
|
790
|
+
} else
|
|
791
|
+
this._input.peek(1) === "/" && (f = this.__patterns.comment.read(), g = this._create_token(l.COMMENT, f));
|
|
792
|
+
}
|
|
793
|
+
return g;
|
|
794
|
+
}, O.prototype._read_string = function(c) {
|
|
795
|
+
if (c === "`" || c === "'" || c === '"') {
|
|
796
|
+
var g = this._input.next();
|
|
797
|
+
return this.has_char_escapes = !1, c === "`" ? g += this._read_string_recursive("`", !0, "${") : g += this._read_string_recursive(c), this.has_char_escapes && this._options.unescape_strings && (g = A(g)), this._input.peek() === c && (g += this._input.next()), g = g.replace(a.allLineBreaks, `
|
|
798
|
+
`), this._create_token(l.STRING, g);
|
|
799
|
+
}
|
|
800
|
+
return null;
|
|
801
|
+
}, O.prototype._allow_regexp_or_xml = function(c) {
|
|
802
|
+
return c.type === l.RESERVED && o(c.text, ["return", "case", "throw", "else", "do", "typeof", "yield"]) || c.type === l.END_EXPR && c.text === ")" && c.opened.previous.type === l.RESERVED && o(c.opened.previous.text, ["if", "while", "for"]) || o(c.type, [
|
|
803
|
+
l.COMMENT,
|
|
804
|
+
l.START_EXPR,
|
|
805
|
+
l.START_BLOCK,
|
|
806
|
+
l.START,
|
|
807
|
+
l.END_BLOCK,
|
|
808
|
+
l.OPERATOR,
|
|
809
|
+
l.EQUALS,
|
|
810
|
+
l.EOF,
|
|
811
|
+
l.SEMICOLON,
|
|
812
|
+
l.COMMA
|
|
813
|
+
]);
|
|
814
|
+
}, O.prototype._read_regexp = function(c, g) {
|
|
815
|
+
if (c === "/" && this._allow_regexp_or_xml(g)) {
|
|
816
|
+
for (var f = this._input.next(), T = !1, n = !1; this._input.hasNext() && (T || n || this._input.peek() !== c) && !this._input.testChar(a.newline); )
|
|
817
|
+
f += this._input.peek(), T ? T = !1 : (T = this._input.peek() === "\\", this._input.peek() === "[" ? n = !0 : this._input.peek() === "]" && (n = !1)), this._input.next();
|
|
818
|
+
return this._input.peek() === c && (f += this._input.next(), f += this._input.read(a.identifier)), this._create_token(l.STRING, f);
|
|
819
|
+
}
|
|
820
|
+
return null;
|
|
821
|
+
}, O.prototype._read_xml = function(c, g) {
|
|
822
|
+
if (this._options.e4x && c === "<" && this._allow_regexp_or_xml(g)) {
|
|
823
|
+
var f = "", T = this.__patterns.xml.read_match();
|
|
824
|
+
if (T) {
|
|
825
|
+
for (var n = T[2].replace(/^{\s+/, "{").replace(/\s+}$/, "}"), d = n.indexOf("{") === 0, m = 0; T; ) {
|
|
826
|
+
var R = !!T[1], C = T[2], P = !!T[T.length - 1] || C.slice(0, 8) === "![CDATA[";
|
|
827
|
+
if (!P && (C === n || d && C.replace(/^{\s+/, "{").replace(/\s+}$/, "}")) && (R ? --m : ++m), f += T[0], m <= 0)
|
|
828
|
+
break;
|
|
829
|
+
T = this.__patterns.xml.read_match();
|
|
830
|
+
}
|
|
831
|
+
return T || (f += this._input.match(/[\s\S]*/g)[0]), f = f.replace(a.allLineBreaks, `
|
|
832
|
+
`), this._create_token(l.STRING, f);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return null;
|
|
836
|
+
};
|
|
837
|
+
function A(c) {
|
|
838
|
+
for (var g = "", f = 0, T = new t(c), n = null; T.hasNext(); )
|
|
839
|
+
if (n = T.match(/([\s]|[^\\]|\\\\)+/g), n && (g += n[0]), T.peek() === "\\") {
|
|
840
|
+
if (T.next(), T.peek() === "x")
|
|
841
|
+
n = T.match(/x([0-9A-Fa-f]{2})/g);
|
|
842
|
+
else if (T.peek() === "u")
|
|
843
|
+
n = T.match(/u([0-9A-Fa-f]{4})/g);
|
|
844
|
+
else {
|
|
845
|
+
g += "\\", T.hasNext() && (g += T.next());
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
if (!n || (f = parseInt(n[1], 16), f > 126 && f <= 255 && n[0].indexOf("x") === 0))
|
|
849
|
+
return c;
|
|
850
|
+
if (f >= 0 && f < 32) {
|
|
851
|
+
g += "\\" + n[0];
|
|
852
|
+
continue;
|
|
853
|
+
} else
|
|
854
|
+
f === 34 || f === 39 || f === 92 ? g += "\\" + String.fromCharCode(f) : g += String.fromCharCode(f);
|
|
855
|
+
}
|
|
856
|
+
return g;
|
|
857
|
+
}
|
|
858
|
+
return O.prototype._read_string_recursive = function(c, g, f) {
|
|
859
|
+
var T, n;
|
|
860
|
+
c === "'" ? n = this.__patterns.single_quote : c === '"' ? n = this.__patterns.double_quote : c === "`" ? n = this.__patterns.template_text : c === "}" && (n = this.__patterns.template_expression);
|
|
861
|
+
for (var d = n.read(), m = ""; this._input.hasNext(); ) {
|
|
862
|
+
if (m = this._input.next(), m === c || !g && a.newline.test(m)) {
|
|
863
|
+
this._input.back();
|
|
864
|
+
break;
|
|
865
|
+
} else
|
|
866
|
+
m === "\\" && this._input.hasNext() ? (T = this._input.peek(), T === "x" || T === "u" ? this.has_char_escapes = !0 : T === "\r" && this._input.peek(1) === `
|
|
867
|
+
` && this._input.next(), m += this._input.next()) : f && (f === "${" && m === "$" && this._input.peek() === "{" && (m += this._input.next()), f === m && (c === "`" ? m += this._read_string_recursive("}", g, "`") : m += this._read_string_recursive("`", g, "${"), this._input.hasNext() && (m += this._input.next())));
|
|
868
|
+
m += n.read(), d += m;
|
|
869
|
+
}
|
|
870
|
+
return d;
|
|
871
|
+
}, Q.Tokenizer = O, Q.TOKEN = l, Q.positionable_operators = S.slice(), Q.line_starters = p.slice(), Q;
|
|
872
|
+
}
|
|
873
|
+
var pe;
|
|
874
|
+
function ri() {
|
|
875
|
+
if (pe)
|
|
876
|
+
return wt;
|
|
877
|
+
pe = 1;
|
|
878
|
+
var t = Ut().Output, i = Ne().Token, s = $e(), e = Pe().Options, a = pt().Tokenizer, r = pt().line_starters, u = pt().positionable_operators, o = pt().TOKEN;
|
|
879
|
+
function l(n, d) {
|
|
880
|
+
return d.indexOf(n) !== -1;
|
|
881
|
+
}
|
|
882
|
+
function v(n) {
|
|
883
|
+
return n.replace(/^\s+/g, "");
|
|
884
|
+
}
|
|
885
|
+
function x(n) {
|
|
886
|
+
for (var d = {}, m = 0; m < n.length; m++)
|
|
887
|
+
d[n[m].replace(/-/g, "_")] = n[m];
|
|
888
|
+
return d;
|
|
889
|
+
}
|
|
890
|
+
function b(n, d) {
|
|
891
|
+
return n && n.type === o.RESERVED && n.text === d;
|
|
892
|
+
}
|
|
893
|
+
function y(n, d) {
|
|
894
|
+
return n && n.type === o.RESERVED && l(n.text, d);
|
|
895
|
+
}
|
|
896
|
+
var S = ["case", "return", "do", "if", "throw", "else", "await", "break", "continue", "async"], N = ["before-newline", "after-newline", "preserve-newline"], $ = x(N), p = [$.before_newline, $.preserve_newline], _ = {
|
|
897
|
+
BlockStatement: "BlockStatement",
|
|
898
|
+
// 'BLOCK'
|
|
899
|
+
Statement: "Statement",
|
|
900
|
+
// 'STATEMENT'
|
|
901
|
+
ObjectLiteral: "ObjectLiteral",
|
|
902
|
+
// 'OBJECT',
|
|
903
|
+
ArrayLiteral: "ArrayLiteral",
|
|
904
|
+
//'[EXPRESSION]',
|
|
905
|
+
ForInitializer: "ForInitializer",
|
|
906
|
+
//'(FOR-EXPRESSION)',
|
|
907
|
+
Conditional: "Conditional",
|
|
908
|
+
//'(COND-EXPRESSION)',
|
|
909
|
+
Expression: "Expression"
|
|
910
|
+
//'(EXPRESSION)'
|
|
911
|
+
};
|
|
912
|
+
function h(n, d) {
|
|
913
|
+
d.multiline_frame || d.mode === _.ForInitializer || d.mode === _.Conditional || n.remove_indent(d.start_line_index);
|
|
914
|
+
}
|
|
915
|
+
function k(n) {
|
|
916
|
+
n = n.replace(s.allLineBreaks, `
|
|
917
|
+
`);
|
|
918
|
+
for (var d = [], m = n.indexOf(`
|
|
919
|
+
`); m !== -1; )
|
|
920
|
+
d.push(n.substring(0, m)), n = n.substring(m + 1), m = n.indexOf(`
|
|
921
|
+
`);
|
|
922
|
+
return n.length && d.push(n), d;
|
|
923
|
+
}
|
|
924
|
+
function O(n) {
|
|
925
|
+
return n === _.ArrayLiteral;
|
|
926
|
+
}
|
|
927
|
+
function A(n) {
|
|
928
|
+
return l(n, [_.Expression, _.ForInitializer, _.Conditional]);
|
|
929
|
+
}
|
|
930
|
+
function c(n, d) {
|
|
931
|
+
for (var m = 0; m < n.length; m++) {
|
|
932
|
+
var R = n[m].trim();
|
|
933
|
+
if (R.charAt(0) !== d)
|
|
934
|
+
return !1;
|
|
935
|
+
}
|
|
936
|
+
return !0;
|
|
937
|
+
}
|
|
938
|
+
function g(n, d) {
|
|
939
|
+
for (var m = 0, R = n.length, C; m < R; m++)
|
|
940
|
+
if (C = n[m], C && C.indexOf(d) !== 0)
|
|
941
|
+
return !1;
|
|
942
|
+
return !0;
|
|
943
|
+
}
|
|
944
|
+
function f(n, d) {
|
|
945
|
+
d = d || {}, this._source_text = n || "", this._output = null, this._tokens = null, this._last_last_text = null, this._flags = null, this._previous_flags = null, this._flag_store = null, this._options = new e(d);
|
|
946
|
+
}
|
|
947
|
+
f.prototype.create_flags = function(n, d) {
|
|
948
|
+
var m = 0;
|
|
949
|
+
n && (m = n.indentation_level, !this._output.just_added_newline() && n.line_indent_level > m && (m = n.line_indent_level));
|
|
950
|
+
var R = {
|
|
951
|
+
mode: d,
|
|
952
|
+
parent: n,
|
|
953
|
+
last_token: n ? n.last_token : new i(o.START_BLOCK, ""),
|
|
954
|
+
// last token text
|
|
955
|
+
last_word: n ? n.last_word : "",
|
|
956
|
+
// last TOKEN.WORD passed
|
|
957
|
+
declaration_statement: !1,
|
|
958
|
+
declaration_assignment: !1,
|
|
959
|
+
multiline_frame: !1,
|
|
960
|
+
inline_frame: !1,
|
|
961
|
+
if_block: !1,
|
|
962
|
+
else_block: !1,
|
|
963
|
+
class_start_block: !1,
|
|
964
|
+
// class A { INSIDE HERE } or class B extends C { INSIDE HERE }
|
|
965
|
+
do_block: !1,
|
|
966
|
+
do_while: !1,
|
|
967
|
+
import_block: !1,
|
|
968
|
+
in_case_statement: !1,
|
|
969
|
+
// switch(..){ INSIDE HERE }
|
|
970
|
+
in_case: !1,
|
|
971
|
+
// we're on the exact line with "case 0:"
|
|
972
|
+
case_body: !1,
|
|
973
|
+
// the indented case-action block
|
|
974
|
+
case_block: !1,
|
|
975
|
+
// the indented case-action block is wrapped with {}
|
|
976
|
+
indentation_level: m,
|
|
977
|
+
alignment: 0,
|
|
978
|
+
line_indent_level: n ? n.line_indent_level : m,
|
|
979
|
+
start_line_index: this._output.get_line_number(),
|
|
980
|
+
ternary_depth: 0
|
|
981
|
+
};
|
|
982
|
+
return R;
|
|
983
|
+
}, f.prototype._reset = function(n) {
|
|
984
|
+
var d = n.match(/^[\t ]*/)[0];
|
|
985
|
+
this._last_last_text = "", this._output = new t(this._options, d), this._output.raw = this._options.test_output_raw, this._flag_store = [], this.set_mode(_.BlockStatement);
|
|
986
|
+
var m = new a(n, this._options);
|
|
987
|
+
return this._tokens = m.tokenize(), n;
|
|
988
|
+
}, f.prototype.beautify = function() {
|
|
989
|
+
if (this._options.disabled)
|
|
990
|
+
return this._source_text;
|
|
991
|
+
var n, d = this._reset(this._source_text), m = this._options.eol;
|
|
992
|
+
this._options.eol === "auto" && (m = `
|
|
993
|
+
`, d && s.lineBreak.test(d || "") && (m = d.match(s.lineBreak)[0]));
|
|
994
|
+
for (var R = this._tokens.next(); R; )
|
|
995
|
+
this.handle_token(R), this._last_last_text = this._flags.last_token.text, this._flags.last_token = R, R = this._tokens.next();
|
|
996
|
+
return n = this._output.get_code(m), n;
|
|
997
|
+
}, f.prototype.handle_token = function(n, d) {
|
|
998
|
+
n.type === o.START_EXPR ? this.handle_start_expr(n) : n.type === o.END_EXPR ? this.handle_end_expr(n) : n.type === o.START_BLOCK ? this.handle_start_block(n) : n.type === o.END_BLOCK ? this.handle_end_block(n) : n.type === o.WORD ? this.handle_word(n) : n.type === o.RESERVED ? this.handle_word(n) : n.type === o.SEMICOLON ? this.handle_semicolon(n) : n.type === o.STRING ? this.handle_string(n) : n.type === o.EQUALS ? this.handle_equals(n) : n.type === o.OPERATOR ? this.handle_operator(n) : n.type === o.COMMA ? this.handle_comma(n) : n.type === o.BLOCK_COMMENT ? this.handle_block_comment(n, d) : n.type === o.COMMENT ? this.handle_comment(n, d) : n.type === o.DOT ? this.handle_dot(n) : n.type === o.EOF ? this.handle_eof(n) : n.type === o.UNKNOWN ? this.handle_unknown(n, d) : this.handle_unknown(n, d);
|
|
999
|
+
}, f.prototype.handle_whitespace_and_comments = function(n, d) {
|
|
1000
|
+
var m = n.newlines, R = this._options.keep_array_indentation && O(this._flags.mode);
|
|
1001
|
+
if (n.comments_before)
|
|
1002
|
+
for (var C = n.comments_before.next(); C; )
|
|
1003
|
+
this.handle_whitespace_and_comments(C, d), this.handle_token(C, d), C = n.comments_before.next();
|
|
1004
|
+
if (R)
|
|
1005
|
+
for (var P = 0; P < m; P += 1)
|
|
1006
|
+
this.print_newline(P > 0, d);
|
|
1007
|
+
else if (this._options.max_preserve_newlines && m > this._options.max_preserve_newlines && (m = this._options.max_preserve_newlines), this._options.preserve_newlines && m > 1) {
|
|
1008
|
+
this.print_newline(!1, d);
|
|
1009
|
+
for (var L = 1; L < m; L += 1)
|
|
1010
|
+
this.print_newline(!0, d);
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
var T = ["async", "break", "continue", "return", "throw", "yield"];
|
|
1014
|
+
return f.prototype.allow_wrap_or_preserved_newline = function(n, d) {
|
|
1015
|
+
if (d = d === void 0 ? !1 : d, !this._output.just_added_newline()) {
|
|
1016
|
+
var m = this._options.preserve_newlines && n.newlines || d, R = l(this._flags.last_token.text, u) || l(n.text, u);
|
|
1017
|
+
if (R) {
|
|
1018
|
+
var C = l(this._flags.last_token.text, u) && l(this._options.operator_position, p) || l(n.text, u);
|
|
1019
|
+
m = m && C;
|
|
1020
|
+
}
|
|
1021
|
+
if (m)
|
|
1022
|
+
this.print_newline(!1, !0);
|
|
1023
|
+
else if (this._options.wrap_line_length) {
|
|
1024
|
+
if (y(this._flags.last_token, T))
|
|
1025
|
+
return;
|
|
1026
|
+
this._output.set_wrap_point();
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}, f.prototype.print_newline = function(n, d) {
|
|
1030
|
+
if (!d && this._flags.last_token.text !== ";" && this._flags.last_token.text !== "," && this._flags.last_token.text !== "=" && (this._flags.last_token.type !== o.OPERATOR || this._flags.last_token.text === "--" || this._flags.last_token.text === "++"))
|
|
1031
|
+
for (var m = this._tokens.peek(); this._flags.mode === _.Statement && !(this._flags.if_block && b(m, "else")) && !this._flags.do_block; )
|
|
1032
|
+
this.restore_mode();
|
|
1033
|
+
this._output.add_new_line(n) && (this._flags.multiline_frame = !0);
|
|
1034
|
+
}, f.prototype.print_token_line_indentation = function(n) {
|
|
1035
|
+
this._output.just_added_newline() && (this._options.keep_array_indentation && n.newlines && (n.text === "[" || O(this._flags.mode)) ? (this._output.current_line.set_indent(-1), this._output.current_line.push(n.whitespace_before), this._output.space_before_token = !1) : this._output.set_indent(this._flags.indentation_level, this._flags.alignment) && (this._flags.line_indent_level = this._flags.indentation_level));
|
|
1036
|
+
}, f.prototype.print_token = function(n) {
|
|
1037
|
+
if (this._output.raw) {
|
|
1038
|
+
this._output.add_raw_token(n);
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
if (this._options.comma_first && n.previous && n.previous.type === o.COMMA && this._output.just_added_newline() && this._output.previous_line.last() === ",") {
|
|
1042
|
+
var d = this._output.previous_line.pop();
|
|
1043
|
+
this._output.previous_line.is_empty() && (this._output.previous_line.push(d), this._output.trim(!0), this._output.current_line.pop(), this._output.trim()), this.print_token_line_indentation(n), this._output.add_token(","), this._output.space_before_token = !0;
|
|
1044
|
+
}
|
|
1045
|
+
this.print_token_line_indentation(n), this._output.non_breaking_space = !0, this._output.add_token(n.text), this._output.previous_token_wrapped && (this._flags.multiline_frame = !0);
|
|
1046
|
+
}, f.prototype.indent = function() {
|
|
1047
|
+
this._flags.indentation_level += 1, this._output.set_indent(this._flags.indentation_level, this._flags.alignment);
|
|
1048
|
+
}, f.prototype.deindent = function() {
|
|
1049
|
+
this._flags.indentation_level > 0 && (!this._flags.parent || this._flags.indentation_level > this._flags.parent.indentation_level) && (this._flags.indentation_level -= 1, this._output.set_indent(this._flags.indentation_level, this._flags.alignment));
|
|
1050
|
+
}, f.prototype.set_mode = function(n) {
|
|
1051
|
+
this._flags ? (this._flag_store.push(this._flags), this._previous_flags = this._flags) : this._previous_flags = this.create_flags(null, n), this._flags = this.create_flags(this._previous_flags, n), this._output.set_indent(this._flags.indentation_level, this._flags.alignment);
|
|
1052
|
+
}, f.prototype.restore_mode = function() {
|
|
1053
|
+
this._flag_store.length > 0 && (this._previous_flags = this._flags, this._flags = this._flag_store.pop(), this._previous_flags.mode === _.Statement && h(this._output, this._previous_flags), this._output.set_indent(this._flags.indentation_level, this._flags.alignment));
|
|
1054
|
+
}, f.prototype.start_of_object_property = function() {
|
|
1055
|
+
return this._flags.parent.mode === _.ObjectLiteral && this._flags.mode === _.Statement && (this._flags.last_token.text === ":" && this._flags.ternary_depth === 0 || y(this._flags.last_token, ["get", "set"]));
|
|
1056
|
+
}, f.prototype.start_of_statement = function(n) {
|
|
1057
|
+
var d = !1;
|
|
1058
|
+
return d = d || y(this._flags.last_token, ["var", "let", "const"]) && n.type === o.WORD, d = d || b(this._flags.last_token, "do"), d = d || !(this._flags.parent.mode === _.ObjectLiteral && this._flags.mode === _.Statement) && y(this._flags.last_token, T) && !n.newlines, d = d || b(this._flags.last_token, "else") && !(b(n, "if") && !n.comments_before), d = d || this._flags.last_token.type === o.END_EXPR && (this._previous_flags.mode === _.ForInitializer || this._previous_flags.mode === _.Conditional), d = d || this._flags.last_token.type === o.WORD && this._flags.mode === _.BlockStatement && !this._flags.in_case && !(n.text === "--" || n.text === "++") && this._last_last_text !== "function" && n.type !== o.WORD && n.type !== o.RESERVED, d = d || this._flags.mode === _.ObjectLiteral && (this._flags.last_token.text === ":" && this._flags.ternary_depth === 0 || y(this._flags.last_token, ["get", "set"])), d ? (this.set_mode(_.Statement), this.indent(), this.handle_whitespace_and_comments(n, !0), this.start_of_object_property() || this.allow_wrap_or_preserved_newline(
|
|
1059
|
+
n,
|
|
1060
|
+
y(n, ["do", "for", "if", "while"])
|
|
1061
|
+
), !0) : !1;
|
|
1062
|
+
}, f.prototype.handle_start_expr = function(n) {
|
|
1063
|
+
this.start_of_statement(n) || this.handle_whitespace_and_comments(n);
|
|
1064
|
+
var d = _.Expression;
|
|
1065
|
+
if (n.text === "[") {
|
|
1066
|
+
if (this._flags.last_token.type === o.WORD || this._flags.last_token.text === ")") {
|
|
1067
|
+
y(this._flags.last_token, r) && (this._output.space_before_token = !0), this.print_token(n), this.set_mode(d), this.indent(), this._options.space_in_paren && (this._output.space_before_token = !0);
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
d = _.ArrayLiteral, O(this._flags.mode) && (this._flags.last_token.text === "[" || this._flags.last_token.text === "," && (this._last_last_text === "]" || this._last_last_text === "}")) && (this._options.keep_array_indentation || this.print_newline()), l(this._flags.last_token.type, [o.START_EXPR, o.END_EXPR, o.WORD, o.OPERATOR, o.DOT]) || (this._output.space_before_token = !0);
|
|
1071
|
+
} else {
|
|
1072
|
+
if (this._flags.last_token.type === o.RESERVED)
|
|
1073
|
+
this._flags.last_token.text === "for" ? (this._output.space_before_token = this._options.space_before_conditional, d = _.ForInitializer) : l(this._flags.last_token.text, ["if", "while", "switch"]) ? (this._output.space_before_token = this._options.space_before_conditional, d = _.Conditional) : l(this._flags.last_word, ["await", "async"]) ? this._output.space_before_token = !0 : this._flags.last_token.text === "import" && n.whitespace_before === "" ? this._output.space_before_token = !1 : (l(this._flags.last_token.text, r) || this._flags.last_token.text === "catch") && (this._output.space_before_token = !0);
|
|
1074
|
+
else if (this._flags.last_token.type === o.EQUALS || this._flags.last_token.type === o.OPERATOR)
|
|
1075
|
+
this.start_of_object_property() || this.allow_wrap_or_preserved_newline(n);
|
|
1076
|
+
else if (this._flags.last_token.type === o.WORD) {
|
|
1077
|
+
this._output.space_before_token = !1;
|
|
1078
|
+
var m = this._tokens.peek(-3);
|
|
1079
|
+
if (this._options.space_after_named_function && m) {
|
|
1080
|
+
var R = this._tokens.peek(-4);
|
|
1081
|
+
y(m, ["async", "function"]) || m.text === "*" && y(R, ["async", "function"]) ? this._output.space_before_token = !0 : this._flags.mode === _.ObjectLiteral ? (m.text === "{" || m.text === "," || m.text === "*" && (R.text === "{" || R.text === ",")) && (this._output.space_before_token = !0) : this._flags.parent && this._flags.parent.class_start_block && (this._output.space_before_token = !0);
|
|
1082
|
+
}
|
|
1083
|
+
} else
|
|
1084
|
+
this.allow_wrap_or_preserved_newline(n);
|
|
1085
|
+
(this._flags.last_token.type === o.RESERVED && (this._flags.last_word === "function" || this._flags.last_word === "typeof") || this._flags.last_token.text === "*" && (l(this._last_last_text, ["function", "yield"]) || this._flags.mode === _.ObjectLiteral && l(this._last_last_text, ["{", ","]))) && (this._output.space_before_token = this._options.space_after_anon_function);
|
|
1086
|
+
}
|
|
1087
|
+
this._flags.last_token.text === ";" || this._flags.last_token.type === o.START_BLOCK ? this.print_newline() : (this._flags.last_token.type === o.END_EXPR || this._flags.last_token.type === o.START_EXPR || this._flags.last_token.type === o.END_BLOCK || this._flags.last_token.text === "." || this._flags.last_token.type === o.COMMA) && this.allow_wrap_or_preserved_newline(n, n.newlines), this.print_token(n), this.set_mode(d), this._options.space_in_paren && (this._output.space_before_token = !0), this.indent();
|
|
1088
|
+
}, f.prototype.handle_end_expr = function(n) {
|
|
1089
|
+
for (; this._flags.mode === _.Statement; )
|
|
1090
|
+
this.restore_mode();
|
|
1091
|
+
this.handle_whitespace_and_comments(n), this._flags.multiline_frame && this.allow_wrap_or_preserved_newline(
|
|
1092
|
+
n,
|
|
1093
|
+
n.text === "]" && O(this._flags.mode) && !this._options.keep_array_indentation
|
|
1094
|
+
), this._options.space_in_paren && (this._flags.last_token.type === o.START_EXPR && !this._options.space_in_empty_paren ? (this._output.trim(), this._output.space_before_token = !1) : this._output.space_before_token = !0), this.deindent(), this.print_token(n), this.restore_mode(), h(this._output, this._previous_flags), this._flags.do_while && this._previous_flags.mode === _.Conditional && (this._previous_flags.mode = _.Expression, this._flags.do_block = !1, this._flags.do_while = !1);
|
|
1095
|
+
}, f.prototype.handle_start_block = function(n) {
|
|
1096
|
+
this.handle_whitespace_and_comments(n);
|
|
1097
|
+
var d = this._tokens.peek(), m = this._tokens.peek(1);
|
|
1098
|
+
this._flags.last_word === "switch" && this._flags.last_token.type === o.END_EXPR ? (this.set_mode(_.BlockStatement), this._flags.in_case_statement = !0) : this._flags.case_body ? this.set_mode(_.BlockStatement) : m && (l(m.text, [":", ","]) && l(d.type, [o.STRING, o.WORD, o.RESERVED]) || l(d.text, ["get", "set", "..."]) && l(m.type, [o.WORD, o.RESERVED])) ? l(this._last_last_text, ["class", "interface"]) && !l(m.text, [":", ","]) ? this.set_mode(_.BlockStatement) : this.set_mode(_.ObjectLiteral) : this._flags.last_token.type === o.OPERATOR && this._flags.last_token.text === "=>" ? this.set_mode(_.BlockStatement) : l(this._flags.last_token.type, [o.EQUALS, o.START_EXPR, o.COMMA, o.OPERATOR]) || y(this._flags.last_token, ["return", "throw", "import", "default"]) ? this.set_mode(_.ObjectLiteral) : this.set_mode(_.BlockStatement), this._flags.last_token && y(this._flags.last_token.previous, ["class", "extends"]) && (this._flags.class_start_block = !0);
|
|
1099
|
+
var R = !d.comments_before && d.text === "}", C = R && this._flags.last_word === "function" && this._flags.last_token.type === o.END_EXPR;
|
|
1100
|
+
if (this._options.brace_preserve_inline) {
|
|
1101
|
+
var P = 0, L = null;
|
|
1102
|
+
this._flags.inline_frame = !0;
|
|
1103
|
+
do
|
|
1104
|
+
if (P += 1, L = this._tokens.peek(P - 1), L.newlines) {
|
|
1105
|
+
this._flags.inline_frame = !1;
|
|
1106
|
+
break;
|
|
1107
|
+
}
|
|
1108
|
+
while (L.type !== o.EOF && !(L.type === o.END_BLOCK && L.opened === n));
|
|
1109
|
+
}
|
|
1110
|
+
(this._options.brace_style === "expand" || this._options.brace_style === "none" && n.newlines) && !this._flags.inline_frame ? this._flags.last_token.type !== o.OPERATOR && (C || this._flags.last_token.type === o.EQUALS || y(this._flags.last_token, S) && this._flags.last_token.text !== "else") ? this._output.space_before_token = !0 : this.print_newline(!1, !0) : (O(this._previous_flags.mode) && (this._flags.last_token.type === o.START_EXPR || this._flags.last_token.type === o.COMMA) && ((this._flags.last_token.type === o.COMMA || this._options.space_in_paren) && (this._output.space_before_token = !0), (this._flags.last_token.type === o.COMMA || this._flags.last_token.type === o.START_EXPR && this._flags.inline_frame) && (this.allow_wrap_or_preserved_newline(n), this._previous_flags.multiline_frame = this._previous_flags.multiline_frame || this._flags.multiline_frame, this._flags.multiline_frame = !1)), this._flags.last_token.type !== o.OPERATOR && this._flags.last_token.type !== o.START_EXPR && (l(this._flags.last_token.type, [o.START_BLOCK, o.SEMICOLON]) && !this._flags.inline_frame ? this.print_newline() : this._output.space_before_token = !0)), this.print_token(n), this.indent(), !R && !(this._options.brace_preserve_inline && this._flags.inline_frame) && this.print_newline();
|
|
1111
|
+
}, f.prototype.handle_end_block = function(n) {
|
|
1112
|
+
for (this.handle_whitespace_and_comments(n); this._flags.mode === _.Statement; )
|
|
1113
|
+
this.restore_mode();
|
|
1114
|
+
var d = this._flags.last_token.type === o.START_BLOCK;
|
|
1115
|
+
this._flags.inline_frame && !d ? this._output.space_before_token = !0 : this._options.brace_style === "expand" ? d || this.print_newline() : d || (O(this._flags.mode) && this._options.keep_array_indentation ? (this._options.keep_array_indentation = !1, this.print_newline(), this._options.keep_array_indentation = !0) : this.print_newline()), this.restore_mode(), this.print_token(n);
|
|
1116
|
+
}, f.prototype.handle_word = function(n) {
|
|
1117
|
+
if (n.type === o.RESERVED) {
|
|
1118
|
+
if (l(n.text, ["set", "get"]) && this._flags.mode !== _.ObjectLiteral)
|
|
1119
|
+
n.type = o.WORD;
|
|
1120
|
+
else if (n.text === "import" && l(this._tokens.peek().text, ["(", "."]))
|
|
1121
|
+
n.type = o.WORD;
|
|
1122
|
+
else if (l(n.text, ["as", "from"]) && !this._flags.import_block)
|
|
1123
|
+
n.type = o.WORD;
|
|
1124
|
+
else if (this._flags.mode === _.ObjectLiteral) {
|
|
1125
|
+
var d = this._tokens.peek();
|
|
1126
|
+
d.text === ":" && (n.type = o.WORD);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
if (this.start_of_statement(n) ? y(this._flags.last_token, ["var", "let", "const"]) && n.type === o.WORD && (this._flags.declaration_statement = !0) : n.newlines && !A(this._flags.mode) && (this._flags.last_token.type !== o.OPERATOR || this._flags.last_token.text === "--" || this._flags.last_token.text === "++") && this._flags.last_token.type !== o.EQUALS && (this._options.preserve_newlines || !y(this._flags.last_token, ["var", "let", "const", "set", "get"])) ? (this.handle_whitespace_and_comments(n), this.print_newline()) : this.handle_whitespace_and_comments(n), this._flags.do_block && !this._flags.do_while)
|
|
1130
|
+
if (b(n, "while")) {
|
|
1131
|
+
this._output.space_before_token = !0, this.print_token(n), this._output.space_before_token = !0, this._flags.do_while = !0;
|
|
1132
|
+
return;
|
|
1133
|
+
} else
|
|
1134
|
+
this.print_newline(), this._flags.do_block = !1;
|
|
1135
|
+
if (this._flags.if_block)
|
|
1136
|
+
if (!this._flags.else_block && b(n, "else"))
|
|
1137
|
+
this._flags.else_block = !0;
|
|
1138
|
+
else {
|
|
1139
|
+
for (; this._flags.mode === _.Statement; )
|
|
1140
|
+
this.restore_mode();
|
|
1141
|
+
this._flags.if_block = !1, this._flags.else_block = !1;
|
|
1142
|
+
}
|
|
1143
|
+
if (this._flags.in_case_statement && y(n, ["case", "default"])) {
|
|
1144
|
+
this.print_newline(), !this._flags.case_block && (this._flags.case_body || this._options.jslint_happy) && this.deindent(), this._flags.case_body = !1, this.print_token(n), this._flags.in_case = !0;
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
if ((this._flags.last_token.type === o.COMMA || this._flags.last_token.type === o.START_EXPR || this._flags.last_token.type === o.EQUALS || this._flags.last_token.type === o.OPERATOR) && (this.start_of_object_property() || this.allow_wrap_or_preserved_newline(n)), b(n, "function")) {
|
|
1148
|
+
(l(this._flags.last_token.text, ["}", ";"]) || this._output.just_added_newline() && !(l(this._flags.last_token.text, ["(", "[", "{", ":", "=", ","]) || this._flags.last_token.type === o.OPERATOR)) && !this._output.just_added_blankline() && !n.comments_before && (this.print_newline(), this.print_newline(!0)), this._flags.last_token.type === o.RESERVED || this._flags.last_token.type === o.WORD ? y(this._flags.last_token, ["get", "set", "new", "export"]) || y(this._flags.last_token, T) ? this._output.space_before_token = !0 : b(this._flags.last_token, "default") && this._last_last_text === "export" ? this._output.space_before_token = !0 : this._flags.last_token.text === "declare" ? this._output.space_before_token = !0 : this.print_newline() : this._flags.last_token.type === o.OPERATOR || this._flags.last_token.text === "=" ? this._output.space_before_token = !0 : !this._flags.multiline_frame && (A(this._flags.mode) || O(this._flags.mode)) || this.print_newline(), this.print_token(n), this._flags.last_word = n.text;
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
var m = "NONE";
|
|
1152
|
+
if (this._flags.last_token.type === o.END_BLOCK ? this._previous_flags.inline_frame ? m = "SPACE" : y(n, ["else", "catch", "finally", "from"]) ? this._options.brace_style === "expand" || this._options.brace_style === "end-expand" || this._options.brace_style === "none" && n.newlines ? m = "NEWLINE" : (m = "SPACE", this._output.space_before_token = !0) : m = "NEWLINE" : this._flags.last_token.type === o.SEMICOLON && this._flags.mode === _.BlockStatement ? m = "NEWLINE" : this._flags.last_token.type === o.SEMICOLON && A(this._flags.mode) ? m = "SPACE" : this._flags.last_token.type === o.STRING ? m = "NEWLINE" : this._flags.last_token.type === o.RESERVED || this._flags.last_token.type === o.WORD || this._flags.last_token.text === "*" && (l(this._last_last_text, ["function", "yield"]) || this._flags.mode === _.ObjectLiteral && l(this._last_last_text, ["{", ","])) ? m = "SPACE" : this._flags.last_token.type === o.START_BLOCK ? this._flags.inline_frame ? m = "SPACE" : m = "NEWLINE" : this._flags.last_token.type === o.END_EXPR && (this._output.space_before_token = !0, m = "NEWLINE"), y(n, r) && this._flags.last_token.text !== ")" && (this._flags.inline_frame || this._flags.last_token.text === "else" || this._flags.last_token.text === "export" ? m = "SPACE" : m = "NEWLINE"), y(n, ["else", "catch", "finally"]))
|
|
1153
|
+
if ((!(this._flags.last_token.type === o.END_BLOCK && this._previous_flags.mode === _.BlockStatement) || this._options.brace_style === "expand" || this._options.brace_style === "end-expand" || this._options.brace_style === "none" && n.newlines) && !this._flags.inline_frame)
|
|
1154
|
+
this.print_newline();
|
|
1155
|
+
else {
|
|
1156
|
+
this._output.trim(!0);
|
|
1157
|
+
var R = this._output.current_line;
|
|
1158
|
+
R.last() !== "}" && this.print_newline(), this._output.space_before_token = !0;
|
|
1159
|
+
}
|
|
1160
|
+
else
|
|
1161
|
+
m === "NEWLINE" ? y(this._flags.last_token, S) ? this._output.space_before_token = !0 : this._flags.last_token.text === "declare" && y(n, ["var", "let", "const"]) ? this._output.space_before_token = !0 : this._flags.last_token.type !== o.END_EXPR ? (this._flags.last_token.type !== o.START_EXPR || !y(n, ["var", "let", "const"])) && this._flags.last_token.text !== ":" && (b(n, "if") && b(n.previous, "else") ? this._output.space_before_token = !0 : this.print_newline()) : y(n, r) && this._flags.last_token.text !== ")" && this.print_newline() : this._flags.multiline_frame && O(this._flags.mode) && this._flags.last_token.text === "," && this._last_last_text === "}" ? this.print_newline() : m === "SPACE" && (this._output.space_before_token = !0);
|
|
1162
|
+
n.previous && (n.previous.type === o.WORD || n.previous.type === o.RESERVED) && (this._output.space_before_token = !0), this.print_token(n), this._flags.last_word = n.text, n.type === o.RESERVED && (n.text === "do" ? this._flags.do_block = !0 : n.text === "if" ? this._flags.if_block = !0 : n.text === "import" ? this._flags.import_block = !0 : this._flags.import_block && b(n, "from") && (this._flags.import_block = !1));
|
|
1163
|
+
}, f.prototype.handle_semicolon = function(n) {
|
|
1164
|
+
this.start_of_statement(n) ? this._output.space_before_token = !1 : this.handle_whitespace_and_comments(n);
|
|
1165
|
+
for (var d = this._tokens.peek(); this._flags.mode === _.Statement && !(this._flags.if_block && b(d, "else")) && !this._flags.do_block; )
|
|
1166
|
+
this.restore_mode();
|
|
1167
|
+
this._flags.import_block && (this._flags.import_block = !1), this.print_token(n);
|
|
1168
|
+
}, f.prototype.handle_string = function(n) {
|
|
1169
|
+
n.text.startsWith("`") && n.newlines === 0 && n.whitespace_before === "" && (n.previous.text === ")" || this._flags.last_token.type === o.WORD) || (this.start_of_statement(n) ? this._output.space_before_token = !0 : (this.handle_whitespace_and_comments(n), this._flags.last_token.type === o.RESERVED || this._flags.last_token.type === o.WORD || this._flags.inline_frame ? this._output.space_before_token = !0 : this._flags.last_token.type === o.COMMA || this._flags.last_token.type === o.START_EXPR || this._flags.last_token.type === o.EQUALS || this._flags.last_token.type === o.OPERATOR ? this.start_of_object_property() || this.allow_wrap_or_preserved_newline(n) : n.text.startsWith("`") && this._flags.last_token.type === o.END_EXPR && (n.previous.text === "]" || n.previous.text === ")") && n.newlines === 0 ? this._output.space_before_token = !0 : this.print_newline())), this.print_token(n);
|
|
1170
|
+
}, f.prototype.handle_equals = function(n) {
|
|
1171
|
+
this.start_of_statement(n) || this.handle_whitespace_and_comments(n), this._flags.declaration_statement && (this._flags.declaration_assignment = !0), this._output.space_before_token = !0, this.print_token(n), this._output.space_before_token = !0;
|
|
1172
|
+
}, f.prototype.handle_comma = function(n) {
|
|
1173
|
+
this.handle_whitespace_and_comments(n, !0), this.print_token(n), this._output.space_before_token = !0, this._flags.declaration_statement ? (A(this._flags.parent.mode) && (this._flags.declaration_assignment = !1), this._flags.declaration_assignment ? (this._flags.declaration_assignment = !1, this.print_newline(!1, !0)) : this._options.comma_first && this.allow_wrap_or_preserved_newline(n)) : this._flags.mode === _.ObjectLiteral || this._flags.mode === _.Statement && this._flags.parent.mode === _.ObjectLiteral ? (this._flags.mode === _.Statement && this.restore_mode(), this._flags.inline_frame || this.print_newline()) : this._options.comma_first && this.allow_wrap_or_preserved_newline(n);
|
|
1174
|
+
}, f.prototype.handle_operator = function(n) {
|
|
1175
|
+
var d = n.text === "*" && (y(this._flags.last_token, ["function", "yield"]) || l(this._flags.last_token.type, [o.START_BLOCK, o.COMMA, o.END_BLOCK, o.SEMICOLON])), m = l(n.text, ["-", "+"]) && (l(this._flags.last_token.type, [o.START_BLOCK, o.START_EXPR, o.EQUALS, o.OPERATOR]) || l(this._flags.last_token.text, r) || this._flags.last_token.text === ",");
|
|
1176
|
+
if (!this.start_of_statement(n)) {
|
|
1177
|
+
var R = !d;
|
|
1178
|
+
this.handle_whitespace_and_comments(n, R);
|
|
1179
|
+
}
|
|
1180
|
+
if (n.text === "*" && this._flags.last_token.type === o.DOT) {
|
|
1181
|
+
this.print_token(n);
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
if (n.text === "::") {
|
|
1185
|
+
this.print_token(n);
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
if (this._flags.last_token.type === o.OPERATOR && l(this._options.operator_position, p) && this.allow_wrap_or_preserved_newline(n), n.text === ":" && this._flags.in_case) {
|
|
1189
|
+
this.print_token(n), this._flags.in_case = !1, this._flags.case_body = !0, this._tokens.peek().type !== o.START_BLOCK ? (this.indent(), this.print_newline(), this._flags.case_block = !1) : (this._flags.case_block = !0, this._output.space_before_token = !0);
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
var C = !0, P = !0, L = !1;
|
|
1193
|
+
if (n.text === ":" ? this._flags.ternary_depth === 0 ? C = !1 : (this._flags.ternary_depth -= 1, L = !0) : n.text === "?" && (this._flags.ternary_depth += 1), !m && !d && this._options.preserve_newlines && l(n.text, u)) {
|
|
1194
|
+
var z = n.text === ":", lt = z && L, xt = z && !L;
|
|
1195
|
+
switch (this._options.operator_position) {
|
|
1196
|
+
case $.before_newline:
|
|
1197
|
+
this._output.space_before_token = !xt, this.print_token(n), (!z || lt) && this.allow_wrap_or_preserved_newline(n), this._output.space_before_token = !0;
|
|
1198
|
+
return;
|
|
1199
|
+
case $.after_newline:
|
|
1200
|
+
this._output.space_before_token = !0, !z || lt ? this._tokens.peek().newlines ? this.print_newline(!1, !0) : this.allow_wrap_or_preserved_newline(n) : this._output.space_before_token = !1, this.print_token(n), this._output.space_before_token = !0;
|
|
1201
|
+
return;
|
|
1202
|
+
case $.preserve_newline:
|
|
1203
|
+
xt || this.allow_wrap_or_preserved_newline(n), C = !(this._output.just_added_newline() || xt), this._output.space_before_token = C, this.print_token(n), this._output.space_before_token = !0;
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
if (d) {
|
|
1208
|
+
this.allow_wrap_or_preserved_newline(n), C = !1;
|
|
1209
|
+
var Gt = this._tokens.peek();
|
|
1210
|
+
P = Gt && l(Gt.type, [o.WORD, o.RESERVED]);
|
|
1211
|
+
} else if (n.text === "...")
|
|
1212
|
+
this.allow_wrap_or_preserved_newline(n), C = this._flags.last_token.type === o.START_BLOCK, P = !1;
|
|
1213
|
+
else if (l(n.text, ["--", "++", "!", "~"]) || m) {
|
|
1214
|
+
if ((this._flags.last_token.type === o.COMMA || this._flags.last_token.type === o.START_EXPR) && this.allow_wrap_or_preserved_newline(n), C = !1, P = !1, n.newlines && (n.text === "--" || n.text === "++" || n.text === "~")) {
|
|
1215
|
+
var Qt = y(this._flags.last_token, S) && n.newlines;
|
|
1216
|
+
Qt && (this._previous_flags.if_block || this._previous_flags.else_block) && this.restore_mode(), this.print_newline(Qt, !0);
|
|
1217
|
+
}
|
|
1218
|
+
this._flags.last_token.text === ";" && A(this._flags.mode) && (C = !0), this._flags.last_token.type === o.RESERVED ? C = !0 : this._flags.last_token.type === o.END_EXPR ? C = !(this._flags.last_token.text === "]" && (n.text === "--" || n.text === "++")) : this._flags.last_token.type === o.OPERATOR && (C = l(n.text, ["--", "-", "++", "+"]) && l(this._flags.last_token.text, ["--", "-", "++", "+"]), l(n.text, ["+", "-"]) && l(this._flags.last_token.text, ["--", "++"]) && (P = !0)), (this._flags.mode === _.BlockStatement && !this._flags.inline_frame || this._flags.mode === _.Statement) && (this._flags.last_token.text === "{" || this._flags.last_token.text === ";") && this.print_newline();
|
|
1219
|
+
}
|
|
1220
|
+
this._output.space_before_token = this._output.space_before_token || C, this.print_token(n), this._output.space_before_token = P;
|
|
1221
|
+
}, f.prototype.handle_block_comment = function(n, d) {
|
|
1222
|
+
if (this._output.raw) {
|
|
1223
|
+
this._output.add_raw_token(n), n.directives && n.directives.preserve === "end" && (this._output.raw = this._options.test_output_raw);
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
if (n.directives) {
|
|
1227
|
+
this.print_newline(!1, d), this.print_token(n), n.directives.preserve === "start" && (this._output.raw = !0), this.print_newline(!1, !0);
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
if (!s.newline.test(n.text) && !n.newlines) {
|
|
1231
|
+
this._output.space_before_token = !0, this.print_token(n), this._output.space_before_token = !0;
|
|
1232
|
+
return;
|
|
1233
|
+
} else
|
|
1234
|
+
this.print_block_commment(n, d);
|
|
1235
|
+
}, f.prototype.print_block_commment = function(n, d) {
|
|
1236
|
+
var m = k(n.text), R, C = !1, P = !1, L = n.whitespace_before, z = L.length;
|
|
1237
|
+
if (this.print_newline(!1, d), this.print_token_line_indentation(n), this._output.add_token(m[0]), this.print_newline(!1, d), m.length > 1) {
|
|
1238
|
+
for (m = m.slice(1), C = c(m, "*"), P = g(m, L), C && (this._flags.alignment = 1), R = 0; R < m.length; R++)
|
|
1239
|
+
C ? (this.print_token_line_indentation(n), this._output.add_token(v(m[R]))) : P && m[R] ? (this.print_token_line_indentation(n), this._output.add_token(m[R].substring(z))) : (this._output.current_line.set_indent(-1), this._output.add_token(m[R])), this.print_newline(!1, d);
|
|
1240
|
+
this._flags.alignment = 0;
|
|
1241
|
+
}
|
|
1242
|
+
}, f.prototype.handle_comment = function(n, d) {
|
|
1243
|
+
n.newlines ? this.print_newline(!1, d) : this._output.trim(!0), this._output.space_before_token = !0, this.print_token(n), this.print_newline(!1, d);
|
|
1244
|
+
}, f.prototype.handle_dot = function(n) {
|
|
1245
|
+
this.start_of_statement(n) || this.handle_whitespace_and_comments(n, !0), this._flags.last_token.text.match("^[0-9]+$") && (this._output.space_before_token = !0), y(this._flags.last_token, S) ? this._output.space_before_token = !1 : this.allow_wrap_or_preserved_newline(
|
|
1246
|
+
n,
|
|
1247
|
+
this._flags.last_token.text === ")" && this._options.break_chained_methods
|
|
1248
|
+
), this._options.unindent_chained_methods && this._output.just_added_newline() && this.deindent(), this.print_token(n);
|
|
1249
|
+
}, f.prototype.handle_unknown = function(n, d) {
|
|
1250
|
+
this.print_token(n), n.text[n.text.length - 1] === `
|
|
1251
|
+
` && this.print_newline(!1, d);
|
|
1252
|
+
}, f.prototype.handle_eof = function(n) {
|
|
1253
|
+
for (; this._flags.mode === _.Statement; )
|
|
1254
|
+
this.restore_mode();
|
|
1255
|
+
this.handle_whitespace_and_comments(n);
|
|
1256
|
+
}, wt.Beautifier = f, wt;
|
|
1257
|
+
}
|
|
1258
|
+
var he;
|
|
1259
|
+
function oi() {
|
|
1260
|
+
if (he)
|
|
1261
|
+
return st;
|
|
1262
|
+
he = 1;
|
|
1263
|
+
var t = ri().Beautifier, i = Pe().Options;
|
|
1264
|
+
function s(e, a) {
|
|
1265
|
+
var r = new t(e, a);
|
|
1266
|
+
return r.beautify();
|
|
1267
|
+
}
|
|
1268
|
+
return ni.exports = s, st.defaultOptions = function() {
|
|
1269
|
+
return new i();
|
|
1270
|
+
}, st;
|
|
1271
|
+
}
|
|
1272
|
+
var nt = {}, li = {
|
|
1273
|
+
get exports() {
|
|
1274
|
+
return nt;
|
|
1275
|
+
},
|
|
1276
|
+
set exports(t) {
|
|
1277
|
+
nt = t;
|
|
1278
|
+
}
|
|
1279
|
+
}, Pt = {}, jt = {}, fe;
|
|
1280
|
+
function Le() {
|
|
1281
|
+
if (fe)
|
|
1282
|
+
return jt;
|
|
1283
|
+
fe = 1;
|
|
1284
|
+
var t = zt().Options;
|
|
1285
|
+
function i(s) {
|
|
1286
|
+
t.call(this, s, "css"), this.selector_separator_newline = this._get_boolean("selector_separator_newline", !0), this.newline_between_rules = this._get_boolean("newline_between_rules", !0);
|
|
1287
|
+
var e = this._get_boolean("space_around_selector_separator");
|
|
1288
|
+
this.space_around_combinator = this._get_boolean("space_around_combinator") || e;
|
|
1289
|
+
var a = this._get_selection_list("brace_style", ["collapse", "expand", "end-expand", "none", "preserve-inline"]);
|
|
1290
|
+
this.brace_style = "collapse";
|
|
1291
|
+
for (var r = 0; r < a.length; r++)
|
|
1292
|
+
a[r] !== "expand" ? this.brace_style = "collapse" : this.brace_style = a[r];
|
|
1293
|
+
}
|
|
1294
|
+
return i.prototype = new t(), jt.Options = i, jt;
|
|
1295
|
+
}
|
|
1296
|
+
var ce;
|
|
1297
|
+
function ui() {
|
|
1298
|
+
if (ce)
|
|
1299
|
+
return Pt;
|
|
1300
|
+
ce = 1;
|
|
1301
|
+
var t = Le().Options, i = Ut().Output, s = qt().InputScanner, e = Vt().Directives, a = new e(/\/\*/, /\*\//), r = /\r\n|[\r\n]/, u = /\r\n|[\r\n]/g, o = /\s/, l = /(?:\s|\n)+/g, v = /\/\*(?:[\s\S]*?)((?:\*\/)|$)/g, x = /\/\/(?:[^\n\r\u2028\u2029]*)/g;
|
|
1302
|
+
function b(y, S) {
|
|
1303
|
+
this._source_text = y || "", this._options = new t(S), this._ch = null, this._input = null, this.NESTED_AT_RULE = {
|
|
1304
|
+
page: !0,
|
|
1305
|
+
"font-face": !0,
|
|
1306
|
+
keyframes: !0,
|
|
1307
|
+
// also in CONDITIONAL_GROUP_RULE below
|
|
1308
|
+
media: !0,
|
|
1309
|
+
supports: !0,
|
|
1310
|
+
document: !0
|
|
1311
|
+
}, this.CONDITIONAL_GROUP_RULE = {
|
|
1312
|
+
media: !0,
|
|
1313
|
+
supports: !0,
|
|
1314
|
+
document: !0
|
|
1315
|
+
}, this.NON_SEMICOLON_NEWLINE_PROPERTY = [
|
|
1316
|
+
"grid-template-areas",
|
|
1317
|
+
"grid-template"
|
|
1318
|
+
];
|
|
1319
|
+
}
|
|
1320
|
+
return b.prototype.eatString = function(y) {
|
|
1321
|
+
var S = "";
|
|
1322
|
+
for (this._ch = this._input.next(); this._ch; ) {
|
|
1323
|
+
if (S += this._ch, this._ch === "\\")
|
|
1324
|
+
S += this._input.next();
|
|
1325
|
+
else if (y.indexOf(this._ch) !== -1 || this._ch === `
|
|
1326
|
+
`)
|
|
1327
|
+
break;
|
|
1328
|
+
this._ch = this._input.next();
|
|
1329
|
+
}
|
|
1330
|
+
return S;
|
|
1331
|
+
}, b.prototype.eatWhitespace = function(y) {
|
|
1332
|
+
for (var S = o.test(this._input.peek()), N = 0; o.test(this._input.peek()); )
|
|
1333
|
+
this._ch = this._input.next(), y && this._ch === `
|
|
1334
|
+
` && (N === 0 || N < this._options.max_preserve_newlines) && (N++, this._output.add_new_line(!0));
|
|
1335
|
+
return S;
|
|
1336
|
+
}, b.prototype.foundNestedPseudoClass = function() {
|
|
1337
|
+
for (var y = 0, S = 1, N = this._input.peek(S); N; ) {
|
|
1338
|
+
if (N === "{")
|
|
1339
|
+
return !0;
|
|
1340
|
+
if (N === "(")
|
|
1341
|
+
y += 1;
|
|
1342
|
+
else if (N === ")") {
|
|
1343
|
+
if (y === 0)
|
|
1344
|
+
return !1;
|
|
1345
|
+
y -= 1;
|
|
1346
|
+
} else if (N === ";" || N === "}")
|
|
1347
|
+
return !1;
|
|
1348
|
+
S++, N = this._input.peek(S);
|
|
1349
|
+
}
|
|
1350
|
+
return !1;
|
|
1351
|
+
}, b.prototype.print_string = function(y) {
|
|
1352
|
+
this._output.set_indent(this._indentLevel), this._output.non_breaking_space = !0, this._output.add_token(y);
|
|
1353
|
+
}, b.prototype.preserveSingleSpace = function(y) {
|
|
1354
|
+
y && (this._output.space_before_token = !0);
|
|
1355
|
+
}, b.prototype.indent = function() {
|
|
1356
|
+
this._indentLevel++;
|
|
1357
|
+
}, b.prototype.outdent = function() {
|
|
1358
|
+
this._indentLevel > 0 && this._indentLevel--;
|
|
1359
|
+
}, b.prototype.beautify = function() {
|
|
1360
|
+
if (this._options.disabled)
|
|
1361
|
+
return this._source_text;
|
|
1362
|
+
var y = this._source_text, S = this._options.eol;
|
|
1363
|
+
S === "auto" && (S = `
|
|
1364
|
+
`, y && r.test(y || "") && (S = y.match(r)[0])), y = y.replace(u, `
|
|
1365
|
+
`);
|
|
1366
|
+
var N = y.match(/^[\t ]*/)[0];
|
|
1367
|
+
this._output = new i(this._options, N), this._input = new s(y), this._indentLevel = 0, this._nestedLevel = 0, this._ch = null;
|
|
1368
|
+
for (var $ = 0, p = !1, _ = !1, h = !1, k = !1, O = !1, A = this._ch, c = !1, g, f, T; g = this._input.read(l), f = g !== "", T = A, this._ch = this._input.next(), this._ch === "\\" && this._input.hasNext() && (this._ch += this._input.next()), A = this._ch, this._ch; )
|
|
1369
|
+
if (this._ch === "/" && this._input.peek() === "*") {
|
|
1370
|
+
this._output.add_new_line(), this._input.back();
|
|
1371
|
+
var n = this._input.read(v), d = a.get_directives(n);
|
|
1372
|
+
d && d.ignore === "start" && (n += a.readIgnored(this._input)), this.print_string(n), this.eatWhitespace(!0), this._output.add_new_line();
|
|
1373
|
+
} else if (this._ch === "/" && this._input.peek() === "/")
|
|
1374
|
+
this._output.space_before_token = !0, this._input.back(), this.print_string(this._input.read(x)), this.eatWhitespace(!0);
|
|
1375
|
+
else if (this._ch === "$") {
|
|
1376
|
+
this.preserveSingleSpace(f), this.print_string(this._ch);
|
|
1377
|
+
var m = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
|
|
1378
|
+
m.match(/[ :]$/) && (m = this.eatString(": ").replace(/\s$/, ""), this.print_string(m), this._output.space_before_token = !0), m = m.replace(/\s$/, ""), $ === 0 && m.indexOf(":") !== -1 && (_ = !0, this.indent());
|
|
1379
|
+
} else if (this._ch === "@")
|
|
1380
|
+
if (this.preserveSingleSpace(f), this._input.peek() === "{")
|
|
1381
|
+
this.print_string(this._ch + this.eatString("}"));
|
|
1382
|
+
else {
|
|
1383
|
+
this.print_string(this._ch);
|
|
1384
|
+
var R = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
|
|
1385
|
+
R.match(/[ :]$/) && (R = this.eatString(": ").replace(/\s$/, ""), this.print_string(R), this._output.space_before_token = !0), R = R.replace(/\s$/, ""), $ === 0 && R.indexOf(":") !== -1 ? (_ = !0, this.indent()) : R in this.NESTED_AT_RULE ? (this._nestedLevel += 1, R in this.CONDITIONAL_GROUP_RULE && (h = !0)) : $ === 0 && !_ && (k = !0);
|
|
1386
|
+
}
|
|
1387
|
+
else if (this._ch === "#" && this._input.peek() === "{")
|
|
1388
|
+
this.preserveSingleSpace(f), this.print_string(this._ch + this.eatString("}"));
|
|
1389
|
+
else if (this._ch === "{")
|
|
1390
|
+
_ && (_ = !1, this.outdent()), k = !1, h ? (h = !1, p = this._indentLevel >= this._nestedLevel) : p = this._indentLevel >= this._nestedLevel - 1, this._options.newline_between_rules && p && this._output.previous_line && this._output.previous_line.item(-1) !== "{" && this._output.ensure_empty_line_above("/", ","), this._output.space_before_token = !0, this._options.brace_style === "expand" ? (this._output.add_new_line(), this.print_string(this._ch), this.indent(), this._output.set_indent(this._indentLevel)) : (T === "(" ? this._output.space_before_token = !1 : T !== "," && this.indent(), this.print_string(this._ch)), this.eatWhitespace(!0), this._output.add_new_line();
|
|
1391
|
+
else if (this._ch === "}")
|
|
1392
|
+
this.outdent(), this._output.add_new_line(), T === "{" && this._output.trim(!0), _ && (this.outdent(), _ = !1), this.print_string(this._ch), p = !1, this._nestedLevel && this._nestedLevel--, this.eatWhitespace(!0), this._output.add_new_line(), this._options.newline_between_rules && !this._output.just_added_blankline() && this._input.peek() !== "}" && this._output.add_new_line(!0), this._input.peek() === ")" && (this._output.trim(!0), this._options.brace_style === "expand" && this._output.add_new_line(!0));
|
|
1393
|
+
else if (this._ch === ":") {
|
|
1394
|
+
for (var C = 0; C < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; C++)
|
|
1395
|
+
if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[C])) {
|
|
1396
|
+
c = !0;
|
|
1397
|
+
break;
|
|
1398
|
+
}
|
|
1399
|
+
(p || h) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !k && $ === 0 ? (this.print_string(":"), _ || (_ = !0, this._output.space_before_token = !0, this.eatWhitespace(!0), this.indent())) : (this._input.lookBack(" ") && (this._output.space_before_token = !0), this._input.peek() === ":" ? (this._ch = this._input.next(), this.print_string("::")) : this.print_string(":"));
|
|
1400
|
+
} else if (this._ch === '"' || this._ch === "'") {
|
|
1401
|
+
var P = T === '"' || T === "'";
|
|
1402
|
+
this.preserveSingleSpace(P || f), this.print_string(this._ch + this.eatString(this._ch)), this.eatWhitespace(!0);
|
|
1403
|
+
} else if (this._ch === ";")
|
|
1404
|
+
c = !1, $ === 0 ? (_ && (this.outdent(), _ = !1), k = !1, this.print_string(this._ch), this.eatWhitespace(!0), this._input.peek() !== "/" && this._output.add_new_line()) : (this.print_string(this._ch), this.eatWhitespace(!0), this._output.space_before_token = !0);
|
|
1405
|
+
else if (this._ch === "(")
|
|
1406
|
+
if (this._input.lookBack("url"))
|
|
1407
|
+
this.print_string(this._ch), this.eatWhitespace(), $++, this.indent(), this._ch = this._input.next(), this._ch === ")" || this._ch === '"' || this._ch === "'" ? this._input.back() : this._ch && (this.print_string(this._ch + this.eatString(")")), $ && ($--, this.outdent()));
|
|
1408
|
+
else {
|
|
1409
|
+
var L = !1;
|
|
1410
|
+
this._input.lookBack("with") && (L = !0), this.preserveSingleSpace(f || L), this.print_string(this._ch), _ && T === "$" && this._options.selector_separator_newline ? (this._output.add_new_line(), O = !0) : (this.eatWhitespace(), $++, this.indent());
|
|
1411
|
+
}
|
|
1412
|
+
else if (this._ch === ")")
|
|
1413
|
+
$ && ($--, this.outdent()), O && this._input.peek() === ";" && this._options.selector_separator_newline && (O = !1, this.outdent(), this._output.add_new_line()), this.print_string(this._ch);
|
|
1414
|
+
else if (this._ch === ",")
|
|
1415
|
+
this.print_string(this._ch), this.eatWhitespace(!0), this._options.selector_separator_newline && (!_ || O) && $ === 0 && !k ? this._output.add_new_line() : this._output.space_before_token = !0;
|
|
1416
|
+
else if ((this._ch === ">" || this._ch === "+" || this._ch === "~") && !_ && $ === 0)
|
|
1417
|
+
this._options.space_around_combinator ? (this._output.space_before_token = !0, this.print_string(this._ch), this._output.space_before_token = !0) : (this.print_string(this._ch), this.eatWhitespace(), this._ch && o.test(this._ch) && (this._ch = ""));
|
|
1418
|
+
else if (this._ch === "]")
|
|
1419
|
+
this.print_string(this._ch);
|
|
1420
|
+
else if (this._ch === "[")
|
|
1421
|
+
this.preserveSingleSpace(f), this.print_string(this._ch);
|
|
1422
|
+
else if (this._ch === "=")
|
|
1423
|
+
this.eatWhitespace(), this.print_string("="), o.test(this._ch) && (this._ch = "");
|
|
1424
|
+
else if (this._ch === "!" && !this._input.lookBack("\\"))
|
|
1425
|
+
this._output.space_before_token = !0, this.print_string(this._ch);
|
|
1426
|
+
else {
|
|
1427
|
+
var z = T === '"' || T === "'";
|
|
1428
|
+
this.preserveSingleSpace(z || f), this.print_string(this._ch), !this._output.just_added_newline() && this._input.peek() === `
|
|
1429
|
+
` && c && this._output.add_new_line();
|
|
1430
|
+
}
|
|
1431
|
+
var lt = this._output.get_code(S);
|
|
1432
|
+
return lt;
|
|
1433
|
+
}, Pt.Beautifier = b, Pt;
|
|
1434
|
+
}
|
|
1435
|
+
var de;
|
|
1436
|
+
function pi() {
|
|
1437
|
+
if (de)
|
|
1438
|
+
return nt;
|
|
1439
|
+
de = 1;
|
|
1440
|
+
var t = ui().Beautifier, i = Le().Options;
|
|
1441
|
+
function s(e, a) {
|
|
1442
|
+
var r = new t(e, a);
|
|
1443
|
+
return r.beautify();
|
|
1444
|
+
}
|
|
1445
|
+
return li.exports = s, nt.defaultOptions = function() {
|
|
1446
|
+
return new i();
|
|
1447
|
+
}, nt;
|
|
1448
|
+
}
|
|
1449
|
+
var at = {}, hi = {
|
|
1450
|
+
get exports() {
|
|
1451
|
+
return at;
|
|
1452
|
+
},
|
|
1453
|
+
set exports(t) {
|
|
1454
|
+
at = t;
|
|
1455
|
+
}
|
|
1456
|
+
}, Lt = {}, Dt = {}, me;
|
|
1457
|
+
function De() {
|
|
1458
|
+
if (me)
|
|
1459
|
+
return Dt;
|
|
1460
|
+
me = 1;
|
|
1461
|
+
var t = zt().Options;
|
|
1462
|
+
function i(s) {
|
|
1463
|
+
t.call(this, s, "html"), this.templating.length === 1 && this.templating[0] === "auto" && (this.templating = ["django", "erb", "handlebars", "php"]), this.indent_inner_html = this._get_boolean("indent_inner_html"), this.indent_body_inner_html = this._get_boolean("indent_body_inner_html", !0), this.indent_head_inner_html = this._get_boolean("indent_head_inner_html", !0), this.indent_handlebars = this._get_boolean("indent_handlebars", !0), this.wrap_attributes = this._get_selection(
|
|
1464
|
+
"wrap_attributes",
|
|
1465
|
+
["auto", "force", "force-aligned", "force-expand-multiline", "aligned-multiple", "preserve", "preserve-aligned"]
|
|
1466
|
+
), this.wrap_attributes_min_attrs = this._get_number("wrap_attributes_min_attrs", 2), this.wrap_attributes_indent_size = this._get_number("wrap_attributes_indent_size", this.indent_size), this.extra_liners = this._get_array("extra_liners", ["head", "body", "/html"]), this.inline = this._get_array("inline", [
|
|
1467
|
+
"a",
|
|
1468
|
+
"abbr",
|
|
1469
|
+
"area",
|
|
1470
|
+
"audio",
|
|
1471
|
+
"b",
|
|
1472
|
+
"bdi",
|
|
1473
|
+
"bdo",
|
|
1474
|
+
"br",
|
|
1475
|
+
"button",
|
|
1476
|
+
"canvas",
|
|
1477
|
+
"cite",
|
|
1478
|
+
"code",
|
|
1479
|
+
"data",
|
|
1480
|
+
"datalist",
|
|
1481
|
+
"del",
|
|
1482
|
+
"dfn",
|
|
1483
|
+
"em",
|
|
1484
|
+
"embed",
|
|
1485
|
+
"i",
|
|
1486
|
+
"iframe",
|
|
1487
|
+
"img",
|
|
1488
|
+
"input",
|
|
1489
|
+
"ins",
|
|
1490
|
+
"kbd",
|
|
1491
|
+
"keygen",
|
|
1492
|
+
"label",
|
|
1493
|
+
"map",
|
|
1494
|
+
"mark",
|
|
1495
|
+
"math",
|
|
1496
|
+
"meter",
|
|
1497
|
+
"noscript",
|
|
1498
|
+
"object",
|
|
1499
|
+
"output",
|
|
1500
|
+
"progress",
|
|
1501
|
+
"q",
|
|
1502
|
+
"ruby",
|
|
1503
|
+
"s",
|
|
1504
|
+
"samp",
|
|
1505
|
+
/* 'script', */
|
|
1506
|
+
"select",
|
|
1507
|
+
"small",
|
|
1508
|
+
"span",
|
|
1509
|
+
"strong",
|
|
1510
|
+
"sub",
|
|
1511
|
+
"sup",
|
|
1512
|
+
"svg",
|
|
1513
|
+
"template",
|
|
1514
|
+
"textarea",
|
|
1515
|
+
"time",
|
|
1516
|
+
"u",
|
|
1517
|
+
"var",
|
|
1518
|
+
"video",
|
|
1519
|
+
"wbr",
|
|
1520
|
+
"text",
|
|
1521
|
+
// obsolete inline tags
|
|
1522
|
+
"acronym",
|
|
1523
|
+
"big",
|
|
1524
|
+
"strike",
|
|
1525
|
+
"tt"
|
|
1526
|
+
]), this.inline_custom_elements = this._get_boolean("inline_custom_elements", !0), this.void_elements = this._get_array("void_elements", [
|
|
1527
|
+
// HTLM void elements - aka self-closing tags - aka singletons
|
|
1528
|
+
// https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
|
|
1529
|
+
"area",
|
|
1530
|
+
"base",
|
|
1531
|
+
"br",
|
|
1532
|
+
"col",
|
|
1533
|
+
"embed",
|
|
1534
|
+
"hr",
|
|
1535
|
+
"img",
|
|
1536
|
+
"input",
|
|
1537
|
+
"keygen",
|
|
1538
|
+
"link",
|
|
1539
|
+
"menuitem",
|
|
1540
|
+
"meta",
|
|
1541
|
+
"param",
|
|
1542
|
+
"source",
|
|
1543
|
+
"track",
|
|
1544
|
+
"wbr",
|
|
1545
|
+
// NOTE: Optional tags are too complex for a simple list
|
|
1546
|
+
// they are hard coded in _do_optional_end_element
|
|
1547
|
+
// Doctype and xml elements
|
|
1548
|
+
"!doctype",
|
|
1549
|
+
"?xml",
|
|
1550
|
+
// obsolete tags
|
|
1551
|
+
// basefont: https://www.computerhope.com/jargon/h/html-basefont-tag.htm
|
|
1552
|
+
// isndex: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/isindex
|
|
1553
|
+
"basefont",
|
|
1554
|
+
"isindex"
|
|
1555
|
+
]), this.unformatted = this._get_array("unformatted", []), this.content_unformatted = this._get_array("content_unformatted", [
|
|
1556
|
+
"pre",
|
|
1557
|
+
"textarea"
|
|
1558
|
+
]), this.unformatted_content_delimiter = this._get_characters("unformatted_content_delimiter"), this.indent_scripts = this._get_selection("indent_scripts", ["normal", "keep", "separate"]);
|
|
1559
|
+
}
|
|
1560
|
+
return i.prototype = new t(), Dt.Options = i, Dt;
|
|
1561
|
+
}
|
|
1562
|
+
var ht = {}, ge;
|
|
1563
|
+
function be() {
|
|
1564
|
+
if (ge)
|
|
1565
|
+
return ht;
|
|
1566
|
+
ge = 1;
|
|
1567
|
+
var t = dt().Tokenizer, i = dt().TOKEN, s = Vt().Directives, e = je().TemplatablePattern, a = gt().Pattern, r = {
|
|
1568
|
+
TAG_OPEN: "TK_TAG_OPEN",
|
|
1569
|
+
TAG_CLOSE: "TK_TAG_CLOSE",
|
|
1570
|
+
ATTRIBUTE: "TK_ATTRIBUTE",
|
|
1571
|
+
EQUALS: "TK_EQUALS",
|
|
1572
|
+
VALUE: "TK_VALUE",
|
|
1573
|
+
COMMENT: "TK_COMMENT",
|
|
1574
|
+
TEXT: "TK_TEXT",
|
|
1575
|
+
UNKNOWN: "TK_UNKNOWN",
|
|
1576
|
+
START: i.START,
|
|
1577
|
+
RAW: i.RAW,
|
|
1578
|
+
EOF: i.EOF
|
|
1579
|
+
}, u = new s(/<\!--/, /-->/), o = function(l, v) {
|
|
1580
|
+
t.call(this, l, v), this._current_tag_name = "";
|
|
1581
|
+
var x = new e(this._input).read_options(this._options), b = new a(this._input);
|
|
1582
|
+
if (this.__patterns = {
|
|
1583
|
+
word: x.until(/[\n\r\t <]/),
|
|
1584
|
+
single_quote: x.until_after(/'/),
|
|
1585
|
+
double_quote: x.until_after(/"/),
|
|
1586
|
+
attribute: x.until(/[\n\r\t =>]|\/>/),
|
|
1587
|
+
element_name: x.until(/[\n\r\t >\/]/),
|
|
1588
|
+
handlebars_comment: b.starting_with(/{{!--/).until_after(/--}}/),
|
|
1589
|
+
handlebars: b.starting_with(/{{/).until_after(/}}/),
|
|
1590
|
+
handlebars_open: b.until(/[\n\r\t }]/),
|
|
1591
|
+
handlebars_raw_close: b.until(/}}/),
|
|
1592
|
+
comment: b.starting_with(/<!--/).until_after(/-->/),
|
|
1593
|
+
cdata: b.starting_with(/<!\[CDATA\[/).until_after(/]]>/),
|
|
1594
|
+
// https://en.wikipedia.org/wiki/Conditional_comment
|
|
1595
|
+
conditional_comment: b.starting_with(/<!\[/).until_after(/]>/),
|
|
1596
|
+
processing: b.starting_with(/<\?/).until_after(/\?>/)
|
|
1597
|
+
}, this._options.indent_handlebars && (this.__patterns.word = this.__patterns.word.exclude("handlebars")), this._unformatted_content_delimiter = null, this._options.unformatted_content_delimiter) {
|
|
1598
|
+
var y = this._input.get_literal_regexp(this._options.unformatted_content_delimiter);
|
|
1599
|
+
this.__patterns.unformatted_content_delimiter = b.matching(y).until_after(y);
|
|
1600
|
+
}
|
|
1601
|
+
};
|
|
1602
|
+
return o.prototype = new t(), o.prototype._is_comment = function(l) {
|
|
1603
|
+
return !1;
|
|
1604
|
+
}, o.prototype._is_opening = function(l) {
|
|
1605
|
+
return l.type === r.TAG_OPEN;
|
|
1606
|
+
}, o.prototype._is_closing = function(l, v) {
|
|
1607
|
+
return l.type === r.TAG_CLOSE && v && ((l.text === ">" || l.text === "/>") && v.text[0] === "<" || l.text === "}}" && v.text[0] === "{" && v.text[1] === "{");
|
|
1608
|
+
}, o.prototype._reset = function() {
|
|
1609
|
+
this._current_tag_name = "";
|
|
1610
|
+
}, o.prototype._get_next_token = function(l, v) {
|
|
1611
|
+
var x = null;
|
|
1612
|
+
this._readWhitespace();
|
|
1613
|
+
var b = this._input.peek();
|
|
1614
|
+
return b === null ? this._create_token(r.EOF, "") : (x = x || this._read_open_handlebars(b, v), x = x || this._read_attribute(b, l, v), x = x || this._read_close(b, v), x = x || this._read_raw_content(b, l, v), x = x || this._read_content_word(b), x = x || this._read_comment_or_cdata(b), x = x || this._read_processing(b), x = x || this._read_open(b, v), x = x || this._create_token(r.UNKNOWN, this._input.next()), x);
|
|
1615
|
+
}, o.prototype._read_comment_or_cdata = function(l) {
|
|
1616
|
+
var v = null, x = null, b = null;
|
|
1617
|
+
if (l === "<") {
|
|
1618
|
+
var y = this._input.peek(1);
|
|
1619
|
+
y === "!" && (x = this.__patterns.comment.read(), x ? (b = u.get_directives(x), b && b.ignore === "start" && (x += u.readIgnored(this._input))) : x = this.__patterns.cdata.read()), x && (v = this._create_token(r.COMMENT, x), v.directives = b);
|
|
1620
|
+
}
|
|
1621
|
+
return v;
|
|
1622
|
+
}, o.prototype._read_processing = function(l) {
|
|
1623
|
+
var v = null, x = null, b = null;
|
|
1624
|
+
if (l === "<") {
|
|
1625
|
+
var y = this._input.peek(1);
|
|
1626
|
+
(y === "!" || y === "?") && (x = this.__patterns.conditional_comment.read(), x = x || this.__patterns.processing.read()), x && (v = this._create_token(r.COMMENT, x), v.directives = b);
|
|
1627
|
+
}
|
|
1628
|
+
return v;
|
|
1629
|
+
}, o.prototype._read_open = function(l, v) {
|
|
1630
|
+
var x = null, b = null;
|
|
1631
|
+
return v || l === "<" && (x = this._input.next(), this._input.peek() === "/" && (x += this._input.next()), x += this.__patterns.element_name.read(), b = this._create_token(r.TAG_OPEN, x)), b;
|
|
1632
|
+
}, o.prototype._read_open_handlebars = function(l, v) {
|
|
1633
|
+
var x = null, b = null;
|
|
1634
|
+
return v || this._options.indent_handlebars && l === "{" && this._input.peek(1) === "{" && (this._input.peek(2) === "!" ? (x = this.__patterns.handlebars_comment.read(), x = x || this.__patterns.handlebars.read(), b = this._create_token(r.COMMENT, x)) : (x = this.__patterns.handlebars_open.read(), b = this._create_token(r.TAG_OPEN, x))), b;
|
|
1635
|
+
}, o.prototype._read_close = function(l, v) {
|
|
1636
|
+
var x = null, b = null;
|
|
1637
|
+
return v && (v.text[0] === "<" && (l === ">" || l === "/" && this._input.peek(1) === ">") ? (x = this._input.next(), l === "/" && (x += this._input.next()), b = this._create_token(r.TAG_CLOSE, x)) : v.text[0] === "{" && l === "}" && this._input.peek(1) === "}" && (this._input.next(), this._input.next(), b = this._create_token(r.TAG_CLOSE, "}}"))), b;
|
|
1638
|
+
}, o.prototype._read_attribute = function(l, v, x) {
|
|
1639
|
+
var b = null, y = "";
|
|
1640
|
+
if (x && x.text[0] === "<")
|
|
1641
|
+
if (l === "=")
|
|
1642
|
+
b = this._create_token(r.EQUALS, this._input.next());
|
|
1643
|
+
else if (l === '"' || l === "'") {
|
|
1644
|
+
var S = this._input.next();
|
|
1645
|
+
l === '"' ? S += this.__patterns.double_quote.read() : S += this.__patterns.single_quote.read(), b = this._create_token(r.VALUE, S);
|
|
1646
|
+
} else
|
|
1647
|
+
y = this.__patterns.attribute.read(), y && (v.type === r.EQUALS ? b = this._create_token(r.VALUE, y) : b = this._create_token(r.ATTRIBUTE, y));
|
|
1648
|
+
return b;
|
|
1649
|
+
}, o.prototype._is_content_unformatted = function(l) {
|
|
1650
|
+
return this._options.void_elements.indexOf(l) === -1 && (this._options.content_unformatted.indexOf(l) !== -1 || this._options.unformatted.indexOf(l) !== -1);
|
|
1651
|
+
}, o.prototype._read_raw_content = function(l, v, x) {
|
|
1652
|
+
var b = "";
|
|
1653
|
+
if (x && x.text[0] === "{")
|
|
1654
|
+
b = this.__patterns.handlebars_raw_close.read();
|
|
1655
|
+
else if (v.type === r.TAG_CLOSE && v.opened.text[0] === "<" && v.text[0] !== "/") {
|
|
1656
|
+
var y = v.opened.text.substr(1).toLowerCase();
|
|
1657
|
+
if (y === "script" || y === "style") {
|
|
1658
|
+
var S = this._read_comment_or_cdata(l);
|
|
1659
|
+
if (S)
|
|
1660
|
+
return S.type = r.TEXT, S;
|
|
1661
|
+
b = this._input.readUntil(new RegExp("</" + y + "[\\n\\r\\t ]*?>", "ig"));
|
|
1662
|
+
} else
|
|
1663
|
+
this._is_content_unformatted(y) && (b = this._input.readUntil(new RegExp("</" + y + "[\\n\\r\\t ]*?>", "ig")));
|
|
1664
|
+
}
|
|
1665
|
+
return b ? this._create_token(r.TEXT, b) : null;
|
|
1666
|
+
}, o.prototype._read_content_word = function(l) {
|
|
1667
|
+
var v = "";
|
|
1668
|
+
if (this._options.unformatted_content_delimiter && l === this._options.unformatted_content_delimiter[0] && (v = this.__patterns.unformatted_content_delimiter.read()), v || (v = this.__patterns.word.read()), v)
|
|
1669
|
+
return this._create_token(r.TEXT, v);
|
|
1670
|
+
}, ht.Tokenizer = o, ht.TOKEN = r, ht;
|
|
1671
|
+
}
|
|
1672
|
+
var ve;
|
|
1673
|
+
function fi() {
|
|
1674
|
+
if (ve)
|
|
1675
|
+
return Lt;
|
|
1676
|
+
ve = 1;
|
|
1677
|
+
var t = De().Options, i = Ut().Output, s = be().Tokenizer, e = be().TOKEN, a = /\r\n|[\r\n]/, r = /\r\n|[\r\n]/g, u = function(p, _) {
|
|
1678
|
+
this.indent_level = 0, this.alignment_size = 0, this.max_preserve_newlines = p.max_preserve_newlines, this.preserve_newlines = p.preserve_newlines, this._output = new i(p, _);
|
|
1679
|
+
};
|
|
1680
|
+
u.prototype.current_line_has_match = function(p) {
|
|
1681
|
+
return this._output.current_line.has_match(p);
|
|
1682
|
+
}, u.prototype.set_space_before_token = function(p, _) {
|
|
1683
|
+
this._output.space_before_token = p, this._output.non_breaking_space = _;
|
|
1684
|
+
}, u.prototype.set_wrap_point = function() {
|
|
1685
|
+
this._output.set_indent(this.indent_level, this.alignment_size), this._output.set_wrap_point();
|
|
1686
|
+
}, u.prototype.add_raw_token = function(p) {
|
|
1687
|
+
this._output.add_raw_token(p);
|
|
1688
|
+
}, u.prototype.print_preserved_newlines = function(p) {
|
|
1689
|
+
var _ = 0;
|
|
1690
|
+
p.type !== e.TEXT && p.previous.type !== e.TEXT && (_ = p.newlines ? 1 : 0), this.preserve_newlines && (_ = p.newlines < this.max_preserve_newlines + 1 ? p.newlines : this.max_preserve_newlines + 1);
|
|
1691
|
+
for (var h = 0; h < _; h++)
|
|
1692
|
+
this.print_newline(h > 0);
|
|
1693
|
+
return _ !== 0;
|
|
1694
|
+
}, u.prototype.traverse_whitespace = function(p) {
|
|
1695
|
+
return p.whitespace_before || p.newlines ? (this.print_preserved_newlines(p) || (this._output.space_before_token = !0), !0) : !1;
|
|
1696
|
+
}, u.prototype.previous_token_wrapped = function() {
|
|
1697
|
+
return this._output.previous_token_wrapped;
|
|
1698
|
+
}, u.prototype.print_newline = function(p) {
|
|
1699
|
+
this._output.add_new_line(p);
|
|
1700
|
+
}, u.prototype.print_token = function(p) {
|
|
1701
|
+
p.text && (this._output.set_indent(this.indent_level, this.alignment_size), this._output.add_token(p.text));
|
|
1702
|
+
}, u.prototype.indent = function() {
|
|
1703
|
+
this.indent_level++;
|
|
1704
|
+
}, u.prototype.get_full_indent = function(p) {
|
|
1705
|
+
return p = this.indent_level + (p || 0), p < 1 ? "" : this._output.get_indent_string(p);
|
|
1706
|
+
};
|
|
1707
|
+
var o = function(p) {
|
|
1708
|
+
for (var _ = null, h = p.next; h.type !== e.EOF && p.closed !== h; ) {
|
|
1709
|
+
if (h.type === e.ATTRIBUTE && h.text === "type") {
|
|
1710
|
+
h.next && h.next.type === e.EQUALS && h.next.next && h.next.next.type === e.VALUE && (_ = h.next.next.text);
|
|
1711
|
+
break;
|
|
1712
|
+
}
|
|
1713
|
+
h = h.next;
|
|
1714
|
+
}
|
|
1715
|
+
return _;
|
|
1716
|
+
}, l = function(p, _) {
|
|
1717
|
+
var h = null, k = null;
|
|
1718
|
+
return _.closed ? (p === "script" ? h = "text/javascript" : p === "style" && (h = "text/css"), h = o(_) || h, h.search("text/css") > -1 ? k = "css" : h.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/) > -1 ? k = "javascript" : h.search(/(text|application|dojo)\/(x-)?(html)/) > -1 ? k = "html" : h.search(/test\/null/) > -1 && (k = "null"), k) : null;
|
|
1719
|
+
};
|
|
1720
|
+
function v(p, _) {
|
|
1721
|
+
return _.indexOf(p) !== -1;
|
|
1722
|
+
}
|
|
1723
|
+
function x(p, _, h) {
|
|
1724
|
+
this.parent = p || null, this.tag = _ ? _.tag_name : "", this.indent_level = h || 0, this.parser_token = _ || null;
|
|
1725
|
+
}
|
|
1726
|
+
function b(p) {
|
|
1727
|
+
this._printer = p, this._current_frame = null;
|
|
1728
|
+
}
|
|
1729
|
+
b.prototype.get_parser_token = function() {
|
|
1730
|
+
return this._current_frame ? this._current_frame.parser_token : null;
|
|
1731
|
+
}, b.prototype.record_tag = function(p) {
|
|
1732
|
+
var _ = new x(this._current_frame, p, this._printer.indent_level);
|
|
1733
|
+
this._current_frame = _;
|
|
1734
|
+
}, b.prototype._try_pop_frame = function(p) {
|
|
1735
|
+
var _ = null;
|
|
1736
|
+
return p && (_ = p.parser_token, this._printer.indent_level = p.indent_level, this._current_frame = p.parent), _;
|
|
1737
|
+
}, b.prototype._get_frame = function(p, _) {
|
|
1738
|
+
for (var h = this._current_frame; h && p.indexOf(h.tag) === -1; ) {
|
|
1739
|
+
if (_ && _.indexOf(h.tag) !== -1) {
|
|
1740
|
+
h = null;
|
|
1741
|
+
break;
|
|
1742
|
+
}
|
|
1743
|
+
h = h.parent;
|
|
1744
|
+
}
|
|
1745
|
+
return h;
|
|
1746
|
+
}, b.prototype.try_pop = function(p, _) {
|
|
1747
|
+
var h = this._get_frame([p], _);
|
|
1748
|
+
return this._try_pop_frame(h);
|
|
1749
|
+
}, b.prototype.indent_to_tag = function(p) {
|
|
1750
|
+
var _ = this._get_frame(p);
|
|
1751
|
+
_ && (this._printer.indent_level = _.indent_level);
|
|
1752
|
+
};
|
|
1753
|
+
function y(p, _, h, k) {
|
|
1754
|
+
this._source_text = p || "", _ = _ || {}, this._js_beautify = h, this._css_beautify = k, this._tag_stack = null;
|
|
1755
|
+
var O = new t(_, "html");
|
|
1756
|
+
this._options = O, this._is_wrap_attributes_force = this._options.wrap_attributes.substr(0, 5) === "force", this._is_wrap_attributes_force_expand_multiline = this._options.wrap_attributes === "force-expand-multiline", this._is_wrap_attributes_force_aligned = this._options.wrap_attributes === "force-aligned", this._is_wrap_attributes_aligned_multiple = this._options.wrap_attributes === "aligned-multiple", this._is_wrap_attributes_preserve = this._options.wrap_attributes.substr(0, 8) === "preserve", this._is_wrap_attributes_preserve_aligned = this._options.wrap_attributes === "preserve-aligned";
|
|
1757
|
+
}
|
|
1758
|
+
y.prototype.beautify = function() {
|
|
1759
|
+
if (this._options.disabled)
|
|
1760
|
+
return this._source_text;
|
|
1761
|
+
var p = this._source_text, _ = this._options.eol;
|
|
1762
|
+
this._options.eol === "auto" && (_ = `
|
|
1763
|
+
`, p && a.test(p) && (_ = p.match(a)[0])), p = p.replace(r, `
|
|
1764
|
+
`);
|
|
1765
|
+
var h = p.match(/^[\t ]*/)[0], k = {
|
|
1766
|
+
text: "",
|
|
1767
|
+
type: ""
|
|
1768
|
+
}, O = new S(), A = new u(this._options, h), c = new s(p, this._options).tokenize();
|
|
1769
|
+
this._tag_stack = new b(A);
|
|
1770
|
+
for (var g = null, f = c.next(); f.type !== e.EOF; )
|
|
1771
|
+
f.type === e.TAG_OPEN || f.type === e.COMMENT ? (g = this._handle_tag_open(A, f, O, k, c), O = g) : f.type === e.ATTRIBUTE || f.type === e.EQUALS || f.type === e.VALUE || f.type === e.TEXT && !O.tag_complete ? g = this._handle_inside_tag(A, f, O, k) : f.type === e.TAG_CLOSE ? g = this._handle_tag_close(A, f, O) : f.type === e.TEXT ? g = this._handle_text(A, f, O) : A.add_raw_token(f), k = g, f = c.next();
|
|
1772
|
+
var T = A._output.get_code(_);
|
|
1773
|
+
return T;
|
|
1774
|
+
}, y.prototype._handle_tag_close = function(p, _, h) {
|
|
1775
|
+
var k = {
|
|
1776
|
+
text: _.text,
|
|
1777
|
+
type: _.type
|
|
1778
|
+
};
|
|
1779
|
+
return p.alignment_size = 0, h.tag_complete = !0, p.set_space_before_token(_.newlines || _.whitespace_before !== "", !0), h.is_unformatted ? p.add_raw_token(_) : (h.tag_start_char === "<" && (p.set_space_before_token(_.text[0] === "/", !0), this._is_wrap_attributes_force_expand_multiline && h.has_wrapped_attrs && p.print_newline(!1)), p.print_token(_)), h.indent_content && !(h.is_unformatted || h.is_content_unformatted) && (p.indent(), h.indent_content = !1), !h.is_inline_element && !(h.is_unformatted || h.is_content_unformatted) && p.set_wrap_point(), k;
|
|
1780
|
+
}, y.prototype._handle_inside_tag = function(p, _, h, k) {
|
|
1781
|
+
var O = h.has_wrapped_attrs, A = {
|
|
1782
|
+
text: _.text,
|
|
1783
|
+
type: _.type
|
|
1784
|
+
};
|
|
1785
|
+
return p.set_space_before_token(_.newlines || _.whitespace_before !== "", !0), h.is_unformatted ? p.add_raw_token(_) : h.tag_start_char === "{" && _.type === e.TEXT ? p.print_preserved_newlines(_) ? (_.newlines = 0, p.add_raw_token(_)) : p.print_token(_) : (_.type === e.ATTRIBUTE ? p.set_space_before_token(!0) : (_.type === e.EQUALS || _.type === e.VALUE && _.previous.type === e.EQUALS) && p.set_space_before_token(!1), _.type === e.ATTRIBUTE && h.tag_start_char === "<" && ((this._is_wrap_attributes_preserve || this._is_wrap_attributes_preserve_aligned) && (p.traverse_whitespace(_), O = O || _.newlines !== 0), this._is_wrap_attributes_force && h.attr_count >= this._options.wrap_attributes_min_attrs && (k.type !== e.TAG_OPEN || // ie. second attribute and beyond
|
|
1786
|
+
this._is_wrap_attributes_force_expand_multiline) && (p.print_newline(!1), O = !0)), p.print_token(_), O = O || p.previous_token_wrapped(), h.has_wrapped_attrs = O), A;
|
|
1787
|
+
}, y.prototype._handle_text = function(p, _, h) {
|
|
1788
|
+
var k = {
|
|
1789
|
+
text: _.text,
|
|
1790
|
+
type: "TK_CONTENT"
|
|
1791
|
+
};
|
|
1792
|
+
return h.custom_beautifier_name ? this._print_custom_beatifier_text(p, _, h) : h.is_unformatted || h.is_content_unformatted ? p.add_raw_token(_) : (p.traverse_whitespace(_), p.print_token(_)), k;
|
|
1793
|
+
}, y.prototype._print_custom_beatifier_text = function(p, _, h) {
|
|
1794
|
+
var k = this;
|
|
1795
|
+
if (_.text !== "") {
|
|
1796
|
+
var O = _.text, A, c = 1, g = "", f = "";
|
|
1797
|
+
h.custom_beautifier_name === "javascript" && typeof this._js_beautify == "function" ? A = this._js_beautify : h.custom_beautifier_name === "css" && typeof this._css_beautify == "function" ? A = this._css_beautify : h.custom_beautifier_name === "html" && (A = function(C, P) {
|
|
1798
|
+
var L = new y(C, P, k._js_beautify, k._css_beautify);
|
|
1799
|
+
return L.beautify();
|
|
1800
|
+
}), this._options.indent_scripts === "keep" ? c = 0 : this._options.indent_scripts === "separate" && (c = -p.indent_level);
|
|
1801
|
+
var T = p.get_full_indent(c);
|
|
1802
|
+
if (O = O.replace(/\n[ \t]*$/, ""), h.custom_beautifier_name !== "html" && O[0] === "<" && O.match(/^(<!--|<!\[CDATA\[)/)) {
|
|
1803
|
+
var n = /^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(O);
|
|
1804
|
+
if (!n) {
|
|
1805
|
+
p.add_raw_token(_);
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
g = T + n[1] + `
|
|
1809
|
+
`, O = n[4], n[5] && (f = T + n[5]), O = O.replace(/\n[ \t]*$/, ""), (n[2] || n[3].indexOf(`
|
|
1810
|
+
`) !== -1) && (n = n[3].match(/[ \t]+$/), n && (_.whitespace_before = n[0]));
|
|
1811
|
+
}
|
|
1812
|
+
if (O)
|
|
1813
|
+
if (A) {
|
|
1814
|
+
var d = function() {
|
|
1815
|
+
this.eol = `
|
|
1816
|
+
`;
|
|
1817
|
+
};
|
|
1818
|
+
d.prototype = this._options.raw_options;
|
|
1819
|
+
var m = new d();
|
|
1820
|
+
O = A(T + O, m);
|
|
1821
|
+
} else {
|
|
1822
|
+
var R = _.whitespace_before;
|
|
1823
|
+
R && (O = O.replace(new RegExp(`
|
|
1824
|
+
(` + R + ")?", "g"), `
|
|
1825
|
+
`)), O = T + O.replace(/\n/g, `
|
|
1826
|
+
` + T);
|
|
1827
|
+
}
|
|
1828
|
+
g && (O ? O = g + O + `
|
|
1829
|
+
` + f : O = g + f), p.print_newline(!1), O && (_.text = O, _.whitespace_before = "", _.newlines = 0, p.add_raw_token(_), p.print_newline(!0));
|
|
1830
|
+
}
|
|
1831
|
+
}, y.prototype._handle_tag_open = function(p, _, h, k, O) {
|
|
1832
|
+
var A = this._get_tag_open_token(_);
|
|
1833
|
+
if ((h.is_unformatted || h.is_content_unformatted) && !h.is_empty_element && _.type === e.TAG_OPEN && !A.is_start_tag ? (p.add_raw_token(_), A.start_tag_token = this._tag_stack.try_pop(A.tag_name)) : (p.traverse_whitespace(_), this._set_tag_position(p, _, A, h, k), A.is_inline_element || p.set_wrap_point(), p.print_token(_)), A.is_start_tag && this._is_wrap_attributes_force) {
|
|
1834
|
+
var c = 0, g;
|
|
1835
|
+
do
|
|
1836
|
+
g = O.peek(c), g.type === e.ATTRIBUTE && (A.attr_count += 1), c += 1;
|
|
1837
|
+
while (g.type !== e.EOF && g.type !== e.TAG_CLOSE);
|
|
1838
|
+
}
|
|
1839
|
+
return (this._is_wrap_attributes_force_aligned || this._is_wrap_attributes_aligned_multiple || this._is_wrap_attributes_preserve_aligned) && (A.alignment_size = _.text.length + 1), !A.tag_complete && !A.is_unformatted && (p.alignment_size = A.alignment_size), A;
|
|
1840
|
+
};
|
|
1841
|
+
var S = function(p, _) {
|
|
1842
|
+
if (this.parent = p || null, this.text = "", this.type = "TK_TAG_OPEN", this.tag_name = "", this.is_inline_element = !1, this.is_unformatted = !1, this.is_content_unformatted = !1, this.is_empty_element = !1, this.is_start_tag = !1, this.is_end_tag = !1, this.indent_content = !1, this.multiline_content = !1, this.custom_beautifier_name = null, this.start_tag_token = null, this.attr_count = 0, this.has_wrapped_attrs = !1, this.alignment_size = 0, this.tag_complete = !1, this.tag_start_char = "", this.tag_check = "", !_)
|
|
1843
|
+
this.tag_complete = !0;
|
|
1844
|
+
else {
|
|
1845
|
+
var h;
|
|
1846
|
+
this.tag_start_char = _.text[0], this.text = _.text, this.tag_start_char === "<" ? (h = _.text.match(/^<([^\s>]*)/), this.tag_check = h ? h[1] : "") : (h = _.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/), this.tag_check = h ? h[1] : "", (_.text.startsWith("{{#>") || _.text.startsWith("{{~#>")) && this.tag_check[0] === ">" && (this.tag_check === ">" && _.next !== null ? this.tag_check = _.next.text.split(" ")[0] : this.tag_check = _.text.split(">")[1])), this.tag_check = this.tag_check.toLowerCase(), _.type === e.COMMENT && (this.tag_complete = !0), this.is_start_tag = this.tag_check.charAt(0) !== "/", this.tag_name = this.is_start_tag ? this.tag_check : this.tag_check.substr(1), this.is_end_tag = !this.is_start_tag || _.closed && _.closed.text === "/>";
|
|
1847
|
+
var k = 2;
|
|
1848
|
+
this.tag_start_char === "{" && this.text.length >= 3 && this.text.charAt(2) === "~" && (k = 3), this.is_end_tag = this.is_end_tag || this.tag_start_char === "{" && (this.text.length < 3 || /[^#\^]/.test(this.text.charAt(k)));
|
|
1849
|
+
}
|
|
1850
|
+
};
|
|
1851
|
+
y.prototype._get_tag_open_token = function(p) {
|
|
1852
|
+
var _ = new S(this._tag_stack.get_parser_token(), p);
|
|
1853
|
+
return _.alignment_size = this._options.wrap_attributes_indent_size, _.is_end_tag = _.is_end_tag || v(_.tag_check, this._options.void_elements), _.is_empty_element = _.tag_complete || _.is_start_tag && _.is_end_tag, _.is_unformatted = !_.tag_complete && v(_.tag_check, this._options.unformatted), _.is_content_unformatted = !_.is_empty_element && v(_.tag_check, this._options.content_unformatted), _.is_inline_element = v(_.tag_name, this._options.inline) || this._options.inline_custom_elements && _.tag_name.includes("-") || _.tag_start_char === "{", _;
|
|
1854
|
+
}, y.prototype._set_tag_position = function(p, _, h, k, O) {
|
|
1855
|
+
if (h.is_empty_element || (h.is_end_tag ? h.start_tag_token = this._tag_stack.try_pop(h.tag_name) : (this._do_optional_end_element(h) && (h.is_inline_element || p.print_newline(!1)), this._tag_stack.record_tag(h), (h.tag_name === "script" || h.tag_name === "style") && !(h.is_unformatted || h.is_content_unformatted) && (h.custom_beautifier_name = l(h.tag_check, _)))), v(h.tag_check, this._options.extra_liners) && (p.print_newline(!1), p._output.just_added_blankline() || p.print_newline(!0)), h.is_empty_element) {
|
|
1856
|
+
if (h.tag_start_char === "{" && h.tag_check === "else") {
|
|
1857
|
+
this._tag_stack.indent_to_tag(["if", "unless", "each"]), h.indent_content = !0;
|
|
1858
|
+
var A = p.current_line_has_match(/{{#if/);
|
|
1859
|
+
A || p.print_newline(!1);
|
|
1860
|
+
}
|
|
1861
|
+
h.tag_name === "!--" && O.type === e.TAG_CLOSE && k.is_end_tag && h.text.indexOf(`
|
|
1862
|
+
`) === -1 || (h.is_inline_element || h.is_unformatted || p.print_newline(!1), this._calcluate_parent_multiline(p, h));
|
|
1863
|
+
} else if (h.is_end_tag) {
|
|
1864
|
+
var c = !1;
|
|
1865
|
+
c = h.start_tag_token && h.start_tag_token.multiline_content, c = c || !h.is_inline_element && !(k.is_inline_element || k.is_unformatted) && !(O.type === e.TAG_CLOSE && h.start_tag_token === k) && O.type !== "TK_CONTENT", (h.is_content_unformatted || h.is_unformatted) && (c = !1), c && p.print_newline(!1);
|
|
1866
|
+
} else
|
|
1867
|
+
h.indent_content = !h.custom_beautifier_name, h.tag_start_char === "<" && (h.tag_name === "html" ? h.indent_content = this._options.indent_inner_html : h.tag_name === "head" ? h.indent_content = this._options.indent_head_inner_html : h.tag_name === "body" && (h.indent_content = this._options.indent_body_inner_html)), !(h.is_inline_element || h.is_unformatted) && (O.type !== "TK_CONTENT" || h.is_content_unformatted) && p.print_newline(!1), this._calcluate_parent_multiline(p, h);
|
|
1868
|
+
}, y.prototype._calcluate_parent_multiline = function(p, _) {
|
|
1869
|
+
_.parent && p._output.just_added_newline() && !((_.is_inline_element || _.is_unformatted) && _.parent.is_inline_element) && (_.parent.multiline_content = !0);
|
|
1870
|
+
};
|
|
1871
|
+
var N = ["address", "article", "aside", "blockquote", "details", "div", "dl", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hr", "main", "menu", "nav", "ol", "p", "pre", "section", "table", "ul"], $ = ["a", "audio", "del", "ins", "map", "noscript", "video"];
|
|
1872
|
+
return y.prototype._do_optional_end_element = function(p) {
|
|
1873
|
+
var _ = null;
|
|
1874
|
+
if (!(p.is_empty_element || !p.is_start_tag || !p.parent)) {
|
|
1875
|
+
if (p.tag_name === "body")
|
|
1876
|
+
_ = _ || this._tag_stack.try_pop("head");
|
|
1877
|
+
else if (p.tag_name === "li")
|
|
1878
|
+
_ = _ || this._tag_stack.try_pop("li", ["ol", "ul", "menu"]);
|
|
1879
|
+
else if (p.tag_name === "dd" || p.tag_name === "dt")
|
|
1880
|
+
_ = _ || this._tag_stack.try_pop("dt", ["dl"]), _ = _ || this._tag_stack.try_pop("dd", ["dl"]);
|
|
1881
|
+
else if (p.parent.tag_name === "p" && N.indexOf(p.tag_name) !== -1) {
|
|
1882
|
+
var h = p.parent.parent;
|
|
1883
|
+
(!h || $.indexOf(h.tag_name) === -1) && (_ = _ || this._tag_stack.try_pop("p"));
|
|
1884
|
+
} else
|
|
1885
|
+
p.tag_name === "rp" || p.tag_name === "rt" ? (_ = _ || this._tag_stack.try_pop("rt", ["ruby", "rtc"]), _ = _ || this._tag_stack.try_pop("rp", ["ruby", "rtc"])) : p.tag_name === "optgroup" ? _ = _ || this._tag_stack.try_pop("optgroup", ["select"]) : p.tag_name === "option" ? _ = _ || this._tag_stack.try_pop("option", ["select", "datalist", "optgroup"]) : p.tag_name === "colgroup" ? _ = _ || this._tag_stack.try_pop("caption", ["table"]) : p.tag_name === "thead" ? (_ = _ || this._tag_stack.try_pop("caption", ["table"]), _ = _ || this._tag_stack.try_pop("colgroup", ["table"])) : p.tag_name === "tbody" || p.tag_name === "tfoot" ? (_ = _ || this._tag_stack.try_pop("caption", ["table"]), _ = _ || this._tag_stack.try_pop("colgroup", ["table"]), _ = _ || this._tag_stack.try_pop("thead", ["table"]), _ = _ || this._tag_stack.try_pop("tbody", ["table"])) : p.tag_name === "tr" ? (_ = _ || this._tag_stack.try_pop("caption", ["table"]), _ = _ || this._tag_stack.try_pop("colgroup", ["table"]), _ = _ || this._tag_stack.try_pop("tr", ["table", "thead", "tbody", "tfoot"])) : (p.tag_name === "th" || p.tag_name === "td") && (_ = _ || this._tag_stack.try_pop("td", ["table", "thead", "tbody", "tfoot", "tr"]), _ = _ || this._tag_stack.try_pop("th", ["table", "thead", "tbody", "tfoot", "tr"]));
|
|
1886
|
+
return p.parent = this._tag_stack.get_parser_token(), _;
|
|
1887
|
+
}
|
|
1888
|
+
}, Lt.Beautifier = y, Lt;
|
|
1889
|
+
}
|
|
1890
|
+
var ye;
|
|
1891
|
+
function ci() {
|
|
1892
|
+
if (ye)
|
|
1893
|
+
return at;
|
|
1894
|
+
ye = 1;
|
|
1895
|
+
var t = fi().Beautifier, i = De().Options;
|
|
1896
|
+
function s(e, a, r, u) {
|
|
1897
|
+
var o = new t(e, a, r, u);
|
|
1898
|
+
return o.beautify();
|
|
1899
|
+
}
|
|
1900
|
+
return hi.exports = s, at.defaultOptions = function() {
|
|
1901
|
+
return new i();
|
|
1902
|
+
}, at;
|
|
1903
|
+
}
|
|
1904
|
+
var xe;
|
|
1905
|
+
function di() {
|
|
1906
|
+
if (xe)
|
|
1907
|
+
return Z;
|
|
1908
|
+
xe = 1;
|
|
1909
|
+
var t = oi(), i = pi(), s = ci();
|
|
1910
|
+
function e(a, r, u, o) {
|
|
1911
|
+
return u = u || t, o = o || i, s(a, r, u, o);
|
|
1912
|
+
}
|
|
1913
|
+
return e.defaultOptions = s.defaultOptions, Z.js = t, Z.css = i, Z.html = e, Z;
|
|
1914
|
+
}
|
|
1915
|
+
(function(t) {
|
|
1916
|
+
function i(s, e, a) {
|
|
1917
|
+
var r = function(u, o) {
|
|
1918
|
+
return s.js_beautify(u, o);
|
|
1919
|
+
};
|
|
1920
|
+
return r.js = s.js_beautify, r.css = e.css_beautify, r.html = a.html_beautify, r.js_beautify = s.js_beautify, r.css_beautify = e.css_beautify, r.html_beautify = a.html_beautify, r;
|
|
1921
|
+
}
|
|
1922
|
+
(function(s) {
|
|
1923
|
+
var e = di();
|
|
1924
|
+
e.js_beautify = e.js, e.css_beautify = e.css, e.html_beautify = e.html, s.exports = i(e, e, e);
|
|
1925
|
+
})(t);
|
|
1926
|
+
})(si);
|
|
1927
|
+
const It = {
|
|
1928
|
+
html: {
|
|
1929
|
+
indent_size: "2",
|
|
1930
|
+
indent_char: " ",
|
|
1931
|
+
max_preserve_newlines: "-1",
|
|
1932
|
+
preserve_newlines: !1,
|
|
1933
|
+
keep_array_indentation: !1,
|
|
1934
|
+
break_chained_methods: !1,
|
|
1935
|
+
indent_scripts: "separate",
|
|
1936
|
+
brace_style: "end-expand",
|
|
1937
|
+
space_before_conditional: !0,
|
|
1938
|
+
unescape_strings: !1,
|
|
1939
|
+
jslint_happy: !1,
|
|
1940
|
+
end_with_newline: !0,
|
|
1941
|
+
wrap_line_length: "110",
|
|
1942
|
+
indent_inner_html: !0,
|
|
1943
|
+
comma_first: !1,
|
|
1944
|
+
e4x: !0,
|
|
1945
|
+
indent_empty_lines: !0
|
|
1946
|
+
},
|
|
1947
|
+
js: {
|
|
1948
|
+
indent_size: "2",
|
|
1949
|
+
indent_char: " ",
|
|
1950
|
+
max_preserve_newlines: "-1",
|
|
1951
|
+
preserve_newlines: !1,
|
|
1952
|
+
keep_array_indentation: !1,
|
|
1953
|
+
break_chained_methods: !1,
|
|
1954
|
+
indent_scripts: "normal",
|
|
1955
|
+
brace_style: "end-expand",
|
|
1956
|
+
space_before_conditional: !0,
|
|
1957
|
+
unescape_strings: !1,
|
|
1958
|
+
jslint_happy: !0,
|
|
1959
|
+
end_with_newline: !0,
|
|
1960
|
+
wrap_line_length: "110",
|
|
1961
|
+
indent_inner_html: !0,
|
|
1962
|
+
comma_first: !1,
|
|
1963
|
+
e4x: !0,
|
|
1964
|
+
indent_empty_lines: !0
|
|
1965
|
+
},
|
|
1966
|
+
css: {
|
|
1967
|
+
indent_size: "2",
|
|
1968
|
+
indent_char: " ",
|
|
1969
|
+
max_preserve_newlines: "-1",
|
|
1970
|
+
preserve_newlines: !1,
|
|
1971
|
+
keep_array_indentation: !1,
|
|
1972
|
+
break_chained_methods: !1,
|
|
1973
|
+
indent_scripts: "normal",
|
|
1974
|
+
brace_style: "end-expand",
|
|
1975
|
+
space_before_conditional: !0,
|
|
1976
|
+
unescape_strings: !1,
|
|
1977
|
+
jslint_happy: !0,
|
|
1978
|
+
end_with_newline: !0,
|
|
1979
|
+
wrap_line_length: "110",
|
|
1980
|
+
indent_inner_html: !0,
|
|
1981
|
+
comma_first: !1,
|
|
1982
|
+
e4x: !0,
|
|
1983
|
+
indent_empty_lines: !0
|
|
1984
|
+
}
|
|
1985
|
+
};
|
|
1986
|
+
function ft(t, i) {
|
|
1987
|
+
switch (t) {
|
|
1988
|
+
case q.html:
|
|
1989
|
+
return it.html(i, It.html);
|
|
1990
|
+
case q.css:
|
|
1991
|
+
return it.css(i, It.css);
|
|
1992
|
+
case q.javascript:
|
|
1993
|
+
return it.js(i, It.js);
|
|
1994
|
+
case q.json: {
|
|
1995
|
+
var s = ze(i);
|
|
1996
|
+
return Bt(s) && i ? i : H(s, void 0, " ");
|
|
1997
|
+
}
|
|
1998
|
+
default:
|
|
1999
|
+
return i;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
const mi = (t) => t ? t.replace(/[A-Z]/g, function(i) {
|
|
2003
|
+
return "-" + i.toLowerCase();
|
|
2004
|
+
}) : "";
|
|
2005
|
+
class W {
|
|
2006
|
+
constructor() {
|
|
2007
|
+
Y(this, "exContent");
|
|
2008
|
+
Y(this, "tag");
|
|
2009
|
+
Y(this, "exProp");
|
|
2010
|
+
Y(this, "autoProp");
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
const gi = (t, i) => `<el-row ${U(t)}>
|
|
2014
|
+
${t.cols.map((a) => bi(a, i)).join("")}
|
|
2015
|
+
</el-row>
|
|
2016
|
+
`, bi = (t, i) => {
|
|
2017
|
+
const s = w.getOptions(t, "responsive");
|
|
2018
|
+
["span", "xs", "sm", "md", "lg", "xl"].forEach((r) => {
|
|
2019
|
+
let u = null;
|
|
2020
|
+
const o = !!s, l = w.getOptions(t, r);
|
|
2021
|
+
r == "span" ? u = o ? null : l : u = o ? l : null, w.setOrgOption(t, r, u);
|
|
2022
|
+
}), delete t.options.responsive;
|
|
2023
|
+
const a = vt(t, i);
|
|
2024
|
+
return bt(t, { wdName: "el-col", props: a });
|
|
2025
|
+
}, vi = (t, i) => `<div class="table-container">
|
|
2026
|
+
<table ${U(t, "table-layout")}>
|
|
2027
|
+
<tbody>
|
|
2028
|
+
${t.rows.map((a) => yi(a, i)).join("")}
|
|
2029
|
+
</tbody>
|
|
2030
|
+
</table>
|
|
2031
|
+
</div>`, yi = (t, i) => `<tr>${t.cols.filter((s) => !s.merged).map((s) => xi(s, i)).join("")}</tr>`, xi = (t, i) => {
|
|
2032
|
+
const s = t.options, e = U(t);
|
|
2033
|
+
["colspan", "rowspan"].forEach((o) => {
|
|
2034
|
+
let l = w.getOptions(t, o);
|
|
2035
|
+
const v = Ve(l) && !isNaN(l) && l !== 1 ? l : "";
|
|
2036
|
+
w.setOptions(t, o, String(v));
|
|
2037
|
+
}), delete t.options.name;
|
|
2038
|
+
const r = vt(t, i);
|
|
2039
|
+
let u = [];
|
|
2040
|
+
return s.cellWidth && u.push("width: " + s.cellWidth + " !important"), s.cellHeight && u.push("height: " + s.cellHeight + " !important"), bt(t, { wdName: "td", props: r, classAttr: e, styleArray: u });
|
|
2041
|
+
}, wi = (t, i) => {
|
|
2042
|
+
const s = U(t), e = t.tabs && t.tabs.length > 0 ? `v-model="${w.getName(t)}ActiveTab"` : "", a = vt(t, i);
|
|
2043
|
+
return `
|
|
2044
|
+
<el-tabs ${e} type="${t.displayType}" ${a} ${s}>
|
|
2045
|
+
${t.tabs.map((u) => {
|
|
2046
|
+
const o = w.getOptions(u, "disabled"), l = w.getOptions(u, "name"), v = w.getOptions(u, "label");
|
|
2047
|
+
return `
|
|
2048
|
+
<el-tab-pane name="${l}" label="${v}" ${o === !0 ? "disabled" : ""}>
|
|
2049
|
+
${X(u.widgetList)}
|
|
2050
|
+
</el-tab-pane>
|
|
2051
|
+
`;
|
|
2052
|
+
}).join("")}
|
|
2053
|
+
</el-tabs>
|
|
2054
|
+
`;
|
|
2055
|
+
}, Oi = (t) => {
|
|
2056
|
+
var a;
|
|
2057
|
+
const { slots: i } = mt(t, void 0, { s_slots: !0 });
|
|
2058
|
+
var s = [
|
|
2059
|
+
D("header", w.getOptions(t, "label")),
|
|
2060
|
+
D("default", X((a = Re(i.value, "default")) == null ? void 0 : a.widgetList), !0)
|
|
2061
|
+
];
|
|
2062
|
+
let e = {
|
|
2063
|
+
exContent: s.join("")
|
|
2064
|
+
};
|
|
2065
|
+
return M(t, e);
|
|
2066
|
+
}, Ti = (t) => {
|
|
2067
|
+
const i = w.getOptions(t, "label"), s = w.getOptions(t, "labelTooltip"), e = w.getOptions(t, "labelIconClass"), a = w.getOptions(t, "labelIconPosition");
|
|
2068
|
+
if (!s && !e)
|
|
2069
|
+
return i;
|
|
2070
|
+
let r = F(e, '<i class="', '"></i>'), u = F(r, `<el-tooltip content="${s}" effect="light">`, "</el-tooltip>"), o = `${a === Jt.rear ? i : ""}${u}${a === Jt.front ? i : ""}`;
|
|
2071
|
+
return o ? F(o, "<template #label>", "</template>") : i;
|
|
2072
|
+
}, Ei = (t, i) => {
|
|
2073
|
+
var o;
|
|
2074
|
+
const s = U(t), e = w.getOptions(t, "modelName") || w.getName(t), a = t.widgetList && t.widgetList.length > 0 ? `:model="${e}"` : "", r = vt(t, {});
|
|
2075
|
+
return `
|
|
2076
|
+
<el-form ${a} ${r} ${s}>
|
|
2077
|
+
${(o = t.widgetList) == null ? void 0 : o.map((l) => {
|
|
2078
|
+
const v = w.getOptions(l, "labelHidden"), x = w.getOptions(l, "label"), b = w.getOptions(l, "labelWidth"), y = w.getOptions(l, "labelPosition"), S = v ? "" : x, N = v ? 'label-width="0"' : b ? `label-width="${b}"` : "", $ = !v && y ? `label-position="${y}"` : "", p = Ti(l);
|
|
2079
|
+
let _ = X([l], i);
|
|
2080
|
+
const h = ` prop="${w.getName(t)}"`, k = `<el-form-item label="${S}" ${N} ${$} ${s} ${h}>
|
|
2081
|
+
${p}
|
|
2082
|
+
${_}
|
|
2083
|
+
</el-form-item>`;
|
|
2084
|
+
return l != null && l.formItemFlag ? k : _;
|
|
2085
|
+
}).join("")}
|
|
2086
|
+
</el-form>
|
|
2087
|
+
`;
|
|
2088
|
+
}, ki = (t) => {
|
|
2089
|
+
var s;
|
|
2090
|
+
const i = ke((s = _t(t)) == null ? void 0 : s.map((e) => t[e] ? `${e}:${t[e]}` : ""), ";");
|
|
2091
|
+
return i ? `style="${i}"` : "";
|
|
2092
|
+
}, Ri = (t) => {
|
|
2093
|
+
var s;
|
|
2094
|
+
return ke((s = _t(t)) == null ? void 0 : s.map((e) => t[e] ? `${e}="${t[e]}"` : ""), " ");
|
|
2095
|
+
}, Ai = (t) => `${t.cols.map((s) => Ft(s)).join("")}`, Ft = (t) => {
|
|
2096
|
+
var b, y;
|
|
2097
|
+
const i = t, s = `${B.getValue(i.partName)}`, e = `${B.getValue(i.direction)}`, a = `${B.getValue(i.cellWidth)}`, r = `${B.getValue(i.cellHeight)}`, u = U({ type: E.contCell, options: i }), o = { width: a, height: r }, l = { direction: e }, v = `el-${s}`;
|
|
2098
|
+
return v ? `
|
|
2099
|
+
<${v} ${u} ${Ri(l)} ${ki(o)}>
|
|
2100
|
+
${(y = (b = t == null ? void 0 : t.children) == null ? void 0 : b.map((S) => Ft(S))) == null ? void 0 : y.join("")}
|
|
2101
|
+
${bt(Mt(t))}
|
|
2102
|
+
</${v}>
|
|
2103
|
+
` : "";
|
|
2104
|
+
}, Si = (t, i) => M(t, {
|
|
2105
|
+
tag: "el-input",
|
|
2106
|
+
exProp: 'type="textarea"'
|
|
2107
|
+
}, i), Ci = (t, i) => {
|
|
2108
|
+
const s = G(t, i), e = Ni(t);
|
|
2109
|
+
return `<el-radio-group ${s}>${e}</el-radio-group>`;
|
|
2110
|
+
};
|
|
2111
|
+
function Ni(t) {
|
|
2112
|
+
const i = w.getOptions(t, "buttonStyle") ? "el-radio-button" : "el-radio", s = w.getOptions(t, "border") ? "border" : "", e = `style="display: ${w.getOptions(t, "displayStyle")}"`, a = new W();
|
|
2113
|
+
return a.tag = i, a.autoProp = !1, a.exContent = "{{item.label}}", a.exProp = [
|
|
2114
|
+
s,
|
|
2115
|
+
e,
|
|
2116
|
+
j("item.value", ":label"),
|
|
2117
|
+
j(w.getOptions(t, "disabled") ? "true" : "item.disabled", ":disabled"),
|
|
2118
|
+
j(w.getOptions(t, "border") ? "true" : "item.border", ":border")
|
|
2119
|
+
].join(" "), K(t, a);
|
|
2120
|
+
}
|
|
2121
|
+
const $i = (t, i) => {
|
|
2122
|
+
const s = G(t, i), e = Pi(t);
|
|
2123
|
+
return `<el-checkbox-group ${s}>${e}</el-checkbox-group>`;
|
|
2124
|
+
};
|
|
2125
|
+
function Pi(t) {
|
|
2126
|
+
const i = w.getOptions(t, "buttonStyle") ? "el-checkbox-button" : "el-checkbox", s = w.getOptions(t, "border") ? "border" : "", e = `style="display: ${w.getOptions(t, "displayStyle")}"`, a = new W();
|
|
2127
|
+
return a.tag = i, a.autoProp = !1, a.exContent = "{{item.label}}", a.exProp = [
|
|
2128
|
+
s,
|
|
2129
|
+
e,
|
|
2130
|
+
j("item.value", ":label"),
|
|
2131
|
+
j(w.getOptions(t, "disabled") ? "true" : "item.disabled", ":disabled"),
|
|
2132
|
+
j(w.getOptions(t, "border") ? "true" : "item.border", ":border")
|
|
2133
|
+
].join(" "), K(t, a);
|
|
2134
|
+
}
|
|
2135
|
+
const ji = (t, i) => {
|
|
2136
|
+
const s = G(t, i), e = Li(t);
|
|
2137
|
+
var a = [
|
|
2138
|
+
D("prefix", w.getOptions(t, "slotPrefix"))
|
|
2139
|
+
];
|
|
2140
|
+
return `<el-select ${s}>${e}${a.join("")}</el-select>`;
|
|
2141
|
+
};
|
|
2142
|
+
function Li(t) {
|
|
2143
|
+
var i = w.getOptions(t, J.optionItems);
|
|
2144
|
+
return i != null && i.length ? i.some((s) => {
|
|
2145
|
+
var e;
|
|
2146
|
+
return ((e = s.children) == null ? void 0 : e.length) > 0;
|
|
2147
|
+
}) ? Ii(t) : Di(t) : "";
|
|
2148
|
+
}
|
|
2149
|
+
function Di(t) {
|
|
2150
|
+
const i = "el-option", s = new W();
|
|
2151
|
+
return s.tag = i, s.autoProp = !0, K(t, s);
|
|
2152
|
+
}
|
|
2153
|
+
function Ii(t) {
|
|
2154
|
+
var i = w.getOptions(t, J.optionItems);
|
|
2155
|
+
if (!(i != null && i.length))
|
|
2156
|
+
return "";
|
|
2157
|
+
var s = i == null ? void 0 : i.map((e) => Bi(e));
|
|
2158
|
+
return s == null ? void 0 : s.join("");
|
|
2159
|
+
}
|
|
2160
|
+
function Bi(t) {
|
|
2161
|
+
var s;
|
|
2162
|
+
if (((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) > 0) {
|
|
2163
|
+
var i = "el-option-group";
|
|
2164
|
+
return `
|
|
2165
|
+
<${i}>${we(t.children)}</${i}>
|
|
2166
|
+
`;
|
|
2167
|
+
} else
|
|
2168
|
+
return we(t);
|
|
2169
|
+
}
|
|
2170
|
+
function we(t) {
|
|
2171
|
+
var i = [
|
|
2172
|
+
j(t.value, "value"),
|
|
2173
|
+
j(t.label, "label")
|
|
2174
|
+
];
|
|
2175
|
+
return `
|
|
2176
|
+
<el-option ${i}></el-option>
|
|
2177
|
+
`;
|
|
2178
|
+
}
|
|
2179
|
+
const Mi = (t, i) => {
|
|
2180
|
+
const s = U(t, "");
|
|
2181
|
+
var e = w.getOptions(t, J.optionItems);
|
|
2182
|
+
const a = G(t, i);
|
|
2183
|
+
return `
|
|
2184
|
+
<el-table ${s} ${a}>
|
|
2185
|
+
${e == null ? void 0 : e.map((u) => Ie(u, i)).join("")}
|
|
2186
|
+
</el-table>
|
|
2187
|
+
`;
|
|
2188
|
+
}, Ie = (t, i) => {
|
|
2189
|
+
var l, v;
|
|
2190
|
+
const s = Oe(t);
|
|
2191
|
+
delete s.children;
|
|
2192
|
+
const e = Mt({ type: E.eltableCol, options: s }), a = G(e, i), { slots: r } = mt(e, void 0, { s_slots: !0 });
|
|
2193
|
+
var u = [
|
|
2194
|
+
D("default", X((l = Re(r.value, "default")) == null ? void 0 : l.widgetList), !1)
|
|
2195
|
+
];
|
|
2196
|
+
return `
|
|
2197
|
+
<el-table-column ${a}>
|
|
2198
|
+
${((v = t == null ? void 0 : t.children) == null ? void 0 : v.map((x) => Ie(x, i))) || ""}
|
|
2199
|
+
${u}
|
|
2200
|
+
</el-table-column>
|
|
2201
|
+
`;
|
|
2202
|
+
}, Wi = (t, i) => {
|
|
2203
|
+
const { pictureUploadIconChild: s, uploadTipSlotChild: e } = yt(t), a = G(t, i);
|
|
2204
|
+
let r = t.options, u = r == null ? void 0 : r.name;
|
|
2205
|
+
return `<el-upload
|
|
2206
|
+
:file-list="${u}FileList"
|
|
2207
|
+
:headers="${u}UploadHeaders"
|
|
2208
|
+
:data="${u}UploadData"
|
|
2209
|
+
list-type="picture-card"
|
|
2210
|
+
${a}>
|
|
2211
|
+
${D(rt.tip, e)}
|
|
2212
|
+
${D(rt.default, s)}
|
|
2213
|
+
</el-upload>`;
|
|
2214
|
+
}, Ki = (t, i) => {
|
|
2215
|
+
const { fileUploadIconChild: s, uploadTipSlotChild: e } = yt(t), a = G(t, i);
|
|
2216
|
+
let r = t.options, u = r == null ? void 0 : r.name;
|
|
2217
|
+
return `<el-upload
|
|
2218
|
+
:file-list="${u}FileList"
|
|
2219
|
+
:headers="${u}UploadHeaders"
|
|
2220
|
+
:data="${u}UploadData"
|
|
2221
|
+
list-type="picture-card"
|
|
2222
|
+
${a}>
|
|
2223
|
+
${D(rt.tip, e)}
|
|
2224
|
+
${D(rt.default, s)}
|
|
2225
|
+
</el-upload>`;
|
|
2226
|
+
}, Ui = (t) => M(t, {
|
|
2227
|
+
tag: "vue-editor"
|
|
2228
|
+
}), zi = (t) => {
|
|
2229
|
+
let i = t.options;
|
|
2230
|
+
var s = ["checkStrictly", "multiple", "expandTrigger", "lazy", "emitPath", "hoverThreshold"], e = {};
|
|
2231
|
+
s.forEach((r) => {
|
|
2232
|
+
(i == null ? void 0 : i[r]) !== void 0 && (e[r] = i == null ? void 0 : i[r]);
|
|
2233
|
+
});
|
|
2234
|
+
let a = {
|
|
2235
|
+
exProp: [
|
|
2236
|
+
`:options="${w.getOptions(t, "name")}Options"`,
|
|
2237
|
+
`:props="${H(e).replaceAll('"', "'")}"`
|
|
2238
|
+
].join(" ")
|
|
2239
|
+
};
|
|
2240
|
+
return M(t, a);
|
|
2241
|
+
}, qi = (t) => {
|
|
2242
|
+
var i = Oe(t);
|
|
2243
|
+
const { linkPrefixIcon: s, linkSuffixIcon: e } = yt(i);
|
|
2244
|
+
return B.getValue(i.defalut) || B.setValue(i, "default", ` ${s}${w.getOptions(t, "content")}${e}`), M(i);
|
|
2245
|
+
}, Vi = (t) => {
|
|
2246
|
+
var e;
|
|
2247
|
+
let i = t.options, s = {
|
|
2248
|
+
// exContent: arr.join(''),
|
|
2249
|
+
exProp: `:preview-src-list=${H((e = B.getValue(i.optionItems)) == null ? void 0 : e.map((a) => a.label))}`
|
|
2250
|
+
};
|
|
2251
|
+
return M(t, s);
|
|
2252
|
+
}, Fi = (t) => {
|
|
2253
|
+
const i = w.getOptions(t, "label"), s = U(t, "");
|
|
2254
|
+
return `<router-view name="${i}" :key="$route.fullPath" ${s}></router-view>`;
|
|
2255
|
+
};
|
|
2256
|
+
function Xi(t) {
|
|
2257
|
+
const i = ot(t);
|
|
2258
|
+
var s = [
|
|
2259
|
+
'<div v-html="item?.content"></div>'
|
|
2260
|
+
], e = [
|
|
2261
|
+
V("name", "item?.name"),
|
|
2262
|
+
V("label", "item?.label")
|
|
2263
|
+
];
|
|
2264
|
+
const a = new W();
|
|
2265
|
+
return a.tag = i, a.autoProp = !1, a.exContent = s.join(""), a.exProp = e.join(""), K(t, a);
|
|
2266
|
+
}
|
|
2267
|
+
const Gi = (t) => {
|
|
2268
|
+
t.options;
|
|
2269
|
+
const i = Qi(t);
|
|
2270
|
+
var e = [
|
|
2271
|
+
`<div v-html="${w.getOptions(t, "label")}"></div>`,
|
|
2272
|
+
D("dropdown", i)
|
|
2273
|
+
];
|
|
2274
|
+
let a = {
|
|
2275
|
+
exContent: e.join("")
|
|
2276
|
+
};
|
|
2277
|
+
return M(t, a);
|
|
2278
|
+
};
|
|
2279
|
+
function Qi(t) {
|
|
2280
|
+
const i = ot(t);
|
|
2281
|
+
var s = [
|
|
2282
|
+
"{{item.label}}"
|
|
2283
|
+
], e = [
|
|
2284
|
+
'v-bind="item"'
|
|
2285
|
+
];
|
|
2286
|
+
const a = new W();
|
|
2287
|
+
return a.tag = i, a.autoProp = !1, a.exContent = s.join(""), a.exProp = e.join(""), K(t, a);
|
|
2288
|
+
}
|
|
2289
|
+
function Hi(t) {
|
|
2290
|
+
const i = ot(t);
|
|
2291
|
+
var s = [
|
|
2292
|
+
D("title", '<span v-html="item?.label"></span>'),
|
|
2293
|
+
'<div v-html="item?.content"></div>'
|
|
2294
|
+
], e = [
|
|
2295
|
+
'v-bind="item"',
|
|
2296
|
+
V("name", "item?.value")
|
|
2297
|
+
];
|
|
2298
|
+
const a = new W();
|
|
2299
|
+
return a.tag = i, a.autoProp = !1, a.exContent = s.join(""), a.exProp = e.join(""), K(t, a);
|
|
2300
|
+
}
|
|
2301
|
+
const Ji = (t) => {
|
|
2302
|
+
const i = Yi(t), s = w.getOptions(t, "title"), e = w.getOptions(t, "extra");
|
|
2303
|
+
var a = [
|
|
2304
|
+
D("title", `${s}`),
|
|
2305
|
+
D("extra", `${e}`),
|
|
2306
|
+
i
|
|
2307
|
+
];
|
|
2308
|
+
let r = {
|
|
2309
|
+
exContent: a.join("")
|
|
2310
|
+
};
|
|
2311
|
+
return M(t, r);
|
|
2312
|
+
};
|
|
2313
|
+
function Yi(t) {
|
|
2314
|
+
const i = ot(t);
|
|
2315
|
+
var s = [
|
|
2316
|
+
'<div v-html="item?.content"></div>',
|
|
2317
|
+
D("label", "{{item?.label}}")
|
|
2318
|
+
];
|
|
2319
|
+
const e = new W();
|
|
2320
|
+
return e.tag = i, e.autoProp = !0, e.exContent = s.join(""), K(t, e);
|
|
2321
|
+
}
|
|
2322
|
+
function Zi(t) {
|
|
2323
|
+
const i = ot(t);
|
|
2324
|
+
var s = [
|
|
2325
|
+
`<a :href="item.to" :target="item.replace===true?'_self':'_blank'">{{ item.label }}</a>`
|
|
2326
|
+
];
|
|
2327
|
+
const e = new W();
|
|
2328
|
+
return e.tag = i, e.autoProp = !1, e.exContent = s.join(""), K(t, e);
|
|
2329
|
+
}
|
|
2330
|
+
function Be(t) {
|
|
2331
|
+
if (!(t != null && t.length))
|
|
2332
|
+
return "";
|
|
2333
|
+
var i = t == null ? void 0 : t.map((s) => ts(s));
|
|
2334
|
+
return i == null ? void 0 : i.join("");
|
|
2335
|
+
}
|
|
2336
|
+
function ts(t) {
|
|
2337
|
+
var s;
|
|
2338
|
+
if (t != null && t.children && ((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) > 0) {
|
|
2339
|
+
var i = (t == null ? void 0 : t.menuItemType) === Je.MenuItemGroup ? "el-menu-item-group" : "el-sub-menu";
|
|
2340
|
+
return `
|
|
2341
|
+
<${i}>${Be(t.children)}</${i}>
|
|
2342
|
+
`;
|
|
2343
|
+
} else
|
|
2344
|
+
return es(t);
|
|
2345
|
+
}
|
|
2346
|
+
function es(t) {
|
|
2347
|
+
return `
|
|
2348
|
+
<el-menu-item>
|
|
2349
|
+
<template #title>
|
|
2350
|
+
${t != null && t.icon ? `<i :class="el-icon-${t == null ? void 0 : t.icon}"></i>` : ""}${t.label}
|
|
2351
|
+
</template>
|
|
2352
|
+
</el-menu-item>
|
|
2353
|
+
`;
|
|
2354
|
+
}
|
|
2355
|
+
function is(t) {
|
|
2356
|
+
const i = "el-step";
|
|
2357
|
+
var s = [
|
|
2358
|
+
D("title", "{{item.label}}"),
|
|
2359
|
+
D("description", "{{item.description}}"),
|
|
2360
|
+
D("icon", '<i class="el-icon-" + item.icon></i>')
|
|
2361
|
+
], e = [
|
|
2362
|
+
V("status", "item?.status")
|
|
2363
|
+
];
|
|
2364
|
+
const a = new W();
|
|
2365
|
+
return a.tag = i, a.autoProp = !1, a.exContent = s.join(""), a.exProp = e.join(""), K(t, a);
|
|
2366
|
+
}
|
|
2367
|
+
const ss = (t) => M(t, { tag: "div", exContent: w.getOptions(t, "content"), autoProp: !1 }), ns = (t) => {
|
|
2368
|
+
var i = t == null ? void 0 : t.options;
|
|
2369
|
+
return i == null ? void 0 : i.content;
|
|
2370
|
+
}, as = (t, i) => M(t, void 0, i), M = (t, i, s) => {
|
|
2371
|
+
var $, p, _;
|
|
2372
|
+
const e = i == null ? void 0 : i.exContent, a = i == null ? void 0 : i.tag, r = i == null ? void 0 : i.exProp, u = i == null ? void 0 : i.autoProp, o = Xt(t, s);
|
|
2373
|
+
let l = u !== !1 ? (p = ($ = Object.values(o)) == null ? void 0 : $.filter((h) => !!h)) == null ? void 0 : p.join(" ") : "";
|
|
2374
|
+
l = [r || "", l || ""].join(" ");
|
|
2375
|
+
const v = w.getOptions(t, "content"), x = w.getOptions(t, "label"), { originSlots: b } = mt(t, void 0, { s_slots: !0 }), y = (_ = b.value) == null ? void 0 : _.map((h) => {
|
|
2376
|
+
var k;
|
|
2377
|
+
return ((k = h == null ? void 0 : h.widgetList) == null ? void 0 : k.length) > 0 ? bt(h, { wdName: "template", props: `#${h == null ? void 0 : h.slotName}` }) : D(h == null ? void 0 : h.slotName, Qe(h.default) || h.default || ((h == null ? void 0 : h.slotName) == rt.default ? v || x : ""));
|
|
2378
|
+
}).join(" ");
|
|
2379
|
+
let S = [e, y].join(" ");
|
|
2380
|
+
const N = a || `el-${t == null ? void 0 : t.type}`;
|
|
2381
|
+
return `<${N} ${l}>${S}</${N}>`;
|
|
2382
|
+
};
|
|
2383
|
+
function K(t, i) {
|
|
2384
|
+
var a;
|
|
2385
|
+
const s = w.getOptions(t, J.optionItems);
|
|
2386
|
+
(a = B.getValue(s)) == null || a[0];
|
|
2387
|
+
const e = i.autoProp !== !1 ? 'v-bind="item"' : "";
|
|
2388
|
+
return `
|
|
2389
|
+
<${i.tag} v-for="(item, index) in ${w.getOptions(t, "name")}Options" :key="index" ${e || ""} ${i.exProp || ""}>
|
|
2390
|
+
${i.exContent || ""}
|
|
2391
|
+
</${i.tag}>
|
|
2392
|
+
`;
|
|
2393
|
+
}
|
|
2394
|
+
const ot = (t) => `el-${t == null ? void 0 : t.type}-item`, et = (t) => {
|
|
2395
|
+
let i = "";
|
|
2396
|
+
switch (t == null ? void 0 : t.type) {
|
|
2397
|
+
case E.menu:
|
|
2398
|
+
i = Be(w.getOptions(t, J.optionItems));
|
|
2399
|
+
break;
|
|
2400
|
+
case E.collapse:
|
|
2401
|
+
i = Hi(t);
|
|
2402
|
+
break;
|
|
2403
|
+
case E.breadcrumb:
|
|
2404
|
+
i = Zi(t);
|
|
2405
|
+
break;
|
|
2406
|
+
case E.steps:
|
|
2407
|
+
i = is(t);
|
|
2408
|
+
break;
|
|
2409
|
+
case E.carousel:
|
|
2410
|
+
i = Xi(t);
|
|
2411
|
+
break;
|
|
2412
|
+
}
|
|
2413
|
+
return M(t, { exContent: i });
|
|
2414
|
+
};
|
|
2415
|
+
function U(t, i = "") {
|
|
2416
|
+
const s = t == null ? void 0 : t.options;
|
|
2417
|
+
let e = [];
|
|
2418
|
+
i && i !== "" && e.push(i);
|
|
2419
|
+
const a = B.getValue(s == null ? void 0 : s.customClass);
|
|
2420
|
+
return a && Array.isArray(a) && a.length > 0 && e.push(Array.from(a).join(" ")), e.length > 0 ? `class="${e.join(" ")}"` : "";
|
|
2421
|
+
}
|
|
2422
|
+
const bt = (t, i) => {
|
|
2423
|
+
const s = U(t) || "", e = (i == null ? void 0 : i.wdName) || "", a = i == null ? void 0 : i.styleArray, r = (i == null ? void 0 : i.classAttr) || "", u = (i == null ? void 0 : i.props) || "";
|
|
2424
|
+
let o = (a == null ? void 0 : a.length) > 0 ? `style="${a == null ? void 0 : a.join(";")}"` : "";
|
|
2425
|
+
return e ? `
|
|
2426
|
+
<${e} ${s} ${o} ${r} ${u}>
|
|
2427
|
+
${X(t == null ? void 0 : t.widgetList)}
|
|
2428
|
+
</${e}>
|
|
2429
|
+
` : `
|
|
2430
|
+
${X(t == null ? void 0 : t.widgetList)}
|
|
2431
|
+
`;
|
|
2432
|
+
}, _s = () => {
|
|
2433
|
+
var t = {};
|
|
2434
|
+
return t[E.grid + ""] = gi, t[E.table + ""] = vi, t[E.tabs + ""] = wi, t[E.cont + ""] = Ai, t[E.contCell + ""] = Ft, t[E.form + ""] = Ei, t;
|
|
2435
|
+
}, rs = _s();
|
|
2436
|
+
function X(t, i) {
|
|
2437
|
+
var s = [];
|
|
2438
|
+
return t == null || t.forEach((e) => {
|
|
2439
|
+
e.category === He.container ? s.push(os(e, i)) : s.push(ps(e, i));
|
|
2440
|
+
}), s.length ? s.join(`
|
|
2441
|
+
`) : "";
|
|
2442
|
+
}
|
|
2443
|
+
function os(t, i) {
|
|
2444
|
+
const s = rs[t.type];
|
|
2445
|
+
return s ? s(t, i) : null;
|
|
2446
|
+
}
|
|
2447
|
+
function G(t, i) {
|
|
2448
|
+
var e, a;
|
|
2449
|
+
const s = Xt(t, i);
|
|
2450
|
+
return (a = (e = Object.values(s)) == null ? void 0 : e.filter((r) => !!r)) == null ? void 0 : a.join(" ");
|
|
2451
|
+
}
|
|
2452
|
+
function vt(t, i) {
|
|
2453
|
+
var e, a;
|
|
2454
|
+
var s = Xt(t, i);
|
|
2455
|
+
return (a = (e = Object.values(s)) == null ? void 0 : e.filter((r) => !!r)) == null ? void 0 : a.join(" ");
|
|
2456
|
+
}
|
|
2457
|
+
function Xt(t, i) {
|
|
2458
|
+
var l;
|
|
2459
|
+
let s = t.options, e = {};
|
|
2460
|
+
const { attrs: a } = mt(t, void 0, { s_attr: !0 });
|
|
2461
|
+
var r = a.value;
|
|
2462
|
+
let u = yt(t, i);
|
|
2463
|
+
(l = Object.keys(r)) == null || l.map((v) => {
|
|
2464
|
+
var x = mi(v), b = B.getValue(s[v]);
|
|
2465
|
+
e[v] = u[v] || j(b, x);
|
|
2466
|
+
});
|
|
2467
|
+
var o = "vModel";
|
|
2468
|
+
return u[o] && (e[o] = u[o]), e;
|
|
2469
|
+
}
|
|
2470
|
+
function yt(t, i) {
|
|
2471
|
+
var a;
|
|
2472
|
+
const s = w.getOptions(t, "name"), e = (a = i == null ? void 0 : i.getFieldModel) == null ? void 0 : a.call(i, s);
|
|
2473
|
+
return {
|
|
2474
|
+
vModel: (t == null ? void 0 : t.formItemFlag) === !0 && e ? `v-model="${e}"` : "",
|
|
2475
|
+
defaultFirstOption: j(w.getOptions(t, "filterable") && w.getOptions(t, "allowCreate"), "default-first-option"),
|
|
2476
|
+
type: j(w.getOptions(t, "type") === "number" ? "text" : w.getOptions(t, "type"), "type"),
|
|
2477
|
+
// rows: buildProp((!isNone(wop.rows) && !isNaN(wop.rows)) ? wop.rows : '', 'rows'),
|
|
2478
|
+
controlsPosition: j(w.getOptions(t, "controlsPosition") === Ht.right ? w.getOptions(t, "controlsPosition") : "", "controls-position"),
|
|
2479
|
+
contentPosition: j(w.getOptions(t, "contentPosition") !== Ht.center ? w.getOptions(t, "contentPosition") : "", "content-position"),
|
|
2480
|
+
readonly: j(w.getOptions(t, "readonly"), "readonly"),
|
|
2481
|
+
// disabled: buildProp(wop.disabled, `:disabled="true"`),
|
|
2482
|
+
// showWordLimit: buildProp(wop.showWordLimit, `:show-word-limit="true"`),
|
|
2483
|
+
rateMax: j(!isNaN(w.getOptions(t, "max") || 0) && w.getOptions(t, "max") !== 5 ? w.getOptions(t, "max") : "", "max"),
|
|
2484
|
+
sliderMin: j(w.getOptions(t, "min") !== 0 ? w.getOptions(t, "min") : "", "min"),
|
|
2485
|
+
sliderMax: j(w.getOptions(t, "max") !== 100 ? w.getOptions(t, "max") : "", "max"),
|
|
2486
|
+
sliderStep: j(w.getOptions(t, "step") !== 1 ? w.getOptions(t, "step") : "", "step"),
|
|
2487
|
+
// multipleLimit: buildProp((wop.multipleLimit > 0) ? wop.multipleLimit : '', 'multiple-limit'),
|
|
2488
|
+
switchWidth: j(w.getOptions(t, "switchWidth") !== 40 ? w.getOptions(t, "switchWidth") : "", "width"),
|
|
2489
|
+
lowThreshold: j(w.getOptions(t, "lowThreshold") !== 2 ? w.getOptions(t, "lowThreshold") : "", "low-threshold"),
|
|
2490
|
+
highThreshold: j(w.getOptions(t, "highThreshold") !== 4 ? w.getOptions(t, "highThreshold") : "", "high-threshold"),
|
|
2491
|
+
uploadTipSlotChild: w.getOptions(t, "uploadTip") ? `<div class="el-upload__tip">${w.getOptions(t, "uploadTip")}</div>` : "",
|
|
2492
|
+
//!!wop.uploadTip ? `<template #tip><div class="el-upload__tip">${wop.uploadTip}</div></template>` : '',
|
|
2493
|
+
// appendButtonChild: !!wop.appendButton ? getSlotTemplate('append', `<el-button class="${wop.buttonIcon}" ${!!wop.appendButtonDisabled ? 'disabled' : ''}></el-button>`) : '',
|
|
2494
|
+
//!!wop.appendButton ? `<template #append><el-button class="${wop.buttonIcon}" ${!!wop.appendButtonDisabled ? 'disabled' : ''}></el-button></template>` : '',
|
|
2495
|
+
linkPrefixIcon: ct(w.getOptions(t, "prefixIcon")),
|
|
2496
|
+
linkSuffixIcon: ct(w.getOptions(t, "suffixIcon")),
|
|
2497
|
+
pictureUploadIconChild: ct("plus"),
|
|
2498
|
+
fileUploadIconChild: ct("plus")
|
|
2499
|
+
};
|
|
2500
|
+
}
|
|
2501
|
+
function ct(t) {
|
|
2502
|
+
return t ? (t + "").trim().startsWith("<svg") ? t : `
|
|
2503
|
+
<el-icon><${t} /></el-icon>
|
|
2504
|
+
` : "";
|
|
2505
|
+
}
|
|
2506
|
+
function V(t, i, s = ":") {
|
|
2507
|
+
return `${s}${t}="${i}"`;
|
|
2508
|
+
}
|
|
2509
|
+
function D(t, i, s = !1) {
|
|
2510
|
+
return (i || s) && t ? `
|
|
2511
|
+
<template #${t}>
|
|
2512
|
+
${i}
|
|
2513
|
+
</template>
|
|
2514
|
+
` : "";
|
|
2515
|
+
}
|
|
2516
|
+
function j(t, i) {
|
|
2517
|
+
if (t) {
|
|
2518
|
+
var s = typeof t;
|
|
2519
|
+
if (s == "boolean")
|
|
2520
|
+
return V(i, t, ":");
|
|
2521
|
+
if (s == "number") {
|
|
2522
|
+
if (!Bt(t) && !isNaN(t))
|
|
2523
|
+
return V(i, t, ":");
|
|
2524
|
+
} else
|
|
2525
|
+
return s == "object" ? V(i, H(t), ":") : V(i, t, "");
|
|
2526
|
+
}
|
|
2527
|
+
return "";
|
|
2528
|
+
}
|
|
2529
|
+
const ls = () => {
|
|
2530
|
+
var t = {};
|
|
2531
|
+
return Ge(E).forEach((i) => {
|
|
2532
|
+
t[i.label] = as;
|
|
2533
|
+
}), t[E.textarea + ""] = Si, t[E.radio + ""] = Ci, t[E.checkbox + ""] = $i, t[E.select + ""] = ji, t[E.pictureUpload + ""] = Wi, t[E.fileUpload + ""] = Ki, t[E.richEditor + ""] = Ui, t[E.cascader + ""] = zi, t[E.link + ""] = qi, t[E.staticText + ""] = ss, t[E.htmlText + ""] = ns, t[E.card + ""] = Oi, t[E.router + ""] = Fi, t[E.descriptions + ""] = Ji, t[E.dropdown + ""] = Gi, t[E.image + ""] = Vi, t[E.eltable + ""] = Mi, t[E.carousel + ""] = et, t[E.steps + ""] = et, t[E.collapse + ""] = et, t[E.breadcrumb + ""] = et, t[E.menu + ""] = et, t;
|
|
2534
|
+
}, us = ls();
|
|
2535
|
+
function ps(t, i) {
|
|
2536
|
+
const s = us[t.type];
|
|
2537
|
+
return ` ${s ? s(t, i) : null}`;
|
|
2538
|
+
}
|
|
2539
|
+
function hs(t, i = !1) {
|
|
2540
|
+
const s = Wt(t), e = qe(s, !0);
|
|
2541
|
+
var r = X(t, {
|
|
2542
|
+
getFieldModel: (u) => {
|
|
2543
|
+
var o;
|
|
2544
|
+
return (o = e == null ? void 0 : e.find((l) => l.key === u)) == null ? void 0 : o.path;
|
|
2545
|
+
}
|
|
2546
|
+
});
|
|
2547
|
+
return r;
|
|
2548
|
+
}
|
|
2549
|
+
const fs = function(t) {
|
|
2550
|
+
return `
|
|
2551
|
+
${B.getValue(t == null ? void 0 : t.cssCode) || ""}
|
|
2552
|
+
`;
|
|
2553
|
+
}, cs = function(t, i = !1) {
|
|
2554
|
+
return "";
|
|
2555
|
+
}, As = (t, i, s = !1) => {
|
|
2556
|
+
var e = hs(i, s), a = s ? ii(i) : ei(i), r = fs(t), u = cs(t, s);
|
|
2557
|
+
const o = ft(q.html, e), l = ft(q.javascript, a), v = ft(q.css, r), x = ft(q.css, u);
|
|
2558
|
+
return `
|
|
2559
|
+
${F(o, "<template>", "</template>", void 0, !0)}
|
|
2560
|
+
${F(l, `<script${s ? " setup" : ""}>`, "<\/script>", void 0, !0)}
|
|
2561
|
+
|
|
2562
|
+
${F(v, "<style>", "</style>", void 0, !0)}
|
|
2563
|
+
${F(x, "<style scoped>", "</style>", void 0, !0)}
|
|
2564
|
+
`;
|
|
2565
|
+
};
|
|
2566
|
+
export {
|
|
2567
|
+
As as genSFC
|
|
2568
|
+
};
|