@typespec/prettier-plugin-typespec 0.47.0-dev.0 → 0.47.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,934 +1,321 @@
1
1
  'use strict';
2
2
 
3
- var prettier = require('prettier');
3
+ /**
4
+ * AST types
5
+ */
6
+ var SyntaxKind;
7
+ (function (SyntaxKind) {
8
+ SyntaxKind[SyntaxKind["TypeSpecScript"] = 0] = "TypeSpecScript";
9
+ /** @deprecated Use TypeSpecScript */
10
+ SyntaxKind[SyntaxKind["CadlScript"] = 0] = "CadlScript";
11
+ SyntaxKind[SyntaxKind["JsSourceFile"] = 1] = "JsSourceFile";
12
+ SyntaxKind[SyntaxKind["ImportStatement"] = 2] = "ImportStatement";
13
+ SyntaxKind[SyntaxKind["Identifier"] = 3] = "Identifier";
14
+ SyntaxKind[SyntaxKind["AugmentDecoratorStatement"] = 4] = "AugmentDecoratorStatement";
15
+ SyntaxKind[SyntaxKind["DecoratorExpression"] = 5] = "DecoratorExpression";
16
+ SyntaxKind[SyntaxKind["DirectiveExpression"] = 6] = "DirectiveExpression";
17
+ SyntaxKind[SyntaxKind["MemberExpression"] = 7] = "MemberExpression";
18
+ SyntaxKind[SyntaxKind["NamespaceStatement"] = 8] = "NamespaceStatement";
19
+ SyntaxKind[SyntaxKind["UsingStatement"] = 9] = "UsingStatement";
20
+ SyntaxKind[SyntaxKind["OperationStatement"] = 10] = "OperationStatement";
21
+ SyntaxKind[SyntaxKind["OperationSignatureDeclaration"] = 11] = "OperationSignatureDeclaration";
22
+ SyntaxKind[SyntaxKind["OperationSignatureReference"] = 12] = "OperationSignatureReference";
23
+ SyntaxKind[SyntaxKind["ModelStatement"] = 13] = "ModelStatement";
24
+ SyntaxKind[SyntaxKind["ModelExpression"] = 14] = "ModelExpression";
25
+ SyntaxKind[SyntaxKind["ModelProperty"] = 15] = "ModelProperty";
26
+ SyntaxKind[SyntaxKind["ModelSpreadProperty"] = 16] = "ModelSpreadProperty";
27
+ SyntaxKind[SyntaxKind["ScalarStatement"] = 17] = "ScalarStatement";
28
+ SyntaxKind[SyntaxKind["InterfaceStatement"] = 18] = "InterfaceStatement";
29
+ SyntaxKind[SyntaxKind["UnionStatement"] = 19] = "UnionStatement";
30
+ SyntaxKind[SyntaxKind["UnionVariant"] = 20] = "UnionVariant";
31
+ SyntaxKind[SyntaxKind["EnumStatement"] = 21] = "EnumStatement";
32
+ SyntaxKind[SyntaxKind["EnumMember"] = 22] = "EnumMember";
33
+ SyntaxKind[SyntaxKind["EnumSpreadMember"] = 23] = "EnumSpreadMember";
34
+ SyntaxKind[SyntaxKind["AliasStatement"] = 24] = "AliasStatement";
35
+ SyntaxKind[SyntaxKind["DecoratorDeclarationStatement"] = 25] = "DecoratorDeclarationStatement";
36
+ SyntaxKind[SyntaxKind["FunctionDeclarationStatement"] = 26] = "FunctionDeclarationStatement";
37
+ SyntaxKind[SyntaxKind["FunctionParameter"] = 27] = "FunctionParameter";
38
+ SyntaxKind[SyntaxKind["UnionExpression"] = 28] = "UnionExpression";
39
+ SyntaxKind[SyntaxKind["IntersectionExpression"] = 29] = "IntersectionExpression";
40
+ SyntaxKind[SyntaxKind["TupleExpression"] = 30] = "TupleExpression";
41
+ SyntaxKind[SyntaxKind["ArrayExpression"] = 31] = "ArrayExpression";
42
+ SyntaxKind[SyntaxKind["StringLiteral"] = 32] = "StringLiteral";
43
+ SyntaxKind[SyntaxKind["NumericLiteral"] = 33] = "NumericLiteral";
44
+ SyntaxKind[SyntaxKind["BooleanLiteral"] = 34] = "BooleanLiteral";
45
+ SyntaxKind[SyntaxKind["ExternKeyword"] = 35] = "ExternKeyword";
46
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 36] = "VoidKeyword";
47
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 37] = "NeverKeyword";
48
+ SyntaxKind[SyntaxKind["UnknownKeyword"] = 38] = "UnknownKeyword";
49
+ SyntaxKind[SyntaxKind["ValueOfExpression"] = 39] = "ValueOfExpression";
50
+ SyntaxKind[SyntaxKind["TypeReference"] = 40] = "TypeReference";
51
+ SyntaxKind[SyntaxKind["ProjectionReference"] = 41] = "ProjectionReference";
52
+ SyntaxKind[SyntaxKind["TemplateParameterDeclaration"] = 42] = "TemplateParameterDeclaration";
53
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 43] = "EmptyStatement";
54
+ SyntaxKind[SyntaxKind["InvalidStatement"] = 44] = "InvalidStatement";
55
+ SyntaxKind[SyntaxKind["LineComment"] = 45] = "LineComment";
56
+ SyntaxKind[SyntaxKind["BlockComment"] = 46] = "BlockComment";
57
+ SyntaxKind[SyntaxKind["Doc"] = 47] = "Doc";
58
+ SyntaxKind[SyntaxKind["DocText"] = 48] = "DocText";
59
+ SyntaxKind[SyntaxKind["DocParamTag"] = 49] = "DocParamTag";
60
+ SyntaxKind[SyntaxKind["DocReturnsTag"] = 50] = "DocReturnsTag";
61
+ SyntaxKind[SyntaxKind["DocTemplateTag"] = 51] = "DocTemplateTag";
62
+ SyntaxKind[SyntaxKind["DocUnknownTag"] = 52] = "DocUnknownTag";
63
+ SyntaxKind[SyntaxKind["Projection"] = 53] = "Projection";
64
+ SyntaxKind[SyntaxKind["ProjectionParameterDeclaration"] = 54] = "ProjectionParameterDeclaration";
65
+ SyntaxKind[SyntaxKind["ProjectionModelSelector"] = 55] = "ProjectionModelSelector";
66
+ SyntaxKind[SyntaxKind["ProjectionModelPropertySelector"] = 56] = "ProjectionModelPropertySelector";
67
+ SyntaxKind[SyntaxKind["ProjectionOperationSelector"] = 57] = "ProjectionOperationSelector";
68
+ SyntaxKind[SyntaxKind["ProjectionUnionSelector"] = 58] = "ProjectionUnionSelector";
69
+ SyntaxKind[SyntaxKind["ProjectionUnionVariantSelector"] = 59] = "ProjectionUnionVariantSelector";
70
+ SyntaxKind[SyntaxKind["ProjectionInterfaceSelector"] = 60] = "ProjectionInterfaceSelector";
71
+ SyntaxKind[SyntaxKind["ProjectionEnumSelector"] = 61] = "ProjectionEnumSelector";
72
+ SyntaxKind[SyntaxKind["ProjectionEnumMemberSelector"] = 62] = "ProjectionEnumMemberSelector";
73
+ SyntaxKind[SyntaxKind["ProjectionExpressionStatement"] = 63] = "ProjectionExpressionStatement";
74
+ SyntaxKind[SyntaxKind["ProjectionIfExpression"] = 64] = "ProjectionIfExpression";
75
+ SyntaxKind[SyntaxKind["ProjectionBlockExpression"] = 65] = "ProjectionBlockExpression";
76
+ SyntaxKind[SyntaxKind["ProjectionMemberExpression"] = 66] = "ProjectionMemberExpression";
77
+ SyntaxKind[SyntaxKind["ProjectionLogicalExpression"] = 67] = "ProjectionLogicalExpression";
78
+ SyntaxKind[SyntaxKind["ProjectionEqualityExpression"] = 68] = "ProjectionEqualityExpression";
79
+ SyntaxKind[SyntaxKind["ProjectionUnaryExpression"] = 69] = "ProjectionUnaryExpression";
80
+ SyntaxKind[SyntaxKind["ProjectionRelationalExpression"] = 70] = "ProjectionRelationalExpression";
81
+ SyntaxKind[SyntaxKind["ProjectionArithmeticExpression"] = 71] = "ProjectionArithmeticExpression";
82
+ SyntaxKind[SyntaxKind["ProjectionCallExpression"] = 72] = "ProjectionCallExpression";
83
+ SyntaxKind[SyntaxKind["ProjectionLambdaExpression"] = 73] = "ProjectionLambdaExpression";
84
+ SyntaxKind[SyntaxKind["ProjectionLambdaParameterDeclaration"] = 74] = "ProjectionLambdaParameterDeclaration";
85
+ SyntaxKind[SyntaxKind["ProjectionModelExpression"] = 75] = "ProjectionModelExpression";
86
+ SyntaxKind[SyntaxKind["ProjectionModelProperty"] = 76] = "ProjectionModelProperty";
87
+ SyntaxKind[SyntaxKind["ProjectionModelSpreadProperty"] = 77] = "ProjectionModelSpreadProperty";
88
+ SyntaxKind[SyntaxKind["ProjectionSpreadProperty"] = 78] = "ProjectionSpreadProperty";
89
+ SyntaxKind[SyntaxKind["ProjectionTupleExpression"] = 79] = "ProjectionTupleExpression";
90
+ SyntaxKind[SyntaxKind["ProjectionStatement"] = 80] = "ProjectionStatement";
91
+ SyntaxKind[SyntaxKind["ProjectionDecoratorReferenceExpression"] = 81] = "ProjectionDecoratorReferenceExpression";
92
+ SyntaxKind[SyntaxKind["Return"] = 82] = "Return";
93
+ })(SyntaxKind || (SyntaxKind = {}));
94
+ var IdentifierKind;
95
+ (function (IdentifierKind) {
96
+ IdentifierKind[IdentifierKind["TypeReference"] = 0] = "TypeReference";
97
+ IdentifierKind[IdentifierKind["Decorator"] = 1] = "Decorator";
98
+ IdentifierKind[IdentifierKind["Function"] = 2] = "Function";
99
+ IdentifierKind[IdentifierKind["Using"] = 3] = "Using";
100
+ IdentifierKind[IdentifierKind["Declaration"] = 4] = "Declaration";
101
+ IdentifierKind[IdentifierKind["Other"] = 5] = "Other";
102
+ })(IdentifierKind || (IdentifierKind = {}));
103
+ const NoTarget = Symbol.for("NoTarget");
104
+ var ListenerFlow;
105
+ (function (ListenerFlow) {
106
+ /**
107
+ * Do not navigate any containing or referenced type.
108
+ */
109
+ ListenerFlow[ListenerFlow["NoRecursion"] = 1] = "NoRecursion";
110
+ })(ListenerFlow || (ListenerFlow = {}));
4
111
 
5
- //
6
- // Generated by scripts/regen-nonascii-map.js
7
- // on node v18.16.0 with unicode 15.0.
8
- //
9
112
  /**
10
- * @internal
113
+ * Create a new diagnostics creator.
114
+ * @param diagnostics Map of the potential diagnostics.
115
+ * @param libraryName Optional name of the library if in the scope of a library.
116
+ * @returns @see DiagnosticCreator
117
+ */
118
+ function createDiagnosticCreator(diagnostics, libraryName) {
119
+ const errorMessage = libraryName
120
+ ? `It must match one of the code defined in the library '${libraryName}'`
121
+ : "It must match one of the code defined in the compiler.";
122
+ function createDiagnostic(diagnostic) {
123
+ var _a;
124
+ const diagnosticDef = diagnostics[diagnostic.code];
125
+ if (!diagnosticDef) {
126
+ const codeStr = Object.keys(diagnostics)
127
+ .map((x) => ` - ${x}`)
128
+ .join("\n");
129
+ const code = String(diagnostic.code);
130
+ throw new Error(`Unexpected diagnostic code '${code}'. ${errorMessage}. Defined codes:\n${codeStr}`);
131
+ }
132
+ const message = diagnosticDef.messages[(_a = diagnostic.messageId) !== null && _a !== void 0 ? _a : "default"];
133
+ if (!message) {
134
+ const codeStr = Object.keys(diagnosticDef.messages)
135
+ .map((x) => ` - ${x}`)
136
+ .join("\n");
137
+ const messageId = String(diagnostic.messageId);
138
+ const code = String(diagnostic.code);
139
+ throw new Error(`Unexpected message id '${messageId}'. ${errorMessage} for code '${code}'. Defined codes:\n${codeStr}`);
140
+ }
141
+ const messageStr = typeof message === "string" ? message : message(diagnostic.format);
142
+ return {
143
+ code: libraryName ? `${libraryName}/${String(diagnostic.code)}` : diagnostic.code.toString(),
144
+ severity: diagnosticDef.severity,
145
+ message: messageStr,
146
+ target: diagnostic.target,
147
+ };
148
+ }
149
+ function reportDiagnostic(program, diagnostic) {
150
+ const diag = createDiagnostic(diagnostic);
151
+ program.reportDiagnostic(diag);
152
+ }
153
+ return {
154
+ diagnostics,
155
+ createDiagnostic,
156
+ reportDiagnostic,
157
+ };
158
+ }
159
+ function createSourceFile(text, path) {
160
+ let lineStarts = undefined;
161
+ return {
162
+ text,
163
+ path,
164
+ getLineStarts,
165
+ getLineAndCharacterOfPosition,
166
+ };
167
+ function getLineStarts() {
168
+ return (lineStarts = lineStarts !== null && lineStarts !== void 0 ? lineStarts : scanLineStarts(text));
169
+ }
170
+ function getLineAndCharacterOfPosition(position) {
171
+ const starts = getLineStarts();
172
+ let line = binarySearch(starts, position);
173
+ // When binarySearch returns < 0 indicating that the value was not found, it
174
+ // returns the bitwise complement of the index where the value would need to
175
+ // be inserted to keep the array sorted. So flipping the bits back to this
176
+ // positive index tells us what the line number would be if we were to
177
+ // create a new line starting at the given position, and subtracting 1 from
178
+ // that therefore gives us the line number we're after.
179
+ if (line < 0) {
180
+ line = ~line - 1;
181
+ }
182
+ return {
183
+ line,
184
+ character: position - starts[line],
185
+ };
186
+ }
187
+ }
188
+ function getSourceLocation(target) {
189
+ if (target === NoTarget || target === undefined) {
190
+ return undefined;
191
+ }
192
+ if ("file" in target) {
193
+ return target;
194
+ }
195
+ if (!("kind" in target)) {
196
+ // symbol
197
+ if (target.flags & 524288 /* SymbolFlags.Using */) {
198
+ target = target.symbolSource;
199
+ }
200
+ if (!target.declarations[0]) {
201
+ return createSyntheticSourceLocation();
202
+ }
203
+ return getSourceLocationOfNode(target.declarations[0]);
204
+ }
205
+ else if (typeof target.kind === "number") {
206
+ // node
207
+ return getSourceLocationOfNode(target);
208
+ }
209
+ else {
210
+ // type
211
+ const targetNode = target.node;
212
+ if (targetNode) {
213
+ return getSourceLocationOfNode(targetNode);
214
+ }
215
+ return createSyntheticSourceLocation();
216
+ }
217
+ }
218
+ function createSyntheticSourceLocation(loc = "<unknown location>") {
219
+ return {
220
+ file: createSourceFile("", loc),
221
+ pos: 0,
222
+ end: 0,
223
+ isSynthetic: true,
224
+ };
225
+ }
226
+ function getSourceLocationOfNode(node) {
227
+ let root = node;
228
+ while (root.parent !== undefined) {
229
+ root = root.parent;
230
+ }
231
+ if (root.kind !== SyntaxKind.TypeSpecScript && root.kind !== SyntaxKind.JsSourceFile) {
232
+ return createSyntheticSourceLocation(node.flags & 8 /* NodeFlags.Synthetic */
233
+ ? undefined
234
+ : "<unknown location - cannot obtain source location of unbound node - file bug at https://github.com/microsoft/typespec>");
235
+ }
236
+ return {
237
+ file: root.file,
238
+ pos: node.pos,
239
+ end: node.end,
240
+ };
241
+ }
242
+ /**
243
+ * Use this to report bugs in the compiler, and not errors in the source code
244
+ * being compiled.
11
245
  *
12
- * Map of non-ascii characters that are valid in an identifier. Each pair of
13
- * numbers represents an inclusive range of code points.
246
+ * @param condition Throw if this is not true.
247
+ *
248
+ * @param message Error message.
249
+ *
250
+ * @param target Optional location in source code that might give a clue about
251
+ * what got the compiler off track.
14
252
  */
15
- //prettier-ignore
16
- const nonAsciiIdentifierMap = [
17
- 0xa0, 0x377,
18
- 0x37a, 0x37f,
19
- 0x384, 0x38a,
20
- 0x38c, 0x38c,
21
- 0x38e, 0x3a1,
22
- 0x3a3, 0x52f,
23
- 0x531, 0x556,
24
- 0x559, 0x58a,
25
- 0x58d, 0x58f,
26
- 0x591, 0x5c7,
27
- 0x5d0, 0x5ea,
28
- 0x5ef, 0x5f4,
29
- 0x600, 0x70d,
30
- 0x70f, 0x74a,
31
- 0x74d, 0x7b1,
32
- 0x7c0, 0x7fa,
33
- 0x7fd, 0x82d,
34
- 0x830, 0x83e,
35
- 0x840, 0x85b,
36
- 0x85e, 0x85e,
37
- 0x860, 0x86a,
38
- 0x870, 0x88e,
39
- 0x890, 0x891,
40
- 0x898, 0x983,
41
- 0x985, 0x98c,
42
- 0x98f, 0x990,
43
- 0x993, 0x9a8,
44
- 0x9aa, 0x9b0,
45
- 0x9b2, 0x9b2,
46
- 0x9b6, 0x9b9,
47
- 0x9bc, 0x9c4,
48
- 0x9c7, 0x9c8,
49
- 0x9cb, 0x9ce,
50
- 0x9d7, 0x9d7,
51
- 0x9dc, 0x9dd,
52
- 0x9df, 0x9e3,
53
- 0x9e6, 0x9fe,
54
- 0xa01, 0xa03,
55
- 0xa05, 0xa0a,
56
- 0xa0f, 0xa10,
57
- 0xa13, 0xa28,
58
- 0xa2a, 0xa30,
59
- 0xa32, 0xa33,
60
- 0xa35, 0xa36,
61
- 0xa38, 0xa39,
62
- 0xa3c, 0xa3c,
63
- 0xa3e, 0xa42,
64
- 0xa47, 0xa48,
65
- 0xa4b, 0xa4d,
66
- 0xa51, 0xa51,
67
- 0xa59, 0xa5c,
68
- 0xa5e, 0xa5e,
69
- 0xa66, 0xa76,
70
- 0xa81, 0xa83,
71
- 0xa85, 0xa8d,
72
- 0xa8f, 0xa91,
73
- 0xa93, 0xaa8,
74
- 0xaaa, 0xab0,
75
- 0xab2, 0xab3,
76
- 0xab5, 0xab9,
77
- 0xabc, 0xac5,
78
- 0xac7, 0xac9,
79
- 0xacb, 0xacd,
80
- 0xad0, 0xad0,
81
- 0xae0, 0xae3,
82
- 0xae6, 0xaf1,
83
- 0xaf9, 0xaff,
84
- 0xb01, 0xb03,
85
- 0xb05, 0xb0c,
86
- 0xb0f, 0xb10,
87
- 0xb13, 0xb28,
88
- 0xb2a, 0xb30,
89
- 0xb32, 0xb33,
90
- 0xb35, 0xb39,
91
- 0xb3c, 0xb44,
92
- 0xb47, 0xb48,
93
- 0xb4b, 0xb4d,
94
- 0xb55, 0xb57,
95
- 0xb5c, 0xb5d,
96
- 0xb5f, 0xb63,
97
- 0xb66, 0xb77,
98
- 0xb82, 0xb83,
99
- 0xb85, 0xb8a,
100
- 0xb8e, 0xb90,
101
- 0xb92, 0xb95,
102
- 0xb99, 0xb9a,
103
- 0xb9c, 0xb9c,
104
- 0xb9e, 0xb9f,
105
- 0xba3, 0xba4,
106
- 0xba8, 0xbaa,
107
- 0xbae, 0xbb9,
108
- 0xbbe, 0xbc2,
109
- 0xbc6, 0xbc8,
110
- 0xbca, 0xbcd,
111
- 0xbd0, 0xbd0,
112
- 0xbd7, 0xbd7,
113
- 0xbe6, 0xbfa,
114
- 0xc00, 0xc0c,
115
- 0xc0e, 0xc10,
116
- 0xc12, 0xc28,
117
- 0xc2a, 0xc39,
118
- 0xc3c, 0xc44,
119
- 0xc46, 0xc48,
120
- 0xc4a, 0xc4d,
121
- 0xc55, 0xc56,
122
- 0xc58, 0xc5a,
123
- 0xc5d, 0xc5d,
124
- 0xc60, 0xc63,
125
- 0xc66, 0xc6f,
126
- 0xc77, 0xc8c,
127
- 0xc8e, 0xc90,
128
- 0xc92, 0xca8,
129
- 0xcaa, 0xcb3,
130
- 0xcb5, 0xcb9,
131
- 0xcbc, 0xcc4,
132
- 0xcc6, 0xcc8,
133
- 0xcca, 0xccd,
134
- 0xcd5, 0xcd6,
135
- 0xcdd, 0xcde,
136
- 0xce0, 0xce3,
137
- 0xce6, 0xcef,
138
- 0xcf1, 0xcf3,
139
- 0xd00, 0xd0c,
140
- 0xd0e, 0xd10,
141
- 0xd12, 0xd44,
142
- 0xd46, 0xd48,
143
- 0xd4a, 0xd4f,
144
- 0xd54, 0xd63,
145
- 0xd66, 0xd7f,
146
- 0xd81, 0xd83,
147
- 0xd85, 0xd96,
148
- 0xd9a, 0xdb1,
149
- 0xdb3, 0xdbb,
150
- 0xdbd, 0xdbd,
151
- 0xdc0, 0xdc6,
152
- 0xdca, 0xdca,
153
- 0xdcf, 0xdd4,
154
- 0xdd6, 0xdd6,
155
- 0xdd8, 0xddf,
156
- 0xde6, 0xdef,
157
- 0xdf2, 0xdf4,
158
- 0xe01, 0xe3a,
159
- 0xe3f, 0xe5b,
160
- 0xe81, 0xe82,
161
- 0xe84, 0xe84,
162
- 0xe86, 0xe8a,
163
- 0xe8c, 0xea3,
164
- 0xea5, 0xea5,
165
- 0xea7, 0xebd,
166
- 0xec0, 0xec4,
167
- 0xec6, 0xec6,
168
- 0xec8, 0xece,
169
- 0xed0, 0xed9,
170
- 0xedc, 0xedf,
171
- 0xf00, 0xf47,
172
- 0xf49, 0xf6c,
173
- 0xf71, 0xf97,
174
- 0xf99, 0xfbc,
175
- 0xfbe, 0xfcc,
176
- 0xfce, 0xfda,
177
- 0x1000, 0x10c5,
178
- 0x10c7, 0x10c7,
179
- 0x10cd, 0x10cd,
180
- 0x10d0, 0x1248,
181
- 0x124a, 0x124d,
182
- 0x1250, 0x1256,
183
- 0x1258, 0x1258,
184
- 0x125a, 0x125d,
185
- 0x1260, 0x1288,
186
- 0x128a, 0x128d,
187
- 0x1290, 0x12b0,
188
- 0x12b2, 0x12b5,
189
- 0x12b8, 0x12be,
190
- 0x12c0, 0x12c0,
191
- 0x12c2, 0x12c5,
192
- 0x12c8, 0x12d6,
193
- 0x12d8, 0x1310,
194
- 0x1312, 0x1315,
195
- 0x1318, 0x135a,
196
- 0x135d, 0x137c,
197
- 0x1380, 0x1399,
198
- 0x13a0, 0x13f5,
199
- 0x13f8, 0x13fd,
200
- 0x1400, 0x169c,
201
- 0x16a0, 0x16f8,
202
- 0x1700, 0x1715,
203
- 0x171f, 0x1736,
204
- 0x1740, 0x1753,
205
- 0x1760, 0x176c,
206
- 0x176e, 0x1770,
207
- 0x1772, 0x1773,
208
- 0x1780, 0x17dd,
209
- 0x17e0, 0x17e9,
210
- 0x17f0, 0x17f9,
211
- 0x1800, 0x1819,
212
- 0x1820, 0x1878,
213
- 0x1880, 0x18aa,
214
- 0x18b0, 0x18f5,
215
- 0x1900, 0x191e,
216
- 0x1920, 0x192b,
217
- 0x1930, 0x193b,
218
- 0x1940, 0x1940,
219
- 0x1944, 0x196d,
220
- 0x1970, 0x1974,
221
- 0x1980, 0x19ab,
222
- 0x19b0, 0x19c9,
223
- 0x19d0, 0x19da,
224
- 0x19de, 0x1a1b,
225
- 0x1a1e, 0x1a5e,
226
- 0x1a60, 0x1a7c,
227
- 0x1a7f, 0x1a89,
228
- 0x1a90, 0x1a99,
229
- 0x1aa0, 0x1aad,
230
- 0x1ab0, 0x1ace,
231
- 0x1b00, 0x1b4c,
232
- 0x1b50, 0x1b7e,
233
- 0x1b80, 0x1bf3,
234
- 0x1bfc, 0x1c37,
235
- 0x1c3b, 0x1c49,
236
- 0x1c4d, 0x1c88,
237
- 0x1c90, 0x1cba,
238
- 0x1cbd, 0x1cc7,
239
- 0x1cd0, 0x1cfa,
240
- 0x1d00, 0x1f15,
241
- 0x1f18, 0x1f1d,
242
- 0x1f20, 0x1f45,
243
- 0x1f48, 0x1f4d,
244
- 0x1f50, 0x1f57,
245
- 0x1f59, 0x1f59,
246
- 0x1f5b, 0x1f5b,
247
- 0x1f5d, 0x1f5d,
248
- 0x1f5f, 0x1f7d,
249
- 0x1f80, 0x1fb4,
250
- 0x1fb6, 0x1fc4,
251
- 0x1fc6, 0x1fd3,
252
- 0x1fd6, 0x1fdb,
253
- 0x1fdd, 0x1fef,
254
- 0x1ff2, 0x1ff4,
255
- 0x1ff6, 0x1ffe,
256
- 0x2000, 0x200d,
257
- 0x2010, 0x2027,
258
- 0x202a, 0x2064,
259
- 0x2066, 0x2071,
260
- 0x2074, 0x208e,
261
- 0x2090, 0x209c,
262
- 0x20a0, 0x20c0,
263
- 0x20d0, 0x20f0,
264
- 0x2100, 0x218b,
265
- 0x2190, 0x2426,
266
- 0x2440, 0x244a,
267
- 0x2460, 0x2b73,
268
- 0x2b76, 0x2b95,
269
- 0x2b97, 0x2cf3,
270
- 0x2cf9, 0x2d25,
271
- 0x2d27, 0x2d27,
272
- 0x2d2d, 0x2d2d,
273
- 0x2d30, 0x2d67,
274
- 0x2d6f, 0x2d70,
275
- 0x2d7f, 0x2d96,
276
- 0x2da0, 0x2da6,
277
- 0x2da8, 0x2dae,
278
- 0x2db0, 0x2db6,
279
- 0x2db8, 0x2dbe,
280
- 0x2dc0, 0x2dc6,
281
- 0x2dc8, 0x2dce,
282
- 0x2dd0, 0x2dd6,
283
- 0x2dd8, 0x2dde,
284
- 0x2de0, 0x2e5d,
285
- 0x2e80, 0x2e99,
286
- 0x2e9b, 0x2ef3,
287
- 0x2f00, 0x2fd5,
288
- 0x2ff0, 0x2ffb,
289
- 0x3000, 0x303f,
290
- 0x3041, 0x3096,
291
- 0x3099, 0x30ff,
292
- 0x3105, 0x312f,
293
- 0x3131, 0x318e,
294
- 0x3190, 0x31e3,
295
- 0x31f0, 0x321e,
296
- 0x3220, 0xa48c,
297
- 0xa490, 0xa4c6,
298
- 0xa4d0, 0xa62b,
299
- 0xa640, 0xa6f7,
300
- 0xa700, 0xa7ca,
301
- 0xa7d0, 0xa7d1,
302
- 0xa7d3, 0xa7d3,
303
- 0xa7d5, 0xa7d9,
304
- 0xa7f2, 0xa82c,
305
- 0xa830, 0xa839,
306
- 0xa840, 0xa877,
307
- 0xa880, 0xa8c5,
308
- 0xa8ce, 0xa8d9,
309
- 0xa8e0, 0xa953,
310
- 0xa95f, 0xa97c,
311
- 0xa980, 0xa9cd,
312
- 0xa9cf, 0xa9d9,
313
- 0xa9de, 0xa9fe,
314
- 0xaa00, 0xaa36,
315
- 0xaa40, 0xaa4d,
316
- 0xaa50, 0xaa59,
317
- 0xaa5c, 0xaac2,
318
- 0xaadb, 0xaaf6,
319
- 0xab01, 0xab06,
320
- 0xab09, 0xab0e,
321
- 0xab11, 0xab16,
322
- 0xab20, 0xab26,
323
- 0xab28, 0xab2e,
324
- 0xab30, 0xab6b,
325
- 0xab70, 0xabed,
326
- 0xabf0, 0xabf9,
327
- 0xac00, 0xd7a3,
328
- 0xd7b0, 0xd7c6,
329
- 0xd7cb, 0xd7fb,
330
- 0xf900, 0xfa6d,
331
- 0xfa70, 0xfad9,
332
- 0xfb00, 0xfb06,
333
- 0xfb13, 0xfb17,
334
- 0xfb1d, 0xfb36,
335
- 0xfb38, 0xfb3c,
336
- 0xfb3e, 0xfb3e,
337
- 0xfb40, 0xfb41,
338
- 0xfb43, 0xfb44,
339
- 0xfb46, 0xfbc2,
340
- 0xfbd3, 0xfd8f,
341
- 0xfd92, 0xfdc7,
342
- 0xfdcf, 0xfdcf,
343
- 0xfdf0, 0xfe19,
344
- 0xfe20, 0xfe52,
345
- 0xfe54, 0xfe66,
346
- 0xfe68, 0xfe6b,
347
- 0xfe70, 0xfe74,
348
- 0xfe76, 0xfefc,
349
- 0xfeff, 0xfeff,
350
- 0xff01, 0xffbe,
351
- 0xffc2, 0xffc7,
352
- 0xffca, 0xffcf,
353
- 0xffd2, 0xffd7,
354
- 0xffda, 0xffdc,
355
- 0xffe0, 0xffe6,
356
- 0xffe8, 0xffee,
357
- 0xfff9, 0xfffc,
358
- 0x10000, 0x1000b,
359
- 0x1000d, 0x10026,
360
- 0x10028, 0x1003a,
361
- 0x1003c, 0x1003d,
362
- 0x1003f, 0x1004d,
363
- 0x10050, 0x1005d,
364
- 0x10080, 0x100fa,
365
- 0x10100, 0x10102,
366
- 0x10107, 0x10133,
367
- 0x10137, 0x1018e,
368
- 0x10190, 0x1019c,
369
- 0x101a0, 0x101a0,
370
- 0x101d0, 0x101fd,
371
- 0x10280, 0x1029c,
372
- 0x102a0, 0x102d0,
373
- 0x102e0, 0x102fb,
374
- 0x10300, 0x10323,
375
- 0x1032d, 0x1034a,
376
- 0x10350, 0x1037a,
377
- 0x10380, 0x1039d,
378
- 0x1039f, 0x103c3,
379
- 0x103c8, 0x103d5,
380
- 0x10400, 0x1049d,
381
- 0x104a0, 0x104a9,
382
- 0x104b0, 0x104d3,
383
- 0x104d8, 0x104fb,
384
- 0x10500, 0x10527,
385
- 0x10530, 0x10563,
386
- 0x1056f, 0x1057a,
387
- 0x1057c, 0x1058a,
388
- 0x1058c, 0x10592,
389
- 0x10594, 0x10595,
390
- 0x10597, 0x105a1,
391
- 0x105a3, 0x105b1,
392
- 0x105b3, 0x105b9,
393
- 0x105bb, 0x105bc,
394
- 0x10600, 0x10736,
395
- 0x10740, 0x10755,
396
- 0x10760, 0x10767,
397
- 0x10780, 0x10785,
398
- 0x10787, 0x107b0,
399
- 0x107b2, 0x107ba,
400
- 0x10800, 0x10805,
401
- 0x10808, 0x10808,
402
- 0x1080a, 0x10835,
403
- 0x10837, 0x10838,
404
- 0x1083c, 0x1083c,
405
- 0x1083f, 0x10855,
406
- 0x10857, 0x1089e,
407
- 0x108a7, 0x108af,
408
- 0x108e0, 0x108f2,
409
- 0x108f4, 0x108f5,
410
- 0x108fb, 0x1091b,
411
- 0x1091f, 0x10939,
412
- 0x1093f, 0x1093f,
413
- 0x10980, 0x109b7,
414
- 0x109bc, 0x109cf,
415
- 0x109d2, 0x10a03,
416
- 0x10a05, 0x10a06,
417
- 0x10a0c, 0x10a13,
418
- 0x10a15, 0x10a17,
419
- 0x10a19, 0x10a35,
420
- 0x10a38, 0x10a3a,
421
- 0x10a3f, 0x10a48,
422
- 0x10a50, 0x10a58,
423
- 0x10a60, 0x10a9f,
424
- 0x10ac0, 0x10ae6,
425
- 0x10aeb, 0x10af6,
426
- 0x10b00, 0x10b35,
427
- 0x10b39, 0x10b55,
428
- 0x10b58, 0x10b72,
429
- 0x10b78, 0x10b91,
430
- 0x10b99, 0x10b9c,
431
- 0x10ba9, 0x10baf,
432
- 0x10c00, 0x10c48,
433
- 0x10c80, 0x10cb2,
434
- 0x10cc0, 0x10cf2,
435
- 0x10cfa, 0x10d27,
436
- 0x10d30, 0x10d39,
437
- 0x10e60, 0x10e7e,
438
- 0x10e80, 0x10ea9,
439
- 0x10eab, 0x10ead,
440
- 0x10eb0, 0x10eb1,
441
- 0x10efd, 0x10f27,
442
- 0x10f30, 0x10f59,
443
- 0x10f70, 0x10f89,
444
- 0x10fb0, 0x10fcb,
445
- 0x10fe0, 0x10ff6,
446
- 0x11000, 0x1104d,
447
- 0x11052, 0x11075,
448
- 0x1107f, 0x110c2,
449
- 0x110cd, 0x110cd,
450
- 0x110d0, 0x110e8,
451
- 0x110f0, 0x110f9,
452
- 0x11100, 0x11134,
453
- 0x11136, 0x11147,
454
- 0x11150, 0x11176,
455
- 0x11180, 0x111df,
456
- 0x111e1, 0x111f4,
457
- 0x11200, 0x11211,
458
- 0x11213, 0x11241,
459
- 0x11280, 0x11286,
460
- 0x11288, 0x11288,
461
- 0x1128a, 0x1128d,
462
- 0x1128f, 0x1129d,
463
- 0x1129f, 0x112a9,
464
- 0x112b0, 0x112ea,
465
- 0x112f0, 0x112f9,
466
- 0x11300, 0x11303,
467
- 0x11305, 0x1130c,
468
- 0x1130f, 0x11310,
469
- 0x11313, 0x11328,
470
- 0x1132a, 0x11330,
471
- 0x11332, 0x11333,
472
- 0x11335, 0x11339,
473
- 0x1133b, 0x11344,
474
- 0x11347, 0x11348,
475
- 0x1134b, 0x1134d,
476
- 0x11350, 0x11350,
477
- 0x11357, 0x11357,
478
- 0x1135d, 0x11363,
479
- 0x11366, 0x1136c,
480
- 0x11370, 0x11374,
481
- 0x11400, 0x1145b,
482
- 0x1145d, 0x11461,
483
- 0x11480, 0x114c7,
484
- 0x114d0, 0x114d9,
485
- 0x11580, 0x115b5,
486
- 0x115b8, 0x115dd,
487
- 0x11600, 0x11644,
488
- 0x11650, 0x11659,
489
- 0x11660, 0x1166c,
490
- 0x11680, 0x116b9,
491
- 0x116c0, 0x116c9,
492
- 0x11700, 0x1171a,
493
- 0x1171d, 0x1172b,
494
- 0x11730, 0x11746,
495
- 0x11800, 0x1183b,
496
- 0x118a0, 0x118f2,
497
- 0x118ff, 0x11906,
498
- 0x11909, 0x11909,
499
- 0x1190c, 0x11913,
500
- 0x11915, 0x11916,
501
- 0x11918, 0x11935,
502
- 0x11937, 0x11938,
503
- 0x1193b, 0x11946,
504
- 0x11950, 0x11959,
505
- 0x119a0, 0x119a7,
506
- 0x119aa, 0x119d7,
507
- 0x119da, 0x119e4,
508
- 0x11a00, 0x11a47,
509
- 0x11a50, 0x11aa2,
510
- 0x11ab0, 0x11af8,
511
- 0x11b00, 0x11b09,
512
- 0x11c00, 0x11c08,
513
- 0x11c0a, 0x11c36,
514
- 0x11c38, 0x11c45,
515
- 0x11c50, 0x11c6c,
516
- 0x11c70, 0x11c8f,
517
- 0x11c92, 0x11ca7,
518
- 0x11ca9, 0x11cb6,
519
- 0x11d00, 0x11d06,
520
- 0x11d08, 0x11d09,
521
- 0x11d0b, 0x11d36,
522
- 0x11d3a, 0x11d3a,
523
- 0x11d3c, 0x11d3d,
524
- 0x11d3f, 0x11d47,
525
- 0x11d50, 0x11d59,
526
- 0x11d60, 0x11d65,
527
- 0x11d67, 0x11d68,
528
- 0x11d6a, 0x11d8e,
529
- 0x11d90, 0x11d91,
530
- 0x11d93, 0x11d98,
531
- 0x11da0, 0x11da9,
532
- 0x11ee0, 0x11ef8,
533
- 0x11f00, 0x11f10,
534
- 0x11f12, 0x11f3a,
535
- 0x11f3e, 0x11f59,
536
- 0x11fb0, 0x11fb0,
537
- 0x11fc0, 0x11ff1,
538
- 0x11fff, 0x12399,
539
- 0x12400, 0x1246e,
540
- 0x12470, 0x12474,
541
- 0x12480, 0x12543,
542
- 0x12f90, 0x12ff2,
543
- 0x13000, 0x13455,
544
- 0x14400, 0x14646,
545
- 0x16800, 0x16a38,
546
- 0x16a40, 0x16a5e,
547
- 0x16a60, 0x16a69,
548
- 0x16a6e, 0x16abe,
549
- 0x16ac0, 0x16ac9,
550
- 0x16ad0, 0x16aed,
551
- 0x16af0, 0x16af5,
552
- 0x16b00, 0x16b45,
553
- 0x16b50, 0x16b59,
554
- 0x16b5b, 0x16b61,
555
- 0x16b63, 0x16b77,
556
- 0x16b7d, 0x16b8f,
557
- 0x16e40, 0x16e9a,
558
- 0x16f00, 0x16f4a,
559
- 0x16f4f, 0x16f87,
560
- 0x16f8f, 0x16f9f,
561
- 0x16fe0, 0x16fe4,
562
- 0x16ff0, 0x16ff1,
563
- 0x17000, 0x187f7,
564
- 0x18800, 0x18cd5,
565
- 0x18d00, 0x18d08,
566
- 0x1aff0, 0x1aff3,
567
- 0x1aff5, 0x1affb,
568
- 0x1affd, 0x1affe,
569
- 0x1b000, 0x1b122,
570
- 0x1b132, 0x1b132,
571
- 0x1b150, 0x1b152,
572
- 0x1b155, 0x1b155,
573
- 0x1b164, 0x1b167,
574
- 0x1b170, 0x1b2fb,
575
- 0x1bc00, 0x1bc6a,
576
- 0x1bc70, 0x1bc7c,
577
- 0x1bc80, 0x1bc88,
578
- 0x1bc90, 0x1bc99,
579
- 0x1bc9c, 0x1bca3,
580
- 0x1cf00, 0x1cf2d,
581
- 0x1cf30, 0x1cf46,
582
- 0x1cf50, 0x1cfc3,
583
- 0x1d000, 0x1d0f5,
584
- 0x1d100, 0x1d126,
585
- 0x1d129, 0x1d1ea,
586
- 0x1d200, 0x1d245,
587
- 0x1d2c0, 0x1d2d3,
588
- 0x1d2e0, 0x1d2f3,
589
- 0x1d300, 0x1d356,
590
- 0x1d360, 0x1d378,
591
- 0x1d400, 0x1d454,
592
- 0x1d456, 0x1d49c,
593
- 0x1d49e, 0x1d49f,
594
- 0x1d4a2, 0x1d4a2,
595
- 0x1d4a5, 0x1d4a6,
596
- 0x1d4a9, 0x1d4ac,
597
- 0x1d4ae, 0x1d4b9,
598
- 0x1d4bb, 0x1d4bb,
599
- 0x1d4bd, 0x1d4c3,
600
- 0x1d4c5, 0x1d505,
601
- 0x1d507, 0x1d50a,
602
- 0x1d50d, 0x1d514,
603
- 0x1d516, 0x1d51c,
604
- 0x1d51e, 0x1d539,
605
- 0x1d53b, 0x1d53e,
606
- 0x1d540, 0x1d544,
607
- 0x1d546, 0x1d546,
608
- 0x1d54a, 0x1d550,
609
- 0x1d552, 0x1d6a5,
610
- 0x1d6a8, 0x1d7cb,
611
- 0x1d7ce, 0x1da8b,
612
- 0x1da9b, 0x1da9f,
613
- 0x1daa1, 0x1daaf,
614
- 0x1df00, 0x1df1e,
615
- 0x1df25, 0x1df2a,
616
- 0x1e000, 0x1e006,
617
- 0x1e008, 0x1e018,
618
- 0x1e01b, 0x1e021,
619
- 0x1e023, 0x1e024,
620
- 0x1e026, 0x1e02a,
621
- 0x1e030, 0x1e06d,
622
- 0x1e08f, 0x1e08f,
623
- 0x1e100, 0x1e12c,
624
- 0x1e130, 0x1e13d,
625
- 0x1e140, 0x1e149,
626
- 0x1e14e, 0x1e14f,
627
- 0x1e290, 0x1e2ae,
628
- 0x1e2c0, 0x1e2f9,
629
- 0x1e2ff, 0x1e2ff,
630
- 0x1e4d0, 0x1e4f9,
631
- 0x1e7e0, 0x1e7e6,
632
- 0x1e7e8, 0x1e7eb,
633
- 0x1e7ed, 0x1e7ee,
634
- 0x1e7f0, 0x1e7fe,
635
- 0x1e800, 0x1e8c4,
636
- 0x1e8c7, 0x1e8d6,
637
- 0x1e900, 0x1e94b,
638
- 0x1e950, 0x1e959,
639
- 0x1e95e, 0x1e95f,
640
- 0x1ec71, 0x1ecb4,
641
- 0x1ed01, 0x1ed3d,
642
- 0x1ee00, 0x1ee03,
643
- 0x1ee05, 0x1ee1f,
644
- 0x1ee21, 0x1ee22,
645
- 0x1ee24, 0x1ee24,
646
- 0x1ee27, 0x1ee27,
647
- 0x1ee29, 0x1ee32,
648
- 0x1ee34, 0x1ee37,
649
- 0x1ee39, 0x1ee39,
650
- 0x1ee3b, 0x1ee3b,
651
- 0x1ee42, 0x1ee42,
652
- 0x1ee47, 0x1ee47,
653
- 0x1ee49, 0x1ee49,
654
- 0x1ee4b, 0x1ee4b,
655
- 0x1ee4d, 0x1ee4f,
656
- 0x1ee51, 0x1ee52,
657
- 0x1ee54, 0x1ee54,
658
- 0x1ee57, 0x1ee57,
659
- 0x1ee59, 0x1ee59,
660
- 0x1ee5b, 0x1ee5b,
661
- 0x1ee5d, 0x1ee5d,
662
- 0x1ee5f, 0x1ee5f,
663
- 0x1ee61, 0x1ee62,
664
- 0x1ee64, 0x1ee64,
665
- 0x1ee67, 0x1ee6a,
666
- 0x1ee6c, 0x1ee72,
667
- 0x1ee74, 0x1ee77,
668
- 0x1ee79, 0x1ee7c,
669
- 0x1ee7e, 0x1ee7e,
670
- 0x1ee80, 0x1ee89,
671
- 0x1ee8b, 0x1ee9b,
672
- 0x1eea1, 0x1eea3,
673
- 0x1eea5, 0x1eea9,
674
- 0x1eeab, 0x1eebb,
675
- 0x1eef0, 0x1eef1,
676
- 0x1f000, 0x1f02b,
677
- 0x1f030, 0x1f093,
678
- 0x1f0a0, 0x1f0ae,
679
- 0x1f0b1, 0x1f0bf,
680
- 0x1f0c1, 0x1f0cf,
681
- 0x1f0d1, 0x1f0f5,
682
- 0x1f100, 0x1f1ad,
683
- 0x1f1e6, 0x1f202,
684
- 0x1f210, 0x1f23b,
685
- 0x1f240, 0x1f248,
686
- 0x1f250, 0x1f251,
687
- 0x1f260, 0x1f265,
688
- 0x1f300, 0x1f6d7,
689
- 0x1f6dc, 0x1f6ec,
690
- 0x1f6f0, 0x1f6fc,
691
- 0x1f700, 0x1f776,
692
- 0x1f77b, 0x1f7d9,
693
- 0x1f7e0, 0x1f7eb,
694
- 0x1f7f0, 0x1f7f0,
695
- 0x1f800, 0x1f80b,
696
- 0x1f810, 0x1f847,
697
- 0x1f850, 0x1f859,
698
- 0x1f860, 0x1f887,
699
- 0x1f890, 0x1f8ad,
700
- 0x1f8b0, 0x1f8b1,
701
- 0x1f900, 0x1fa53,
702
- 0x1fa60, 0x1fa6d,
703
- 0x1fa70, 0x1fa7c,
704
- 0x1fa80, 0x1fa88,
705
- 0x1fa90, 0x1fabd,
706
- 0x1fabf, 0x1fac5,
707
- 0x1face, 0x1fadb,
708
- 0x1fae0, 0x1fae8,
709
- 0x1faf0, 0x1faf8,
710
- 0x1fb00, 0x1fb92,
711
- 0x1fb94, 0x1fbca,
712
- 0x1fbf0, 0x1fbf9,
713
- 0x20000, 0x2a6df,
714
- 0x2a700, 0x2b739,
715
- 0x2b740, 0x2b81d,
716
- 0x2b820, 0x2cea1,
717
- 0x2ceb0, 0x2ebe0,
718
- 0x2f800, 0x2fa1d,
719
- 0x30000, 0x3134a,
720
- 0x31350, 0x323af,
721
- 0xe0001, 0xe0001,
722
- 0xe0020, 0xe007f,
723
- 0xe0100, 0xe01ef,
724
- ];
725
-
726
- function utf16CodeUnits(codePoint) {
727
- return codePoint >= 0x10000 ? 2 : 1;
728
- }
729
- function isLineBreak(ch) {
730
- return ch === 10 /* CharCode.LineFeed */ || ch === 13 /* CharCode.CarriageReturn */;
731
- }
732
- function isAsciiWhiteSpaceSingleLine(ch) {
733
- return (ch === 32 /* CharCode.Space */ ||
734
- ch === 9 /* CharCode.Tab */ ||
735
- ch === 11 /* CharCode.VerticalTab */ ||
736
- ch === 12 /* CharCode.FormFeed */);
737
- }
738
- function isNonAsciiWhiteSpaceSingleLine(ch) {
739
- return (ch === 133 /* CharCode.NextLine */ || // not considered a line break
740
- ch === 8206 /* CharCode.LeftToRightMark */ ||
741
- ch === 8207 /* CharCode.RightToLeftMark */ ||
742
- ch === 8232 /* CharCode.LineSeparator */ ||
743
- ch === 8233 /* CharCode.ParagraphSeparator */);
744
- }
745
- function isWhiteSpace(ch) {
746
- return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
747
- }
748
- function isWhiteSpaceSingleLine(ch) {
749
- return (isAsciiWhiteSpaceSingleLine(ch) ||
750
- (ch > 127 /* CharCode.MaxAscii */ && isNonAsciiWhiteSpaceSingleLine(ch)));
751
- }
752
- function trim(str) {
753
- let start = 0;
754
- let end = str.length - 1;
755
- if (!isWhiteSpace(str.charCodeAt(start)) && !isWhiteSpace(str.charCodeAt(end))) {
756
- return str;
757
- }
758
- while (isWhiteSpace(str.charCodeAt(start))) {
759
- start++;
760
- }
761
- while (isWhiteSpace(str.charCodeAt(end))) {
762
- end--;
763
- }
764
- return str.substring(start, end + 1);
765
- }
766
- function isDigit(ch) {
767
- return ch >= 48 /* CharCode._0 */ && ch <= 57 /* CharCode._9 */;
768
- }
769
- function isHexDigit(ch) {
770
- return (isDigit(ch) || (ch >= 65 /* CharCode.A */ && ch <= 70 /* CharCode.F */) || (ch >= 97 /* CharCode.a */ && ch <= 102 /* CharCode.f */));
771
- }
772
- function isBinaryDigit(ch) {
773
- return ch === 48 /* CharCode._0 */ || ch === 49 /* CharCode._1 */;
774
- }
775
- function isLowercaseAsciiLetter(ch) {
776
- return ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */;
777
- }
778
- function isAsciiIdentifierStart(ch) {
779
- return ((ch >= 65 /* CharCode.A */ && ch <= 90 /* CharCode.Z */) ||
780
- (ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */) ||
781
- ch === 36 /* CharCode.$ */ ||
782
- ch === 95 /* CharCode._ */);
783
- }
784
- function isAsciiIdentifierContinue(ch) {
785
- return ((ch >= 65 /* CharCode.A */ && ch <= 90 /* CharCode.Z */) ||
786
- (ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */) ||
787
- (ch >= 48 /* CharCode._0 */ && ch <= 57 /* CharCode._9 */) ||
788
- ch === 36 /* CharCode.$ */ ||
789
- ch === 95 /* CharCode._ */);
790
- }
791
- function isIdentifierStart(codePoint) {
792
- return (isAsciiIdentifierStart(codePoint) ||
793
- (codePoint > 127 /* CharCode.MaxAscii */ && isNonAsciiIdentifierCharacter(codePoint)));
794
- }
795
- function isIdentifierContinue(codePoint) {
796
- return (isAsciiIdentifierContinue(codePoint) ||
797
- (codePoint > 127 /* CharCode.MaxAscii */ && isNonAsciiIdentifierCharacter(codePoint)));
798
- }
799
- function isNonAsciiIdentifierCharacter(codePoint) {
800
- return lookupInNonAsciiMap(codePoint, nonAsciiIdentifierMap);
801
- }
802
- function lookupInNonAsciiMap(codePoint, map) {
803
- // Perform binary search in one of the Unicode range maps
804
- let lo = 0;
805
- let hi = map.length;
806
- let mid;
807
- while (lo + 1 < hi) {
808
- mid = lo + (hi - lo) / 2;
809
- // mid has to be even to catch a range's beginning
810
- mid -= mid % 2;
811
- if (map[mid] <= codePoint && codePoint <= map[mid + 1]) {
812
- return true;
813
- }
814
- if (codePoint < map[mid]) {
815
- hi = mid;
816
- }
817
- else {
818
- lo = mid + 2;
819
- }
820
- }
821
- return false;
822
- }
823
-
824
- /**
825
- * AST types
826
- */
827
- var SyntaxKind;
828
- (function (SyntaxKind) {
829
- SyntaxKind[SyntaxKind["TypeSpecScript"] = 0] = "TypeSpecScript";
830
- /** @deprecated Use TypeSpecScript */
831
- SyntaxKind[SyntaxKind["CadlScript"] = 0] = "CadlScript";
832
- SyntaxKind[SyntaxKind["JsSourceFile"] = 1] = "JsSourceFile";
833
- SyntaxKind[SyntaxKind["ImportStatement"] = 2] = "ImportStatement";
834
- SyntaxKind[SyntaxKind["Identifier"] = 3] = "Identifier";
835
- SyntaxKind[SyntaxKind["AugmentDecoratorStatement"] = 4] = "AugmentDecoratorStatement";
836
- SyntaxKind[SyntaxKind["DecoratorExpression"] = 5] = "DecoratorExpression";
837
- SyntaxKind[SyntaxKind["DirectiveExpression"] = 6] = "DirectiveExpression";
838
- SyntaxKind[SyntaxKind["MemberExpression"] = 7] = "MemberExpression";
839
- SyntaxKind[SyntaxKind["NamespaceStatement"] = 8] = "NamespaceStatement";
840
- SyntaxKind[SyntaxKind["UsingStatement"] = 9] = "UsingStatement";
841
- SyntaxKind[SyntaxKind["OperationStatement"] = 10] = "OperationStatement";
842
- SyntaxKind[SyntaxKind["OperationSignatureDeclaration"] = 11] = "OperationSignatureDeclaration";
843
- SyntaxKind[SyntaxKind["OperationSignatureReference"] = 12] = "OperationSignatureReference";
844
- SyntaxKind[SyntaxKind["ModelStatement"] = 13] = "ModelStatement";
845
- SyntaxKind[SyntaxKind["ModelExpression"] = 14] = "ModelExpression";
846
- SyntaxKind[SyntaxKind["ModelProperty"] = 15] = "ModelProperty";
847
- SyntaxKind[SyntaxKind["ModelSpreadProperty"] = 16] = "ModelSpreadProperty";
848
- SyntaxKind[SyntaxKind["ScalarStatement"] = 17] = "ScalarStatement";
849
- SyntaxKind[SyntaxKind["InterfaceStatement"] = 18] = "InterfaceStatement";
850
- SyntaxKind[SyntaxKind["UnionStatement"] = 19] = "UnionStatement";
851
- SyntaxKind[SyntaxKind["UnionVariant"] = 20] = "UnionVariant";
852
- SyntaxKind[SyntaxKind["EnumStatement"] = 21] = "EnumStatement";
853
- SyntaxKind[SyntaxKind["EnumMember"] = 22] = "EnumMember";
854
- SyntaxKind[SyntaxKind["EnumSpreadMember"] = 23] = "EnumSpreadMember";
855
- SyntaxKind[SyntaxKind["AliasStatement"] = 24] = "AliasStatement";
856
- SyntaxKind[SyntaxKind["DecoratorDeclarationStatement"] = 25] = "DecoratorDeclarationStatement";
857
- SyntaxKind[SyntaxKind["FunctionDeclarationStatement"] = 26] = "FunctionDeclarationStatement";
858
- SyntaxKind[SyntaxKind["FunctionParameter"] = 27] = "FunctionParameter";
859
- SyntaxKind[SyntaxKind["UnionExpression"] = 28] = "UnionExpression";
860
- SyntaxKind[SyntaxKind["IntersectionExpression"] = 29] = "IntersectionExpression";
861
- SyntaxKind[SyntaxKind["TupleExpression"] = 30] = "TupleExpression";
862
- SyntaxKind[SyntaxKind["ArrayExpression"] = 31] = "ArrayExpression";
863
- SyntaxKind[SyntaxKind["StringLiteral"] = 32] = "StringLiteral";
864
- SyntaxKind[SyntaxKind["NumericLiteral"] = 33] = "NumericLiteral";
865
- SyntaxKind[SyntaxKind["BooleanLiteral"] = 34] = "BooleanLiteral";
866
- SyntaxKind[SyntaxKind["ExternKeyword"] = 35] = "ExternKeyword";
867
- SyntaxKind[SyntaxKind["VoidKeyword"] = 36] = "VoidKeyword";
868
- SyntaxKind[SyntaxKind["NeverKeyword"] = 37] = "NeverKeyword";
869
- SyntaxKind[SyntaxKind["UnknownKeyword"] = 38] = "UnknownKeyword";
870
- SyntaxKind[SyntaxKind["ValueOfExpression"] = 39] = "ValueOfExpression";
871
- SyntaxKind[SyntaxKind["TypeReference"] = 40] = "TypeReference";
872
- SyntaxKind[SyntaxKind["ProjectionReference"] = 41] = "ProjectionReference";
873
- SyntaxKind[SyntaxKind["TemplateParameterDeclaration"] = 42] = "TemplateParameterDeclaration";
874
- SyntaxKind[SyntaxKind["EmptyStatement"] = 43] = "EmptyStatement";
875
- SyntaxKind[SyntaxKind["InvalidStatement"] = 44] = "InvalidStatement";
876
- SyntaxKind[SyntaxKind["LineComment"] = 45] = "LineComment";
877
- SyntaxKind[SyntaxKind["BlockComment"] = 46] = "BlockComment";
878
- SyntaxKind[SyntaxKind["Doc"] = 47] = "Doc";
879
- SyntaxKind[SyntaxKind["DocText"] = 48] = "DocText";
880
- SyntaxKind[SyntaxKind["DocParamTag"] = 49] = "DocParamTag";
881
- SyntaxKind[SyntaxKind["DocReturnsTag"] = 50] = "DocReturnsTag";
882
- SyntaxKind[SyntaxKind["DocTemplateTag"] = 51] = "DocTemplateTag";
883
- SyntaxKind[SyntaxKind["DocUnknownTag"] = 52] = "DocUnknownTag";
884
- SyntaxKind[SyntaxKind["Projection"] = 53] = "Projection";
885
- SyntaxKind[SyntaxKind["ProjectionParameterDeclaration"] = 54] = "ProjectionParameterDeclaration";
886
- SyntaxKind[SyntaxKind["ProjectionModelSelector"] = 55] = "ProjectionModelSelector";
887
- SyntaxKind[SyntaxKind["ProjectionModelPropertySelector"] = 56] = "ProjectionModelPropertySelector";
888
- SyntaxKind[SyntaxKind["ProjectionOperationSelector"] = 57] = "ProjectionOperationSelector";
889
- SyntaxKind[SyntaxKind["ProjectionUnionSelector"] = 58] = "ProjectionUnionSelector";
890
- SyntaxKind[SyntaxKind["ProjectionUnionVariantSelector"] = 59] = "ProjectionUnionVariantSelector";
891
- SyntaxKind[SyntaxKind["ProjectionInterfaceSelector"] = 60] = "ProjectionInterfaceSelector";
892
- SyntaxKind[SyntaxKind["ProjectionEnumSelector"] = 61] = "ProjectionEnumSelector";
893
- SyntaxKind[SyntaxKind["ProjectionEnumMemberSelector"] = 62] = "ProjectionEnumMemberSelector";
894
- SyntaxKind[SyntaxKind["ProjectionExpressionStatement"] = 63] = "ProjectionExpressionStatement";
895
- SyntaxKind[SyntaxKind["ProjectionIfExpression"] = 64] = "ProjectionIfExpression";
896
- SyntaxKind[SyntaxKind["ProjectionBlockExpression"] = 65] = "ProjectionBlockExpression";
897
- SyntaxKind[SyntaxKind["ProjectionMemberExpression"] = 66] = "ProjectionMemberExpression";
898
- SyntaxKind[SyntaxKind["ProjectionLogicalExpression"] = 67] = "ProjectionLogicalExpression";
899
- SyntaxKind[SyntaxKind["ProjectionEqualityExpression"] = 68] = "ProjectionEqualityExpression";
900
- SyntaxKind[SyntaxKind["ProjectionUnaryExpression"] = 69] = "ProjectionUnaryExpression";
901
- SyntaxKind[SyntaxKind["ProjectionRelationalExpression"] = 70] = "ProjectionRelationalExpression";
902
- SyntaxKind[SyntaxKind["ProjectionArithmeticExpression"] = 71] = "ProjectionArithmeticExpression";
903
- SyntaxKind[SyntaxKind["ProjectionCallExpression"] = 72] = "ProjectionCallExpression";
904
- SyntaxKind[SyntaxKind["ProjectionLambdaExpression"] = 73] = "ProjectionLambdaExpression";
905
- SyntaxKind[SyntaxKind["ProjectionLambdaParameterDeclaration"] = 74] = "ProjectionLambdaParameterDeclaration";
906
- SyntaxKind[SyntaxKind["ProjectionModelExpression"] = 75] = "ProjectionModelExpression";
907
- SyntaxKind[SyntaxKind["ProjectionModelProperty"] = 76] = "ProjectionModelProperty";
908
- SyntaxKind[SyntaxKind["ProjectionModelSpreadProperty"] = 77] = "ProjectionModelSpreadProperty";
909
- SyntaxKind[SyntaxKind["ProjectionSpreadProperty"] = 78] = "ProjectionSpreadProperty";
910
- SyntaxKind[SyntaxKind["ProjectionTupleExpression"] = 79] = "ProjectionTupleExpression";
911
- SyntaxKind[SyntaxKind["ProjectionStatement"] = 80] = "ProjectionStatement";
912
- SyntaxKind[SyntaxKind["ProjectionDecoratorReferenceExpression"] = 81] = "ProjectionDecoratorReferenceExpression";
913
- SyntaxKind[SyntaxKind["Return"] = 82] = "Return";
914
- })(SyntaxKind || (SyntaxKind = {}));
915
- var IdentifierKind;
916
- (function (IdentifierKind) {
917
- IdentifierKind[IdentifierKind["TypeReference"] = 0] = "TypeReference";
918
- IdentifierKind[IdentifierKind["Decorator"] = 1] = "Decorator";
919
- IdentifierKind[IdentifierKind["Function"] = 2] = "Function";
920
- IdentifierKind[IdentifierKind["Using"] = 3] = "Using";
921
- IdentifierKind[IdentifierKind["Declaration"] = 4] = "Declaration";
922
- IdentifierKind[IdentifierKind["Other"] = 5] = "Other";
923
- })(IdentifierKind || (IdentifierKind = {}));
924
- const NoTarget = Symbol.for("NoTarget");
925
- var ListenerFlow;
926
- (function (ListenerFlow) {
927
- /**
928
- * Do not navigate any containing or referenced type.
929
- */
930
- ListenerFlow[ListenerFlow["NoRecursion"] = 1] = "NoRecursion";
931
- })(ListenerFlow || (ListenerFlow = {}));
253
+ function compilerAssert(condition, message, target) {
254
+ if (condition) {
255
+ return;
256
+ }
257
+ if (target) {
258
+ let location;
259
+ try {
260
+ location = getSourceLocation(target);
261
+ }
262
+ catch (err) { }
263
+ if (location) {
264
+ const pos = location.file.getLineAndCharacterOfPosition(location.pos);
265
+ const file = location.file.path;
266
+ const line = pos.line + 1;
267
+ const col = pos.character + 1;
268
+ message += `\nOccurred while compiling code in ${file} near line ${line}, column ${col}`;
269
+ }
270
+ }
271
+ throw new Error(message);
272
+ }
273
+ function scanLineStarts(text) {
274
+ const starts = [];
275
+ let start = 0;
276
+ let pos = 0;
277
+ while (pos < text.length) {
278
+ const ch = text.charCodeAt(pos);
279
+ pos++;
280
+ switch (ch) {
281
+ case 13 /* CharCode.CarriageReturn */:
282
+ if (text.charCodeAt(pos) === 10 /* CharCode.LineFeed */) {
283
+ pos++;
284
+ }
285
+ // fallthrough
286
+ case 10 /* CharCode.LineFeed */:
287
+ starts.push(start);
288
+ start = pos;
289
+ break;
290
+ }
291
+ }
292
+ starts.push(start);
293
+ return starts;
294
+ }
295
+ /**
296
+ * Search sorted array of numbers for the given value. If found, return index
297
+ * in array where value was found. If not found, return a negative number that
298
+ * is the bitwise complement of the index where value would need to be inserted
299
+ * to keep the array sorted.
300
+ */
301
+ function binarySearch(array, value) {
302
+ let low = 0;
303
+ let high = array.length - 1;
304
+ while (low <= high) {
305
+ const middle = low + ((high - low) >> 1);
306
+ const v = array[middle];
307
+ if (v < value) {
308
+ low = middle + 1;
309
+ }
310
+ else if (v > value) {
311
+ high = middle - 1;
312
+ }
313
+ else {
314
+ return middle;
315
+ }
316
+ }
317
+ return ~low;
318
+ }
932
319
 
933
320
  const globalLibraryUrlsLoadedSym = Symbol.for("TYPESPEC_LIBRARY_URLS_LOADED");
934
321
  if (globalThis[globalLibraryUrlsLoadedSym] === undefined) {
@@ -1190,9 +577,6 @@ const diagnostics = {
1190
577
  severity: "error",
1191
578
  messages: {
1192
579
  default: "Using must refer to a namespace",
1193
- decorator: "Can't use a decorator",
1194
- function: "Can't use a function",
1195
- projection: "Can't use a projection",
1196
580
  },
1197
581
  },
1198
582
  "invalid-type-ref": {
@@ -1257,6 +641,7 @@ const diagnostics = {
1257
641
  inDecorator: paramMessage `Cannot resolve ${"id"} in decorator`,
1258
642
  underNamespace: paramMessage `Namespace ${"namespace"} doesn't have member ${"id"}`,
1259
643
  underContainer: paramMessage `${"kind"} doesn't have member ${"id"}`,
644
+ metaProperty: paramMessage `${"kind"} doesn't have meta property ${"id"}`,
1260
645
  node: paramMessage `Cannot resolve '${"id"}' in node ${"nodeName"} since it has no members. Did you mean to use "::" instead of "."?`,
1261
646
  },
1262
647
  },
@@ -1414,6 +799,18 @@ const diagnostics = {
1414
799
  default: paramMessage `Shadowing parent template parmaeter with the same name "${"name"}"`,
1415
800
  },
1416
801
  },
802
+ "invalid-deprecation-argument": {
803
+ severity: "error",
804
+ messages: {
805
+ default: "Invalid deprecation argument",
806
+ },
807
+ },
808
+ "duplicate-deprecation": {
809
+ severity: "warning",
810
+ messages: {
811
+ default: "The #deprecated directive cannot be used more than once on the same declaration.",
812
+ },
813
+ },
1417
814
  /**
1418
815
  * Configuration
1419
816
  */
@@ -1732,215 +1129,2140 @@ const diagnostics = {
1732
1129
  default: "Conflict marker encountered.",
1733
1130
  },
1734
1131
  },
1132
+ // #region CLI
1133
+ "no-compatible-vs-installed": {
1134
+ severity: "error",
1135
+ messages: {
1136
+ default: "No compatible version of Visual Studio found.",
1137
+ },
1138
+ },
1139
+ "vs-extension-windows-only": {
1140
+ severity: "error",
1141
+ messages: {
1142
+ default: "Visual Studio extension is not supported on non-Windows.",
1143
+ },
1144
+ },
1145
+ "vscode-in-path": {
1146
+ severity: "error",
1147
+ messages: {
1148
+ default: "Couldn't find VS Code 'code' command in PATH. Make sure you have the VS Code executable added to the system PATH.",
1149
+ osx: "Couldn't find VS Code 'code' command in PATH. Make sure you have the VS Code executable added to the system PATH.\nSee instruction for Mac OS here https://code.visualstudio.com/docs/setup/mac",
1150
+ },
1151
+ },
1152
+ // #endregion CLI
1735
1153
  };
1736
1154
  const { createDiagnostic, reportDiagnostic } = createDiagnosticCreator(diagnostics);
1737
1155
 
1156
+ (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1157
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1158
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1159
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1160
+ };
1161
+ (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1162
+ if (kind === "m") throw new TypeError("Private method is not writable");
1163
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1164
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1165
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1166
+ };
1738
1167
  /**
1739
- * Create a new diagnostics creator.
1740
- * @param diagnostics Map of the potential diagnostics.
1741
- * @param libraryName Optional name of the library if in the scope of a library.
1742
- * @returns @see DiagnosticCreator
1168
+ * A specially typed version of `Array.isArray` to work around [this issue](https://github.com/microsoft/TypeScript/issues/17002).
1743
1169
  */
1744
- function createDiagnosticCreator(diagnostics, libraryName) {
1745
- const errorMessage = libraryName
1746
- ? `It must match one of the code defined in the library '${libraryName}'`
1747
- : "It must match one of the code defined in the compiler.";
1748
- function createDiagnostic(diagnostic) {
1749
- var _a;
1750
- const diagnosticDef = diagnostics[diagnostic.code];
1751
- if (!diagnosticDef) {
1752
- const codeStr = Object.keys(diagnostics)
1753
- .map((x) => ` - ${x}`)
1754
- .join("\n");
1755
- const code = String(diagnostic.code);
1756
- throw new Error(`Unexpected diagnostic code '${code}'. ${errorMessage}. Defined codes:\n${codeStr}`);
1757
- }
1758
- const message = diagnosticDef.messages[(_a = diagnostic.messageId) !== null && _a !== void 0 ? _a : "default"];
1759
- if (!message) {
1760
- const codeStr = Object.keys(diagnosticDef.messages)
1761
- .map((x) => ` - ${x}`)
1762
- .join("\n");
1763
- const messageId = String(diagnostic.messageId);
1764
- const code = String(diagnostic.code);
1765
- throw new Error(`Unexpected message id '${messageId}'. ${errorMessage} for code '${code}'. Defined codes:\n${codeStr}`);
1766
- }
1767
- const messageStr = typeof message === "string" ? message : message(diagnostic.format);
1768
- return {
1769
- code: libraryName ? `${libraryName}/${String(diagnostic.code)}` : diagnostic.code.toString(),
1770
- severity: diagnosticDef.severity,
1771
- message: messageStr,
1772
- target: diagnostic.target,
1170
+ function isArray(
1171
+ // eslint-disable-next-line @typescript-eslint/ban-types
1172
+ arg) {
1173
+ return Array.isArray(arg);
1174
+ }
1175
+ /**
1176
+ * Casts away readonly typing.
1177
+ *
1178
+ * Use it like this when it is safe to override readonly typing:
1179
+ * mutate(item).prop = value;
1180
+ */
1181
+ function mutate(value) {
1182
+ return value;
1183
+ }
1184
+
1185
+ var __defProp = Object.defineProperty;
1186
+ var __export = (target, all) => {
1187
+ for (var name in all)
1188
+ __defProp(target, name, { get: all[name], enumerable: true });
1189
+ };
1190
+
1191
+ // src/document/public.js
1192
+ var public_exports = {};
1193
+ __export(public_exports, {
1194
+ builders: () => builders,
1195
+ printer: () => printer,
1196
+ utils: () => utils
1197
+ });
1198
+
1199
+ // src/document/constants.js
1200
+ var DOC_TYPE_STRING = "string";
1201
+ var DOC_TYPE_ARRAY = "array";
1202
+ var DOC_TYPE_CURSOR = "cursor";
1203
+ var DOC_TYPE_INDENT = "indent";
1204
+ var DOC_TYPE_ALIGN = "align";
1205
+ var DOC_TYPE_TRIM = "trim";
1206
+ var DOC_TYPE_GROUP = "group";
1207
+ var DOC_TYPE_FILL = "fill";
1208
+ var DOC_TYPE_IF_BREAK = "if-break";
1209
+ var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
1210
+ var DOC_TYPE_LINE_SUFFIX = "line-suffix";
1211
+ var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
1212
+ var DOC_TYPE_LINE = "line";
1213
+ var DOC_TYPE_LABEL = "label";
1214
+ var DOC_TYPE_BREAK_PARENT = "break-parent";
1215
+ var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
1216
+ DOC_TYPE_CURSOR,
1217
+ DOC_TYPE_INDENT,
1218
+ DOC_TYPE_ALIGN,
1219
+ DOC_TYPE_TRIM,
1220
+ DOC_TYPE_GROUP,
1221
+ DOC_TYPE_FILL,
1222
+ DOC_TYPE_IF_BREAK,
1223
+ DOC_TYPE_INDENT_IF_BREAK,
1224
+ DOC_TYPE_LINE_SUFFIX,
1225
+ DOC_TYPE_LINE_SUFFIX_BOUNDARY,
1226
+ DOC_TYPE_LINE,
1227
+ DOC_TYPE_LABEL,
1228
+ DOC_TYPE_BREAK_PARENT
1229
+ ]);
1230
+
1231
+ // src/document/utils/get-doc-type.js
1232
+ function getDocType(doc) {
1233
+ if (typeof doc === "string") {
1234
+ return DOC_TYPE_STRING;
1235
+ }
1236
+ if (Array.isArray(doc)) {
1237
+ return DOC_TYPE_ARRAY;
1238
+ }
1239
+ if (!doc) {
1240
+ return;
1241
+ }
1242
+ const { type } = doc;
1243
+ if (VALID_OBJECT_DOC_TYPES.has(type)) {
1244
+ return type;
1245
+ }
1246
+ }
1247
+ var get_doc_type_default = getDocType;
1248
+
1249
+ // src/document/invalid-doc-error.js
1250
+ var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
1251
+ function getDocErrorMessage(doc) {
1252
+ const type = doc === null ? "null" : typeof doc;
1253
+ if (type !== "string" && type !== "object") {
1254
+ return `Unexpected doc '${type}',
1255
+ Expected it to be 'string' or 'object'.`;
1256
+ }
1257
+ if (get_doc_type_default(doc)) {
1258
+ throw new Error("doc is valid.");
1259
+ }
1260
+ const objectType = Object.prototype.toString.call(doc);
1261
+ if (objectType !== "[object Object]") {
1262
+ return `Unexpected doc '${objectType}'.`;
1263
+ }
1264
+ const EXPECTED_TYPE_VALUES = disjunctionListFormat(
1265
+ [...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
1266
+ );
1267
+ return `Unexpected doc.type '${doc.type}'.
1268
+ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
1269
+ }
1270
+ var InvalidDocError = class extends Error {
1271
+ name = "InvalidDocError";
1272
+ constructor(doc) {
1273
+ super(getDocErrorMessage(doc));
1274
+ this.doc = doc;
1275
+ }
1276
+ };
1277
+ var invalid_doc_error_default = InvalidDocError;
1278
+
1279
+ // src/document/utils/traverse-doc.js
1280
+ var traverseDocOnExitStackMarker = {};
1281
+ function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
1282
+ const docsStack = [doc];
1283
+ while (docsStack.length > 0) {
1284
+ const doc2 = docsStack.pop();
1285
+ if (doc2 === traverseDocOnExitStackMarker) {
1286
+ onExit(docsStack.pop());
1287
+ continue;
1288
+ }
1289
+ if (onExit) {
1290
+ docsStack.push(doc2, traverseDocOnExitStackMarker);
1291
+ }
1292
+ const docType = get_doc_type_default(doc2);
1293
+ if (!docType) {
1294
+ throw new invalid_doc_error_default(doc2);
1295
+ }
1296
+ if ((onEnter == null ? void 0 : onEnter(doc2)) === false) {
1297
+ continue;
1298
+ }
1299
+ switch (docType) {
1300
+ case DOC_TYPE_ARRAY:
1301
+ case DOC_TYPE_FILL: {
1302
+ const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts;
1303
+ for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
1304
+ docsStack.push(parts[i]);
1305
+ }
1306
+ break;
1307
+ }
1308
+ case DOC_TYPE_IF_BREAK:
1309
+ docsStack.push(doc2.flatContents, doc2.breakContents);
1310
+ break;
1311
+ case DOC_TYPE_GROUP:
1312
+ if (shouldTraverseConditionalGroups && doc2.expandedStates) {
1313
+ for (let ic = doc2.expandedStates.length, i = ic - 1; i >= 0; --i) {
1314
+ docsStack.push(doc2.expandedStates[i]);
1315
+ }
1316
+ } else {
1317
+ docsStack.push(doc2.contents);
1318
+ }
1319
+ break;
1320
+ case DOC_TYPE_ALIGN:
1321
+ case DOC_TYPE_INDENT:
1322
+ case DOC_TYPE_INDENT_IF_BREAK:
1323
+ case DOC_TYPE_LABEL:
1324
+ case DOC_TYPE_LINE_SUFFIX:
1325
+ docsStack.push(doc2.contents);
1326
+ break;
1327
+ case DOC_TYPE_STRING:
1328
+ case DOC_TYPE_CURSOR:
1329
+ case DOC_TYPE_TRIM:
1330
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1331
+ case DOC_TYPE_LINE:
1332
+ case DOC_TYPE_BREAK_PARENT:
1333
+ break;
1334
+ default:
1335
+ throw new invalid_doc_error_default(doc2);
1336
+ }
1337
+ }
1338
+ }
1339
+ var traverse_doc_default = traverseDoc;
1340
+
1341
+ // src/document/utils/assert-doc.js
1342
+ var noop = () => {
1343
+ };
1344
+ var assertDocArray = noop ;
1345
+
1346
+ // src/document/builders.js
1347
+ function indent$1(contents) {
1348
+ return { type: DOC_TYPE_INDENT, contents };
1349
+ }
1350
+ function align$1(widthOrString, contents) {
1351
+ return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
1352
+ }
1353
+ function group$1(contents, opts = {}) {
1354
+ assertDocArray(
1355
+ opts.expandedStates);
1356
+ return {
1357
+ type: DOC_TYPE_GROUP,
1358
+ id: opts.id,
1359
+ contents,
1360
+ break: Boolean(opts.shouldBreak),
1361
+ expandedStates: opts.expandedStates
1362
+ };
1363
+ }
1364
+ function dedentToRoot(contents) {
1365
+ return align$1(Number.NEGATIVE_INFINITY, contents);
1366
+ }
1367
+ function markAsRoot(contents) {
1368
+ return align$1({ type: "root" }, contents);
1369
+ }
1370
+ function dedent(contents) {
1371
+ return align$1(-1, contents);
1372
+ }
1373
+ function conditionalGroup(states, opts) {
1374
+ return group$1(states[0], { ...opts, expandedStates: states });
1375
+ }
1376
+ function fill(parts) {
1377
+ return { type: DOC_TYPE_FILL, parts };
1378
+ }
1379
+ function ifBreak$1(breakContents, flatContents = "", opts = {}) {
1380
+ return {
1381
+ type: DOC_TYPE_IF_BREAK,
1382
+ breakContents,
1383
+ flatContents,
1384
+ groupId: opts.groupId
1385
+ };
1386
+ }
1387
+ function indentIfBreak(contents, opts) {
1388
+ return {
1389
+ type: DOC_TYPE_INDENT_IF_BREAK,
1390
+ contents,
1391
+ groupId: opts.groupId,
1392
+ negate: opts.negate
1393
+ };
1394
+ }
1395
+ function lineSuffix(contents) {
1396
+ return { type: DOC_TYPE_LINE_SUFFIX, contents };
1397
+ }
1398
+ var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
1399
+ var breakParent$1 = { type: DOC_TYPE_BREAK_PARENT };
1400
+ var trim$1 = { type: DOC_TYPE_TRIM };
1401
+ var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
1402
+ var literallineWithoutBreakParent = {
1403
+ type: DOC_TYPE_LINE,
1404
+ hard: true,
1405
+ literal: true
1406
+ };
1407
+ var line$1 = { type: DOC_TYPE_LINE };
1408
+ var softline$1 = { type: DOC_TYPE_LINE, soft: true };
1409
+ var hardline$1 = [hardlineWithoutBreakParent, breakParent$1];
1410
+ var literalline = [literallineWithoutBreakParent, breakParent$1];
1411
+ var cursor = { type: DOC_TYPE_CURSOR };
1412
+ function join$1(separator, docs) {
1413
+ const parts = [];
1414
+ for (let i = 0; i < docs.length; i++) {
1415
+ if (i !== 0) {
1416
+ parts.push(separator);
1417
+ }
1418
+ parts.push(docs[i]);
1419
+ }
1420
+ return parts;
1421
+ }
1422
+ function addAlignmentToDoc(doc, size, tabWidth) {
1423
+ let aligned = doc;
1424
+ if (size > 0) {
1425
+ for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
1426
+ aligned = indent$1(aligned);
1427
+ }
1428
+ aligned = align$1(size % tabWidth, aligned);
1429
+ aligned = align$1(Number.NEGATIVE_INFINITY, aligned);
1430
+ }
1431
+ return aligned;
1432
+ }
1433
+ function label(label2, contents) {
1434
+ return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
1435
+ }
1436
+
1437
+ // scripts/build/shims/at.js
1438
+ var at$1 = (isOptionalObject, object, index) => {
1439
+ if (isOptionalObject && (object === void 0 || object === null)) {
1440
+ return;
1441
+ }
1442
+ if (Array.isArray(object) || typeof object === "string") {
1443
+ return object[index < 0 ? object.length + index : index];
1444
+ }
1445
+ return object.at(index);
1446
+ };
1447
+ var at_default = at$1;
1448
+
1449
+ // scripts/build/shims/string-replace-all.js
1450
+ var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
1451
+ if (isOptionalObject && (original === void 0 || original === null)) {
1452
+ return;
1453
+ }
1454
+ if (original.replaceAll) {
1455
+ return original.replaceAll(pattern, replacement);
1456
+ }
1457
+ if (pattern.global) {
1458
+ return original.replace(pattern, replacement);
1459
+ }
1460
+ return original.split(pattern).join(replacement);
1461
+ };
1462
+ var string_replace_all_default = stringReplaceAll;
1463
+
1464
+ // src/common/end-of-line.js
1465
+ function convertEndOfLineToChars(value) {
1466
+ switch (value) {
1467
+ case "cr":
1468
+ return "\r";
1469
+ case "crlf":
1470
+ return "\r\n";
1471
+ default:
1472
+ return "\n";
1473
+ }
1474
+ }
1475
+
1476
+ // node_modules/emoji-regex/index.mjs
1477
+ var emoji_regex_default = () => {
1478
+ 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\u26D3\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]|\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])?|[\uDFC3\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-\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]|\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(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\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-\uDEB6](?:\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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?)?)|\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])?|\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-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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;
1479
+ };
1480
+
1481
+ // node_modules/eastasianwidth/eastasianwidth.js
1482
+ var eastasianwidth_default = {
1483
+ eastAsianWidth(character) {
1484
+ var x = character.charCodeAt(0);
1485
+ var y = character.length == 2 ? character.charCodeAt(1) : 0;
1486
+ var codePoint = x;
1487
+ if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) {
1488
+ x &= 1023;
1489
+ y &= 1023;
1490
+ codePoint = x << 10 | y;
1491
+ codePoint += 65536;
1492
+ }
1493
+ if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
1494
+ return "F";
1495
+ }
1496
+ if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
1497
+ return "W";
1498
+ }
1499
+ return "N";
1500
+ }
1501
+ };
1502
+
1503
+ // src/utils/get-string-width.js
1504
+ var notAsciiRegex = /[^\x20-\x7F]/;
1505
+ function getStringWidth(text) {
1506
+ if (!text) {
1507
+ return 0;
1508
+ }
1509
+ if (!notAsciiRegex.test(text)) {
1510
+ return text.length;
1511
+ }
1512
+ text = text.replace(emoji_regex_default(), " ");
1513
+ let width = 0;
1514
+ for (const character of text) {
1515
+ const codePoint = character.codePointAt(0);
1516
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
1517
+ continue;
1518
+ }
1519
+ if (codePoint >= 768 && codePoint <= 879) {
1520
+ continue;
1521
+ }
1522
+ const code = eastasianwidth_default.eastAsianWidth(character);
1523
+ width += code === "F" || code === "W" ? 2 : 1;
1524
+ }
1525
+ return width;
1526
+ }
1527
+ var get_string_width_default = getStringWidth;
1528
+
1529
+ // src/document/utils.js
1530
+ var getDocParts = (doc) => {
1531
+ if (Array.isArray(doc)) {
1532
+ return doc;
1533
+ }
1534
+ if (doc.type !== DOC_TYPE_FILL) {
1535
+ throw new Error(`Expect doc to be 'array' or '${DOC_TYPE_FILL}'.`);
1536
+ }
1537
+ return doc.parts;
1538
+ };
1539
+ function mapDoc(doc, cb) {
1540
+ if (typeof doc === "string") {
1541
+ return cb(doc);
1542
+ }
1543
+ const mapped = /* @__PURE__ */ new Map();
1544
+ return rec(doc);
1545
+ function rec(doc2) {
1546
+ if (mapped.has(doc2)) {
1547
+ return mapped.get(doc2);
1548
+ }
1549
+ const result = process2(doc2);
1550
+ mapped.set(doc2, result);
1551
+ return result;
1552
+ }
1553
+ function process2(doc2) {
1554
+ switch (get_doc_type_default(doc2)) {
1555
+ case DOC_TYPE_ARRAY:
1556
+ return cb(doc2.map(rec));
1557
+ case DOC_TYPE_FILL:
1558
+ return cb({
1559
+ ...doc2,
1560
+ parts: doc2.parts.map(rec)
1561
+ });
1562
+ case DOC_TYPE_IF_BREAK:
1563
+ return cb({
1564
+ ...doc2,
1565
+ breakContents: rec(doc2.breakContents),
1566
+ flatContents: rec(doc2.flatContents)
1567
+ });
1568
+ case DOC_TYPE_GROUP: {
1569
+ let {
1570
+ expandedStates,
1571
+ contents
1572
+ } = doc2;
1573
+ if (expandedStates) {
1574
+ expandedStates = expandedStates.map(rec);
1575
+ contents = expandedStates[0];
1576
+ } else {
1577
+ contents = rec(contents);
1578
+ }
1579
+ return cb({
1580
+ ...doc2,
1581
+ contents,
1582
+ expandedStates
1583
+ });
1584
+ }
1585
+ case DOC_TYPE_ALIGN:
1586
+ case DOC_TYPE_INDENT:
1587
+ case DOC_TYPE_INDENT_IF_BREAK:
1588
+ case DOC_TYPE_LABEL:
1589
+ case DOC_TYPE_LINE_SUFFIX:
1590
+ return cb({
1591
+ ...doc2,
1592
+ contents: rec(doc2.contents)
1593
+ });
1594
+ case DOC_TYPE_STRING:
1595
+ case DOC_TYPE_CURSOR:
1596
+ case DOC_TYPE_TRIM:
1597
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1598
+ case DOC_TYPE_LINE:
1599
+ case DOC_TYPE_BREAK_PARENT:
1600
+ return cb(doc2);
1601
+ default:
1602
+ throw new invalid_doc_error_default(doc2);
1603
+ }
1604
+ }
1605
+ }
1606
+ function findInDoc(doc, fn, defaultValue) {
1607
+ let result = defaultValue;
1608
+ let shouldSkipFurtherProcessing = false;
1609
+ function findInDocOnEnterFn(doc2) {
1610
+ if (shouldSkipFurtherProcessing) {
1611
+ return false;
1612
+ }
1613
+ const maybeResult = fn(doc2);
1614
+ if (maybeResult !== void 0) {
1615
+ shouldSkipFurtherProcessing = true;
1616
+ result = maybeResult;
1617
+ }
1618
+ }
1619
+ traverse_doc_default(doc, findInDocOnEnterFn);
1620
+ return result;
1621
+ }
1622
+ function willBreakFn(doc) {
1623
+ if (doc.type === DOC_TYPE_GROUP && doc.break) {
1624
+ return true;
1625
+ }
1626
+ if (doc.type === DOC_TYPE_LINE && doc.hard) {
1627
+ return true;
1628
+ }
1629
+ if (doc.type === DOC_TYPE_BREAK_PARENT) {
1630
+ return true;
1631
+ }
1632
+ }
1633
+ function willBreak(doc) {
1634
+ return findInDoc(doc, willBreakFn, false);
1635
+ }
1636
+ function breakParentGroup(groupStack) {
1637
+ if (groupStack.length > 0) {
1638
+ const parentGroup = at_default(
1639
+ /* isOptionalObject*/
1640
+ false,
1641
+ groupStack,
1642
+ -1
1643
+ );
1644
+ if (!parentGroup.expandedStates && !parentGroup.break) {
1645
+ parentGroup.break = "propagated";
1646
+ }
1647
+ }
1648
+ return null;
1649
+ }
1650
+ function propagateBreaks(doc) {
1651
+ const alreadyVisitedSet = /* @__PURE__ */ new Set();
1652
+ const groupStack = [];
1653
+ function propagateBreaksOnEnterFn(doc2) {
1654
+ if (doc2.type === DOC_TYPE_BREAK_PARENT) {
1655
+ breakParentGroup(groupStack);
1656
+ }
1657
+ if (doc2.type === DOC_TYPE_GROUP) {
1658
+ groupStack.push(doc2);
1659
+ if (alreadyVisitedSet.has(doc2)) {
1660
+ return false;
1661
+ }
1662
+ alreadyVisitedSet.add(doc2);
1663
+ }
1664
+ }
1665
+ function propagateBreaksOnExitFn(doc2) {
1666
+ if (doc2.type === DOC_TYPE_GROUP) {
1667
+ const group2 = groupStack.pop();
1668
+ if (group2.break) {
1669
+ breakParentGroup(groupStack);
1670
+ }
1671
+ }
1672
+ }
1673
+ traverse_doc_default(
1674
+ doc,
1675
+ propagateBreaksOnEnterFn,
1676
+ propagateBreaksOnExitFn,
1677
+ /* shouldTraverseConditionalGroups */
1678
+ true
1679
+ );
1680
+ }
1681
+ function removeLinesFn(doc) {
1682
+ if (doc.type === DOC_TYPE_LINE && !doc.hard) {
1683
+ return doc.soft ? "" : " ";
1684
+ }
1685
+ if (doc.type === DOC_TYPE_IF_BREAK) {
1686
+ return doc.flatContents;
1687
+ }
1688
+ return doc;
1689
+ }
1690
+ function removeLines(doc) {
1691
+ return mapDoc(doc, removeLinesFn);
1692
+ }
1693
+ function stripTrailingHardlineFromParts(parts) {
1694
+ parts = [...parts];
1695
+ while (parts.length >= 2 && at_default(
1696
+ /* isOptionalObject*/
1697
+ false,
1698
+ parts,
1699
+ -2
1700
+ ).type === DOC_TYPE_LINE && at_default(
1701
+ /* isOptionalObject*/
1702
+ false,
1703
+ parts,
1704
+ -1
1705
+ ).type === DOC_TYPE_BREAK_PARENT) {
1706
+ parts.length -= 2;
1707
+ }
1708
+ if (parts.length > 0) {
1709
+ const lastPart = stripTrailingHardlineFromDoc(at_default(
1710
+ /* isOptionalObject*/
1711
+ false,
1712
+ parts,
1713
+ -1
1714
+ ));
1715
+ parts[parts.length - 1] = lastPart;
1716
+ }
1717
+ return parts;
1718
+ }
1719
+ function stripTrailingHardlineFromDoc(doc) {
1720
+ switch (get_doc_type_default(doc)) {
1721
+ case DOC_TYPE_ALIGN:
1722
+ case DOC_TYPE_INDENT:
1723
+ case DOC_TYPE_INDENT_IF_BREAK:
1724
+ case DOC_TYPE_GROUP:
1725
+ case DOC_TYPE_LINE_SUFFIX:
1726
+ case DOC_TYPE_LABEL: {
1727
+ const contents = stripTrailingHardlineFromDoc(doc.contents);
1728
+ return {
1729
+ ...doc,
1730
+ contents
1731
+ };
1732
+ }
1733
+ case DOC_TYPE_IF_BREAK:
1734
+ return {
1735
+ ...doc,
1736
+ breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
1737
+ flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
1738
+ };
1739
+ case DOC_TYPE_FILL:
1740
+ return {
1741
+ ...doc,
1742
+ parts: stripTrailingHardlineFromParts(doc.parts)
1743
+ };
1744
+ case DOC_TYPE_ARRAY:
1745
+ return stripTrailingHardlineFromParts(doc);
1746
+ case DOC_TYPE_STRING:
1747
+ return doc.replace(/[\n\r]*$/, "");
1748
+ case DOC_TYPE_CURSOR:
1749
+ case DOC_TYPE_TRIM:
1750
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1751
+ case DOC_TYPE_LINE:
1752
+ case DOC_TYPE_BREAK_PARENT:
1753
+ break;
1754
+ default:
1755
+ throw new invalid_doc_error_default(doc);
1756
+ }
1757
+ return doc;
1758
+ }
1759
+ function stripTrailingHardline(doc) {
1760
+ return stripTrailingHardlineFromDoc(cleanDoc(doc));
1761
+ }
1762
+ function cleanDocFn(doc) {
1763
+ switch (get_doc_type_default(doc)) {
1764
+ case DOC_TYPE_FILL:
1765
+ if (doc.parts.every((part) => part === "")) {
1766
+ return "";
1767
+ }
1768
+ break;
1769
+ case DOC_TYPE_GROUP:
1770
+ if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
1771
+ return "";
1772
+ }
1773
+ if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
1774
+ return doc.contents;
1775
+ }
1776
+ break;
1777
+ case DOC_TYPE_ALIGN:
1778
+ case DOC_TYPE_INDENT:
1779
+ case DOC_TYPE_INDENT_IF_BREAK:
1780
+ case DOC_TYPE_LINE_SUFFIX:
1781
+ if (!doc.contents) {
1782
+ return "";
1783
+ }
1784
+ break;
1785
+ case DOC_TYPE_IF_BREAK:
1786
+ if (!doc.flatContents && !doc.breakContents) {
1787
+ return "";
1788
+ }
1789
+ break;
1790
+ case DOC_TYPE_ARRAY: {
1791
+ const parts = [];
1792
+ for (const part of doc) {
1793
+ if (!part) {
1794
+ continue;
1795
+ }
1796
+ const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
1797
+ if (typeof currentPart === "string" && typeof at_default(
1798
+ /* isOptionalObject*/
1799
+ false,
1800
+ parts,
1801
+ -1
1802
+ ) === "string") {
1803
+ parts[parts.length - 1] += currentPart;
1804
+ } else {
1805
+ parts.push(currentPart);
1806
+ }
1807
+ parts.push(...restParts);
1808
+ }
1809
+ if (parts.length === 0) {
1810
+ return "";
1811
+ }
1812
+ if (parts.length === 1) {
1813
+ return parts[0];
1814
+ }
1815
+ return parts;
1816
+ }
1817
+ case DOC_TYPE_STRING:
1818
+ case DOC_TYPE_CURSOR:
1819
+ case DOC_TYPE_TRIM:
1820
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
1821
+ case DOC_TYPE_LINE:
1822
+ case DOC_TYPE_LABEL:
1823
+ case DOC_TYPE_BREAK_PARENT:
1824
+ break;
1825
+ default:
1826
+ throw new invalid_doc_error_default(doc);
1827
+ }
1828
+ return doc;
1829
+ }
1830
+ function cleanDoc(doc) {
1831
+ return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
1832
+ }
1833
+ function replaceEndOfLine(doc, replacement = literalline) {
1834
+ return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join$1(replacement, currentDoc.split("\n")) : currentDoc);
1835
+ }
1836
+ function canBreakFn(doc) {
1837
+ if (doc.type === DOC_TYPE_LINE) {
1838
+ return true;
1839
+ }
1840
+ }
1841
+ function canBreak(doc) {
1842
+ return findInDoc(doc, canBreakFn, false);
1843
+ }
1844
+
1845
+ // src/document/printer.js
1846
+ var MODE_BREAK = Symbol("MODE_BREAK");
1847
+ var MODE_FLAT = Symbol("MODE_FLAT");
1848
+ var CURSOR_PLACEHOLDER = Symbol("cursor");
1849
+ function rootIndent() {
1850
+ return {
1851
+ value: "",
1852
+ length: 0,
1853
+ queue: []
1854
+ };
1855
+ }
1856
+ function makeIndent(ind, options) {
1857
+ return generateInd(ind, {
1858
+ type: "indent"
1859
+ }, options);
1860
+ }
1861
+ function makeAlign(indent2, widthOrDoc, options) {
1862
+ if (widthOrDoc === Number.NEGATIVE_INFINITY) {
1863
+ return indent2.root || rootIndent();
1864
+ }
1865
+ if (widthOrDoc < 0) {
1866
+ return generateInd(indent2, {
1867
+ type: "dedent"
1868
+ }, options);
1869
+ }
1870
+ if (!widthOrDoc) {
1871
+ return indent2;
1872
+ }
1873
+ if (widthOrDoc.type === "root") {
1874
+ return {
1875
+ ...indent2,
1876
+ root: indent2
1877
+ };
1878
+ }
1879
+ const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
1880
+ return generateInd(indent2, {
1881
+ type: alignType,
1882
+ n: widthOrDoc
1883
+ }, options);
1884
+ }
1885
+ function generateInd(ind, newPart, options) {
1886
+ const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart];
1887
+ let value = "";
1888
+ let length = 0;
1889
+ let lastTabs = 0;
1890
+ let lastSpaces = 0;
1891
+ for (const part of queue) {
1892
+ switch (part.type) {
1893
+ case "indent":
1894
+ flush();
1895
+ if (options.useTabs) {
1896
+ addTabs(1);
1897
+ } else {
1898
+ addSpaces(options.tabWidth);
1899
+ }
1900
+ break;
1901
+ case "stringAlign":
1902
+ flush();
1903
+ value += part.n;
1904
+ length += part.n.length;
1905
+ break;
1906
+ case "numberAlign":
1907
+ lastTabs += 1;
1908
+ lastSpaces += part.n;
1909
+ break;
1910
+ default:
1911
+ throw new Error(`Unexpected type '${part.type}'`);
1912
+ }
1913
+ }
1914
+ flushSpaces();
1915
+ return {
1916
+ ...ind,
1917
+ value,
1918
+ length,
1919
+ queue
1920
+ };
1921
+ function addTabs(count) {
1922
+ value += " ".repeat(count);
1923
+ length += options.tabWidth * count;
1924
+ }
1925
+ function addSpaces(count) {
1926
+ value += " ".repeat(count);
1927
+ length += count;
1928
+ }
1929
+ function flush() {
1930
+ if (options.useTabs) {
1931
+ flushTabs();
1932
+ } else {
1933
+ flushSpaces();
1934
+ }
1935
+ }
1936
+ function flushTabs() {
1937
+ if (lastTabs > 0) {
1938
+ addTabs(lastTabs);
1939
+ }
1940
+ resetLast();
1941
+ }
1942
+ function flushSpaces() {
1943
+ if (lastSpaces > 0) {
1944
+ addSpaces(lastSpaces);
1945
+ }
1946
+ resetLast();
1947
+ }
1948
+ function resetLast() {
1949
+ lastTabs = 0;
1950
+ lastSpaces = 0;
1951
+ }
1952
+ }
1953
+ function trim2(out) {
1954
+ let trimCount = 0;
1955
+ let cursorCount = 0;
1956
+ let outIndex = out.length;
1957
+ outer:
1958
+ while (outIndex--) {
1959
+ const last = out[outIndex];
1960
+ if (last === CURSOR_PLACEHOLDER) {
1961
+ cursorCount++;
1962
+ continue;
1963
+ }
1964
+ for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
1965
+ const char = last[charIndex];
1966
+ if (char === " " || char === " ") {
1967
+ trimCount++;
1968
+ } else {
1969
+ out[outIndex] = last.slice(0, charIndex + 1);
1970
+ break outer;
1971
+ }
1972
+ }
1973
+ }
1974
+ if (trimCount > 0 || cursorCount > 0) {
1975
+ out.length = outIndex + 1;
1976
+ while (cursorCount-- > 0) {
1977
+ out.push(CURSOR_PLACEHOLDER);
1978
+ }
1979
+ }
1980
+ return trimCount;
1981
+ }
1982
+ function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
1983
+ if (width === Number.POSITIVE_INFINITY) {
1984
+ return true;
1985
+ }
1986
+ let restIdx = restCommands.length;
1987
+ const cmds = [next];
1988
+ const out = [];
1989
+ while (width >= 0) {
1990
+ if (cmds.length === 0) {
1991
+ if (restIdx === 0) {
1992
+ return true;
1993
+ }
1994
+ cmds.push(restCommands[--restIdx]);
1995
+ continue;
1996
+ }
1997
+ const {
1998
+ mode,
1999
+ doc
2000
+ } = cmds.pop();
2001
+ switch (get_doc_type_default(doc)) {
2002
+ case DOC_TYPE_STRING:
2003
+ out.push(doc);
2004
+ width -= get_string_width_default(doc);
2005
+ break;
2006
+ case DOC_TYPE_ARRAY:
2007
+ case DOC_TYPE_FILL: {
2008
+ const parts = getDocParts(doc);
2009
+ for (let i = parts.length - 1; i >= 0; i--) {
2010
+ cmds.push({
2011
+ mode,
2012
+ doc: parts[i]
2013
+ });
2014
+ }
2015
+ break;
2016
+ }
2017
+ case DOC_TYPE_INDENT:
2018
+ case DOC_TYPE_ALIGN:
2019
+ case DOC_TYPE_INDENT_IF_BREAK:
2020
+ case DOC_TYPE_LABEL:
2021
+ cmds.push({
2022
+ mode,
2023
+ doc: doc.contents
2024
+ });
2025
+ break;
2026
+ case DOC_TYPE_TRIM:
2027
+ width += trim2(out);
2028
+ break;
2029
+ case DOC_TYPE_GROUP: {
2030
+ if (mustBeFlat && doc.break) {
2031
+ return false;
2032
+ }
2033
+ const groupMode = doc.break ? MODE_BREAK : mode;
2034
+ const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default(
2035
+ /* isOptionalObject*/
2036
+ false,
2037
+ doc.expandedStates,
2038
+ -1
2039
+ ) : doc.contents;
2040
+ cmds.push({
2041
+ mode: groupMode,
2042
+ doc: contents
2043
+ });
2044
+ break;
2045
+ }
2046
+ case DOC_TYPE_IF_BREAK: {
2047
+ const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode;
2048
+ const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents;
2049
+ if (contents) {
2050
+ cmds.push({
2051
+ mode,
2052
+ doc: contents
2053
+ });
2054
+ }
2055
+ break;
2056
+ }
2057
+ case DOC_TYPE_LINE:
2058
+ if (mode === MODE_BREAK || doc.hard) {
2059
+ return true;
2060
+ }
2061
+ if (!doc.soft) {
2062
+ out.push(" ");
2063
+ width--;
2064
+ }
2065
+ break;
2066
+ case DOC_TYPE_LINE_SUFFIX:
2067
+ hasLineSuffix = true;
2068
+ break;
2069
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
2070
+ if (hasLineSuffix) {
2071
+ return false;
2072
+ }
2073
+ break;
2074
+ }
2075
+ }
2076
+ return false;
2077
+ }
2078
+ function printDocToString(doc, options) {
2079
+ const groupModeMap = {};
2080
+ const width = options.printWidth;
2081
+ const newLine = convertEndOfLineToChars(options.endOfLine);
2082
+ let pos = 0;
2083
+ const cmds = [{
2084
+ ind: rootIndent(),
2085
+ mode: MODE_BREAK,
2086
+ doc
2087
+ }];
2088
+ const out = [];
2089
+ let shouldRemeasure = false;
2090
+ const lineSuffix2 = [];
2091
+ let printedCursorCount = 0;
2092
+ propagateBreaks(doc);
2093
+ while (cmds.length > 0) {
2094
+ const {
2095
+ ind,
2096
+ mode,
2097
+ doc: doc2
2098
+ } = cmds.pop();
2099
+ switch (get_doc_type_default(doc2)) {
2100
+ case DOC_TYPE_STRING: {
2101
+ const formatted = newLine !== "\n" ? string_replace_all_default(
2102
+ /* isOptionalObject*/
2103
+ false,
2104
+ doc2,
2105
+ "\n",
2106
+ newLine
2107
+ ) : doc2;
2108
+ out.push(formatted);
2109
+ if (cmds.length > 0) {
2110
+ pos += get_string_width_default(formatted);
2111
+ }
2112
+ break;
2113
+ }
2114
+ case DOC_TYPE_ARRAY:
2115
+ for (let i = doc2.length - 1; i >= 0; i--) {
2116
+ cmds.push({
2117
+ ind,
2118
+ mode,
2119
+ doc: doc2[i]
2120
+ });
2121
+ }
2122
+ break;
2123
+ case DOC_TYPE_CURSOR:
2124
+ if (printedCursorCount >= 2) {
2125
+ throw new Error("There are too many 'cursor' in doc.");
2126
+ }
2127
+ out.push(CURSOR_PLACEHOLDER);
2128
+ printedCursorCount++;
2129
+ break;
2130
+ case DOC_TYPE_INDENT:
2131
+ cmds.push({
2132
+ ind: makeIndent(ind, options),
2133
+ mode,
2134
+ doc: doc2.contents
2135
+ });
2136
+ break;
2137
+ case DOC_TYPE_ALIGN:
2138
+ cmds.push({
2139
+ ind: makeAlign(ind, doc2.n, options),
2140
+ mode,
2141
+ doc: doc2.contents
2142
+ });
2143
+ break;
2144
+ case DOC_TYPE_TRIM:
2145
+ pos -= trim2(out);
2146
+ break;
2147
+ case DOC_TYPE_GROUP:
2148
+ switch (mode) {
2149
+ case MODE_FLAT:
2150
+ if (!shouldRemeasure) {
2151
+ cmds.push({
2152
+ ind,
2153
+ mode: doc2.break ? MODE_BREAK : MODE_FLAT,
2154
+ doc: doc2.contents
2155
+ });
2156
+ break;
2157
+ }
2158
+ case MODE_BREAK: {
2159
+ shouldRemeasure = false;
2160
+ const next = {
2161
+ ind,
2162
+ mode: MODE_FLAT,
2163
+ doc: doc2.contents
2164
+ };
2165
+ const rem = width - pos;
2166
+ const hasLineSuffix = lineSuffix2.length > 0;
2167
+ if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
2168
+ cmds.push(next);
2169
+ } else {
2170
+ if (doc2.expandedStates) {
2171
+ const mostExpanded = at_default(
2172
+ /* isOptionalObject*/
2173
+ false,
2174
+ doc2.expandedStates,
2175
+ -1
2176
+ );
2177
+ if (doc2.break) {
2178
+ cmds.push({
2179
+ ind,
2180
+ mode: MODE_BREAK,
2181
+ doc: mostExpanded
2182
+ });
2183
+ break;
2184
+ } else {
2185
+ for (let i = 1; i < doc2.expandedStates.length + 1; i++) {
2186
+ if (i >= doc2.expandedStates.length) {
2187
+ cmds.push({
2188
+ ind,
2189
+ mode: MODE_BREAK,
2190
+ doc: mostExpanded
2191
+ });
2192
+ break;
2193
+ } else {
2194
+ const state = doc2.expandedStates[i];
2195
+ const cmd = {
2196
+ ind,
2197
+ mode: MODE_FLAT,
2198
+ doc: state
2199
+ };
2200
+ if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
2201
+ cmds.push(cmd);
2202
+ break;
2203
+ }
2204
+ }
2205
+ }
2206
+ }
2207
+ } else {
2208
+ cmds.push({
2209
+ ind,
2210
+ mode: MODE_BREAK,
2211
+ doc: doc2.contents
2212
+ });
2213
+ }
2214
+ }
2215
+ break;
2216
+ }
2217
+ }
2218
+ if (doc2.id) {
2219
+ groupModeMap[doc2.id] = at_default(
2220
+ /* isOptionalObject*/
2221
+ false,
2222
+ cmds,
2223
+ -1
2224
+ ).mode;
2225
+ }
2226
+ break;
2227
+ case DOC_TYPE_FILL: {
2228
+ const rem = width - pos;
2229
+ const {
2230
+ parts
2231
+ } = doc2;
2232
+ if (parts.length === 0) {
2233
+ break;
2234
+ }
2235
+ const [content, whitespace] = parts;
2236
+ const contentFlatCmd = {
2237
+ ind,
2238
+ mode: MODE_FLAT,
2239
+ doc: content
2240
+ };
2241
+ const contentBreakCmd = {
2242
+ ind,
2243
+ mode: MODE_BREAK,
2244
+ doc: content
2245
+ };
2246
+ const contentFits = fits(contentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true);
2247
+ if (parts.length === 1) {
2248
+ if (contentFits) {
2249
+ cmds.push(contentFlatCmd);
2250
+ } else {
2251
+ cmds.push(contentBreakCmd);
2252
+ }
2253
+ break;
2254
+ }
2255
+ const whitespaceFlatCmd = {
2256
+ ind,
2257
+ mode: MODE_FLAT,
2258
+ doc: whitespace
1773
2259
  };
1774
- }
1775
- function reportDiagnostic(program, diagnostic) {
1776
- const diag = createDiagnostic(diagnostic);
1777
- program.reportDiagnostic(diag);
1778
- }
2260
+ const whitespaceBreakCmd = {
2261
+ ind,
2262
+ mode: MODE_BREAK,
2263
+ doc: whitespace
2264
+ };
2265
+ if (parts.length === 2) {
2266
+ if (contentFits) {
2267
+ cmds.push(whitespaceFlatCmd, contentFlatCmd);
2268
+ } else {
2269
+ cmds.push(whitespaceBreakCmd, contentBreakCmd);
2270
+ }
2271
+ break;
2272
+ }
2273
+ parts.splice(0, 2);
2274
+ const remainingCmd = {
2275
+ ind,
2276
+ mode,
2277
+ doc: fill(parts)
2278
+ };
2279
+ const secondContent = parts[0];
2280
+ const firstAndSecondContentFlatCmd = {
2281
+ ind,
2282
+ mode: MODE_FLAT,
2283
+ doc: [content, whitespace, secondContent]
2284
+ };
2285
+ const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true);
2286
+ if (firstAndSecondContentFits) {
2287
+ cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
2288
+ } else if (contentFits) {
2289
+ cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
2290
+ } else {
2291
+ cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
2292
+ }
2293
+ break;
2294
+ }
2295
+ case DOC_TYPE_IF_BREAK:
2296
+ case DOC_TYPE_INDENT_IF_BREAK: {
2297
+ const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode;
2298
+ if (groupMode === MODE_BREAK) {
2299
+ const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent$1(doc2.contents);
2300
+ if (breakContents) {
2301
+ cmds.push({
2302
+ ind,
2303
+ mode,
2304
+ doc: breakContents
2305
+ });
2306
+ }
2307
+ }
2308
+ if (groupMode === MODE_FLAT) {
2309
+ const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent$1(doc2.contents) : doc2.contents;
2310
+ if (flatContents) {
2311
+ cmds.push({
2312
+ ind,
2313
+ mode,
2314
+ doc: flatContents
2315
+ });
2316
+ }
2317
+ }
2318
+ break;
2319
+ }
2320
+ case DOC_TYPE_LINE_SUFFIX:
2321
+ lineSuffix2.push({
2322
+ ind,
2323
+ mode,
2324
+ doc: doc2.contents
2325
+ });
2326
+ break;
2327
+ case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
2328
+ if (lineSuffix2.length > 0) {
2329
+ cmds.push({
2330
+ ind,
2331
+ mode,
2332
+ doc: hardlineWithoutBreakParent
2333
+ });
2334
+ }
2335
+ break;
2336
+ case DOC_TYPE_LINE:
2337
+ switch (mode) {
2338
+ case MODE_FLAT:
2339
+ if (!doc2.hard) {
2340
+ if (!doc2.soft) {
2341
+ out.push(" ");
2342
+ pos += 1;
2343
+ }
2344
+ break;
2345
+ } else {
2346
+ shouldRemeasure = true;
2347
+ }
2348
+ case MODE_BREAK:
2349
+ if (lineSuffix2.length > 0) {
2350
+ cmds.push({
2351
+ ind,
2352
+ mode,
2353
+ doc: doc2
2354
+ }, ...lineSuffix2.reverse());
2355
+ lineSuffix2.length = 0;
2356
+ break;
2357
+ }
2358
+ if (doc2.literal) {
2359
+ if (ind.root) {
2360
+ out.push(newLine, ind.root.value);
2361
+ pos = ind.root.length;
2362
+ } else {
2363
+ out.push(newLine);
2364
+ pos = 0;
2365
+ }
2366
+ } else {
2367
+ pos -= trim2(out);
2368
+ out.push(newLine + ind.value);
2369
+ pos = ind.length;
2370
+ }
2371
+ break;
2372
+ }
2373
+ break;
2374
+ case DOC_TYPE_LABEL:
2375
+ cmds.push({
2376
+ ind,
2377
+ mode,
2378
+ doc: doc2.contents
2379
+ });
2380
+ break;
2381
+ case DOC_TYPE_BREAK_PARENT:
2382
+ break;
2383
+ default:
2384
+ throw new invalid_doc_error_default(doc2);
2385
+ }
2386
+ if (cmds.length === 0 && lineSuffix2.length > 0) {
2387
+ cmds.push(...lineSuffix2.reverse());
2388
+ lineSuffix2.length = 0;
2389
+ }
2390
+ }
2391
+ const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
2392
+ if (cursorPlaceholderIndex !== -1) {
2393
+ const otherCursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER, cursorPlaceholderIndex + 1);
2394
+ const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
2395
+ const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
2396
+ const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
1779
2397
  return {
1780
- diagnostics,
1781
- createDiagnostic,
1782
- reportDiagnostic,
2398
+ formatted: beforeCursor + aroundCursor + afterCursor,
2399
+ cursorNodeStart: beforeCursor.length,
2400
+ cursorNodeText: aroundCursor
1783
2401
  };
2402
+ }
2403
+ return {
2404
+ formatted: out.join("")
2405
+ };
1784
2406
  }
1785
- function createSourceFile(text, path) {
1786
- let lineStarts = undefined;
1787
- return {
1788
- text,
1789
- path,
1790
- getLineStarts,
1791
- getLineAndCharacterOfPosition,
1792
- };
1793
- function getLineStarts() {
1794
- return (lineStarts = lineStarts !== null && lineStarts !== void 0 ? lineStarts : scanLineStarts(text));
1795
- }
1796
- function getLineAndCharacterOfPosition(position) {
1797
- const starts = getLineStarts();
1798
- let line = binarySearch(starts, position);
1799
- // When binarySearch returns < 0 indicating that the value was not found, it
1800
- // returns the bitwise complement of the index where the value would need to
1801
- // be inserted to keep the array sorted. So flipping the bits back to this
1802
- // positive index tells us what the line number would be if we were to
1803
- // create a new line starting at the given position, and subtracting 1 from
1804
- // that therefore gives us the line number we're after.
1805
- if (line < 0) {
1806
- line = ~line - 1;
1807
- }
1808
- return {
1809
- line,
1810
- character: position - starts[line],
1811
- };
1812
- }
2407
+
2408
+ // src/document/public.js
2409
+ var builders = {
2410
+ join: join$1,
2411
+ line: line$1,
2412
+ softline: softline$1,
2413
+ hardline: hardline$1,
2414
+ literalline,
2415
+ group: group$1,
2416
+ conditionalGroup,
2417
+ fill,
2418
+ lineSuffix,
2419
+ lineSuffixBoundary,
2420
+ cursor,
2421
+ breakParent: breakParent$1,
2422
+ ifBreak: ifBreak$1,
2423
+ trim: trim$1,
2424
+ indent: indent$1,
2425
+ indentIfBreak,
2426
+ align: align$1,
2427
+ addAlignmentToDoc,
2428
+ markAsRoot,
2429
+ dedentToRoot,
2430
+ dedent,
2431
+ hardlineWithoutBreakParent,
2432
+ literallineWithoutBreakParent,
2433
+ label,
2434
+ // TODO: Remove this in v4
2435
+ concat: (parts) => parts
2436
+ };
2437
+ var printer = { printDocToString };
2438
+ var utils = {
2439
+ willBreak,
2440
+ traverseDoc: traverse_doc_default,
2441
+ findInDoc,
2442
+ mapDoc,
2443
+ removeLines,
2444
+ stripTrailingHardline,
2445
+ replaceEndOfLine,
2446
+ canBreak
2447
+ };
2448
+
2449
+ //
2450
+ // Generated by scripts/regen-nonascii-map.js
2451
+ // on node v18.16.0 with unicode 15.0.
2452
+ //
2453
+ /**
2454
+ * @internal
2455
+ *
2456
+ * Map of non-ascii characters that are valid in an identifier. Each pair of
2457
+ * numbers represents an inclusive range of code points.
2458
+ */
2459
+ //prettier-ignore
2460
+ const nonAsciiIdentifierMap = [
2461
+ 0xa0, 0x377,
2462
+ 0x37a, 0x37f,
2463
+ 0x384, 0x38a,
2464
+ 0x38c, 0x38c,
2465
+ 0x38e, 0x3a1,
2466
+ 0x3a3, 0x52f,
2467
+ 0x531, 0x556,
2468
+ 0x559, 0x58a,
2469
+ 0x58d, 0x58f,
2470
+ 0x591, 0x5c7,
2471
+ 0x5d0, 0x5ea,
2472
+ 0x5ef, 0x5f4,
2473
+ 0x600, 0x70d,
2474
+ 0x70f, 0x74a,
2475
+ 0x74d, 0x7b1,
2476
+ 0x7c0, 0x7fa,
2477
+ 0x7fd, 0x82d,
2478
+ 0x830, 0x83e,
2479
+ 0x840, 0x85b,
2480
+ 0x85e, 0x85e,
2481
+ 0x860, 0x86a,
2482
+ 0x870, 0x88e,
2483
+ 0x890, 0x891,
2484
+ 0x898, 0x983,
2485
+ 0x985, 0x98c,
2486
+ 0x98f, 0x990,
2487
+ 0x993, 0x9a8,
2488
+ 0x9aa, 0x9b0,
2489
+ 0x9b2, 0x9b2,
2490
+ 0x9b6, 0x9b9,
2491
+ 0x9bc, 0x9c4,
2492
+ 0x9c7, 0x9c8,
2493
+ 0x9cb, 0x9ce,
2494
+ 0x9d7, 0x9d7,
2495
+ 0x9dc, 0x9dd,
2496
+ 0x9df, 0x9e3,
2497
+ 0x9e6, 0x9fe,
2498
+ 0xa01, 0xa03,
2499
+ 0xa05, 0xa0a,
2500
+ 0xa0f, 0xa10,
2501
+ 0xa13, 0xa28,
2502
+ 0xa2a, 0xa30,
2503
+ 0xa32, 0xa33,
2504
+ 0xa35, 0xa36,
2505
+ 0xa38, 0xa39,
2506
+ 0xa3c, 0xa3c,
2507
+ 0xa3e, 0xa42,
2508
+ 0xa47, 0xa48,
2509
+ 0xa4b, 0xa4d,
2510
+ 0xa51, 0xa51,
2511
+ 0xa59, 0xa5c,
2512
+ 0xa5e, 0xa5e,
2513
+ 0xa66, 0xa76,
2514
+ 0xa81, 0xa83,
2515
+ 0xa85, 0xa8d,
2516
+ 0xa8f, 0xa91,
2517
+ 0xa93, 0xaa8,
2518
+ 0xaaa, 0xab0,
2519
+ 0xab2, 0xab3,
2520
+ 0xab5, 0xab9,
2521
+ 0xabc, 0xac5,
2522
+ 0xac7, 0xac9,
2523
+ 0xacb, 0xacd,
2524
+ 0xad0, 0xad0,
2525
+ 0xae0, 0xae3,
2526
+ 0xae6, 0xaf1,
2527
+ 0xaf9, 0xaff,
2528
+ 0xb01, 0xb03,
2529
+ 0xb05, 0xb0c,
2530
+ 0xb0f, 0xb10,
2531
+ 0xb13, 0xb28,
2532
+ 0xb2a, 0xb30,
2533
+ 0xb32, 0xb33,
2534
+ 0xb35, 0xb39,
2535
+ 0xb3c, 0xb44,
2536
+ 0xb47, 0xb48,
2537
+ 0xb4b, 0xb4d,
2538
+ 0xb55, 0xb57,
2539
+ 0xb5c, 0xb5d,
2540
+ 0xb5f, 0xb63,
2541
+ 0xb66, 0xb77,
2542
+ 0xb82, 0xb83,
2543
+ 0xb85, 0xb8a,
2544
+ 0xb8e, 0xb90,
2545
+ 0xb92, 0xb95,
2546
+ 0xb99, 0xb9a,
2547
+ 0xb9c, 0xb9c,
2548
+ 0xb9e, 0xb9f,
2549
+ 0xba3, 0xba4,
2550
+ 0xba8, 0xbaa,
2551
+ 0xbae, 0xbb9,
2552
+ 0xbbe, 0xbc2,
2553
+ 0xbc6, 0xbc8,
2554
+ 0xbca, 0xbcd,
2555
+ 0xbd0, 0xbd0,
2556
+ 0xbd7, 0xbd7,
2557
+ 0xbe6, 0xbfa,
2558
+ 0xc00, 0xc0c,
2559
+ 0xc0e, 0xc10,
2560
+ 0xc12, 0xc28,
2561
+ 0xc2a, 0xc39,
2562
+ 0xc3c, 0xc44,
2563
+ 0xc46, 0xc48,
2564
+ 0xc4a, 0xc4d,
2565
+ 0xc55, 0xc56,
2566
+ 0xc58, 0xc5a,
2567
+ 0xc5d, 0xc5d,
2568
+ 0xc60, 0xc63,
2569
+ 0xc66, 0xc6f,
2570
+ 0xc77, 0xc8c,
2571
+ 0xc8e, 0xc90,
2572
+ 0xc92, 0xca8,
2573
+ 0xcaa, 0xcb3,
2574
+ 0xcb5, 0xcb9,
2575
+ 0xcbc, 0xcc4,
2576
+ 0xcc6, 0xcc8,
2577
+ 0xcca, 0xccd,
2578
+ 0xcd5, 0xcd6,
2579
+ 0xcdd, 0xcde,
2580
+ 0xce0, 0xce3,
2581
+ 0xce6, 0xcef,
2582
+ 0xcf1, 0xcf3,
2583
+ 0xd00, 0xd0c,
2584
+ 0xd0e, 0xd10,
2585
+ 0xd12, 0xd44,
2586
+ 0xd46, 0xd48,
2587
+ 0xd4a, 0xd4f,
2588
+ 0xd54, 0xd63,
2589
+ 0xd66, 0xd7f,
2590
+ 0xd81, 0xd83,
2591
+ 0xd85, 0xd96,
2592
+ 0xd9a, 0xdb1,
2593
+ 0xdb3, 0xdbb,
2594
+ 0xdbd, 0xdbd,
2595
+ 0xdc0, 0xdc6,
2596
+ 0xdca, 0xdca,
2597
+ 0xdcf, 0xdd4,
2598
+ 0xdd6, 0xdd6,
2599
+ 0xdd8, 0xddf,
2600
+ 0xde6, 0xdef,
2601
+ 0xdf2, 0xdf4,
2602
+ 0xe01, 0xe3a,
2603
+ 0xe3f, 0xe5b,
2604
+ 0xe81, 0xe82,
2605
+ 0xe84, 0xe84,
2606
+ 0xe86, 0xe8a,
2607
+ 0xe8c, 0xea3,
2608
+ 0xea5, 0xea5,
2609
+ 0xea7, 0xebd,
2610
+ 0xec0, 0xec4,
2611
+ 0xec6, 0xec6,
2612
+ 0xec8, 0xece,
2613
+ 0xed0, 0xed9,
2614
+ 0xedc, 0xedf,
2615
+ 0xf00, 0xf47,
2616
+ 0xf49, 0xf6c,
2617
+ 0xf71, 0xf97,
2618
+ 0xf99, 0xfbc,
2619
+ 0xfbe, 0xfcc,
2620
+ 0xfce, 0xfda,
2621
+ 0x1000, 0x10c5,
2622
+ 0x10c7, 0x10c7,
2623
+ 0x10cd, 0x10cd,
2624
+ 0x10d0, 0x1248,
2625
+ 0x124a, 0x124d,
2626
+ 0x1250, 0x1256,
2627
+ 0x1258, 0x1258,
2628
+ 0x125a, 0x125d,
2629
+ 0x1260, 0x1288,
2630
+ 0x128a, 0x128d,
2631
+ 0x1290, 0x12b0,
2632
+ 0x12b2, 0x12b5,
2633
+ 0x12b8, 0x12be,
2634
+ 0x12c0, 0x12c0,
2635
+ 0x12c2, 0x12c5,
2636
+ 0x12c8, 0x12d6,
2637
+ 0x12d8, 0x1310,
2638
+ 0x1312, 0x1315,
2639
+ 0x1318, 0x135a,
2640
+ 0x135d, 0x137c,
2641
+ 0x1380, 0x1399,
2642
+ 0x13a0, 0x13f5,
2643
+ 0x13f8, 0x13fd,
2644
+ 0x1400, 0x169c,
2645
+ 0x16a0, 0x16f8,
2646
+ 0x1700, 0x1715,
2647
+ 0x171f, 0x1736,
2648
+ 0x1740, 0x1753,
2649
+ 0x1760, 0x176c,
2650
+ 0x176e, 0x1770,
2651
+ 0x1772, 0x1773,
2652
+ 0x1780, 0x17dd,
2653
+ 0x17e0, 0x17e9,
2654
+ 0x17f0, 0x17f9,
2655
+ 0x1800, 0x1819,
2656
+ 0x1820, 0x1878,
2657
+ 0x1880, 0x18aa,
2658
+ 0x18b0, 0x18f5,
2659
+ 0x1900, 0x191e,
2660
+ 0x1920, 0x192b,
2661
+ 0x1930, 0x193b,
2662
+ 0x1940, 0x1940,
2663
+ 0x1944, 0x196d,
2664
+ 0x1970, 0x1974,
2665
+ 0x1980, 0x19ab,
2666
+ 0x19b0, 0x19c9,
2667
+ 0x19d0, 0x19da,
2668
+ 0x19de, 0x1a1b,
2669
+ 0x1a1e, 0x1a5e,
2670
+ 0x1a60, 0x1a7c,
2671
+ 0x1a7f, 0x1a89,
2672
+ 0x1a90, 0x1a99,
2673
+ 0x1aa0, 0x1aad,
2674
+ 0x1ab0, 0x1ace,
2675
+ 0x1b00, 0x1b4c,
2676
+ 0x1b50, 0x1b7e,
2677
+ 0x1b80, 0x1bf3,
2678
+ 0x1bfc, 0x1c37,
2679
+ 0x1c3b, 0x1c49,
2680
+ 0x1c4d, 0x1c88,
2681
+ 0x1c90, 0x1cba,
2682
+ 0x1cbd, 0x1cc7,
2683
+ 0x1cd0, 0x1cfa,
2684
+ 0x1d00, 0x1f15,
2685
+ 0x1f18, 0x1f1d,
2686
+ 0x1f20, 0x1f45,
2687
+ 0x1f48, 0x1f4d,
2688
+ 0x1f50, 0x1f57,
2689
+ 0x1f59, 0x1f59,
2690
+ 0x1f5b, 0x1f5b,
2691
+ 0x1f5d, 0x1f5d,
2692
+ 0x1f5f, 0x1f7d,
2693
+ 0x1f80, 0x1fb4,
2694
+ 0x1fb6, 0x1fc4,
2695
+ 0x1fc6, 0x1fd3,
2696
+ 0x1fd6, 0x1fdb,
2697
+ 0x1fdd, 0x1fef,
2698
+ 0x1ff2, 0x1ff4,
2699
+ 0x1ff6, 0x1ffe,
2700
+ 0x2000, 0x200d,
2701
+ 0x2010, 0x2027,
2702
+ 0x202a, 0x2064,
2703
+ 0x2066, 0x2071,
2704
+ 0x2074, 0x208e,
2705
+ 0x2090, 0x209c,
2706
+ 0x20a0, 0x20c0,
2707
+ 0x20d0, 0x20f0,
2708
+ 0x2100, 0x218b,
2709
+ 0x2190, 0x2426,
2710
+ 0x2440, 0x244a,
2711
+ 0x2460, 0x2b73,
2712
+ 0x2b76, 0x2b95,
2713
+ 0x2b97, 0x2cf3,
2714
+ 0x2cf9, 0x2d25,
2715
+ 0x2d27, 0x2d27,
2716
+ 0x2d2d, 0x2d2d,
2717
+ 0x2d30, 0x2d67,
2718
+ 0x2d6f, 0x2d70,
2719
+ 0x2d7f, 0x2d96,
2720
+ 0x2da0, 0x2da6,
2721
+ 0x2da8, 0x2dae,
2722
+ 0x2db0, 0x2db6,
2723
+ 0x2db8, 0x2dbe,
2724
+ 0x2dc0, 0x2dc6,
2725
+ 0x2dc8, 0x2dce,
2726
+ 0x2dd0, 0x2dd6,
2727
+ 0x2dd8, 0x2dde,
2728
+ 0x2de0, 0x2e5d,
2729
+ 0x2e80, 0x2e99,
2730
+ 0x2e9b, 0x2ef3,
2731
+ 0x2f00, 0x2fd5,
2732
+ 0x2ff0, 0x2ffb,
2733
+ 0x3000, 0x303f,
2734
+ 0x3041, 0x3096,
2735
+ 0x3099, 0x30ff,
2736
+ 0x3105, 0x312f,
2737
+ 0x3131, 0x318e,
2738
+ 0x3190, 0x31e3,
2739
+ 0x31f0, 0x321e,
2740
+ 0x3220, 0xa48c,
2741
+ 0xa490, 0xa4c6,
2742
+ 0xa4d0, 0xa62b,
2743
+ 0xa640, 0xa6f7,
2744
+ 0xa700, 0xa7ca,
2745
+ 0xa7d0, 0xa7d1,
2746
+ 0xa7d3, 0xa7d3,
2747
+ 0xa7d5, 0xa7d9,
2748
+ 0xa7f2, 0xa82c,
2749
+ 0xa830, 0xa839,
2750
+ 0xa840, 0xa877,
2751
+ 0xa880, 0xa8c5,
2752
+ 0xa8ce, 0xa8d9,
2753
+ 0xa8e0, 0xa953,
2754
+ 0xa95f, 0xa97c,
2755
+ 0xa980, 0xa9cd,
2756
+ 0xa9cf, 0xa9d9,
2757
+ 0xa9de, 0xa9fe,
2758
+ 0xaa00, 0xaa36,
2759
+ 0xaa40, 0xaa4d,
2760
+ 0xaa50, 0xaa59,
2761
+ 0xaa5c, 0xaac2,
2762
+ 0xaadb, 0xaaf6,
2763
+ 0xab01, 0xab06,
2764
+ 0xab09, 0xab0e,
2765
+ 0xab11, 0xab16,
2766
+ 0xab20, 0xab26,
2767
+ 0xab28, 0xab2e,
2768
+ 0xab30, 0xab6b,
2769
+ 0xab70, 0xabed,
2770
+ 0xabf0, 0xabf9,
2771
+ 0xac00, 0xd7a3,
2772
+ 0xd7b0, 0xd7c6,
2773
+ 0xd7cb, 0xd7fb,
2774
+ 0xf900, 0xfa6d,
2775
+ 0xfa70, 0xfad9,
2776
+ 0xfb00, 0xfb06,
2777
+ 0xfb13, 0xfb17,
2778
+ 0xfb1d, 0xfb36,
2779
+ 0xfb38, 0xfb3c,
2780
+ 0xfb3e, 0xfb3e,
2781
+ 0xfb40, 0xfb41,
2782
+ 0xfb43, 0xfb44,
2783
+ 0xfb46, 0xfbc2,
2784
+ 0xfbd3, 0xfd8f,
2785
+ 0xfd92, 0xfdc7,
2786
+ 0xfdcf, 0xfdcf,
2787
+ 0xfdf0, 0xfe19,
2788
+ 0xfe20, 0xfe52,
2789
+ 0xfe54, 0xfe66,
2790
+ 0xfe68, 0xfe6b,
2791
+ 0xfe70, 0xfe74,
2792
+ 0xfe76, 0xfefc,
2793
+ 0xfeff, 0xfeff,
2794
+ 0xff01, 0xffbe,
2795
+ 0xffc2, 0xffc7,
2796
+ 0xffca, 0xffcf,
2797
+ 0xffd2, 0xffd7,
2798
+ 0xffda, 0xffdc,
2799
+ 0xffe0, 0xffe6,
2800
+ 0xffe8, 0xffee,
2801
+ 0xfff9, 0xfffc,
2802
+ 0x10000, 0x1000b,
2803
+ 0x1000d, 0x10026,
2804
+ 0x10028, 0x1003a,
2805
+ 0x1003c, 0x1003d,
2806
+ 0x1003f, 0x1004d,
2807
+ 0x10050, 0x1005d,
2808
+ 0x10080, 0x100fa,
2809
+ 0x10100, 0x10102,
2810
+ 0x10107, 0x10133,
2811
+ 0x10137, 0x1018e,
2812
+ 0x10190, 0x1019c,
2813
+ 0x101a0, 0x101a0,
2814
+ 0x101d0, 0x101fd,
2815
+ 0x10280, 0x1029c,
2816
+ 0x102a0, 0x102d0,
2817
+ 0x102e0, 0x102fb,
2818
+ 0x10300, 0x10323,
2819
+ 0x1032d, 0x1034a,
2820
+ 0x10350, 0x1037a,
2821
+ 0x10380, 0x1039d,
2822
+ 0x1039f, 0x103c3,
2823
+ 0x103c8, 0x103d5,
2824
+ 0x10400, 0x1049d,
2825
+ 0x104a0, 0x104a9,
2826
+ 0x104b0, 0x104d3,
2827
+ 0x104d8, 0x104fb,
2828
+ 0x10500, 0x10527,
2829
+ 0x10530, 0x10563,
2830
+ 0x1056f, 0x1057a,
2831
+ 0x1057c, 0x1058a,
2832
+ 0x1058c, 0x10592,
2833
+ 0x10594, 0x10595,
2834
+ 0x10597, 0x105a1,
2835
+ 0x105a3, 0x105b1,
2836
+ 0x105b3, 0x105b9,
2837
+ 0x105bb, 0x105bc,
2838
+ 0x10600, 0x10736,
2839
+ 0x10740, 0x10755,
2840
+ 0x10760, 0x10767,
2841
+ 0x10780, 0x10785,
2842
+ 0x10787, 0x107b0,
2843
+ 0x107b2, 0x107ba,
2844
+ 0x10800, 0x10805,
2845
+ 0x10808, 0x10808,
2846
+ 0x1080a, 0x10835,
2847
+ 0x10837, 0x10838,
2848
+ 0x1083c, 0x1083c,
2849
+ 0x1083f, 0x10855,
2850
+ 0x10857, 0x1089e,
2851
+ 0x108a7, 0x108af,
2852
+ 0x108e0, 0x108f2,
2853
+ 0x108f4, 0x108f5,
2854
+ 0x108fb, 0x1091b,
2855
+ 0x1091f, 0x10939,
2856
+ 0x1093f, 0x1093f,
2857
+ 0x10980, 0x109b7,
2858
+ 0x109bc, 0x109cf,
2859
+ 0x109d2, 0x10a03,
2860
+ 0x10a05, 0x10a06,
2861
+ 0x10a0c, 0x10a13,
2862
+ 0x10a15, 0x10a17,
2863
+ 0x10a19, 0x10a35,
2864
+ 0x10a38, 0x10a3a,
2865
+ 0x10a3f, 0x10a48,
2866
+ 0x10a50, 0x10a58,
2867
+ 0x10a60, 0x10a9f,
2868
+ 0x10ac0, 0x10ae6,
2869
+ 0x10aeb, 0x10af6,
2870
+ 0x10b00, 0x10b35,
2871
+ 0x10b39, 0x10b55,
2872
+ 0x10b58, 0x10b72,
2873
+ 0x10b78, 0x10b91,
2874
+ 0x10b99, 0x10b9c,
2875
+ 0x10ba9, 0x10baf,
2876
+ 0x10c00, 0x10c48,
2877
+ 0x10c80, 0x10cb2,
2878
+ 0x10cc0, 0x10cf2,
2879
+ 0x10cfa, 0x10d27,
2880
+ 0x10d30, 0x10d39,
2881
+ 0x10e60, 0x10e7e,
2882
+ 0x10e80, 0x10ea9,
2883
+ 0x10eab, 0x10ead,
2884
+ 0x10eb0, 0x10eb1,
2885
+ 0x10efd, 0x10f27,
2886
+ 0x10f30, 0x10f59,
2887
+ 0x10f70, 0x10f89,
2888
+ 0x10fb0, 0x10fcb,
2889
+ 0x10fe0, 0x10ff6,
2890
+ 0x11000, 0x1104d,
2891
+ 0x11052, 0x11075,
2892
+ 0x1107f, 0x110c2,
2893
+ 0x110cd, 0x110cd,
2894
+ 0x110d0, 0x110e8,
2895
+ 0x110f0, 0x110f9,
2896
+ 0x11100, 0x11134,
2897
+ 0x11136, 0x11147,
2898
+ 0x11150, 0x11176,
2899
+ 0x11180, 0x111df,
2900
+ 0x111e1, 0x111f4,
2901
+ 0x11200, 0x11211,
2902
+ 0x11213, 0x11241,
2903
+ 0x11280, 0x11286,
2904
+ 0x11288, 0x11288,
2905
+ 0x1128a, 0x1128d,
2906
+ 0x1128f, 0x1129d,
2907
+ 0x1129f, 0x112a9,
2908
+ 0x112b0, 0x112ea,
2909
+ 0x112f0, 0x112f9,
2910
+ 0x11300, 0x11303,
2911
+ 0x11305, 0x1130c,
2912
+ 0x1130f, 0x11310,
2913
+ 0x11313, 0x11328,
2914
+ 0x1132a, 0x11330,
2915
+ 0x11332, 0x11333,
2916
+ 0x11335, 0x11339,
2917
+ 0x1133b, 0x11344,
2918
+ 0x11347, 0x11348,
2919
+ 0x1134b, 0x1134d,
2920
+ 0x11350, 0x11350,
2921
+ 0x11357, 0x11357,
2922
+ 0x1135d, 0x11363,
2923
+ 0x11366, 0x1136c,
2924
+ 0x11370, 0x11374,
2925
+ 0x11400, 0x1145b,
2926
+ 0x1145d, 0x11461,
2927
+ 0x11480, 0x114c7,
2928
+ 0x114d0, 0x114d9,
2929
+ 0x11580, 0x115b5,
2930
+ 0x115b8, 0x115dd,
2931
+ 0x11600, 0x11644,
2932
+ 0x11650, 0x11659,
2933
+ 0x11660, 0x1166c,
2934
+ 0x11680, 0x116b9,
2935
+ 0x116c0, 0x116c9,
2936
+ 0x11700, 0x1171a,
2937
+ 0x1171d, 0x1172b,
2938
+ 0x11730, 0x11746,
2939
+ 0x11800, 0x1183b,
2940
+ 0x118a0, 0x118f2,
2941
+ 0x118ff, 0x11906,
2942
+ 0x11909, 0x11909,
2943
+ 0x1190c, 0x11913,
2944
+ 0x11915, 0x11916,
2945
+ 0x11918, 0x11935,
2946
+ 0x11937, 0x11938,
2947
+ 0x1193b, 0x11946,
2948
+ 0x11950, 0x11959,
2949
+ 0x119a0, 0x119a7,
2950
+ 0x119aa, 0x119d7,
2951
+ 0x119da, 0x119e4,
2952
+ 0x11a00, 0x11a47,
2953
+ 0x11a50, 0x11aa2,
2954
+ 0x11ab0, 0x11af8,
2955
+ 0x11b00, 0x11b09,
2956
+ 0x11c00, 0x11c08,
2957
+ 0x11c0a, 0x11c36,
2958
+ 0x11c38, 0x11c45,
2959
+ 0x11c50, 0x11c6c,
2960
+ 0x11c70, 0x11c8f,
2961
+ 0x11c92, 0x11ca7,
2962
+ 0x11ca9, 0x11cb6,
2963
+ 0x11d00, 0x11d06,
2964
+ 0x11d08, 0x11d09,
2965
+ 0x11d0b, 0x11d36,
2966
+ 0x11d3a, 0x11d3a,
2967
+ 0x11d3c, 0x11d3d,
2968
+ 0x11d3f, 0x11d47,
2969
+ 0x11d50, 0x11d59,
2970
+ 0x11d60, 0x11d65,
2971
+ 0x11d67, 0x11d68,
2972
+ 0x11d6a, 0x11d8e,
2973
+ 0x11d90, 0x11d91,
2974
+ 0x11d93, 0x11d98,
2975
+ 0x11da0, 0x11da9,
2976
+ 0x11ee0, 0x11ef8,
2977
+ 0x11f00, 0x11f10,
2978
+ 0x11f12, 0x11f3a,
2979
+ 0x11f3e, 0x11f59,
2980
+ 0x11fb0, 0x11fb0,
2981
+ 0x11fc0, 0x11ff1,
2982
+ 0x11fff, 0x12399,
2983
+ 0x12400, 0x1246e,
2984
+ 0x12470, 0x12474,
2985
+ 0x12480, 0x12543,
2986
+ 0x12f90, 0x12ff2,
2987
+ 0x13000, 0x13455,
2988
+ 0x14400, 0x14646,
2989
+ 0x16800, 0x16a38,
2990
+ 0x16a40, 0x16a5e,
2991
+ 0x16a60, 0x16a69,
2992
+ 0x16a6e, 0x16abe,
2993
+ 0x16ac0, 0x16ac9,
2994
+ 0x16ad0, 0x16aed,
2995
+ 0x16af0, 0x16af5,
2996
+ 0x16b00, 0x16b45,
2997
+ 0x16b50, 0x16b59,
2998
+ 0x16b5b, 0x16b61,
2999
+ 0x16b63, 0x16b77,
3000
+ 0x16b7d, 0x16b8f,
3001
+ 0x16e40, 0x16e9a,
3002
+ 0x16f00, 0x16f4a,
3003
+ 0x16f4f, 0x16f87,
3004
+ 0x16f8f, 0x16f9f,
3005
+ 0x16fe0, 0x16fe4,
3006
+ 0x16ff0, 0x16ff1,
3007
+ 0x17000, 0x187f7,
3008
+ 0x18800, 0x18cd5,
3009
+ 0x18d00, 0x18d08,
3010
+ 0x1aff0, 0x1aff3,
3011
+ 0x1aff5, 0x1affb,
3012
+ 0x1affd, 0x1affe,
3013
+ 0x1b000, 0x1b122,
3014
+ 0x1b132, 0x1b132,
3015
+ 0x1b150, 0x1b152,
3016
+ 0x1b155, 0x1b155,
3017
+ 0x1b164, 0x1b167,
3018
+ 0x1b170, 0x1b2fb,
3019
+ 0x1bc00, 0x1bc6a,
3020
+ 0x1bc70, 0x1bc7c,
3021
+ 0x1bc80, 0x1bc88,
3022
+ 0x1bc90, 0x1bc99,
3023
+ 0x1bc9c, 0x1bca3,
3024
+ 0x1cf00, 0x1cf2d,
3025
+ 0x1cf30, 0x1cf46,
3026
+ 0x1cf50, 0x1cfc3,
3027
+ 0x1d000, 0x1d0f5,
3028
+ 0x1d100, 0x1d126,
3029
+ 0x1d129, 0x1d1ea,
3030
+ 0x1d200, 0x1d245,
3031
+ 0x1d2c0, 0x1d2d3,
3032
+ 0x1d2e0, 0x1d2f3,
3033
+ 0x1d300, 0x1d356,
3034
+ 0x1d360, 0x1d378,
3035
+ 0x1d400, 0x1d454,
3036
+ 0x1d456, 0x1d49c,
3037
+ 0x1d49e, 0x1d49f,
3038
+ 0x1d4a2, 0x1d4a2,
3039
+ 0x1d4a5, 0x1d4a6,
3040
+ 0x1d4a9, 0x1d4ac,
3041
+ 0x1d4ae, 0x1d4b9,
3042
+ 0x1d4bb, 0x1d4bb,
3043
+ 0x1d4bd, 0x1d4c3,
3044
+ 0x1d4c5, 0x1d505,
3045
+ 0x1d507, 0x1d50a,
3046
+ 0x1d50d, 0x1d514,
3047
+ 0x1d516, 0x1d51c,
3048
+ 0x1d51e, 0x1d539,
3049
+ 0x1d53b, 0x1d53e,
3050
+ 0x1d540, 0x1d544,
3051
+ 0x1d546, 0x1d546,
3052
+ 0x1d54a, 0x1d550,
3053
+ 0x1d552, 0x1d6a5,
3054
+ 0x1d6a8, 0x1d7cb,
3055
+ 0x1d7ce, 0x1da8b,
3056
+ 0x1da9b, 0x1da9f,
3057
+ 0x1daa1, 0x1daaf,
3058
+ 0x1df00, 0x1df1e,
3059
+ 0x1df25, 0x1df2a,
3060
+ 0x1e000, 0x1e006,
3061
+ 0x1e008, 0x1e018,
3062
+ 0x1e01b, 0x1e021,
3063
+ 0x1e023, 0x1e024,
3064
+ 0x1e026, 0x1e02a,
3065
+ 0x1e030, 0x1e06d,
3066
+ 0x1e08f, 0x1e08f,
3067
+ 0x1e100, 0x1e12c,
3068
+ 0x1e130, 0x1e13d,
3069
+ 0x1e140, 0x1e149,
3070
+ 0x1e14e, 0x1e14f,
3071
+ 0x1e290, 0x1e2ae,
3072
+ 0x1e2c0, 0x1e2f9,
3073
+ 0x1e2ff, 0x1e2ff,
3074
+ 0x1e4d0, 0x1e4f9,
3075
+ 0x1e7e0, 0x1e7e6,
3076
+ 0x1e7e8, 0x1e7eb,
3077
+ 0x1e7ed, 0x1e7ee,
3078
+ 0x1e7f0, 0x1e7fe,
3079
+ 0x1e800, 0x1e8c4,
3080
+ 0x1e8c7, 0x1e8d6,
3081
+ 0x1e900, 0x1e94b,
3082
+ 0x1e950, 0x1e959,
3083
+ 0x1e95e, 0x1e95f,
3084
+ 0x1ec71, 0x1ecb4,
3085
+ 0x1ed01, 0x1ed3d,
3086
+ 0x1ee00, 0x1ee03,
3087
+ 0x1ee05, 0x1ee1f,
3088
+ 0x1ee21, 0x1ee22,
3089
+ 0x1ee24, 0x1ee24,
3090
+ 0x1ee27, 0x1ee27,
3091
+ 0x1ee29, 0x1ee32,
3092
+ 0x1ee34, 0x1ee37,
3093
+ 0x1ee39, 0x1ee39,
3094
+ 0x1ee3b, 0x1ee3b,
3095
+ 0x1ee42, 0x1ee42,
3096
+ 0x1ee47, 0x1ee47,
3097
+ 0x1ee49, 0x1ee49,
3098
+ 0x1ee4b, 0x1ee4b,
3099
+ 0x1ee4d, 0x1ee4f,
3100
+ 0x1ee51, 0x1ee52,
3101
+ 0x1ee54, 0x1ee54,
3102
+ 0x1ee57, 0x1ee57,
3103
+ 0x1ee59, 0x1ee59,
3104
+ 0x1ee5b, 0x1ee5b,
3105
+ 0x1ee5d, 0x1ee5d,
3106
+ 0x1ee5f, 0x1ee5f,
3107
+ 0x1ee61, 0x1ee62,
3108
+ 0x1ee64, 0x1ee64,
3109
+ 0x1ee67, 0x1ee6a,
3110
+ 0x1ee6c, 0x1ee72,
3111
+ 0x1ee74, 0x1ee77,
3112
+ 0x1ee79, 0x1ee7c,
3113
+ 0x1ee7e, 0x1ee7e,
3114
+ 0x1ee80, 0x1ee89,
3115
+ 0x1ee8b, 0x1ee9b,
3116
+ 0x1eea1, 0x1eea3,
3117
+ 0x1eea5, 0x1eea9,
3118
+ 0x1eeab, 0x1eebb,
3119
+ 0x1eef0, 0x1eef1,
3120
+ 0x1f000, 0x1f02b,
3121
+ 0x1f030, 0x1f093,
3122
+ 0x1f0a0, 0x1f0ae,
3123
+ 0x1f0b1, 0x1f0bf,
3124
+ 0x1f0c1, 0x1f0cf,
3125
+ 0x1f0d1, 0x1f0f5,
3126
+ 0x1f100, 0x1f1ad,
3127
+ 0x1f1e6, 0x1f202,
3128
+ 0x1f210, 0x1f23b,
3129
+ 0x1f240, 0x1f248,
3130
+ 0x1f250, 0x1f251,
3131
+ 0x1f260, 0x1f265,
3132
+ 0x1f300, 0x1f6d7,
3133
+ 0x1f6dc, 0x1f6ec,
3134
+ 0x1f6f0, 0x1f6fc,
3135
+ 0x1f700, 0x1f776,
3136
+ 0x1f77b, 0x1f7d9,
3137
+ 0x1f7e0, 0x1f7eb,
3138
+ 0x1f7f0, 0x1f7f0,
3139
+ 0x1f800, 0x1f80b,
3140
+ 0x1f810, 0x1f847,
3141
+ 0x1f850, 0x1f859,
3142
+ 0x1f860, 0x1f887,
3143
+ 0x1f890, 0x1f8ad,
3144
+ 0x1f8b0, 0x1f8b1,
3145
+ 0x1f900, 0x1fa53,
3146
+ 0x1fa60, 0x1fa6d,
3147
+ 0x1fa70, 0x1fa7c,
3148
+ 0x1fa80, 0x1fa88,
3149
+ 0x1fa90, 0x1fabd,
3150
+ 0x1fabf, 0x1fac5,
3151
+ 0x1face, 0x1fadb,
3152
+ 0x1fae0, 0x1fae8,
3153
+ 0x1faf0, 0x1faf8,
3154
+ 0x1fb00, 0x1fb92,
3155
+ 0x1fb94, 0x1fbca,
3156
+ 0x1fbf0, 0x1fbf9,
3157
+ 0x20000, 0x2a6df,
3158
+ 0x2a700, 0x2b739,
3159
+ 0x2b740, 0x2b81d,
3160
+ 0x2b820, 0x2cea1,
3161
+ 0x2ceb0, 0x2ebe0,
3162
+ 0x2f800, 0x2fa1d,
3163
+ 0x30000, 0x3134a,
3164
+ 0x31350, 0x323af,
3165
+ 0xe0001, 0xe0001,
3166
+ 0xe0020, 0xe007f,
3167
+ 0xe0100, 0xe01ef,
3168
+ ];
3169
+
3170
+ function utf16CodeUnits(codePoint) {
3171
+ return codePoint >= 0x10000 ? 2 : 1;
1813
3172
  }
1814
- function getSourceLocation(target) {
1815
- if (target === NoTarget || target === undefined) {
1816
- return undefined;
1817
- }
1818
- if ("file" in target) {
1819
- return target;
1820
- }
1821
- if (!("kind" in target)) {
1822
- // symbol
1823
- if (target.flags & 524288 /* SymbolFlags.Using */) {
1824
- target = target.symbolSource;
1825
- }
1826
- if (!target.declarations[0]) {
1827
- return createSyntheticSourceLocation();
1828
- }
1829
- return getSourceLocationOfNode(target.declarations[0]);
3173
+ function isLineBreak(ch) {
3174
+ return ch === 10 /* CharCode.LineFeed */ || ch === 13 /* CharCode.CarriageReturn */;
3175
+ }
3176
+ function isAsciiWhiteSpaceSingleLine(ch) {
3177
+ return (ch === 32 /* CharCode.Space */ ||
3178
+ ch === 9 /* CharCode.Tab */ ||
3179
+ ch === 11 /* CharCode.VerticalTab */ ||
3180
+ ch === 12 /* CharCode.FormFeed */);
3181
+ }
3182
+ function isNonAsciiWhiteSpaceSingleLine(ch) {
3183
+ return (ch === 133 /* CharCode.NextLine */ || // not considered a line break
3184
+ ch === 8206 /* CharCode.LeftToRightMark */ ||
3185
+ ch === 8207 /* CharCode.RightToLeftMark */ ||
3186
+ ch === 8232 /* CharCode.LineSeparator */ ||
3187
+ ch === 8233 /* CharCode.ParagraphSeparator */);
3188
+ }
3189
+ function isWhiteSpace(ch) {
3190
+ return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
3191
+ }
3192
+ function isWhiteSpaceSingleLine(ch) {
3193
+ return (isAsciiWhiteSpaceSingleLine(ch) ||
3194
+ (ch > 127 /* CharCode.MaxAscii */ && isNonAsciiWhiteSpaceSingleLine(ch)));
3195
+ }
3196
+ function trim(str) {
3197
+ let start = 0;
3198
+ let end = str.length - 1;
3199
+ if (!isWhiteSpace(str.charCodeAt(start)) && !isWhiteSpace(str.charCodeAt(end))) {
3200
+ return str;
1830
3201
  }
1831
- else if (typeof target.kind === "number") {
1832
- // node
1833
- return getSourceLocationOfNode(target);
3202
+ while (isWhiteSpace(str.charCodeAt(start))) {
3203
+ start++;
1834
3204
  }
1835
- else {
1836
- // type
1837
- const targetNode = target.node;
1838
- if (targetNode) {
1839
- return getSourceLocationOfNode(targetNode);
1840
- }
1841
- return createSyntheticSourceLocation();
3205
+ while (isWhiteSpace(str.charCodeAt(end))) {
3206
+ end--;
1842
3207
  }
3208
+ return str.substring(start, end + 1);
1843
3209
  }
1844
- function createSyntheticSourceLocation(loc = "<unknown location>") {
1845
- return {
1846
- file: createSourceFile("", loc),
1847
- pos: 0,
1848
- end: 0,
1849
- isSynthetic: true,
1850
- };
3210
+ function isDigit(ch) {
3211
+ return ch >= 48 /* CharCode._0 */ && ch <= 57 /* CharCode._9 */;
1851
3212
  }
1852
- function getSourceLocationOfNode(node) {
1853
- let root = node;
1854
- while (root.parent !== undefined) {
1855
- root = root.parent;
1856
- }
1857
- if (root.kind !== SyntaxKind.TypeSpecScript && root.kind !== SyntaxKind.JsSourceFile) {
1858
- return createSyntheticSourceLocation(node.flags & 8 /* NodeFlags.Synthetic */
1859
- ? undefined
1860
- : "<unknown location - cannot obtain source location of unbound node - file bug at https://github.com/microsoft/typespec>");
1861
- }
1862
- return {
1863
- file: root.file,
1864
- pos: node.pos,
1865
- end: node.end,
1866
- };
3213
+ function isHexDigit(ch) {
3214
+ return (isDigit(ch) || (ch >= 65 /* CharCode.A */ && ch <= 70 /* CharCode.F */) || (ch >= 97 /* CharCode.a */ && ch <= 102 /* CharCode.f */));
1867
3215
  }
1868
- /**
1869
- * Use this to report bugs in the compiler, and not errors in the source code
1870
- * being compiled.
1871
- *
1872
- * @param condition Throw if this is not true.
1873
- *
1874
- * @param message Error message.
1875
- *
1876
- * @param target Optional location in source code that might give a clue about
1877
- * what got the compiler off track.
1878
- */
1879
- function compilerAssert(condition, message, target) {
1880
- if (condition) {
1881
- return;
1882
- }
1883
- if (target) {
1884
- let location;
1885
- try {
1886
- location = getSourceLocation(target);
1887
- }
1888
- catch (err) { }
1889
- if (location) {
1890
- const pos = location.file.getLineAndCharacterOfPosition(location.pos);
1891
- const file = location.file.path;
1892
- const line = pos.line + 1;
1893
- const col = pos.character + 1;
1894
- message += `\nOccurred while compiling code in ${file} near line ${line}, column ${col}`;
1895
- }
1896
- }
1897
- throw new Error(message);
3216
+ function isBinaryDigit(ch) {
3217
+ return ch === 48 /* CharCode._0 */ || ch === 49 /* CharCode._1 */;
1898
3218
  }
1899
- function scanLineStarts(text) {
1900
- const starts = [];
1901
- let start = 0;
1902
- let pos = 0;
1903
- while (pos < text.length) {
1904
- const ch = text.charCodeAt(pos);
1905
- pos++;
1906
- switch (ch) {
1907
- case 13 /* CharCode.CarriageReturn */:
1908
- if (text.charCodeAt(pos) === 10 /* CharCode.LineFeed */) {
1909
- pos++;
1910
- }
1911
- // fallthrough
1912
- case 10 /* CharCode.LineFeed */:
1913
- starts.push(start);
1914
- start = pos;
1915
- break;
1916
- }
1917
- }
1918
- starts.push(start);
1919
- return starts;
3219
+ function isLowercaseAsciiLetter(ch) {
3220
+ return ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */;
1920
3221
  }
1921
- /**
1922
- * Search sorted array of numbers for the given value. If found, return index
1923
- * in array where value was found. If not found, return a negative number that
1924
- * is the bitwise complement of the index where value would need to be inserted
1925
- * to keep the array sorted.
1926
- */
1927
- function binarySearch(array, value) {
1928
- let low = 0;
1929
- let high = array.length - 1;
1930
- while (low <= high) {
1931
- const middle = low + ((high - low) >> 1);
1932
- const v = array[middle];
1933
- if (v < value) {
1934
- low = middle + 1;
3222
+ function isAsciiIdentifierStart(ch) {
3223
+ return ((ch >= 65 /* CharCode.A */ && ch <= 90 /* CharCode.Z */) ||
3224
+ (ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */) ||
3225
+ ch === 36 /* CharCode.$ */ ||
3226
+ ch === 95 /* CharCode._ */);
3227
+ }
3228
+ function isAsciiIdentifierContinue(ch) {
3229
+ return ((ch >= 65 /* CharCode.A */ && ch <= 90 /* CharCode.Z */) ||
3230
+ (ch >= 97 /* CharCode.a */ && ch <= 122 /* CharCode.z */) ||
3231
+ (ch >= 48 /* CharCode._0 */ && ch <= 57 /* CharCode._9 */) ||
3232
+ ch === 36 /* CharCode.$ */ ||
3233
+ ch === 95 /* CharCode._ */);
3234
+ }
3235
+ function isIdentifierStart(codePoint) {
3236
+ return (isAsciiIdentifierStart(codePoint) ||
3237
+ (codePoint > 127 /* CharCode.MaxAscii */ && isNonAsciiIdentifierCharacter(codePoint)));
3238
+ }
3239
+ function isIdentifierContinue(codePoint) {
3240
+ return (isAsciiIdentifierContinue(codePoint) ||
3241
+ (codePoint > 127 /* CharCode.MaxAscii */ && isNonAsciiIdentifierCharacter(codePoint)));
3242
+ }
3243
+ function isNonAsciiIdentifierCharacter(codePoint) {
3244
+ return lookupInNonAsciiMap(codePoint, nonAsciiIdentifierMap);
3245
+ }
3246
+ function lookupInNonAsciiMap(codePoint, map) {
3247
+ // Perform binary search in one of the Unicode range maps
3248
+ let lo = 0;
3249
+ let hi = map.length;
3250
+ let mid;
3251
+ while (lo + 1 < hi) {
3252
+ mid = lo + (hi - lo) / 2;
3253
+ // mid has to be even to catch a range's beginning
3254
+ mid -= mid % 2;
3255
+ if (map[mid] <= codePoint && codePoint <= map[mid + 1]) {
3256
+ return true;
1935
3257
  }
1936
- else if (v > value) {
1937
- high = middle - 1;
3258
+ if (codePoint < map[mid]) {
3259
+ hi = mid;
1938
3260
  }
1939
3261
  else {
1940
- return middle;
3262
+ lo = mid + 2;
1941
3263
  }
1942
3264
  }
1943
- return ~low;
3265
+ return false;
1944
3266
  }
1945
3267
 
1946
3268
  // All conflict markers consist of the same character repeated seven times. If it is
@@ -2921,7 +4243,46 @@ function getTokenDisplayTable(entries) {
2921
4243
  return table;
2922
4244
  }
2923
4245
 
2924
- const { util } = prettier;
4246
+ var uu=Object.create;var Ue=Object.defineProperty;var ou=Object.getOwnPropertyDescriptor;var iu=Object.getOwnPropertyNames;var su=Object.getPrototypeOf,au=Object.prototype.hasOwnProperty;var rr=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ct=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Me=(t,e)=>{for(var r in e)Ue(t,r,{get:e[r],enumerable:!0});},nr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of iu(e))!au.call(t,o)&&o!==r&&Ue(t,o,{get:()=>e[o],enumerable:!(n=ou(e,o))||n.enumerable});return t};var ur=(t,e,r)=>(r=t!=null?uu(su(t)):{},nr(e||!t||!t.__esModule?Ue(r,"default",{value:t,enumerable:!0}):r,t)),Du=t=>nr(Ue({},"__esModule",{value:!0}),t);var cu=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var gt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r);};var le=(t,e,r)=>(cu(t,e,"access private method"),r);var ir=Ct(yt=>{Object.defineProperty(yt,"__esModule",{value:!0});yt.default=or;function or(){}or.prototype={diff:function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=n.callback;typeof n=="function"&&(o=n,n={}),this.options=n;var u=this;function i(p){return o?(setTimeout(function(){o(void 0,p);},0),!0):p}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var s=r.length,a=e.length,D=1,c=s+a;n.maxEditLength&&(c=Math.min(c,n.maxEditLength));var F=[{newPos:-1,components:[]}],f=this.extractCommon(F[0],r,e,0);if(F[0].newPos+1>=s&&f+1>=a)return i([{value:this.join(r),count:r.length}]);function d(){for(var p=-1*D;p<=D;p+=2){var m=void 0,E=F[p-1],h=F[p+1],g=(h?h.newPos:0)-p;E&&(F[p-1]=void 0);var C=E&&E.newPos+1<s,_=h&&0<=g&&g<a;if(!C&&!_){F[p]=void 0;continue}if(!C||_&&E.newPos<h.newPos?(m=pu(h),u.pushComponent(m.components,void 0,!0)):(m=E,m.newPos++,u.pushComponent(m.components,!0,void 0)),g=u.extractCommon(m,r,e,p),m.newPos+1>=s&&g+1>=a)return i(fu(u,m.components,r,e,u.useLongestToken));F[p]=m;}D++;}if(o)(function p(){setTimeout(function(){if(D>c)return o();d()||p();},0);})();else for(;D<=c;){var l=d();if(l)return l}},pushComponent:function(e,r,n){var o=e[e.length-1];o&&o.added===r&&o.removed===n?e[e.length-1]={count:o.count+1,added:r,removed:n}:e.push({count:1,added:r,removed:n});},extractCommon:function(e,r,n,o){for(var u=r.length,i=n.length,s=e.newPos,a=s-o,D=0;s+1<u&&a+1<i&&this.equals(r[s+1],n[a+1]);)s++,a++,D++;return D&&e.components.push({count:D}),e.newPos=s,a},equals:function(e,r){return this.options.comparator?this.options.comparator(e,r):e===r||this.options.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};function fu(t,e,r,n,o){for(var u=0,i=e.length,s=0,a=0;u<i;u++){var D=e[u];if(D.removed){if(D.value=t.join(n.slice(a,a+D.count)),a+=D.count,u&&e[u-1].added){var F=e[u-1];e[u-1]=e[u],e[u]=F;}}else {if(!D.added&&o){var c=r.slice(s,s+D.count);c=c.map(function(d,l){var p=n[a+l];return p.length>d.length?p:d}),D.value=t.join(c);}else D.value=t.join(r.slice(s,s+D.count));s+=D.count,D.added||(a+=D.count);}}var f=e[i-1];return i>1&&typeof f.value=="string"&&(f.added||f.removed)&&t.equals("",f.value)&&(e[i-2].value+=f.value,e.pop()),e}function pu(t){return {newPos:t.newPos,components:t.components.slice(0)}}});var sr=Ct(ye=>{Object.defineProperty(ye,"__esModule",{value:!0});ye.diffArrays=mu;ye.arrayDiff=void 0;var du=Fu(ir());function Fu(t){return t&&t.__esModule?t:{default:t}}var ge=new du.default;ye.arrayDiff=ge;ge.tokenize=function(t){return t.slice()};ge.join=ge.removeEmpty=function(t){return t};function mu(t,e,r){return ge.diff(t,e,r)}});var j,N,Pe=rr(()=>{j=t=>t;j.grey=j;j.red=j;j.bold=j;j.yellow=j;j.blue=j;j.default=j;N=j;});var cn={};Me(cn,{getChalk:()=>Ju,shouldHighlight:()=>qu});var qu,Ju,ln=rr(()=>{Pe();qu=()=>!1,Ju=()=>N;});var Fn=Ct(pt=>{Object.defineProperty(pt,"__esModule",{value:!0});pt.codeFrameColumns=dn;pt.default=Qu;var Yt=(ln(),Du(cn)),fn=!1;function Xu(t){return {gutter:t.grey,marker:t.red.bold,message:t.red.bold}}var pn=/\r\n|[\n\r\u2028\u2029]/;function Zu(t,e,r){let n=Object.assign({column:0,line:-1},t.start),o=Object.assign({},n,t.end),{linesAbove:u=2,linesBelow:i=3}=r||{},s=n.line,a=n.column,D=o.line,c=o.column,F=Math.max(s-(u+1),0),f=Math.min(e.length,D+i);s===-1&&(F=0),D===-1&&(f=e.length);let d=D-s,l={};if(d)for(let p=0;p<=d;p++){let m=p+s;if(!a)l[m]=!0;else if(p===0){let E=e[m-1].length;l[m]=[a,E-a+1];}else if(p===d)l[m]=[0,c];else {let E=e[m-p].length;l[m]=[0,E];}}else a===c?a?l[s]=[a,0]:l[s]=!0:l[s]=[a,c-a];return {start:F,end:f,markerLines:l}}function dn(t,e,r={}){let n=(r.highlightCode||r.forceColor)&&(0, Yt.shouldHighlight)(r),o=(0, Yt.getChalk)(r),u=Xu(o),i=(p,m)=>n?p(m):m,s=t.split(pn),{start:a,end:D,markerLines:c}=Zu(e,s,r),F=e.start&&typeof e.start.column=="number",f=String(D).length,l=(n?(0, Yt.default)(t,r):t).split(pn,D).slice(a,D).map((p,m)=>{let E=a+1+m,g=` ${` ${E}`.slice(-f)} |`,C=c[E],_=!c[E+1];if(C){let ee="";if(Array.isArray(C)){let M=p.slice(0,Math.max(C[0]-1,0)).replace(/[^\t]/g," "),te=C[1]||1;ee=[`
4247
+ `,i(u.gutter,g.replace(/\d/g," "))," ",M,i(u.marker,"^").repeat(te)].join(""),_&&r.message&&(ee+=" "+i(u.message,r.message));}return [i(u.marker,">"),i(u.gutter,g),p.length>0?` ${p}`:"",ee].join("")}else return ` ${i(u.gutter,g)}${p.length>0?` ${p}`:""}`}).join(`
4248
+ `);return r.message&&!F&&(l=`${" ".repeat(f+1)}${r.message}
4249
+ ${l}`),n?o.reset(l):l}function Qu(t,e,r,n={}){if(!fn){fn=!0;let u="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";{let i=new Error(u);i.name="DeprecationWarning",console.warn(new Error(u));}}return r=Math.max(r,0),dn(t,{start:{column:r,line:e}},n)}});var er={};Me(er,{__debug:()=>Go,check:()=>Wo,doc:()=>Qt,format:()=>nu,formatWithCursor:()=>ru,getSupportInfo:()=>zo,util:()=>Zt,version:()=>tu});var lu=(t,e,r,n)=>{if(!(t&&e==null))return e.replaceAll?e.replaceAll(r,n):r.global?e.replace(r,n):e.split(r).join(n)},re=lu;var Vn=ur(sr(),1);var W="string",$="array",z="cursor",S="indent",v="align",P="trim",A="group",k="fill",B="if-break",L="indent-if-break",I="line-suffix",R="line-suffix-boundary",x="line",O="label",b="break-parent",We=new Set([z,S,v,P,A,k,B,L,I,R,x,O,b]);function Eu(t){if(typeof t=="string")return W;if(Array.isArray(t))return $;if(!t)return;let{type:e}=t;if(We.has(e))return e}var G=Eu;var hu=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function Cu(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return `Unexpected doc '${e}',
4250
+ Expected it to be 'string' or 'object'.`;if(G(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return `Unexpected doc '${r}'.`;let n=hu([...We].map(o=>`'${o}'`));return `Unexpected doc.type '${t.type}'.
4251
+ Expected it to be ${n}.`}var xt=class extends Error{name="InvalidDocError";constructor(e){super(Cu(e)),this.doc=e;}},X=xt;var ar={};function gu(t,e,r,n){let o=[t];for(;o.length>0;){let u=o.pop();if(u===ar){r(o.pop());continue}r&&o.push(u,ar);let i=G(u);if(!i)throw new X(u);if((e==null?void 0:e(u))!==!1)switch(i){case $:case k:{let s=i===$?u:u.parts;for(let a=s.length,D=a-1;D>=0;--D)o.push(s[D]);break}case B:o.push(u.flatContents,u.breakContents);break;case A:if(n&&u.expandedStates)for(let s=u.expandedStates.length,a=s-1;a>=0;--a)o.push(u.expandedStates[a]);else o.push(u.contents);break;case v:case S:case L:case O:case I:o.push(u.contents);break;case W:case z:case P:case R:case x:case b:break;default:throw new X(u)}}}var xe=gu;var Dr=()=>{},ze=Dr;function ae(t){return {type:S,contents:t}}function se(t,e){return {type:v,contents:e,n:t}}function _t(t,e={}){return ze(e.expandedStates),{type:A,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function cr(t){return se(Number.NEGATIVE_INFINITY,t)}function lr(t){return se({type:"root"},t)}function fr(t){return se(-1,t)}function pr(t,e){return _t(t[0],{...e,expandedStates:t})}function Ge(t){return {type:k,parts:t}}function dr(t,e="",r={}){return {type:B,breakContents:t,flatContents:e,groupId:r.groupId}}function Fr(t,e){return {type:L,contents:t,groupId:e.groupId,negate:e.negate}}function _e(t){return {type:I,contents:t}}var mr={type:R},fe={type:b},Er={type:P},Ae={type:x,hard:!0},At={type:x,hard:!0,literal:!0},Ke={type:x},hr={type:x,soft:!0},H=[Ae,fe],He=[At,fe],Be={type:z};function ke(t,e){let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}function qe(t,e,r){let n=t;if(e>0){for(let o=0;o<Math.floor(e/r);++o)n=ae(n);n=se(e%r,n),n=se(Number.NEGATIVE_INFINITY,n);}return n}function Cr(t,e){return t?{type:O,label:t,contents:e}:e}var yu=(t,e,r)=>{if(!(t&&e==null))return Array.isArray(e)||typeof e=="string"?e[r<0?e.length+r:r]:e.at(r)},y=yu;function gr(t){let e=t.indexOf("\r");return e>=0?t.charAt(e+1)===`
4252
+ `?"crlf":"cr":"lf"}function be(t){switch(t){case"cr":return "\r";case"crlf":return `\r
4253
+ `;default:return `
4254
+ `}}function Bt(t,e){let r;switch(e){case`
4255
+ `:r=/\n/g;break;case"\r":r=/\r/g;break;case`\r
4256
+ `:r=/\r\n/g;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(e)}.`)}let n=t.match(r);return n?n.length:0}function yr(t){return re(!1,t,/\r\n?/g,`
4257
+ `)}var xr=()=>/[#*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\u26D3\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]|\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])?|[\uDFC3\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-\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]|\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(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\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-\uDEB6](?:\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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?)?)|\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])?|\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-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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;var _r={eastAsianWidth(t){var e=t.charCodeAt(0),r=t.length==2?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=r&&r<=57343&&(e&=1023,r&=1023,n=e<<10|r,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":"N"}};var xu=/[^\x20-\x7F]/;function _u(t){if(!t)return 0;if(!xu.test(t))return t.length;t=t.replace(xr()," ");let e=0;for(let r of t){let n=r.codePointAt(0);if(n<=31||n>=127&&n<=159||n>=768&&n<=879)continue;let o=_r.eastAsianWidth(r);e+=o==="F"||o==="W"?2:1;}return e}var we=_u;var kr=t=>{if(Array.isArray(t))return t;if(t.type!==k)throw new Error(`Expect doc to be 'array' or '${k}'.`);return t.parts};function Ne(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(u){if(r.has(u))return r.get(u);let i=o(u);return r.set(u,i),i}function o(u){switch(G(u)){case $:return e(u.map(n));case k:return e({...u,parts:u.parts.map(n)});case B:return e({...u,breakContents:n(u.breakContents),flatContents:n(u.flatContents)});case A:{let{expandedStates:i,contents:s}=u;return i?(i=i.map(n),s=i[0]):s=n(s),e({...u,contents:s,expandedStates:i})}case v:case S:case L:case O:case I:return e({...u,contents:n(u.contents)});case W:case z:case P:case R:case x:case b:return e(u);default:throw new X(u)}}}function Je(t,e,r){let n=r,o=!1;function u(i){if(o)return !1;let s=e(i);s!==void 0&&(o=!0,n=s);}return xe(t,u),n}function Au(t){if(t.type===A&&t.break||t.type===x&&t.hard||t.type===b)return !0}function br(t){return Je(t,Au,!1)}function Ar(t){if(t.length>0){let e=y(!1,t,-1);!e.expandedStates&&!e.break&&(e.break="propagated");}return null}function wr(t){let e=new Set,r=[];function n(u){if(u.type===b&&Ar(r),u.type===A){if(r.push(u),e.has(u))return !1;e.add(u);}}function o(u){u.type===A&&r.pop().break&&Ar(r);}xe(t,n,o,!0);}function Bu(t){return t.type===x&&!t.hard?t.soft?"":" ":t.type===B?t.flatContents:t}function Or(t){return Ne(t,Bu)}function Br(t){for(t=[...t];t.length>=2&&y(!1,t,-2).type===x&&y(!1,t,-1).type===b;)t.length-=2;if(t.length>0){let e=Oe(y(!1,t,-1));t[t.length-1]=e;}return t}function Oe(t){switch(G(t)){case v:case S:case L:case A:case I:case O:{let e=Oe(t.contents);return {...t,contents:e}}case B:return {...t,breakContents:Oe(t.breakContents),flatContents:Oe(t.flatContents)};case k:return {...t,parts:Br(t.parts)};case $:return Br(t);case W:return t.replace(/[\n\r]*$/,"");case z:case P:case R:case x:case b:break;default:throw new X(t)}return t}function Xe(t){return Oe(bu(t))}function ku(t){switch(G(t)){case k:if(t.parts.every(e=>e===""))return "";break;case A:if(!t.contents&&!t.id&&!t.break&&!t.expandedStates)return "";if(t.contents.type===A&&t.contents.id===t.id&&t.contents.break===t.break&&t.contents.expandedStates===t.expandedStates)return t.contents;break;case v:case S:case L:case I:if(!t.contents)return "";break;case B:if(!t.flatContents&&!t.breakContents)return "";break;case $:{let e=[];for(let r of t){if(!r)continue;let[n,...o]=Array.isArray(r)?r:[r];typeof n=="string"&&typeof y(!1,e,-1)=="string"?e[e.length-1]+=n:e.push(n),e.push(...o);}return e.length===0?"":e.length===1?e[0]:e}case W:case z:case P:case R:case x:case O:case b:break;default:throw new X(t)}return t}function bu(t){return Ne(t,e=>ku(e))}function Nr(t,e=He){return Ne(t,r=>typeof r=="string"?ke(e,r.split(`
4258
+ `)):r)}function wu(t){if(t.type===x)return !0}function Tr(t){return Je(t,wu,!1)}function Ze(t,e){return t.type===O?{...t,contents:e(t.contents)}:e(t)}var Y=Symbol("MODE_BREAK"),q=Symbol("MODE_FLAT"),Te=Symbol("cursor");function Sr(){return {value:"",length:0,queue:[]}}function Ou(t,e){return kt(t,{type:"indent"},e)}function Nu(t,e,r){return e===Number.NEGATIVE_INFINITY?t.root||Sr():e<0?kt(t,{type:"dedent"},r):e?e.type==="root"?{...t,root:t}:kt(t,{type:typeof e=="string"?"stringAlign":"numberAlign",n:e},r):t}function kt(t,e,r){let n=e.type==="dedent"?t.queue.slice(0,-1):[...t.queue,e],o="",u=0,i=0,s=0;for(let l of n)switch(l.type){case"indent":c(),r.useTabs?a(1):D(r.tabWidth);break;case"stringAlign":c(),o+=l.n,u+=l.n.length;break;case"numberAlign":i+=1,s+=l.n;break;default:throw new Error(`Unexpected type '${l.type}'`)}return f(),{...t,value:o,length:u,queue:n};function a(l){o+=" ".repeat(l),u+=r.tabWidth*l;}function D(l){o+=" ".repeat(l),u+=l;}function c(){r.useTabs?F():f();}function F(){i>0&&a(i),d();}function f(){s>0&&D(s),d();}function d(){i=0,s=0;}}function bt(t){let e=0,r=0,n=t.length;e:for(;n--;){let o=t[n];if(o===Te){r++;continue}for(let u=o.length-1;u>=0;u--){let i=o[u];if(i===" "||i===" ")e++;else {t[n]=o.slice(0,u+1);break e}}}if(e>0||r>0)for(t.length=n+1;r-- >0;)t.push(Te);return e}function Qe(t,e,r,n,o,u){if(r===Number.POSITIVE_INFINITY)return !0;let i=e.length,s=[t],a=[];for(;r>=0;){if(s.length===0){if(i===0)return !0;s.push(e[--i]);continue}let{mode:D,doc:c}=s.pop();switch(G(c)){case W:a.push(c),r-=we(c);break;case $:case k:{let F=kr(c);for(let f=F.length-1;f>=0;f--)s.push({mode:D,doc:F[f]});break}case S:case v:case L:case O:s.push({mode:D,doc:c.contents});break;case P:r+=bt(a);break;case A:{if(u&&c.break)return !1;let F=c.break?Y:D,f=c.expandedStates&&F===Y?y(!1,c.expandedStates,-1):c.contents;s.push({mode:F,doc:f});break}case B:{let f=(c.groupId?o[c.groupId]||q:D)===Y?c.breakContents:c.flatContents;f&&s.push({mode:D,doc:f});break}case x:if(D===Y||c.hard)return !0;c.soft||(a.push(" "),r--);break;case I:n=!0;break;case R:if(n)return !1;break}}return !1}function pe(t,e){let r={},n=e.printWidth,o=be(e.endOfLine),u=0,i=[{ind:Sr(),mode:Y,doc:t}],s=[],a=!1,D=[],c=0;for(wr(t);i.length>0;){let{ind:f,mode:d,doc:l}=i.pop();switch(G(l)){case W:{let p=o!==`
4259
+ `?re(!1,l,`
4260
+ `,o):l;s.push(p),i.length>0&&(u+=we(p));break}case $:for(let p=l.length-1;p>=0;p--)i.push({ind:f,mode:d,doc:l[p]});break;case z:if(c>=2)throw new Error("There are too many 'cursor' in doc.");s.push(Te),c++;break;case S:i.push({ind:Ou(f,e),mode:d,doc:l.contents});break;case v:i.push({ind:Nu(f,l.n,e),mode:d,doc:l.contents});break;case P:u-=bt(s);break;case A:switch(d){case q:if(!a){i.push({ind:f,mode:l.break?Y:q,doc:l.contents});break}case Y:{a=!1;let p={ind:f,mode:q,doc:l.contents},m=n-u,E=D.length>0;if(!l.break&&Qe(p,i,m,E,r))i.push(p);else if(l.expandedStates){let h=y(!1,l.expandedStates,-1);if(l.break){i.push({ind:f,mode:Y,doc:h});break}else for(let g=1;g<l.expandedStates.length+1;g++)if(g>=l.expandedStates.length){i.push({ind:f,mode:Y,doc:h});break}else {let C=l.expandedStates[g],_={ind:f,mode:q,doc:C};if(Qe(_,i,m,E,r)){i.push(_);break}}}else i.push({ind:f,mode:Y,doc:l.contents});break}}l.id&&(r[l.id]=y(!1,i,-1).mode);break;case k:{let p=n-u,{parts:m}=l;if(m.length===0)break;let[E,h]=m,g={ind:f,mode:q,doc:E},C={ind:f,mode:Y,doc:E},_=Qe(g,[],p,D.length>0,r,!0);if(m.length===1){_?i.push(g):i.push(C);break}let ee={ind:f,mode:q,doc:h},M={ind:f,mode:Y,doc:h};if(m.length===2){_?i.push(ee,g):i.push(M,C);break}m.splice(0,2);let te={ind:f,mode:d,doc:Ge(m)},tr=m[0];Qe({ind:f,mode:q,doc:[E,h,tr]},[],p,D.length>0,r,!0)?i.push(te,ee,g):_?i.push(te,M,g):i.push(te,M,C);break}case B:case L:{let p=l.groupId?r[l.groupId]:d;if(p===Y){let m=l.type===B?l.breakContents:l.negate?l.contents:ae(l.contents);m&&i.push({ind:f,mode:d,doc:m});}if(p===q){let m=l.type===B?l.flatContents:l.negate?ae(l.contents):l.contents;m&&i.push({ind:f,mode:d,doc:m});}break}case I:D.push({ind:f,mode:d,doc:l.contents});break;case R:D.length>0&&i.push({ind:f,mode:d,doc:Ae});break;case x:switch(d){case q:if(l.hard)a=!0;else {l.soft||(s.push(" "),u+=1);break}case Y:if(D.length>0){i.push({ind:f,mode:d,doc:l},...D.reverse()),D.length=0;break}l.literal?f.root?(s.push(o,f.root.value),u=f.root.length):(s.push(o),u=0):(u-=bt(s),s.push(o+f.value),u=f.length);break}break;case O:i.push({ind:f,mode:d,doc:l.contents});break;case b:break;default:throw new X(l)}i.length===0&&D.length>0&&(i.push(...D.reverse()),D.length=0);}let F=s.indexOf(Te);if(F!==-1){let f=s.indexOf(Te,F+1),d=s.slice(0,F).join(""),l=s.slice(F+1,f).join(""),p=s.slice(f+1).join("");return {formatted:d+l+p,cursorNodeStart:d.length,cursorNodeText:l}}return {formatted:s.join("")}}function Z(t){var e;if(!t)return "";if(Array.isArray(t)){let r=[];for(let n of t)if(Array.isArray(n))r.push(...Z(n));else {let o=Z(n);o!==""&&r.push(o);}return r}return t.type===B?{...t,breakContents:Z(t.breakContents),flatContents:Z(t.flatContents)}:t.type===A?{...t,contents:Z(t.contents),expandedStates:(e=t.expandedStates)==null?void 0:e.map(Z)}:t.type===k?{type:"fill",parts:t.parts.map(Z)}:t.contents?{...t,contents:Z(t.contents)}:t}function vr(t){let e=Object.create(null),r=new Set;return n(Z(t));function n(u,i,s){var a,D;if(typeof u=="string")return JSON.stringify(u);if(Array.isArray(u)){let c=u.map(n).filter(Boolean);return c.length===1?c[0]:`[${c.join(", ")}]`}if(u.type===x){let c=((a=s==null?void 0:s[i+1])==null?void 0:a.type)===b;return u.literal?c?"literalline":"literallineWithoutBreakParent":u.hard?c?"hardline":"hardlineWithoutBreakParent":u.soft?"softline":"line"}if(u.type===b)return ((D=s==null?void 0:s[i-1])==null?void 0:D.type)===x&&s[i-1].hard?void 0:"breakParent";if(u.type===P)return "trim";if(u.type===S)return "indent("+n(u.contents)+")";if(u.type===v)return u.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(u.contents)+")":u.n<0?"dedent("+n(u.contents)+")":u.n.type==="root"?"markAsRoot("+n(u.contents)+")":"align("+JSON.stringify(u.n)+", "+n(u.contents)+")";if(u.type===B)return "ifBreak("+n(u.breakContents)+(u.flatContents?", "+n(u.flatContents):"")+(u.groupId?(u.flatContents?"":', ""')+`, { groupId: ${o(u.groupId)} }`:"")+")";if(u.type===L){let c=[];u.negate&&c.push("negate: true"),u.groupId&&c.push(`groupId: ${o(u.groupId)}`);let F=c.length>0?`, { ${c.join(", ")} }`:"";return `indentIfBreak(${n(u.contents)}${F})`}if(u.type===A){let c=[];u.break&&u.break!=="propagated"&&c.push("shouldBreak: true"),u.id&&c.push(`id: ${o(u.id)}`);let F=c.length>0?`, { ${c.join(", ")} }`:"";return u.expandedStates?`conditionalGroup([${u.expandedStates.map(f=>n(f)).join(",")}]${F})`:`group(${n(u.contents)}${F})`}if(u.type===k)return `fill([${u.parts.map(c=>n(c)).join(", ")}])`;if(u.type===I)return "lineSuffix("+n(u.contents)+")";if(u.type===R)return "lineSuffixBoundary";if(u.type===O)return `label(${JSON.stringify(u.label)}, ${n(u.contents)})`;throw new Error("Unknown doc type "+u.type)}function o(u){if(typeof u!="symbol")return JSON.stringify(String(u));if(u in e)return e[u];let i=u.description||"symbol";for(let s=0;;s++){let a=i+(s>0?` #${s}`:"");if(!r.has(a))return r.add(a),e[u]=`Symbol.for(${JSON.stringify(a)})`}}}function Tu(t,e,r=0){let n=0;for(let o=r;o<t.length;++o)t[o]===" "?n=n+e-n%e:n++;return n}var de=Tu;var Se=class extends Error{name="ConfigError"},ve=class extends Error{name="UndefinedParserError"};var Pr={cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:`Print (to stderr) where a cursor at the given position would move to after formatting.
4261
+ This option cannot be used with --range-start and --range-end.`,cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
4262
+ (mixed values within one file are normalised by looking at what's used after the first line)`}]},filepath:{category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:t=>typeof t=="string"||typeof t=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:t=>typeof t=="string"||typeof t=="object",cliName:"plugin",cliCategory:"Config"},printWidth:{category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{category:"Special",type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:`Format code ending at a given character offset (exclusive).
4263
+ The range will extend forwards to the end of the selected statement.
4264
+ This option cannot be used with --cursor-offset.`,cliCategory:"Editor"},rangeStart:{category:"Special",type:"int",default:0,range:{start:0,end:1/0,step:1},description:`Format code starting at a given character offset.
4265
+ The range will extend backwards to the start of the first line containing the selected statement.
4266
+ This option cannot be used with --cursor-offset.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:`Require either '@prettier' or '@format' to be present in the file's first docblock comment
4267
+ in order for it to be formatted.`,cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function et({plugins:t=[],showDeprecated:e=!1}={}){let r=t.flatMap(o=>o.languages??[]),n=[];for(let o of vu(Object.assign({},...t.map(({options:u})=>u),Pr)))!e&&o.deprecated||(Array.isArray(o.choices)&&(e||(o.choices=o.choices.filter(u=>!u.deprecated)),o.name==="parser"&&(o.choices=[...o.choices,...Su(o.choices,r,t)])),o.pluginDefaults=Object.fromEntries(t.filter(u=>{var i;return ((i=u.defaultOptions)==null?void 0:i[o.name])!==void 0}).map(u=>[u.name,u.defaultOptions[o.name]])),n.push(o));return {languages:r,options:n}}function*Su(t,e,r){let n=new Set(t.map(o=>o.value));for(let o of e)if(o.parsers){for(let u of o.parsers)if(!n.has(u)){n.add(u);let i=r.find(a=>a.parsers&&Object.prototype.hasOwnProperty.call(a.parsers,u)),s=o.name;i!=null&&i.name&&(s+=` (plugin: ${i.name})`),yield {value:u,description:s};}}}function vu(t){let e=[];for(let[r,n]of Object.entries(t)){let o={name:r,...n};Array.isArray(o.default)&&(o.default=y(!1,o.default,-1).value),e.push(o);}return e}var Pu=t=>t.split(/[/\\]/).pop();function Lr(t,e){if(!e)return;let r=Pu(e).toLowerCase();return t.find(n=>{var o,u;return ((o=n.extensions)==null?void 0:o.some(i=>r.endsWith(i)))||((u=n.filenames)==null?void 0:u.some(i=>i.toLowerCase()===r))})}function Lu(t,e){if(e)return t.find(({name:r})=>r.toLowerCase()===e)??t.find(({aliases:r})=>r==null?void 0:r.includes(e))??t.find(({extensions:r})=>r==null?void 0:r.includes(`.${e}`))}function Iu(t,e){let r=t.plugins.flatMap(o=>o.languages??[]),n=Lu(r,e.language)??Lr(r,e.physicalFile)??Lr(r,e.file)??(e.physicalFile,void 0);return n==null?void 0:n.parsers[0]}var Ir=Iu;var ne={key:t=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?t:JSON.stringify(t),value(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return `[${t.map(r=>ne.value(r)).join(", ")}]`;let e=Object.keys(t);return e.length===0?"{}":`{ ${e.map(r=>`${ne.key(r)}: ${ne.value(t[r])}`).join(", ")} }`},pair:({key:t,value:e})=>ne.value({[t]:e})};Pe();var Rr=(t,e,{descriptor:r})=>{let n=[`${N.yellow(typeof t=="string"?r.key(t):r.pair(t))} is deprecated`];return e&&n.push(`we now treat it as ${N.blue(typeof e=="string"?r.key(e):r.pair(e))}`),n.join("; ")+"."};Pe();var tt=Symbol.for("vnopts.VALUE_NOT_EXIST"),Fe=Symbol.for("vnopts.VALUE_UNCHANGED");var Yr=" ".repeat(2),Vr=(t,e,r)=>{let{text:n,list:o}=r.normalizeExpectedResult(r.schemas[t].expected(r)),u=[];return n&&u.push(jr(t,e,n,r.descriptor)),o&&u.push([jr(t,e,o.title,r.descriptor)].concat(o.values.map(i=>$r(i,r.loggerPrintWidth))).join(`
4268
+ `)),Ur(u,r.loggerPrintWidth)};function jr(t,e,r,n){return [`Invalid ${N.red(n.key(t))} value.`,`Expected ${N.blue(r)},`,`but received ${e===tt?N.gray("nothing"):N.red(n.value(e))}.`].join(" ")}function $r({text:t,list:e},r){let n=[];return t&&n.push(`- ${N.blue(t)}`),e&&n.push([`- ${N.blue(e.title)}:`].concat(e.values.map(o=>$r(o,r-Yr.length).replace(/^|\n/g,`$&${Yr}`))).join(`
4269
+ `)),Ur(n,r)}function Ur(t,e){if(t.length===1)return t[0];let[r,n]=t,[o,u]=t.map(i=>i.split(`
4270
+ `,1)[0].length);return o>e&&o>u?n:r}Pe();var wt=[],Mr=[];function Ot(t,e){if(t===e)return 0;let r=t;t.length>e.length&&(t=e,e=r);let n=t.length,o=e.length;for(;n>0&&t.charCodeAt(~-n)===e.charCodeAt(~-o);)n--,o--;let u=0;for(;u<n&&t.charCodeAt(u)===e.charCodeAt(u);)u++;if(n-=u,o-=u,n===0)return o;let i,s,a,D,c=0,F=0;for(;c<n;)Mr[c]=t.charCodeAt(u+c),wt[c]=++c;for(;F<o;)for(i=e.charCodeAt(u+F),a=F++,s=F,c=0;c<n;c++)D=i===Mr[c]?a:a+1,a=wt[c],s=wt[c]=a>s?D>s?s+1:D:D>a?a+1:D;return s}var rt=(t,e,{descriptor:r,logger:n,schemas:o})=>{let u=[`Ignored unknown option ${N.yellow(r.pair({key:t,value:e}))}.`],i=Object.keys(o).sort().find(s=>Ot(t,s)<3);i&&u.push(`Did you mean ${N.blue(r.key(i))}?`),n.warn(u.join(" "));};var Ru=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function Yu(t,e){let r=new t(e),n=Object.create(r);for(let o of Ru)o in e&&(n[o]=ju(e[o],r,w.prototype[o].length));return n}var w=class{static create(e){return Yu(this,e)}constructor(e){this.name=e.name;}default(e){}expected(e){return "nothing"}validate(e,r){return !1}deprecated(e,r){return !1}forward(e,r){}redirect(e,r){}overlap(e,r,n){return e}preprocess(e,r){return e}postprocess(e,r){return Fe}};function ju(t,e,r){return typeof t=="function"?(...n)=>t(...n.slice(0,r-1),e,...n.slice(r-1)):()=>t}var nt=class extends w{constructor(e){super(e),this._sourceName=e.sourceName;}expected(e){return e.schemas[this._sourceName].expected(e)}validate(e,r){return r.schemas[this._sourceName].validate(e,r)}redirect(e,r){return this._sourceName}};var ut=class extends w{expected(){return "anything"}validate(){return !0}};var ot=class extends w{constructor({valueSchema:e,name:r=e.name,...n}){super({...n,name:r}),this._valueSchema=e;}expected(e){let{text:r,list:n}=e.normalizeExpectedResult(this._valueSchema.expected(e));return {text:r&&`an array of ${r}`,list:n&&{title:"an array of the following values",values:[{list:n}]}}}validate(e,r){if(!Array.isArray(e))return !1;let n=[];for(let o of e){let u=r.normalizeValidateResult(this._valueSchema.validate(o,r),o);u!==!0&&n.push(u.value);}return n.length===0?!0:{value:n}}deprecated(e,r){let n=[];for(let o of e){let u=r.normalizeDeprecatedResult(this._valueSchema.deprecated(o,r),o);u!==!1&&n.push(...u.map(({value:i})=>({value:[i]})));}return n}forward(e,r){let n=[];for(let o of e){let u=r.normalizeForwardResult(this._valueSchema.forward(o,r),o);n.push(...u.map(Wr));}return n}redirect(e,r){let n=[],o=[];for(let u of e){let i=r.normalizeRedirectResult(this._valueSchema.redirect(u,r),u);"remain"in i&&n.push(i.remain),o.push(...i.redirect.map(Wr));}return n.length===0?{redirect:o}:{redirect:o,remain:n}}overlap(e,r){return e.concat(r)}};function Wr({from:t,to:e}){return {from:[t],to:e}}var it=class extends w{expected(){return "true or false"}validate(e){return typeof e=="boolean"}};function Gr(t,e){let r=Object.create(null);for(let n of t){let o=n[e];if(r[o])throw new Error(`Duplicate ${e} ${JSON.stringify(o)}`);r[o]=n;}return r}function Kr(t,e){let r=new Map;for(let n of t){let o=n[e];if(r.has(o))throw new Error(`Duplicate ${e} ${JSON.stringify(o)}`);r.set(o,n);}return r}function Hr(){let t=Object.create(null);return e=>{let r=JSON.stringify(e);return t[r]?!0:(t[r]=!0,!1)}}function qr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return [r,n]}function Jr(t){return t===Math.floor(t)}function Xr(t,e){if(t===e)return 0;let r=typeof t,n=typeof e,o=["undefined","object","boolean","number","string"];return r!==n?o.indexOf(r)-o.indexOf(n):r!=="string"?Number(t)-Number(e):t.localeCompare(e)}function Zr(t){return (...e)=>{let r=t(...e);return typeof r=="string"?new Error(r):r}}function Nt(t){return t===void 0?{}:t}function Tt(t){if(typeof t=="string")return {text:t};let{text:e,list:r}=t;return Vu((e||r)!==void 0,"Unexpected `expected` result, there should be at least one field."),r?{text:e,list:{title:r.title,values:r.values.map(Tt)}}:{text:e}}function St(t,e){return t===!0?!0:t===!1?{value:e}:t}function vt(t,e,r=!1){return t===!1?!1:t===!0?r?!0:[{value:e}]:"value"in t?[t]:t.length===0?!1:t}function zr(t,e){return typeof t=="string"||"key"in t?{from:e,to:t}:"from"in t?{from:t.from,to:t.to}:{from:e,to:t.to}}function st(t,e){return t===void 0?[]:Array.isArray(t)?t.map(r=>zr(r,e)):[zr(t,e)]}function Pt(t,e){let r=st(typeof t=="object"&&"redirect"in t?t.redirect:t,e);return r.length===0?{remain:e,redirect:r}:typeof t=="object"&&"remain"in t?{remain:t.remain,redirect:r}:{redirect:r}}function Vu(t,e){if(!t)throw new Error(e)}var at=class extends w{constructor(e){super(e),this._choices=Kr(e.choices.map(r=>r&&typeof r=="object"?r:{value:r}),"value");}expected({descriptor:e}){let r=Array.from(this._choices.keys()).map(i=>this._choices.get(i)).filter(({hidden:i})=>!i).map(i=>i.value).sort(Xr).map(e.value),n=r.slice(0,-2),o=r.slice(-2);return {text:n.concat(o.join(" or ")).join(", "),list:{title:"one of the following values",values:r}}}validate(e){return this._choices.has(e)}deprecated(e){let r=this._choices.get(e);return r&&r.deprecated?{value:e}:!1}forward(e){let r=this._choices.get(e);return r?r.forward:void 0}redirect(e){let r=this._choices.get(e);return r?r.redirect:void 0}};var Dt=class extends w{expected(){return "a number"}validate(e,r){return typeof e=="number"}};var ct=class extends Dt{expected(){return "an integer"}validate(e,r){return r.normalizeValidateResult(super.validate(e,r),e)===!0&&Jr(e)}};var Le=class extends w{expected(){return "a string"}validate(e){return typeof e=="string"}};var Qr=ne,en=rt,tn=Vr,rn=Rr;var lt=class{constructor(e,r){let{logger:n=console,loggerPrintWidth:o=80,descriptor:u=Qr,unknown:i=en,invalid:s=tn,deprecated:a=rn,missing:D=()=>!1,required:c=()=>!1,preprocess:F=d=>d,postprocess:f=()=>Fe}=r||{};this._utils={descriptor:u,logger:n||{warn:()=>{}},loggerPrintWidth:o,schemas:Gr(e,"name"),normalizeDefaultResult:Nt,normalizeExpectedResult:Tt,normalizeDeprecatedResult:vt,normalizeForwardResult:st,normalizeRedirectResult:Pt,normalizeValidateResult:St},this._unknownHandler=i,this._invalidHandler=Zr(s),this._deprecatedHandler=a,this._identifyMissing=(d,l)=>!(d in l)||D(d,l),this._identifyRequired=c,this._preprocess=F,this._postprocess=f,this.cleanHistory();}cleanHistory(){this._hasDeprecationWarned=Hr();}normalize(e){let r={},o=[this._preprocess(e,this._utils)],u=()=>{for(;o.length!==0;){let i=o.shift(),s=this._applyNormalization(i,r);o.push(...s);}};u();for(let i of Object.keys(this._utils.schemas)){let s=this._utils.schemas[i];if(!(i in r)){let a=Nt(s.default(this._utils));"value"in a&&o.push({[i]:a.value});}}u();for(let i of Object.keys(this._utils.schemas)){if(!(i in r))continue;let s=this._utils.schemas[i],a=r[i],D=s.postprocess(a,this._utils);D!==Fe&&(this._applyValidation(D,i,s),r[i]=D);}return this._applyPostprocess(r),this._applyRequiredCheck(r),r}_applyNormalization(e,r){let n=[],{knownKeys:o,unknownKeys:u}=this._partitionOptionKeys(e);for(let i of o){let s=this._utils.schemas[i],a=s.preprocess(e[i],this._utils);this._applyValidation(a,i,s);let D=({from:d,to:l})=>{n.push(typeof l=="string"?{[l]:d}:{[l.key]:l.value});},c=({value:d,redirectTo:l})=>{let p=vt(s.deprecated(d,this._utils),a,!0);if(p!==!1)if(p===!0)this._hasDeprecationWarned(i)||this._utils.logger.warn(this._deprecatedHandler(i,l,this._utils));else for(let{value:m}of p){let E={key:i,value:m};if(!this._hasDeprecationWarned(E)){let h=typeof l=="string"?{key:l,value:m}:l;this._utils.logger.warn(this._deprecatedHandler(E,h,this._utils));}}};st(s.forward(a,this._utils),a).forEach(D);let f=Pt(s.redirect(a,this._utils),a);if(f.redirect.forEach(D),"remain"in f){let d=f.remain;r[i]=i in r?s.overlap(r[i],d,this._utils):d,c({value:d});}for(let{from:d,to:l}of f.redirect)c({value:d,redirectTo:l});}for(let i of u){let s=e[i];this._applyUnknownHandler(i,s,r,(a,D)=>{n.push({[a]:D});});}return n}_applyRequiredCheck(e){for(let r of Object.keys(this._utils.schemas))if(this._identifyMissing(r,e)&&this._identifyRequired(r))throw this._invalidHandler(r,tt,this._utils)}_partitionOptionKeys(e){let[r,n]=qr(Object.keys(e).filter(o=>!this._identifyMissing(o,e)),o=>o in this._utils.schemas);return {knownKeys:r,unknownKeys:n}}_applyValidation(e,r,n){let o=St(n.validate(e,this._utils),e);if(o!==!0)throw this._invalidHandler(r,o.value,this._utils)}_applyUnknownHandler(e,r,n,o){let u=this._unknownHandler(e,r,this._utils);if(u)for(let i of Object.keys(u)){if(this._identifyMissing(i,u))continue;let s=u[i];i in this._utils.schemas?o(i,s):n[i]=s;}}_applyPostprocess(e){let r=this._postprocess(e,this._utils);if(r!==Fe){if(r.delete)for(let n of r.delete)delete e[n];if(r.override){let{knownKeys:n,unknownKeys:o}=this._partitionOptionKeys(r.override);for(let u of n){let i=r.override[u];this._applyValidation(i,u,this._utils.schemas[u]),e[u]=i;}for(let u of o){let i=r.override[u];this._applyUnknownHandler(u,i,e,(s,a)=>{let D=this._utils.schemas[s];this._applyValidation(a,s,D),e[s]=a;});}}}}};var Lt;function Uu(t,e,{logger:r=!1,isCLI:n=!1,passThrough:o=!1,FlagSchema:u,descriptor:i}={}){if(n){if(!u)throw new Error("'FlagSchema' option is required.");if(!i)throw new Error("'descriptor' option is required.")}else i=ne;let s=o?Array.isArray(o)?(f,d)=>o.includes(f)?{[f]:d}:void 0:(f,d)=>({[f]:d}):(f,d,l)=>{let{_:p,...m}=l.schemas;return rt(f,d,{...l,schemas:m})},a=Mu(e,{isCLI:n,FlagSchema:u}),D=new lt(a,{logger:r,unknown:s,descriptor:i}),c=r!==!1;c&&Lt&&(D._hasDeprecationWarned=Lt);let F=D.normalize(t);return c&&(Lt=D._hasDeprecationWarned),F}function Mu(t,{isCLI:e,FlagSchema:r}){let n=[];e&&n.push(ut.create({name:"_"}));for(let o of t)n.push(Wu(o,{isCLI:e,optionInfos:t,FlagSchema:r})),o.alias&&e&&n.push(nt.create({name:o.alias,sourceName:o.name}));return n}function Wu(t,{isCLI:e,optionInfos:r,FlagSchema:n}){let{name:o}=t,u={name:o},i,s={};switch(t.type){case"int":i=ct,e&&(u.preprocess=Number);break;case"string":i=Le;break;case"choice":i=at,u.choices=t.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:t.name,value:a.redirect}}}:a);break;case"boolean":i=it;break;case"flag":i=n,u.flags=r.flatMap(a=>[a.alias,a.description&&a.name,a.oppositeDescription&&`no-${a.name}`].filter(Boolean));break;case"path":i=Le;break;default:throw new Error(`Unexpected type ${t.type}`)}if(t.exception?u.validate=(a,D,c)=>t.exception(a)||D.validate(a,c):u.validate=(a,D,c)=>a===void 0||D.validate(a,c),t.redirect&&(s.redirect=a=>a?{to:{key:t.redirect.option,value:t.redirect.value}}:void 0),t.deprecated&&(s.deprecated=!0),e&&!t.array){let a=u.preprocess||(D=>D);u.preprocess=(D,c,F)=>c.preprocess(a(Array.isArray(D)?y(!1,D,-1):D),F);}return t.array?ot.create({...e?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...s,valueSchema:i.create(u)}):i.create({...u,...s})}var nn=Uu;function It(t,e){if(!e)throw new Error("parserName is required.");for(let n=t.length-1;n>=0;n--){let o=t[n];if(o.parsers&&Object.prototype.hasOwnProperty.call(o.parsers,e))return o}let r=`Couldn't resolve parser "${e}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Se(r)}function un(t,e){if(!e)throw new Error("astFormat is required.");for(let n=t.length-1;n>=0;n--){let o=t[n];if(o.printers&&Object.prototype.hasOwnProperty.call(o.printers,e))return o}let r=`Couldn't find plugin for AST format "${e}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Se(r)}function ft({plugins:t,parser:e}){let r=It(t,e);return Rt(r,e)}function Rt(t,e){let r=t.parsers[e];return typeof r=="function"?r():r}function on(t,e){let r=t.printers[e];return typeof r=="function"?r():r}var sn={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function zu(t,e={}){var F;let r={...t};if(!r.parser)if(r.filepath){if(r.parser=Ir(r,{physicalFile:r.filepath}),!r.parser)throw new ve(`No parser could be inferred for file "${r.filepath}".`)}else throw new ve("No parser and no file path given, couldn't infer a parser.");let n=et({plugins:t.plugins,showDeprecated:!0}).options,o={...sn,...Object.fromEntries(n.filter(f=>f.default!==void 0).map(f=>[f.name,f.default]))},u=It(r.plugins,r.parser),i=await Rt(u,r.parser);r.astFormat=i.astFormat,r.locEnd=i.locEnd,r.locStart=i.locStart;let s=(F=u.printers)!=null&&F[i.astFormat]?u:un(r.plugins,i.astFormat),a=await on(s,i.astFormat);r.printer=a;let D=s.defaultOptions?Object.fromEntries(Object.entries(s.defaultOptions).filter(([,f])=>f!==void 0)):{},c={...o,...D};for(let[f,d]of Object.entries(c))(r[f]===null||r[f]===void 0)&&(r[f]=d);return r.parser==="json"&&(r.trailingComma="none"),nn(r,n,{passThrough:Object.keys(sn),...e})}var ue=zu;var an=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),Gu=t=>Object.keys(t).filter(e=>!an.has(e));function Ku(t){return t?e=>t(e,an):Gu}var J=Ku;function Hu(t,e){let{printer:{massageAstNode:r,getVisitorKeys:n}}=e;if(!r)return t;let o=J(n),u=r.ignoredProperties??new Set;return i(t);function i(s,a){if(!(s!==null&&typeof s=="object"))return s;if(Array.isArray(s))return s.map(f=>i(f,a)).filter(Boolean);let D={},c=new Set(o(s));for(let f in s)!Object.prototype.hasOwnProperty.call(s,f)||u.has(f)||(c.has(f)?D[f]=i(s[f],s):D[f]=s[f]);let F=r(s,D,a);if(F!==null)return F??D}}var Dn=Hu;var mn=ur(Fn(),1);async function eo(t,e){let r=await ft(e),n=r.preprocess?r.preprocess(t,e):t;e.originalText=n;let o;try{o=await r.parse(n,e,e);}catch(u){to(u,t);}return {text:n,ast:o}}function to(t,e){let{loc:r}=t;if(r){let n=(0, mn.codeFrameColumns)(e,r,{highlightCode:!0});throw t.message+=`
4271
+ `+n,t.codeFrame=n,t}throw t}var De=eo;var Ie,Vt,me,dt,jt=class{constructor(e){gt(this,Ie);gt(this,me);this.stack=[e];}get key(){let{stack:e,siblings:r}=this;return y(!1,e,r===null?-2:-4)??null}get index(){return this.siblings===null?null:y(!1,this.stack,-2)}get node(){return y(!1,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:e}=this,r=y(!1,e,-3);return Array.isArray(r)?r:null}get next(){let{siblings:e}=this;return e===null?null:e[this.index+1]}get previous(){let{siblings:e}=this;return e===null?null:e[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:e,index:r}=this;return e!==null&&r===e.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return [...le(this,me,dt).call(this)]}getName(){let{stack:e}=this,{length:r}=e;return r>1?y(!1,e,-2):null}getValue(){return y(!1,this.stack,-1)}getNode(e=0){let r=le(this,Ie,Vt).call(this,e);return r===-1?null:this.stack[r]}getParentNode(e=0){return this.getNode(e+1)}call(e,...r){let{stack:n}=this,{length:o}=n,u=y(!1,n,-1);for(let i of r)u=u[i],n.push(i,u);try{return e(this)}finally{n.length=o;}}callParent(e,r=0){let n=le(this,Ie,Vt).call(this,r+1),o=this.stack.splice(n+1);try{return e(this)}finally{this.stack.push(...o);}}each(e,...r){let{stack:n}=this,{length:o}=n,u=y(!1,n,-1);for(let i of r)u=u[i],n.push(i,u);try{for(let i=0;i<u.length;++i)n.push(i,u[i]),e(this,i,u),n.length-=2;}finally{n.length=o;}}map(e,...r){let n=[];return this.each((o,u,i)=>{n[u]=e(o,u,i);},...r),n}match(...e){let r=this.stack.length-1,n=null,o=this.stack[r--];for(let u of e){if(o===void 0)return !1;let i=null;if(typeof n=="number"&&(i=n,n=this.stack[r--],o=this.stack[r--]),u&&!u(o,n,i))return !1;n=this.stack[r--],o=this.stack[r--];}return !0}findAncestor(e){for(let r of le(this,me,dt).call(this))if(e(r))return r}hasAncestor(e){for(let r of le(this,me,dt).call(this))if(e(r))return !0;return !1}};Ie=new WeakSet,Vt=function(e){let{stack:r}=this;for(let n=r.length-1;n>=0;n-=2)if(!Array.isArray(r[n])&&--e<0)return n;return -1},me=new WeakSet,dt=function*(){let{stack:e}=this;for(let r=e.length-3;r>=0;r-=2){let n=e[r];Array.isArray(n)||(yield n);}};var En=jt;var Re=()=>{};Re.ok=Re;Re.strictEqual=Re;var Ye=Re;function Ee(t){return (e,r,n)=>{let o=!!(n!=null&&n.backwards);if(r===!1)return !1;let{length:u}=e,i=r;for(;i>=0&&i<u;){let s=e.charAt(i);if(t instanceof RegExp){if(!t.test(s))return i}else if(!t.includes(s))return i;o?i--:i++;}return i===-1||i===u?i:!1}}var hn=Ee(/\s/),T=Ee(" "),Ft=Ee(",; "),mt=Ee(/[^\n\r]/);function ro(t,e,r){let n=!!(r!=null&&r.backwards);if(e===!1)return !1;let o=t.charAt(e);if(n){if(t.charAt(e-1)==="\r"&&o===`
4272
+ `)return e-2;if(o===`
4273
+ `||o==="\r"||o==="\u2028"||o==="\u2029")return e-1}else {if(o==="\r"&&t.charAt(e+1)===`
4274
+ `)return e+2;if(o===`
4275
+ `||o==="\r"||o==="\u2028"||o==="\u2029")return e+1}return e}var V=ro;function no(t,e,r={}){let n=T(t,r.backwards?e-1:e,r),o=V(t,n,r);return n!==o}var U=no;function uo(t){return Array.isArray(t)&&t.length>0}var $t=uo;function oo(t){return t!==null&&typeof t=="object"}var Cn=oo;function*Ut(t,e){let{getVisitorKeys:r,filter:n=()=>!0}=e,o=u=>Cn(u)&&n(u);for(let u of r(t)){let i=t[u];if(Array.isArray(i))for(let s of i)o(s)&&(yield s);else o(i)&&(yield i);}}function*gn(t,e){let r=[t];for(let n=0;n<r.length;n++){let o=r[n];for(let u of Ut(o,e))yield u,r.push(u);}}function io(t){let e=t.type||t.kind||"(unknown type)",r=String(t.name||t.id&&(typeof t.id=="object"?t.id.name:t.id)||t.key&&(typeof t.key=="object"?t.key.name:t.key)||t.value&&(typeof t.value=="object"?"":String(t.value))||t.operator||"");return r.length>20&&(r=r.slice(0,19)+"\u2026"),e+(r?" "+r:"")}function Mt(t,e){(t.comments??(t.comments=[])).push(e),e.printed=!1,e.nodeDescription=io(t);}function oe(t,e){e.leading=!0,e.trailing=!1,Mt(t,e);}function Q(t,e,r){e.leading=!1,e.trailing=!1,r&&(e.marker=r),Mt(t,e);}function ie(t,e){e.leading=!1,e.trailing=!0,Mt(t,e);}var Wt=new WeakMap;function Et(t,e){if(Wt.has(t))return Wt.get(t);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:o},locStart:u,locEnd:i}=e;if(!n)return [];let s=((r==null?void 0:r(t,e))??[...Ut(t,{getVisitorKeys:J(o)})]).flatMap(a=>n(a)?[a]:Et(a,e));return s.sort((a,D)=>u(a)-u(D)||i(a)-i(D)),Wt.set(t,s),s}function xn(t,e,r,n){let{locStart:o,locEnd:u}=r,i=o(e),s=u(e),a=Et(t,r),D,c,F=0,f=a.length;for(;F<f;){let d=F+f>>1,l=a[d],p=o(l),m=u(l);if(p<=i&&s<=m)return xn(l,e,r,l);if(m<=i){D=l,F=d+1;continue}if(s<=p){c=l,f=d;continue}throw new Error("Comment location overlaps with node location")}if((n==null?void 0:n.type)==="TemplateLiteral"){let{quasis:d}=n,l=Gt(d,e,r);D&&Gt(d,D,r)!==l&&(D=null),c&&Gt(d,c,r)!==l&&(c=null);}return {enclosingNode:n,precedingNode:D,followingNode:c}}var zt=()=>!1;function _n(t,e){let{comments:r}=t;if(delete t.comments,!$t(r)||!e.printer.canAttachComment)return;let n=[],{locStart:o,locEnd:u,printer:{experimentalFeatures:{avoidAstMutation:i=!1}={},handleComments:s={}},originalText:a}=e,{ownLine:D=zt,endOfLine:c=zt,remaining:F=zt}=s,f=r.map((d,l)=>({...xn(t,d,e),comment:d,text:a,options:e,ast:t,isLastComment:r.length-1===l}));for(let[d,l]of f.entries()){let{comment:p,precedingNode:m,enclosingNode:E,followingNode:h,text:g,options:C,ast:_,isLastComment:ee}=l;if(C.parser==="json"||C.parser==="json5"||C.parser==="__js_expression"||C.parser==="__ts_expression"||C.parser==="__vue_expression"||C.parser==="__vue_ts_expression"){if(o(p)-o(_)<=0){oe(_,p);continue}if(u(p)-u(_)>=0){ie(_,p);continue}}let M;if(i?M=[l]:(p.enclosingNode=E,p.precedingNode=m,p.followingNode=h,M=[p,g,C,_,ee]),so(g,C,f,d))p.placement="ownLine",D(...M)||(h?oe(h,p):m?ie(m,p):E?Q(E,p):Q(_,p));else if(ao(g,C,f,d))p.placement="endOfLine",c(...M)||(m?ie(m,p):h?oe(h,p):E?Q(E,p):Q(_,p));else if(p.placement="remaining",!F(...M))if(m&&h){let te=n.length;te>0&&n[te-1].followingNode!==h&&yn(n,C),n.push(l);}else m?ie(m,p):h?oe(h,p):E?Q(E,p):Q(_,p);}if(yn(n,e),!i)for(let d of r)delete d.precedingNode,delete d.enclosingNode,delete d.followingNode;}var An=t=>!/[\S\n\u2028\u2029]/.test(t);function so(t,e,r,n){let{comment:o,precedingNode:u}=r[n],{locStart:i,locEnd:s}=e,a=i(o);if(u)for(let D=n-1;D>=0;D--){let{comment:c,precedingNode:F}=r[D];if(F!==u||!An(t.slice(s(c),a)))break;a=i(c);}return U(t,a,{backwards:!0})}function ao(t,e,r,n){let{comment:o,followingNode:u}=r[n],{locStart:i,locEnd:s}=e,a=s(o);if(u)for(let D=n+1;D<r.length;D++){let{comment:c,followingNode:F}=r[D];if(F!==u||!An(t.slice(a,i(c))))break;a=s(c);}return U(t,a)}function yn(t,e){var s,a;let r=t.length;if(r===0)return;let{precedingNode:n,followingNode:o}=t[0],u=e.locStart(o),i;for(i=r;i>0;--i){let{comment:D,precedingNode:c,followingNode:F}=t[i-1];Ye.strictEqual(c,n),Ye.strictEqual(F,o);let f=e.originalText.slice(e.locEnd(D),u);if(((a=(s=e.printer).isGap)==null?void 0:a.call(s,f,e))??/^[\s(]*$/.test(f))u=e.locStart(D);else break}for(let[D,{comment:c}]of t.entries())D<i?ie(n,c):oe(o,c);for(let D of [n,o])D.comments&&D.comments.length>1&&D.comments.sort((c,F)=>e.locStart(c)-e.locStart(F));t.length=0;}function Gt(t,e,r){let n=r.locStart(e)-1;for(let o=1;o<t.length;++o)if(n<r.locStart(t[o]))return o-1;return 0}function Do(t,e){let r=e-1;r=T(t,r,{backwards:!0}),r=V(t,r,{backwards:!0}),r=T(t,r,{backwards:!0});let n=V(t,r,{backwards:!0});return r!==n}var je=Do;function Bn(t,e){let r=t.node;return r.printed=!0,e.printer.printComment(t,e)}function co(t,e){var c;let r=t.node,n=[Bn(t,e)],{printer:o,originalText:u,locStart:i,locEnd:s}=e;if((c=o.isBlockComment)==null?void 0:c.call(o,r)){let F=U(u,s(r))?U(u,i(r),{backwards:!0})?H:Ke:" ";n.push(F);}else n.push(H);let D=V(u,T(u,s(r)));return D!==!1&&U(u,D)&&n.push(H),n}function lo(t,e,r){var D;let n=t.node,o=Bn(t,e),{printer:u,originalText:i,locStart:s}=e,a=(D=u.isBlockComment)==null?void 0:D.call(u,n);if(r!=null&&r.hasLineSuffix&&!(r!=null&&r.isBlock)||U(i,s(n),{backwards:!0})){let c=je(i,s(n));return {doc:_e([H,c?H:"",o]),isBlock:a,hasLineSuffix:!0}}return !a||r!=null&&r.hasLineSuffix?{doc:[_e([" ",o]),fe],isBlock:a,hasLineSuffix:!0}:{doc:[" ",o],isBlock:a,hasLineSuffix:!1}}function fo(t,e){let r=t.node;if(!r)return {};let n=e[Symbol.for("printedComments")];if((r.comments||[]).filter(a=>!n.has(a)).length===0)return {leading:"",trailing:""};let u=[],i=[],s;return t.each(()=>{let a=t.node;if(n!=null&&n.has(a))return;let{leading:D,trailing:c}=a;D?u.push(co(t,e)):c&&(s=lo(t,e,s),i.push(s.doc));},"comments"),{leading:u,trailing:i}}function kn(t,e,r){let{leading:n,trailing:o}=fo(t,r);return !n&&!o?e:Ze(e,u=>[n,u,o])}function bn(t){let{[Symbol.for("comments")]:e,[Symbol.for("printedComments")]:r}=t;for(let n of e){if(!n.printed&&!r.has(n))throw new Error('Comment "'+n.value.trim()+'" was not printed. Please report this error!');delete n.printed;}}async function wn(t,e,r,n,o){let{embeddedLanguageFormatting:u,printer:{embed:i,hasPrettierIgnore:s=()=>!1,getVisitorKeys:a}}=r;if(!i||u!=="auto")return;if(i.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/en/plugins.html#optional-embed");let D=J(i.getVisitorKeys??a),c=[];d();let F=t.stack;for(let{print:l,node:p,pathStack:m}of c)try{t.stack=m;let E=await l(f,e,t,r);E&&o.set(p,E);}catch(E){if(globalThis.PRETTIER_DEBUG)throw E}t.stack=F;function f(l,p){return po(l,p,r,n)}function d(){let{node:l}=t;if(l===null||typeof l!="object"||s(t))return;for(let m of D(l))Array.isArray(l[m])?t.each(d,m):t.call(d,m);let p=i(t,r);if(p){if(typeof p=="function"){c.push({print:p,node:l,pathStack:[...t.stack]});return}o.set(l,p);}}}async function po(t,e,r,n){let o=await ue({...r,...e,parentParser:r.parser,originalText:t},{passThrough:!0}),{ast:u}=await De(t,o),i=await n(u,o);return Xe(i)}function mo(t,e){let{originalText:r,[Symbol.for("comments")]:n,locStart:o,locEnd:u,[Symbol.for("printedComments")]:i}=e,{node:s}=t,a=o(s),D=u(s);for(let c of n)o(c)>=a&&u(c)<=D&&i.add(c);return r.slice(a,D)}var Nn=mo;async function Ve(t,e){({ast:t}=await Kt(t,e));let r=new Map,n=new En(t),u=new Map;await wn(n,s,e,Ve,u);let i=await Tn(n,e,s,void 0,u);return bn(e),i;function s(D,c){return D===void 0||D===n?a(c):Array.isArray(D)?n.call(()=>a(c),...D):n.call(()=>a(c),D)}function a(D){let c=n.node;if(c==null)return "";let F=c&&typeof c=="object"&&D===void 0;if(F&&r.has(c))return r.get(c);let f=Tn(n,e,s,D,u);return F&&r.set(c,f),f}}function Tn(t,e,r,n,o){var a;let{node:u}=t,{printer:i}=e,s;return (a=i.hasPrettierIgnore)!=null&&a.call(i,t)?s=Nn(t,e):o.has(u)?s=o.get(u):s=i.print(t,e,r,n),u===e.cursorNode&&(s=Ze(s,D=>[Be,D,Be])),i.printComment&&(!i.willPrintOwnComments||!i.willPrintOwnComments(t,e))&&(s=kn(t,s,e)),s}async function Kt(t,e){let r=t.comments??[];e[Symbol.for("comments")]=r,e[Symbol.for("tokens")]=t.tokens??[],e[Symbol.for("printedComments")]=new Set,_n(t,e);let{printer:{preprocess:n}}=e;return t=n?await n(t,e):t,{ast:t,comments:r}}var Eo=({parser:t})=>t==="json"||t==="json5"||t==="json-stringify";function ho(t,e){let r=[t.node,...t.parentNodes],n=new Set([e.node,...e.parentNodes]);return r.find(o=>Pn.has(o.type)&&n.has(o))}function Sn(t){let e=t.length-1;for(;;){let r=t[e];if((r==null?void 0:r.type)==="Program"||(r==null?void 0:r.type)==="File")e--;else break}return t.slice(0,e+1)}function Co(t,e,{locStart:r,locEnd:n}){let o=t.node,u=e.node;if(o===u)return {startNode:o,endNode:u};let i=r(t.node);for(let a of Sn(e.parentNodes))if(r(a)>=i)u=a;else break;let s=n(e.node);for(let a of Sn(t.parentNodes)){if(n(a)<=s)o=a;else break;if(o===u)break}return {startNode:o,endNode:u}}function Ht(t,e,r,n,o=[],u){let{locStart:i,locEnd:s}=r,a=i(t),D=s(t);if(!(e>D||e<a||u==="rangeEnd"&&e===a||u==="rangeStart"&&e===D)){for(let c of Et(t,r)){let F=Ht(c,e,r,n,[t,...o],u);if(F)return F}if(!n||n(t,o[0]))return {node:t,parentNodes:o}}}function go(t,e){return e!=="DeclareExportDeclaration"&&t!=="TypeParameterDeclaration"&&(t==="Directive"||t==="TypeAlias"||t==="TSExportAssignment"||t.startsWith("Declare")||t.startsWith("TSDeclare")||t.endsWith("Statement")||t.endsWith("Declaration"))}var Pn=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),yo=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function vn(t,e,r){if(!e)return !1;switch(t.parser){case"flow":case"babel":case"babel-flow":case"babel-ts":case"typescript":case"acorn":case"espree":case"meriyah":case"__babel_estree":return go(e.type,r==null?void 0:r.type);case"json":case"json5":case"json-stringify":return Pn.has(e.type);case"graphql":return yo.has(e.kind);case"vue":return e.tag!=="root"}return !1}function Ln(t,e,r){let{rangeStart:n,rangeEnd:o,locStart:u,locEnd:i}=e;Ye.ok(o>n);let s=t.slice(n,o).search(/\S/),a=s===-1;if(!a)for(n+=s;o>n&&!/\S/.test(t[o-1]);--o);let D=Ht(r,n,e,(d,l)=>vn(e,d,l),[],"rangeStart"),c=a?D:Ht(r,o,e,d=>vn(e,d),[],"rangeEnd");if(!D||!c)return {rangeStart:0,rangeEnd:0};let F,f;if(Eo(e)){let d=ho(D,c);F=d,f=d;}else ({startNode:F,endNode:f}=Co(D,c,e));return {rangeStart:Math.min(u(F),u(f)),rangeEnd:Math.max(i(F),i(f))}}function xo(t,e){let{cursorOffset:r,locStart:n,locEnd:o}=e,u=J(e.printer.getVisitorKeys),i=a=>n(a)<=r&&o(a)>=r,s=t;for(let a of gn(t,{getVisitorKeys:u,filter:i}))s=a;return s}var In=xo;var $n="\uFEFF",Rn=Symbol("cursor");async function Un(t,e,r=0){if(!t||t.trim().length===0)return {formatted:"",cursorOffset:-1,comments:[]};let{ast:n,text:o}=await De(t,e);e.cursorOffset>=0&&(e.cursorNode=In(n,e));let u=await Ve(n,e);r>0&&(u=qe([H,u],r,e.tabWidth));let i=pe(u,e);if(r>0){let a=i.formatted.trim();i.cursorNodeStart!==void 0&&(i.cursorNodeStart-=i.formatted.indexOf(a)),i.formatted=a+be(e.endOfLine);}let s=e[Symbol.for("comments")];if(e.cursorOffset>=0){let a,D,c,F,f;if(e.cursorNode&&i.cursorNodeText?(a=e.locStart(e.cursorNode),D=o.slice(a,e.locEnd(e.cursorNode)),c=e.cursorOffset-a,F=i.cursorNodeStart,f=i.cursorNodeText):(a=0,D=o,c=e.cursorOffset,F=0,f=i.formatted),D===f)return {formatted:i.formatted,cursorOffset:F+c,comments:s};let d=D.split("");d.splice(c,0,Rn);let l=f.split(""),p=(0, Vn.diffArrays)(d,l),m=F;for(let E of p)if(E.removed){if(E.value.includes(Rn))break}else m+=E.count;return {formatted:i.formatted,cursorOffset:m,comments:s}}return {formatted:i.formatted,cursorOffset:-1,comments:s}}async function _o(t,e){let{ast:r,text:n}=await De(t,e),{rangeStart:o,rangeEnd:u}=Ln(n,e,r),i=n.slice(o,u),s=Math.min(o,n.lastIndexOf(`
4276
+ `,o)+1),a=n.slice(s,o).match(/^\s*/)[0],D=de(a,e.tabWidth),c=await Un(i,{...e,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:e.cursorOffset>o&&e.cursorOffset<=u?e.cursorOffset-o:-1,endOfLine:"lf"},D),F=c.formatted.trimEnd(),{cursorOffset:f}=e;f>u?f+=F.length-i.length:c.cursorOffset>=0&&(f=c.cursorOffset+o);let d=n.slice(0,o)+F+n.slice(u);if(e.endOfLine!=="lf"){let l=be(e.endOfLine);f>=0&&l===`\r
4277
+ `&&(f+=Bt(d.slice(0,f),`
4278
+ `)),d=re(!1,d,`
4279
+ `,l);}return {formatted:d,cursorOffset:f,comments:c.comments}}function qt(t,e,r){return typeof e!="number"||Number.isNaN(e)||e<0||e>t.length?r:e}function Yn(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:o}=e;return r=qt(t,r,-1),n=qt(t,n,0),o=qt(t,o,t.length),{...e,cursorOffset:r,rangeStart:n,rangeEnd:o}}function Mn(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u}=Yn(t,e),i=t.charAt(0)===$n;if(i&&(t=t.slice(1),r--,n--,o--),u==="auto"&&(u=gr(t)),t.includes("\r")){let s=a=>Bt(t.slice(0,Math.max(a,0)),`\r
4280
+ `);r-=s(r),n-=s(n),o-=s(o),t=yr(t);}return {hasBOM:i,text:t,options:Yn(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u})}}async function jn(t,e){let r=await ft(e);return !r.hasPragma||r.hasPragma(t)}async function Jt(t,e){let{hasBOM:r,text:n,options:o}=Mn(t,await ue(e));if(o.rangeStart>=o.rangeEnd&&n!==""||o.requirePragma&&!await jn(n,o))return {formatted:t,cursorOffset:e.cursorOffset,comments:[]};let u;return o.rangeStart>0||o.rangeEnd<n.length?u=await _o(n,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await jn(n,o)&&(n=o.printer.insertPragma(n)),u=await Un(n,o)),r&&(u.formatted=$n+u.formatted,u.cursorOffset>=0&&u.cursorOffset++),u}async function Wn(t,e,r){let{text:n,options:o}=Mn(t,await ue(e)),u=await De(n,o);return r&&(r.preprocessForPrint&&(u.ast=await Kt(u.ast,o)),r.massage&&(u.ast=Dn(u.ast,o))),u}async function zn(t,e){e=await ue(e);let r=await Ve(t,e);return pe(r,e)}async function Gn(t,e){let r=vr(t),{formatted:n}=await Jt(r,{...e,parser:"__js_expression"});return n}async function Kn(t,e){e=await ue(e);let{ast:r}=await De(t,e);return Ve(r,e)}async function Hn(t,e){return pe(t,await ue(e))}var Zt={};Me(Zt,{addDanglingComment:()=>Q,addLeadingComment:()=>oe,addTrailingComment:()=>ie,getAlignmentSize:()=>de,getIndentSize:()=>Jn,getMaxContinuousCount:()=>qn,getNextNonSpaceNonCommentCharacter:()=>Qn,getNextNonSpaceNonCommentCharacterIndex:()=>Io,getStringWidth:()=>we,hasNewline:()=>U,hasNewlineInRange:()=>Xn,hasSpaces:()=>Zn,isNextLineEmpty:()=>Vo,isNextLineEmptyAfterIndex:()=>ht,isPreviousLineEmpty:()=>Yo,makeString:()=>eu,skip:()=>Ee,skipEverythingButNewLine:()=>mt,skipInlineComment:()=>he,skipNewline:()=>V,skipSpaces:()=>T,skipToLineEnd:()=>Ft,skipTrailingComment:()=>Ce,skipWhitespace:()=>hn});function Bo(t,e){if(e===!1)return !1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let r=e+2;r<t.length;++r)if(t.charAt(r)==="*"&&t.charAt(r+1)==="/")return r+2}return e}var he=Bo;function ko(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?mt(t,e):e}var Ce=ko;function bo(t,e){let r=null,n=e;for(;n!==r;)r=n,n=T(t,n),n=he(t,n),n=Ce(t,n),n=V(t,n);return n}var $e=bo;function wo(t,e){let r=null,n=e;for(;n!==r;)r=n,n=Ft(t,n),n=he(t,n),n=T(t,n);return n=Ce(t,n),n=V(t,n),n!==!1&&U(t,n)}var ht=wo;function Xt(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Oo(t,e){let r=t.match(new RegExp(`(${Xt(e)})+`,"g"));return r===null?0:r.reduce((n,o)=>Math.max(n,o.length/e.length),0)}var qn=Oo;function No(t,e){let r=t.lastIndexOf(`
4281
+ `);return r===-1?0:de(t.slice(r+1).match(/^[\t ]*/)[0],e)}var Jn=No;function To(t,e,r){for(let n=e;n<r;++n)if(t.charAt(n)===`
4282
+ `)return !0;return !1}var Xn=To;function So(t,e,r={}){return T(t,r.backwards?e-1:e,r)!==e}var Zn=So;function vo(t,e){let r=$e(t,e);return r===!1?"":t.charAt(r)}var Qn=vo;function Po(t,e,r){let n=e==='"'?"'":'"',u=re(!1,t,/\\(.)|(["'])/gs,(i,s,a)=>s===n?s:a===e?"\\"+a:a||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(s)?s:"\\"+s));return e+u+e}var eu=Po;function Lo(t,e,r){return $e(t,r(e))}function Io(t,e){return arguments.length===2||typeof e=="number"?$e(t,e):Lo(...arguments)}function Ro(t,e,r){return je(t,r(e))}function Yo(t,e){return arguments.length===2||typeof e=="number"?je(t,e):Ro(...arguments)}function jo(t,e,r){return ht(t,r(e))}function Vo(t,e){return arguments.length===2||typeof e=="number"?ht(t,e):jo(...arguments)}var Qt={};Me(Qt,{builders:()=>$o,printer:()=>Uo,utils:()=>Mo});var $o={join:ke,line:Ke,softline:hr,hardline:H,literalline:He,group:_t,conditionalGroup:pr,fill:Ge,lineSuffix:_e,lineSuffixBoundary:mr,cursor:Be,breakParent:fe,ifBreak:dr,trim:Er,indent:ae,indentIfBreak:Fr,align:se,addAlignmentToDoc:qe,markAsRoot:lr,dedentToRoot:cr,dedent:fr,hardlineWithoutBreakParent:Ae,literallineWithoutBreakParent:At,label:Cr,concat:t=>t},Uo={printDocToString:pe},Mo={willBreak:br,traverseDoc:xe,findInDoc:Je,mapDoc:Ne,removeLines:Or,stripTrailingHardline:Xe,replaceEndOfLine:Nr,canBreak:Tr};var tu="3.0.1";function ce(t,e=1){return async(...r)=>{let n=r[e]??{},o=n.plugins??[];return r[e]={...n,plugins:Array.isArray(o)?o:Object.values(o)},t(...r)}}var ru=ce(Jt);async function nu(t,e){let{formatted:r}=await ru(t,{...e,cursorOffset:-1});return r}async function Wo(t,e){return await nu(t,e)===t}var zo=ce(et,0),Go={parse:ce(Wn),formatAST:ce(zn),formatDoc:ce(Gn),printToDoc:ce(Kn),printDocToString:ce(Hn)};
4283
+
4284
+ const util = Zt;
4285
+
2925
4286
  /**
2926
4287
  * Override the default behavior to attach comments to syntax node.
2927
4288
  */
@@ -3043,6 +4404,7 @@ function needsParens(path, options) {
3043
4404
  if (!parent) {
3044
4405
  return false;
3045
4406
  }
4407
+ // eslint-disable-next-line deprecation/deprecation
3046
4408
  const node = path.getValue();
3047
4409
  switch (node.kind) {
3048
4410
  case SyntaxKind.IntersectionExpression:
@@ -3059,8 +4421,8 @@ function needsParens(path, options) {
3059
4421
  }
3060
4422
  }
3061
4423
 
3062
- const { align, breakParent, group, hardline, ifBreak, indent, join, line, softline } = prettier.doc.builders;
3063
- const { isNextLineEmpty } = prettier.util;
4424
+ const { align, breakParent, group, hardline, ifBreak, indent, join, line, softline } = builders;
4425
+ const { isNextLineEmpty } = util;
3064
4426
  /**
3065
4427
  * If the decorators for that node should try to be kept inline.
3066
4428
  */
@@ -3071,6 +4433,7 @@ const DecoratorsTryInline = {
3071
4433
  };
3072
4434
  const typespecPrinter = {
3073
4435
  print: printTypeSpec,
4436
+ isBlockComment: (node) => isBlockComment(node),
3074
4437
  canAttachComment: canAttachComment,
3075
4438
  printComment: printComment,
3076
4439
  handleComments: commentHandler,
@@ -3372,7 +4735,7 @@ function shouldDecoratorBreakLine(path, options, { tryInline }) {
3372
4735
  * Check if there is already new lines in between the decorators of the node.
3373
4736
  */
3374
4737
  function hasNewlineBetweenOrAfterDecorators(node, options) {
3375
- return node.decorators.some((decorator) => prettier.util.hasNewline(options.originalText, decorator.end));
4738
+ return node.decorators.some((decorator) => util.hasNewline(options.originalText, decorator.end));
3376
4739
  }
3377
4740
  function printDecorator(path, options, print) {
3378
4741
  const args = printDecoratorArgs(path, options, print);
@@ -4166,35 +5529,6 @@ function isLineComment(comment) {
4166
5529
  return comment.kind === SyntaxKind.BlockComment;
4167
5530
  }
4168
5531
 
4169
- (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4170
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4171
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4172
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4173
- };
4174
- (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4175
- if (kind === "m") throw new TypeError("Private method is not writable");
4176
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4177
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
4178
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
4179
- };
4180
- /**
4181
- * A specially typed version of `Array.isArray` to work around [this issue](https://github.com/microsoft/TypeScript/issues/17002).
4182
- */
4183
- function isArray(
4184
- // eslint-disable-next-line @typescript-eslint/ban-types
4185
- arg) {
4186
- return Array.isArray(arg);
4187
- }
4188
- /**
4189
- * Casts away readonly typing.
4190
- *
4191
- * Use it like this when it is safe to override readonly typing:
4192
- * mutate(item).prop = value;
4193
- */
4194
- function mutate(value) {
4195
- return value;
4196
- }
4197
-
4198
5532
  /**
4199
5533
  * The fixed set of options for each of the kinds of delimited lists in TypeSpec.
4200
5534
  */
@@ -4645,16 +5979,43 @@ function createParser(code, options = {}) {
4645
5979
  };
4646
5980
  }
4647
5981
  function parseUnionVariant(pos, decorators) {
4648
- const id = parseIdentifier({
4649
- message: "property",
4650
- allowStringLiteral: true,
4651
- });
4652
- parseExpected(Token.Colon);
4653
- const value = parseExpression();
5982
+ const idOrExpr = parseExpression();
5983
+ if (parseOptional(Token.Colon)) {
5984
+ let id = undefined;
5985
+ if (idOrExpr.kind !== SyntaxKind.TypeReference &&
5986
+ idOrExpr.kind !== SyntaxKind.StringLiteral) {
5987
+ error({ code: "token-expected", messageId: "identifier" });
5988
+ }
5989
+ else if (idOrExpr.kind === SyntaxKind.StringLiteral) {
5990
+ // convert string literal node to identifier node (back compat for string literal quoted properties)
5991
+ id = {
5992
+ kind: SyntaxKind.Identifier,
5993
+ sv: idOrExpr.value,
5994
+ ...finishNode(idOrExpr.pos),
5995
+ };
5996
+ }
5997
+ else {
5998
+ const target = idOrExpr.target;
5999
+ if (target.kind === SyntaxKind.Identifier) {
6000
+ id = target;
6001
+ }
6002
+ else {
6003
+ error({ code: "token-expected", messageId: "identifier" });
6004
+ }
6005
+ }
6006
+ const value = parseExpression();
6007
+ return {
6008
+ kind: SyntaxKind.UnionVariant,
6009
+ id,
6010
+ value,
6011
+ decorators,
6012
+ ...finishNode(pos),
6013
+ };
6014
+ }
4654
6015
  return {
4655
6016
  kind: SyntaxKind.UnionVariant,
4656
- id,
4657
- value,
6017
+ id: undefined,
6018
+ value: idOrExpr,
4658
6019
  decorators,
4659
6020
  ...finishNode(pos),
4660
6021
  };
@@ -5066,7 +6427,7 @@ function createParser(code, options = {}) {
5066
6427
  const pos = tokenPos();
5067
6428
  parseExpected(Token.Hash);
5068
6429
  const target = parseIdentifier();
5069
- if (target.sv !== "suppress") {
6430
+ if (target.sv !== "suppress" && target.sv !== "deprecated") {
5070
6431
  error({
5071
6432
  code: "unknown-directive",
5072
6433
  format: { id: target.sv },
@@ -6729,7 +8090,7 @@ function isBlocklessNamespace(node) {
6729
8090
  return node.statements === undefined;
6730
8091
  }
6731
8092
 
6732
- function parse(text, parsers, opts) {
8093
+ function parse(text, options) {
6733
8094
  const result = parse$1(text, { comments: true, docs: true });
6734
8095
  flattenNamespaces(result);
6735
8096
  const errors = result.parseDiagnostics.filter((x) => x.severity === "error");