ct-rich-text-editor 1.2.4 → 1.2.6

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.
Files changed (46) hide show
  1. package/dist/api/ai/index.d.ts +6 -1
  2. package/dist/api/auth.d.ts +4 -0
  3. package/dist/api/config/endpoints.d.ts +1 -0
  4. package/dist/assets/style.css +5394 -1
  5. package/dist/{babel-1c4a328b.js → babel-d155920e.js} +2303 -2279
  6. package/dist/{babel-1c4a328b.js.map → babel-d155920e.js.map} +1 -1
  7. package/dist/components/AiPlugin/index.d.ts +1 -1
  8. package/dist/components/ImageGenerationDialog/ImageGenerationManager.d.ts +11 -0
  9. package/dist/components/ImageGenerationDialog/index.d.ts +10 -0
  10. package/dist/editorConfig.d.ts +1 -0
  11. package/dist/estree-b1fff53b.js +4706 -0
  12. package/dist/{estree-2cbea43c.js.map → estree-b1fff53b.js.map} +1 -1
  13. package/dist/html-f95ee5dc.js +2885 -0
  14. package/dist/{html-c18fb60e.js.map → html-f95ee5dc.js.map} +1 -1
  15. package/dist/index-5238e1b7.js +27912 -0
  16. package/dist/index-5238e1b7.js.map +1 -0
  17. package/dist/index-ffff9c22.js +655 -0
  18. package/dist/index-ffff9c22.js.map +1 -0
  19. package/dist/index.js +47 -14
  20. package/dist/index.js.map +1 -1
  21. package/dist/markdown-1d9e6c3f.js +3759 -0
  22. package/dist/markdown-1d9e6c3f.js.map +1 -0
  23. package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +1 -0
  24. package/dist/plugins/AIChatPlugin.d.ts +2 -1
  25. package/dist/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +1 -0
  26. package/dist/postcss-c2592f3f.js +5399 -0
  27. package/dist/postcss-c2592f3f.js.map +1 -0
  28. package/dist/standalone-bcc7f37a.js +2649 -0
  29. package/dist/standalone-bcc7f37a.js.map +1 -0
  30. package/dist/types.d.ts +1 -0
  31. package/dist/typescript-48c10f50.js +13601 -0
  32. package/dist/{typescript-39d06710.js.map → typescript-48c10f50.js.map} +1 -1
  33. package/package.json +2 -2
  34. package/dist/estree-2cbea43c.js +0 -4668
  35. package/dist/html-c18fb60e.js +0 -2842
  36. package/dist/index-0e027fdf.js +0 -806
  37. package/dist/index-0e027fdf.js.map +0 -1
  38. package/dist/index-bd25a91b.js +0 -35926
  39. package/dist/index-bd25a91b.js.map +0 -1
  40. package/dist/markdown-39c3822b.js +0 -3548
  41. package/dist/markdown-39c3822b.js.map +0 -1
  42. package/dist/postcss-bbcc713e.js +0 -5152
  43. package/dist/postcss-bbcc713e.js.map +0 -1
  44. package/dist/standalone-36ad3877.js +0 -2601
  45. package/dist/standalone-36ad3877.js.map +0 -1
  46. package/dist/typescript-39d06710.js +0 -13534
@@ -1,2601 +0,0 @@
1
- var It = Object.defineProperty;
2
- var Pt = (e, u, t) => u in e ? It(e, u, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[u] = t;
3
- var he = (e, u, t) => (Pt(e, typeof u != "symbol" ? u + "" : u, t), t);
4
- var $t = Object.create, eu = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, Mt = Object.getOwnPropertyNames, Rt = Object.getPrototypeOf, Wt = Object.prototype.hasOwnProperty, Hu = (e) => {
5
- throw TypeError(e);
6
- }, Gu = (e, u) => () => (u || e((u = { exports: {} }).exports, u), u.exports), uu = (e, u) => {
7
- for (var t in u)
8
- eu(e, t, { get: u[t], enumerable: !0 });
9
- }, zt = (e, u, t, r) => {
10
- if (u && typeof u == "object" || typeof u == "function")
11
- for (let D of Mt(u))
12
- !Wt.call(e, D) && D !== t && eu(e, D, { get: () => u[D], enumerable: !(r = Lt(u, D)) || r.enumerable });
13
- return e;
14
- }, we = (e, u, t) => (t = e != null ? $t(Rt(e)) : {}, zt(u || !e || !e.__esModule ? eu(t, "default", { value: e, enumerable: !0 }) : t, e)), Vt = (e, u, t) => u.has(e) || Hu("Cannot " + t), qt = (e, u, t) => u.has(e) ? Hu("Cannot add the same private member more than once") : u instanceof WeakSet ? u.add(e) : u.set(e, t), le = (e, u, t) => (Vt(e, u, "access private method"), t), tu = Gu((e, u) => {
15
- var t = new Proxy(String, { get: () => t });
16
- u.exports = t;
17
- }), Jt = Gu((e) => {
18
- Object.defineProperty(e, "__esModule", { value: !0 });
19
- function u() {
20
- return new Proxy({}, { get: () => (n) => n });
21
- }
22
- var t = /\r\n|[\n\r\u2028\u2029]/;
23
- function r(n, o, i) {
24
- let a = Object.assign({ column: 0, line: -1 }, n.start), s = Object.assign({}, a, n.end), { linesAbove: l = 2, linesBelow: F = 3 } = i || {}, c = a.line, d = a.column, f = s.line, p = s.column, h = Math.max(c - (l + 1), 0), g = Math.min(o.length, f + F);
25
- c === -1 && (h = 0), f === -1 && (g = o.length);
26
- let y = f - c, C = {};
27
- if (y)
28
- for (let m = 0; m <= y; m++) {
29
- let E = m + c;
30
- if (!d)
31
- C[E] = !0;
32
- else if (m === 0) {
33
- let v = o[E - 1].length;
34
- C[E] = [d, v - d + 1];
35
- } else if (m === y)
36
- C[E] = [0, p];
37
- else {
38
- let v = o[E - m].length;
39
- C[E] = [0, v];
40
- }
41
- }
42
- else
43
- d === p ? d ? C[c] = [d, 0] : C[c] = !0 : C[c] = [d, p - d];
44
- return { start: h, end: g, markerLines: C };
45
- }
46
- function D(n, o, i = {}) {
47
- let a = u(), s = n.split(t), { start: l, end: F, markerLines: c } = r(o, s, i), d = o.start && typeof o.start.column == "number", f = String(F).length, p = n.split(t, F).slice(l, F).map((h, g) => {
48
- let y = l + 1 + g, C = ` ${` ${y}`.slice(-f)} |`, m = c[y], E = !c[y + 1];
49
- if (m) {
50
- let v = "";
51
- if (Array.isArray(m)) {
52
- let A = h.slice(0, Math.max(m[0] - 1, 0)).replace(/[^\t]/g, " "), N = m[1] || 1;
53
- v = [`
54
- `, a.gutter(C.replace(/\d/g, " ")), " ", A, a.marker("^").repeat(N)].join(""), E && i.message && (v += " " + a.message(i.message));
55
- }
56
- return [a.marker(">"), a.gutter(C), h.length > 0 ? ` ${h}` : "", v].join("");
57
- } else
58
- return ` ${a.gutter(C)}${h.length > 0 ? ` ${h}` : ""}`;
59
- }).join(`
60
- `);
61
- return i.message && !d && (p = `${" ".repeat(f + 1)}${i.message}
62
- ${p}`), p;
63
- }
64
- e.codeFrameColumns = D;
65
- }), Kt = {};
66
- uu(Kt, { __debug: () => eo, check: () => QD, doc: () => Nt, format: () => jt, formatWithCursor: () => _t, getSupportInfo: () => XD, util: () => Ot, version: () => wD });
67
- var Ut = (e, u, t, r) => {
68
- if (!(e && u == null))
69
- return u.replaceAll ? u.replaceAll(t, r) : t.global ? u.replace(t, r) : u.split(t).join(r);
70
- }, ke = Ut;
71
- function _() {
72
- }
73
- _.prototype = { diff: function(e, u) {
74
- var t, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, D = r.callback;
75
- typeof r == "function" && (D = r, r = {});
76
- var n = this;
77
- function o(C) {
78
- return C = n.postProcess(C, r), D ? (setTimeout(function() {
79
- D(C);
80
- }, 0), !0) : C;
81
- }
82
- e = this.castInput(e, r), u = this.castInput(u, r), e = this.removeEmpty(this.tokenize(e, r)), u = this.removeEmpty(this.tokenize(u, r));
83
- var i = u.length, a = e.length, s = 1, l = i + a;
84
- r.maxEditLength != null && (l = Math.min(l, r.maxEditLength));
85
- var F = (t = r.timeout) !== null && t !== void 0 ? t : 1 / 0, c = Date.now() + F, d = [{ oldPos: -1, lastComponent: void 0 }], f = this.extractCommon(d[0], u, e, 0, r);
86
- if (d[0].oldPos + 1 >= a && f + 1 >= i)
87
- return o(Cu(n, d[0].lastComponent, u, e, n.useLongestToken));
88
- var p = -1 / 0, h = 1 / 0;
89
- function g() {
90
- for (var C = Math.max(p, -s); C <= Math.min(h, s); C += 2) {
91
- var m = void 0, E = d[C - 1], v = d[C + 1];
92
- E && (d[C - 1] = void 0);
93
- var A = !1;
94
- if (v) {
95
- var N = v.oldPos - C;
96
- A = v && 0 <= N && N < i;
97
- }
98
- var ue = E && E.oldPos + 1 < a;
99
- if (!A && !ue) {
100
- d[C] = void 0;
101
- continue;
102
- }
103
- if (!ue || A && E.oldPos < v.oldPos ? m = n.addToPath(v, !0, !1, 0, r) : m = n.addToPath(E, !1, !0, 1, r), f = n.extractCommon(m, u, e, C, r), m.oldPos + 1 >= a && f + 1 >= i)
104
- return o(Cu(n, m.lastComponent, u, e, n.useLongestToken));
105
- d[C] = m, m.oldPos + 1 >= a && (h = Math.min(h, C - 1)), f + 1 >= i && (p = Math.max(p, C + 1));
106
- }
107
- s++;
108
- }
109
- if (D)
110
- (function C() {
111
- setTimeout(function() {
112
- if (s > l || Date.now() > c)
113
- return D();
114
- g() || C();
115
- }, 0);
116
- })();
117
- else
118
- for (; s <= l && Date.now() <= c; ) {
119
- var y = g();
120
- if (y)
121
- return y;
122
- }
123
- }, addToPath: function(e, u, t, r, D) {
124
- var n = e.lastComponent;
125
- return n && !D.oneChangePerToken && n.added === u && n.removed === t ? { oldPos: e.oldPos + r, lastComponent: { count: n.count + 1, added: u, removed: t, previousComponent: n.previousComponent } } : { oldPos: e.oldPos + r, lastComponent: { count: 1, added: u, removed: t, previousComponent: n } };
126
- }, extractCommon: function(e, u, t, r, D) {
127
- for (var n = u.length, o = t.length, i = e.oldPos, a = i - r, s = 0; a + 1 < n && i + 1 < o && this.equals(t[i + 1], u[a + 1], D); )
128
- a++, i++, s++, D.oneChangePerToken && (e.lastComponent = { count: 1, previousComponent: e.lastComponent, added: !1, removed: !1 });
129
- return s && !D.oneChangePerToken && (e.lastComponent = { count: s, previousComponent: e.lastComponent, added: !1, removed: !1 }), e.oldPos = i, a;
130
- }, equals: function(e, u, t) {
131
- return t.comparator ? t.comparator(e, u) : e === u || t.ignoreCase && e.toLowerCase() === u.toLowerCase();
132
- }, removeEmpty: function(e) {
133
- for (var u = [], t = 0; t < e.length; t++)
134
- e[t] && u.push(e[t]);
135
- return u;
136
- }, castInput: function(e) {
137
- return e;
138
- }, tokenize: function(e) {
139
- return Array.from(e);
140
- }, join: function(e) {
141
- return e.join("");
142
- }, postProcess: function(e) {
143
- return e;
144
- } };
145
- function Cu(e, u, t, r, D) {
146
- for (var n = [], o; u; )
147
- n.push(u), o = u.previousComponent, delete u.previousComponent, u = o;
148
- n.reverse();
149
- for (var i = 0, a = n.length, s = 0, l = 0; i < a; i++) {
150
- var F = n[i];
151
- if (F.removed)
152
- F.value = e.join(r.slice(l, l + F.count)), l += F.count;
153
- else {
154
- if (!F.added && D) {
155
- var c = t.slice(s, s + F.count);
156
- c = c.map(function(d, f) {
157
- var p = r[l + f];
158
- return p.length > d.length ? p : d;
159
- }), F.value = e.join(c);
160
- } else
161
- F.value = e.join(t.slice(s, s + F.count));
162
- s += F.count, F.added || (l += F.count);
163
- }
164
- }
165
- return n;
166
- }
167
- function mu(e, u) {
168
- var t;
169
- for (t = 0; t < e.length && t < u.length; t++)
170
- if (e[t] != u[t])
171
- return e.slice(0, t);
172
- return e.slice(0, t);
173
- }
174
- function gu(e, u) {
175
- var t;
176
- if (!e || !u || e[e.length - 1] != u[u.length - 1])
177
- return "";
178
- for (t = 0; t < e.length && t < u.length; t++)
179
- if (e[e.length - (t + 1)] != u[u.length - (t + 1)])
180
- return e.slice(-t);
181
- return e.slice(-t);
182
- }
183
- function ze(e, u, t) {
184
- if (e.slice(0, u.length) != u)
185
- throw Error("string ".concat(JSON.stringify(e), " doesn't start with prefix ").concat(JSON.stringify(u), "; this is a bug"));
186
- return t + e.slice(u.length);
187
- }
188
- function Ve(e, u, t) {
189
- if (!u)
190
- return e + t;
191
- if (e.slice(-u.length) != u)
192
- throw Error("string ".concat(JSON.stringify(e), " doesn't end with suffix ").concat(JSON.stringify(u), "; this is a bug"));
193
- return e.slice(0, -u.length) + t;
194
- }
195
- function ce(e, u) {
196
- return ze(e, u, "");
197
- }
198
- function Ce(e, u) {
199
- return Ve(e, u, "");
200
- }
201
- function Eu(e, u) {
202
- return u.slice(0, Ht(e, u));
203
- }
204
- function Ht(e, u) {
205
- var t = 0;
206
- e.length > u.length && (t = e.length - u.length);
207
- var r = u.length;
208
- e.length < u.length && (r = e.length);
209
- var D = Array(r), n = 0;
210
- D[0] = 0;
211
- for (var o = 1; o < r; o++) {
212
- for (u[o] == u[n] ? D[o] = D[n] : D[o] = n; n > 0 && u[o] != u[n]; )
213
- n = D[n];
214
- u[o] == u[n] && n++;
215
- }
216
- n = 0;
217
- for (var i = t; i < e.length; i++) {
218
- for (; n > 0 && e[i] != u[n]; )
219
- n = D[n];
220
- e[i] == u[n] && n++;
221
- }
222
- return n;
223
- }
224
- var Be = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", Gt = new RegExp("[".concat(Be, "]+|\\s+|[^").concat(Be, "]"), "ug"), Se = new _();
225
- Se.equals = function(e, u, t) {
226
- return t.ignoreCase && (e = e.toLowerCase(), u = u.toLowerCase()), e.trim() === u.trim();
227
- };
228
- Se.tokenize = function(e) {
229
- var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t;
230
- if (u.intlSegmenter) {
231
- if (u.intlSegmenter.resolvedOptions().granularity != "word")
232
- throw new Error('The segmenter passed must have a granularity of "word"');
233
- t = Array.from(u.intlSegmenter.segment(e), function(n) {
234
- return n.segment;
235
- });
236
- } else
237
- t = e.match(Gt) || [];
238
- var r = [], D = null;
239
- return t.forEach(function(n) {
240
- /\s/.test(n) ? D == null ? r.push(n) : r.push(r.pop() + n) : /\s/.test(D) ? r[r.length - 1] == D ? r.push(r.pop() + n) : r.push(D + n) : r.push(n), D = n;
241
- }), r;
242
- };
243
- Se.join = function(e) {
244
- return e.map(function(u, t) {
245
- return t == 0 ? u : u.replace(/^\s+/, "");
246
- }).join("");
247
- };
248
- Se.postProcess = function(e, u) {
249
- if (!e || u.oneChangePerToken)
250
- return e;
251
- var t = null, r = null, D = null;
252
- return e.forEach(function(n) {
253
- n.added ? r = n : n.removed ? D = n : ((r || D) && yu(t, D, r, n), t = n, r = null, D = null);
254
- }), (r || D) && yu(t, D, r, null), e;
255
- };
256
- function yu(e, u, t, r) {
257
- if (u && t) {
258
- var D = u.value.match(/^\s*/)[0], n = u.value.match(/\s*$/)[0], o = t.value.match(/^\s*/)[0], i = t.value.match(/\s*$/)[0];
259
- if (e) {
260
- var a = mu(D, o);
261
- e.value = Ve(e.value, o, a), u.value = ce(u.value, a), t.value = ce(t.value, a);
262
- }
263
- if (r) {
264
- var s = gu(n, i);
265
- r.value = ze(r.value, i, s), u.value = Ce(u.value, s), t.value = Ce(t.value, s);
266
- }
267
- } else if (t)
268
- e && (t.value = t.value.replace(/^\s*/, "")), r && (r.value = r.value.replace(/^\s*/, ""));
269
- else if (e && r) {
270
- var l = r.value.match(/^\s*/)[0], F = u.value.match(/^\s*/)[0], c = u.value.match(/\s*$/)[0], d = mu(l, F);
271
- u.value = ce(u.value, d);
272
- var f = gu(ce(l, d), c);
273
- u.value = Ce(u.value, f), r.value = ze(r.value, l, f), e.value = Ve(e.value, l, l.slice(0, l.length - f.length));
274
- } else if (r) {
275
- var p = r.value.match(/^\s*/)[0], h = u.value.match(/\s*$/)[0], g = Eu(h, p);
276
- u.value = Ce(u.value, g);
277
- } else if (e) {
278
- var y = e.value.match(/\s*$/)[0], C = u.value.match(/^\s*/)[0], m = Eu(y, C);
279
- u.value = ce(u.value, m);
280
- }
281
- }
282
- var Yt = new _();
283
- Yt.tokenize = function(e) {
284
- var u = new RegExp("(\\r?\\n)|[".concat(Be, "]+|[^\\S\\n\\r]+|[^").concat(Be, "]"), "ug");
285
- return e.match(u) || [];
286
- };
287
- var ru = new _();
288
- ru.tokenize = function(e, u) {
289
- u.stripTrailingCr && (e = e.replace(/\r\n/g, `
290
- `));
291
- var t = [], r = e.split(/(\n|\r\n)/);
292
- r[r.length - 1] || r.pop();
293
- for (var D = 0; D < r.length; D++) {
294
- var n = r[D];
295
- D % 2 && !u.newlineIsToken ? t[t.length - 1] += n : t.push(n);
296
- }
297
- return t;
298
- };
299
- ru.equals = function(e, u, t) {
300
- return t.ignoreWhitespace ? ((!t.newlineIsToken || !e.includes(`
301
- `)) && (e = e.trim()), (!t.newlineIsToken || !u.includes(`
302
- `)) && (u = u.trim())) : t.ignoreNewlineAtEof && !t.newlineIsToken && (e.endsWith(`
303
- `) && (e = e.slice(0, -1)), u.endsWith(`
304
- `) && (u = u.slice(0, -1))), _.prototype.equals.call(this, e, u, t);
305
- };
306
- var Zt = new _();
307
- Zt.tokenize = function(e) {
308
- return e.split(/(\S.+?[.!?])(?=\s+|$)/);
309
- };
310
- var Qt = new _();
311
- Qt.tokenize = function(e) {
312
- return e.split(/([{}:;,]|\s+)/);
313
- };
314
- function qe(e) {
315
- "@babel/helpers - typeof";
316
- return qe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(u) {
317
- return typeof u;
318
- } : function(u) {
319
- return u && typeof Symbol == "function" && u.constructor === Symbol && u !== Symbol.prototype ? "symbol" : typeof u;
320
- }, qe(e);
321
- }
322
- var de = new _();
323
- de.useLongestToken = !0;
324
- de.tokenize = ru.tokenize;
325
- de.castInput = function(e, u) {
326
- var t = u.undefinedReplacement, r = u.stringifyReplacer, D = r === void 0 ? function(n, o) {
327
- return typeof o > "u" ? t : o;
328
- } : r;
329
- return typeof e == "string" ? e : JSON.stringify(Je(e, null, null, D), D, " ");
330
- };
331
- de.equals = function(e, u, t) {
332
- return _.prototype.equals.call(de, e.replace(/,([\r\n])/g, "$1"), u.replace(/,([\r\n])/g, "$1"), t);
333
- };
334
- function Je(e, u, t, r, D) {
335
- u = u || [], t = t || [], r && (e = r(D, e));
336
- var n;
337
- for (n = 0; n < u.length; n += 1)
338
- if (u[n] === e)
339
- return t[n];
340
- var o;
341
- if (Object.prototype.toString.call(e) === "[object Array]") {
342
- for (u.push(e), o = new Array(e.length), t.push(o), n = 0; n < e.length; n += 1)
343
- o[n] = Je(e[n], u, t, r, D);
344
- return u.pop(), t.pop(), o;
345
- }
346
- if (e && e.toJSON && (e = e.toJSON()), qe(e) === "object" && e !== null) {
347
- u.push(e), o = {}, t.push(o);
348
- var i = [], a;
349
- for (a in e)
350
- Object.prototype.hasOwnProperty.call(e, a) && i.push(a);
351
- for (i.sort(), n = 0; n < i.length; n += 1)
352
- a = i[n], o[a] = Je(e[a], u, t, r, a);
353
- u.pop(), t.pop();
354
- } else
355
- o = e;
356
- return o;
357
- }
358
- var be = new _();
359
- be.tokenize = function(e) {
360
- return e.slice();
361
- };
362
- be.join = be.removeEmpty = function(e) {
363
- return e;
364
- };
365
- function Xt(e, u, t) {
366
- return be.diff(e, u, t);
367
- }
368
- function er(e) {
369
- let u = e.indexOf("\r");
370
- return u !== -1 ? e.charAt(u + 1) === `
371
- ` ? "crlf" : "cr" : "lf";
372
- }
373
- function nu(e) {
374
- switch (e) {
375
- case "cr":
376
- return "\r";
377
- case "crlf":
378
- return `\r
379
- `;
380
- default:
381
- return `
382
- `;
383
- }
384
- }
385
- function Yu(e, u) {
386
- let t;
387
- switch (u) {
388
- case `
389
- `:
390
- t = /\n/gu;
391
- break;
392
- case "\r":
393
- t = /\r/gu;
394
- break;
395
- case `\r
396
- `:
397
- t = /\r\n/gu;
398
- break;
399
- default:
400
- throw new Error(`Unexpected "eol" ${JSON.stringify(u)}.`);
401
- }
402
- let r = e.match(t);
403
- return r ? r.length : 0;
404
- }
405
- function ur(e) {
406
- return ke(!1, e, /\r\n?/gu, `
407
- `);
408
- }
409
- var Q = "string", P = "array", X = "cursor", $ = "indent", L = "align", M = "trim", k = "group", j = "fill", S = "if-break", R = "indent-if-break", W = "line-suffix", z = "line-suffix-boundary", b = "line", T = "label", x = "break-parent", Zu = /* @__PURE__ */ new Set([X, $, L, M, k, j, S, R, W, z, b, T, x]), tr = (e, u, t) => {
410
- if (!(e && u == null))
411
- return Array.isArray(u) || typeof u == "string" ? u[t < 0 ? u.length + t : t] : u.at(t);
412
- }, B = tr;
413
- function rr(e) {
414
- if (typeof e == "string")
415
- return Q;
416
- if (Array.isArray(e))
417
- return P;
418
- if (!e)
419
- return;
420
- let { type: u } = e;
421
- if (Zu.has(u))
422
- return u;
423
- }
424
- var ee = rr, nr = (e) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(e);
425
- function Dr(e) {
426
- let u = e === null ? "null" : typeof e;
427
- if (u !== "string" && u !== "object")
428
- return `Unexpected doc '${u}',
429
- Expected it to be 'string' or 'object'.`;
430
- if (ee(e))
431
- throw new Error("doc is valid.");
432
- let t = Object.prototype.toString.call(e);
433
- if (t !== "[object Object]")
434
- return `Unexpected doc '${t}'.`;
435
- let r = nr([...Zu].map((D) => `'${D}'`));
436
- return `Unexpected doc.type '${e.type}'.
437
- Expected it to be ${r}.`;
438
- }
439
- var or = class extends Error {
440
- constructor(u) {
441
- super(Dr(u));
442
- he(this, "name", "InvalidDocError");
443
- this.doc = u;
444
- }
445
- }, ie = or, vu = {};
446
- function ir(e, u, t, r) {
447
- let D = [e];
448
- for (; D.length > 0; ) {
449
- let n = D.pop();
450
- if (n === vu) {
451
- t(D.pop());
452
- continue;
453
- }
454
- t && D.push(n, vu);
455
- let o = ee(n);
456
- if (!o)
457
- throw new ie(n);
458
- if ((u == null ? void 0 : u(n)) !== !1)
459
- switch (o) {
460
- case P:
461
- case j: {
462
- let i = o === P ? n : n.parts;
463
- for (let a = i.length, s = a - 1; s >= 0; --s)
464
- D.push(i[s]);
465
- break;
466
- }
467
- case S:
468
- D.push(n.flatContents, n.breakContents);
469
- break;
470
- case k:
471
- if (r && n.expandedStates)
472
- for (let i = n.expandedStates.length, a = i - 1; a >= 0; --a)
473
- D.push(n.expandedStates[a]);
474
- else
475
- D.push(n.contents);
476
- break;
477
- case L:
478
- case $:
479
- case R:
480
- case T:
481
- case W:
482
- D.push(n.contents);
483
- break;
484
- case Q:
485
- case X:
486
- case M:
487
- case z:
488
- case b:
489
- case x:
490
- break;
491
- default:
492
- throw new ie(n);
493
- }
494
- }
495
- }
496
- var Du = ir;
497
- function xe(e, u) {
498
- if (typeof e == "string")
499
- return u(e);
500
- let t = /* @__PURE__ */ new Map();
501
- return r(e);
502
- function r(n) {
503
- if (t.has(n))
504
- return t.get(n);
505
- let o = D(n);
506
- return t.set(n, o), o;
507
- }
508
- function D(n) {
509
- switch (ee(n)) {
510
- case P:
511
- return u(n.map(r));
512
- case j:
513
- return u({ ...n, parts: n.parts.map(r) });
514
- case S:
515
- return u({ ...n, breakContents: r(n.breakContents), flatContents: r(n.flatContents) });
516
- case k: {
517
- let { expandedStates: o, contents: i } = n;
518
- return o ? (o = o.map(r), i = o[0]) : i = r(i), u({ ...n, contents: i, expandedStates: o });
519
- }
520
- case L:
521
- case $:
522
- case R:
523
- case T:
524
- case W:
525
- return u({ ...n, contents: r(n.contents) });
526
- case Q:
527
- case X:
528
- case M:
529
- case z:
530
- case b:
531
- case x:
532
- return u(n);
533
- default:
534
- throw new ie(n);
535
- }
536
- }
537
- }
538
- function ou(e, u, t) {
539
- let r = t, D = !1;
540
- function n(o) {
541
- if (D)
542
- return !1;
543
- let i = u(o);
544
- i !== void 0 && (D = !0, r = i);
545
- }
546
- return Du(e, n), r;
547
- }
548
- function ar(e) {
549
- if (e.type === k && e.break || e.type === b && e.hard || e.type === x)
550
- return !0;
551
- }
552
- function sr(e) {
553
- return ou(e, ar, !1);
554
- }
555
- function Bu(e) {
556
- if (e.length > 0) {
557
- let u = B(!1, e, -1);
558
- !u.expandedStates && !u.break && (u.break = "propagated");
559
- }
560
- return null;
561
- }
562
- function lr(e) {
563
- let u = /* @__PURE__ */ new Set(), t = [];
564
- function r(n) {
565
- if (n.type === x && Bu(t), n.type === k) {
566
- if (t.push(n), u.has(n))
567
- return !1;
568
- u.add(n);
569
- }
570
- }
571
- function D(n) {
572
- n.type === k && t.pop().break && Bu(t);
573
- }
574
- Du(e, r, D, !0);
575
- }
576
- function cr(e) {
577
- return e.type === b && !e.hard ? e.soft ? "" : " " : e.type === S ? e.flatContents : e;
578
- }
579
- function fr(e) {
580
- return xe(e, cr);
581
- }
582
- function bu(e) {
583
- for (e = [...e]; e.length >= 2 && B(!1, e, -2).type === b && B(!1, e, -1).type === x; )
584
- e.length -= 2;
585
- if (e.length > 0) {
586
- let u = fe(B(!1, e, -1));
587
- e[e.length - 1] = u;
588
- }
589
- return e;
590
- }
591
- function fe(e) {
592
- switch (ee(e)) {
593
- case $:
594
- case R:
595
- case k:
596
- case W:
597
- case T: {
598
- let u = fe(e.contents);
599
- return { ...e, contents: u };
600
- }
601
- case S:
602
- return { ...e, breakContents: fe(e.breakContents), flatContents: fe(e.flatContents) };
603
- case j:
604
- return { ...e, parts: bu(e.parts) };
605
- case P:
606
- return bu(e);
607
- case Q:
608
- return e.replace(/[\n\r]*$/u, "");
609
- case L:
610
- case X:
611
- case M:
612
- case z:
613
- case b:
614
- case x:
615
- break;
616
- default:
617
- throw new ie(e);
618
- }
619
- return e;
620
- }
621
- function Qu(e) {
622
- return fe(Fr(e));
623
- }
624
- function dr(e) {
625
- switch (ee(e)) {
626
- case j:
627
- if (e.parts.every((u) => u === ""))
628
- return "";
629
- break;
630
- case k:
631
- if (!e.contents && !e.id && !e.break && !e.expandedStates)
632
- return "";
633
- if (e.contents.type === k && e.contents.id === e.id && e.contents.break === e.break && e.contents.expandedStates === e.expandedStates)
634
- return e.contents;
635
- break;
636
- case L:
637
- case $:
638
- case R:
639
- case W:
640
- if (!e.contents)
641
- return "";
642
- break;
643
- case S:
644
- if (!e.flatContents && !e.breakContents)
645
- return "";
646
- break;
647
- case P: {
648
- let u = [];
649
- for (let t of e) {
650
- if (!t)
651
- continue;
652
- let [r, ...D] = Array.isArray(t) ? t : [t];
653
- typeof r == "string" && typeof B(!1, u, -1) == "string" ? u[u.length - 1] += r : u.push(r), u.push(...D);
654
- }
655
- return u.length === 0 ? "" : u.length === 1 ? u[0] : u;
656
- }
657
- case Q:
658
- case X:
659
- case M:
660
- case z:
661
- case b:
662
- case T:
663
- case x:
664
- break;
665
- default:
666
- throw new ie(e);
667
- }
668
- return e;
669
- }
670
- function Fr(e) {
671
- return xe(e, (u) => dr(u));
672
- }
673
- function pr(e, u = tt) {
674
- return xe(e, (t) => typeof t == "string" ? rt(u, t.split(`
675
- `)) : t);
676
- }
677
- function hr(e) {
678
- if (e.type === b)
679
- return !0;
680
- }
681
- function Cr(e) {
682
- return ou(e, hr, !1);
683
- }
684
- function Ee(e, u) {
685
- return e.type === T ? { ...e, contents: u(e.contents) } : u(e);
686
- }
687
- var mr = () => {
688
- }, gr = mr;
689
- function Ae(e) {
690
- return { type: $, contents: e };
691
- }
692
- function ae(e, u) {
693
- return { type: L, contents: u, n: e };
694
- }
695
- function Xu(e, u = {}) {
696
- return gr(u.expandedStates), { type: k, id: u.id, contents: e, break: !!u.shouldBreak, expandedStates: u.expandedStates };
697
- }
698
- function Er(e) {
699
- return ae(Number.NEGATIVE_INFINITY, e);
700
- }
701
- function yr(e) {
702
- return ae({ type: "root" }, e);
703
- }
704
- function vr(e) {
705
- return ae(-1, e);
706
- }
707
- function Br(e, u) {
708
- return Xu(e[0], { ...u, expandedStates: e });
709
- }
710
- function br(e) {
711
- return { type: j, parts: e };
712
- }
713
- function Ar(e, u = "", t = {}) {
714
- return { type: S, breakContents: e, flatContents: u, groupId: t.groupId };
715
- }
716
- function wr(e, u) {
717
- return { type: R, contents: e, groupId: u.groupId, negate: u.negate };
718
- }
719
- function Ke(e) {
720
- return { type: W, contents: e };
721
- }
722
- var kr = { type: z }, Ne = { type: x }, Sr = { type: M }, iu = { type: b, hard: !0 }, et = { type: b, hard: !0, literal: !0 }, ut = { type: b }, xr = { type: b, soft: !0 }, Y = [iu, Ne], tt = [et, Ne], G = { type: X };
723
- function rt(e, u) {
724
- let t = [];
725
- for (let r = 0; r < u.length; r++)
726
- r !== 0 && t.push(e), t.push(u[r]);
727
- return t;
728
- }
729
- function nt(e, u, t) {
730
- let r = e;
731
- if (u > 0) {
732
- for (let D = 0; D < Math.floor(u / t); ++D)
733
- r = Ae(r);
734
- r = ae(u % t, r), r = ae(Number.NEGATIVE_INFINITY, r);
735
- }
736
- return r;
737
- }
738
- function Nr(e, u) {
739
- return e ? { type: T, label: e, contents: u } : u;
740
- }
741
- function I(e) {
742
- var u;
743
- if (!e)
744
- return "";
745
- if (Array.isArray(e)) {
746
- let t = [];
747
- for (let r of e)
748
- if (Array.isArray(r))
749
- t.push(...I(r));
750
- else {
751
- let D = I(r);
752
- D !== "" && t.push(D);
753
- }
754
- return t;
755
- }
756
- return e.type === S ? { ...e, breakContents: I(e.breakContents), flatContents: I(e.flatContents) } : e.type === k ? { ...e, contents: I(e.contents), expandedStates: (u = e.expandedStates) == null ? void 0 : u.map(I) } : e.type === j ? { type: "fill", parts: e.parts.map(I) } : e.contents ? { ...e, contents: I(e.contents) } : e;
757
- }
758
- function Or(e) {
759
- let u = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ new Set();
760
- return r(I(e));
761
- function r(n, o, i) {
762
- var a, s;
763
- if (typeof n == "string")
764
- return JSON.stringify(n);
765
- if (Array.isArray(n)) {
766
- let l = n.map(r).filter(Boolean);
767
- return l.length === 1 ? l[0] : `[${l.join(", ")}]`;
768
- }
769
- if (n.type === b) {
770
- let l = ((a = i == null ? void 0 : i[o + 1]) == null ? void 0 : a.type) === x;
771
- return n.literal ? l ? "literalline" : "literallineWithoutBreakParent" : n.hard ? l ? "hardline" : "hardlineWithoutBreakParent" : n.soft ? "softline" : "line";
772
- }
773
- if (n.type === x)
774
- return ((s = i == null ? void 0 : i[o - 1]) == null ? void 0 : s.type) === b && i[o - 1].hard ? void 0 : "breakParent";
775
- if (n.type === M)
776
- return "trim";
777
- if (n.type === $)
778
- return "indent(" + r(n.contents) + ")";
779
- if (n.type === L)
780
- return n.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + r(n.contents) + ")" : n.n < 0 ? "dedent(" + r(n.contents) + ")" : n.n.type === "root" ? "markAsRoot(" + r(n.contents) + ")" : "align(" + JSON.stringify(n.n) + ", " + r(n.contents) + ")";
781
- if (n.type === S)
782
- return "ifBreak(" + r(n.breakContents) + (n.flatContents ? ", " + r(n.flatContents) : "") + (n.groupId ? (n.flatContents ? "" : ', ""') + `, { groupId: ${D(n.groupId)} }` : "") + ")";
783
- if (n.type === R) {
784
- let l = [];
785
- n.negate && l.push("negate: true"), n.groupId && l.push(`groupId: ${D(n.groupId)}`);
786
- let F = l.length > 0 ? `, { ${l.join(", ")} }` : "";
787
- return `indentIfBreak(${r(n.contents)}${F})`;
788
- }
789
- if (n.type === k) {
790
- let l = [];
791
- n.break && n.break !== "propagated" && l.push("shouldBreak: true"), n.id && l.push(`id: ${D(n.id)}`);
792
- let F = l.length > 0 ? `, { ${l.join(", ")} }` : "";
793
- return n.expandedStates ? `conditionalGroup([${n.expandedStates.map((c) => r(c)).join(",")}]${F})` : `group(${r(n.contents)}${F})`;
794
- }
795
- if (n.type === j)
796
- return `fill([${n.parts.map((l) => r(l)).join(", ")}])`;
797
- if (n.type === W)
798
- return "lineSuffix(" + r(n.contents) + ")";
799
- if (n.type === z)
800
- return "lineSuffixBoundary";
801
- if (n.type === T)
802
- return `label(${JSON.stringify(n.label)}, ${r(n.contents)})`;
803
- throw new Error("Unknown doc type " + n.type);
804
- }
805
- function D(n) {
806
- if (typeof n != "symbol")
807
- return JSON.stringify(String(n));
808
- if (n in u)
809
- return u[n];
810
- let o = n.description || "symbol";
811
- for (let i = 0; ; i++) {
812
- let a = o + (i > 0 ? ` #${i}` : "");
813
- if (!t.has(a))
814
- return t.add(a), u[n] = `Symbol.for(${JSON.stringify(a)})`;
815
- }
816
- }
817
- }
818
- var _r = () => /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\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-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
819
- function jr(e) {
820
- return e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
821
- }
822
- function Tr(e) {
823
- return e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9776 && e <= 9783 || e >= 9800 && e <= 9811 || e === 9855 || e >= 9866 && e <= 9871 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12773 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101631 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e >= 119552 && e <= 119638 || e >= 119648 && e <= 119670 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129673 || e >= 129679 && e <= 129734 || e >= 129742 && e <= 129756 || e >= 129759 && e <= 129769 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
824
- }
825
- var Ir = (e) => !(jr(e) || Tr(e)), Pr = /[^\x20-\x7F]/u;
826
- function $r(e) {
827
- if (!e)
828
- return 0;
829
- if (!Pr.test(e))
830
- return e.length;
831
- e = e.replace(_r(), " ");
832
- let u = 0;
833
- for (let t of e) {
834
- let r = t.codePointAt(0);
835
- r <= 31 || r >= 127 && r <= 159 || r >= 768 && r <= 879 || (u += Ir(r) ? 1 : 2);
836
- }
837
- return u;
838
- }
839
- var au = $r, w = Symbol("MODE_BREAK"), O = Symbol("MODE_FLAT"), te = Symbol("cursor"), Ue = Symbol("DOC_FILL_PRINTED_LENGTH");
840
- function Dt() {
841
- return { value: "", length: 0, queue: [] };
842
- }
843
- function Lr(e, u) {
844
- return He(e, { type: "indent" }, u);
845
- }
846
- function Mr(e, u, t) {
847
- return u === Number.NEGATIVE_INFINITY ? e.root || Dt() : u < 0 ? He(e, { type: "dedent" }, t) : u ? u.type === "root" ? { ...e, root: e } : He(e, { type: typeof u == "string" ? "stringAlign" : "numberAlign", n: u }, t) : e;
848
- }
849
- function He(e, u, t) {
850
- let r = u.type === "dedent" ? e.queue.slice(0, -1) : [...e.queue, u], D = "", n = 0, o = 0, i = 0;
851
- for (let f of r)
852
- switch (f.type) {
853
- case "indent":
854
- l(), t.useTabs ? a(1) : s(t.tabWidth);
855
- break;
856
- case "stringAlign":
857
- l(), D += f.n, n += f.n.length;
858
- break;
859
- case "numberAlign":
860
- o += 1, i += f.n;
861
- break;
862
- default:
863
- throw new Error(`Unexpected type '${f.type}'`);
864
- }
865
- return c(), { ...e, value: D, length: n, queue: r };
866
- function a(f) {
867
- D += " ".repeat(f), n += t.tabWidth * f;
868
- }
869
- function s(f) {
870
- D += " ".repeat(f), n += f;
871
- }
872
- function l() {
873
- t.useTabs ? F() : c();
874
- }
875
- function F() {
876
- o > 0 && a(o), d();
877
- }
878
- function c() {
879
- i > 0 && s(i), d();
880
- }
881
- function d() {
882
- o = 0, i = 0;
883
- }
884
- }
885
- function Ge(e) {
886
- let u = 0, t = 0, r = e.length;
887
- e:
888
- for (; r--; ) {
889
- let D = e[r];
890
- if (D === te) {
891
- t++;
892
- continue;
893
- }
894
- for (let n = D.length - 1; n >= 0; n--) {
895
- let o = D[n];
896
- if (o === " " || o === " ")
897
- u++;
898
- else {
899
- e[r] = D.slice(0, n + 1);
900
- break e;
901
- }
902
- }
903
- }
904
- if (u > 0 || t > 0)
905
- for (e.length = r + 1; t-- > 0; )
906
- e.push(te);
907
- return u;
908
- }
909
- function me(e, u, t, r, D, n) {
910
- if (t === Number.POSITIVE_INFINITY)
911
- return !0;
912
- let o = u.length, i = [e], a = [];
913
- for (; t >= 0; ) {
914
- if (i.length === 0) {
915
- if (o === 0)
916
- return !0;
917
- i.push(u[--o]);
918
- continue;
919
- }
920
- let { mode: s, doc: l } = i.pop(), F = ee(l);
921
- switch (F) {
922
- case Q:
923
- a.push(l), t -= au(l);
924
- break;
925
- case P:
926
- case j: {
927
- let c = F === P ? l : l.parts, d = l[Ue] ?? 0;
928
- for (let f = c.length - 1; f >= d; f--)
929
- i.push({ mode: s, doc: c[f] });
930
- break;
931
- }
932
- case $:
933
- case L:
934
- case R:
935
- case T:
936
- i.push({ mode: s, doc: l.contents });
937
- break;
938
- case M:
939
- t += Ge(a);
940
- break;
941
- case k: {
942
- if (n && l.break)
943
- return !1;
944
- let c = l.break ? w : s, d = l.expandedStates && c === w ? B(!1, l.expandedStates, -1) : l.contents;
945
- i.push({ mode: c, doc: d });
946
- break;
947
- }
948
- case S: {
949
- let c = (l.groupId ? D[l.groupId] || O : s) === w ? l.breakContents : l.flatContents;
950
- c && i.push({ mode: s, doc: c });
951
- break;
952
- }
953
- case b:
954
- if (s === w || l.hard)
955
- return !0;
956
- l.soft || (a.push(" "), t--);
957
- break;
958
- case W:
959
- r = !0;
960
- break;
961
- case z:
962
- if (r)
963
- return !1;
964
- break;
965
- }
966
- }
967
- return !1;
968
- }
969
- function Oe(e, u) {
970
- let t = {}, r = u.printWidth, D = nu(u.endOfLine), n = 0, o = [{ ind: Dt(), mode: w, doc: e }], i = [], a = !1, s = [], l = 0;
971
- for (lr(e); o.length > 0; ) {
972
- let { ind: c, mode: d, doc: f } = o.pop();
973
- switch (ee(f)) {
974
- case Q: {
975
- let p = D !== `
976
- ` ? ke(!1, f, `
977
- `, D) : f;
978
- i.push(p), o.length > 0 && (n += au(p));
979
- break;
980
- }
981
- case P:
982
- for (let p = f.length - 1; p >= 0; p--)
983
- o.push({ ind: c, mode: d, doc: f[p] });
984
- break;
985
- case X:
986
- if (l >= 2)
987
- throw new Error("There are too many 'cursor' in doc.");
988
- i.push(te), l++;
989
- break;
990
- case $:
991
- o.push({ ind: Lr(c, u), mode: d, doc: f.contents });
992
- break;
993
- case L:
994
- o.push({ ind: Mr(c, f.n, u), mode: d, doc: f.contents });
995
- break;
996
- case M:
997
- n -= Ge(i);
998
- break;
999
- case k:
1000
- switch (d) {
1001
- case O:
1002
- if (!a) {
1003
- o.push({ ind: c, mode: f.break ? w : O, doc: f.contents });
1004
- break;
1005
- }
1006
- case w: {
1007
- a = !1;
1008
- let p = { ind: c, mode: O, doc: f.contents }, h = r - n, g = s.length > 0;
1009
- if (!f.break && me(p, o, h, g, t))
1010
- o.push(p);
1011
- else if (f.expandedStates) {
1012
- let y = B(!1, f.expandedStates, -1);
1013
- if (f.break) {
1014
- o.push({ ind: c, mode: w, doc: y });
1015
- break;
1016
- } else
1017
- for (let C = 1; C < f.expandedStates.length + 1; C++)
1018
- if (C >= f.expandedStates.length) {
1019
- o.push({ ind: c, mode: w, doc: y });
1020
- break;
1021
- } else {
1022
- let m = f.expandedStates[C], E = { ind: c, mode: O, doc: m };
1023
- if (me(E, o, h, g, t)) {
1024
- o.push(E);
1025
- break;
1026
- }
1027
- }
1028
- } else
1029
- o.push({ ind: c, mode: w, doc: f.contents });
1030
- break;
1031
- }
1032
- }
1033
- f.id && (t[f.id] = B(!1, o, -1).mode);
1034
- break;
1035
- case j: {
1036
- let p = r - n, h = f[Ue] ?? 0, { parts: g } = f, y = g.length - h;
1037
- if (y === 0)
1038
- break;
1039
- let C = g[h + 0], m = g[h + 1], E = { ind: c, mode: O, doc: C }, v = { ind: c, mode: w, doc: C }, A = me(E, [], p, s.length > 0, t, !0);
1040
- if (y === 1) {
1041
- A ? o.push(E) : o.push(v);
1042
- break;
1043
- }
1044
- let N = { ind: c, mode: O, doc: m }, ue = { ind: c, mode: w, doc: m };
1045
- if (y === 2) {
1046
- A ? o.push(N, E) : o.push(ue, v);
1047
- break;
1048
- }
1049
- let Tt = g[h + 2], Ie = { ind: c, mode: d, doc: { ...f, [Ue]: h + 2 } };
1050
- me({ ind: c, mode: O, doc: [C, m, Tt] }, [], p, s.length > 0, t, !0) ? o.push(Ie, N, E) : A ? o.push(Ie, ue, E) : o.push(Ie, ue, v);
1051
- break;
1052
- }
1053
- case S:
1054
- case R: {
1055
- let p = f.groupId ? t[f.groupId] : d;
1056
- if (p === w) {
1057
- let h = f.type === S ? f.breakContents : f.negate ? f.contents : Ae(f.contents);
1058
- h && o.push({ ind: c, mode: d, doc: h });
1059
- }
1060
- if (p === O) {
1061
- let h = f.type === S ? f.flatContents : f.negate ? Ae(f.contents) : f.contents;
1062
- h && o.push({ ind: c, mode: d, doc: h });
1063
- }
1064
- break;
1065
- }
1066
- case W:
1067
- s.push({ ind: c, mode: d, doc: f.contents });
1068
- break;
1069
- case z:
1070
- s.length > 0 && o.push({ ind: c, mode: d, doc: iu });
1071
- break;
1072
- case b:
1073
- switch (d) {
1074
- case O:
1075
- if (f.hard)
1076
- a = !0;
1077
- else {
1078
- f.soft || (i.push(" "), n += 1);
1079
- break;
1080
- }
1081
- case w:
1082
- if (s.length > 0) {
1083
- o.push({ ind: c, mode: d, doc: f }, ...s.reverse()), s.length = 0;
1084
- break;
1085
- }
1086
- f.literal ? c.root ? (i.push(D, c.root.value), n = c.root.length) : (i.push(D), n = 0) : (n -= Ge(i), i.push(D + c.value), n = c.length);
1087
- break;
1088
- }
1089
- break;
1090
- case T:
1091
- o.push({ ind: c, mode: d, doc: f.contents });
1092
- break;
1093
- case x:
1094
- break;
1095
- default:
1096
- throw new ie(f);
1097
- }
1098
- o.length === 0 && s.length > 0 && (o.push(...s.reverse()), s.length = 0);
1099
- }
1100
- let F = i.indexOf(te);
1101
- if (F !== -1) {
1102
- let c = i.indexOf(te, F + 1);
1103
- if (c === -1)
1104
- return { formatted: i.filter((h) => h !== te).join("") };
1105
- let d = i.slice(0, F).join(""), f = i.slice(F + 1, c).join(""), p = i.slice(c + 1).join("");
1106
- return { formatted: d + f + p, cursorNodeStart: d.length, cursorNodeText: f };
1107
- }
1108
- return { formatted: i.join("") };
1109
- }
1110
- function Rr(e, u, t = 0) {
1111
- let r = 0;
1112
- for (let D = t; D < e.length; ++D)
1113
- e[D] === " " ? r = r + u - r % u : r++;
1114
- return r;
1115
- }
1116
- var su = Rr, K, Ye, ye, Wr = class {
1117
- constructor(e) {
1118
- qt(this, K), this.stack = [e];
1119
- }
1120
- get key() {
1121
- let { stack: e, siblings: u } = this;
1122
- return B(!1, e, u === null ? -2 : -4) ?? null;
1123
- }
1124
- get index() {
1125
- return this.siblings === null ? null : B(!1, this.stack, -2);
1126
- }
1127
- get node() {
1128
- return B(!1, this.stack, -1);
1129
- }
1130
- get parent() {
1131
- return this.getNode(1);
1132
- }
1133
- get grandparent() {
1134
- return this.getNode(2);
1135
- }
1136
- get isInArray() {
1137
- return this.siblings !== null;
1138
- }
1139
- get siblings() {
1140
- let { stack: e } = this, u = B(!1, e, -3);
1141
- return Array.isArray(u) ? u : null;
1142
- }
1143
- get next() {
1144
- let { siblings: e } = this;
1145
- return e === null ? null : e[this.index + 1];
1146
- }
1147
- get previous() {
1148
- let { siblings: e } = this;
1149
- return e === null ? null : e[this.index - 1];
1150
- }
1151
- get isFirst() {
1152
- return this.index === 0;
1153
- }
1154
- get isLast() {
1155
- let { siblings: e, index: u } = this;
1156
- return e !== null && u === e.length - 1;
1157
- }
1158
- get isRoot() {
1159
- return this.stack.length === 1;
1160
- }
1161
- get root() {
1162
- return this.stack[0];
1163
- }
1164
- get ancestors() {
1165
- return [...le(this, K, ye).call(this)];
1166
- }
1167
- getName() {
1168
- let { stack: e } = this, { length: u } = e;
1169
- return u > 1 ? B(!1, e, -2) : null;
1170
- }
1171
- getValue() {
1172
- return B(!1, this.stack, -1);
1173
- }
1174
- getNode(e = 0) {
1175
- let u = le(this, K, Ye).call(this, e);
1176
- return u === -1 ? null : this.stack[u];
1177
- }
1178
- getParentNode(e = 0) {
1179
- return this.getNode(e + 1);
1180
- }
1181
- call(e, ...u) {
1182
- let { stack: t } = this, { length: r } = t, D = B(!1, t, -1);
1183
- for (let n of u)
1184
- D = D[n], t.push(n, D);
1185
- try {
1186
- return e(this);
1187
- } finally {
1188
- t.length = r;
1189
- }
1190
- }
1191
- callParent(e, u = 0) {
1192
- let t = le(this, K, Ye).call(this, u + 1), r = this.stack.splice(t + 1);
1193
- try {
1194
- return e(this);
1195
- } finally {
1196
- this.stack.push(...r);
1197
- }
1198
- }
1199
- each(e, ...u) {
1200
- let { stack: t } = this, { length: r } = t, D = B(!1, t, -1);
1201
- for (let n of u)
1202
- D = D[n], t.push(n, D);
1203
- try {
1204
- for (let n = 0; n < D.length; ++n)
1205
- t.push(n, D[n]), e(this, n, D), t.length -= 2;
1206
- } finally {
1207
- t.length = r;
1208
- }
1209
- }
1210
- map(e, ...u) {
1211
- let t = [];
1212
- return this.each((r, D, n) => {
1213
- t[D] = e(r, D, n);
1214
- }, ...u), t;
1215
- }
1216
- match(...e) {
1217
- let u = this.stack.length - 1, t = null, r = this.stack[u--];
1218
- for (let D of e) {
1219
- if (r === void 0)
1220
- return !1;
1221
- let n = null;
1222
- if (typeof t == "number" && (n = t, t = this.stack[u--], r = this.stack[u--]), D && !D(r, t, n))
1223
- return !1;
1224
- t = this.stack[u--], r = this.stack[u--];
1225
- }
1226
- return !0;
1227
- }
1228
- findAncestor(e) {
1229
- for (let u of le(this, K, ye).call(this))
1230
- if (e(u))
1231
- return u;
1232
- }
1233
- hasAncestor(e) {
1234
- for (let u of le(this, K, ye).call(this))
1235
- if (e(u))
1236
- return !0;
1237
- return !1;
1238
- }
1239
- };
1240
- K = /* @__PURE__ */ new WeakSet(), Ye = function(e) {
1241
- let { stack: u } = this;
1242
- for (let t = u.length - 1; t >= 0; t -= 2)
1243
- if (!Array.isArray(u[t]) && --e < 0)
1244
- return t;
1245
- return -1;
1246
- }, ye = function* () {
1247
- let { stack: e } = this;
1248
- for (let u = e.length - 3; u >= 0; u -= 2) {
1249
- let t = e[u];
1250
- Array.isArray(t) || (yield t);
1251
- }
1252
- };
1253
- var zr = Wr, ot = new Proxy(() => {
1254
- }, { get: () => ot }), Ze = ot;
1255
- function Vr(e) {
1256
- return e !== null && typeof e == "object";
1257
- }
1258
- var qr = Vr;
1259
- function* _e(e, u) {
1260
- let { getVisitorKeys: t, filter: r = () => !0 } = u, D = (n) => qr(n) && r(n);
1261
- for (let n of t(e)) {
1262
- let o = e[n];
1263
- if (Array.isArray(o))
1264
- for (let i of o)
1265
- D(i) && (yield i);
1266
- else
1267
- D(o) && (yield o);
1268
- }
1269
- }
1270
- function* Jr(e, u) {
1271
- let t = [e];
1272
- for (let r = 0; r < t.length; r++) {
1273
- let D = t[r];
1274
- for (let n of _e(D, u))
1275
- yield n, t.push(n);
1276
- }
1277
- }
1278
- function Kr(e, u) {
1279
- return _e(e, u).next().done;
1280
- }
1281
- function Fe(e) {
1282
- return (u, t, r) => {
1283
- let D = !!(r != null && r.backwards);
1284
- if (t === !1)
1285
- return !1;
1286
- let { length: n } = u, o = t;
1287
- for (; o >= 0 && o < n; ) {
1288
- let i = u.charAt(o);
1289
- if (e instanceof RegExp) {
1290
- if (!e.test(i))
1291
- return o;
1292
- } else if (!e.includes(i))
1293
- return o;
1294
- D ? o-- : o++;
1295
- }
1296
- return o === -1 || o === n ? o : !1;
1297
- };
1298
- }
1299
- var Ur = Fe(/\s/u), q = Fe(" "), it = Fe(",; "), at = Fe(/[^\n\r]/u);
1300
- function Hr(e, u, t) {
1301
- let r = !!(t != null && t.backwards);
1302
- if (u === !1)
1303
- return !1;
1304
- let D = e.charAt(u);
1305
- if (r) {
1306
- if (e.charAt(u - 1) === "\r" && D === `
1307
- `)
1308
- return u - 2;
1309
- if (D === `
1310
- ` || D === "\r" || D === "\u2028" || D === "\u2029")
1311
- return u - 1;
1312
- } else {
1313
- if (D === "\r" && e.charAt(u + 1) === `
1314
- `)
1315
- return u + 2;
1316
- if (D === `
1317
- ` || D === "\r" || D === "\u2028" || D === "\u2029")
1318
- return u + 1;
1319
- }
1320
- return u;
1321
- }
1322
- var Z = Hr;
1323
- function Gr(e, u, t = {}) {
1324
- let r = q(e, t.backwards ? u - 1 : u, t), D = Z(e, r, t);
1325
- return r !== D;
1326
- }
1327
- var V = Gr;
1328
- function Yr(e) {
1329
- return Array.isArray(e) && e.length > 0;
1330
- }
1331
- var Zr = Yr, st = /* @__PURE__ */ new Set(["tokens", "comments", "parent", "enclosingNode", "precedingNode", "followingNode"]), Qr = (e) => Object.keys(e).filter((u) => !st.has(u));
1332
- function Xr(e) {
1333
- return e ? (u) => e(u, st) : Qr;
1334
- }
1335
- var je = Xr;
1336
- function en(e) {
1337
- let u = e.type || e.kind || "(unknown type)", t = String(e.name || e.id && (typeof e.id == "object" ? e.id.name : e.id) || e.key && (typeof e.key == "object" ? e.key.name : e.key) || e.value && (typeof e.value == "object" ? "" : String(e.value)) || e.operator || "");
1338
- return t.length > 20 && (t = t.slice(0, 19) + "…"), u + (t ? " " + t : "");
1339
- }
1340
- function lu(e, u) {
1341
- (e.comments ?? (e.comments = [])).push(u), u.printed = !1, u.nodeDescription = en(e);
1342
- }
1343
- function re(e, u) {
1344
- u.leading = !0, u.trailing = !1, lu(e, u);
1345
- }
1346
- function U(e, u, t) {
1347
- u.leading = !1, u.trailing = !1, t && (u.marker = t), lu(e, u);
1348
- }
1349
- function ne(e, u) {
1350
- u.leading = !1, u.trailing = !0, lu(e, u);
1351
- }
1352
- var Pe = /* @__PURE__ */ new WeakMap();
1353
- function cu(e, u) {
1354
- if (Pe.has(e))
1355
- return Pe.get(e);
1356
- let { printer: { getCommentChildNodes: t, canAttachComment: r, getVisitorKeys: D }, locStart: n, locEnd: o } = u;
1357
- if (!r)
1358
- return [];
1359
- let i = ((t == null ? void 0 : t(e, u)) ?? [..._e(e, { getVisitorKeys: je(D) })]).flatMap((a) => r(a) ? [a] : cu(a, u));
1360
- return i.sort((a, s) => n(a) - n(s) || o(a) - o(s)), Pe.set(e, i), i;
1361
- }
1362
- function lt(e, u, t, r) {
1363
- let { locStart: D, locEnd: n } = t, o = D(u), i = n(u), a = cu(e, t), s, l, F = 0, c = a.length;
1364
- for (; F < c; ) {
1365
- let d = F + c >> 1, f = a[d], p = D(f), h = n(f);
1366
- if (p <= o && i <= h)
1367
- return lt(f, u, t, f);
1368
- if (h <= o) {
1369
- s = f, F = d + 1;
1370
- continue;
1371
- }
1372
- if (i <= p) {
1373
- l = f, c = d;
1374
- continue;
1375
- }
1376
- throw new Error("Comment location overlaps with node location");
1377
- }
1378
- if ((r == null ? void 0 : r.type) === "TemplateLiteral") {
1379
- let { quasis: d } = r, f = Le(d, u, t);
1380
- s && Le(d, s, t) !== f && (s = null), l && Le(d, l, t) !== f && (l = null);
1381
- }
1382
- return { enclosingNode: r, precedingNode: s, followingNode: l };
1383
- }
1384
- var $e = () => !1;
1385
- function un(e, u) {
1386
- let { comments: t } = e;
1387
- if (delete e.comments, !Zr(t) || !u.printer.canAttachComment)
1388
- return;
1389
- let r = [], { locStart: D, locEnd: n, printer: { experimentalFeatures: { avoidAstMutation: o = !1 } = {}, handleComments: i = {} }, originalText: a } = u, { ownLine: s = $e, endOfLine: l = $e, remaining: F = $e } = i, c = t.map((d, f) => ({ ...lt(e, d, u), comment: d, text: a, options: u, ast: e, isLastComment: t.length - 1 === f }));
1390
- for (let [d, f] of c.entries()) {
1391
- let { comment: p, precedingNode: h, enclosingNode: g, followingNode: y, text: C, options: m, ast: E, isLastComment: v } = f;
1392
- if (m.parser === "json" || m.parser === "json5" || m.parser === "jsonc" || m.parser === "__js_expression" || m.parser === "__ts_expression" || m.parser === "__vue_expression" || m.parser === "__vue_ts_expression") {
1393
- if (D(p) - D(E) <= 0) {
1394
- re(E, p);
1395
- continue;
1396
- }
1397
- if (n(p) - n(E) >= 0) {
1398
- ne(E, p);
1399
- continue;
1400
- }
1401
- }
1402
- let A;
1403
- if (o ? A = [f] : (p.enclosingNode = g, p.precedingNode = h, p.followingNode = y, A = [p, C, m, E, v]), tn(C, m, c, d))
1404
- p.placement = "ownLine", s(...A) || (y ? re(y, p) : h ? ne(h, p) : U(g || E, p));
1405
- else if (rn(C, m, c, d))
1406
- p.placement = "endOfLine", l(...A) || (h ? ne(h, p) : y ? re(y, p) : U(g || E, p));
1407
- else if (p.placement = "remaining", !F(...A))
1408
- if (h && y) {
1409
- let N = r.length;
1410
- N > 0 && r[N - 1].followingNode !== y && Au(r, m), r.push(f);
1411
- } else
1412
- h ? ne(h, p) : y ? re(y, p) : U(g || E, p);
1413
- }
1414
- if (Au(r, u), !o)
1415
- for (let d of t)
1416
- delete d.precedingNode, delete d.enclosingNode, delete d.followingNode;
1417
- }
1418
- var ct = (e) => !/[\S\n\u2028\u2029]/u.test(e);
1419
- function tn(e, u, t, r) {
1420
- let { comment: D, precedingNode: n } = t[r], { locStart: o, locEnd: i } = u, a = o(D);
1421
- if (n)
1422
- for (let s = r - 1; s >= 0; s--) {
1423
- let { comment: l, precedingNode: F } = t[s];
1424
- if (F !== n || !ct(e.slice(i(l), a)))
1425
- break;
1426
- a = o(l);
1427
- }
1428
- return V(e, a, { backwards: !0 });
1429
- }
1430
- function rn(e, u, t, r) {
1431
- let { comment: D, followingNode: n } = t[r], { locStart: o, locEnd: i } = u, a = i(D);
1432
- if (n)
1433
- for (let s = r + 1; s < t.length; s++) {
1434
- let { comment: l, followingNode: F } = t[s];
1435
- if (F !== n || !ct(e.slice(a, o(l))))
1436
- break;
1437
- a = i(l);
1438
- }
1439
- return V(e, a);
1440
- }
1441
- function Au(e, u) {
1442
- var t, r;
1443
- let D = e.length;
1444
- if (D === 0)
1445
- return;
1446
- let { precedingNode: n, followingNode: o } = e[0], i = u.locStart(o), a;
1447
- for (a = D; a > 0; --a) {
1448
- let { comment: s, precedingNode: l, followingNode: F } = e[a - 1];
1449
- Ze.strictEqual(l, n), Ze.strictEqual(F, o);
1450
- let c = u.originalText.slice(u.locEnd(s), i);
1451
- if (((r = (t = u.printer).isGap) == null ? void 0 : r.call(t, c, u)) ?? /^[\s(]*$/u.test(c))
1452
- i = u.locStart(s);
1453
- else
1454
- break;
1455
- }
1456
- for (let [s, { comment: l }] of e.entries())
1457
- s < a ? ne(n, l) : re(o, l);
1458
- for (let s of [n, o])
1459
- s.comments && s.comments.length > 1 && s.comments.sort((l, F) => u.locStart(l) - u.locStart(F));
1460
- e.length = 0;
1461
- }
1462
- function Le(e, u, t) {
1463
- let r = t.locStart(u) - 1;
1464
- for (let D = 1; D < e.length; ++D)
1465
- if (r < t.locStart(e[D]))
1466
- return D - 1;
1467
- return 0;
1468
- }
1469
- function nn(e, u) {
1470
- let t = u - 1;
1471
- t = q(e, t, { backwards: !0 }), t = Z(e, t, { backwards: !0 }), t = q(e, t, { backwards: !0 });
1472
- let r = Z(e, t, { backwards: !0 });
1473
- return t !== r;
1474
- }
1475
- var fu = nn;
1476
- function ft(e, u) {
1477
- let t = e.node;
1478
- return t.printed = !0, u.printer.printComment(e, u);
1479
- }
1480
- function Dn(e, u) {
1481
- var t;
1482
- let r = e.node, D = [ft(e, u)], { printer: n, originalText: o, locStart: i, locEnd: a } = u;
1483
- if ((t = n.isBlockComment) != null && t.call(n, r)) {
1484
- let l = V(o, a(r)) ? V(o, i(r), { backwards: !0 }) ? Y : ut : " ";
1485
- D.push(l);
1486
- } else
1487
- D.push(Y);
1488
- let s = Z(o, q(o, a(r)));
1489
- return s !== !1 && V(o, s) && D.push(Y), D;
1490
- }
1491
- function on(e, u, t) {
1492
- var r;
1493
- let D = e.node, n = ft(e, u), { printer: o, originalText: i, locStart: a } = u, s = (r = o.isBlockComment) == null ? void 0 : r.call(o, D);
1494
- if (t != null && t.hasLineSuffix && !(t != null && t.isBlock) || V(i, a(D), { backwards: !0 })) {
1495
- let l = fu(i, a(D));
1496
- return { doc: Ke([Y, l ? Y : "", n]), isBlock: s, hasLineSuffix: !0 };
1497
- }
1498
- return !s || t != null && t.hasLineSuffix ? { doc: [Ke([" ", n]), Ne], isBlock: s, hasLineSuffix: !0 } : { doc: [" ", n], isBlock: s, hasLineSuffix: !1 };
1499
- }
1500
- function an(e, u) {
1501
- let t = e.node;
1502
- if (!t)
1503
- return {};
1504
- let r = u[Symbol.for("printedComments")];
1505
- if ((t.comments || []).filter((i) => !r.has(i)).length === 0)
1506
- return { leading: "", trailing: "" };
1507
- let D = [], n = [], o;
1508
- return e.each(() => {
1509
- let i = e.node;
1510
- if (r != null && r.has(i))
1511
- return;
1512
- let { leading: a, trailing: s } = i;
1513
- a ? D.push(Dn(e, u)) : s && (o = on(e, u, o), n.push(o.doc));
1514
- }, "comments"), { leading: D, trailing: n };
1515
- }
1516
- function sn(e, u, t) {
1517
- let { leading: r, trailing: D } = an(e, t);
1518
- return !r && !D ? u : Ee(u, (n) => [r, n, D]);
1519
- }
1520
- function ln(e) {
1521
- let { [Symbol.for("comments")]: u, [Symbol.for("printedComments")]: t } = e;
1522
- for (let r of u) {
1523
- if (!r.printed && !t.has(r))
1524
- throw new Error('Comment "' + r.value.trim() + '" was not printed. Please report this error!');
1525
- delete r.printed;
1526
- }
1527
- }
1528
- var dt = class extends Error {
1529
- constructor() {
1530
- super(...arguments);
1531
- he(this, "name", "ConfigError");
1532
- }
1533
- }, wu = class extends Error {
1534
- constructor() {
1535
- super(...arguments);
1536
- he(this, "name", "UndefinedParserError");
1537
- }
1538
- }, cn = { 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.", 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
1539
- (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: (e) => typeof e == "string" || typeof e == "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: "jsonc", description: "JSON with Comments" }, { 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: (e) => typeof e == "string" || typeof e == "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).
1540
- The range will extend forwards to the end of the selected statement.`, 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.
1541
- The range will extend backwards to the start of the first line containing the selected statement.`, 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
1542
- 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." }] } };
1543
- function Ft({ plugins: e = [], showDeprecated: u = !1 } = {}) {
1544
- let t = e.flatMap((D) => D.languages ?? []), r = [];
1545
- for (let D of dn(Object.assign({}, ...e.map(({ options: n }) => n), cn)))
1546
- !u && D.deprecated || (Array.isArray(D.choices) && (u || (D.choices = D.choices.filter((n) => !n.deprecated)), D.name === "parser" && (D.choices = [...D.choices, ...fn(D.choices, t, e)])), D.pluginDefaults = Object.fromEntries(e.filter((n) => {
1547
- var o;
1548
- return ((o = n.defaultOptions) == null ? void 0 : o[D.name]) !== void 0;
1549
- }).map((n) => [n.name, n.defaultOptions[D.name]])), r.push(D));
1550
- return { languages: t, options: r };
1551
- }
1552
- function* fn(e, u, t) {
1553
- let r = new Set(e.map((D) => D.value));
1554
- for (let D of u)
1555
- if (D.parsers) {
1556
- for (let n of D.parsers)
1557
- if (!r.has(n)) {
1558
- r.add(n);
1559
- let o = t.find((a) => a.parsers && Object.prototype.hasOwnProperty.call(a.parsers, n)), i = D.name;
1560
- o != null && o.name && (i += ` (plugin: ${o.name})`), yield { value: n, description: i };
1561
- }
1562
- }
1563
- }
1564
- function dn(e) {
1565
- let u = [];
1566
- for (let [t, r] of Object.entries(e)) {
1567
- let D = { name: t, ...r };
1568
- Array.isArray(D.default) && (D.default = B(!1, D.default, -1).value), u.push(D);
1569
- }
1570
- return u;
1571
- }
1572
- var Fn = (e) => String(e).split(/[/\\]/u).pop();
1573
- function ku(e, u) {
1574
- if (!u)
1575
- return;
1576
- let t = Fn(u).toLowerCase();
1577
- return e.find(({ filenames: r }) => r == null ? void 0 : r.some((D) => D.toLowerCase() === t)) ?? e.find(({ extensions: r }) => r == null ? void 0 : r.some((D) => t.endsWith(D)));
1578
- }
1579
- function pn(e, u) {
1580
- if (u)
1581
- return e.find(({ name: t }) => t.toLowerCase() === u) ?? e.find(({ aliases: t }) => t == null ? void 0 : t.includes(u)) ?? e.find(({ extensions: t }) => t == null ? void 0 : t.includes(`.${u}`));
1582
- }
1583
- function hn(e, u) {
1584
- let t = e.plugins.flatMap((D) => D.languages ?? []), r = pn(t, u.language) ?? ku(t, u.physicalFile) ?? ku(t, u.file) ?? (u.physicalFile, void 0);
1585
- return r == null ? void 0 : r.parsers[0];
1586
- }
1587
- var Cn = hn, De = { key: (e) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e) ? e : JSON.stringify(e), value(e) {
1588
- if (e === null || typeof e != "object")
1589
- return JSON.stringify(e);
1590
- if (Array.isArray(e))
1591
- return `[${e.map((t) => De.value(t)).join(", ")}]`;
1592
- let u = Object.keys(e);
1593
- return u.length === 0 ? "{}" : `{ ${u.map((t) => `${De.key(t)}: ${De.value(e[t])}`).join(", ")} }`;
1594
- }, pair: ({ key: e, value: u }) => De.value({ [e]: u }) }, Su = we(tu(), 1), mn = (e, u, { descriptor: t }) => {
1595
- let r = [`${Su.default.yellow(typeof e == "string" ? t.key(e) : t.pair(e))} is deprecated`];
1596
- return u && r.push(`we now treat it as ${Su.default.blue(typeof u == "string" ? t.key(u) : t.pair(u))}`), r.join("; ") + ".";
1597
- }, oe = we(tu(), 1), pt = Symbol.for("vnopts.VALUE_NOT_EXIST"), ve = Symbol.for("vnopts.VALUE_UNCHANGED"), xu = " ".repeat(2), gn = (e, u, t) => {
1598
- let { text: r, list: D } = t.normalizeExpectedResult(t.schemas[e].expected(t)), n = [];
1599
- return r && n.push(Nu(e, u, r, t.descriptor)), D && n.push([Nu(e, u, D.title, t.descriptor)].concat(D.values.map((o) => ht(o, t.loggerPrintWidth))).join(`
1600
- `)), Ct(n, t.loggerPrintWidth);
1601
- };
1602
- function Nu(e, u, t, r) {
1603
- return [`Invalid ${oe.default.red(r.key(e))} value.`, `Expected ${oe.default.blue(t)},`, `but received ${u === pt ? oe.default.gray("nothing") : oe.default.red(r.value(u))}.`].join(" ");
1604
- }
1605
- function ht({ text: e, list: u }, t) {
1606
- let r = [];
1607
- return e && r.push(`- ${oe.default.blue(e)}`), u && r.push([`- ${oe.default.blue(u.title)}:`].concat(u.values.map((D) => ht(D, t - xu.length).replace(/^|\n/g, `$&${xu}`))).join(`
1608
- `)), Ct(r, t);
1609
- }
1610
- function Ct(e, u) {
1611
- if (e.length === 1)
1612
- return e[0];
1613
- let [t, r] = e, [D, n] = e.map((o) => o.split(`
1614
- `, 1)[0].length);
1615
- return D > u && D > n ? r : t;
1616
- }
1617
- var Ou = we(tu(), 1), Me = [], _u = [];
1618
- function En(e, u) {
1619
- if (e === u)
1620
- return 0;
1621
- let t = e;
1622
- e.length > u.length && (e = u, u = t);
1623
- let r = e.length, D = u.length;
1624
- for (; r > 0 && e.charCodeAt(~-r) === u.charCodeAt(~-D); )
1625
- r--, D--;
1626
- let n = 0;
1627
- for (; n < r && e.charCodeAt(n) === u.charCodeAt(n); )
1628
- n++;
1629
- if (r -= n, D -= n, r === 0)
1630
- return D;
1631
- let o, i, a, s, l = 0, F = 0;
1632
- for (; l < r; )
1633
- _u[l] = e.charCodeAt(n + l), Me[l] = ++l;
1634
- for (; F < D; )
1635
- for (o = u.charCodeAt(n + F), a = F++, i = F, l = 0; l < r; l++)
1636
- s = o === _u[l] ? a : a + 1, a = Me[l], i = Me[l] = a > i ? s > i ? i + 1 : s : s > a ? a + 1 : s;
1637
- return i;
1638
- }
1639
- var mt = (e, u, { descriptor: t, logger: r, schemas: D }) => {
1640
- let n = [`Ignored unknown option ${Ou.default.yellow(t.pair({ key: e, value: u }))}.`], o = Object.keys(D).sort().find((i) => En(e, i) < 3);
1641
- o && n.push(`Did you mean ${Ou.default.blue(t.key(o))}?`), r.warn(n.join(" "));
1642
- }, yn = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"];
1643
- function vn(e, u) {
1644
- let t = new e(u), r = Object.create(t);
1645
- for (let D of yn)
1646
- D in u && (r[D] = Bn(u[D], t, J.prototype[D].length));
1647
- return r;
1648
- }
1649
- var J = class {
1650
- static create(e) {
1651
- return vn(this, e);
1652
- }
1653
- constructor(e) {
1654
- this.name = e.name;
1655
- }
1656
- default(e) {
1657
- }
1658
- expected(e) {
1659
- return "nothing";
1660
- }
1661
- validate(e, u) {
1662
- return !1;
1663
- }
1664
- deprecated(e, u) {
1665
- return !1;
1666
- }
1667
- forward(e, u) {
1668
- }
1669
- redirect(e, u) {
1670
- }
1671
- overlap(e, u, t) {
1672
- return e;
1673
- }
1674
- preprocess(e, u) {
1675
- return e;
1676
- }
1677
- postprocess(e, u) {
1678
- return ve;
1679
- }
1680
- };
1681
- function Bn(e, u, t) {
1682
- return typeof e == "function" ? (...r) => e(...r.slice(0, t - 1), u, ...r.slice(t - 1)) : () => e;
1683
- }
1684
- var bn = class extends J {
1685
- constructor(e) {
1686
- super(e), this._sourceName = e.sourceName;
1687
- }
1688
- expected(e) {
1689
- return e.schemas[this._sourceName].expected(e);
1690
- }
1691
- validate(e, u) {
1692
- return u.schemas[this._sourceName].validate(e, u);
1693
- }
1694
- redirect(e, u) {
1695
- return this._sourceName;
1696
- }
1697
- }, An = class extends J {
1698
- expected() {
1699
- return "anything";
1700
- }
1701
- validate() {
1702
- return !0;
1703
- }
1704
- }, wn = class extends J {
1705
- constructor({ valueSchema: e, name: u = e.name, ...t }) {
1706
- super({ ...t, name: u }), this._valueSchema = e;
1707
- }
1708
- expected(e) {
1709
- let { text: u, list: t } = e.normalizeExpectedResult(this._valueSchema.expected(e));
1710
- return { text: u && `an array of ${u}`, list: t && { title: "an array of the following values", values: [{ list: t }] } };
1711
- }
1712
- validate(e, u) {
1713
- if (!Array.isArray(e))
1714
- return !1;
1715
- let t = [];
1716
- for (let r of e) {
1717
- let D = u.normalizeValidateResult(this._valueSchema.validate(r, u), r);
1718
- D !== !0 && t.push(D.value);
1719
- }
1720
- return t.length === 0 ? !0 : { value: t };
1721
- }
1722
- deprecated(e, u) {
1723
- let t = [];
1724
- for (let r of e) {
1725
- let D = u.normalizeDeprecatedResult(this._valueSchema.deprecated(r, u), r);
1726
- D !== !1 && t.push(...D.map(({ value: n }) => ({ value: [n] })));
1727
- }
1728
- return t;
1729
- }
1730
- forward(e, u) {
1731
- let t = [];
1732
- for (let r of e) {
1733
- let D = u.normalizeForwardResult(this._valueSchema.forward(r, u), r);
1734
- t.push(...D.map(ju));
1735
- }
1736
- return t;
1737
- }
1738
- redirect(e, u) {
1739
- let t = [], r = [];
1740
- for (let D of e) {
1741
- let n = u.normalizeRedirectResult(this._valueSchema.redirect(D, u), D);
1742
- "remain" in n && t.push(n.remain), r.push(...n.redirect.map(ju));
1743
- }
1744
- return t.length === 0 ? { redirect: r } : { redirect: r, remain: t };
1745
- }
1746
- overlap(e, u) {
1747
- return e.concat(u);
1748
- }
1749
- };
1750
- function ju({ from: e, to: u }) {
1751
- return { from: [e], to: u };
1752
- }
1753
- var kn = class extends J {
1754
- expected() {
1755
- return "true or false";
1756
- }
1757
- validate(e) {
1758
- return typeof e == "boolean";
1759
- }
1760
- };
1761
- function Sn(e, u) {
1762
- let t = /* @__PURE__ */ Object.create(null);
1763
- for (let r of e) {
1764
- let D = r[u];
1765
- if (t[D])
1766
- throw new Error(`Duplicate ${u} ${JSON.stringify(D)}`);
1767
- t[D] = r;
1768
- }
1769
- return t;
1770
- }
1771
- function xn(e, u) {
1772
- let t = /* @__PURE__ */ new Map();
1773
- for (let r of e) {
1774
- let D = r[u];
1775
- if (t.has(D))
1776
- throw new Error(`Duplicate ${u} ${JSON.stringify(D)}`);
1777
- t.set(D, r);
1778
- }
1779
- return t;
1780
- }
1781
- function Nn() {
1782
- let e = /* @__PURE__ */ Object.create(null);
1783
- return (u) => {
1784
- let t = JSON.stringify(u);
1785
- return e[t] ? !0 : (e[t] = !0, !1);
1786
- };
1787
- }
1788
- function On(e, u) {
1789
- let t = [], r = [];
1790
- for (let D of e)
1791
- u(D) ? t.push(D) : r.push(D);
1792
- return [t, r];
1793
- }
1794
- function _n(e) {
1795
- return e === Math.floor(e);
1796
- }
1797
- function jn(e, u) {
1798
- if (e === u)
1799
- return 0;
1800
- let t = typeof e, r = typeof u, D = ["undefined", "object", "boolean", "number", "string"];
1801
- return t !== r ? D.indexOf(t) - D.indexOf(r) : t !== "string" ? Number(e) - Number(u) : e.localeCompare(u);
1802
- }
1803
- function Tn(e) {
1804
- return (...u) => {
1805
- let t = e(...u);
1806
- return typeof t == "string" ? new Error(t) : t;
1807
- };
1808
- }
1809
- function Tu(e) {
1810
- return e === void 0 ? {} : e;
1811
- }
1812
- function gt(e) {
1813
- if (typeof e == "string")
1814
- return { text: e };
1815
- let { text: u, list: t } = e;
1816
- return In((u || t) !== void 0, "Unexpected `expected` result, there should be at least one field."), t ? { text: u, list: { title: t.title, values: t.values.map(gt) } } : { text: u };
1817
- }
1818
- function Iu(e, u) {
1819
- return e === !0 ? !0 : e === !1 ? { value: u } : e;
1820
- }
1821
- function Pu(e, u, t = !1) {
1822
- return e === !1 ? !1 : e === !0 ? t ? !0 : [{ value: u }] : "value" in e ? [e] : e.length === 0 ? !1 : e;
1823
- }
1824
- function $u(e, u) {
1825
- return typeof e == "string" || "key" in e ? { from: u, to: e } : "from" in e ? { from: e.from, to: e.to } : { from: u, to: e.to };
1826
- }
1827
- function Qe(e, u) {
1828
- return e === void 0 ? [] : Array.isArray(e) ? e.map((t) => $u(t, u)) : [$u(e, u)];
1829
- }
1830
- function Lu(e, u) {
1831
- let t = Qe(typeof e == "object" && "redirect" in e ? e.redirect : e, u);
1832
- return t.length === 0 ? { remain: u, redirect: t } : typeof e == "object" && "remain" in e ? { remain: e.remain, redirect: t } : { redirect: t };
1833
- }
1834
- function In(e, u) {
1835
- if (!e)
1836
- throw new Error(u);
1837
- }
1838
- var Pn = class extends J {
1839
- constructor(e) {
1840
- super(e), this._choices = xn(e.choices.map((u) => u && typeof u == "object" ? u : { value: u }), "value");
1841
- }
1842
- expected({ descriptor: e }) {
1843
- let u = Array.from(this._choices.keys()).map((D) => this._choices.get(D)).filter(({ hidden: D }) => !D).map((D) => D.value).sort(jn).map(e.value), t = u.slice(0, -2), r = u.slice(-2);
1844
- return { text: t.concat(r.join(" or ")).join(", "), list: { title: "one of the following values", values: u } };
1845
- }
1846
- validate(e) {
1847
- return this._choices.has(e);
1848
- }
1849
- deprecated(e) {
1850
- let u = this._choices.get(e);
1851
- return u && u.deprecated ? { value: e } : !1;
1852
- }
1853
- forward(e) {
1854
- let u = this._choices.get(e);
1855
- return u ? u.forward : void 0;
1856
- }
1857
- redirect(e) {
1858
- let u = this._choices.get(e);
1859
- return u ? u.redirect : void 0;
1860
- }
1861
- }, $n = class extends J {
1862
- expected() {
1863
- return "a number";
1864
- }
1865
- validate(e, u) {
1866
- return typeof e == "number";
1867
- }
1868
- }, Ln = class extends $n {
1869
- expected() {
1870
- return "an integer";
1871
- }
1872
- validate(e, u) {
1873
- return u.normalizeValidateResult(super.validate(e, u), e) === !0 && _n(e);
1874
- }
1875
- }, Mu = class extends J {
1876
- expected() {
1877
- return "a string";
1878
- }
1879
- validate(e) {
1880
- return typeof e == "string";
1881
- }
1882
- }, Mn = De, Rn = mt, Wn = gn, zn = mn, Vn = class {
1883
- constructor(e, u) {
1884
- let { logger: t = console, loggerPrintWidth: r = 80, descriptor: D = Mn, unknown: n = Rn, invalid: o = Wn, deprecated: i = zn, missing: a = () => !1, required: s = () => !1, preprocess: l = (c) => c, postprocess: F = () => ve } = u || {};
1885
- this._utils = { descriptor: D, logger: t || { warn: () => {
1886
- } }, loggerPrintWidth: r, schemas: Sn(e, "name"), normalizeDefaultResult: Tu, normalizeExpectedResult: gt, normalizeDeprecatedResult: Pu, normalizeForwardResult: Qe, normalizeRedirectResult: Lu, normalizeValidateResult: Iu }, this._unknownHandler = n, this._invalidHandler = Tn(o), this._deprecatedHandler = i, this._identifyMissing = (c, d) => !(c in d) || a(c, d), this._identifyRequired = s, this._preprocess = l, this._postprocess = F, this.cleanHistory();
1887
- }
1888
- cleanHistory() {
1889
- this._hasDeprecationWarned = Nn();
1890
- }
1891
- normalize(e) {
1892
- let u = {}, t = [this._preprocess(e, this._utils)], r = () => {
1893
- for (; t.length !== 0; ) {
1894
- let D = t.shift(), n = this._applyNormalization(D, u);
1895
- t.push(...n);
1896
- }
1897
- };
1898
- r();
1899
- for (let D of Object.keys(this._utils.schemas)) {
1900
- let n = this._utils.schemas[D];
1901
- if (!(D in u)) {
1902
- let o = Tu(n.default(this._utils));
1903
- "value" in o && t.push({ [D]: o.value });
1904
- }
1905
- }
1906
- r();
1907
- for (let D of Object.keys(this._utils.schemas)) {
1908
- if (!(D in u))
1909
- continue;
1910
- let n = this._utils.schemas[D], o = u[D], i = n.postprocess(o, this._utils);
1911
- i !== ve && (this._applyValidation(i, D, n), u[D] = i);
1912
- }
1913
- return this._applyPostprocess(u), this._applyRequiredCheck(u), u;
1914
- }
1915
- _applyNormalization(e, u) {
1916
- let t = [], { knownKeys: r, unknownKeys: D } = this._partitionOptionKeys(e);
1917
- for (let n of r) {
1918
- let o = this._utils.schemas[n], i = o.preprocess(e[n], this._utils);
1919
- this._applyValidation(i, n, o);
1920
- let a = ({ from: F, to: c }) => {
1921
- t.push(typeof c == "string" ? { [c]: F } : { [c.key]: c.value });
1922
- }, s = ({ value: F, redirectTo: c }) => {
1923
- let d = Pu(o.deprecated(F, this._utils), i, !0);
1924
- if (d !== !1)
1925
- if (d === !0)
1926
- this._hasDeprecationWarned(n) || this._utils.logger.warn(this._deprecatedHandler(n, c, this._utils));
1927
- else
1928
- for (let { value: f } of d) {
1929
- let p = { key: n, value: f };
1930
- if (!this._hasDeprecationWarned(p)) {
1931
- let h = typeof c == "string" ? { key: c, value: f } : c;
1932
- this._utils.logger.warn(this._deprecatedHandler(p, h, this._utils));
1933
- }
1934
- }
1935
- };
1936
- Qe(o.forward(i, this._utils), i).forEach(a);
1937
- let l = Lu(o.redirect(i, this._utils), i);
1938
- if (l.redirect.forEach(a), "remain" in l) {
1939
- let F = l.remain;
1940
- u[n] = n in u ? o.overlap(u[n], F, this._utils) : F, s({ value: F });
1941
- }
1942
- for (let { from: F, to: c } of l.redirect)
1943
- s({ value: F, redirectTo: c });
1944
- }
1945
- for (let n of D) {
1946
- let o = e[n];
1947
- this._applyUnknownHandler(n, o, u, (i, a) => {
1948
- t.push({ [i]: a });
1949
- });
1950
- }
1951
- return t;
1952
- }
1953
- _applyRequiredCheck(e) {
1954
- for (let u of Object.keys(this._utils.schemas))
1955
- if (this._identifyMissing(u, e) && this._identifyRequired(u))
1956
- throw this._invalidHandler(u, pt, this._utils);
1957
- }
1958
- _partitionOptionKeys(e) {
1959
- let [u, t] = On(Object.keys(e).filter((r) => !this._identifyMissing(r, e)), (r) => r in this._utils.schemas);
1960
- return { knownKeys: u, unknownKeys: t };
1961
- }
1962
- _applyValidation(e, u, t) {
1963
- let r = Iu(t.validate(e, this._utils), e);
1964
- if (r !== !0)
1965
- throw this._invalidHandler(u, r.value, this._utils);
1966
- }
1967
- _applyUnknownHandler(e, u, t, r) {
1968
- let D = this._unknownHandler(e, u, this._utils);
1969
- if (D)
1970
- for (let n of Object.keys(D)) {
1971
- if (this._identifyMissing(n, D))
1972
- continue;
1973
- let o = D[n];
1974
- n in this._utils.schemas ? r(n, o) : t[n] = o;
1975
- }
1976
- }
1977
- _applyPostprocess(e) {
1978
- let u = this._postprocess(e, this._utils);
1979
- if (u !== ve) {
1980
- if (u.delete)
1981
- for (let t of u.delete)
1982
- delete e[t];
1983
- if (u.override) {
1984
- let { knownKeys: t, unknownKeys: r } = this._partitionOptionKeys(u.override);
1985
- for (let D of t) {
1986
- let n = u.override[D];
1987
- this._applyValidation(n, D, this._utils.schemas[D]), e[D] = n;
1988
- }
1989
- for (let D of r) {
1990
- let n = u.override[D];
1991
- this._applyUnknownHandler(D, n, e, (o, i) => {
1992
- let a = this._utils.schemas[o];
1993
- this._applyValidation(i, o, a), e[o] = i;
1994
- });
1995
- }
1996
- }
1997
- }
1998
- }
1999
- }, Re;
2000
- function qn(e, u, { logger: t = !1, isCLI: r = !1, passThrough: D = !1, FlagSchema: n, descriptor: o } = {}) {
2001
- if (r) {
2002
- if (!n)
2003
- throw new Error("'FlagSchema' option is required.");
2004
- if (!o)
2005
- throw new Error("'descriptor' option is required.");
2006
- } else
2007
- o = De;
2008
- let i = D ? Array.isArray(D) ? (c, d) => D.includes(c) ? { [c]: d } : void 0 : (c, d) => ({ [c]: d }) : (c, d, f) => {
2009
- let { _: p, ...h } = f.schemas;
2010
- return mt(c, d, { ...f, schemas: h });
2011
- }, a = Jn(u, { isCLI: r, FlagSchema: n }), s = new Vn(a, { logger: t, unknown: i, descriptor: o }), l = t !== !1;
2012
- l && Re && (s._hasDeprecationWarned = Re);
2013
- let F = s.normalize(e);
2014
- return l && (Re = s._hasDeprecationWarned), F;
2015
- }
2016
- function Jn(e, { isCLI: u, FlagSchema: t }) {
2017
- let r = [];
2018
- u && r.push(An.create({ name: "_" }));
2019
- for (let D of e)
2020
- r.push(Kn(D, { isCLI: u, optionInfos: e, FlagSchema: t })), D.alias && u && r.push(bn.create({ name: D.alias, sourceName: D.name }));
2021
- return r;
2022
- }
2023
- function Kn(e, { isCLI: u, optionInfos: t, FlagSchema: r }) {
2024
- let { name: D } = e, n = { name: D }, o, i = {};
2025
- switch (e.type) {
2026
- case "int":
2027
- o = Ln, u && (n.preprocess = Number);
2028
- break;
2029
- case "string":
2030
- o = Mu;
2031
- break;
2032
- case "choice":
2033
- o = Pn, n.choices = e.choices.map((a) => a != null && a.redirect ? { ...a, redirect: { to: { key: e.name, value: a.redirect } } } : a);
2034
- break;
2035
- case "boolean":
2036
- o = kn;
2037
- break;
2038
- case "flag":
2039
- o = r, n.flags = t.flatMap((a) => [a.alias, a.description && a.name, a.oppositeDescription && `no-${a.name}`].filter(Boolean));
2040
- break;
2041
- case "path":
2042
- o = Mu;
2043
- break;
2044
- default:
2045
- throw new Error(`Unexpected type ${e.type}`);
2046
- }
2047
- if (e.exception ? n.validate = (a, s, l) => e.exception(a) || s.validate(a, l) : n.validate = (a, s, l) => a === void 0 || s.validate(a, l), e.redirect && (i.redirect = (a) => a ? { to: typeof e.redirect == "string" ? e.redirect : { key: e.redirect.option, value: e.redirect.value } } : void 0), e.deprecated && (i.deprecated = !0), u && !e.array) {
2048
- let a = n.preprocess || ((s) => s);
2049
- n.preprocess = (s, l, F) => l.preprocess(a(Array.isArray(s) ? B(!1, s, -1) : s), F);
2050
- }
2051
- return e.array ? wn.create({ ...u ? { preprocess: (a) => Array.isArray(a) ? a : [a] } : {}, ...i, valueSchema: o.create(n) }) : o.create({ ...n, ...i });
2052
- }
2053
- var Un = qn, Hn = (e, u, t) => {
2054
- if (!(e && u == null)) {
2055
- if (u.findLast)
2056
- return u.findLast(t);
2057
- for (let r = u.length - 1; r >= 0; r--) {
2058
- let D = u[r];
2059
- if (t(D, r, u))
2060
- return D;
2061
- }
2062
- }
2063
- }, Et = Hn;
2064
- function yt(e, u) {
2065
- if (!u)
2066
- throw new Error("parserName is required.");
2067
- let t = Et(!1, e, (D) => D.parsers && Object.prototype.hasOwnProperty.call(D.parsers, u));
2068
- if (t)
2069
- return t;
2070
- let r = `Couldn't resolve parser "${u}".`;
2071
- throw r += " Plugins must be explicitly added to the standalone bundle.", new dt(r);
2072
- }
2073
- function Gn(e, u) {
2074
- if (!u)
2075
- throw new Error("astFormat is required.");
2076
- let t = Et(!1, e, (D) => D.printers && Object.prototype.hasOwnProperty.call(D.printers, u));
2077
- if (t)
2078
- return t;
2079
- let r = `Couldn't find plugin for AST format "${u}".`;
2080
- throw r += " Plugins must be explicitly added to the standalone bundle.", new dt(r);
2081
- }
2082
- function vt({ plugins: e, parser: u }) {
2083
- let t = yt(e, u);
2084
- return Bt(t, u);
2085
- }
2086
- function Bt(e, u) {
2087
- let t = e.parsers[u];
2088
- return typeof t == "function" ? t() : t;
2089
- }
2090
- function Yn(e, u) {
2091
- let t = e.printers[u];
2092
- return typeof t == "function" ? t() : t;
2093
- }
2094
- var Ru = { astFormat: "estree", printer: {}, originalText: void 0, locStart: null, locEnd: null };
2095
- async function Zn(e, u = {}) {
2096
- var t;
2097
- let r = { ...e };
2098
- if (!r.parser)
2099
- if (r.filepath) {
2100
- if (r.parser = Cn(r, { physicalFile: r.filepath }), !r.parser)
2101
- throw new wu(`No parser could be inferred for file "${r.filepath}".`);
2102
- } else
2103
- throw new wu("No parser and no file path given, couldn't infer a parser.");
2104
- let D = Ft({ plugins: e.plugins, showDeprecated: !0 }).options, n = { ...Ru, ...Object.fromEntries(D.filter((c) => c.default !== void 0).map((c) => [c.name, c.default])) }, o = yt(r.plugins, r.parser), i = await Bt(o, r.parser);
2105
- r.astFormat = i.astFormat, r.locEnd = i.locEnd, r.locStart = i.locStart;
2106
- let a = (t = o.printers) != null && t[i.astFormat] ? o : Gn(r.plugins, i.astFormat), s = await Yn(a, i.astFormat);
2107
- r.printer = s;
2108
- let l = a.defaultOptions ? Object.fromEntries(Object.entries(a.defaultOptions).filter(([, c]) => c !== void 0)) : {}, F = { ...n, ...l };
2109
- for (let [c, d] of Object.entries(F))
2110
- (r[c] === null || r[c] === void 0) && (r[c] = d);
2111
- return r.parser === "json" && (r.trailingComma = "none"), Un(r, D, { passThrough: Object.keys(Ru), ...u });
2112
- }
2113
- var se = Zn, Qn = we(Jt(), 1);
2114
- async function Xn(e, u) {
2115
- let t = await vt(u), r = t.preprocess ? t.preprocess(e, u) : e;
2116
- u.originalText = r;
2117
- let D;
2118
- try {
2119
- D = await t.parse(r, u, u);
2120
- } catch (n) {
2121
- eD(n, e);
2122
- }
2123
- return { text: r, ast: D };
2124
- }
2125
- function eD(e, u) {
2126
- let { loc: t } = e;
2127
- if (t) {
2128
- let r = (0, Qn.codeFrameColumns)(u, t, { highlightCode: !0 });
2129
- throw e.message += `
2130
- ` + r, e.codeFrame = r, e;
2131
- }
2132
- throw e;
2133
- }
2134
- var pe = Xn;
2135
- async function uD(e, u, t, r, D) {
2136
- let { embeddedLanguageFormatting: n, printer: { embed: o, hasPrettierIgnore: i = () => !1, getVisitorKeys: a } } = t;
2137
- if (!o || n !== "auto")
2138
- return;
2139
- if (o.length > 2)
2140
- throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");
2141
- let s = je(o.getVisitorKeys ?? a), l = [];
2142
- d();
2143
- let F = e.stack;
2144
- for (let { print: f, node: p, pathStack: h } of l)
2145
- try {
2146
- e.stack = h;
2147
- let g = await f(c, u, e, t);
2148
- g && D.set(p, g);
2149
- } catch (g) {
2150
- if (globalThis.PRETTIER_DEBUG)
2151
- throw g;
2152
- }
2153
- e.stack = F;
2154
- function c(f, p) {
2155
- return tD(f, p, t, r);
2156
- }
2157
- function d() {
2158
- let { node: f } = e;
2159
- if (f === null || typeof f != "object" || i(e))
2160
- return;
2161
- for (let h of s(f))
2162
- Array.isArray(f[h]) ? e.each(d, h) : e.call(d, h);
2163
- let p = o(e, t);
2164
- if (p) {
2165
- if (typeof p == "function") {
2166
- l.push({ print: p, node: f, pathStack: [...e.stack] });
2167
- return;
2168
- }
2169
- D.set(f, p);
2170
- }
2171
- }
2172
- }
2173
- async function tD(e, u, t, r) {
2174
- let D = await se({ ...t, ...u, parentParser: t.parser, originalText: e }, { passThrough: !0 }), { ast: n } = await pe(e, D), o = await r(n, D);
2175
- return Qu(o);
2176
- }
2177
- function rD(e, u) {
2178
- let { originalText: t, [Symbol.for("comments")]: r, locStart: D, locEnd: n, [Symbol.for("printedComments")]: o } = u, { node: i } = e, a = D(i), s = n(i);
2179
- for (let l of r)
2180
- D(l) >= a && n(l) <= s && o.add(l);
2181
- return t.slice(a, s);
2182
- }
2183
- var nD = rD;
2184
- async function Te(e, u) {
2185
- ({ ast: e } = await bt(e, u));
2186
- let t = /* @__PURE__ */ new Map(), r = new zr(e), D = /* @__PURE__ */ new Map();
2187
- await uD(r, o, u, Te, D);
2188
- let n = await Wu(r, u, o, void 0, D);
2189
- if (ln(u), u.nodeAfterCursor && !u.nodeBeforeCursor)
2190
- return [G, n];
2191
- if (u.nodeBeforeCursor && !u.nodeAfterCursor)
2192
- return [n, G];
2193
- return n;
2194
- function o(a, s) {
2195
- return a === void 0 || a === r ? i(s) : Array.isArray(a) ? r.call(() => i(s), ...a) : r.call(() => i(s), a);
2196
- }
2197
- function i(a) {
2198
- let s = r.node;
2199
- if (s == null)
2200
- return "";
2201
- let l = s && typeof s == "object" && a === void 0;
2202
- if (l && t.has(s))
2203
- return t.get(s);
2204
- let F = Wu(r, u, o, a, D);
2205
- return l && t.set(s, F), F;
2206
- }
2207
- }
2208
- function Wu(e, u, t, r, D) {
2209
- var n;
2210
- let { node: o } = e, { printer: i } = u, a;
2211
- switch ((n = i.hasPrettierIgnore) != null && n.call(i, e) ? a = nD(e, u) : D.has(o) ? a = D.get(o) : a = i.print(e, u, t, r), o) {
2212
- case u.cursorNode:
2213
- a = Ee(a, (s) => [G, s, G]);
2214
- break;
2215
- case u.nodeBeforeCursor:
2216
- a = Ee(a, (s) => [s, G]);
2217
- break;
2218
- case u.nodeAfterCursor:
2219
- a = Ee(a, (s) => [G, s]);
2220
- break;
2221
- }
2222
- return i.printComment && (!i.willPrintOwnComments || !i.willPrintOwnComments(e, u)) && (a = sn(e, a, u)), a;
2223
- }
2224
- async function bt(e, u) {
2225
- let t = e.comments ?? [];
2226
- u[Symbol.for("comments")] = t, u[Symbol.for("tokens")] = e.tokens ?? [], u[Symbol.for("printedComments")] = /* @__PURE__ */ new Set(), un(e, u);
2227
- let { printer: { preprocess: r } } = u;
2228
- return e = r ? await r(e, u) : e, { ast: e, comments: t };
2229
- }
2230
- function DD(e, u) {
2231
- let { cursorOffset: t, locStart: r, locEnd: D } = u, n = je(u.printer.getVisitorKeys), o = (d) => r(d) <= t && D(d) >= t, i = e, a = [e];
2232
- for (let d of Jr(e, { getVisitorKeys: n, filter: o }))
2233
- a.push(d), i = d;
2234
- if (Kr(i, { getVisitorKeys: n }))
2235
- return { cursorNode: i };
2236
- let s, l, F = -1, c = Number.POSITIVE_INFINITY;
2237
- for (; a.length > 0 && (s === void 0 || l === void 0); ) {
2238
- i = a.pop();
2239
- let d = s !== void 0, f = l !== void 0;
2240
- for (let p of _e(i, { getVisitorKeys: n })) {
2241
- if (!d) {
2242
- let h = D(p);
2243
- h <= t && h > F && (s = p, F = h);
2244
- }
2245
- if (!f) {
2246
- let h = r(p);
2247
- h >= t && h < c && (l = p, c = h);
2248
- }
2249
- }
2250
- }
2251
- return { nodeBeforeCursor: s, nodeAfterCursor: l };
2252
- }
2253
- var oD = DD;
2254
- function iD(e, u) {
2255
- let { printer: { massageAstNode: t, getVisitorKeys: r } } = u;
2256
- if (!t)
2257
- return e;
2258
- let D = je(r), n = t.ignoredProperties ?? /* @__PURE__ */ new Set();
2259
- return o(e);
2260
- function o(i, a) {
2261
- if (!(i !== null && typeof i == "object"))
2262
- return i;
2263
- if (Array.isArray(i))
2264
- return i.map((c) => o(c, a)).filter(Boolean);
2265
- let s = {}, l = new Set(D(i));
2266
- for (let c in i)
2267
- !Object.prototype.hasOwnProperty.call(i, c) || n.has(c) || (l.has(c) ? s[c] = o(i[c], i) : s[c] = i[c]);
2268
- let F = t(i, s, a);
2269
- if (F !== null)
2270
- return F ?? s;
2271
- }
2272
- }
2273
- var aD = iD, sD = (e, u, t) => {
2274
- if (!(e && u == null)) {
2275
- if (u.findLastIndex)
2276
- return u.findLastIndex(t);
2277
- for (let r = u.length - 1; r >= 0; r--) {
2278
- let D = u[r];
2279
- if (t(D, r, u))
2280
- return r;
2281
- }
2282
- return -1;
2283
- }
2284
- }, lD = sD, cD = ({ parser: e }) => e === "json" || e === "json5" || e === "jsonc" || e === "json-stringify";
2285
- function fD(e, u) {
2286
- let t = [e.node, ...e.parentNodes], r = /* @__PURE__ */ new Set([u.node, ...u.parentNodes]);
2287
- return t.find((D) => At.has(D.type) && r.has(D));
2288
- }
2289
- function zu(e) {
2290
- let u = lD(!1, e, (t) => t.type !== "Program" && t.type !== "File");
2291
- return u === -1 ? e : e.slice(0, u + 1);
2292
- }
2293
- function dD(e, u, { locStart: t, locEnd: r }) {
2294
- let D = e.node, n = u.node;
2295
- if (D === n)
2296
- return { startNode: D, endNode: n };
2297
- let o = t(e.node);
2298
- for (let a of zu(u.parentNodes))
2299
- if (t(a) >= o)
2300
- n = a;
2301
- else
2302
- break;
2303
- let i = r(u.node);
2304
- for (let a of zu(e.parentNodes)) {
2305
- if (r(a) <= i)
2306
- D = a;
2307
- else
2308
- break;
2309
- if (D === n)
2310
- break;
2311
- }
2312
- return { startNode: D, endNode: n };
2313
- }
2314
- function Xe(e, u, t, r, D = [], n) {
2315
- let { locStart: o, locEnd: i } = t, a = o(e), s = i(e);
2316
- if (!(u > s || u < a || n === "rangeEnd" && u === a || n === "rangeStart" && u === s)) {
2317
- for (let l of cu(e, t)) {
2318
- let F = Xe(l, u, t, r, [e, ...D], n);
2319
- if (F)
2320
- return F;
2321
- }
2322
- if (!r || r(e, D[0]))
2323
- return { node: e, parentNodes: D };
2324
- }
2325
- }
2326
- function FD(e, u) {
2327
- return u !== "DeclareExportDeclaration" && e !== "TypeParameterDeclaration" && (e === "Directive" || e === "TypeAlias" || e === "TSExportAssignment" || e.startsWith("Declare") || e.startsWith("TSDeclare") || e.endsWith("Statement") || e.endsWith("Declaration"));
2328
- }
2329
- var At = /* @__PURE__ */ new Set(["JsonRoot", "ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]), pD = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
2330
- function Vu(e, u, t) {
2331
- if (!u)
2332
- return !1;
2333
- switch (e.parser) {
2334
- case "flow":
2335
- case "babel":
2336
- case "babel-flow":
2337
- case "babel-ts":
2338
- case "typescript":
2339
- case "acorn":
2340
- case "espree":
2341
- case "meriyah":
2342
- case "__babel_estree":
2343
- return FD(u.type, t == null ? void 0 : t.type);
2344
- case "json":
2345
- case "json5":
2346
- case "jsonc":
2347
- case "json-stringify":
2348
- return At.has(u.type);
2349
- case "graphql":
2350
- return pD.has(u.kind);
2351
- case "vue":
2352
- return u.tag !== "root";
2353
- }
2354
- return !1;
2355
- }
2356
- function hD(e, u, t) {
2357
- let { rangeStart: r, rangeEnd: D, locStart: n, locEnd: o } = u;
2358
- Ze.ok(D > r);
2359
- let i = e.slice(r, D).search(/\S/u), a = i === -1;
2360
- if (!a)
2361
- for (r += i; D > r && !/\S/u.test(e[D - 1]); --D)
2362
- ;
2363
- let s = Xe(t, r, u, (d, f) => Vu(u, d, f), [], "rangeStart"), l = a ? s : Xe(t, D, u, (d) => Vu(u, d), [], "rangeEnd");
2364
- if (!s || !l)
2365
- return { rangeStart: 0, rangeEnd: 0 };
2366
- let F, c;
2367
- if (cD(u)) {
2368
- let d = fD(s, l);
2369
- F = d, c = d;
2370
- } else
2371
- ({ startNode: F, endNode: c } = dD(s, l, u));
2372
- return { rangeStart: Math.min(n(F), n(c)), rangeEnd: Math.max(o(F), o(c)) };
2373
- }
2374
- var wt = "\uFEFF", qu = Symbol("cursor");
2375
- async function kt(e, u, t = 0) {
2376
- if (!e || e.trim().length === 0)
2377
- return { formatted: "", cursorOffset: -1, comments: [] };
2378
- let { ast: r, text: D } = await pe(e, u);
2379
- u.cursorOffset >= 0 && (u = { ...u, ...oD(r, u) });
2380
- let n = await Te(r, u);
2381
- t > 0 && (n = nt([Y, n], t, u.tabWidth));
2382
- let o = Oe(n, u);
2383
- if (t > 0) {
2384
- let a = o.formatted.trim();
2385
- o.cursorNodeStart !== void 0 && (o.cursorNodeStart -= o.formatted.indexOf(a), o.cursorNodeStart < 0 && (o.cursorNodeStart = 0, o.cursorNodeText = o.cursorNodeText.trimStart()), o.cursorNodeStart + o.cursorNodeText.length > a.length && (o.cursorNodeText = o.cursorNodeText.trimEnd())), o.formatted = a + nu(u.endOfLine);
2386
- }
2387
- let i = u[Symbol.for("comments")];
2388
- if (u.cursorOffset >= 0) {
2389
- let a, s, l, F;
2390
- if ((u.cursorNode || u.nodeBeforeCursor || u.nodeAfterCursor) && o.cursorNodeText)
2391
- if (l = o.cursorNodeStart, F = o.cursorNodeText, u.cursorNode)
2392
- a = u.locStart(u.cursorNode), s = D.slice(a, u.locEnd(u.cursorNode));
2393
- else {
2394
- if (!u.nodeBeforeCursor && !u.nodeAfterCursor)
2395
- throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");
2396
- a = u.nodeBeforeCursor ? u.locEnd(u.nodeBeforeCursor) : 0;
2397
- let g = u.nodeAfterCursor ? u.locStart(u.nodeAfterCursor) : D.length;
2398
- s = D.slice(a, g);
2399
- }
2400
- else
2401
- a = 0, s = D, l = 0, F = o.formatted;
2402
- let c = u.cursorOffset - a;
2403
- if (s === F)
2404
- return { formatted: o.formatted, cursorOffset: l + c, comments: i };
2405
- let d = s.split("");
2406
- d.splice(c, 0, qu);
2407
- let f = F.split(""), p = Xt(d, f), h = l;
2408
- for (let g of p)
2409
- if (g.removed) {
2410
- if (g.value.includes(qu))
2411
- break;
2412
- } else
2413
- h += g.count;
2414
- return { formatted: o.formatted, cursorOffset: h, comments: i };
2415
- }
2416
- return { formatted: o.formatted, cursorOffset: -1, comments: i };
2417
- }
2418
- async function CD(e, u) {
2419
- let { ast: t, text: r } = await pe(e, u), { rangeStart: D, rangeEnd: n } = hD(r, u, t), o = r.slice(D, n), i = Math.min(D, r.lastIndexOf(`
2420
- `, D) + 1), a = r.slice(i, D).match(/^\s*/u)[0], s = su(a, u.tabWidth), l = await kt(o, { ...u, rangeStart: 0, rangeEnd: Number.POSITIVE_INFINITY, cursorOffset: u.cursorOffset > D && u.cursorOffset <= n ? u.cursorOffset - D : -1, endOfLine: "lf" }, s), F = l.formatted.trimEnd(), { cursorOffset: c } = u;
2421
- c > n ? c += F.length - o.length : l.cursorOffset >= 0 && (c = l.cursorOffset + D);
2422
- let d = r.slice(0, D) + F + r.slice(n);
2423
- if (u.endOfLine !== "lf") {
2424
- let f = nu(u.endOfLine);
2425
- c >= 0 && f === `\r
2426
- ` && (c += Yu(d.slice(0, c), `
2427
- `)), d = ke(!1, d, `
2428
- `, f);
2429
- }
2430
- return { formatted: d, cursorOffset: c, comments: l.comments };
2431
- }
2432
- function We(e, u, t) {
2433
- return typeof u != "number" || Number.isNaN(u) || u < 0 || u > e.length ? t : u;
2434
- }
2435
- function Ju(e, u) {
2436
- let { cursorOffset: t, rangeStart: r, rangeEnd: D } = u;
2437
- return t = We(e, t, -1), r = We(e, r, 0), D = We(e, D, e.length), { ...u, cursorOffset: t, rangeStart: r, rangeEnd: D };
2438
- }
2439
- function St(e, u) {
2440
- let { cursorOffset: t, rangeStart: r, rangeEnd: D, endOfLine: n } = Ju(e, u), o = e.charAt(0) === wt;
2441
- if (o && (e = e.slice(1), t--, r--, D--), n === "auto" && (n = er(e)), e.includes("\r")) {
2442
- let i = (a) => Yu(e.slice(0, Math.max(a, 0)), `\r
2443
- `);
2444
- t -= i(t), r -= i(r), D -= i(D), e = ur(e);
2445
- }
2446
- return { hasBOM: o, text: e, options: Ju(e, { ...u, cursorOffset: t, rangeStart: r, rangeEnd: D, endOfLine: n }) };
2447
- }
2448
- async function Ku(e, u) {
2449
- let t = await vt(u);
2450
- return !t.hasPragma || t.hasPragma(e);
2451
- }
2452
- async function xt(e, u) {
2453
- let { hasBOM: t, text: r, options: D } = St(e, await se(u));
2454
- if (D.rangeStart >= D.rangeEnd && r !== "" || D.requirePragma && !await Ku(r, D))
2455
- return { formatted: e, cursorOffset: u.cursorOffset, comments: [] };
2456
- let n;
2457
- return D.rangeStart > 0 || D.rangeEnd < r.length ? n = await CD(r, D) : (!D.requirePragma && D.insertPragma && D.printer.insertPragma && !await Ku(r, D) && (r = D.printer.insertPragma(r)), n = await kt(r, D)), t && (n.formatted = wt + n.formatted, n.cursorOffset >= 0 && n.cursorOffset++), n;
2458
- }
2459
- async function mD(e, u, t) {
2460
- let { text: r, options: D } = St(e, await se(u)), n = await pe(r, D);
2461
- return t && (t.preprocessForPrint && (n.ast = await bt(n.ast, D)), t.massage && (n.ast = aD(n.ast, D))), n;
2462
- }
2463
- async function gD(e, u) {
2464
- u = await se(u);
2465
- let t = await Te(e, u);
2466
- return Oe(t, u);
2467
- }
2468
- async function ED(e, u) {
2469
- let t = Or(e), { formatted: r } = await xt(t, { ...u, parser: "__js_expression" });
2470
- return r;
2471
- }
2472
- async function yD(e, u) {
2473
- u = await se(u);
2474
- let { ast: t } = await pe(e, u);
2475
- return Te(t, u);
2476
- }
2477
- async function vD(e, u) {
2478
- return Oe(e, await se(u));
2479
- }
2480
- var Nt = {};
2481
- uu(Nt, { builders: () => BD, printer: () => bD, utils: () => AD });
2482
- var BD = { join: rt, line: ut, softline: xr, hardline: Y, literalline: tt, group: Xu, conditionalGroup: Br, fill: br, lineSuffix: Ke, lineSuffixBoundary: kr, cursor: G, breakParent: Ne, ifBreak: Ar, trim: Sr, indent: Ae, indentIfBreak: wr, align: ae, addAlignmentToDoc: nt, markAsRoot: yr, dedentToRoot: Er, dedent: vr, hardlineWithoutBreakParent: iu, literallineWithoutBreakParent: et, label: Nr, concat: (e) => e }, bD = { printDocToString: Oe }, AD = { willBreak: sr, traverseDoc: Du, findInDoc: ou, mapDoc: xe, removeLines: fr, stripTrailingHardline: Qu, replaceEndOfLine: pr, canBreak: Cr }, wD = "3.5.3", Ot = {};
2483
- uu(Ot, { addDanglingComment: () => U, addLeadingComment: () => re, addTrailingComment: () => ne, getAlignmentSize: () => su, getIndentSize: () => _D, getMaxContinuousCount: () => ID, getNextNonSpaceNonCommentCharacter: () => $D, getNextNonSpaceNonCommentCharacterIndex: () => UD, getPreferredQuote: () => MD, getStringWidth: () => au, hasNewline: () => V, hasNewlineInRange: () => WD, hasSpaces: () => VD, isNextLineEmpty: () => ZD, isNextLineEmptyAfterIndex: () => hu, isPreviousLineEmpty: () => GD, makeString: () => JD, skip: () => Fe, skipEverythingButNewLine: () => at, skipInlineComment: () => du, skipNewline: () => Z, skipSpaces: () => q, skipToLineEnd: () => it, skipTrailingComment: () => Fu, skipWhitespace: () => Ur });
2484
- function kD(e, u) {
2485
- if (u === !1)
2486
- return !1;
2487
- if (e.charAt(u) === "/" && e.charAt(u + 1) === "*") {
2488
- for (let t = u + 2; t < e.length; ++t)
2489
- if (e.charAt(t) === "*" && e.charAt(t + 1) === "/")
2490
- return t + 2;
2491
- }
2492
- return u;
2493
- }
2494
- var du = kD;
2495
- function SD(e, u) {
2496
- return u === !1 ? !1 : e.charAt(u) === "/" && e.charAt(u + 1) === "/" ? at(e, u) : u;
2497
- }
2498
- var Fu = SD;
2499
- function xD(e, u) {
2500
- let t = null, r = u;
2501
- for (; r !== t; )
2502
- t = r, r = q(e, r), r = du(e, r), r = Fu(e, r), r = Z(e, r);
2503
- return r;
2504
- }
2505
- var pu = xD;
2506
- function ND(e, u) {
2507
- let t = null, r = u;
2508
- for (; r !== t; )
2509
- t = r, r = it(e, r), r = du(e, r), r = q(e, r);
2510
- return r = Fu(e, r), r = Z(e, r), r !== !1 && V(e, r);
2511
- }
2512
- var hu = ND;
2513
- function OD(e, u) {
2514
- let t = e.lastIndexOf(`
2515
- `);
2516
- return t === -1 ? 0 : su(e.slice(t + 1).match(/^[\t ]*/u)[0], u);
2517
- }
2518
- var _D = OD;
2519
- function jD(e) {
2520
- if (typeof e != "string")
2521
- throw new TypeError("Expected a string");
2522
- return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
2523
- }
2524
- function TD(e, u) {
2525
- let t = e.match(new RegExp(`(${jD(u)})+`, "gu"));
2526
- return t === null ? 0 : t.reduce((r, D) => Math.max(r, D.length / u.length), 0);
2527
- }
2528
- var ID = TD;
2529
- function PD(e, u) {
2530
- let t = pu(e, u);
2531
- return t === !1 ? "" : e.charAt(t);
2532
- }
2533
- var $D = PD, ge = "'", Uu = '"';
2534
- function LD(e, u) {
2535
- let t = u === !0 || u === ge ? ge : Uu, r = t === ge ? Uu : ge, D = 0, n = 0;
2536
- for (let o of e)
2537
- o === t ? D++ : o === r && n++;
2538
- return D > n ? r : t;
2539
- }
2540
- var MD = LD;
2541
- function RD(e, u, t) {
2542
- for (let r = u; r < t; ++r)
2543
- if (e.charAt(r) === `
2544
- `)
2545
- return !0;
2546
- return !1;
2547
- }
2548
- var WD = RD;
2549
- function zD(e, u, t = {}) {
2550
- return q(e, t.backwards ? u - 1 : u, t) !== u;
2551
- }
2552
- var VD = zD;
2553
- function qD(e, u, t) {
2554
- let r = u === '"' ? "'" : '"', D = ke(!1, e, /\\(.)|(["'])/gsu, (n, o, i) => o === r ? o : i === u ? "\\" + i : i || (t && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(o) ? o : "\\" + o));
2555
- return u + D + u;
2556
- }
2557
- var JD = qD;
2558
- function KD(e, u, t) {
2559
- return pu(e, t(u));
2560
- }
2561
- function UD(e, u) {
2562
- return arguments.length === 2 || typeof u == "number" ? pu(e, u) : KD(...arguments);
2563
- }
2564
- function HD(e, u, t) {
2565
- return fu(e, t(u));
2566
- }
2567
- function GD(e, u) {
2568
- return arguments.length === 2 || typeof u == "number" ? fu(e, u) : HD(...arguments);
2569
- }
2570
- function YD(e, u, t) {
2571
- return hu(e, t(u));
2572
- }
2573
- function ZD(e, u) {
2574
- return arguments.length === 2 || typeof u == "number" ? hu(e, u) : YD(...arguments);
2575
- }
2576
- function H(e, u = 1) {
2577
- return async (...t) => {
2578
- let r = t[u] ?? {}, D = r.plugins ?? [];
2579
- return t[u] = { ...r, plugins: Array.isArray(D) ? D : Object.values(D) }, e(...t);
2580
- };
2581
- }
2582
- var _t = H(xt);
2583
- async function jt(e, u) {
2584
- let { formatted: t } = await _t(e, { ...u, cursorOffset: -1 });
2585
- return t;
2586
- }
2587
- async function QD(e, u) {
2588
- return await jt(e, u) === e;
2589
- }
2590
- var XD = H(Ft, 0), eo = { parse: H(mD), formatAST: H(gD), formatDoc: H(ED), printToDoc: H(yD), printDocToString: H(vD) };
2591
- export {
2592
- eo as __debug,
2593
- QD as check,
2594
- Nt as doc,
2595
- jt as format,
2596
- _t as formatWithCursor,
2597
- XD as getSupportInfo,
2598
- Ot as util,
2599
- wD as version
2600
- };
2601
- //# sourceMappingURL=standalone-36ad3877.js.map