@maildeno/editor 0.4.6 → 0.4.7

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