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.js
CHANGED
|
@@ -30,44 +30,110 @@
|
|
|
30
30
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
31
31
|
};
|
|
32
32
|
var __copyProps = (to, from, except, desc) => {
|
|
33
|
-
if (
|
|
33
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
34
34
|
for (let key of __getOwnPropNames(from))
|
|
35
35
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
36
|
-
__defProp(to, key, {
|
|
37
|
-
get: () => from[key],
|
|
38
|
-
enumerable:
|
|
39
|
-
!(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
40
|
-
});
|
|
36
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
41
37
|
}
|
|
42
38
|
return to;
|
|
43
39
|
};
|
|
44
|
-
var __toCommonJS = (mod) =>
|
|
45
|
-
__copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
41
|
|
|
47
42
|
// src/document/public.js
|
|
48
43
|
var public_exports = {};
|
|
49
44
|
__export(public_exports, {
|
|
50
45
|
builders: () => builders,
|
|
51
46
|
printer: () => printer,
|
|
52
|
-
utils: () => utils
|
|
47
|
+
utils: () => utils
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// scripts/build/shims/shared.js
|
|
51
|
+
var OPTIONAL_OBJECT = 1;
|
|
52
|
+
var createMethodShim = (methodName, getImplementation) => (flags, object, ...arguments_) => {
|
|
53
|
+
if (flags | OPTIONAL_OBJECT && (object === void 0 || object === null)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const implementation = getImplementation.call(object) ?? object[methodName];
|
|
57
|
+
return implementation.apply(object, arguments_);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// scripts/build/shims/method-at.js
|
|
61
|
+
function stringOrArrayAt(index) {
|
|
62
|
+
return this[index < 0 ? this.length + index : index];
|
|
63
|
+
}
|
|
64
|
+
var at = createMethodShim("at", function() {
|
|
65
|
+
if (Array.isArray(this) || typeof this === "string") {
|
|
66
|
+
return stringOrArrayAt;
|
|
67
|
+
}
|
|
53
68
|
});
|
|
69
|
+
var method_at_default = at;
|
|
54
70
|
|
|
55
|
-
// src/
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
+
// src/utilities/noop.js
|
|
72
|
+
var noop = () => {
|
|
73
|
+
};
|
|
74
|
+
var noop_default = noop;
|
|
75
|
+
|
|
76
|
+
// src/document/builders/types.js
|
|
77
|
+
var DOC_TYPE_STRING = (
|
|
78
|
+
/** @type {const} */
|
|
79
|
+
"string"
|
|
80
|
+
);
|
|
81
|
+
var DOC_TYPE_ARRAY = (
|
|
82
|
+
/** @type {const} */
|
|
83
|
+
"array"
|
|
84
|
+
);
|
|
85
|
+
var DOC_TYPE_CURSOR = (
|
|
86
|
+
/** @type {const} */
|
|
87
|
+
"cursor"
|
|
88
|
+
);
|
|
89
|
+
var DOC_TYPE_INDENT = (
|
|
90
|
+
/** @type {const} */
|
|
91
|
+
"indent"
|
|
92
|
+
);
|
|
93
|
+
var DOC_TYPE_ALIGN = (
|
|
94
|
+
/** @type {const} */
|
|
95
|
+
"align"
|
|
96
|
+
);
|
|
97
|
+
var DOC_TYPE_TRIM = (
|
|
98
|
+
/** @type {const} */
|
|
99
|
+
"trim"
|
|
100
|
+
);
|
|
101
|
+
var DOC_TYPE_GROUP = (
|
|
102
|
+
/** @type {const} */
|
|
103
|
+
"group"
|
|
104
|
+
);
|
|
105
|
+
var DOC_TYPE_FILL = (
|
|
106
|
+
/** @type {const} */
|
|
107
|
+
"fill"
|
|
108
|
+
);
|
|
109
|
+
var DOC_TYPE_IF_BREAK = (
|
|
110
|
+
/** @type {const} */
|
|
111
|
+
"if-break"
|
|
112
|
+
);
|
|
113
|
+
var DOC_TYPE_INDENT_IF_BREAK = (
|
|
114
|
+
/** @type {const} */
|
|
115
|
+
"indent-if-break"
|
|
116
|
+
);
|
|
117
|
+
var DOC_TYPE_LINE_SUFFIX = (
|
|
118
|
+
/** @type {const} */
|
|
119
|
+
"line-suffix"
|
|
120
|
+
);
|
|
121
|
+
var DOC_TYPE_LINE_SUFFIX_BOUNDARY = (
|
|
122
|
+
/** @type {const} */
|
|
123
|
+
"line-suffix-boundary"
|
|
124
|
+
);
|
|
125
|
+
var DOC_TYPE_LINE = (
|
|
126
|
+
/** @type {const} */
|
|
127
|
+
"line"
|
|
128
|
+
);
|
|
129
|
+
var DOC_TYPE_LABEL = (
|
|
130
|
+
/** @type {const} */
|
|
131
|
+
"label"
|
|
132
|
+
);
|
|
133
|
+
var DOC_TYPE_BREAK_PARENT = (
|
|
134
|
+
/** @type {const} */
|
|
135
|
+
"break-parent"
|
|
136
|
+
);
|
|
71
137
|
var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
|
|
72
138
|
DOC_TYPE_CURSOR,
|
|
73
139
|
DOC_TYPE_INDENT,
|
|
@@ -81,10 +147,19 @@
|
|
|
81
147
|
DOC_TYPE_LINE_SUFFIX_BOUNDARY,
|
|
82
148
|
DOC_TYPE_LINE,
|
|
83
149
|
DOC_TYPE_LABEL,
|
|
84
|
-
DOC_TYPE_BREAK_PARENT
|
|
150
|
+
DOC_TYPE_BREAK_PARENT
|
|
85
151
|
]);
|
|
86
152
|
|
|
87
|
-
//
|
|
153
|
+
// node_modules/trim-newlines/index.js
|
|
154
|
+
function trimNewlinesEnd(string) {
|
|
155
|
+
let end = string.length;
|
|
156
|
+
while (end > 0 && (string[end - 1] === "\r" || string[end - 1] === "\n")) {
|
|
157
|
+
end--;
|
|
158
|
+
}
|
|
159
|
+
return end < string.length ? string.slice(0, end) : string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/document/utilities/get-doc-type.js
|
|
88
163
|
function getDocType(doc) {
|
|
89
164
|
if (typeof doc === "string") {
|
|
90
165
|
return DOC_TYPE_STRING;
|
|
@@ -102,9 +177,8 @@
|
|
|
102
177
|
}
|
|
103
178
|
var get_doc_type_default = getDocType;
|
|
104
179
|
|
|
105
|
-
// src/document/invalid-doc-error.js
|
|
106
|
-
var disjunctionListFormat = (list) =>
|
|
107
|
-
new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
|
|
180
|
+
// src/document/utilities/invalid-doc-error.js
|
|
181
|
+
var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
|
|
108
182
|
function getDocErrorMessage(doc) {
|
|
109
183
|
const type = doc === null ? "null" : typeof doc;
|
|
110
184
|
if (type !== "string" && type !== "object") {
|
|
@@ -119,7 +193,7 @@ Expected it to be 'string' or 'object'.`;
|
|
|
119
193
|
return `Unexpected doc '${objectType}'.`;
|
|
120
194
|
}
|
|
121
195
|
const EXPECTED_TYPE_VALUES = disjunctionListFormat(
|
|
122
|
-
[...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
|
|
196
|
+
[...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
|
|
123
197
|
);
|
|
124
198
|
return `Unexpected doc.type '${doc.type}'.
|
|
125
199
|
Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
@@ -133,7 +207,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133
207
|
};
|
|
134
208
|
var invalid_doc_error_default = InvalidDocError;
|
|
135
209
|
|
|
136
|
-
// src/document/
|
|
210
|
+
// src/document/utilities/traverse-doc.js
|
|
137
211
|
var traverseDocOnExitStackMarker = {};
|
|
138
212
|
function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
|
|
139
213
|
const docsStack = [doc];
|
|
@@ -150,7 +224,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
150
224
|
if (!docType) {
|
|
151
225
|
throw new invalid_doc_error_default(doc2);
|
|
152
226
|
}
|
|
153
|
-
if (
|
|
227
|
+
if (onEnter?.(doc2) === false) {
|
|
154
228
|
continue;
|
|
155
229
|
}
|
|
156
230
|
switch (docType) {
|
|
@@ -195,363 +269,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
195
269
|
}
|
|
196
270
|
var traverse_doc_default = traverseDoc;
|
|
197
271
|
|
|
198
|
-
// src/document/
|
|
199
|
-
var noop = () => {};
|
|
200
|
-
var assertDoc = true
|
|
201
|
-
? noop
|
|
202
|
-
: function (doc) {
|
|
203
|
-
traverse_doc_default(doc, (doc2) => {
|
|
204
|
-
if (checked.has(doc2)) {
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
if (typeof doc2 !== "string") {
|
|
208
|
-
checked.add(doc2);
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
var assertDocArray = true
|
|
213
|
-
? noop
|
|
214
|
-
: function (docs, optional = false) {
|
|
215
|
-
if (optional && !docs) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
if (!Array.isArray(docs)) {
|
|
219
|
-
throw new TypeError("Unexpected doc array.");
|
|
220
|
-
}
|
|
221
|
-
for (const doc of docs) {
|
|
222
|
-
assertDoc(doc);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
// src/document/builders.js
|
|
227
|
-
function indent(contents) {
|
|
228
|
-
assertDoc(contents);
|
|
229
|
-
return { type: DOC_TYPE_INDENT, contents };
|
|
230
|
-
}
|
|
231
|
-
function align(widthOrString, contents) {
|
|
232
|
-
assertDoc(contents);
|
|
233
|
-
return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
|
|
234
|
-
}
|
|
235
|
-
function group(contents, opts = {}) {
|
|
236
|
-
assertDoc(contents);
|
|
237
|
-
assertDocArray(
|
|
238
|
-
opts.expandedStates,
|
|
239
|
-
/* optional */
|
|
240
|
-
true,
|
|
241
|
-
);
|
|
242
|
-
return {
|
|
243
|
-
type: DOC_TYPE_GROUP,
|
|
244
|
-
id: opts.id,
|
|
245
|
-
contents,
|
|
246
|
-
break: Boolean(opts.shouldBreak),
|
|
247
|
-
expandedStates: opts.expandedStates,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function dedentToRoot(contents) {
|
|
251
|
-
return align(Number.NEGATIVE_INFINITY, contents);
|
|
252
|
-
}
|
|
253
|
-
function markAsRoot(contents) {
|
|
254
|
-
return align({ type: "root" }, contents);
|
|
255
|
-
}
|
|
256
|
-
function dedent(contents) {
|
|
257
|
-
return align(-1, contents);
|
|
258
|
-
}
|
|
259
|
-
function conditionalGroup(states, opts) {
|
|
260
|
-
return group(states[0], { ...opts, expandedStates: states });
|
|
261
|
-
}
|
|
262
|
-
function fill(parts) {
|
|
263
|
-
assertDocArray(parts);
|
|
264
|
-
return { type: DOC_TYPE_FILL, parts };
|
|
265
|
-
}
|
|
266
|
-
function ifBreak(breakContents, flatContents = "", opts = {}) {
|
|
267
|
-
assertDoc(breakContents);
|
|
268
|
-
if (flatContents !== "") {
|
|
269
|
-
assertDoc(flatContents);
|
|
270
|
-
}
|
|
271
|
-
return {
|
|
272
|
-
type: DOC_TYPE_IF_BREAK,
|
|
273
|
-
breakContents,
|
|
274
|
-
flatContents,
|
|
275
|
-
groupId: opts.groupId,
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
function indentIfBreak(contents, opts) {
|
|
279
|
-
assertDoc(contents);
|
|
280
|
-
return {
|
|
281
|
-
type: DOC_TYPE_INDENT_IF_BREAK,
|
|
282
|
-
contents,
|
|
283
|
-
groupId: opts.groupId,
|
|
284
|
-
negate: opts.negate,
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function lineSuffix(contents) {
|
|
288
|
-
assertDoc(contents);
|
|
289
|
-
return { type: DOC_TYPE_LINE_SUFFIX, contents };
|
|
290
|
-
}
|
|
291
|
-
var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
|
|
292
|
-
var breakParent = { type: DOC_TYPE_BREAK_PARENT };
|
|
293
|
-
var trim = { type: DOC_TYPE_TRIM };
|
|
294
|
-
var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
|
|
295
|
-
var literallineWithoutBreakParent = {
|
|
296
|
-
type: DOC_TYPE_LINE,
|
|
297
|
-
hard: true,
|
|
298
|
-
literal: true,
|
|
299
|
-
};
|
|
300
|
-
var line = { type: DOC_TYPE_LINE };
|
|
301
|
-
var softline = { type: DOC_TYPE_LINE, soft: true };
|
|
302
|
-
var hardline = [hardlineWithoutBreakParent, breakParent];
|
|
303
|
-
var literalline = [literallineWithoutBreakParent, breakParent];
|
|
304
|
-
var cursor = { type: DOC_TYPE_CURSOR };
|
|
305
|
-
function join(separator, docs) {
|
|
306
|
-
assertDoc(separator);
|
|
307
|
-
assertDocArray(docs);
|
|
308
|
-
const parts = [];
|
|
309
|
-
for (let i = 0; i < docs.length; i++) {
|
|
310
|
-
if (i !== 0) {
|
|
311
|
-
parts.push(separator);
|
|
312
|
-
}
|
|
313
|
-
parts.push(docs[i]);
|
|
314
|
-
}
|
|
315
|
-
return parts;
|
|
316
|
-
}
|
|
317
|
-
function addAlignmentToDoc(doc, size, tabWidth) {
|
|
318
|
-
assertDoc(doc);
|
|
319
|
-
let aligned = doc;
|
|
320
|
-
if (size > 0) {
|
|
321
|
-
for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
|
|
322
|
-
aligned = indent(aligned);
|
|
323
|
-
}
|
|
324
|
-
aligned = align(size % tabWidth, aligned);
|
|
325
|
-
aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
|
326
|
-
}
|
|
327
|
-
return aligned;
|
|
328
|
-
}
|
|
329
|
-
function label(label2, contents) {
|
|
330
|
-
assertDoc(contents);
|
|
331
|
-
return label2
|
|
332
|
-
? { type: DOC_TYPE_LABEL, label: label2, contents }
|
|
333
|
-
: contents;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// scripts/build/shims/at.js
|
|
337
|
-
var at = (isOptionalObject, object, index) => {
|
|
338
|
-
if (isOptionalObject && (object === void 0 || object === null)) {
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
if (Array.isArray(object) || typeof object === "string") {
|
|
342
|
-
return object[index < 0 ? object.length + index : index];
|
|
343
|
-
}
|
|
344
|
-
return object.at(index);
|
|
345
|
-
};
|
|
346
|
-
var at_default = at;
|
|
347
|
-
|
|
348
|
-
// scripts/build/shims/string-replace-all.js
|
|
349
|
-
var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
|
|
350
|
-
if (isOptionalObject && (original === void 0 || original === null)) {
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
if (original.replaceAll) {
|
|
354
|
-
return original.replaceAll(pattern, replacement);
|
|
355
|
-
}
|
|
356
|
-
if (pattern.global) {
|
|
357
|
-
return original.replace(pattern, replacement);
|
|
358
|
-
}
|
|
359
|
-
return original.split(pattern).join(replacement);
|
|
360
|
-
};
|
|
361
|
-
var string_replace_all_default = stringReplaceAll;
|
|
362
|
-
|
|
363
|
-
// src/common/end-of-line.js
|
|
364
|
-
function convertEndOfLineToChars(value) {
|
|
365
|
-
switch (value) {
|
|
366
|
-
case "cr":
|
|
367
|
-
return "\r";
|
|
368
|
-
case "crlf":
|
|
369
|
-
return "\r\n";
|
|
370
|
-
default:
|
|
371
|
-
return "\n";
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// node_modules/emoji-regex/index.mjs
|
|
376
|
-
var emoji_regex_default = () => {
|
|
377
|
-
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;
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
// node_modules/get-east-asian-width/lookup.js
|
|
381
|
-
function isFullWidth(x) {
|
|
382
|
-
return (
|
|
383
|
-
x === 12288 || (x >= 65281 && x <= 65376) || (x >= 65504 && x <= 65510)
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
|
-
function isWide(x) {
|
|
387
|
-
return (
|
|
388
|
-
(x >= 4352 && x <= 4447) ||
|
|
389
|
-
x === 8986 ||
|
|
390
|
-
x === 8987 ||
|
|
391
|
-
x === 9001 ||
|
|
392
|
-
x === 9002 ||
|
|
393
|
-
(x >= 9193 && x <= 9196) ||
|
|
394
|
-
x === 9200 ||
|
|
395
|
-
x === 9203 ||
|
|
396
|
-
x === 9725 ||
|
|
397
|
-
x === 9726 ||
|
|
398
|
-
x === 9748 ||
|
|
399
|
-
x === 9749 ||
|
|
400
|
-
(x >= 9800 && x <= 9811) ||
|
|
401
|
-
x === 9855 ||
|
|
402
|
-
x === 9875 ||
|
|
403
|
-
x === 9889 ||
|
|
404
|
-
x === 9898 ||
|
|
405
|
-
x === 9899 ||
|
|
406
|
-
x === 9917 ||
|
|
407
|
-
x === 9918 ||
|
|
408
|
-
x === 9924 ||
|
|
409
|
-
x === 9925 ||
|
|
410
|
-
x === 9934 ||
|
|
411
|
-
x === 9940 ||
|
|
412
|
-
x === 9962 ||
|
|
413
|
-
x === 9970 ||
|
|
414
|
-
x === 9971 ||
|
|
415
|
-
x === 9973 ||
|
|
416
|
-
x === 9978 ||
|
|
417
|
-
x === 9981 ||
|
|
418
|
-
x === 9989 ||
|
|
419
|
-
x === 9994 ||
|
|
420
|
-
x === 9995 ||
|
|
421
|
-
x === 10024 ||
|
|
422
|
-
x === 10060 ||
|
|
423
|
-
x === 10062 ||
|
|
424
|
-
(x >= 10067 && x <= 10069) ||
|
|
425
|
-
x === 10071 ||
|
|
426
|
-
(x >= 10133 && x <= 10135) ||
|
|
427
|
-
x === 10160 ||
|
|
428
|
-
x === 10175 ||
|
|
429
|
-
x === 11035 ||
|
|
430
|
-
x === 11036 ||
|
|
431
|
-
x === 11088 ||
|
|
432
|
-
x === 11093 ||
|
|
433
|
-
(x >= 11904 && x <= 11929) ||
|
|
434
|
-
(x >= 11931 && x <= 12019) ||
|
|
435
|
-
(x >= 12032 && x <= 12245) ||
|
|
436
|
-
(x >= 12272 && x <= 12287) ||
|
|
437
|
-
(x >= 12289 && x <= 12350) ||
|
|
438
|
-
(x >= 12353 && x <= 12438) ||
|
|
439
|
-
(x >= 12441 && x <= 12543) ||
|
|
440
|
-
(x >= 12549 && x <= 12591) ||
|
|
441
|
-
(x >= 12593 && x <= 12686) ||
|
|
442
|
-
(x >= 12688 && x <= 12771) ||
|
|
443
|
-
(x >= 12783 && x <= 12830) ||
|
|
444
|
-
(x >= 12832 && x <= 12871) ||
|
|
445
|
-
(x >= 12880 && x <= 19903) ||
|
|
446
|
-
(x >= 19968 && x <= 42124) ||
|
|
447
|
-
(x >= 42128 && x <= 42182) ||
|
|
448
|
-
(x >= 43360 && x <= 43388) ||
|
|
449
|
-
(x >= 44032 && x <= 55203) ||
|
|
450
|
-
(x >= 63744 && x <= 64255) ||
|
|
451
|
-
(x >= 65040 && x <= 65049) ||
|
|
452
|
-
(x >= 65072 && x <= 65106) ||
|
|
453
|
-
(x >= 65108 && x <= 65126) ||
|
|
454
|
-
(x >= 65128 && x <= 65131) ||
|
|
455
|
-
(x >= 94176 && x <= 94180) ||
|
|
456
|
-
x === 94192 ||
|
|
457
|
-
x === 94193 ||
|
|
458
|
-
(x >= 94208 && x <= 100343) ||
|
|
459
|
-
(x >= 100352 && x <= 101589) ||
|
|
460
|
-
(x >= 101632 && x <= 101640) ||
|
|
461
|
-
(x >= 110576 && x <= 110579) ||
|
|
462
|
-
(x >= 110581 && x <= 110587) ||
|
|
463
|
-
x === 110589 ||
|
|
464
|
-
x === 110590 ||
|
|
465
|
-
(x >= 110592 && x <= 110882) ||
|
|
466
|
-
x === 110898 ||
|
|
467
|
-
(x >= 110928 && x <= 110930) ||
|
|
468
|
-
x === 110933 ||
|
|
469
|
-
(x >= 110948 && x <= 110951) ||
|
|
470
|
-
(x >= 110960 && x <= 111355) ||
|
|
471
|
-
x === 126980 ||
|
|
472
|
-
x === 127183 ||
|
|
473
|
-
x === 127374 ||
|
|
474
|
-
(x >= 127377 && x <= 127386) ||
|
|
475
|
-
(x >= 127488 && x <= 127490) ||
|
|
476
|
-
(x >= 127504 && x <= 127547) ||
|
|
477
|
-
(x >= 127552 && x <= 127560) ||
|
|
478
|
-
x === 127568 ||
|
|
479
|
-
x === 127569 ||
|
|
480
|
-
(x >= 127584 && x <= 127589) ||
|
|
481
|
-
(x >= 127744 && x <= 127776) ||
|
|
482
|
-
(x >= 127789 && x <= 127797) ||
|
|
483
|
-
(x >= 127799 && x <= 127868) ||
|
|
484
|
-
(x >= 127870 && x <= 127891) ||
|
|
485
|
-
(x >= 127904 && x <= 127946) ||
|
|
486
|
-
(x >= 127951 && x <= 127955) ||
|
|
487
|
-
(x >= 127968 && x <= 127984) ||
|
|
488
|
-
x === 127988 ||
|
|
489
|
-
(x >= 127992 && x <= 128062) ||
|
|
490
|
-
x === 128064 ||
|
|
491
|
-
(x >= 128066 && x <= 128252) ||
|
|
492
|
-
(x >= 128255 && x <= 128317) ||
|
|
493
|
-
(x >= 128331 && x <= 128334) ||
|
|
494
|
-
(x >= 128336 && x <= 128359) ||
|
|
495
|
-
x === 128378 ||
|
|
496
|
-
x === 128405 ||
|
|
497
|
-
x === 128406 ||
|
|
498
|
-
x === 128420 ||
|
|
499
|
-
(x >= 128507 && x <= 128591) ||
|
|
500
|
-
(x >= 128640 && x <= 128709) ||
|
|
501
|
-
x === 128716 ||
|
|
502
|
-
(x >= 128720 && x <= 128722) ||
|
|
503
|
-
(x >= 128725 && x <= 128727) ||
|
|
504
|
-
(x >= 128732 && x <= 128735) ||
|
|
505
|
-
x === 128747 ||
|
|
506
|
-
x === 128748 ||
|
|
507
|
-
(x >= 128756 && x <= 128764) ||
|
|
508
|
-
(x >= 128992 && x <= 129003) ||
|
|
509
|
-
x === 129008 ||
|
|
510
|
-
(x >= 129292 && x <= 129338) ||
|
|
511
|
-
(x >= 129340 && x <= 129349) ||
|
|
512
|
-
(x >= 129351 && x <= 129535) ||
|
|
513
|
-
(x >= 129648 && x <= 129660) ||
|
|
514
|
-
(x >= 129664 && x <= 129672) ||
|
|
515
|
-
(x >= 129680 && x <= 129725) ||
|
|
516
|
-
(x >= 129727 && x <= 129733) ||
|
|
517
|
-
(x >= 129742 && x <= 129755) ||
|
|
518
|
-
(x >= 129760 && x <= 129768) ||
|
|
519
|
-
(x >= 129776 && x <= 129784) ||
|
|
520
|
-
(x >= 131072 && x <= 196605) ||
|
|
521
|
-
(x >= 196608 && x <= 262141)
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// node_modules/get-east-asian-width/index.js
|
|
526
|
-
var _isNarrowWidth = (codePoint) =>
|
|
527
|
-
!(isFullWidth(codePoint) || isWide(codePoint));
|
|
528
|
-
|
|
529
|
-
// src/utils/get-string-width.js
|
|
530
|
-
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
531
|
-
function getStringWidth(text) {
|
|
532
|
-
if (!text) {
|
|
533
|
-
return 0;
|
|
534
|
-
}
|
|
535
|
-
if (!notAsciiRegex.test(text)) {
|
|
536
|
-
return text.length;
|
|
537
|
-
}
|
|
538
|
-
text = text.replace(emoji_regex_default(), " ");
|
|
539
|
-
let width = 0;
|
|
540
|
-
for (const character of text) {
|
|
541
|
-
const codePoint = character.codePointAt(0);
|
|
542
|
-
if (codePoint <= 31 || (codePoint >= 127 && codePoint <= 159)) {
|
|
543
|
-
continue;
|
|
544
|
-
}
|
|
545
|
-
if (codePoint >= 768 && codePoint <= 879) {
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
width += _isNarrowWidth(codePoint) ? 1 : 2;
|
|
549
|
-
}
|
|
550
|
-
return width;
|
|
551
|
-
}
|
|
552
|
-
var get_string_width_default = getStringWidth;
|
|
553
|
-
|
|
554
|
-
// src/document/utils.js
|
|
272
|
+
// src/document/utilities/index.js
|
|
555
273
|
function mapDoc(doc, cb) {
|
|
556
274
|
if (typeof doc === "string") {
|
|
557
275
|
return cb(doc);
|
|
@@ -573,16 +291,19 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
573
291
|
case DOC_TYPE_FILL:
|
|
574
292
|
return cb({
|
|
575
293
|
...doc2,
|
|
576
|
-
parts: doc2.parts.map(rec)
|
|
294
|
+
parts: doc2.parts.map(rec)
|
|
577
295
|
});
|
|
578
296
|
case DOC_TYPE_IF_BREAK:
|
|
579
297
|
return cb({
|
|
580
298
|
...doc2,
|
|
581
299
|
breakContents: rec(doc2.breakContents),
|
|
582
|
-
flatContents: rec(doc2.flatContents)
|
|
300
|
+
flatContents: rec(doc2.flatContents)
|
|
583
301
|
});
|
|
584
302
|
case DOC_TYPE_GROUP: {
|
|
585
|
-
let {
|
|
303
|
+
let {
|
|
304
|
+
expandedStates,
|
|
305
|
+
contents
|
|
306
|
+
} = doc2;
|
|
586
307
|
if (expandedStates) {
|
|
587
308
|
expandedStates = expandedStates.map(rec);
|
|
588
309
|
contents = expandedStates[0];
|
|
@@ -592,7 +313,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
592
313
|
return cb({
|
|
593
314
|
...doc2,
|
|
594
315
|
contents,
|
|
595
|
-
expandedStates
|
|
316
|
+
expandedStates
|
|
596
317
|
});
|
|
597
318
|
}
|
|
598
319
|
case DOC_TYPE_ALIGN:
|
|
@@ -602,7 +323,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
602
323
|
case DOC_TYPE_LINE_SUFFIX:
|
|
603
324
|
return cb({
|
|
604
325
|
...doc2,
|
|
605
|
-
contents: rec(doc2.contents)
|
|
326
|
+
contents: rec(doc2.contents)
|
|
606
327
|
});
|
|
607
328
|
case DOC_TYPE_STRING:
|
|
608
329
|
case DOC_TYPE_CURSOR:
|
|
@@ -648,11 +369,11 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
648
369
|
}
|
|
649
370
|
function breakParentGroup(groupStack) {
|
|
650
371
|
if (groupStack.length > 0) {
|
|
651
|
-
const parentGroup =
|
|
652
|
-
/*
|
|
653
|
-
|
|
372
|
+
const parentGroup = method_at_default(
|
|
373
|
+
/* OPTIONAL_OBJECT: false */
|
|
374
|
+
0,
|
|
654
375
|
groupStack,
|
|
655
|
-
-1
|
|
376
|
+
-1
|
|
656
377
|
);
|
|
657
378
|
if (!parentGroup.expandedStates && !parentGroup.break) {
|
|
658
379
|
parentGroup.break = "propagated";
|
|
@@ -688,7 +409,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
688
409
|
propagateBreaksOnEnterFn,
|
|
689
410
|
propagateBreaksOnExitFn,
|
|
690
411
|
/* shouldTraverseConditionalGroups */
|
|
691
|
-
true
|
|
412
|
+
true
|
|
692
413
|
);
|
|
693
414
|
}
|
|
694
415
|
function removeLinesFn(doc) {
|
|
@@ -705,32 +426,26 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
705
426
|
}
|
|
706
427
|
function stripTrailingHardlineFromParts(parts) {
|
|
707
428
|
parts = [...parts];
|
|
708
|
-
while (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
parts,
|
|
720
|
-
-1,
|
|
721
|
-
).type === DOC_TYPE_BREAK_PARENT
|
|
722
|
-
) {
|
|
429
|
+
while (parts.length >= 2 && method_at_default(
|
|
430
|
+
/* OPTIONAL_OBJECT: false */
|
|
431
|
+
0,
|
|
432
|
+
parts,
|
|
433
|
+
-2
|
|
434
|
+
).type === DOC_TYPE_LINE && method_at_default(
|
|
435
|
+
/* OPTIONAL_OBJECT: false */
|
|
436
|
+
0,
|
|
437
|
+
parts,
|
|
438
|
+
-1
|
|
439
|
+
).type === DOC_TYPE_BREAK_PARENT) {
|
|
723
440
|
parts.length -= 2;
|
|
724
441
|
}
|
|
725
442
|
if (parts.length > 0) {
|
|
726
|
-
const lastPart = stripTrailingHardlineFromDoc(
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
),
|
|
733
|
-
);
|
|
443
|
+
const lastPart = stripTrailingHardlineFromDoc(method_at_default(
|
|
444
|
+
/* OPTIONAL_OBJECT: false */
|
|
445
|
+
0,
|
|
446
|
+
parts,
|
|
447
|
+
-1
|
|
448
|
+
));
|
|
734
449
|
parts[parts.length - 1] = lastPart;
|
|
735
450
|
}
|
|
736
451
|
return parts;
|
|
@@ -745,24 +460,24 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
745
460
|
const contents = stripTrailingHardlineFromDoc(doc.contents);
|
|
746
461
|
return {
|
|
747
462
|
...doc,
|
|
748
|
-
contents
|
|
463
|
+
contents
|
|
749
464
|
};
|
|
750
465
|
}
|
|
751
466
|
case DOC_TYPE_IF_BREAK:
|
|
752
467
|
return {
|
|
753
468
|
...doc,
|
|
754
469
|
breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
|
|
755
|
-
flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
|
|
470
|
+
flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
|
|
756
471
|
};
|
|
757
472
|
case DOC_TYPE_FILL:
|
|
758
473
|
return {
|
|
759
474
|
...doc,
|
|
760
|
-
parts: stripTrailingHardlineFromParts(doc.parts)
|
|
475
|
+
parts: stripTrailingHardlineFromParts(doc.parts)
|
|
761
476
|
};
|
|
762
477
|
case DOC_TYPE_ARRAY:
|
|
763
478
|
return stripTrailingHardlineFromParts(doc);
|
|
764
479
|
case DOC_TYPE_STRING:
|
|
765
|
-
return doc
|
|
480
|
+
return trimNewlinesEnd(doc);
|
|
766
481
|
case DOC_TYPE_ALIGN:
|
|
767
482
|
case DOC_TYPE_CURSOR:
|
|
768
483
|
case DOC_TYPE_TRIM:
|
|
@@ -789,12 +504,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
789
504
|
if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
|
|
790
505
|
return "";
|
|
791
506
|
}
|
|
792
|
-
if (
|
|
793
|
-
doc.contents.type === DOC_TYPE_GROUP &&
|
|
794
|
-
doc.contents.id === doc.id &&
|
|
795
|
-
doc.contents.break === doc.break &&
|
|
796
|
-
doc.contents.expandedStates === doc.expandedStates
|
|
797
|
-
) {
|
|
507
|
+
if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
|
|
798
508
|
return doc.contents;
|
|
799
509
|
}
|
|
800
510
|
break;
|
|
@@ -817,18 +527,13 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
817
527
|
if (!part) {
|
|
818
528
|
continue;
|
|
819
529
|
}
|
|
820
|
-
const [currentPart, ...restParts] = Array.isArray(part)
|
|
821
|
-
|
|
822
|
-
:
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
false,
|
|
828
|
-
parts,
|
|
829
|
-
-1,
|
|
830
|
-
) === "string"
|
|
831
|
-
) {
|
|
530
|
+
const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
|
|
531
|
+
if (typeof currentPart === "string" && typeof method_at_default(
|
|
532
|
+
/* OPTIONAL_OBJECT: false */
|
|
533
|
+
0,
|
|
534
|
+
parts,
|
|
535
|
+
-1
|
|
536
|
+
) === "string") {
|
|
832
537
|
parts[parts.length - 1] += currentPart;
|
|
833
538
|
} else {
|
|
834
539
|
parts.push(currentPart);
|
|
@@ -860,11 +565,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
860
565
|
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
|
|
861
566
|
}
|
|
862
567
|
function replaceEndOfLine(doc, replacement = literalline) {
|
|
863
|
-
return mapDoc(doc, (currentDoc) =>
|
|
864
|
-
typeof currentDoc === "string"
|
|
865
|
-
? join(replacement, currentDoc.split("\n"))
|
|
866
|
-
: currentDoc,
|
|
867
|
-
);
|
|
568
|
+
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc);
|
|
868
569
|
}
|
|
869
570
|
function canBreakFn(doc) {
|
|
870
571
|
if (doc.type === DOC_TYPE_LINE) {
|
|
@@ -875,71 +576,297 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
875
576
|
return findInDoc(doc, canBreakFn, false);
|
|
876
577
|
}
|
|
877
578
|
|
|
878
|
-
// src/document/
|
|
879
|
-
var
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
579
|
+
// src/document/utilities/assert-doc.js
|
|
580
|
+
var assertDoc = true ? noop_default : (
|
|
581
|
+
/**
|
|
582
|
+
@param {Doc} doc
|
|
583
|
+
*/
|
|
584
|
+
function(doc) {
|
|
585
|
+
traverse_doc_default(doc, (doc2) => {
|
|
586
|
+
if (typeof doc2 === "string" || checked.has(doc2)) {
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
checked.add(doc2);
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
);
|
|
593
|
+
var assertDocArray = true ? noop_default : (
|
|
594
|
+
/**
|
|
595
|
+
@param {readonly Doc[]} docs
|
|
596
|
+
@param {boolean} [optional = false]
|
|
597
|
+
*/
|
|
598
|
+
function(docs, optional = false) {
|
|
599
|
+
if (optional && !docs) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (!Array.isArray(docs)) {
|
|
603
|
+
throw new TypeError("Unexpected doc array.");
|
|
604
|
+
}
|
|
605
|
+
for (const doc of docs) {
|
|
606
|
+
assertDoc(doc);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
var assertDocFillParts = true ? noop_default : (
|
|
611
|
+
/**
|
|
612
|
+
@param {readonly Doc[]} parts
|
|
613
|
+
*/
|
|
614
|
+
function(parts) {
|
|
615
|
+
assertDocArray(parts);
|
|
616
|
+
if (parts.length > 1 && isEmptyDoc(method_at_default(
|
|
617
|
+
/* OPTIONAL_OBJECT: false */
|
|
618
|
+
0,
|
|
619
|
+
parts,
|
|
620
|
+
-1
|
|
621
|
+
))) {
|
|
622
|
+
parts = parts.slice(0, -1);
|
|
623
|
+
}
|
|
624
|
+
for (const [i, doc] of parts.entries()) {
|
|
625
|
+
if (i % 2 === 1 && !isValidSeparator(doc)) {
|
|
626
|
+
const type = get_doc_type_default(doc);
|
|
627
|
+
throw new Error(`Unexpected non-line-break doc at ${i}. Doc type is ${type}.`);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
);
|
|
632
|
+
var assertAlignType = true ? noop_default : function(alignType) {
|
|
633
|
+
if (!(typeof alignType === "number" || typeof alignType === "string" || alignType?.type === "root")) {
|
|
634
|
+
throw new TypeError(`Invalid alignType '${alignType}'.`);
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
// src/document/builders/indent.js
|
|
639
|
+
function indent(contents) {
|
|
640
|
+
assertDoc(contents);
|
|
641
|
+
return { type: DOC_TYPE_INDENT, contents };
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// src/document/builders/align.js
|
|
645
|
+
function align(alignType, contents) {
|
|
646
|
+
assertAlignType(alignType);
|
|
647
|
+
assertDoc(contents);
|
|
648
|
+
return { type: DOC_TYPE_ALIGN, contents, n: alignType };
|
|
649
|
+
}
|
|
650
|
+
function dedentToRoot(contents) {
|
|
651
|
+
return align(Number.NEGATIVE_INFINITY, contents);
|
|
652
|
+
}
|
|
653
|
+
function markAsRoot(contents) {
|
|
654
|
+
return align({ type: "root" }, contents);
|
|
655
|
+
}
|
|
656
|
+
function dedent(contents) {
|
|
657
|
+
return align(-1, contents);
|
|
658
|
+
}
|
|
659
|
+
function addAlignmentToDoc(doc, size, tabWidth) {
|
|
660
|
+
assertDoc(doc);
|
|
661
|
+
let aligned = doc;
|
|
662
|
+
if (size > 0) {
|
|
663
|
+
for (let level = 0; level < Math.floor(size / tabWidth); ++level) {
|
|
664
|
+
aligned = indent(aligned);
|
|
665
|
+
}
|
|
666
|
+
aligned = align(size % tabWidth, aligned);
|
|
667
|
+
aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
|
668
|
+
}
|
|
669
|
+
return aligned;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// src/document/builders/break-parent.js
|
|
673
|
+
var breakParent = { type: DOC_TYPE_BREAK_PARENT };
|
|
674
|
+
|
|
675
|
+
// src/document/builders/cursor.js
|
|
676
|
+
var cursor = { type: DOC_TYPE_CURSOR };
|
|
677
|
+
|
|
678
|
+
// src/document/builders/fill.js
|
|
679
|
+
function fill(parts) {
|
|
680
|
+
assertDocFillParts(parts);
|
|
681
|
+
return { type: DOC_TYPE_FILL, parts };
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// src/document/builders/group.js
|
|
685
|
+
function group(contents, options = {}) {
|
|
686
|
+
assertDoc(contents);
|
|
687
|
+
assertDocArray(
|
|
688
|
+
options.expandedStates,
|
|
689
|
+
/* optional */
|
|
690
|
+
true
|
|
691
|
+
);
|
|
883
692
|
return {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
693
|
+
type: DOC_TYPE_GROUP,
|
|
694
|
+
id: options.id,
|
|
695
|
+
contents,
|
|
696
|
+
break: Boolean(options.shouldBreak),
|
|
697
|
+
expandedStates: options.expandedStates
|
|
887
698
|
};
|
|
888
699
|
}
|
|
889
|
-
function
|
|
890
|
-
return
|
|
891
|
-
ind,
|
|
892
|
-
{
|
|
893
|
-
type: "indent",
|
|
894
|
-
},
|
|
895
|
-
options,
|
|
896
|
-
);
|
|
700
|
+
function conditionalGroup(states, options) {
|
|
701
|
+
return group(states[0], { ...options, expandedStates: states });
|
|
897
702
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
703
|
+
|
|
704
|
+
// src/document/builders/if-break.js
|
|
705
|
+
function ifBreak(breakContents, flatContents = "", options = {}) {
|
|
706
|
+
assertDoc(breakContents);
|
|
707
|
+
if (flatContents !== "") {
|
|
708
|
+
assertDoc(flatContents);
|
|
901
709
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
710
|
+
return {
|
|
711
|
+
type: DOC_TYPE_IF_BREAK,
|
|
712
|
+
breakContents,
|
|
713
|
+
flatContents,
|
|
714
|
+
groupId: options.groupId
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// src/document/builders/indent-if-break.js
|
|
719
|
+
function indentIfBreak(contents, options) {
|
|
720
|
+
assertDoc(contents);
|
|
721
|
+
return {
|
|
722
|
+
type: DOC_TYPE_INDENT_IF_BREAK,
|
|
723
|
+
contents,
|
|
724
|
+
groupId: options.groupId,
|
|
725
|
+
negate: options.negate
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// src/document/builders/join.js
|
|
730
|
+
function join(separator, docs) {
|
|
731
|
+
assertDoc(separator);
|
|
732
|
+
assertDocArray(docs);
|
|
733
|
+
const parts = [];
|
|
734
|
+
for (let i = 0; i < docs.length; i++) {
|
|
735
|
+
if (i !== 0) {
|
|
736
|
+
parts.push(separator);
|
|
737
|
+
}
|
|
738
|
+
parts.push(docs[i]);
|
|
910
739
|
}
|
|
911
|
-
|
|
912
|
-
|
|
740
|
+
return parts;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// src/document/builders/label.js
|
|
744
|
+
function label(label2, contents) {
|
|
745
|
+
assertDoc(contents);
|
|
746
|
+
return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
// src/document/builders/line.js
|
|
750
|
+
var line = { type: DOC_TYPE_LINE };
|
|
751
|
+
var softline = { type: DOC_TYPE_LINE, soft: true };
|
|
752
|
+
var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
|
|
753
|
+
var hardline = [hardlineWithoutBreakParent, breakParent];
|
|
754
|
+
var literallineWithoutBreakParent = {
|
|
755
|
+
type: DOC_TYPE_LINE,
|
|
756
|
+
hard: true,
|
|
757
|
+
literal: true
|
|
758
|
+
};
|
|
759
|
+
var literalline = [literallineWithoutBreakParent, breakParent];
|
|
760
|
+
|
|
761
|
+
// src/document/builders/line-suffix.js
|
|
762
|
+
function lineSuffix(contents) {
|
|
763
|
+
assertDoc(contents);
|
|
764
|
+
return { type: DOC_TYPE_LINE_SUFFIX, contents };
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// src/document/builders/line-suffix-boundary.js
|
|
768
|
+
var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
|
|
769
|
+
|
|
770
|
+
// src/document/builders/trim.js
|
|
771
|
+
var trim = { type: DOC_TYPE_TRIM };
|
|
772
|
+
|
|
773
|
+
// scripts/build/shims/method-replace-all.js
|
|
774
|
+
var stringReplaceAll = String.prototype.replaceAll ?? function(pattern, replacement) {
|
|
775
|
+
if (pattern.global) {
|
|
776
|
+
return this.replace(pattern, replacement);
|
|
913
777
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
778
|
+
return this.split(pattern).join(replacement);
|
|
779
|
+
};
|
|
780
|
+
var replaceAll = createMethodShim("replaceAll", function() {
|
|
781
|
+
if (typeof this === "string") {
|
|
782
|
+
return stringReplaceAll;
|
|
919
783
|
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
784
|
+
});
|
|
785
|
+
var method_replace_all_default = replaceAll;
|
|
786
|
+
|
|
787
|
+
// src/common/end-of-line.js
|
|
788
|
+
var OPTION_CR = "cr";
|
|
789
|
+
var OPTION_CRLF = "crlf";
|
|
790
|
+
var CHARACTER_CR = "\r";
|
|
791
|
+
var CHARACTER_CRLF = "\r\n";
|
|
792
|
+
var CHARACTER_LF = "\n";
|
|
793
|
+
var DEFAULT_EOL = CHARACTER_LF;
|
|
794
|
+
function convertEndOfLineOptionToCharacter(endOfLineOption) {
|
|
795
|
+
return endOfLineOption === OPTION_CR ? CHARACTER_CR : endOfLineOption === OPTION_CRLF ? CHARACTER_CRLF : DEFAULT_EOL;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// node_modules/emoji-regex/index.mjs
|
|
799
|
+
var emoji_regex_default = () => {
|
|
800
|
+
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;
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
// node_modules/get-east-asian-width/lookup.js
|
|
804
|
+
function isFullWidth(x) {
|
|
805
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
806
|
+
}
|
|
807
|
+
function isWide(x) {
|
|
808
|
+
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;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// src/utilities/narrow-emojis.evaluate.js
|
|
812
|
+
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";
|
|
813
|
+
|
|
814
|
+
// src/utilities/get-string-width.js
|
|
815
|
+
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
816
|
+
var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
|
|
817
|
+
function getStringWidth(text) {
|
|
818
|
+
if (!text) {
|
|
819
|
+
return 0;
|
|
820
|
+
}
|
|
821
|
+
if (!notAsciiRegex.test(text)) {
|
|
822
|
+
return text.length;
|
|
823
|
+
}
|
|
824
|
+
text = text.replace(
|
|
825
|
+
emoji_regex_default(),
|
|
826
|
+
(match) => narrowEmojisSet.has(match) ? " " : " "
|
|
929
827
|
);
|
|
828
|
+
let width = 0;
|
|
829
|
+
for (const character of text) {
|
|
830
|
+
const codePoint = character.codePointAt(0);
|
|
831
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
832
|
+
continue;
|
|
833
|
+
}
|
|
834
|
+
if (codePoint >= 768 && codePoint <= 879) {
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
838
|
+
continue;
|
|
839
|
+
}
|
|
840
|
+
width += isFullWidth(codePoint) || isWide(codePoint) ? 2 : 1;
|
|
841
|
+
}
|
|
842
|
+
return width;
|
|
930
843
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
844
|
+
var get_string_width_default = getStringWidth;
|
|
845
|
+
|
|
846
|
+
// src/document/printer/indent.js
|
|
847
|
+
var INDENT_COMMAND_TYPE_INDENT = 0;
|
|
848
|
+
var INDENT_COMMAND_TYPE_DEDENT = 1;
|
|
849
|
+
var INDENT_COMMAND_TYPE_WIDTH = 2;
|
|
850
|
+
var INDENT_COMMAND_TYPE_STRING = 3;
|
|
851
|
+
var INDENT_COMMAND_INDENT = { type: INDENT_COMMAND_TYPE_INDENT };
|
|
852
|
+
var INDENT_COMMAND_DEDENT = { type: INDENT_COMMAND_TYPE_DEDENT };
|
|
853
|
+
var ROOT_INDENT = {
|
|
854
|
+
value: "",
|
|
855
|
+
length: 0,
|
|
856
|
+
queue: [],
|
|
857
|
+
get root() {
|
|
858
|
+
return ROOT_INDENT;
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
function generateIndent(indent2, command, options) {
|
|
862
|
+
const queue = command.type === INDENT_COMMAND_TYPE_DEDENT ? indent2.queue.slice(0, -1) : [...indent2.queue, command];
|
|
936
863
|
let value = "";
|
|
937
864
|
let length = 0;
|
|
938
865
|
let lastTabs = 0;
|
|
939
866
|
let lastSpaces = 0;
|
|
940
|
-
for (const
|
|
941
|
-
switch (
|
|
942
|
-
case
|
|
867
|
+
for (const command2 of queue) {
|
|
868
|
+
switch (command2.type) {
|
|
869
|
+
case INDENT_COMMAND_TYPE_INDENT:
|
|
943
870
|
flush();
|
|
944
871
|
if (options.useTabs) {
|
|
945
872
|
addTabs(1);
|
|
@@ -947,26 +874,25 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
947
874
|
addSpaces(options.tabWidth);
|
|
948
875
|
}
|
|
949
876
|
break;
|
|
950
|
-
case
|
|
877
|
+
case INDENT_COMMAND_TYPE_STRING: {
|
|
878
|
+
const { string } = command2;
|
|
951
879
|
flush();
|
|
952
|
-
value +=
|
|
953
|
-
length +=
|
|
880
|
+
value += string;
|
|
881
|
+
length += string.length;
|
|
954
882
|
break;
|
|
955
|
-
|
|
883
|
+
}
|
|
884
|
+
case INDENT_COMMAND_TYPE_WIDTH: {
|
|
885
|
+
const { width } = command2;
|
|
956
886
|
lastTabs += 1;
|
|
957
|
-
lastSpaces +=
|
|
887
|
+
lastSpaces += width;
|
|
958
888
|
break;
|
|
889
|
+
}
|
|
959
890
|
default:
|
|
960
|
-
throw new Error(`Unexpected
|
|
891
|
+
throw new Error(`Unexpected indent comment '${command2.type}'.`);
|
|
961
892
|
}
|
|
962
893
|
}
|
|
963
894
|
flushSpaces();
|
|
964
|
-
return {
|
|
965
|
-
...ind,
|
|
966
|
-
value,
|
|
967
|
-
length,
|
|
968
|
-
queue,
|
|
969
|
-
};
|
|
895
|
+
return { ...indent2, value, length, queue };
|
|
970
896
|
function addTabs(count) {
|
|
971
897
|
value += " ".repeat(count);
|
|
972
898
|
length += options.tabWidth * count;
|
|
@@ -999,73 +925,96 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
999
925
|
lastSpaces = 0;
|
|
1000
926
|
}
|
|
1001
927
|
}
|
|
1002
|
-
function
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
trimCount++;
|
|
1019
|
-
} else {
|
|
1020
|
-
out[outIndex] = last.slice(0, charIndex + 1);
|
|
1021
|
-
break outer;
|
|
1022
|
-
}
|
|
928
|
+
function makeAlign(indent2, indentOptions, options) {
|
|
929
|
+
if (!indentOptions) {
|
|
930
|
+
return indent2;
|
|
931
|
+
}
|
|
932
|
+
if (indentOptions.type === "root") {
|
|
933
|
+
return { ...indent2, root: indent2 };
|
|
934
|
+
}
|
|
935
|
+
if (indentOptions === Number.NEGATIVE_INFINITY) {
|
|
936
|
+
return indent2.root;
|
|
937
|
+
}
|
|
938
|
+
let command;
|
|
939
|
+
if (typeof indentOptions === "number") {
|
|
940
|
+
if (indentOptions < 0) {
|
|
941
|
+
command = INDENT_COMMAND_DEDENT;
|
|
942
|
+
} else {
|
|
943
|
+
command = { type: INDENT_COMMAND_TYPE_WIDTH, width: indentOptions };
|
|
1023
944
|
}
|
|
945
|
+
} else {
|
|
946
|
+
command = { type: INDENT_COMMAND_TYPE_STRING, string: indentOptions };
|
|
1024
947
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
948
|
+
return generateIndent(indent2, command, options);
|
|
949
|
+
}
|
|
950
|
+
function makeIndent(indent2, options) {
|
|
951
|
+
return generateIndent(indent2, INDENT_COMMAND_INDENT, options);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// src/document/printer/trim-indentation.js
|
|
955
|
+
function getTrailingIndentionLength(text) {
|
|
956
|
+
let length = 0;
|
|
957
|
+
for (let index = text.length - 1; index >= 0; index--) {
|
|
958
|
+
const character = text[index];
|
|
959
|
+
if (character === " " || character === " ") {
|
|
960
|
+
length++;
|
|
961
|
+
} else {
|
|
962
|
+
break;
|
|
1029
963
|
}
|
|
1030
964
|
}
|
|
1031
|
-
return
|
|
965
|
+
return length;
|
|
1032
966
|
}
|
|
1033
|
-
function
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
)
|
|
1041
|
-
|
|
967
|
+
function trimIndentation(text) {
|
|
968
|
+
const length = getTrailingIndentionLength(text);
|
|
969
|
+
const trimmed = length === 0 ? text : text.slice(0, text.length - length);
|
|
970
|
+
return { text: trimmed, count: length };
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// src/document/printer/printer.js
|
|
974
|
+
var MODE_BREAK = Symbol("MODE_BREAK");
|
|
975
|
+
var MODE_FLAT = Symbol("MODE_FLAT");
|
|
976
|
+
var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
977
|
+
function fits(next, restCommands, remainingWidth, hasLineSuffix, groupModeMap, mustBeFlat) {
|
|
978
|
+
if (remainingWidth === Number.POSITIVE_INFINITY) {
|
|
1042
979
|
return true;
|
|
1043
980
|
}
|
|
1044
|
-
let
|
|
1045
|
-
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
981
|
+
let restCommandsIndex = restCommands.length;
|
|
982
|
+
let hasPendingSpace = false;
|
|
983
|
+
const commands = [next];
|
|
984
|
+
let output = "";
|
|
985
|
+
while (remainingWidth >= 0) {
|
|
986
|
+
if (commands.length === 0) {
|
|
987
|
+
if (restCommandsIndex === 0) {
|
|
1050
988
|
return true;
|
|
1051
989
|
}
|
|
1052
|
-
|
|
990
|
+
commands.push(restCommands[--restCommandsIndex]);
|
|
1053
991
|
continue;
|
|
1054
992
|
}
|
|
1055
|
-
const {
|
|
993
|
+
const {
|
|
994
|
+
mode,
|
|
995
|
+
doc
|
|
996
|
+
} = commands.pop();
|
|
1056
997
|
const docType = get_doc_type_default(doc);
|
|
1057
998
|
switch (docType) {
|
|
1058
999
|
case DOC_TYPE_STRING:
|
|
1059
|
-
|
|
1060
|
-
|
|
1000
|
+
if (doc) {
|
|
1001
|
+
if (hasPendingSpace) {
|
|
1002
|
+
output += " ";
|
|
1003
|
+
remainingWidth -= 1;
|
|
1004
|
+
hasPendingSpace = false;
|
|
1005
|
+
}
|
|
1006
|
+
output += doc;
|
|
1007
|
+
remainingWidth -= get_string_width_default(doc);
|
|
1008
|
+
}
|
|
1061
1009
|
break;
|
|
1062
1010
|
case DOC_TYPE_ARRAY:
|
|
1063
1011
|
case DOC_TYPE_FILL: {
|
|
1064
1012
|
const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts;
|
|
1065
|
-
|
|
1066
|
-
|
|
1013
|
+
const end = doc[DOC_FILL_PRINTED_LENGTH] ?? 0;
|
|
1014
|
+
for (let index = parts.length - 1; index >= end; index--) {
|
|
1015
|
+
commands.push({
|
|
1067
1016
|
mode,
|
|
1068
|
-
doc: parts[
|
|
1017
|
+
doc: parts[index]
|
|
1069
1018
|
});
|
|
1070
1019
|
}
|
|
1071
1020
|
break;
|
|
@@ -1074,44 +1023,44 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1074
1023
|
case DOC_TYPE_ALIGN:
|
|
1075
1024
|
case DOC_TYPE_INDENT_IF_BREAK:
|
|
1076
1025
|
case DOC_TYPE_LABEL:
|
|
1077
|
-
|
|
1026
|
+
commands.push({
|
|
1078
1027
|
mode,
|
|
1079
|
-
doc: doc.contents
|
|
1028
|
+
doc: doc.contents
|
|
1080
1029
|
});
|
|
1081
1030
|
break;
|
|
1082
|
-
case DOC_TYPE_TRIM:
|
|
1083
|
-
|
|
1031
|
+
case DOC_TYPE_TRIM: {
|
|
1032
|
+
const {
|
|
1033
|
+
text,
|
|
1034
|
+
count
|
|
1035
|
+
} = trimIndentation(output);
|
|
1036
|
+
output = text;
|
|
1037
|
+
remainingWidth += count;
|
|
1084
1038
|
break;
|
|
1039
|
+
}
|
|
1085
1040
|
case DOC_TYPE_GROUP: {
|
|
1086
1041
|
if (mustBeFlat && doc.break) {
|
|
1087
1042
|
return false;
|
|
1088
1043
|
}
|
|
1089
1044
|
const groupMode = doc.break ? MODE_BREAK : mode;
|
|
1090
|
-
const contents =
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
)
|
|
1098
|
-
: doc.contents;
|
|
1099
|
-
cmds.push({
|
|
1045
|
+
const contents = doc.expandedStates && groupMode === MODE_BREAK ? method_at_default(
|
|
1046
|
+
/* OPTIONAL_OBJECT: false */
|
|
1047
|
+
0,
|
|
1048
|
+
doc.expandedStates,
|
|
1049
|
+
-1
|
|
1050
|
+
) : doc.contents;
|
|
1051
|
+
commands.push({
|
|
1100
1052
|
mode: groupMode,
|
|
1101
|
-
doc: contents
|
|
1053
|
+
doc: contents
|
|
1102
1054
|
});
|
|
1103
1055
|
break;
|
|
1104
1056
|
}
|
|
1105
1057
|
case DOC_TYPE_IF_BREAK: {
|
|
1106
|
-
const groupMode = doc.groupId
|
|
1107
|
-
|
|
1108
|
-
: mode;
|
|
1109
|
-
const contents =
|
|
1110
|
-
groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
|
|
1058
|
+
const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
|
|
1059
|
+
const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
|
|
1111
1060
|
if (contents) {
|
|
1112
|
-
|
|
1061
|
+
commands.push({
|
|
1113
1062
|
mode,
|
|
1114
|
-
doc: contents
|
|
1063
|
+
doc: contents
|
|
1115
1064
|
});
|
|
1116
1065
|
}
|
|
1117
1066
|
break;
|
|
@@ -1121,8 +1070,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1121
1070
|
return true;
|
|
1122
1071
|
}
|
|
1123
1072
|
if (!doc.soft) {
|
|
1124
|
-
|
|
1125
|
-
width--;
|
|
1073
|
+
hasPendingSpace = true;
|
|
1126
1074
|
}
|
|
1127
1075
|
break;
|
|
1128
1076
|
case DOC_TYPE_LINE_SUFFIX:
|
|
@@ -1138,143 +1086,144 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1138
1086
|
return false;
|
|
1139
1087
|
}
|
|
1140
1088
|
function printDocToString(doc, options) {
|
|
1141
|
-
const groupModeMap =
|
|
1089
|
+
const groupModeMap = /* @__PURE__ */ Object.create(null);
|
|
1142
1090
|
const width = options.printWidth;
|
|
1143
|
-
const newLine =
|
|
1144
|
-
let
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
];
|
|
1152
|
-
const out = [];
|
|
1091
|
+
const newLine = convertEndOfLineOptionToCharacter(options.endOfLine);
|
|
1092
|
+
let position = 0;
|
|
1093
|
+
const commands = [{
|
|
1094
|
+
indent: ROOT_INDENT,
|
|
1095
|
+
mode: MODE_BREAK,
|
|
1096
|
+
doc
|
|
1097
|
+
}];
|
|
1098
|
+
let output = "";
|
|
1153
1099
|
let shouldRemeasure = false;
|
|
1154
1100
|
const lineSuffix2 = [];
|
|
1155
|
-
|
|
1101
|
+
const cursorPositions = [];
|
|
1102
|
+
const settledOutput = [];
|
|
1103
|
+
const settledCursorPositions = [];
|
|
1104
|
+
let settledTextLength = 0;
|
|
1156
1105
|
propagateBreaks(doc);
|
|
1157
|
-
while (
|
|
1158
|
-
const {
|
|
1106
|
+
while (commands.length > 0) {
|
|
1107
|
+
const {
|
|
1108
|
+
indent: indent2,
|
|
1109
|
+
mode,
|
|
1110
|
+
doc: doc2
|
|
1111
|
+
} = commands.pop();
|
|
1159
1112
|
switch (get_doc_type_default(doc2)) {
|
|
1160
1113
|
case DOC_TYPE_STRING: {
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
pos += get_string_width_default(formatted);
|
|
1114
|
+
const formatted2 = newLine !== "\n" ? method_replace_all_default(
|
|
1115
|
+
/* OPTIONAL_OBJECT: false */
|
|
1116
|
+
0,
|
|
1117
|
+
doc2,
|
|
1118
|
+
"\n",
|
|
1119
|
+
newLine
|
|
1120
|
+
) : doc2;
|
|
1121
|
+
if (formatted2) {
|
|
1122
|
+
output += formatted2;
|
|
1123
|
+
if (commands.length > 0) {
|
|
1124
|
+
position += get_string_width_default(formatted2);
|
|
1125
|
+
}
|
|
1174
1126
|
}
|
|
1175
1127
|
break;
|
|
1176
1128
|
}
|
|
1177
1129
|
case DOC_TYPE_ARRAY:
|
|
1178
|
-
for (let
|
|
1179
|
-
|
|
1180
|
-
|
|
1130
|
+
for (let index = doc2.length - 1; index >= 0; index--) {
|
|
1131
|
+
commands.push({
|
|
1132
|
+
indent: indent2,
|
|
1181
1133
|
mode,
|
|
1182
|
-
doc: doc2[
|
|
1134
|
+
doc: doc2[index]
|
|
1183
1135
|
});
|
|
1184
1136
|
}
|
|
1185
1137
|
break;
|
|
1186
1138
|
case DOC_TYPE_CURSOR:
|
|
1187
|
-
if (
|
|
1139
|
+
if (cursorPositions.length >= 2) {
|
|
1188
1140
|
throw new Error("There are too many 'cursor' in doc.");
|
|
1189
1141
|
}
|
|
1190
|
-
|
|
1191
|
-
printedCursorCount++;
|
|
1142
|
+
cursorPositions.push(settledTextLength + output.length);
|
|
1192
1143
|
break;
|
|
1193
1144
|
case DOC_TYPE_INDENT:
|
|
1194
|
-
|
|
1195
|
-
|
|
1145
|
+
commands.push({
|
|
1146
|
+
indent: makeIndent(indent2, options),
|
|
1196
1147
|
mode,
|
|
1197
|
-
doc: doc2.contents
|
|
1148
|
+
doc: doc2.contents
|
|
1198
1149
|
});
|
|
1199
1150
|
break;
|
|
1200
1151
|
case DOC_TYPE_ALIGN:
|
|
1201
|
-
|
|
1202
|
-
|
|
1152
|
+
commands.push({
|
|
1153
|
+
indent: makeAlign(indent2, doc2.n, options),
|
|
1203
1154
|
mode,
|
|
1204
|
-
doc: doc2.contents
|
|
1155
|
+
doc: doc2.contents
|
|
1205
1156
|
});
|
|
1206
1157
|
break;
|
|
1207
1158
|
case DOC_TYPE_TRIM:
|
|
1208
|
-
|
|
1159
|
+
trim2();
|
|
1209
1160
|
break;
|
|
1210
1161
|
case DOC_TYPE_GROUP:
|
|
1211
1162
|
switch (mode) {
|
|
1212
1163
|
case MODE_FLAT:
|
|
1213
1164
|
if (!shouldRemeasure) {
|
|
1214
|
-
|
|
1215
|
-
|
|
1165
|
+
commands.push({
|
|
1166
|
+
indent: indent2,
|
|
1216
1167
|
mode: doc2.break ? MODE_BREAK : MODE_FLAT,
|
|
1217
|
-
doc: doc2.contents
|
|
1168
|
+
doc: doc2.contents
|
|
1218
1169
|
});
|
|
1219
1170
|
break;
|
|
1220
1171
|
}
|
|
1172
|
+
// fallthrough
|
|
1221
1173
|
case MODE_BREAK: {
|
|
1222
1174
|
shouldRemeasure = false;
|
|
1223
1175
|
const next = {
|
|
1224
|
-
|
|
1176
|
+
indent: indent2,
|
|
1225
1177
|
mode: MODE_FLAT,
|
|
1226
|
-
doc: doc2.contents
|
|
1178
|
+
doc: doc2.contents
|
|
1227
1179
|
};
|
|
1228
|
-
const
|
|
1180
|
+
const remainingWidth = width - position;
|
|
1229
1181
|
const hasLineSuffix = lineSuffix2.length > 0;
|
|
1230
|
-
if (
|
|
1231
|
-
|
|
1232
|
-
fits(next, cmds, rem, hasLineSuffix, groupModeMap)
|
|
1233
|
-
) {
|
|
1234
|
-
cmds.push(next);
|
|
1182
|
+
if (!doc2.break && fits(next, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
|
|
1183
|
+
commands.push(next);
|
|
1235
1184
|
} else {
|
|
1236
1185
|
if (doc2.expandedStates) {
|
|
1237
|
-
const mostExpanded =
|
|
1238
|
-
/*
|
|
1239
|
-
|
|
1186
|
+
const mostExpanded = method_at_default(
|
|
1187
|
+
/* OPTIONAL_OBJECT: false */
|
|
1188
|
+
0,
|
|
1240
1189
|
doc2.expandedStates,
|
|
1241
|
-
-1
|
|
1190
|
+
-1
|
|
1242
1191
|
);
|
|
1243
1192
|
if (doc2.break) {
|
|
1244
|
-
|
|
1245
|
-
|
|
1193
|
+
commands.push({
|
|
1194
|
+
indent: indent2,
|
|
1246
1195
|
mode: MODE_BREAK,
|
|
1247
|
-
doc: mostExpanded
|
|
1196
|
+
doc: mostExpanded
|
|
1248
1197
|
});
|
|
1249
1198
|
break;
|
|
1250
1199
|
} else {
|
|
1251
|
-
for (let
|
|
1252
|
-
if (
|
|
1253
|
-
|
|
1254
|
-
|
|
1200
|
+
for (let index = 1; index < doc2.expandedStates.length + 1; index++) {
|
|
1201
|
+
if (index >= doc2.expandedStates.length) {
|
|
1202
|
+
commands.push({
|
|
1203
|
+
indent: indent2,
|
|
1255
1204
|
mode: MODE_BREAK,
|
|
1256
|
-
doc: mostExpanded
|
|
1205
|
+
doc: mostExpanded
|
|
1257
1206
|
});
|
|
1258
1207
|
break;
|
|
1259
1208
|
} else {
|
|
1260
|
-
const state = doc2.expandedStates[
|
|
1209
|
+
const state = doc2.expandedStates[index];
|
|
1261
1210
|
const cmd = {
|
|
1262
|
-
|
|
1211
|
+
indent: indent2,
|
|
1263
1212
|
mode: MODE_FLAT,
|
|
1264
|
-
doc: state
|
|
1213
|
+
doc: state
|
|
1265
1214
|
};
|
|
1266
|
-
if (fits(cmd,
|
|
1267
|
-
|
|
1215
|
+
if (fits(cmd, commands, remainingWidth, hasLineSuffix, groupModeMap)) {
|
|
1216
|
+
commands.push(cmd);
|
|
1268
1217
|
break;
|
|
1269
1218
|
}
|
|
1270
1219
|
}
|
|
1271
1220
|
}
|
|
1272
1221
|
}
|
|
1273
1222
|
} else {
|
|
1274
|
-
|
|
1275
|
-
|
|
1223
|
+
commands.push({
|
|
1224
|
+
indent: indent2,
|
|
1276
1225
|
mode: MODE_BREAK,
|
|
1277
|
-
doc: doc2.contents
|
|
1226
|
+
doc: doc2.contents
|
|
1278
1227
|
});
|
|
1279
1228
|
}
|
|
1280
1229
|
}
|
|
@@ -1282,91 +1231,105 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1282
1231
|
}
|
|
1283
1232
|
}
|
|
1284
1233
|
if (doc2.id) {
|
|
1285
|
-
groupModeMap[doc2.id] =
|
|
1286
|
-
/*
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
-1
|
|
1234
|
+
groupModeMap[doc2.id] = method_at_default(
|
|
1235
|
+
/* OPTIONAL_OBJECT: false */
|
|
1236
|
+
0,
|
|
1237
|
+
commands,
|
|
1238
|
+
-1
|
|
1290
1239
|
).mode;
|
|
1291
1240
|
}
|
|
1292
1241
|
break;
|
|
1242
|
+
// Fills each line with as much code as possible before moving to a new
|
|
1243
|
+
// line with the same indentation.
|
|
1244
|
+
//
|
|
1245
|
+
// Expects doc.parts to be an array of alternating content and
|
|
1246
|
+
// whitespace. The whitespace contains the linebreaks.
|
|
1247
|
+
//
|
|
1248
|
+
// For example:
|
|
1249
|
+
// ["I", line, "love", line, "monkeys"]
|
|
1250
|
+
// or
|
|
1251
|
+
// [{ type: group, ... }, softline, { type: group, ... }]
|
|
1252
|
+
//
|
|
1253
|
+
// It uses this parts structure to handle three main layout cases:
|
|
1254
|
+
// * The first two content items fit on the same line without
|
|
1255
|
+
// breaking
|
|
1256
|
+
// -> output the first content item and the whitespace "flat".
|
|
1257
|
+
// * Only the first content item fits on the line without breaking
|
|
1258
|
+
// -> output the first content item "flat" and the whitespace with
|
|
1259
|
+
// "break".
|
|
1260
|
+
// * Neither content item fits on the line without breaking
|
|
1261
|
+
// -> output the first content item and the whitespace with "break".
|
|
1293
1262
|
case DOC_TYPE_FILL: {
|
|
1294
|
-
const
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1263
|
+
const remainingWidth = width - position;
|
|
1264
|
+
const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0;
|
|
1265
|
+
const {
|
|
1266
|
+
parts
|
|
1267
|
+
} = doc2;
|
|
1268
|
+
const length = parts.length - offset;
|
|
1269
|
+
if (length === 0) {
|
|
1297
1270
|
break;
|
|
1298
1271
|
}
|
|
1299
|
-
const
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1272
|
+
const content = parts[offset + 0];
|
|
1273
|
+
const whitespace = parts[offset + 1];
|
|
1274
|
+
const contentFlatCommand = {
|
|
1275
|
+
indent: indent2,
|
|
1302
1276
|
mode: MODE_FLAT,
|
|
1303
|
-
doc: content
|
|
1277
|
+
doc: content
|
|
1304
1278
|
};
|
|
1305
|
-
const
|
|
1306
|
-
|
|
1279
|
+
const contentBreakCommand = {
|
|
1280
|
+
indent: indent2,
|
|
1307
1281
|
mode: MODE_BREAK,
|
|
1308
|
-
doc: content
|
|
1282
|
+
doc: content
|
|
1309
1283
|
};
|
|
1310
|
-
const contentFits = fits(
|
|
1311
|
-
|
|
1312
|
-
[],
|
|
1313
|
-
rem,
|
|
1314
|
-
lineSuffix2.length > 0,
|
|
1315
|
-
groupModeMap,
|
|
1316
|
-
true,
|
|
1317
|
-
);
|
|
1318
|
-
if (parts.length === 1) {
|
|
1284
|
+
const contentFits = fits(contentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
|
|
1285
|
+
if (length === 1) {
|
|
1319
1286
|
if (contentFits) {
|
|
1320
|
-
|
|
1287
|
+
commands.push(contentFlatCommand);
|
|
1321
1288
|
} else {
|
|
1322
|
-
|
|
1289
|
+
commands.push(contentBreakCommand);
|
|
1323
1290
|
}
|
|
1324
1291
|
break;
|
|
1325
1292
|
}
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1293
|
+
const whitespaceFlatCommand = {
|
|
1294
|
+
indent: indent2,
|
|
1328
1295
|
mode: MODE_FLAT,
|
|
1329
|
-
doc: whitespace
|
|
1296
|
+
doc: whitespace
|
|
1330
1297
|
};
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1298
|
+
const whitespaceBreakCommand = {
|
|
1299
|
+
indent: indent2,
|
|
1333
1300
|
mode: MODE_BREAK,
|
|
1334
|
-
doc: whitespace
|
|
1301
|
+
doc: whitespace
|
|
1335
1302
|
};
|
|
1336
|
-
if (
|
|
1303
|
+
if (length === 2) {
|
|
1337
1304
|
if (contentFits) {
|
|
1338
|
-
|
|
1305
|
+
commands.push(whitespaceFlatCommand, contentFlatCommand);
|
|
1339
1306
|
} else {
|
|
1340
|
-
|
|
1307
|
+
commands.push(whitespaceBreakCommand, contentBreakCommand);
|
|
1341
1308
|
}
|
|
1342
1309
|
break;
|
|
1343
1310
|
}
|
|
1344
|
-
parts
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1311
|
+
const secondContent = parts[offset + 2];
|
|
1312
|
+
const remainingCommand = {
|
|
1313
|
+
indent: indent2,
|
|
1347
1314
|
mode,
|
|
1348
|
-
doc:
|
|
1315
|
+
doc: {
|
|
1316
|
+
...doc2,
|
|
1317
|
+
[DOC_FILL_PRINTED_LENGTH]: offset + 2
|
|
1318
|
+
}
|
|
1349
1319
|
};
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1352
|
-
ind,
|
|
1320
|
+
const firstAndSecondContentFlatCommand = {
|
|
1321
|
+
indent: indent2,
|
|
1353
1322
|
mode: MODE_FLAT,
|
|
1354
|
-
doc: [content, whitespace, secondContent]
|
|
1323
|
+
doc: [content, whitespace, secondContent]
|
|
1355
1324
|
};
|
|
1356
|
-
const firstAndSecondContentFits = fits(
|
|
1357
|
-
|
|
1358
|
-
[],
|
|
1359
|
-
rem,
|
|
1360
|
-
lineSuffix2.length > 0,
|
|
1361
|
-
groupModeMap,
|
|
1362
|
-
true,
|
|
1363
|
-
);
|
|
1325
|
+
const firstAndSecondContentFits = fits(firstAndSecondContentFlatCommand, [], remainingWidth, lineSuffix2.length > 0, groupModeMap, true);
|
|
1326
|
+
commands.push(remainingCommand);
|
|
1364
1327
|
if (firstAndSecondContentFits) {
|
|
1365
|
-
|
|
1328
|
+
commands.push(whitespaceFlatCommand, contentFlatCommand);
|
|
1366
1329
|
} else if (contentFits) {
|
|
1367
|
-
|
|
1330
|
+
commands.push(whitespaceBreakCommand, contentFlatCommand);
|
|
1368
1331
|
} else {
|
|
1369
|
-
|
|
1332
|
+
commands.push(whitespaceBreakCommand, contentBreakCommand);
|
|
1370
1333
|
}
|
|
1371
1334
|
break;
|
|
1372
1335
|
}
|
|
@@ -1374,32 +1337,22 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1374
1337
|
case DOC_TYPE_INDENT_IF_BREAK: {
|
|
1375
1338
|
const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode;
|
|
1376
1339
|
if (groupMode === MODE_BREAK) {
|
|
1377
|
-
const breakContents =
|
|
1378
|
-
doc2.type === DOC_TYPE_IF_BREAK
|
|
1379
|
-
? doc2.breakContents
|
|
1380
|
-
: doc2.negate
|
|
1381
|
-
? doc2.contents
|
|
1382
|
-
: indent(doc2.contents);
|
|
1340
|
+
const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents);
|
|
1383
1341
|
if (breakContents) {
|
|
1384
|
-
|
|
1385
|
-
|
|
1342
|
+
commands.push({
|
|
1343
|
+
indent: indent2,
|
|
1386
1344
|
mode,
|
|
1387
|
-
doc: breakContents
|
|
1345
|
+
doc: breakContents
|
|
1388
1346
|
});
|
|
1389
1347
|
}
|
|
1390
1348
|
}
|
|
1391
1349
|
if (groupMode === MODE_FLAT) {
|
|
1392
|
-
const flatContents =
|
|
1393
|
-
doc2.type === DOC_TYPE_IF_BREAK
|
|
1394
|
-
? doc2.flatContents
|
|
1395
|
-
: doc2.negate
|
|
1396
|
-
? indent(doc2.contents)
|
|
1397
|
-
: doc2.contents;
|
|
1350
|
+
const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents;
|
|
1398
1351
|
if (flatContents) {
|
|
1399
|
-
|
|
1400
|
-
|
|
1352
|
+
commands.push({
|
|
1353
|
+
indent: indent2,
|
|
1401
1354
|
mode,
|
|
1402
|
-
doc: flatContents
|
|
1355
|
+
doc: flatContents
|
|
1403
1356
|
});
|
|
1404
1357
|
}
|
|
1405
1358
|
}
|
|
@@ -1407,17 +1360,17 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1407
1360
|
}
|
|
1408
1361
|
case DOC_TYPE_LINE_SUFFIX:
|
|
1409
1362
|
lineSuffix2.push({
|
|
1410
|
-
|
|
1363
|
+
indent: indent2,
|
|
1411
1364
|
mode,
|
|
1412
|
-
doc: doc2.contents
|
|
1365
|
+
doc: doc2.contents
|
|
1413
1366
|
});
|
|
1414
1367
|
break;
|
|
1415
1368
|
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
1416
1369
|
if (lineSuffix2.length > 0) {
|
|
1417
|
-
|
|
1418
|
-
|
|
1370
|
+
commands.push({
|
|
1371
|
+
indent: indent2,
|
|
1419
1372
|
mode,
|
|
1420
|
-
doc: hardlineWithoutBreakParent
|
|
1373
|
+
doc: hardlineWithoutBreakParent
|
|
1421
1374
|
});
|
|
1422
1375
|
}
|
|
1423
1376
|
break;
|
|
@@ -1426,47 +1379,46 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1426
1379
|
case MODE_FLAT:
|
|
1427
1380
|
if (!doc2.hard) {
|
|
1428
1381
|
if (!doc2.soft) {
|
|
1429
|
-
|
|
1430
|
-
|
|
1382
|
+
output += " ";
|
|
1383
|
+
position += 1;
|
|
1431
1384
|
}
|
|
1432
1385
|
break;
|
|
1433
1386
|
} else {
|
|
1434
1387
|
shouldRemeasure = true;
|
|
1435
1388
|
}
|
|
1389
|
+
// fallthrough
|
|
1436
1390
|
case MODE_BREAK:
|
|
1437
1391
|
if (lineSuffix2.length > 0) {
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
},
|
|
1444
|
-
...lineSuffix2.reverse(),
|
|
1445
|
-
);
|
|
1392
|
+
commands.push({
|
|
1393
|
+
indent: indent2,
|
|
1394
|
+
mode,
|
|
1395
|
+
doc: doc2
|
|
1396
|
+
}, ...lineSuffix2.reverse());
|
|
1446
1397
|
lineSuffix2.length = 0;
|
|
1447
1398
|
break;
|
|
1448
1399
|
}
|
|
1449
1400
|
if (doc2.literal) {
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1401
|
+
output += newLine;
|
|
1402
|
+
position = 0;
|
|
1403
|
+
if (indent2.root) {
|
|
1404
|
+
if (indent2.root.value) {
|
|
1405
|
+
output += indent2.root.value;
|
|
1406
|
+
}
|
|
1407
|
+
position = indent2.root.length;
|
|
1456
1408
|
}
|
|
1457
1409
|
} else {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1410
|
+
trim2();
|
|
1411
|
+
output += newLine + indent2.value;
|
|
1412
|
+
position = indent2.length;
|
|
1461
1413
|
}
|
|
1462
1414
|
break;
|
|
1463
1415
|
}
|
|
1464
1416
|
break;
|
|
1465
1417
|
case DOC_TYPE_LABEL:
|
|
1466
|
-
|
|
1467
|
-
|
|
1418
|
+
commands.push({
|
|
1419
|
+
indent: indent2,
|
|
1468
1420
|
mode,
|
|
1469
|
-
doc: doc2.contents
|
|
1421
|
+
doc: doc2.contents
|
|
1470
1422
|
});
|
|
1471
1423
|
break;
|
|
1472
1424
|
case DOC_TYPE_BREAK_PARENT:
|
|
@@ -1474,31 +1426,45 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1474
1426
|
default:
|
|
1475
1427
|
throw new invalid_doc_error_default(doc2);
|
|
1476
1428
|
}
|
|
1477
|
-
if (
|
|
1478
|
-
|
|
1429
|
+
if (commands.length === 0 && lineSuffix2.length > 0) {
|
|
1430
|
+
commands.push(...lineSuffix2.reverse());
|
|
1479
1431
|
lineSuffix2.length = 0;
|
|
1480
1432
|
}
|
|
1481
1433
|
}
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
CURSOR_PLACEHOLDER,
|
|
1486
|
-
cursorPlaceholderIndex + 1,
|
|
1487
|
-
);
|
|
1488
|
-
const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
|
|
1489
|
-
const aroundCursor = out
|
|
1490
|
-
.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex)
|
|
1491
|
-
.join("");
|
|
1492
|
-
const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
|
|
1434
|
+
const formatted = settledOutput.join("") + output;
|
|
1435
|
+
const finalCursorPositions = [...settledCursorPositions, ...cursorPositions];
|
|
1436
|
+
if (finalCursorPositions.length !== 2) {
|
|
1493
1437
|
return {
|
|
1494
|
-
formatted
|
|
1495
|
-
cursorNodeStart: beforeCursor.length,
|
|
1496
|
-
cursorNodeText: aroundCursor,
|
|
1438
|
+
formatted
|
|
1497
1439
|
};
|
|
1498
1440
|
}
|
|
1441
|
+
const cursorNodeStart = finalCursorPositions[0];
|
|
1499
1442
|
return {
|
|
1500
|
-
formatted
|
|
1443
|
+
formatted,
|
|
1444
|
+
cursorNodeStart,
|
|
1445
|
+
cursorNodeText: formatted.slice(cursorNodeStart, method_at_default(
|
|
1446
|
+
/* OPTIONAL_OBJECT: false */
|
|
1447
|
+
0,
|
|
1448
|
+
finalCursorPositions,
|
|
1449
|
+
-1
|
|
1450
|
+
))
|
|
1501
1451
|
};
|
|
1452
|
+
function trim2() {
|
|
1453
|
+
const {
|
|
1454
|
+
text: trimmed,
|
|
1455
|
+
count
|
|
1456
|
+
} = trimIndentation(output);
|
|
1457
|
+
if (trimmed) {
|
|
1458
|
+
settledOutput.push(trimmed);
|
|
1459
|
+
settledTextLength += trimmed.length;
|
|
1460
|
+
}
|
|
1461
|
+
output = "";
|
|
1462
|
+
position -= count;
|
|
1463
|
+
if (cursorPositions.length > 0) {
|
|
1464
|
+
settledCursorPositions.push(...cursorPositions.map((position2) => Math.min(position2, settledTextLength)));
|
|
1465
|
+
cursorPositions.length = 0;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1502
1468
|
}
|
|
1503
1469
|
|
|
1504
1470
|
// src/document/public.js
|
|
@@ -1528,7 +1494,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1528
1494
|
literallineWithoutBreakParent,
|
|
1529
1495
|
label,
|
|
1530
1496
|
// TODO: Remove this in v4
|
|
1531
|
-
concat: (parts) => parts
|
|
1497
|
+
concat: (parts) => parts
|
|
1532
1498
|
};
|
|
1533
1499
|
var printer = { printDocToString };
|
|
1534
1500
|
var utils = {
|
|
@@ -1539,7 +1505,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1539
1505
|
removeLines,
|
|
1540
1506
|
stripTrailingHardline,
|
|
1541
1507
|
replaceEndOfLine,
|
|
1542
|
-
canBreak
|
|
1508
|
+
canBreak
|
|
1543
1509
|
};
|
|
1544
1510
|
return __toCommonJS(public_exports);
|
|
1545
|
-
});
|
|
1511
|
+
});
|