dorian 2.6.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.node-version +1 -1
- data/.npm-version +1 -1
- data/.rubocop.yml +25 -21
- data/.ruby-version +1 -1
- data/.tool-versions +2 -3
- data/Gemfile +0 -4
- data/Gemfile.lock +63 -116
- data/VERSION +1 -1
- data/dorian.gemspec +19 -19
- data/lib/dorian/bin.rb +82 -75
- data/package-lock.json +8 -8
- data/package.json +5 -5
- data/vendor/prettier/LICENSE +0 -4372
- data/vendor/prettier/README.md +14 -19
- data/vendor/prettier/THIRD-PARTY-NOTICES.md +6059 -0
- data/vendor/prettier/bin/prettier.cjs +27 -18
- data/vendor/prettier/doc.d.ts +11 -0
- data/vendor/prettier/doc.js +742 -776
- data/vendor/prettier/doc.mjs +743 -766
- data/vendor/prettier/index.cjs +266 -371
- data/vendor/prettier/index.d.ts +43 -16
- data/vendor/prettier/index.mjs +9615 -16721
- data/vendor/prettier/internal/experimental-cli-worker.mjs +2841 -0
- data/vendor/prettier/internal/experimental-cli.mjs +12790 -0
- data/vendor/prettier/internal/legacy-cli.mjs +6229 -0
- data/vendor/prettier/package.json +113 -108
- data/vendor/prettier/plugins/acorn.js +16 -6618
- data/vendor/prettier/plugins/acorn.mjs +16 -6456
- data/vendor/prettier/plugins/angular.js +4 -2435
- data/vendor/prettier/plugins/angular.mjs +4 -2375
- data/vendor/prettier/plugins/babel.d.ts +7 -7
- data/vendor/prettier/plugins/babel.js +15 -14271
- data/vendor/prettier/plugins/babel.mjs +15 -13986
- data/vendor/prettier/plugins/estree.d.ts +6 -1
- data/vendor/prettier/plugins/estree.js +43 -9486
- data/vendor/prettier/plugins/estree.mjs +43 -9278
- data/vendor/prettier/plugins/flow.js +19 -51476
- data/vendor/prettier/plugins/flow.mjs +19 -51218
- data/vendor/prettier/plugins/glimmer.d.ts +5 -1
- data/vendor/prettier/plugins/glimmer.js +30 -8527
- data/vendor/prettier/plugins/glimmer.mjs +30 -8414
- data/vendor/prettier/plugins/graphql.d.ts +5 -1
- data/vendor/prettier/plugins/graphql.js +15 -2408
- data/vendor/prettier/plugins/graphql.mjs +15 -2334
- data/vendor/prettier/plugins/html.d.ts +6 -1
- data/vendor/prettier/plugins/html.js +25 -8182
- data/vendor/prettier/plugins/html.mjs +25 -8077
- data/vendor/prettier/plugins/markdown.d.ts +5 -1
- data/vendor/prettier/plugins/markdown.js +57 -9063
- data/vendor/prettier/plugins/markdown.mjs +57 -8972
- data/vendor/prettier/plugins/meriyah.js +5 -5953
- data/vendor/prettier/plugins/meriyah.mjs +5 -5800
- data/vendor/prettier/plugins/postcss.d.ts +5 -1
- data/vendor/prettier/plugins/postcss.js +61 -9244
- data/vendor/prettier/plugins/postcss.mjs +61 -9046
- data/vendor/prettier/plugins/typescript.js +15 -38052
- data/vendor/prettier/plugins/typescript.mjs +15 -37726
- data/vendor/prettier/plugins/yaml.d.ts +5 -1
- data/vendor/prettier/plugins/yaml.js +157 -7423
- data/vendor/prettier/plugins/yaml.mjs +157 -7327
- data/vendor/prettier/standalone.d.ts +1 -1
- data/vendor/prettier/standalone.js +29 -3984
- data/vendor/prettier/standalone.mjs +29 -3938
- metadata +145 -40
- data/vendor/prettier/internal/cli.mjs +0 -4366
data/vendor/prettier/doc.mjs
CHANGED
|
@@ -9,25 +9,96 @@ var public_exports = {};
|
|
|
9
9
|
__export(public_exports, {
|
|
10
10
|
builders: () => builders,
|
|
11
11
|
printer: () => printer,
|
|
12
|
-
utils: () => utils
|
|
12
|
+
utils: () => utils
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
//
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
15
|
+
// scripts/build/shims/shared.js
|
|
16
|
+
var OPTIONAL_OBJECT = 1;
|
|
17
|
+
var createMethodShim = (methodName, getImplementation) => (flags, object, ...arguments_) => {
|
|
18
|
+
if (flags | OPTIONAL_OBJECT && (object === void 0 || object === null)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const implementation = getImplementation.call(object) ?? object[methodName];
|
|
22
|
+
return implementation.apply(object, arguments_);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// scripts/build/shims/method-at.js
|
|
26
|
+
function stringOrArrayAt(index) {
|
|
27
|
+
return this[index < 0 ? this.length + index : index];
|
|
28
|
+
}
|
|
29
|
+
var at = createMethodShim("at", function() {
|
|
30
|
+
if (Array.isArray(this) || typeof this === "string") {
|
|
31
|
+
return stringOrArrayAt;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var method_at_default = at;
|
|
35
|
+
|
|
36
|
+
// src/utilities/noop.js
|
|
37
|
+
var noop = () => {
|
|
38
|
+
};
|
|
39
|
+
var noop_default = noop;
|
|
40
|
+
|
|
41
|
+
// src/document/builders/types.js
|
|
42
|
+
var DOC_TYPE_STRING = (
|
|
43
|
+
/** @type {const} */
|
|
44
|
+
"string"
|
|
45
|
+
);
|
|
46
|
+
var DOC_TYPE_ARRAY = (
|
|
47
|
+
/** @type {const} */
|
|
48
|
+
"array"
|
|
49
|
+
);
|
|
50
|
+
var DOC_TYPE_CURSOR = (
|
|
51
|
+
/** @type {const} */
|
|
52
|
+
"cursor"
|
|
53
|
+
);
|
|
54
|
+
var DOC_TYPE_INDENT = (
|
|
55
|
+
/** @type {const} */
|
|
56
|
+
"indent"
|
|
57
|
+
);
|
|
58
|
+
var DOC_TYPE_ALIGN = (
|
|
59
|
+
/** @type {const} */
|
|
60
|
+
"align"
|
|
61
|
+
);
|
|
62
|
+
var DOC_TYPE_TRIM = (
|
|
63
|
+
/** @type {const} */
|
|
64
|
+
"trim"
|
|
65
|
+
);
|
|
66
|
+
var DOC_TYPE_GROUP = (
|
|
67
|
+
/** @type {const} */
|
|
68
|
+
"group"
|
|
69
|
+
);
|
|
70
|
+
var DOC_TYPE_FILL = (
|
|
71
|
+
/** @type {const} */
|
|
72
|
+
"fill"
|
|
73
|
+
);
|
|
74
|
+
var DOC_TYPE_IF_BREAK = (
|
|
75
|
+
/** @type {const} */
|
|
76
|
+
"if-break"
|
|
77
|
+
);
|
|
78
|
+
var DOC_TYPE_INDENT_IF_BREAK = (
|
|
79
|
+
/** @type {const} */
|
|
80
|
+
"indent-if-break"
|
|
81
|
+
);
|
|
82
|
+
var DOC_TYPE_LINE_SUFFIX = (
|
|
83
|
+
/** @type {const} */
|
|
84
|
+
"line-suffix"
|
|
85
|
+
);
|
|
86
|
+
var DOC_TYPE_LINE_SUFFIX_BOUNDARY = (
|
|
87
|
+
/** @type {const} */
|
|
88
|
+
"line-suffix-boundary"
|
|
89
|
+
);
|
|
90
|
+
var DOC_TYPE_LINE = (
|
|
91
|
+
/** @type {const} */
|
|
92
|
+
"line"
|
|
93
|
+
);
|
|
94
|
+
var DOC_TYPE_LABEL = (
|
|
95
|
+
/** @type {const} */
|
|
96
|
+
"label"
|
|
97
|
+
);
|
|
98
|
+
var DOC_TYPE_BREAK_PARENT = (
|
|
99
|
+
/** @type {const} */
|
|
100
|
+
"break-parent"
|
|
101
|
+
);
|
|
31
102
|
var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
|
|
32
103
|
DOC_TYPE_CURSOR,
|
|
33
104
|
DOC_TYPE_INDENT,
|
|
@@ -41,10 +112,19 @@ var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
|
|
|
41
112
|
DOC_TYPE_LINE_SUFFIX_BOUNDARY,
|
|
42
113
|
DOC_TYPE_LINE,
|
|
43
114
|
DOC_TYPE_LABEL,
|
|
44
|
-
DOC_TYPE_BREAK_PARENT
|
|
115
|
+
DOC_TYPE_BREAK_PARENT
|
|
45
116
|
]);
|
|
46
117
|
|
|
47
|
-
//
|
|
118
|
+
// node_modules/trim-newlines/index.js
|
|
119
|
+
function trimNewlinesEnd(string) {
|
|
120
|
+
let end = string.length;
|
|
121
|
+
while (end > 0 && (string[end - 1] === "\r" || string[end - 1] === "\n")) {
|
|
122
|
+
end--;
|
|
123
|
+
}
|
|
124
|
+
return end < string.length ? string.slice(0, end) : string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/document/utilities/get-doc-type.js
|
|
48
128
|
function getDocType(doc) {
|
|
49
129
|
if (typeof doc === "string") {
|
|
50
130
|
return DOC_TYPE_STRING;
|
|
@@ -62,9 +142,8 @@ function getDocType(doc) {
|
|
|
62
142
|
}
|
|
63
143
|
var get_doc_type_default = getDocType;
|
|
64
144
|
|
|
65
|
-
// src/document/invalid-doc-error.js
|
|
66
|
-
var disjunctionListFormat = (list) =>
|
|
67
|
-
new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
|
|
145
|
+
// src/document/utilities/invalid-doc-error.js
|
|
146
|
+
var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
|
|
68
147
|
function getDocErrorMessage(doc) {
|
|
69
148
|
const type = doc === null ? "null" : typeof doc;
|
|
70
149
|
if (type !== "string" && type !== "object") {
|
|
@@ -79,7 +158,7 @@ Expected it to be 'string' or 'object'.`;
|
|
|
79
158
|
return `Unexpected doc '${objectType}'.`;
|
|
80
159
|
}
|
|
81
160
|
const EXPECTED_TYPE_VALUES = disjunctionListFormat(
|
|
82
|
-
[...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
|
|
161
|
+
[...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
|
|
83
162
|
);
|
|
84
163
|
return `Unexpected doc.type '${doc.type}'.
|
|
85
164
|
Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
@@ -93,7 +172,7 @@ var InvalidDocError = class extends Error {
|
|
|
93
172
|
};
|
|
94
173
|
var invalid_doc_error_default = InvalidDocError;
|
|
95
174
|
|
|
96
|
-
// src/document/
|
|
175
|
+
// src/document/utilities/traverse-doc.js
|
|
97
176
|
var traverseDocOnExitStackMarker = {};
|
|
98
177
|
function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
|
|
99
178
|
const docsStack = [doc];
|
|
@@ -110,7 +189,7 @@ function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
|
|
|
110
189
|
if (!docType) {
|
|
111
190
|
throw new invalid_doc_error_default(doc2);
|
|
112
191
|
}
|
|
113
|
-
if (
|
|
192
|
+
if (onEnter?.(doc2) === false) {
|
|
114
193
|
continue;
|
|
115
194
|
}
|
|
116
195
|
switch (docType) {
|
|
@@ -155,361 +234,7 @@ function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
|
|
|
155
234
|
}
|
|
156
235
|
var traverse_doc_default = traverseDoc;
|
|
157
236
|
|
|
158
|
-
// src/document/
|
|
159
|
-
var noop = () => {};
|
|
160
|
-
var assertDoc = true
|
|
161
|
-
? noop
|
|
162
|
-
: function (doc) {
|
|
163
|
-
traverse_doc_default(doc, (doc2) => {
|
|
164
|
-
if (checked.has(doc2)) {
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
if (typeof doc2 !== "string") {
|
|
168
|
-
checked.add(doc2);
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
var assertDocArray = true
|
|
173
|
-
? noop
|
|
174
|
-
: function (docs, optional = false) {
|
|
175
|
-
if (optional && !docs) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (!Array.isArray(docs)) {
|
|
179
|
-
throw new TypeError("Unexpected doc array.");
|
|
180
|
-
}
|
|
181
|
-
for (const doc of docs) {
|
|
182
|
-
assertDoc(doc);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
// src/document/builders.js
|
|
187
|
-
function indent(contents) {
|
|
188
|
-
assertDoc(contents);
|
|
189
|
-
return { type: DOC_TYPE_INDENT, contents };
|
|
190
|
-
}
|
|
191
|
-
function align(widthOrString, contents) {
|
|
192
|
-
assertDoc(contents);
|
|
193
|
-
return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
|
|
194
|
-
}
|
|
195
|
-
function group(contents, opts = {}) {
|
|
196
|
-
assertDoc(contents);
|
|
197
|
-
assertDocArray(
|
|
198
|
-
opts.expandedStates,
|
|
199
|
-
/* optional */
|
|
200
|
-
true,
|
|
201
|
-
);
|
|
202
|
-
return {
|
|
203
|
-
type: DOC_TYPE_GROUP,
|
|
204
|
-
id: opts.id,
|
|
205
|
-
contents,
|
|
206
|
-
break: Boolean(opts.shouldBreak),
|
|
207
|
-
expandedStates: opts.expandedStates,
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
function dedentToRoot(contents) {
|
|
211
|
-
return align(Number.NEGATIVE_INFINITY, contents);
|
|
212
|
-
}
|
|
213
|
-
function markAsRoot(contents) {
|
|
214
|
-
return align({ type: "root" }, contents);
|
|
215
|
-
}
|
|
216
|
-
function dedent(contents) {
|
|
217
|
-
return align(-1, contents);
|
|
218
|
-
}
|
|
219
|
-
function conditionalGroup(states, opts) {
|
|
220
|
-
return group(states[0], { ...opts, expandedStates: states });
|
|
221
|
-
}
|
|
222
|
-
function fill(parts) {
|
|
223
|
-
assertDocArray(parts);
|
|
224
|
-
return { type: DOC_TYPE_FILL, parts };
|
|
225
|
-
}
|
|
226
|
-
function ifBreak(breakContents, flatContents = "", opts = {}) {
|
|
227
|
-
assertDoc(breakContents);
|
|
228
|
-
if (flatContents !== "") {
|
|
229
|
-
assertDoc(flatContents);
|
|
230
|
-
}
|
|
231
|
-
return {
|
|
232
|
-
type: DOC_TYPE_IF_BREAK,
|
|
233
|
-
breakContents,
|
|
234
|
-
flatContents,
|
|
235
|
-
groupId: opts.groupId,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
function indentIfBreak(contents, opts) {
|
|
239
|
-
assertDoc(contents);
|
|
240
|
-
return {
|
|
241
|
-
type: DOC_TYPE_INDENT_IF_BREAK,
|
|
242
|
-
contents,
|
|
243
|
-
groupId: opts.groupId,
|
|
244
|
-
negate: opts.negate,
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function lineSuffix(contents) {
|
|
248
|
-
assertDoc(contents);
|
|
249
|
-
return { type: DOC_TYPE_LINE_SUFFIX, contents };
|
|
250
|
-
}
|
|
251
|
-
var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
|
|
252
|
-
var breakParent = { type: DOC_TYPE_BREAK_PARENT };
|
|
253
|
-
var trim = { type: DOC_TYPE_TRIM };
|
|
254
|
-
var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
|
|
255
|
-
var literallineWithoutBreakParent = {
|
|
256
|
-
type: DOC_TYPE_LINE,
|
|
257
|
-
hard: true,
|
|
258
|
-
literal: true,
|
|
259
|
-
};
|
|
260
|
-
var line = { type: DOC_TYPE_LINE };
|
|
261
|
-
var softline = { type: DOC_TYPE_LINE, soft: true };
|
|
262
|
-
var hardline = [hardlineWithoutBreakParent, breakParent];
|
|
263
|
-
var literalline = [literallineWithoutBreakParent, breakParent];
|
|
264
|
-
var cursor = { type: DOC_TYPE_CURSOR };
|
|
265
|
-
function join(separator, docs) {
|
|
266
|
-
assertDoc(separator);
|
|
267
|
-
assertDocArray(docs);
|
|
268
|
-
const parts = [];
|
|
269
|
-
for (let i = 0; i < docs.length; i++) {
|
|
270
|
-
if (i !== 0) {
|
|
271
|
-
parts.push(separator);
|
|
272
|
-
}
|
|
273
|
-
parts.push(docs[i]);
|
|
274
|
-
}
|
|
275
|
-
return parts;
|
|
276
|
-
}
|
|
277
|
-
function addAlignmentToDoc(doc, size, tabWidth) {
|
|
278
|
-
assertDoc(doc);
|
|
279
|
-
let aligned = doc;
|
|
280
|
-
if (size > 0) {
|
|
281
|
-
for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
|
|
282
|
-
aligned = indent(aligned);
|
|
283
|
-
}
|
|
284
|
-
aligned = align(size % tabWidth, aligned);
|
|
285
|
-
aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
|
286
|
-
}
|
|
287
|
-
return aligned;
|
|
288
|
-
}
|
|
289
|
-
function label(label2, contents) {
|
|
290
|
-
assertDoc(contents);
|
|
291
|
-
return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// scripts/build/shims/at.js
|
|
295
|
-
var at = (isOptionalObject, object, index) => {
|
|
296
|
-
if (isOptionalObject && (object === void 0 || object === null)) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
if (Array.isArray(object) || typeof object === "string") {
|
|
300
|
-
return object[index < 0 ? object.length + index : index];
|
|
301
|
-
}
|
|
302
|
-
return object.at(index);
|
|
303
|
-
};
|
|
304
|
-
var at_default = at;
|
|
305
|
-
|
|
306
|
-
// scripts/build/shims/string-replace-all.js
|
|
307
|
-
var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
|
|
308
|
-
if (isOptionalObject && (original === void 0 || original === null)) {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
if (original.replaceAll) {
|
|
312
|
-
return original.replaceAll(pattern, replacement);
|
|
313
|
-
}
|
|
314
|
-
if (pattern.global) {
|
|
315
|
-
return original.replace(pattern, replacement);
|
|
316
|
-
}
|
|
317
|
-
return original.split(pattern).join(replacement);
|
|
318
|
-
};
|
|
319
|
-
var string_replace_all_default = stringReplaceAll;
|
|
320
|
-
|
|
321
|
-
// src/common/end-of-line.js
|
|
322
|
-
function convertEndOfLineToChars(value) {
|
|
323
|
-
switch (value) {
|
|
324
|
-
case "cr":
|
|
325
|
-
return "\r";
|
|
326
|
-
case "crlf":
|
|
327
|
-
return "\r\n";
|
|
328
|
-
default:
|
|
329
|
-
return "\n";
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// node_modules/emoji-regex/index.mjs
|
|
334
|
-
var emoji_regex_default = () => {
|
|
335
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
// node_modules/get-east-asian-width/lookup.js
|
|
339
|
-
function isFullWidth(x) {
|
|
340
|
-
return (
|
|
341
|
-
x === 12288 || (x >= 65281 && x <= 65376) || (x >= 65504 && x <= 65510)
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
|
-
function isWide(x) {
|
|
345
|
-
return (
|
|
346
|
-
(x >= 4352 && x <= 4447) ||
|
|
347
|
-
x === 8986 ||
|
|
348
|
-
x === 8987 ||
|
|
349
|
-
x === 9001 ||
|
|
350
|
-
x === 9002 ||
|
|
351
|
-
(x >= 9193 && x <= 9196) ||
|
|
352
|
-
x === 9200 ||
|
|
353
|
-
x === 9203 ||
|
|
354
|
-
x === 9725 ||
|
|
355
|
-
x === 9726 ||
|
|
356
|
-
x === 9748 ||
|
|
357
|
-
x === 9749 ||
|
|
358
|
-
(x >= 9800 && x <= 9811) ||
|
|
359
|
-
x === 9855 ||
|
|
360
|
-
x === 9875 ||
|
|
361
|
-
x === 9889 ||
|
|
362
|
-
x === 9898 ||
|
|
363
|
-
x === 9899 ||
|
|
364
|
-
x === 9917 ||
|
|
365
|
-
x === 9918 ||
|
|
366
|
-
x === 9924 ||
|
|
367
|
-
x === 9925 ||
|
|
368
|
-
x === 9934 ||
|
|
369
|
-
x === 9940 ||
|
|
370
|
-
x === 9962 ||
|
|
371
|
-
x === 9970 ||
|
|
372
|
-
x === 9971 ||
|
|
373
|
-
x === 9973 ||
|
|
374
|
-
x === 9978 ||
|
|
375
|
-
x === 9981 ||
|
|
376
|
-
x === 9989 ||
|
|
377
|
-
x === 9994 ||
|
|
378
|
-
x === 9995 ||
|
|
379
|
-
x === 10024 ||
|
|
380
|
-
x === 10060 ||
|
|
381
|
-
x === 10062 ||
|
|
382
|
-
(x >= 10067 && x <= 10069) ||
|
|
383
|
-
x === 10071 ||
|
|
384
|
-
(x >= 10133 && x <= 10135) ||
|
|
385
|
-
x === 10160 ||
|
|
386
|
-
x === 10175 ||
|
|
387
|
-
x === 11035 ||
|
|
388
|
-
x === 11036 ||
|
|
389
|
-
x === 11088 ||
|
|
390
|
-
x === 11093 ||
|
|
391
|
-
(x >= 11904 && x <= 11929) ||
|
|
392
|
-
(x >= 11931 && x <= 12019) ||
|
|
393
|
-
(x >= 12032 && x <= 12245) ||
|
|
394
|
-
(x >= 12272 && x <= 12287) ||
|
|
395
|
-
(x >= 12289 && x <= 12350) ||
|
|
396
|
-
(x >= 12353 && x <= 12438) ||
|
|
397
|
-
(x >= 12441 && x <= 12543) ||
|
|
398
|
-
(x >= 12549 && x <= 12591) ||
|
|
399
|
-
(x >= 12593 && x <= 12686) ||
|
|
400
|
-
(x >= 12688 && x <= 12771) ||
|
|
401
|
-
(x >= 12783 && x <= 12830) ||
|
|
402
|
-
(x >= 12832 && x <= 12871) ||
|
|
403
|
-
(x >= 12880 && x <= 19903) ||
|
|
404
|
-
(x >= 19968 && x <= 42124) ||
|
|
405
|
-
(x >= 42128 && x <= 42182) ||
|
|
406
|
-
(x >= 43360 && x <= 43388) ||
|
|
407
|
-
(x >= 44032 && x <= 55203) ||
|
|
408
|
-
(x >= 63744 && x <= 64255) ||
|
|
409
|
-
(x >= 65040 && x <= 65049) ||
|
|
410
|
-
(x >= 65072 && x <= 65106) ||
|
|
411
|
-
(x >= 65108 && x <= 65126) ||
|
|
412
|
-
(x >= 65128 && x <= 65131) ||
|
|
413
|
-
(x >= 94176 && x <= 94180) ||
|
|
414
|
-
x === 94192 ||
|
|
415
|
-
x === 94193 ||
|
|
416
|
-
(x >= 94208 && x <= 100343) ||
|
|
417
|
-
(x >= 100352 && x <= 101589) ||
|
|
418
|
-
(x >= 101632 && x <= 101640) ||
|
|
419
|
-
(x >= 110576 && x <= 110579) ||
|
|
420
|
-
(x >= 110581 && x <= 110587) ||
|
|
421
|
-
x === 110589 ||
|
|
422
|
-
x === 110590 ||
|
|
423
|
-
(x >= 110592 && x <= 110882) ||
|
|
424
|
-
x === 110898 ||
|
|
425
|
-
(x >= 110928 && x <= 110930) ||
|
|
426
|
-
x === 110933 ||
|
|
427
|
-
(x >= 110948 && x <= 110951) ||
|
|
428
|
-
(x >= 110960 && x <= 111355) ||
|
|
429
|
-
x === 126980 ||
|
|
430
|
-
x === 127183 ||
|
|
431
|
-
x === 127374 ||
|
|
432
|
-
(x >= 127377 && x <= 127386) ||
|
|
433
|
-
(x >= 127488 && x <= 127490) ||
|
|
434
|
-
(x >= 127504 && x <= 127547) ||
|
|
435
|
-
(x >= 127552 && x <= 127560) ||
|
|
436
|
-
x === 127568 ||
|
|
437
|
-
x === 127569 ||
|
|
438
|
-
(x >= 127584 && x <= 127589) ||
|
|
439
|
-
(x >= 127744 && x <= 127776) ||
|
|
440
|
-
(x >= 127789 && x <= 127797) ||
|
|
441
|
-
(x >= 127799 && x <= 127868) ||
|
|
442
|
-
(x >= 127870 && x <= 127891) ||
|
|
443
|
-
(x >= 127904 && x <= 127946) ||
|
|
444
|
-
(x >= 127951 && x <= 127955) ||
|
|
445
|
-
(x >= 127968 && x <= 127984) ||
|
|
446
|
-
x === 127988 ||
|
|
447
|
-
(x >= 127992 && x <= 128062) ||
|
|
448
|
-
x === 128064 ||
|
|
449
|
-
(x >= 128066 && x <= 128252) ||
|
|
450
|
-
(x >= 128255 && x <= 128317) ||
|
|
451
|
-
(x >= 128331 && x <= 128334) ||
|
|
452
|
-
(x >= 128336 && x <= 128359) ||
|
|
453
|
-
x === 128378 ||
|
|
454
|
-
x === 128405 ||
|
|
455
|
-
x === 128406 ||
|
|
456
|
-
x === 128420 ||
|
|
457
|
-
(x >= 128507 && x <= 128591) ||
|
|
458
|
-
(x >= 128640 && x <= 128709) ||
|
|
459
|
-
x === 128716 ||
|
|
460
|
-
(x >= 128720 && x <= 128722) ||
|
|
461
|
-
(x >= 128725 && x <= 128727) ||
|
|
462
|
-
(x >= 128732 && x <= 128735) ||
|
|
463
|
-
x === 128747 ||
|
|
464
|
-
x === 128748 ||
|
|
465
|
-
(x >= 128756 && x <= 128764) ||
|
|
466
|
-
(x >= 128992 && x <= 129003) ||
|
|
467
|
-
x === 129008 ||
|
|
468
|
-
(x >= 129292 && x <= 129338) ||
|
|
469
|
-
(x >= 129340 && x <= 129349) ||
|
|
470
|
-
(x >= 129351 && x <= 129535) ||
|
|
471
|
-
(x >= 129648 && x <= 129660) ||
|
|
472
|
-
(x >= 129664 && x <= 129672) ||
|
|
473
|
-
(x >= 129680 && x <= 129725) ||
|
|
474
|
-
(x >= 129727 && x <= 129733) ||
|
|
475
|
-
(x >= 129742 && x <= 129755) ||
|
|
476
|
-
(x >= 129760 && x <= 129768) ||
|
|
477
|
-
(x >= 129776 && x <= 129784) ||
|
|
478
|
-
(x >= 131072 && x <= 196605) ||
|
|
479
|
-
(x >= 196608 && x <= 262141)
|
|
480
|
-
);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
// node_modules/get-east-asian-width/index.js
|
|
484
|
-
var _isNarrowWidth = (codePoint) =>
|
|
485
|
-
!(isFullWidth(codePoint) || isWide(codePoint));
|
|
486
|
-
|
|
487
|
-
// src/utils/get-string-width.js
|
|
488
|
-
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
489
|
-
function getStringWidth(text) {
|
|
490
|
-
if (!text) {
|
|
491
|
-
return 0;
|
|
492
|
-
}
|
|
493
|
-
if (!notAsciiRegex.test(text)) {
|
|
494
|
-
return text.length;
|
|
495
|
-
}
|
|
496
|
-
text = text.replace(emoji_regex_default(), " ");
|
|
497
|
-
let width = 0;
|
|
498
|
-
for (const character of text) {
|
|
499
|
-
const codePoint = character.codePointAt(0);
|
|
500
|
-
if (codePoint <= 31 || (codePoint >= 127 && codePoint <= 159)) {
|
|
501
|
-
continue;
|
|
502
|
-
}
|
|
503
|
-
if (codePoint >= 768 && codePoint <= 879) {
|
|
504
|
-
continue;
|
|
505
|
-
}
|
|
506
|
-
width += _isNarrowWidth(codePoint) ? 1 : 2;
|
|
507
|
-
}
|
|
508
|
-
return width;
|
|
509
|
-
}
|
|
510
|
-
var get_string_width_default = getStringWidth;
|
|
511
|
-
|
|
512
|
-
// src/document/utils.js
|
|
237
|
+
// src/document/utilities/index.js
|
|
513
238
|
function mapDoc(doc, cb) {
|
|
514
239
|
if (typeof doc === "string") {
|
|
515
240
|
return cb(doc);
|
|
@@ -531,16 +256,19 @@ function mapDoc(doc, cb) {
|
|
|
531
256
|
case DOC_TYPE_FILL:
|
|
532
257
|
return cb({
|
|
533
258
|
...doc2,
|
|
534
|
-
parts: doc2.parts.map(rec)
|
|
259
|
+
parts: doc2.parts.map(rec)
|
|
535
260
|
});
|
|
536
261
|
case DOC_TYPE_IF_BREAK:
|
|
537
262
|
return cb({
|
|
538
263
|
...doc2,
|
|
539
264
|
breakContents: rec(doc2.breakContents),
|
|
540
|
-
flatContents: rec(doc2.flatContents)
|
|
265
|
+
flatContents: rec(doc2.flatContents)
|
|
541
266
|
});
|
|
542
267
|
case DOC_TYPE_GROUP: {
|
|
543
|
-
let {
|
|
268
|
+
let {
|
|
269
|
+
expandedStates,
|
|
270
|
+
contents
|
|
271
|
+
} = doc2;
|
|
544
272
|
if (expandedStates) {
|
|
545
273
|
expandedStates = expandedStates.map(rec);
|
|
546
274
|
contents = expandedStates[0];
|
|
@@ -550,7 +278,7 @@ function mapDoc(doc, cb) {
|
|
|
550
278
|
return cb({
|
|
551
279
|
...doc2,
|
|
552
280
|
contents,
|
|
553
|
-
expandedStates
|
|
281
|
+
expandedStates
|
|
554
282
|
});
|
|
555
283
|
}
|
|
556
284
|
case DOC_TYPE_ALIGN:
|
|
@@ -560,7 +288,7 @@ function mapDoc(doc, cb) {
|
|
|
560
288
|
case DOC_TYPE_LINE_SUFFIX:
|
|
561
289
|
return cb({
|
|
562
290
|
...doc2,
|
|
563
|
-
contents: rec(doc2.contents)
|
|
291
|
+
contents: rec(doc2.contents)
|
|
564
292
|
});
|
|
565
293
|
case DOC_TYPE_STRING:
|
|
566
294
|
case DOC_TYPE_CURSOR:
|
|
@@ -606,11 +334,11 @@ function willBreak(doc) {
|
|
|
606
334
|
}
|
|
607
335
|
function breakParentGroup(groupStack) {
|
|
608
336
|
if (groupStack.length > 0) {
|
|
609
|
-
const parentGroup =
|
|
610
|
-
/*
|
|
611
|
-
|
|
337
|
+
const parentGroup = method_at_default(
|
|
338
|
+
/* OPTIONAL_OBJECT: false */
|
|
339
|
+
0,
|
|
612
340
|
groupStack,
|
|
613
|
-
-1
|
|
341
|
+
-1
|
|
614
342
|
);
|
|
615
343
|
if (!parentGroup.expandedStates && !parentGroup.break) {
|
|
616
344
|
parentGroup.break = "propagated";
|
|
@@ -646,7 +374,7 @@ function propagateBreaks(doc) {
|
|
|
646
374
|
propagateBreaksOnEnterFn,
|
|
647
375
|
propagateBreaksOnExitFn,
|
|
648
376
|
/* shouldTraverseConditionalGroups */
|
|
649
|
-
true
|
|
377
|
+
true
|
|
650
378
|
);
|
|
651
379
|
}
|
|
652
380
|
function removeLinesFn(doc) {
|
|
@@ -663,32 +391,26 @@ function removeLines(doc) {
|
|
|
663
391
|
}
|
|
664
392
|
function stripTrailingHardlineFromParts(parts) {
|
|
665
393
|
parts = [...parts];
|
|
666
|
-
while (
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
parts,
|
|
678
|
-
-1,
|
|
679
|
-
).type === DOC_TYPE_BREAK_PARENT
|
|
680
|
-
) {
|
|
394
|
+
while (parts.length >= 2 && method_at_default(
|
|
395
|
+
/* OPTIONAL_OBJECT: false */
|
|
396
|
+
0,
|
|
397
|
+
parts,
|
|
398
|
+
-2
|
|
399
|
+
).type === DOC_TYPE_LINE && method_at_default(
|
|
400
|
+
/* OPTIONAL_OBJECT: false */
|
|
401
|
+
0,
|
|
402
|
+
parts,
|
|
403
|
+
-1
|
|
404
|
+
).type === DOC_TYPE_BREAK_PARENT) {
|
|
681
405
|
parts.length -= 2;
|
|
682
406
|
}
|
|
683
407
|
if (parts.length > 0) {
|
|
684
|
-
const lastPart = stripTrailingHardlineFromDoc(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
),
|
|
691
|
-
);
|
|
408
|
+
const lastPart = stripTrailingHardlineFromDoc(method_at_default(
|
|
409
|
+
/* OPTIONAL_OBJECT: false */
|
|
410
|
+
0,
|
|
411
|
+
parts,
|
|
412
|
+
-1
|
|
413
|
+
));
|
|
692
414
|
parts[parts.length - 1] = lastPart;
|
|
693
415
|
}
|
|
694
416
|
return parts;
|
|
@@ -703,24 +425,24 @@ function stripTrailingHardlineFromDoc(doc) {
|
|
|
703
425
|
const contents = stripTrailingHardlineFromDoc(doc.contents);
|
|
704
426
|
return {
|
|
705
427
|
...doc,
|
|
706
|
-
contents
|
|
428
|
+
contents
|
|
707
429
|
};
|
|
708
430
|
}
|
|
709
431
|
case DOC_TYPE_IF_BREAK:
|
|
710
432
|
return {
|
|
711
433
|
...doc,
|
|
712
434
|
breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
|
|
713
|
-
flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
|
|
435
|
+
flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
|
|
714
436
|
};
|
|
715
437
|
case DOC_TYPE_FILL:
|
|
716
438
|
return {
|
|
717
439
|
...doc,
|
|
718
|
-
parts: stripTrailingHardlineFromParts(doc.parts)
|
|
440
|
+
parts: stripTrailingHardlineFromParts(doc.parts)
|
|
719
441
|
};
|
|
720
442
|
case DOC_TYPE_ARRAY:
|
|
721
443
|
return stripTrailingHardlineFromParts(doc);
|
|
722
444
|
case DOC_TYPE_STRING:
|
|
723
|
-
return doc
|
|
445
|
+
return trimNewlinesEnd(doc);
|
|
724
446
|
case DOC_TYPE_ALIGN:
|
|
725
447
|
case DOC_TYPE_CURSOR:
|
|
726
448
|
case DOC_TYPE_TRIM:
|
|
@@ -747,12 +469,7 @@ function cleanDocFn(doc) {
|
|
|
747
469
|
if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
|
|
748
470
|
return "";
|
|
749
471
|
}
|
|
750
|
-
if (
|
|
751
|
-
doc.contents.type === DOC_TYPE_GROUP &&
|
|
752
|
-
doc.contents.id === doc.id &&
|
|
753
|
-
doc.contents.break === doc.break &&
|
|
754
|
-
doc.contents.expandedStates === doc.expandedStates
|
|
755
|
-
) {
|
|
472
|
+
if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
|
|
756
473
|
return doc.contents;
|
|
757
474
|
}
|
|
758
475
|
break;
|
|
@@ -776,15 +493,12 @@ function cleanDocFn(doc) {
|
|
|
776
493
|
continue;
|
|
777
494
|
}
|
|
778
495
|
const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
|
|
779
|
-
if (
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
-1,
|
|
786
|
-
) === "string"
|
|
787
|
-
) {
|
|
496
|
+
if (typeof currentPart === "string" && typeof method_at_default(
|
|
497
|
+
/* OPTIONAL_OBJECT: false */
|
|
498
|
+
0,
|
|
499
|
+
parts,
|
|
500
|
+
-1
|
|
501
|
+
) === "string") {
|
|
788
502
|
parts[parts.length - 1] += currentPart;
|
|
789
503
|
} else {
|
|
790
504
|
parts.push(currentPart);
|
|
@@ -816,11 +530,7 @@ function cleanDoc(doc) {
|
|
|
816
530
|
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
|
|
817
531
|
}
|
|
818
532
|
function replaceEndOfLine(doc, replacement = literalline) {
|
|
819
|
-
return mapDoc(doc, (currentDoc) =>
|
|
820
|
-
typeof currentDoc === "string"
|
|
821
|
-
? join(replacement, currentDoc.split("\n"))
|
|
822
|
-
: currentDoc,
|
|
823
|
-
);
|
|
533
|
+
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc);
|
|
824
534
|
}
|
|
825
535
|
function canBreakFn(doc) {
|
|
826
536
|
if (doc.type === DOC_TYPE_LINE) {
|
|
@@ -831,71 +541,297 @@ function canBreak(doc) {
|
|
|
831
541
|
return findInDoc(doc, canBreakFn, false);
|
|
832
542
|
}
|
|
833
543
|
|
|
834
|
-
// src/document/
|
|
835
|
-
var
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
544
|
+
// src/document/utilities/assert-doc.js
|
|
545
|
+
var assertDoc = true ? noop_default : (
|
|
546
|
+
/**
|
|
547
|
+
@param {Doc} doc
|
|
548
|
+
*/
|
|
549
|
+
function(doc) {
|
|
550
|
+
traverse_doc_default(doc, (doc2) => {
|
|
551
|
+
if (typeof doc2 === "string" || checked.has(doc2)) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
checked.add(doc2);
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
);
|
|
558
|
+
var assertDocArray = true ? noop_default : (
|
|
559
|
+
/**
|
|
560
|
+
@param {readonly Doc[]} docs
|
|
561
|
+
@param {boolean} [optional = false]
|
|
562
|
+
*/
|
|
563
|
+
function(docs, optional = false) {
|
|
564
|
+
if (optional && !docs) {
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
if (!Array.isArray(docs)) {
|
|
568
|
+
throw new TypeError("Unexpected doc array.");
|
|
569
|
+
}
|
|
570
|
+
for (const doc of docs) {
|
|
571
|
+
assertDoc(doc);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
);
|
|
575
|
+
var assertDocFillParts = true ? noop_default : (
|
|
576
|
+
/**
|
|
577
|
+
@param {readonly Doc[]} parts
|
|
578
|
+
*/
|
|
579
|
+
function(parts) {
|
|
580
|
+
assertDocArray(parts);
|
|
581
|
+
if (parts.length > 1 && isEmptyDoc(method_at_default(
|
|
582
|
+
/* OPTIONAL_OBJECT: false */
|
|
583
|
+
0,
|
|
584
|
+
parts,
|
|
585
|
+
-1
|
|
586
|
+
))) {
|
|
587
|
+
parts = parts.slice(0, -1);
|
|
588
|
+
}
|
|
589
|
+
for (const [i, doc] of parts.entries()) {
|
|
590
|
+
if (i % 2 === 1 && !isValidSeparator(doc)) {
|
|
591
|
+
const type = get_doc_type_default(doc);
|
|
592
|
+
throw new Error(`Unexpected non-line-break doc at ${i}. Doc type is ${type}.`);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
);
|
|
597
|
+
var assertAlignType = true ? noop_default : function(alignType) {
|
|
598
|
+
if (!(typeof alignType === "number" || typeof alignType === "string" || alignType?.type === "root")) {
|
|
599
|
+
throw new TypeError(`Invalid alignType '${alignType}'.`);
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
// src/document/builders/indent.js
|
|
604
|
+
function indent(contents) {
|
|
605
|
+
assertDoc(contents);
|
|
606
|
+
return { type: DOC_TYPE_INDENT, contents };
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// src/document/builders/align.js
|
|
610
|
+
function align(alignType, contents) {
|
|
611
|
+
assertAlignType(alignType);
|
|
612
|
+
assertDoc(contents);
|
|
613
|
+
return { type: DOC_TYPE_ALIGN, contents, n: alignType };
|
|
614
|
+
}
|
|
615
|
+
function dedentToRoot(contents) {
|
|
616
|
+
return align(Number.NEGATIVE_INFINITY, contents);
|
|
617
|
+
}
|
|
618
|
+
function markAsRoot(contents) {
|
|
619
|
+
return align({ type: "root" }, contents);
|
|
620
|
+
}
|
|
621
|
+
function dedent(contents) {
|
|
622
|
+
return align(-1, contents);
|
|
623
|
+
}
|
|
624
|
+
function addAlignmentToDoc(doc, size, tabWidth) {
|
|
625
|
+
assertDoc(doc);
|
|
626
|
+
let aligned = doc;
|
|
627
|
+
if (size > 0) {
|
|
628
|
+
for (let level = 0; level < Math.floor(size / tabWidth); ++level) {
|
|
629
|
+
aligned = indent(aligned);
|
|
630
|
+
}
|
|
631
|
+
aligned = align(size % tabWidth, aligned);
|
|
632
|
+
aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
|
633
|
+
}
|
|
634
|
+
return aligned;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// src/document/builders/break-parent.js
|
|
638
|
+
var breakParent = { type: DOC_TYPE_BREAK_PARENT };
|
|
639
|
+
|
|
640
|
+
// src/document/builders/cursor.js
|
|
641
|
+
var cursor = { type: DOC_TYPE_CURSOR };
|
|
642
|
+
|
|
643
|
+
// src/document/builders/fill.js
|
|
644
|
+
function fill(parts) {
|
|
645
|
+
assertDocFillParts(parts);
|
|
646
|
+
return { type: DOC_TYPE_FILL, parts };
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// src/document/builders/group.js
|
|
650
|
+
function group(contents, options = {}) {
|
|
651
|
+
assertDoc(contents);
|
|
652
|
+
assertDocArray(
|
|
653
|
+
options.expandedStates,
|
|
654
|
+
/* optional */
|
|
655
|
+
true
|
|
656
|
+
);
|
|
839
657
|
return {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
658
|
+
type: DOC_TYPE_GROUP,
|
|
659
|
+
id: options.id,
|
|
660
|
+
contents,
|
|
661
|
+
break: Boolean(options.shouldBreak),
|
|
662
|
+
expandedStates: options.expandedStates
|
|
843
663
|
};
|
|
844
664
|
}
|
|
845
|
-
function
|
|
846
|
-
return
|
|
847
|
-
ind,
|
|
848
|
-
{
|
|
849
|
-
type: "indent",
|
|
850
|
-
},
|
|
851
|
-
options,
|
|
852
|
-
);
|
|
665
|
+
function conditionalGroup(states, options) {
|
|
666
|
+
return group(states[0], { ...options, expandedStates: states });
|
|
853
667
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
668
|
+
|
|
669
|
+
// src/document/builders/if-break.js
|
|
670
|
+
function ifBreak(breakContents, flatContents = "", options = {}) {
|
|
671
|
+
assertDoc(breakContents);
|
|
672
|
+
if (flatContents !== "") {
|
|
673
|
+
assertDoc(flatContents);
|
|
857
674
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
675
|
+
return {
|
|
676
|
+
type: DOC_TYPE_IF_BREAK,
|
|
677
|
+
breakContents,
|
|
678
|
+
flatContents,
|
|
679
|
+
groupId: options.groupId
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// src/document/builders/indent-if-break.js
|
|
684
|
+
function indentIfBreak(contents, options) {
|
|
685
|
+
assertDoc(contents);
|
|
686
|
+
return {
|
|
687
|
+
type: DOC_TYPE_INDENT_IF_BREAK,
|
|
688
|
+
contents,
|
|
689
|
+
groupId: options.groupId,
|
|
690
|
+
negate: options.negate
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// src/document/builders/join.js
|
|
695
|
+
function join(separator, docs) {
|
|
696
|
+
assertDoc(separator);
|
|
697
|
+
assertDocArray(docs);
|
|
698
|
+
const parts = [];
|
|
699
|
+
for (let i = 0; i < docs.length; i++) {
|
|
700
|
+
if (i !== 0) {
|
|
701
|
+
parts.push(separator);
|
|
702
|
+
}
|
|
703
|
+
parts.push(docs[i]);
|
|
866
704
|
}
|
|
867
|
-
|
|
868
|
-
|
|
705
|
+
return parts;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// src/document/builders/label.js
|
|
709
|
+
function label(label2, contents) {
|
|
710
|
+
assertDoc(contents);
|
|
711
|
+
return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// src/document/builders/line.js
|
|
715
|
+
var line = { type: DOC_TYPE_LINE };
|
|
716
|
+
var softline = { type: DOC_TYPE_LINE, soft: true };
|
|
717
|
+
var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
|
|
718
|
+
var hardline = [hardlineWithoutBreakParent, breakParent];
|
|
719
|
+
var literallineWithoutBreakParent = {
|
|
720
|
+
type: DOC_TYPE_LINE,
|
|
721
|
+
hard: true,
|
|
722
|
+
literal: true
|
|
723
|
+
};
|
|
724
|
+
var literalline = [literallineWithoutBreakParent, breakParent];
|
|
725
|
+
|
|
726
|
+
// src/document/builders/line-suffix.js
|
|
727
|
+
function lineSuffix(contents) {
|
|
728
|
+
assertDoc(contents);
|
|
729
|
+
return { type: DOC_TYPE_LINE_SUFFIX, contents };
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// src/document/builders/line-suffix-boundary.js
|
|
733
|
+
var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
|
|
734
|
+
|
|
735
|
+
// src/document/builders/trim.js
|
|
736
|
+
var trim = { type: DOC_TYPE_TRIM };
|
|
737
|
+
|
|
738
|
+
// scripts/build/shims/method-replace-all.js
|
|
739
|
+
var stringReplaceAll = String.prototype.replaceAll ?? function(pattern, replacement) {
|
|
740
|
+
if (pattern.global) {
|
|
741
|
+
return this.replace(pattern, replacement);
|
|
869
742
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
743
|
+
return this.split(pattern).join(replacement);
|
|
744
|
+
};
|
|
745
|
+
var replaceAll = createMethodShim("replaceAll", function() {
|
|
746
|
+
if (typeof this === "string") {
|
|
747
|
+
return stringReplaceAll;
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
var method_replace_all_default = replaceAll;
|
|
751
|
+
|
|
752
|
+
// src/common/end-of-line.js
|
|
753
|
+
var OPTION_CR = "cr";
|
|
754
|
+
var OPTION_CRLF = "crlf";
|
|
755
|
+
var CHARACTER_CR = "\r";
|
|
756
|
+
var CHARACTER_CRLF = "\r\n";
|
|
757
|
+
var CHARACTER_LF = "\n";
|
|
758
|
+
var DEFAULT_EOL = CHARACTER_LF;
|
|
759
|
+
function convertEndOfLineOptionToCharacter(endOfLineOption) {
|
|
760
|
+
return endOfLineOption === OPTION_CR ? CHARACTER_CR : endOfLineOption === OPTION_CRLF ? CHARACTER_CRLF : DEFAULT_EOL;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// node_modules/emoji-regex/index.mjs
|
|
764
|
+
var emoji_regex_default = () => {
|
|
765
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
// node_modules/get-east-asian-width/lookup.js
|
|
769
|
+
function isFullWidth(x) {
|
|
770
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
771
|
+
}
|
|
772
|
+
function isWide(x) {
|
|
773
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// src/utilities/narrow-emojis.evaluate.js
|
|
777
|
+
var narrow_emojis_evaluate_default = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
|
|
778
|
+
|
|
779
|
+
// src/utilities/get-string-width.js
|
|
780
|
+
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
781
|
+
var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
|
|
782
|
+
function getStringWidth(text) {
|
|
783
|
+
if (!text) {
|
|
784
|
+
return 0;
|
|
875
785
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
n: widthOrDoc,
|
|
883
|
-
},
|
|
884
|
-
options,
|
|
786
|
+
if (!notAsciiRegex.test(text)) {
|
|
787
|
+
return text.length;
|
|
788
|
+
}
|
|
789
|
+
text = text.replace(
|
|
790
|
+
emoji_regex_default(),
|
|
791
|
+
(match) => narrowEmojisSet.has(match) ? " " : " "
|
|
885
792
|
);
|
|
793
|
+
let width = 0;
|
|
794
|
+
for (const character of text) {
|
|
795
|
+
const codePoint = character.codePointAt(0);
|
|
796
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
797
|
+
continue;
|
|
798
|
+
}
|
|
799
|
+
if (codePoint >= 768 && codePoint <= 879) {
|
|
800
|
+
continue;
|
|
801
|
+
}
|
|
802
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
803
|
+
continue;
|
|
804
|
+
}
|
|
805
|
+
width += isFullWidth(codePoint) || isWide(codePoint) ? 2 : 1;
|
|
806
|
+
}
|
|
807
|
+
return width;
|
|
886
808
|
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
809
|
+
var get_string_width_default = getStringWidth;
|
|
810
|
+
|
|
811
|
+
// src/document/printer/indent.js
|
|
812
|
+
var INDENT_COMMAND_TYPE_INDENT = 0;
|
|
813
|
+
var INDENT_COMMAND_TYPE_DEDENT = 1;
|
|
814
|
+
var INDENT_COMMAND_TYPE_WIDTH = 2;
|
|
815
|
+
var INDENT_COMMAND_TYPE_STRING = 3;
|
|
816
|
+
var INDENT_COMMAND_INDENT = { type: INDENT_COMMAND_TYPE_INDENT };
|
|
817
|
+
var INDENT_COMMAND_DEDENT = { type: INDENT_COMMAND_TYPE_DEDENT };
|
|
818
|
+
var ROOT_INDENT = {
|
|
819
|
+
value: "",
|
|
820
|
+
length: 0,
|
|
821
|
+
queue: [],
|
|
822
|
+
get root() {
|
|
823
|
+
return ROOT_INDENT;
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
function generateIndent(indent2, command, options) {
|
|
827
|
+
const queue = command.type === INDENT_COMMAND_TYPE_DEDENT ? indent2.queue.slice(0, -1) : [...indent2.queue, command];
|
|
892
828
|
let value = "";
|
|
893
829
|
let length = 0;
|
|
894
830
|
let lastTabs = 0;
|
|
895
831
|
let lastSpaces = 0;
|
|
896
|
-
for (const
|
|
897
|
-
switch (
|
|
898
|
-
case
|
|
832
|
+
for (const command2 of queue) {
|
|
833
|
+
switch (command2.type) {
|
|
834
|
+
case INDENT_COMMAND_TYPE_INDENT:
|
|
899
835
|
flush();
|
|
900
836
|
if (options.useTabs) {
|
|
901
837
|
addTabs(1);
|
|
@@ -903,26 +839,25 @@ function generateInd(ind, newPart, options) {
|
|
|
903
839
|
addSpaces(options.tabWidth);
|
|
904
840
|
}
|
|
905
841
|
break;
|
|
906
|
-
case
|
|
842
|
+
case INDENT_COMMAND_TYPE_STRING: {
|
|
843
|
+
const { string } = command2;
|
|
907
844
|
flush();
|
|
908
|
-
value +=
|
|
909
|
-
length +=
|
|
845
|
+
value += string;
|
|
846
|
+
length += string.length;
|
|
910
847
|
break;
|
|
911
|
-
|
|
848
|
+
}
|
|
849
|
+
case INDENT_COMMAND_TYPE_WIDTH: {
|
|
850
|
+
const { width } = command2;
|
|
912
851
|
lastTabs += 1;
|
|
913
|
-
lastSpaces +=
|
|
852
|
+
lastSpaces += width;
|
|
914
853
|
break;
|
|
854
|
+
}
|
|
915
855
|
default:
|
|
916
|
-
throw new Error(`Unexpected
|
|
856
|
+
throw new Error(`Unexpected indent comment '${command2.type}'.`);
|
|
917
857
|
}
|
|
918
858
|
}
|
|
919
859
|
flushSpaces();
|
|
920
|
-
return {
|
|
921
|
-
...ind,
|
|
922
|
-
value,
|
|
923
|
-
length,
|
|
924
|
-
queue,
|
|
925
|
-
};
|
|
860
|
+
return { ...indent2, value, length, queue };
|
|
926
861
|
function addTabs(count) {
|
|
927
862
|
value += " ".repeat(count);
|
|
928
863
|
length += options.tabWidth * count;
|
|
@@ -955,73 +890,96 @@ function generateInd(ind, newPart, options) {
|
|
|
955
890
|
lastSpaces = 0;
|
|
956
891
|
}
|
|
957
892
|
}
|
|
958
|
-
function
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
trimCount++;
|
|
975
|
-
} else {
|
|
976
|
-
out[outIndex] = last.slice(0, charIndex + 1);
|
|
977
|
-
break outer;
|
|
978
|
-
}
|
|
893
|
+
function makeAlign(indent2, indentOptions, options) {
|
|
894
|
+
if (!indentOptions) {
|
|
895
|
+
return indent2;
|
|
896
|
+
}
|
|
897
|
+
if (indentOptions.type === "root") {
|
|
898
|
+
return { ...indent2, root: indent2 };
|
|
899
|
+
}
|
|
900
|
+
if (indentOptions === Number.NEGATIVE_INFINITY) {
|
|
901
|
+
return indent2.root;
|
|
902
|
+
}
|
|
903
|
+
let command;
|
|
904
|
+
if (typeof indentOptions === "number") {
|
|
905
|
+
if (indentOptions < 0) {
|
|
906
|
+
command = INDENT_COMMAND_DEDENT;
|
|
907
|
+
} else {
|
|
908
|
+
command = { type: INDENT_COMMAND_TYPE_WIDTH, width: indentOptions };
|
|
979
909
|
}
|
|
910
|
+
} else {
|
|
911
|
+
command = { type: INDENT_COMMAND_TYPE_STRING, string: indentOptions };
|
|
980
912
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
913
|
+
return generateIndent(indent2, command, options);
|
|
914
|
+
}
|
|
915
|
+
function makeIndent(indent2, options) {
|
|
916
|
+
return generateIndent(indent2, INDENT_COMMAND_INDENT, options);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// src/document/printer/trim-indentation.js
|
|
920
|
+
function getTrailingIndentionLength(text) {
|
|
921
|
+
let length = 0;
|
|
922
|
+
for (let index = text.length - 1; index >= 0; index--) {
|
|
923
|
+
const character = text[index];
|
|
924
|
+
if (character === " " || character === " ") {
|
|
925
|
+
length++;
|
|
926
|
+
} else {
|
|
927
|
+
break;
|
|
985
928
|
}
|
|
986
929
|
}
|
|
987
|
-
return
|
|
930
|
+
return length;
|
|
931
|
+
}
|
|
932
|
+
function trimIndentation(text) {
|
|
933
|
+
const length = getTrailingIndentionLength(text);
|
|
934
|
+
const trimmed = length === 0 ? text : text.slice(0, text.length - length);
|
|
935
|
+
return { text: trimmed, count: length };
|
|
988
936
|
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
) {
|
|
997
|
-
if (width === Number.POSITIVE_INFINITY) {
|
|
937
|
+
|
|
938
|
+
// src/document/printer/printer.js
|
|
939
|
+
var MODE_BREAK = Symbol("MODE_BREAK");
|
|
940
|
+
var MODE_FLAT = Symbol("MODE_FLAT");
|
|
941
|
+
var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
942
|
+
function fits(next, restCommands, remainingWidth, hasLineSuffix, groupModeMap, mustBeFlat) {
|
|
943
|
+
if (remainingWidth === Number.POSITIVE_INFINITY) {
|
|
998
944
|
return true;
|
|
999
945
|
}
|
|
1000
|
-
let
|
|
1001
|
-
|
|
1002
|
-
const
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
946
|
+
let restCommandsIndex = restCommands.length;
|
|
947
|
+
let hasPendingSpace = false;
|
|
948
|
+
const commands = [next];
|
|
949
|
+
let output = "";
|
|
950
|
+
while (remainingWidth >= 0) {
|
|
951
|
+
if (commands.length === 0) {
|
|
952
|
+
if (restCommandsIndex === 0) {
|
|
1006
953
|
return true;
|
|
1007
954
|
}
|
|
1008
|
-
|
|
955
|
+
commands.push(restCommands[--restCommandsIndex]);
|
|
1009
956
|
continue;
|
|
1010
957
|
}
|
|
1011
|
-
const {
|
|
958
|
+
const {
|
|
959
|
+
mode,
|
|
960
|
+
doc
|
|
961
|
+
} = commands.pop();
|
|
1012
962
|
const docType = get_doc_type_default(doc);
|
|
1013
963
|
switch (docType) {
|
|
1014
964
|
case DOC_TYPE_STRING:
|
|
1015
|
-
|
|
1016
|
-
|
|
965
|
+
if (doc) {
|
|
966
|
+
if (hasPendingSpace) {
|
|
967
|
+
output += " ";
|
|
968
|
+
remainingWidth -= 1;
|
|
969
|
+
hasPendingSpace = false;
|
|
970
|
+
}
|
|
971
|
+
output += doc;
|
|
972
|
+
remainingWidth -= get_string_width_default(doc);
|
|
973
|
+
}
|
|
1017
974
|
break;
|
|
1018
975
|
case DOC_TYPE_ARRAY:
|
|
1019
976
|
case DOC_TYPE_FILL: {
|
|
1020
977
|
const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
|
|
1021
|
-
|
|
1022
|
-
|
|
978
|
+
const end = doc[DOC_FILL_PRINTED_LENGTH] ?? 0;
|
|
979
|
+
for (let index = parts.length - 1; index >= end; index--) {
|
|
980
|
+
commands.push({
|
|
1023
981
|
mode,
|
|
1024
|
-
doc: parts[
|
|
982
|
+
doc: parts[index]
|
|
1025
983
|
});
|
|
1026
984
|
}
|
|
1027
985
|
break;
|
|
@@ -1030,44 +988,44 @@ function fits(
|
|
|
1030
988
|
case DOC_TYPE_ALIGN:
|
|
1031
989
|
case DOC_TYPE_INDENT_IF_BREAK:
|
|
1032
990
|
case DOC_TYPE_LABEL:
|
|
1033
|
-
|
|
991
|
+
commands.push({
|
|
1034
992
|
mode,
|
|
1035
|
-
doc: doc.contents
|
|
993
|
+
doc: doc.contents
|
|
1036
994
|
});
|
|
1037
995
|
break;
|
|
1038
|
-
case DOC_TYPE_TRIM:
|
|
1039
|
-
|
|
996
|
+
case DOC_TYPE_TRIM: {
|
|
997
|
+
const {
|
|
998
|
+
text,
|
|
999
|
+
count
|
|
1000
|
+
} = trimIndentation(output);
|
|
1001
|
+
output = text;
|
|
1002
|
+
remainingWidth += count;
|
|
1040
1003
|
break;
|
|
1004
|
+
}
|
|
1041
1005
|
case DOC_TYPE_GROUP: {
|
|
1042
1006
|
if (mustBeFlat && doc.break) {
|
|
1043
1007
|
return false;
|
|
1044
1008
|
}
|
|
1045
1009
|
const groupMode = doc.break ? MODE_BREAK : mode;
|
|
1046
|
-
const contents =
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
)
|
|
1054
|
-
: doc.contents;
|
|
1055
|
-
cmds.push({
|
|
1010
|
+
const contents = doc.expandedStates && groupMode === MODE_BREAK ? method_at_default(
|
|
1011
|
+
/* OPTIONAL_OBJECT: false */
|
|
1012
|
+
0,
|
|
1013
|
+
doc.expandedStates,
|
|
1014
|
+
-1
|
|
1015
|
+
) : doc.contents;
|
|
1016
|
+
commands.push({
|
|
1056
1017
|
mode: groupMode,
|
|
1057
|
-
doc: contents
|
|
1018
|
+
doc: contents
|
|
1058
1019
|
});
|
|
1059
1020
|
break;
|
|
1060
1021
|
}
|
|
1061
1022
|
case DOC_TYPE_IF_BREAK: {
|
|
1062
|
-
const groupMode = doc.groupId
|
|
1063
|
-
|
|
1064
|
-
: mode;
|
|
1065
|
-
const contents =
|
|
1066
|
-
groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
|
|
1023
|
+
const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
|
|
1024
|
+
const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
|
|
1067
1025
|
if (contents) {
|
|
1068
|
-
|
|
1026
|
+
commands.push({
|
|
1069
1027
|
mode,
|
|
1070
|
-
doc: contents
|
|
1028
|
+
doc: contents
|
|
1071
1029
|
});
|
|
1072
1030
|
}
|
|
1073
1031
|
break;
|
|
@@ -1077,8 +1035,7 @@ function fits(
|
|
|
1077
1035
|
return true;
|
|
1078
1036
|
}
|
|
1079
1037
|
if (!doc.soft) {
|
|
1080
|
-
|
|
1081
|
-
width--;
|
|
1038
|
+
hasPendingSpace = true;
|
|
1082
1039
|
}
|
|
1083
1040
|
break;
|
|
1084
1041
|
case DOC_TYPE_LINE_SUFFIX:
|
|
@@ -1094,143 +1051,144 @@ function fits(
|
|
|
1094
1051
|
return false;
|
|
1095
1052
|
}
|
|
1096
1053
|
function printDocToString(doc, options) {
|
|
1097
|
-
const groupModeMap =
|
|
1054
|
+
const groupModeMap = /* @__PURE__ */ Object.create(null);
|
|
1098
1055
|
const width = options.printWidth;
|
|
1099
|
-
const newLine =
|
|
1100
|
-
let
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
];
|
|
1108
|
-
const out = [];
|
|
1056
|
+
const newLine = convertEndOfLineOptionToCharacter(options.endOfLine);
|
|
1057
|
+
let position = 0;
|
|
1058
|
+
const commands = [{
|
|
1059
|
+
indent: ROOT_INDENT,
|
|
1060
|
+
mode: MODE_BREAK,
|
|
1061
|
+
doc
|
|
1062
|
+
}];
|
|
1063
|
+
let output = "";
|
|
1109
1064
|
let shouldRemeasure = false;
|
|
1110
1065
|
const lineSuffix2 = [];
|
|
1111
|
-
|
|
1066
|
+
const cursorPositions = [];
|
|
1067
|
+
const settledOutput = [];
|
|
1068
|
+
const settledCursorPositions = [];
|
|
1069
|
+
let settledTextLength = 0;
|
|
1112
1070
|
propagateBreaks(doc);
|
|
1113
|
-
while (
|
|
1114
|
-
const {
|
|
1071
|
+
while (commands.length > 0) {
|
|
1072
|
+
const {
|
|
1073
|
+
indent: indent2,
|
|
1074
|
+
mode,
|
|
1075
|
+
doc: doc2
|
|
1076
|
+
} = commands.pop();
|
|
1115
1077
|
switch (get_doc_type_default(doc2)) {
|
|
1116
1078
|
case DOC_TYPE_STRING: {
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
pos += get_string_width_default(formatted);
|
|
1079
|
+
const formatted2 = newLine !== "\n" ? method_replace_all_default(
|
|
1080
|
+
/* OPTIONAL_OBJECT: false */
|
|
1081
|
+
0,
|
|
1082
|
+
doc2,
|
|
1083
|
+
"\n",
|
|
1084
|
+
newLine
|
|
1085
|
+
) : doc2;
|
|
1086
|
+
if (formatted2) {
|
|
1087
|
+
output += formatted2;
|
|
1088
|
+
if (commands.length > 0) {
|
|
1089
|
+
position += get_string_width_default(formatted2);
|
|
1090
|
+
}
|
|
1130
1091
|
}
|
|
1131
1092
|
break;
|
|
1132
1093
|
}
|
|
1133
1094
|
case DOC_TYPE_ARRAY:
|
|
1134
|
-
for (let
|
|
1135
|
-
|
|
1136
|
-
|
|
1095
|
+
for (let index = doc2.length - 1; index >= 0; index--) {
|
|
1096
|
+
commands.push({
|
|
1097
|
+
indent: indent2,
|
|
1137
1098
|
mode,
|
|
1138
|
-
doc: doc2[
|
|
1099
|
+
doc: doc2[index]
|
|
1139
1100
|
});
|
|
1140
1101
|
}
|
|
1141
1102
|
break;
|
|
1142
1103
|
case DOC_TYPE_CURSOR:
|
|
1143
|
-
if (
|
|
1104
|
+
if (cursorPositions.length >= 2) {
|
|
1144
1105
|
throw new Error("There are too many 'cursor' in doc.");
|
|
1145
1106
|
}
|
|
1146
|
-
|
|
1147
|
-
printedCursorCount++;
|
|
1107
|
+
cursorPositions.push(settledTextLength + output.length);
|
|
1148
1108
|
break;
|
|
1149
1109
|
case DOC_TYPE_INDENT:
|
|
1150
|
-
|
|
1151
|
-
|
|
1110
|
+
commands.push({
|
|
1111
|
+
indent: makeIndent(indent2, options),
|
|
1152
1112
|
mode,
|
|
1153
|
-
doc: doc2.contents
|
|
1113
|
+
doc: doc2.contents
|
|
1154
1114
|
});
|
|
1155
1115
|
break;
|
|
1156
1116
|
case DOC_TYPE_ALIGN:
|
|
1157
|
-
|
|
1158
|
-
|
|
1117
|
+
commands.push({
|
|
1118
|
+
indent: makeAlign(indent2, doc2.n, options),
|
|
1159
1119
|
mode,
|
|
1160
|
-
doc: doc2.contents
|
|
1120
|
+
doc: doc2.contents
|
|
1161
1121
|
});
|
|
1162
1122
|
break;
|
|
1163
1123
|
case DOC_TYPE_TRIM:
|
|
1164
|
-
|
|
1124
|
+
trim2();
|
|
1165
1125
|
break;
|
|
1166
1126
|
case DOC_TYPE_GROUP:
|
|
1167
1127
|
switch (mode) {
|
|
1168
1128
|
case MODE_FLAT:
|
|
1169
1129
|
if (!shouldRemeasure) {
|
|
1170
|
-
|
|
1171
|
-
|
|
1130
|
+
commands.push({
|
|
1131
|
+
indent: indent2,
|
|
1172
1132
|
mode: doc2.break ? MODE_BREAK : MODE_FLAT,
|
|
1173
|
-
doc: doc2.contents
|
|
1133
|
+
doc: doc2.contents
|
|
1174
1134
|
});
|
|
1175
1135
|
break;
|
|
1176
1136
|
}
|
|
1137
|
+
// fallthrough
|
|
1177
1138
|
case MODE_BREAK: {
|
|
1178
1139
|
shouldRemeasure = false;
|
|
1179
1140
|
const next = {
|
|
1180
|
-
|
|
1141
|
+
indent: indent2,
|
|
1181
1142
|
mode: MODE_FLAT,
|
|
1182
|
-
doc: doc2.contents
|
|
1143
|
+
doc: doc2.contents
|
|
1183
1144
|
};
|
|
1184
|
-
const
|
|
1145
|
+
const remainingWidth = width - position;
|
|
1185
1146
|
const hasLineSuffix = lineSuffix2.length > 0;
|
|
1186
|
-
if (
|
|
1187
|
-
|
|
1188
|
-
fits(next, cmds, rem, hasLineSuffix, groupModeMap)
|
|
1189
|
-
) {
|
|
1190
|
-
cmds.push(next);
|
|
1147
|
+
if (!doc2.break && fits(next, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
|
|
1148
|
+
commands.push(next);
|
|
1191
1149
|
} else {
|
|
1192
1150
|
if (doc2.expandedStates) {
|
|
1193
|
-
const mostExpanded =
|
|
1194
|
-
/*
|
|
1195
|
-
|
|
1151
|
+
const mostExpanded = method_at_default(
|
|
1152
|
+
/* OPTIONAL_OBJECT: false */
|
|
1153
|
+
0,
|
|
1196
1154
|
doc2.expandedStates,
|
|
1197
|
-
-1
|
|
1155
|
+
-1
|
|
1198
1156
|
);
|
|
1199
1157
|
if (doc2.break) {
|
|
1200
|
-
|
|
1201
|
-
|
|
1158
|
+
commands.push({
|
|
1159
|
+
indent: indent2,
|
|
1202
1160
|
mode: MODE_BREAK,
|
|
1203
|
-
doc: mostExpanded
|
|
1161
|
+
doc: mostExpanded
|
|
1204
1162
|
});
|
|
1205
1163
|
break;
|
|
1206
1164
|
} else {
|
|
1207
|
-
for (let
|
|
1208
|
-
if (
|
|
1209
|
-
|
|
1210
|
-
|
|
1165
|
+
for (let index = 1; index < doc2.expandedStates.length + 1; index++) {
|
|
1166
|
+
if (index >= doc2.expandedStates.length) {
|
|
1167
|
+
commands.push({
|
|
1168
|
+
indent: indent2,
|
|
1211
1169
|
mode: MODE_BREAK,
|
|
1212
|
-
doc: mostExpanded
|
|
1170
|
+
doc: mostExpanded
|
|
1213
1171
|
});
|
|
1214
1172
|
break;
|
|
1215
1173
|
} else {
|
|
1216
|
-
const state = doc2.expandedStates[
|
|
1174
|
+
const state = doc2.expandedStates[index];
|
|
1217
1175
|
const cmd = {
|
|
1218
|
-
|
|
1176
|
+
indent: indent2,
|
|
1219
1177
|
mode: MODE_FLAT,
|
|
1220
|
-
doc: state
|
|
1178
|
+
doc: state
|
|
1221
1179
|
};
|
|
1222
|
-
if (fits(cmd,
|
|
1223
|
-
|
|
1180
|
+
if (fits(cmd, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
|
|
1181
|
+
commands.push(cmd);
|
|
1224
1182
|
break;
|
|
1225
1183
|
}
|
|
1226
1184
|
}
|
|
1227
1185
|
}
|
|
1228
1186
|
}
|
|
1229
1187
|
} else {
|
|
1230
|
-
|
|
1231
|
-
|
|
1188
|
+
commands.push({
|
|
1189
|
+
indent: indent2,
|
|
1232
1190
|
mode: MODE_BREAK,
|
|
1233
|
-
doc: doc2.contents
|
|
1191
|
+
doc: doc2.contents
|
|
1234
1192
|
});
|
|
1235
1193
|
}
|
|
1236
1194
|
}
|
|
@@ -1238,91 +1196,105 @@ function printDocToString(doc, options) {
|
|
|
1238
1196
|
}
|
|
1239
1197
|
}
|
|
1240
1198
|
if (doc2.id) {
|
|
1241
|
-
groupModeMap[doc2.id] =
|
|
1242
|
-
/*
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
-1
|
|
1199
|
+
groupModeMap[doc2.id] = method_at_default(
|
|
1200
|
+
/* OPTIONAL_OBJECT: false */
|
|
1201
|
+
0,
|
|
1202
|
+
commands,
|
|
1203
|
+
-1
|
|
1246
1204
|
).mode;
|
|
1247
1205
|
}
|
|
1248
1206
|
break;
|
|
1207
|
+
// Fills each line with as much code as possible before moving to a new
|
|
1208
|
+
// line with the same indentation.
|
|
1209
|
+
//
|
|
1210
|
+
// Expects doc.parts to be an array of alternating content and
|
|
1211
|
+
// whitespace. The whitespace contains the linebreaks.
|
|
1212
|
+
//
|
|
1213
|
+
// For example:
|
|
1214
|
+
// ["I", line, "love", line, "monkeys"]
|
|
1215
|
+
// or
|
|
1216
|
+
// [{ type: group, ... }, softline, { type: group, ... }]
|
|
1217
|
+
//
|
|
1218
|
+
// It uses this parts structure to handle three main layout cases:
|
|
1219
|
+
// * The first two content items fit on the same line without
|
|
1220
|
+
// breaking
|
|
1221
|
+
// -> output the first content item and the whitespace "flat".
|
|
1222
|
+
// * Only the first content item fits on the line without breaking
|
|
1223
|
+
// -> output the first content item "flat" and the whitespace with
|
|
1224
|
+
// "break".
|
|
1225
|
+
// * Neither content item fits on the line without breaking
|
|
1226
|
+
// -> output the first content item and the whitespace with "break".
|
|
1249
1227
|
case DOC_TYPE_FILL: {
|
|
1250
|
-
const
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1228
|
+
const remainingWidth = width - position;
|
|
1229
|
+
const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0;
|
|
1230
|
+
const {
|
|
1231
|
+
parts
|
|
1232
|
+
} = doc2;
|
|
1233
|
+
const length = parts.length - offset;
|
|
1234
|
+
if (length === 0) {
|
|
1253
1235
|
break;
|
|
1254
1236
|
}
|
|
1255
|
-
const
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1237
|
+
const content = parts[offset + 0];
|
|
1238
|
+
const whitespace = parts[offset + 1];
|
|
1239
|
+
const contentFlatCommand = {
|
|
1240
|
+
indent: indent2,
|
|
1258
1241
|
mode: MODE_FLAT,
|
|
1259
|
-
doc: content
|
|
1242
|
+
doc: content
|
|
1260
1243
|
};
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1244
|
+
const contentBreakCommand = {
|
|
1245
|
+
indent: indent2,
|
|
1263
1246
|
mode: MODE_BREAK,
|
|
1264
|
-
doc: content
|
|
1247
|
+
doc: content
|
|
1265
1248
|
};
|
|
1266
|
-
const contentFits = fits(
|
|
1267
|
-
|
|
1268
|
-
[],
|
|
1269
|
-
rem,
|
|
1270
|
-
lineSuffix2.length > 0,
|
|
1271
|
-
groupModeMap,
|
|
1272
|
-
true,
|
|
1273
|
-
);
|
|
1274
|
-
if (parts.length === 1) {
|
|
1249
|
+
const contentFits = fits(contentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
|
|
1250
|
+
if (length === 1) {
|
|
1275
1251
|
if (contentFits) {
|
|
1276
|
-
|
|
1252
|
+
commands.push(contentFlatCommand);
|
|
1277
1253
|
} else {
|
|
1278
|
-
|
|
1254
|
+
commands.push(contentBreakCommand);
|
|
1279
1255
|
}
|
|
1280
1256
|
break;
|
|
1281
1257
|
}
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1258
|
+
const whitespaceFlatCommand = {
|
|
1259
|
+
indent: indent2,
|
|
1284
1260
|
mode: MODE_FLAT,
|
|
1285
|
-
doc: whitespace
|
|
1261
|
+
doc: whitespace
|
|
1286
1262
|
};
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1263
|
+
const whitespaceBreakCommand = {
|
|
1264
|
+
indent: indent2,
|
|
1289
1265
|
mode: MODE_BREAK,
|
|
1290
|
-
doc: whitespace
|
|
1266
|
+
doc: whitespace
|
|
1291
1267
|
};
|
|
1292
|
-
if (
|
|
1268
|
+
if (length === 2) {
|
|
1293
1269
|
if (contentFits) {
|
|
1294
|
-
|
|
1270
|
+
commands.push(whitespaceFlatCommand, contentFlatCommand);
|
|
1295
1271
|
} else {
|
|
1296
|
-
|
|
1272
|
+
commands.push(whitespaceBreakCommand, contentBreakCommand);
|
|
1297
1273
|
}
|
|
1298
1274
|
break;
|
|
1299
1275
|
}
|
|
1300
|
-
parts
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1276
|
+
const secondContent = parts[offset + 2];
|
|
1277
|
+
const remainingCommand = {
|
|
1278
|
+
indent: indent2,
|
|
1303
1279
|
mode,
|
|
1304
|
-
doc:
|
|
1280
|
+
doc: {
|
|
1281
|
+
...doc2,
|
|
1282
|
+
[DOC_FILL_PRINTED_LENGTH]: offset + 2
|
|
1283
|
+
}
|
|
1305
1284
|
};
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1308
|
-
ind,
|
|
1285
|
+
const firstAndSecondContentFlatCommand = {
|
|
1286
|
+
indent: indent2,
|
|
1309
1287
|
mode: MODE_FLAT,
|
|
1310
|
-
doc: [content, whitespace, secondContent]
|
|
1288
|
+
doc: [content, whitespace, secondContent]
|
|
1311
1289
|
};
|
|
1312
|
-
const firstAndSecondContentFits = fits(
|
|
1313
|
-
|
|
1314
|
-
[],
|
|
1315
|
-
rem,
|
|
1316
|
-
lineSuffix2.length > 0,
|
|
1317
|
-
groupModeMap,
|
|
1318
|
-
true,
|
|
1319
|
-
);
|
|
1290
|
+
const firstAndSecondContentFits = fits(firstAndSecondContentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
|
|
1291
|
+
commands.push(remainingCommand);
|
|
1320
1292
|
if (firstAndSecondContentFits) {
|
|
1321
|
-
|
|
1293
|
+
commands.push(whitespaceFlatCommand, contentFlatCommand);
|
|
1322
1294
|
} else if (contentFits) {
|
|
1323
|
-
|
|
1295
|
+
commands.push(whitespaceBreakCommand, contentFlatCommand);
|
|
1324
1296
|
} else {
|
|
1325
|
-
|
|
1297
|
+
commands.push(whitespaceBreakCommand, contentBreakCommand);
|
|
1326
1298
|
}
|
|
1327
1299
|
break;
|
|
1328
1300
|
}
|
|
@@ -1330,32 +1302,22 @@ function printDocToString(doc, options) {
|
|
|
1330
1302
|
case DOC_TYPE_INDENT_IF_BREAK: {
|
|
1331
1303
|
const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode;
|
|
1332
1304
|
if (groupMode === MODE_BREAK) {
|
|
1333
|
-
const breakContents =
|
|
1334
|
-
doc2.type === DOC_TYPE_IF_BREAK
|
|
1335
|
-
? doc2.breakContents
|
|
1336
|
-
: doc2.negate
|
|
1337
|
-
? doc2.contents
|
|
1338
|
-
: indent(doc2.contents);
|
|
1305
|
+
const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents);
|
|
1339
1306
|
if (breakContents) {
|
|
1340
|
-
|
|
1341
|
-
|
|
1307
|
+
commands.push({
|
|
1308
|
+
indent: indent2,
|
|
1342
1309
|
mode,
|
|
1343
|
-
doc: breakContents
|
|
1310
|
+
doc: breakContents
|
|
1344
1311
|
});
|
|
1345
1312
|
}
|
|
1346
1313
|
}
|
|
1347
1314
|
if (groupMode === MODE_FLAT) {
|
|
1348
|
-
const flatContents =
|
|
1349
|
-
doc2.type === DOC_TYPE_IF_BREAK
|
|
1350
|
-
? doc2.flatContents
|
|
1351
|
-
: doc2.negate
|
|
1352
|
-
? indent(doc2.contents)
|
|
1353
|
-
: doc2.contents;
|
|
1315
|
+
const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents;
|
|
1354
1316
|
if (flatContents) {
|
|
1355
|
-
|
|
1356
|
-
|
|
1317
|
+
commands.push({
|
|
1318
|
+
indent: indent2,
|
|
1357
1319
|
mode,
|
|
1358
|
-
doc: flatContents
|
|
1320
|
+
doc: flatContents
|
|
1359
1321
|
});
|
|
1360
1322
|
}
|
|
1361
1323
|
}
|
|
@@ -1363,17 +1325,17 @@ function printDocToString(doc, options) {
|
|
|
1363
1325
|
}
|
|
1364
1326
|
case DOC_TYPE_LINE_SUFFIX:
|
|
1365
1327
|
lineSuffix2.push({
|
|
1366
|
-
|
|
1328
|
+
indent: indent2,
|
|
1367
1329
|
mode,
|
|
1368
|
-
doc: doc2.contents
|
|
1330
|
+
doc: doc2.contents
|
|
1369
1331
|
});
|
|
1370
1332
|
break;
|
|
1371
1333
|
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
1372
1334
|
if (lineSuffix2.length > 0) {
|
|
1373
|
-
|
|
1374
|
-
|
|
1335
|
+
commands.push({
|
|
1336
|
+
indent: indent2,
|
|
1375
1337
|
mode,
|
|
1376
|
-
doc: hardlineWithoutBreakParent
|
|
1338
|
+
doc: hardlineWithoutBreakParent
|
|
1377
1339
|
});
|
|
1378
1340
|
}
|
|
1379
1341
|
break;
|
|
@@ -1382,47 +1344,46 @@ function printDocToString(doc, options) {
|
|
|
1382
1344
|
case MODE_FLAT:
|
|
1383
1345
|
if (!doc2.hard) {
|
|
1384
1346
|
if (!doc2.soft) {
|
|
1385
|
-
|
|
1386
|
-
|
|
1347
|
+
output += " ";
|
|
1348
|
+
position += 1;
|
|
1387
1349
|
}
|
|
1388
1350
|
break;
|
|
1389
1351
|
} else {
|
|
1390
1352
|
shouldRemeasure = true;
|
|
1391
1353
|
}
|
|
1354
|
+
// fallthrough
|
|
1392
1355
|
case MODE_BREAK:
|
|
1393
1356
|
if (lineSuffix2.length > 0) {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
},
|
|
1400
|
-
...lineSuffix2.reverse(),
|
|
1401
|
-
);
|
|
1357
|
+
commands.push({
|
|
1358
|
+
indent: indent2,
|
|
1359
|
+
mode,
|
|
1360
|
+
doc: doc2
|
|
1361
|
+
}, ...lineSuffix2.reverse());
|
|
1402
1362
|
lineSuffix2.length = 0;
|
|
1403
1363
|
break;
|
|
1404
1364
|
}
|
|
1405
1365
|
if (doc2.literal) {
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1366
|
+
output += newLine;
|
|
1367
|
+
position = 0;
|
|
1368
|
+
if (indent2.root) {
|
|
1369
|
+
if (indent2.root.value) {
|
|
1370
|
+
output += indent2.root.value;
|
|
1371
|
+
}
|
|
1372
|
+
position = indent2.root.length;
|
|
1412
1373
|
}
|
|
1413
1374
|
} else {
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1375
|
+
trim2();
|
|
1376
|
+
output += newLine + indent2.value;
|
|
1377
|
+
position = indent2.length;
|
|
1417
1378
|
}
|
|
1418
1379
|
break;
|
|
1419
1380
|
}
|
|
1420
1381
|
break;
|
|
1421
1382
|
case DOC_TYPE_LABEL:
|
|
1422
|
-
|
|
1423
|
-
|
|
1383
|
+
commands.push({
|
|
1384
|
+
indent: indent2,
|
|
1424
1385
|
mode,
|
|
1425
|
-
doc: doc2.contents
|
|
1386
|
+
doc: doc2.contents
|
|
1426
1387
|
});
|
|
1427
1388
|
break;
|
|
1428
1389
|
case DOC_TYPE_BREAK_PARENT:
|
|
@@ -1430,31 +1391,45 @@ function printDocToString(doc, options) {
|
|
|
1430
1391
|
default:
|
|
1431
1392
|
throw new invalid_doc_error_default(doc2);
|
|
1432
1393
|
}
|
|
1433
|
-
if (
|
|
1434
|
-
|
|
1394
|
+
if (commands.length === 0 && lineSuffix2.length > 0) {
|
|
1395
|
+
commands.push(...lineSuffix2.reverse());
|
|
1435
1396
|
lineSuffix2.length = 0;
|
|
1436
1397
|
}
|
|
1437
1398
|
}
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
CURSOR_PLACEHOLDER,
|
|
1442
|
-
cursorPlaceholderIndex + 1,
|
|
1443
|
-
);
|
|
1444
|
-
const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
|
|
1445
|
-
const aroundCursor = out
|
|
1446
|
-
.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex)
|
|
1447
|
-
.join("");
|
|
1448
|
-
const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
|
|
1399
|
+
const formatted = settledOutput.join("") + output;
|
|
1400
|
+
const finalCursorPositions = [...settledCursorPositions, ...cursorPositions];
|
|
1401
|
+
if (finalCursorPositions.length !== 2) {
|
|
1449
1402
|
return {
|
|
1450
|
-
formatted
|
|
1451
|
-
cursorNodeStart: beforeCursor.length,
|
|
1452
|
-
cursorNodeText: aroundCursor,
|
|
1403
|
+
formatted
|
|
1453
1404
|
};
|
|
1454
1405
|
}
|
|
1406
|
+
const cursorNodeStart = finalCursorPositions[0];
|
|
1455
1407
|
return {
|
|
1456
|
-
formatted
|
|
1408
|
+
formatted,
|
|
1409
|
+
cursorNodeStart,
|
|
1410
|
+
cursorNodeText: formatted.slice(cursorNodeStart, method_at_default(
|
|
1411
|
+
/* OPTIONAL_OBJECT: false */
|
|
1412
|
+
0,
|
|
1413
|
+
finalCursorPositions,
|
|
1414
|
+
-1
|
|
1415
|
+
))
|
|
1457
1416
|
};
|
|
1417
|
+
function trim2() {
|
|
1418
|
+
const {
|
|
1419
|
+
text: trimmed,
|
|
1420
|
+
count
|
|
1421
|
+
} = trimIndentation(output);
|
|
1422
|
+
if (trimmed) {
|
|
1423
|
+
settledOutput.push(trimmed);
|
|
1424
|
+
settledTextLength += trimmed.length;
|
|
1425
|
+
}
|
|
1426
|
+
output = "";
|
|
1427
|
+
position -= count;
|
|
1428
|
+
if (cursorPositions.length > 0) {
|
|
1429
|
+
settledCursorPositions.push(...cursorPositions.map((position2) => Math.min(position2, settledTextLength)));
|
|
1430
|
+
cursorPositions.length = 0;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1458
1433
|
}
|
|
1459
1434
|
|
|
1460
1435
|
// src/document/public.js
|
|
@@ -1484,7 +1459,7 @@ var builders = {
|
|
|
1484
1459
|
literallineWithoutBreakParent,
|
|
1485
1460
|
label,
|
|
1486
1461
|
// TODO: Remove this in v4
|
|
1487
|
-
concat: (parts) => parts
|
|
1462
|
+
concat: (parts) => parts
|
|
1488
1463
|
};
|
|
1489
1464
|
var printer = { printDocToString };
|
|
1490
1465
|
var utils = {
|
|
@@ -1495,9 +1470,11 @@ var utils = {
|
|
|
1495
1470
|
removeLines,
|
|
1496
1471
|
stripTrailingHardline,
|
|
1497
1472
|
replaceEndOfLine,
|
|
1498
|
-
canBreak
|
|
1473
|
+
canBreak
|
|
1474
|
+
};
|
|
1475
|
+
export {
|
|
1476
|
+
builders,
|
|
1477
|
+
public_exports as default,
|
|
1478
|
+
printer,
|
|
1479
|
+
utils
|
|
1499
1480
|
};
|
|
1500
|
-
|
|
1501
|
-
// with-default-export:src/document/public.js
|
|
1502
|
-
var public_default = public_exports;
|
|
1503
|
-
export { builders, public_default as default, printer, utils };
|