dorian 2.4.0 → 2.5.0

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