@maildeno/editor 0.4.2 → 0.4.4

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.
@@ -1,2391 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __typeError = (msg) => {
3
- throw TypeError(msg);
4
- };
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _t, _e2, _n2, _u2, _r2, _Rt_instances, o_fn, _a, _Lt_instances, t_fn, e_fn, _b;
13
- var Ru = Object.defineProperty;
14
- var yt = (t, e) => {
15
- for (var r in e) Ru(t, r, { get: e[r], enumerable: true });
16
- };
17
- var Su = {};
18
- yt(Su, { __debug: () => $i, check: () => Vi, doc: () => ar, format: () => Pu, formatWithCursor: () => Ou, getSupportInfo: () => Wi, util: () => fr, version: () => gu });
19
- var X = (t, e) => (r, n, ...u) => r | 1 && n == null ? void 0 : (e.call(n) ?? n[t]).apply(n, u);
20
- var vu = String.prototype.replaceAll ?? function(t, e) {
21
- return t.global ? this.replace(t, e) : this.split(t).join(e);
22
- }, Lu = X("replaceAll", function() {
23
- if (typeof this == "string") return vu;
24
- }), ne = Lu;
25
- var Ne = class {
26
- diff(e, r, n = {}) {
27
- let u;
28
- typeof n == "function" ? (u = n, n = {}) : "callback" in n && (u = n.callback);
29
- let o = this.castInput(e, n), i = this.castInput(r, n), D = this.removeEmpty(this.tokenize(o, n)), s = this.removeEmpty(this.tokenize(i, n));
30
- return this.diffWithOptionsObj(D, s, n, u);
31
- }
32
- diffWithOptionsObj(e, r, n, u) {
33
- var o;
34
- let i = (C) => {
35
- if (C = this.postProcess(C, n), u) {
36
- setTimeout(function() {
37
- u(C);
38
- }, 0);
39
- return;
40
- } else return C;
41
- }, D = r.length, s = e.length, a = 1, c = D + s;
42
- n.maxEditLength != null && (c = Math.min(c, n.maxEditLength));
43
- let p = (o = n.timeout) !== null && o !== void 0 ? o : 1 / 0, l = Date.now() + p, m = [{ oldPos: -1, lastComponent: void 0 }], f = this.extractCommon(m[0], r, e, 0, n);
44
- if (m[0].oldPos + 1 >= s && f + 1 >= D) return i(this.buildValues(m[0].lastComponent, r, e));
45
- let F = -1 / 0, d = 1 / 0, E = () => {
46
- for (let C = Math.max(F, -a); C <= Math.min(d, a); C += 2) {
47
- let h, _ = m[C - 1], P = m[C + 1];
48
- _ && (m[C - 1] = void 0);
49
- let A = false;
50
- if (P) {
51
- let J = P.oldPos - C;
52
- A = P && 0 <= J && J < D;
53
- }
54
- let B = _ && _.oldPos + 1 < s;
55
- if (!A && !B) {
56
- m[C] = void 0;
57
- continue;
58
- }
59
- if (!B || A && _.oldPos < P.oldPos ? h = this.addToPath(P, true, false, 0, n) : h = this.addToPath(_, false, true, 1, n), f = this.extractCommon(h, r, e, C, n), h.oldPos + 1 >= s && f + 1 >= D) return i(this.buildValues(h.lastComponent, r, e)) || true;
60
- m[C] = h, h.oldPos + 1 >= s && (d = Math.min(d, C - 1)), f + 1 >= D && (F = Math.max(F, C + 1));
61
- }
62
- a++;
63
- };
64
- if (u) (function C() {
65
- setTimeout(function() {
66
- if (a > c || Date.now() > l) return u(void 0);
67
- E() || C();
68
- }, 0);
69
- })();
70
- else for (; a <= c && Date.now() <= l; ) {
71
- let C = E();
72
- if (C) return C;
73
- }
74
- }
75
- addToPath(e, r, n, u, o) {
76
- let i = e.lastComponent;
77
- return i && !o.oneChangePerToken && i.added === r && i.removed === n ? { oldPos: e.oldPos + u, lastComponent: { count: i.count + 1, added: r, removed: n, previousComponent: i.previousComponent } } : { oldPos: e.oldPos + u, lastComponent: { count: 1, added: r, removed: n, previousComponent: i } };
78
- }
79
- extractCommon(e, r, n, u, o) {
80
- let i = r.length, D = n.length, s = e.oldPos, a = s - u, c = 0;
81
- for (; a + 1 < i && s + 1 < D && this.equals(n[s + 1], r[a + 1], o); ) a++, s++, c++, o.oneChangePerToken && (e.lastComponent = { count: 1, previousComponent: e.lastComponent, added: false, removed: false });
82
- return c && !o.oneChangePerToken && (e.lastComponent = { count: c, previousComponent: e.lastComponent, added: false, removed: false }), e.oldPos = s, a;
83
- }
84
- equals(e, r, n) {
85
- return n.comparator ? n.comparator(e, r) : e === r || !!n.ignoreCase && e.toLowerCase() === r.toLowerCase();
86
- }
87
- removeEmpty(e) {
88
- let r = [];
89
- for (let n = 0; n < e.length; n++) e[n] && r.push(e[n]);
90
- return r;
91
- }
92
- castInput(e, r) {
93
- return e;
94
- }
95
- tokenize(e, r) {
96
- return Array.from(e);
97
- }
98
- join(e) {
99
- return e.join("");
100
- }
101
- postProcess(e, r) {
102
- return e;
103
- }
104
- get useLongestToken() {
105
- return false;
106
- }
107
- buildValues(e, r, n) {
108
- let u = [], o;
109
- for (; e; ) u.push(e), o = e.previousComponent, delete e.previousComponent, e = o;
110
- u.reverse();
111
- let i = u.length, D = 0, s = 0, a = 0;
112
- for (; D < i; D++) {
113
- let c = u[D];
114
- if (c.removed) c.value = this.join(n.slice(a, a + c.count)), a += c.count;
115
- else {
116
- if (!c.added && this.useLongestToken) {
117
- let p = r.slice(s, s + c.count);
118
- p = p.map(function(l, m) {
119
- let f = n[a + m];
120
- return f.length > l.length ? f : l;
121
- }), c.value = this.join(p);
122
- } else c.value = this.join(r.slice(s, s + c.count));
123
- s += c.count, c.added || (a += c.count);
124
- }
125
- }
126
- return u;
127
- }
128
- };
129
- var At = class extends Ne {
130
- tokenize(e) {
131
- return e.slice();
132
- }
133
- join(e) {
134
- return e;
135
- }
136
- removeEmpty(e) {
137
- return e;
138
- }
139
- }, pr = new At();
140
- function xt(t, e, r) {
141
- return pr.diff(t, e, r);
142
- }
143
- var Mu = () => {
144
- }, k = Mu;
145
- var dr = "cr", Fr = "crlf", Yu = "lf", ju = Yu, Bt = "\r", Er = `\r
146
- `, ze = `
147
- `, Uu = ze;
148
- function Cr(t) {
149
- let e = t.indexOf(Bt);
150
- return e !== -1 ? t.charAt(e + 1) === ze ? Fr : dr : ju;
151
- }
152
- function we(t) {
153
- return t === dr ? Bt : t === Fr ? Er : Uu;
154
- }
155
- var Vu = /* @__PURE__ */ new Map([[ze, /\n/g], [Bt, /\r/g], [Er, /\r\n/g]]);
156
- function Tt(t, e) {
157
- var _a2;
158
- let r = Vu.get(e);
159
- return ((_a2 = t.match(r)) == null ? void 0 : _a2.length) ?? 0;
160
- }
161
- var Wu = /\r\n?/g;
162
- function hr(t) {
163
- return ne(0, t, Wu, ze);
164
- }
165
- var ue = Symbol.for("comments");
166
- function $u(t) {
167
- return this[t < 0 ? this.length + t : t];
168
- }
169
- var zu = X("at", function() {
170
- if (Array.isArray(this) || typeof this == "string") return $u;
171
- }), y = zu;
172
- var G = "string", U = "array", V = "cursor", I = "indent", R = "align", v = "trim", x = "group", S = "fill", T = "if-break", L = "indent-if-break", M = "line-suffix", Y = "line-suffix-boundary", g = "line", b = "label", N = "break-parent", Ge = /* @__PURE__ */ new Set([V, I, R, v, x, S, T, L, M, Y, g, b, N]);
173
- function gr(t) {
174
- let e = t.length;
175
- for (; e > 0 && (t[e - 1] === "\r" || t[e - 1] === `
176
- `); ) e--;
177
- return e < t.length ? t.slice(0, e) : t;
178
- }
179
- function Fe(t, e, r) {
180
- if (!t.has(e)) {
181
- let n = r(e);
182
- t.set(e, n);
183
- }
184
- return t.get(e);
185
- }
186
- function Gu(t) {
187
- if (typeof t == "string") return G;
188
- if (Array.isArray(t)) return U;
189
- if (!t) return;
190
- let { type: e } = t;
191
- if (Ge.has(e)) return e;
192
- }
193
- var q = Gu;
194
- var Ku = (t) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(t);
195
- function Hu(t) {
196
- let e = t === null ? "null" : typeof t;
197
- if (e !== "string" && e !== "object") return `Unexpected doc '${e}',
198
- Expected it to be 'string' or 'object'.`;
199
- if (q(t)) throw new Error("doc is valid.");
200
- let r = Object.prototype.toString.call(t);
201
- if (r !== "[object Object]") return `Unexpected doc '${r}'.`;
202
- let n = Ku([...Ge].map((u) => `'${u}'`));
203
- return `Unexpected doc.type '${t.type}'.
204
- Expected it to be ${n}.`;
205
- }
206
- var Nt = class extends Error {
207
- constructor(e) {
208
- super(Hu(e));
209
- __publicField(this, "name", "InvalidDocError");
210
- this.doc = e;
211
- }
212
- }, Z = Nt;
213
- var _r = {};
214
- function Ju(t, e, r, n) {
215
- let u = [t];
216
- for (; u.length > 0; ) {
217
- let o = u.pop();
218
- if (o === _r) {
219
- r(u.pop());
220
- continue;
221
- }
222
- r && u.push(o, _r);
223
- let i = q(o);
224
- if (!i) throw new Z(o);
225
- if ((e == null ? void 0 : e(o)) !== false) switch (i) {
226
- case U:
227
- case S: {
228
- let D = i === U ? o : o.parts;
229
- for (let s = D.length, a = s - 1; a >= 0; --a) u.push(D[a]);
230
- break;
231
- }
232
- case T:
233
- u.push(o.flatContents, o.breakContents);
234
- break;
235
- case x:
236
- if (n && o.expandedStates) for (let D = o.expandedStates.length, s = D - 1; s >= 0; --s) u.push(o.expandedStates[s]);
237
- else u.push(o.contents);
238
- break;
239
- case R:
240
- case I:
241
- case L:
242
- case b:
243
- case M:
244
- u.push(o.contents);
245
- break;
246
- case G:
247
- case V:
248
- case v:
249
- case Y:
250
- case g:
251
- case N:
252
- break;
253
- default:
254
- throw new Z(o);
255
- }
256
- }
257
- }
258
- var Oe = Ju;
259
- function Se(t, e) {
260
- if (typeof t == "string") return e(t);
261
- let r = /* @__PURE__ */ new Map();
262
- return n(t);
263
- function n(o) {
264
- return Fe(r, o, u);
265
- }
266
- function u(o) {
267
- switch (q(o)) {
268
- case U:
269
- return e(o.map(n));
270
- case S:
271
- return e({ ...o, parts: o.parts.map(n) });
272
- case T:
273
- return e({ ...o, breakContents: n(o.breakContents), flatContents: n(o.flatContents) });
274
- case x: {
275
- let { expandedStates: i, contents: D } = o;
276
- return i ? (i = i.map(n), D = i[0]) : D = n(D), e({ ...o, contents: D, expandedStates: i });
277
- }
278
- case R:
279
- case I:
280
- case L:
281
- case b:
282
- case M:
283
- return e({ ...o, contents: n(o.contents) });
284
- case G:
285
- case V:
286
- case v:
287
- case Y:
288
- case g:
289
- case N:
290
- return e(o);
291
- default:
292
- throw new Z(o);
293
- }
294
- }
295
- }
296
- function Ke(t, e, r) {
297
- let n = r, u = false;
298
- function o(i) {
299
- if (u) return false;
300
- let D = e(i);
301
- D !== void 0 && (u = true, n = D);
302
- }
303
- return Oe(t, o), n;
304
- }
305
- function qu(t) {
306
- if (t.type === x && t.break || t.type === g && t.hard || t.type === N) return true;
307
- }
308
- function xr(t) {
309
- return Ke(t, qu, false);
310
- }
311
- function yr(t) {
312
- if (t.length > 0) {
313
- let e = y(0, t, -1);
314
- !e.expandedStates && !e.break && (e.break = "propagated");
315
- }
316
- return null;
317
- }
318
- function Br(t) {
319
- let e = /* @__PURE__ */ new Set(), r = [];
320
- function n(o) {
321
- if (o.type === N && yr(r), o.type === x) {
322
- if (r.push(o), e.has(o)) return false;
323
- e.add(o);
324
- }
325
- }
326
- function u(o) {
327
- o.type === x && r.pop().break && yr(r);
328
- }
329
- Oe(t, n, u, true);
330
- }
331
- function Xu(t) {
332
- return t.type === g && !t.hard ? t.soft ? "" : " " : t.type === T ? t.flatContents : t;
333
- }
334
- function Tr(t) {
335
- return Se(t, Xu);
336
- }
337
- function Ar(t) {
338
- for (t = [...t]; t.length >= 2 && y(0, t, -2).type === g && y(0, t, -1).type === N; ) t.length -= 2;
339
- if (t.length > 0) {
340
- let e = Pe(y(0, t, -1));
341
- t[t.length - 1] = e;
342
- }
343
- return t;
344
- }
345
- function Pe(t) {
346
- switch (q(t)) {
347
- case I:
348
- case L:
349
- case x:
350
- case M:
351
- case b: {
352
- let e = Pe(t.contents);
353
- return { ...t, contents: e };
354
- }
355
- case T:
356
- return { ...t, breakContents: Pe(t.breakContents), flatContents: Pe(t.flatContents) };
357
- case S:
358
- return { ...t, parts: Ar(t.parts) };
359
- case U:
360
- return Ar(t);
361
- case G:
362
- return gr(t);
363
- case R:
364
- case V:
365
- case v:
366
- case Y:
367
- case g:
368
- case N:
369
- break;
370
- default:
371
- throw new Z(t);
372
- }
373
- return t;
374
- }
375
- function He(t) {
376
- return Pe(Zu(t));
377
- }
378
- function Qu(t) {
379
- switch (q(t)) {
380
- case S: {
381
- let { parts: e } = t;
382
- if (e.every((r) => r === "")) return "";
383
- if (e.length === 1) return e[0];
384
- break;
385
- }
386
- case x:
387
- if (!t.contents && !t.id && !t.break && !t.expandedStates) return "";
388
- if (t.contents.type === x && t.contents.id === t.id && t.contents.break === t.break && t.contents.expandedStates === t.expandedStates) return t.contents;
389
- break;
390
- case R:
391
- case I:
392
- case L:
393
- case M:
394
- if (!t.contents) return "";
395
- break;
396
- case T:
397
- if (!t.flatContents && !t.breakContents) return "";
398
- break;
399
- case U: {
400
- let e = [];
401
- for (let r of t) {
402
- if (!r) continue;
403
- let [n, ...u] = Array.isArray(r) ? r : [r];
404
- typeof n == "string" && typeof y(0, e, -1) == "string" ? e[e.length - 1] += n : e.push(n), e.push(...u);
405
- }
406
- return e.length === 0 ? "" : e.length === 1 ? e[0] : e;
407
- }
408
- case G:
409
- case V:
410
- case v:
411
- case Y:
412
- case g:
413
- case b:
414
- case N:
415
- break;
416
- default:
417
- throw new Z(t);
418
- }
419
- return t;
420
- }
421
- function Zu(t) {
422
- return Se(t, (e) => Qu(e));
423
- }
424
- function Nr(t, e = Je) {
425
- return Se(t, (r) => typeof r == "string" ? be(e, r.split(`
426
- `)) : r);
427
- }
428
- function eo(t) {
429
- if (t.type === g) return true;
430
- }
431
- function wr(t) {
432
- return Ke(t, eo, false);
433
- }
434
- function Ee(t, e) {
435
- return t.type === b ? { ...t, contents: e(t.contents) } : e(t);
436
- }
437
- var qe = k;
438
- function oe(t) {
439
- return { type: I, contents: t };
440
- }
441
- function De(t, e) {
442
- return { type: R, contents: e, n: t };
443
- }
444
- function Sr(t) {
445
- return De(Number.NEGATIVE_INFINITY, t);
446
- }
447
- function Xe(t) {
448
- return De({ type: "root" }, t);
449
- }
450
- function br(t) {
451
- return De(-1, t);
452
- }
453
- function Qe(t, e, r) {
454
- let n = t;
455
- if (e > 0) {
456
- for (let u = 0; u < Math.floor(e / r); ++u) n = oe(n);
457
- n = De(e % r, n), n = De(Number.NEGATIVE_INFINITY, n);
458
- }
459
- return n;
460
- }
461
- var ae = { type: N };
462
- var ee = { type: V };
463
- function kr(t) {
464
- return { type: S, parts: t };
465
- }
466
- function wt(t, e = {}) {
467
- return qe(e.expandedStates), { type: x, id: e.id, contents: t, break: !!e.shouldBreak, expandedStates: e.expandedStates };
468
- }
469
- function Ir(t, e) {
470
- return wt(t[0], { ...e, expandedStates: t });
471
- }
472
- function Rr(t, e = "", r = {}) {
473
- return { type: T, breakContents: t, flatContents: e, groupId: r.groupId };
474
- }
475
- function vr(t, e) {
476
- return { type: L, contents: t, groupId: e.groupId, negate: e.negate };
477
- }
478
- function be(t, e) {
479
- let r = [];
480
- for (let n = 0; n < e.length; n++) n !== 0 && r.push(t), r.push(e[n]);
481
- return r;
482
- }
483
- function Lr(t, e) {
484
- return t ? { type: b, label: t, contents: e } : e;
485
- }
486
- var Ze = { type: g }, Mr = { type: g, soft: true }, ke = { type: g, hard: true }, W = [ke, ae], Ot = { type: g, hard: true, literal: true }, Je = [Ot, ae];
487
- function Ie(t) {
488
- return { type: M, contents: t };
489
- }
490
- var Yr = { type: Y };
491
- var jr = { type: v };
492
- function te(t) {
493
- var _a2;
494
- if (!t) return "";
495
- if (Array.isArray(t)) {
496
- let e = [];
497
- for (let r of t) if (Array.isArray(r)) e.push(...te(r));
498
- else {
499
- let n = te(r);
500
- n !== "" && e.push(n);
501
- }
502
- return e;
503
- }
504
- return t.type === T ? { ...t, breakContents: te(t.breakContents), flatContents: te(t.flatContents) } : t.type === x ? { ...t, contents: te(t.contents), expandedStates: (_a2 = t.expandedStates) == null ? void 0 : _a2.map(te) } : t.type === S ? { type: "fill", parts: t.parts.map(te) } : t.contents ? { ...t, contents: te(t.contents) } : t;
505
- }
506
- function Ur(t) {
507
- let e = /* @__PURE__ */ Object.create(null), r = /* @__PURE__ */ new Set();
508
- return n(te(t));
509
- function n(o, i, D) {
510
- var _a2, _b2;
511
- if (typeof o == "string") return JSON.stringify(o);
512
- if (Array.isArray(o)) {
513
- let s = o.map(n).filter(Boolean);
514
- return s.length === 1 ? s[0] : `[${s.join(", ")}]`;
515
- }
516
- if (o.type === g) {
517
- let s = ((_a2 = D == null ? void 0 : D[i + 1]) == null ? void 0 : _a2.type) === N;
518
- return o.literal ? s ? "literalline" : "literallineWithoutBreakParent" : o.hard ? s ? "hardline" : "hardlineWithoutBreakParent" : o.soft ? "softline" : "line";
519
- }
520
- if (o.type === N) return ((_b2 = D == null ? void 0 : D[i - 1]) == null ? void 0 : _b2.type) === g && D[i - 1].hard ? void 0 : "breakParent";
521
- if (o.type === v) return "trim";
522
- if (o.type === I) return "indent(" + n(o.contents) + ")";
523
- if (o.type === R) return o.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + n(o.contents) + ")" : o.n < 0 ? "dedent(" + n(o.contents) + ")" : o.n.type === "root" ? "markAsRoot(" + n(o.contents) + ")" : "align(" + JSON.stringify(o.n) + ", " + n(o.contents) + ")";
524
- if (o.type === T) return "ifBreak(" + n(o.breakContents) + (o.flatContents ? ", " + n(o.flatContents) : "") + (o.groupId ? (o.flatContents ? "" : ', ""') + `, { groupId: ${u(o.groupId)} }` : "") + ")";
525
- if (o.type === L) {
526
- let s = [];
527
- o.negate && s.push("negate: true"), o.groupId && s.push(`groupId: ${u(o.groupId)}`);
528
- let a = s.length > 0 ? `, { ${s.join(", ")} }` : "";
529
- return `indentIfBreak(${n(o.contents)}${a})`;
530
- }
531
- if (o.type === x) {
532
- let s = [];
533
- o.break && o.break !== "propagated" && s.push("shouldBreak: true"), o.id && s.push(`id: ${u(o.id)}`);
534
- let a = s.length > 0 ? `, { ${s.join(", ")} }` : "";
535
- return o.expandedStates ? `conditionalGroup([${o.expandedStates.map((c) => n(c)).join(",")}]${a})` : `group(${n(o.contents)}${a})`;
536
- }
537
- if (o.type === S) return `fill([${o.parts.map((s) => n(s)).join(", ")}])`;
538
- if (o.type === M) return "lineSuffix(" + n(o.contents) + ")";
539
- if (o.type === Y) return "lineSuffixBoundary";
540
- if (o.type === b) return `label(${JSON.stringify(o.label)}, ${n(o.contents)})`;
541
- if (o.type === V) return "cursor";
542
- throw new Error("Unknown doc type " + o.type);
543
- }
544
- function u(o) {
545
- if (typeof o != "symbol") return JSON.stringify(String(o));
546
- if (o in e) return e[o];
547
- let i = o.description || "symbol";
548
- for (let D = 0; ; D++) {
549
- let s = i + (D > 0 ? ` #${D}` : "");
550
- if (!r.has(s)) return r.add(s), e[o] = `Symbol.for(${JSON.stringify(s)})`;
551
- }
552
- }
553
- }
554
- var Vr = () => /[#*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;
555
- var Wr = 12288, $r = 65510, zr = [12288, 12288, 65281, 65376, 65504, 65510];
556
- var Gr = 4352, Kr = 262141, Pt = [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];
557
- var St = (t, e) => {
558
- let r = 0, n = Math.floor(t.length / 2) - 1;
559
- for (; r <= n; ) {
560
- let u = Math.floor((r + n) / 2), o = u * 2;
561
- if (e < t[o]) n = u - 1;
562
- else if (e > t[o + 1]) r = u + 1;
563
- else return true;
564
- }
565
- return false;
566
- };
567
- var Hr = 19968, [to, ro] = no(Pt);
568
- function no(t) {
569
- let e = t[0], r = t[1];
570
- for (let n = 0; n < t.length; n += 2) {
571
- let u = t[n], o = t[n + 1];
572
- if (Hr >= u && Hr <= o) return [u, o];
573
- o - u > r - e && (e = u, r = o);
574
- }
575
- return [e, r];
576
- }
577
- var bt = (t) => t < Wr || t > $r ? false : St(zr, t);
578
- var kt = (t) => t >= to && t <= ro ? true : t < Gr || t > Kr ? false : St(Pt, t);
579
- var uo = /^(?:[\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])$/, Jr = (t) => uo.test(t);
580
- var oo = /[^\x20-\x7F]/;
581
- function io(t) {
582
- if (!t) return 0;
583
- if (!oo.test(t)) return t.length;
584
- let e = 0;
585
- t = t.replace(Vr(), (r) => (e += Jr(r) ? 1 : 2, ""));
586
- for (let r of t) {
587
- let n = r.codePointAt(0);
588
- n <= 31 || n >= 127 && n <= 159 || n >= 768 && n <= 879 || n >= 65024 && n <= 65039 || (e += bt(n) || kt(n) ? 2 : 1);
589
- }
590
- return e;
591
- }
592
- var Re = io;
593
- var so = { type: 0 }, Do = { type: 1 }, It = { value: "", length: 0, queue: [], get root() {
594
- return It;
595
- } };
596
- function qr(t, e, r) {
597
- let n = e.type === 1 ? t.queue.slice(0, -1) : [...t.queue, e], u = "", o = 0, i = 0, D = 0;
598
- for (let f of n) switch (f.type) {
599
- case 0:
600
- c(), r.useTabs ? s(1) : a(r.tabWidth);
601
- break;
602
- case 3: {
603
- let { string: F } = f;
604
- c(), u += F, o += F.length;
605
- break;
606
- }
607
- case 2: {
608
- let { width: F } = f;
609
- i += 1, D += F;
610
- break;
611
- }
612
- default:
613
- throw new Error(`Unexpected indent comment '${f.type}'.`);
614
- }
615
- return l(), { ...t, value: u, length: o, queue: n };
616
- function s(f) {
617
- u += " ".repeat(f), o += r.tabWidth * f;
618
- }
619
- function a(f) {
620
- u += " ".repeat(f), o += f;
621
- }
622
- function c() {
623
- r.useTabs ? p() : l();
624
- }
625
- function p() {
626
- i > 0 && s(i), m();
627
- }
628
- function l() {
629
- D > 0 && a(D), m();
630
- }
631
- function m() {
632
- i = 0, D = 0;
633
- }
634
- }
635
- function Xr(t, e, r) {
636
- if (!e) return t;
637
- if (e.type === "root") return { ...t, root: t };
638
- if (e === Number.NEGATIVE_INFINITY) return t.root;
639
- let n;
640
- return typeof e == "number" ? e < 0 ? n = Do : n = { type: 2, width: e } : n = { type: 3, string: e }, qr(t, n, r);
641
- }
642
- function Qr(t, e) {
643
- return qr(t, so, e);
644
- }
645
- function ao(t) {
646
- let e = 0;
647
- for (let r = t.length - 1; r >= 0; r--) {
648
- let n = t[r];
649
- if (n === " " || n === " ") e++;
650
- else break;
651
- }
652
- return e;
653
- }
654
- function et(t) {
655
- let e = ao(t);
656
- return { text: e === 0 ? t : t.slice(0, t.length - e), count: e };
657
- }
658
- var Rt = (_a = class {
659
- constructor() {
660
- __privateAdd(this, _Rt_instances);
661
- __privateAdd(this, _t, []);
662
- __privateAdd(this, _e2, "");
663
- __privateAdd(this, _n2, 0);
664
- __privateAdd(this, _u2, []);
665
- __privateAdd(this, _r2, []);
666
- }
667
- markPosition() {
668
- if (__privateGet(this, _u2).length + __privateGet(this, _r2).length >= 2) throw new Error("There are too many 'cursor' in doc.");
669
- __privateGet(this, _r2).push(__privateGet(this, _n2) + __privateGet(this, _e2).length);
670
- }
671
- write(e) {
672
- __privateSet(this, _e2, __privateGet(this, _e2) + e);
673
- }
674
- trim() {
675
- let { text: e, count: r } = et(__privateGet(this, _e2));
676
- return __privateSet(this, _e2, e), __privateMethod(this, _Rt_instances, o_fn).call(this), r;
677
- }
678
- finish() {
679
- return __privateMethod(this, _Rt_instances, o_fn).call(this), { text: __privateGet(this, _t).join(""), positions: __privateGet(this, _u2) };
680
- }
681
- }, _t = new WeakMap(), _e2 = new WeakMap(), _n2 = new WeakMap(), _u2 = new WeakMap(), _r2 = new WeakMap(), _Rt_instances = new WeakSet(), o_fn = function() {
682
- let e = __privateGet(this, _e2);
683
- e !== "" && (__privateGet(this, _t).push(e), __privateSet(this, _n2, __privateGet(this, _n2) + e.length), __privateSet(this, _e2, ""));
684
- for (let r of __privateGet(this, _r2)) __privateGet(this, _u2).push(Math.min(r, __privateGet(this, _n2)));
685
- __privateGet(this, _r2).length = 0;
686
- }, _a), Zr = Rt;
687
- var K = Symbol("MODE_BREAK"), Q = Symbol("MODE_FLAT"), vt = Symbol("DOC_FILL_PRINTED_LENGTH");
688
- function tt(t, e, r, n, u, o) {
689
- if (r === Number.POSITIVE_INFINITY) return true;
690
- let i = e.length, D = false, s = [t], a = "";
691
- for (; r >= 0; ) {
692
- if (s.length === 0) {
693
- if (i === 0) return true;
694
- s.push(e[--i]);
695
- continue;
696
- }
697
- let { mode: c, doc: p } = s.pop(), l = q(p);
698
- switch (l) {
699
- case G:
700
- p && (D && (a += " ", r -= 1, D = false), a += p, r -= Re(p));
701
- break;
702
- case U:
703
- case S: {
704
- let m = l === U ? p : p.parts, f = p[vt] ?? 0;
705
- for (let F = m.length - 1; F >= f; F--) s.push({ mode: c, doc: m[F] });
706
- break;
707
- }
708
- case I:
709
- case R:
710
- case L:
711
- case b:
712
- s.push({ mode: c, doc: p.contents });
713
- break;
714
- case v: {
715
- let { text: m, count: f } = et(a);
716
- a = m, r += f;
717
- break;
718
- }
719
- case x: {
720
- if (o && p.break) return false;
721
- let m = p.break ? K : c, f = p.expandedStates && m === K ? y(0, p.expandedStates, -1) : p.contents;
722
- s.push({ mode: m, doc: f });
723
- break;
724
- }
725
- case T: {
726
- let f = (p.groupId ? u[p.groupId] || Q : c) === K ? p.breakContents : p.flatContents;
727
- f && s.push({ mode: c, doc: f });
728
- break;
729
- }
730
- case g:
731
- if (c === K || p.hard) return true;
732
- p.soft || (D = true);
733
- break;
734
- case M:
735
- n = true;
736
- break;
737
- case Y:
738
- if (n) return false;
739
- break;
740
- }
741
- }
742
- return false;
743
- }
744
- function Ce(t, e) {
745
- let r = /* @__PURE__ */ Object.create(null), n = e.printWidth, u = we(e.endOfLine), o = 0, i = [{ indent: It, mode: K, doc: t }], D = false, s = [], a = new Zr();
746
- for (Br(t); i.length > 0; ) {
747
- let { indent: f, mode: F, doc: d } = i.pop();
748
- switch (q(d)) {
749
- case G: {
750
- let E = u !== `
751
- ` ? ne(0, d, `
752
- `, u) : d;
753
- E && (a.write(E), i.length > 0 && (o += Re(E)));
754
- break;
755
- }
756
- case U:
757
- for (let E = d.length - 1; E >= 0; E--) i.push({ indent: f, mode: F, doc: d[E] });
758
- break;
759
- case V:
760
- a.markPosition();
761
- break;
762
- case I:
763
- i.push({ indent: Qr(f, e), mode: F, doc: d.contents });
764
- break;
765
- case R:
766
- i.push({ indent: Xr(f, d.n, e), mode: F, doc: d.contents });
767
- break;
768
- case v:
769
- o -= a.trim();
770
- break;
771
- case x: {
772
- let E = (function() {
773
- if (F === Q && !D) return { indent: f, mode: d.break ? K : Q, doc: d.contents };
774
- D = false;
775
- let h = n - o, _ = s.length > 0, P = { indent: f, mode: Q, doc: d.contents };
776
- if (!d.break && tt(P, i, h, _, r)) return P;
777
- if (!d.expandedStates) return { indent: f, mode: K, doc: d.contents };
778
- if (!d.break) for (let A = 1; A < d.expandedStates.length - 1; A++) {
779
- let B = { indent: f, mode: Q, doc: d.expandedStates[A] };
780
- if (tt(B, i, h, _, r)) return B;
781
- }
782
- return { indent: f, mode: K, doc: y(0, d.expandedStates, -1) };
783
- })();
784
- i.push(E), d.id && (r[d.id] = E.mode);
785
- break;
786
- }
787
- case S: {
788
- let E = n - o, C = d[vt] ?? 0, { parts: h } = d, _ = h.length - C;
789
- if (_ === 0) break;
790
- let P = h[C + 0], A = h[C + 1], B = { indent: f, mode: Q, doc: P }, J = { indent: f, mode: K, doc: P }, $e = tt(B, [], E, s.length > 0, r, true);
791
- if (_ === 1) {
792
- $e ? i.push(B) : i.push(J);
793
- break;
794
- }
795
- let lr = { indent: f, mode: Q, doc: A }, _t2 = { indent: f, mode: K, doc: A };
796
- if (_ === 2) {
797
- $e ? i.push(lr, B) : i.push(_t2, J);
798
- break;
799
- }
800
- let bu = h[C + 2], ku = { indent: f, mode: F, doc: { ...d, [vt]: C + 2 } }, Iu = tt({ indent: f, mode: Q, doc: [P, A, bu] }, [], E, s.length > 0, r, true);
801
- i.push(ku), Iu ? i.push(lr, B) : $e ? i.push(_t2, B) : i.push(_t2, J);
802
- break;
803
- }
804
- case T:
805
- case L: {
806
- let E = d.groupId ? r[d.groupId] : F;
807
- if (E === K) {
808
- let C = d.type === T ? d.breakContents : d.negate ? d.contents : oe(d.contents);
809
- C && i.push({ indent: f, mode: F, doc: C });
810
- }
811
- if (E === Q) {
812
- let C = d.type === T ? d.flatContents : d.negate ? oe(d.contents) : d.contents;
813
- C && i.push({ indent: f, mode: F, doc: C });
814
- }
815
- break;
816
- }
817
- case M:
818
- s.push({ indent: f, mode: F, doc: d.contents });
819
- break;
820
- case Y:
821
- s.length > 0 && i.push({ indent: f, mode: F, doc: ke });
822
- break;
823
- case g:
824
- switch (F) {
825
- case Q:
826
- if (!d.hard) {
827
- d.soft || (a.write(" "), o += 1);
828
- break;
829
- }
830
- D = true;
831
- case K:
832
- if (s.length > 0) {
833
- i.push({ indent: f, mode: F, doc: d }, ...s.reverse()), s.length = 0;
834
- break;
835
- }
836
- d.literal ? (a.write(u), o = 0, f.root && (f.root.value && a.write(f.root.value), o = f.root.length)) : (a.trim(), a.write(u + f.value), o = f.length);
837
- break;
838
- }
839
- break;
840
- case b:
841
- i.push({ indent: f, mode: F, doc: d.contents });
842
- break;
843
- case N:
844
- break;
845
- default:
846
- throw new Z(d);
847
- }
848
- i.length === 0 && s.length > 0 && (i.push(...s.reverse()), s.length = 0);
849
- }
850
- let { text: c, positions: p } = a.finish();
851
- if (p.length !== 2) return { formatted: c };
852
- let [l, m] = p;
853
- return { formatted: c, cursorNodeStart: l, cursorNodeText: c.slice(l, m) };
854
- }
855
- function co(t, e, r = 0) {
856
- let n = 0;
857
- for (let u = r; u < t.length; ++u) t[u] === " " ? n = n + e - n % e : n++;
858
- return n;
859
- }
860
- var he = co;
861
- var Lt = (_b = class {
862
- constructor(e) {
863
- __privateAdd(this, _Lt_instances);
864
- this.stack = [e];
865
- }
866
- get key() {
867
- let { stack: e, siblings: r } = this;
868
- return y(0, e, r === null ? -2 : -4) ?? null;
869
- }
870
- get index() {
871
- return this.siblings === null ? null : y(0, this.stack, -2);
872
- }
873
- get node() {
874
- return y(0, this.stack, -1);
875
- }
876
- get parent() {
877
- return this.getNode(1);
878
- }
879
- get grandparent() {
880
- return this.getNode(2);
881
- }
882
- get isInArray() {
883
- return this.siblings !== null;
884
- }
885
- get siblings() {
886
- let { stack: e } = this, r = y(0, e, -3);
887
- return Array.isArray(r) ? r : null;
888
- }
889
- get next() {
890
- let { siblings: e } = this;
891
- return e === null ? null : e[this.index + 1];
892
- }
893
- get previous() {
894
- let { siblings: e } = this;
895
- return e === null ? null : e[this.index - 1];
896
- }
897
- get isFirst() {
898
- return this.index === 0;
899
- }
900
- get isLast() {
901
- let { siblings: e, index: r } = this;
902
- return e !== null && r === e.length - 1;
903
- }
904
- get isRoot() {
905
- return this.stack.length === 1;
906
- }
907
- get root() {
908
- return this.stack[0];
909
- }
910
- get ancestors() {
911
- return [...__privateMethod(this, _Lt_instances, e_fn).call(this)];
912
- }
913
- getName() {
914
- let { stack: e } = this, { length: r } = e;
915
- return r > 1 ? y(0, e, -2) : null;
916
- }
917
- getValue() {
918
- return y(0, this.stack, -1);
919
- }
920
- getNode(e = 0) {
921
- let r = __privateMethod(this, _Lt_instances, t_fn).call(this, e);
922
- return r === -1 ? null : this.stack[r];
923
- }
924
- getParentNode(e = 0) {
925
- return this.getNode(e + 1);
926
- }
927
- call(e, ...r) {
928
- let { stack: n } = this, { length: u } = n, o = y(0, n, -1);
929
- for (let i of r) o = o == null ? void 0 : o[i], n.push(i, o);
930
- try {
931
- return e(this);
932
- } finally {
933
- n.length = u;
934
- }
935
- }
936
- callParent(e, r = 0) {
937
- let n = __privateMethod(this, _Lt_instances, t_fn).call(this, r + 1), u = this.stack.splice(n + 1);
938
- try {
939
- return e(this);
940
- } finally {
941
- this.stack.push(...u);
942
- }
943
- }
944
- each(e, ...r) {
945
- let { stack: n } = this, { length: u } = n, o = y(0, n, -1);
946
- for (let i of r) o = o[i], n.push(i, o);
947
- try {
948
- for (let i = 0; i < o.length; ++i) n.push(i, o[i]), e(this, i, o), n.length -= 2;
949
- } finally {
950
- n.length = u;
951
- }
952
- }
953
- map(e, ...r) {
954
- let n = [];
955
- return this.each((u, o, i) => {
956
- n[o] = e(u, o, i);
957
- }, ...r), n;
958
- }
959
- match(...e) {
960
- let r = this.stack.length - 1, n = null, u = this.stack[r--];
961
- for (let o of e) {
962
- if (u === void 0) return false;
963
- let i = null;
964
- if (typeof n == "number" && (i = n, n = this.stack[r--], u = this.stack[r--]), o && !o(u, n, i)) return false;
965
- n = this.stack[r--], u = this.stack[r--];
966
- }
967
- return true;
968
- }
969
- findAncestor(e) {
970
- for (let r of __privateMethod(this, _Lt_instances, e_fn).call(this)) if (e(r)) return r;
971
- }
972
- hasAncestor(e) {
973
- for (let r of __privateMethod(this, _Lt_instances, e_fn).call(this)) if (e(r)) return true;
974
- return false;
975
- }
976
- }, _Lt_instances = new WeakSet(), t_fn = function(e) {
977
- let { stack: r } = this;
978
- for (let n = r.length - 1; n >= 0; n -= 2) if (!Array.isArray(r[n]) && --e < 0) return n;
979
- return -1;
980
- }, e_fn = function* () {
981
- let { stack: e } = this;
982
- for (let r = e.length - 3; r >= 0; r -= 2) {
983
- let n = e[r];
984
- Array.isArray(n) || (yield n);
985
- }
986
- }, _b), en = Lt;
987
- function fo(t) {
988
- return Array.isArray(t) && t.length > 0;
989
- }
990
- var rt = fo;
991
- function lo(t) {
992
- return t !== null && typeof t == "object";
993
- }
994
- var ge = lo;
995
- function _e(t) {
996
- return (e, r, n) => {
997
- if (r === false) return false;
998
- let u = !!(n == null ? void 0 : n.backwards), { length: o } = e, i = r;
999
- for (; i >= 0 && i < o; ) {
1000
- let D = e.charAt(i);
1001
- if (t instanceof RegExp) {
1002
- if (!t.test(D)) return i;
1003
- } else if (!t.includes(D)) return i;
1004
- u ? i-- : i++;
1005
- }
1006
- return i === -1 || i === o ? i : false;
1007
- };
1008
- }
1009
- var tn = _e(/\s/), j = _e(" "), nt = _e(",; "), ut = _e(/[^\n\r]/);
1010
- var rn = (t) => t === `
1011
- ` || t === "\r" || t === "\u2028" || t === "\u2029";
1012
- function po(t, e, r) {
1013
- if (e === false) return false;
1014
- let n = !!(r == null ? void 0 : r.backwards), u = t.charAt(e);
1015
- if (n) {
1016
- if (t.charAt(e - 1) === "\r" && u === `
1017
- `) return e - 2;
1018
- if (rn(u)) return e - 1;
1019
- } else {
1020
- if (u === "\r" && t.charAt(e + 1) === `
1021
- `) return e + 2;
1022
- if (rn(u)) return e + 1;
1023
- }
1024
- return e;
1025
- }
1026
- var $ = po;
1027
- function mo(t, e, r = {}) {
1028
- let n = j(t, r.backwards ? e - 1 : e, r), u = $(t, n, r);
1029
- return n !== u;
1030
- }
1031
- var H = mo;
1032
- function* ye(t, e) {
1033
- let { getVisitorKeys: r, filter: n = () => true } = e, u = (o) => ge(o) && n(o);
1034
- for (let o of r(t)) {
1035
- let i = t[o];
1036
- if (Array.isArray(i)) for (let D of i) u(D) && (yield D);
1037
- else u(i) && (yield i);
1038
- }
1039
- }
1040
- function* nn(t, e) {
1041
- let r = [t];
1042
- for (let n = 0; n < r.length; n++) {
1043
- let u = r[n];
1044
- for (let o of ye(u, e)) yield o, r.push(o);
1045
- }
1046
- }
1047
- function un(t, e) {
1048
- return ye(t, e).next().done;
1049
- }
1050
- function Fo(t, e, r) {
1051
- var _a2;
1052
- let { filter: n } = r;
1053
- if (!n) return [];
1054
- let u, o = (((_a2 = r.getChildren) == null ? void 0 : _a2.call(r, t, r)) ?? [...ye(t, { getVisitorKeys: r.getVisitorKeys })]).flatMap((s) => (u ?? (u = [t, ...e]), n(s, u) ? [s] : on(s, u, r))), { locStart: i, locEnd: D } = r;
1055
- return o.sort((s, a) => i(s) - i(a) || D(s) - D(a)), o;
1056
- }
1057
- function on(t, e, r) {
1058
- return Fe(r.cache, t, (n) => Fo(n, e, r));
1059
- }
1060
- var ot = on;
1061
- function Eo(t) {
1062
- let e = t.type || t.kind || "(unknown type)", r = String(t.name || t.id && (typeof t.id == "object" ? t.id.name : t.id) || t.key && (typeof t.key == "object" ? t.key.name : t.key) || t.value && (typeof t.value == "object" ? "" : String(t.value)) || t.operator || "");
1063
- return r.length > 20 && (r = r.slice(0, 19) + "…"), e + (r ? " " + r : "");
1064
- }
1065
- function Mt(t, e) {
1066
- (t.comments ?? (t.comments = [])).push(e), e.printed = false, e.nodeDescription = Eo(t);
1067
- }
1068
- function ce(t, e) {
1069
- e.leading = true, e.trailing = false, Mt(t, e);
1070
- }
1071
- function re(t, e, r) {
1072
- e.leading = false, e.trailing = false, r && (e.marker = r), Mt(t, e);
1073
- }
1074
- function fe(t, e) {
1075
- e.leading = false, e.trailing = true, Mt(t, e);
1076
- }
1077
- var Ut = /* @__PURE__ */ new WeakMap();
1078
- function Dn(t, e, r, n, u = []) {
1079
- let { locStart: o, locEnd: i } = r, D = o(e), s = i(e), a = ot(t, u, { cache: Ut, locStart: o, locEnd: i, getVisitorKeys: r.getVisitorKeys, filter: r.printer.canAttachComment, getChildren: r.printer.getCommentChildNodes }), c, p, l = 0, m = a.length;
1080
- for (; l < m; ) {
1081
- let f = l + m >> 1, F = a[f], d = o(F), E = i(F);
1082
- if (d <= D && s <= E) return Dn(F, e, r, F, [F, ...u]);
1083
- if (E <= D) {
1084
- c = F, l = f + 1;
1085
- continue;
1086
- }
1087
- if (s <= d) {
1088
- p = F, m = f;
1089
- continue;
1090
- }
1091
- throw new Error("Comment location overlaps with node location");
1092
- }
1093
- if ((n == null ? void 0 : n.type) === "TemplateLiteral") {
1094
- let { quasis: f } = n, F = jt(f, e, r);
1095
- c && jt(f, c, r) !== F && (c = null), p && jt(f, p, r) !== F && (p = null);
1096
- }
1097
- return { enclosingNode: n, precedingNode: c, followingNode: p };
1098
- }
1099
- var Yt = () => false;
1100
- function an(t, e) {
1101
- let { comments: r } = t;
1102
- if (delete t.comments, !rt(r) || !e.printer.canAttachComment) return;
1103
- let n = [], { printer: { features: { experimental_avoidAstMutation: u }, handleComments: o = {} }, originalText: i } = e, { ownLine: D = Yt, endOfLine: s = Yt, remaining: a = Yt } = o, c = r.map((l, m) => ({ ...Dn(t, l, e), comment: l, text: i, options: e, ast: t, isLastComment: r.length - 1 === m, placement: void 0 })), p = !u;
1104
- for (let [l, m] of c.entries()) {
1105
- let { comment: f, precedingNode: F, enclosingNode: d, followingNode: E, text: C, options: h, ast: _, isLastComment: P } = m, A = Co(C, h, c, l) ? "ownLine" : ho(C, h, c, l) ? "endOfLine" : "remaining", B;
1106
- if (u ? (m.placement = A, B = [m]) : B = [f, C, h, _, P], p && (f.enclosingNode = d, f.precedingNode = F, f.followingNode = E), f.placement = A, A === "ownLine") D(...B) || (E ? ce(E, f) : F ? fe(F, f) : d ? re(d, f) : re(_, f));
1107
- else if (A === "endOfLine") s(...B) || (F ? fe(F, f) : E ? ce(E, f) : d ? re(d, f) : re(_, f));
1108
- else if (!a(...B)) if (F && E) {
1109
- let J = n.length;
1110
- J > 0 && n[J - 1].followingNode !== E && sn(n, h), n.push(m);
1111
- } else F ? fe(F, f) : E ? ce(E, f) : d ? re(d, f) : re(_, f);
1112
- }
1113
- if (sn(n, e), p) for (let l of r) delete l.precedingNode, delete l.enclosingNode, delete l.followingNode;
1114
- }
1115
- var cn = (t) => !/[\S\n\u2028\u2029]/.test(t);
1116
- function Co(t, e, r, n) {
1117
- let { comment: u, precedingNode: o } = r[n], { locStart: i, locEnd: D } = e, s = i(u);
1118
- if (o) for (let a = n - 1; a >= 0; a--) {
1119
- let { comment: c, precedingNode: p } = r[a];
1120
- if (p !== o || !cn(t.slice(D(c), s))) break;
1121
- s = i(c);
1122
- }
1123
- return H(t, s, { backwards: true });
1124
- }
1125
- function ho(t, e, r, n) {
1126
- let { comment: u, followingNode: o } = r[n], { locStart: i, locEnd: D } = e, s = D(u);
1127
- if (o) for (let a = n + 1; a < r.length; a++) {
1128
- let { comment: c, followingNode: p } = r[a];
1129
- if (p !== o || !cn(t.slice(s, i(c)))) break;
1130
- s = D(c);
1131
- }
1132
- return H(t, s);
1133
- }
1134
- function sn(t, e) {
1135
- var _a2, _b2;
1136
- let r = t.length;
1137
- if (r === 0) return;
1138
- let { precedingNode: n, followingNode: u } = t[0], o = e.locStart(u), i;
1139
- for (i = r; i > 0; --i) {
1140
- let { comment: D, precedingNode: s, followingNode: a } = t[i - 1];
1141
- let c = e.originalText.slice(e.locEnd(D), o);
1142
- if (((_b2 = (_a2 = e.printer).isGap) == null ? void 0 : _b2.call(_a2, c, e)) ?? /^[\s(]*$/.test(c)) o = e.locStart(D);
1143
- else break;
1144
- }
1145
- for (let [D, { comment: s }] of t.entries()) D < i ? fe(n, s) : ce(u, s);
1146
- for (let D of [n, u]) D.comments && D.comments.length > 1 && D.comments.sort((s, a) => e.locStart(s) - e.locStart(a));
1147
- t.length = 0;
1148
- }
1149
- function jt(t, e, r) {
1150
- let n = r.locStart(e) - 1;
1151
- for (let u = 1; u < t.length; ++u) if (n < r.locStart(t[u])) return u - 1;
1152
- return 0;
1153
- }
1154
- function go(t, e) {
1155
- let r = e - 1;
1156
- r = j(t, r, { backwards: true }), r = $(t, r, { backwards: true }), r = j(t, r, { backwards: true });
1157
- let n = $(t, r, { backwards: true });
1158
- return r !== n;
1159
- }
1160
- var ve = go;
1161
- var fn = () => true;
1162
- function ln(t, e) {
1163
- let r = t.node;
1164
- return r.printed = true, e.printer.printComment(t, e);
1165
- }
1166
- function _o(t, e) {
1167
- var _a2;
1168
- let r = t.node, n = [ln(t, e)], { printer: u, originalText: o, locStart: i, locEnd: D } = e;
1169
- if ((_a2 = u.isBlockComment) == null ? void 0 : _a2.call(u, r)) {
1170
- let c = " ";
1171
- H(o, D(r)) && (H(o, i(r), { backwards: true }) ? c = W : c = Ze), n.push(c);
1172
- } else n.push(W);
1173
- let a = $(o, j(o, D(r)));
1174
- return a !== false && H(o, a) && n.push(W), n;
1175
- }
1176
- function yo(t, e, r) {
1177
- var _a2;
1178
- let n = t.node, u = ln(t, e), { printer: o, originalText: i, locStart: D } = e, s = (_a2 = o.isBlockComment) == null ? void 0 : _a2.call(o, n);
1179
- if ((r == null ? void 0 : r.hasLineSuffix) && !(r == null ? void 0 : r.isBlock) || H(i, D(n), { backwards: true })) {
1180
- let a = ve(i, D(n));
1181
- return { doc: Ie([W, a ? W : "", u]), isBlock: s, hasLineSuffix: true };
1182
- }
1183
- return !s || (r == null ? void 0 : r.hasLineSuffix) ? { doc: [Ie([" ", u]), ae], isBlock: s, hasLineSuffix: true } : { doc: [" ", u], isBlock: s, hasLineSuffix: false };
1184
- }
1185
- function Ao(t, e, r) {
1186
- var _a2, _b2;
1187
- let n = e[Symbol.for("printedComments")], u = fn, o = new Set((_b2 = (_a2 = t.node) == null ? void 0 : _a2.comments) == null ? void 0 : _b2.filter((i) => !(n == null ? void 0 : n.has(i)) && i.leading && u(i)));
1188
- return o.size === 0 ? "" : t.map(({ node: i }) => o.has(i) ? _o(t, e) : "", "comments").filter(Boolean);
1189
- }
1190
- function xo(t, e, r) {
1191
- var _a2;
1192
- let n = (_a2 = t.node) == null ? void 0 : _a2.comments, u = new Set(n == null ? void 0 : n.filter((c) => c.trailing)), o = e[Symbol.for("printedComments")], i = fn, D = new Set(n == null ? void 0 : n.filter((c) => u.has(c) && !(o == null ? void 0 : o.has(c)) && i(c)));
1193
- if (D.size === 0) return "";
1194
- let s = [], a;
1195
- return t.each(({ node: c }) => {
1196
- u.has(c) && (a = yo(t, e, a), D.has(c) && s.push(a.doc));
1197
- }, "comments"), s;
1198
- }
1199
- function pn(t, e, r, n) {
1200
- let u = Ao(t, r), o = xo(t, r);
1201
- return u || o ? Ee(e, (i) => [u, i, o]) : e;
1202
- }
1203
- function mn(t) {
1204
- let { [ue]: e, [Symbol.for("printedComments")]: r } = t;
1205
- for (let n of e) {
1206
- if (!n.printed && !r.has(n)) throw new Error('Comment "' + n.value.trim() + '" was not printed. Please report this error!');
1207
- delete n.printed;
1208
- }
1209
- }
1210
- var Le = class extends Error {
1211
- constructor() {
1212
- super(...arguments);
1213
- __publicField(this, "name", "ConfigError");
1214
- }
1215
- }, Me = class extends Error {
1216
- constructor() {
1217
- super(...arguments);
1218
- __publicField(this, "name", "UndefinedParserError");
1219
- }
1220
- };
1221
- var Bo = Object.hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty), le = Bo;
1222
- var Fn = { checkIgnorePragma: { category: "Special", type: "boolean", default: false, 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
1223
- (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: false, description: "Insert @format pragma into file's first docblock comment.", cliCategory: "Other" }, parser: { category: "Global", type: "choice", default: void 0, description: "Which parser to use.", exception: (t) => typeof t == "string" || typeof t == "function", choices: [{ value: "flow", description: "Flow" }, { value: "babel", description: "JavaScript" }, { value: "babel-flow", description: "Flow" }, { value: "babel-ts", description: "TypeScript" }, { value: "typescript", description: "TypeScript" }, { value: "acorn", description: "JavaScript" }, { value: "espree", description: "JavaScript" }, { value: "meriyah", description: "JavaScript" }, { value: "css", description: "CSS" }, { value: "less", description: "Less" }, { value: "scss", description: "SCSS" }, { value: "json", description: "JSON" }, { value: "json5", description: "JSON5" }, { value: "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: true, default: [{ value: [] }], category: "Global", description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.", exception: (t) => typeof t == "string" || typeof t == "object", cliName: "plugin", cliCategory: "Config" }, printWidth: { category: "Global", type: "int", default: 80, description: "The line length where Prettier will try wrap.", range: { start: 0, end: 1 / 0, step: 1 } }, rangeEnd: { category: "Special", type: "int", default: 1 / 0, range: { start: 0, end: 1 / 0, step: 1 }, description: `Format code ending at a given character offset (exclusive).
1224
- 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.
1225
- The range will extend backwards to the start of the first line containing the selected statement.`, cliCategory: "Editor" }, requirePragma: { category: "Special", type: "boolean", default: false, 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: false, 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." }] } };
1226
- function it({ plugins: t = [], showDeprecated: e = false } = {}) {
1227
- let r = t.flatMap((u) => u.languages ?? []), n = [];
1228
- for (let u of No(Object.assign({}, ...t.map(({ options: o }) => o), Fn))) !e && u.deprecated || (Array.isArray(u.choices) && (e || (u.choices = u.choices.filter((o) => !o.deprecated)), u.name === "parser" && (u.choices = [...u.choices, ...To(u.choices, r, t)])), u.pluginDefaults = Object.fromEntries(t.filter((o) => {
1229
- var _a2;
1230
- return ((_a2 = o.defaultOptions) == null ? void 0 : _a2[u.name]) !== void 0;
1231
- }).map((o) => [o.name, o.defaultOptions[u.name]])), n.push(u));
1232
- return { languages: r, options: n };
1233
- }
1234
- function* To(t, e, r) {
1235
- let n = new Set(t.map((u) => u.value));
1236
- for (let u of e) if (u.parsers) {
1237
- for (let o of u.parsers) if (!n.has(o)) {
1238
- n.add(o);
1239
- let i = r.find((s) => s.parsers && le(s.parsers, o)), D = u.name;
1240
- (i == null ? void 0 : i.name) && (D += ` (plugin: ${i.name})`), yield { value: o, description: D };
1241
- }
1242
- }
1243
- }
1244
- function No(t) {
1245
- let e = [];
1246
- for (let [r, n] of Object.entries(t)) {
1247
- let u = { name: r, ...n };
1248
- Array.isArray(u.default) && (u.default = y(0, u.default, -1).value), e.push(u);
1249
- }
1250
- return e;
1251
- }
1252
- var wo = Array.prototype.toReversed ?? function() {
1253
- return [...this].reverse();
1254
- }, Oo = X("toReversed", function() {
1255
- if (Array.isArray(this)) return wo;
1256
- }), En = Oo;
1257
- function Po() {
1258
- var _a2, _b2, _c, _d, _e3;
1259
- let t = globalThis, e = (_a2 = t.process) == null ? void 0 : _a2.platform;
1260
- if (typeof e == "string") return e.startsWith("win");
1261
- let r = (_c = (_b2 = t.Deno) == null ? void 0 : _b2.build) == null ? void 0 : _c.os;
1262
- return typeof r == "string" ? r === "windows" : ((_e3 = (_d = t.navigator) == null ? void 0 : _d.platform) == null ? void 0 : _e3.startsWith("Win")) ?? false;
1263
- }
1264
- var So = Po();
1265
- function Cn(t) {
1266
- if (t = t instanceof URL ? t : new URL(t), t.protocol !== "file:") throw new TypeError(`URL must be a file URL: received "${t.protocol}"`);
1267
- return t;
1268
- }
1269
- function bo(t) {
1270
- return t = Cn(t), decodeURIComponent(t.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
1271
- }
1272
- function ko(t) {
1273
- t = Cn(t);
1274
- let e = decodeURIComponent(t.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
1275
- return t.hostname !== "" && (e = `\\\\${t.hostname}${e}`), e;
1276
- }
1277
- function Vt(t) {
1278
- return So ? ko(t) : bo(t);
1279
- }
1280
- var hn = (t) => String(t).split(/[/\\]/).pop(), gn = (t) => String(t).startsWith("file:");
1281
- function _n(t, e) {
1282
- if (!e) return;
1283
- let r = hn(e).toLowerCase();
1284
- return t.find(({ filenames: n }) => n == null ? void 0 : n.some((u) => u.toLowerCase() === r)) ?? t.find(({ extensions: n }) => n == null ? void 0 : n.some((u) => r.endsWith(u)));
1285
- }
1286
- function Io(t, e) {
1287
- if (e) return t.find(({ name: r }) => r.toLowerCase() === e) ?? t.find(({ aliases: r }) => r == null ? void 0 : r.includes(e)) ?? t.find(({ extensions: r }) => r == null ? void 0 : r.includes(`.${e}`));
1288
- }
1289
- var Ro = void 0;
1290
- function yn(t, e) {
1291
- if (e) {
1292
- if (gn(e)) try {
1293
- e = Vt(e);
1294
- } catch {
1295
- return;
1296
- }
1297
- if (typeof e == "string") return t.find(({ isSupported: r }) => r == null ? void 0 : r({ filepath: e }));
1298
- }
1299
- }
1300
- function vo(t, e) {
1301
- var _a2;
1302
- let r = En(0, t.plugins).flatMap((u) => u.languages ?? []);
1303
- return (_a2 = Io(r, e.language) ?? _n(r, e.physicalFile) ?? _n(r, e.file) ?? yn(r, e.physicalFile) ?? yn(r, e.file) ?? (Ro == null ? void 0 : Ro(r, e.physicalFile))) == null ? void 0 : _a2.parsers[0];
1304
- }
1305
- var st = vo;
1306
- var ie = { key: (t) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t) ? t : JSON.stringify(t), value(t) {
1307
- if (t === null || typeof t != "object") return JSON.stringify(t);
1308
- if (Array.isArray(t)) return `[${t.map((r) => ie.value(r)).join(", ")}]`;
1309
- let e = Object.keys(t);
1310
- return e.length === 0 ? "{}" : `{ ${e.map((r) => `${ie.key(r)}: ${ie.value(t[r])}`).join(", ")} }`;
1311
- }, pair: ({ key: t, value: e }) => ie.value({ [t]: e }) };
1312
- var An = new Proxy(String, { get: () => An }), z = An;
1313
- var xn = (t, e, { descriptor: r }) => {
1314
- let n = [`${z.yellow(typeof t == "string" ? r.key(t) : r.pair(t))} is deprecated`];
1315
- return e && n.push(`we now treat it as ${z.blue(typeof e == "string" ? r.key(e) : r.pair(e))}`), n.join("; ") + ".";
1316
- };
1317
- var Dt = Symbol.for("vnopts.VALUE_NOT_EXIST"), Ae = Symbol.for("vnopts.VALUE_UNCHANGED");
1318
- var Bn = " ".repeat(2), Nn = (t, e, r) => {
1319
- let { text: n, list: u } = r.normalizeExpectedResult(r.schemas[t].expected(r)), o = [];
1320
- return n && o.push(Tn(t, e, n, r.descriptor)), u && o.push([Tn(t, e, u.title, r.descriptor)].concat(u.values.map((i) => wn(i, r.loggerPrintWidth))).join(`
1321
- `)), On(o, r.loggerPrintWidth);
1322
- };
1323
- function Tn(t, e, r, n) {
1324
- return [`Invalid ${z.red(n.key(t))} value.`, `Expected ${z.blue(r)},`, `but received ${e === Dt ? z.gray("nothing") : z.red(n.value(e))}.`].join(" ");
1325
- }
1326
- function wn({ text: t, list: e }, r) {
1327
- let n = [];
1328
- return t && n.push(`- ${z.blue(t)}`), e && n.push([`- ${z.blue(e.title)}:`].concat(e.values.map((u) => wn(u, r - Bn.length).replace(/^|\n/g, `$&${Bn}`))).join(`
1329
- `)), On(n, r);
1330
- }
1331
- function On(t, e) {
1332
- if (t.length === 1) return t[0];
1333
- let [r, n] = t, [u, o] = t.map((i) => i.split(`
1334
- `, 1)[0].length);
1335
- return u > e && u > o ? n : r;
1336
- }
1337
- var xe = [], Wt = [];
1338
- function at(t, e, r) {
1339
- if (t === e) return 0;
1340
- let n = r == null ? void 0 : r.maxDistance, u = t;
1341
- t.length > e.length && (t = e, e = u);
1342
- let o = t.length, i = e.length;
1343
- for (; o > 0 && t.charCodeAt(~-o) === e.charCodeAt(~-i); ) o--, i--;
1344
- let D = 0;
1345
- for (; D < o && t.charCodeAt(D) === e.charCodeAt(D); ) D++;
1346
- if (o -= D, i -= D, n !== void 0 && i - o > n) return n;
1347
- if (o === 0) return n !== void 0 && i > n ? n : i;
1348
- let s, a, c, p, l = 0, m = 0;
1349
- for (; l < o; ) Wt[l] = t.charCodeAt(D + l), xe[l] = ++l;
1350
- for (; m < i; ) {
1351
- for (s = e.charCodeAt(D + m), c = m++, a = m, l = 0; l < o; l++) p = s === Wt[l] ? c : c + 1, c = xe[l], a = xe[l] = c > a ? p > a ? a + 1 : p : p > c ? c + 1 : p;
1352
- if (n !== void 0) {
1353
- let f = a;
1354
- for (l = 0; l < o; l++) xe[l] < f && (f = xe[l]);
1355
- if (f > n) return n;
1356
- }
1357
- }
1358
- return xe.length = o, Wt.length = o, n !== void 0 && a > n ? n : a;
1359
- }
1360
- function Pn(t, e, r) {
1361
- if (!Array.isArray(e) || e.length === 0) return;
1362
- let n = r == null ? void 0 : r.maxDistance, u = t.length;
1363
- for (let s of e) if (s === t) return s;
1364
- let o, i = Number.POSITIVE_INFINITY, D = /* @__PURE__ */ new Set();
1365
- for (let s of e) {
1366
- if (D.has(s)) continue;
1367
- D.add(s);
1368
- let a = Math.abs(s.length - u);
1369
- if (a >= i || a > n) continue;
1370
- let c = Number.isFinite(i) ? Math.min(i, n) : n, p = c === void 0 ? at(t, s) : at(t, s, { maxDistance: c });
1371
- if (p > n) continue;
1372
- let l = p;
1373
- if (c !== void 0 && p === c && c === n && (l = at(t, s)), l < i && (i = l, o = s, i === 0)) break;
1374
- }
1375
- if (!(i > n)) return o;
1376
- }
1377
- var ct = (t, e, { descriptor: r, logger: n, schemas: u }) => {
1378
- let o = [`Ignored unknown option ${z.yellow(r.pair({ key: t, value: e }))}.`], i = Pn(t, Object.keys(u), { maxDistance: 3 });
1379
- i && o.push(`Did you mean ${z.blue(r.key(i))}?`), n.warn(o.join(" "));
1380
- };
1381
- var Lo = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"];
1382
- function Mo(t, e) {
1383
- let r = new t(e), n = Object.create(r);
1384
- for (let u of Lo) u in e && (n[u] = Yo(e[u], r, O.prototype[u].length));
1385
- return n;
1386
- }
1387
- var O = class {
1388
- static create(e) {
1389
- return Mo(this, e);
1390
- }
1391
- constructor(e) {
1392
- this.name = e.name;
1393
- }
1394
- default(e) {
1395
- }
1396
- expected(e) {
1397
- return "nothing";
1398
- }
1399
- validate(e, r) {
1400
- return false;
1401
- }
1402
- deprecated(e, r) {
1403
- return false;
1404
- }
1405
- forward(e, r) {
1406
- }
1407
- redirect(e, r) {
1408
- }
1409
- overlap(e, r, n) {
1410
- return e;
1411
- }
1412
- preprocess(e, r) {
1413
- return e;
1414
- }
1415
- postprocess(e, r) {
1416
- return Ae;
1417
- }
1418
- };
1419
- function Yo(t, e, r) {
1420
- return typeof t == "function" ? (...n) => t(...n.slice(0, r - 1), e, ...n.slice(r - 1)) : () => t;
1421
- }
1422
- var ft = class extends O {
1423
- constructor(e) {
1424
- super(e), this._sourceName = e.sourceName;
1425
- }
1426
- expected(e) {
1427
- return e.schemas[this._sourceName].expected(e);
1428
- }
1429
- validate(e, r) {
1430
- return r.schemas[this._sourceName].validate(e, r);
1431
- }
1432
- redirect(e, r) {
1433
- return this._sourceName;
1434
- }
1435
- };
1436
- var lt = class extends O {
1437
- expected() {
1438
- return "anything";
1439
- }
1440
- validate() {
1441
- return true;
1442
- }
1443
- };
1444
- var pt = class extends O {
1445
- constructor({ valueSchema: e, name: r = e.name, ...n }) {
1446
- super({ ...n, name: r }), this._valueSchema = e;
1447
- }
1448
- expected(e) {
1449
- let { text: r, list: n } = e.normalizeExpectedResult(this._valueSchema.expected(e));
1450
- return { text: r && `an array of ${r}`, list: n && { title: "an array of the following values", values: [{ list: n }] } };
1451
- }
1452
- validate(e, r) {
1453
- if (!Array.isArray(e)) return false;
1454
- let n = [];
1455
- for (let u of e) {
1456
- let o = r.normalizeValidateResult(this._valueSchema.validate(u, r), u);
1457
- o !== true && n.push(o.value);
1458
- }
1459
- return n.length === 0 ? true : { value: n };
1460
- }
1461
- deprecated(e, r) {
1462
- let n = [];
1463
- for (let u of e) {
1464
- let o = r.normalizeDeprecatedResult(this._valueSchema.deprecated(u, r), u);
1465
- o !== false && n.push(...o.map(({ value: i }) => ({ value: [i] })));
1466
- }
1467
- return n;
1468
- }
1469
- forward(e, r) {
1470
- let n = [];
1471
- for (let u of e) {
1472
- let o = r.normalizeForwardResult(this._valueSchema.forward(u, r), u);
1473
- n.push(...o.map(Sn));
1474
- }
1475
- return n;
1476
- }
1477
- redirect(e, r) {
1478
- let n = [], u = [];
1479
- for (let o of e) {
1480
- let i = r.normalizeRedirectResult(this._valueSchema.redirect(o, r), o);
1481
- "remain" in i && n.push(i.remain), u.push(...i.redirect.map(Sn));
1482
- }
1483
- return n.length === 0 ? { redirect: u } : { redirect: u, remain: n };
1484
- }
1485
- overlap(e, r) {
1486
- return e.concat(r);
1487
- }
1488
- };
1489
- function Sn({ from: t, to: e }) {
1490
- return { from: [t], to: e };
1491
- }
1492
- var mt = class extends O {
1493
- expected() {
1494
- return "true or false";
1495
- }
1496
- validate(e) {
1497
- return typeof e == "boolean";
1498
- }
1499
- };
1500
- function kn(t, e) {
1501
- let r = /* @__PURE__ */ Object.create(null);
1502
- for (let n of t) {
1503
- let u = n[e];
1504
- if (r[u]) throw new Error(`Duplicate ${e} ${JSON.stringify(u)}`);
1505
- r[u] = n;
1506
- }
1507
- return r;
1508
- }
1509
- function In(t, e) {
1510
- let r = /* @__PURE__ */ new Map();
1511
- for (let n of t) {
1512
- let u = n[e];
1513
- if (r.has(u)) throw new Error(`Duplicate ${e} ${JSON.stringify(u)}`);
1514
- r.set(u, n);
1515
- }
1516
- return r;
1517
- }
1518
- function Rn() {
1519
- let t = /* @__PURE__ */ Object.create(null);
1520
- return (e) => {
1521
- let r = JSON.stringify(e);
1522
- return t[r] ? true : (t[r] = true, false);
1523
- };
1524
- }
1525
- function vn(t, e) {
1526
- let r = [], n = [];
1527
- for (let u of t) e(u) ? r.push(u) : n.push(u);
1528
- return [r, n];
1529
- }
1530
- function Ln(t) {
1531
- return t === Math.floor(t);
1532
- }
1533
- function Mn(t, e) {
1534
- if (t === e) return 0;
1535
- let r = typeof t, n = typeof e, u = ["undefined", "object", "boolean", "number", "string"];
1536
- return r !== n ? u.indexOf(r) - u.indexOf(n) : r !== "string" ? Number(t) - Number(e) : t.localeCompare(e);
1537
- }
1538
- function Yn(t) {
1539
- return (...e) => {
1540
- let r = t(...e);
1541
- return typeof r == "string" ? new Error(r) : r;
1542
- };
1543
- }
1544
- function $t(t) {
1545
- return t === void 0 ? {} : t;
1546
- }
1547
- function zt(t) {
1548
- if (typeof t == "string") return { text: t };
1549
- let { text: e, list: r } = t;
1550
- return jo((e || r) !== void 0, "Unexpected `expected` result, there should be at least one field."), r ? { text: e, list: { title: r.title, values: r.values.map(zt) } } : { text: e };
1551
- }
1552
- function Gt(t, e) {
1553
- return t === true ? true : t === false ? { value: e } : t;
1554
- }
1555
- function Kt(t, e, r = false) {
1556
- return t === false ? false : t === true ? r ? true : [{ value: e }] : "value" in t ? [t] : t.length === 0 ? false : t;
1557
- }
1558
- function bn(t, e) {
1559
- return typeof t == "string" || "key" in t ? { from: e, to: t } : "from" in t ? { from: t.from, to: t.to } : { from: e, to: t.to };
1560
- }
1561
- function dt(t, e) {
1562
- return t === void 0 ? [] : Array.isArray(t) ? t.map((r) => bn(r, e)) : [bn(t, e)];
1563
- }
1564
- function Ht(t, e) {
1565
- let r = dt(typeof t == "object" && "redirect" in t ? t.redirect : t, e);
1566
- return r.length === 0 ? { remain: e, redirect: r } : typeof t == "object" && "remain" in t ? { remain: t.remain, redirect: r } : { redirect: r };
1567
- }
1568
- function jo(t, e) {
1569
- if (!t) throw new Error(e);
1570
- }
1571
- var Ft = class extends O {
1572
- constructor(e) {
1573
- super(e), this._choices = In(e.choices.map((r) => r && typeof r == "object" ? r : { value: r }), "value");
1574
- }
1575
- expected({ descriptor: e }) {
1576
- let r = Array.from(this._choices.keys()).map((i) => this._choices.get(i)).filter(({ hidden: i }) => !i).map((i) => i.value).sort(Mn).map(e.value), n = r.slice(0, -2), u = r.slice(-2);
1577
- return { text: n.concat(u.join(" or ")).join(", "), list: { title: "one of the following values", values: r } };
1578
- }
1579
- validate(e) {
1580
- return this._choices.has(e);
1581
- }
1582
- deprecated(e) {
1583
- let r = this._choices.get(e);
1584
- return r && r.deprecated ? { value: e } : false;
1585
- }
1586
- forward(e) {
1587
- let r = this._choices.get(e);
1588
- return r ? r.forward : void 0;
1589
- }
1590
- redirect(e) {
1591
- let r = this._choices.get(e);
1592
- return r ? r.redirect : void 0;
1593
- }
1594
- };
1595
- var Et = class extends O {
1596
- expected() {
1597
- return "a number";
1598
- }
1599
- validate(e, r) {
1600
- return typeof e == "number";
1601
- }
1602
- };
1603
- var Ct = class extends Et {
1604
- expected() {
1605
- return "an integer";
1606
- }
1607
- validate(e, r) {
1608
- return r.normalizeValidateResult(super.validate(e, r), e) === true && Ln(e);
1609
- }
1610
- };
1611
- var Ye = class extends O {
1612
- expected() {
1613
- return "a string";
1614
- }
1615
- validate(e) {
1616
- return typeof e == "string";
1617
- }
1618
- };
1619
- var jn = ie, Un = ct, Vn = Nn, Wn = xn;
1620
- var ht = class {
1621
- constructor(e, r) {
1622
- let { logger: n = console, loggerPrintWidth: u = 80, descriptor: o = jn, unknown: i = Un, invalid: D = Vn, deprecated: s = Wn, missing: a = () => false, required: c = () => false, preprocess: p = (m) => m, postprocess: l = () => Ae } = r || {};
1623
- this._utils = { descriptor: o, logger: n || { warn: () => {
1624
- } }, loggerPrintWidth: u, schemas: kn(e, "name"), normalizeDefaultResult: $t, normalizeExpectedResult: zt, normalizeDeprecatedResult: Kt, normalizeForwardResult: dt, normalizeRedirectResult: Ht, normalizeValidateResult: Gt }, this._unknownHandler = i, this._invalidHandler = Yn(D), this._deprecatedHandler = s, this._identifyMissing = (m, f) => !(m in f) || a(m, f), this._identifyRequired = c, this._preprocess = p, this._postprocess = l, this.cleanHistory();
1625
- }
1626
- cleanHistory() {
1627
- this._hasDeprecationWarned = Rn();
1628
- }
1629
- normalize(e) {
1630
- let r = {}, u = [this._preprocess(e, this._utils)], o = () => {
1631
- for (; u.length !== 0; ) {
1632
- let i = u.shift(), D = this._applyNormalization(i, r);
1633
- u.push(...D);
1634
- }
1635
- };
1636
- o();
1637
- for (let i of Object.keys(this._utils.schemas)) {
1638
- let D = this._utils.schemas[i];
1639
- if (!(i in r)) {
1640
- let s = $t(D.default(this._utils));
1641
- "value" in s && u.push({ [i]: s.value });
1642
- }
1643
- }
1644
- o();
1645
- for (let i of Object.keys(this._utils.schemas)) {
1646
- if (!(i in r)) continue;
1647
- let D = this._utils.schemas[i], s = r[i], a = D.postprocess(s, this._utils);
1648
- a !== Ae && (this._applyValidation(a, i, D), r[i] = a);
1649
- }
1650
- return this._applyPostprocess(r), this._applyRequiredCheck(r), r;
1651
- }
1652
- _applyNormalization(e, r) {
1653
- let n = [], { knownKeys: u, unknownKeys: o } = this._partitionOptionKeys(e);
1654
- for (let i of u) {
1655
- let D = this._utils.schemas[i], s = D.preprocess(e[i], this._utils);
1656
- this._applyValidation(s, i, D);
1657
- let a = ({ from: m, to: f }) => {
1658
- n.push(typeof f == "string" ? { [f]: m } : { [f.key]: f.value });
1659
- }, c = ({ value: m, redirectTo: f }) => {
1660
- let F = Kt(D.deprecated(m, this._utils), s, true);
1661
- if (F !== false) if (F === true) this._hasDeprecationWarned(i) || this._utils.logger.warn(this._deprecatedHandler(i, f, this._utils));
1662
- else for (let { value: d } of F) {
1663
- let E = { key: i, value: d };
1664
- if (!this._hasDeprecationWarned(E)) {
1665
- let C = typeof f == "string" ? { key: f, value: d } : f;
1666
- this._utils.logger.warn(this._deprecatedHandler(E, C, this._utils));
1667
- }
1668
- }
1669
- };
1670
- dt(D.forward(s, this._utils), s).forEach(a);
1671
- let l = Ht(D.redirect(s, this._utils), s);
1672
- if (l.redirect.forEach(a), "remain" in l) {
1673
- let m = l.remain;
1674
- r[i] = i in r ? D.overlap(r[i], m, this._utils) : m, c({ value: m });
1675
- }
1676
- for (let { from: m, to: f } of l.redirect) c({ value: m, redirectTo: f });
1677
- }
1678
- for (let i of o) {
1679
- let D = e[i];
1680
- this._applyUnknownHandler(i, D, r, (s, a) => {
1681
- n.push({ [s]: a });
1682
- });
1683
- }
1684
- return n;
1685
- }
1686
- _applyRequiredCheck(e) {
1687
- for (let r of Object.keys(this._utils.schemas)) if (this._identifyMissing(r, e) && this._identifyRequired(r)) throw this._invalidHandler(r, Dt, this._utils);
1688
- }
1689
- _partitionOptionKeys(e) {
1690
- let [r, n] = vn(Object.keys(e).filter((u) => !this._identifyMissing(u, e)), (u) => u in this._utils.schemas);
1691
- return { knownKeys: r, unknownKeys: n };
1692
- }
1693
- _applyValidation(e, r, n) {
1694
- let u = Gt(n.validate(e, this._utils), e);
1695
- if (u !== true) throw this._invalidHandler(r, u.value, this._utils);
1696
- }
1697
- _applyUnknownHandler(e, r, n, u) {
1698
- let o = this._unknownHandler(e, r, this._utils);
1699
- if (o) for (let i of Object.keys(o)) {
1700
- if (this._identifyMissing(i, o)) continue;
1701
- let D = o[i];
1702
- i in this._utils.schemas ? u(i, D) : n[i] = D;
1703
- }
1704
- }
1705
- _applyPostprocess(e) {
1706
- let r = this._postprocess(e, this._utils);
1707
- if (r !== Ae) {
1708
- if (r.delete) for (let n of r.delete) delete e[n];
1709
- if (r.override) {
1710
- let { knownKeys: n, unknownKeys: u } = this._partitionOptionKeys(r.override);
1711
- for (let o of n) {
1712
- let i = r.override[o];
1713
- this._applyValidation(i, o, this._utils.schemas[o]), e[o] = i;
1714
- }
1715
- for (let o of u) {
1716
- let i = r.override[o];
1717
- this._applyUnknownHandler(o, i, e, (D, s) => {
1718
- let a = this._utils.schemas[D];
1719
- this._applyValidation(s, D, a), e[D] = s;
1720
- });
1721
- }
1722
- }
1723
- }
1724
- }
1725
- };
1726
- var Jt;
1727
- function Uo(t, e, { logger: r = false, isCLI: n = false, passThrough: u = false, FlagSchema: o, descriptor: i } = {}) {
1728
- if (n) {
1729
- if (!o) throw new Error("'FlagSchema' option is required.");
1730
- if (!i) throw new Error("'descriptor' option is required.");
1731
- } else i = ie;
1732
- let D = u ? Array.isArray(u) ? (l, m) => u.includes(l) ? { [l]: m } : void 0 : (l, m) => ({ [l]: m }) : (l, m, f) => {
1733
- let { _: F, ...d } = f.schemas;
1734
- return ct(l, m, { ...f, schemas: d });
1735
- }, s = Vo(e, { isCLI: n, FlagSchema: o }), a = new ht(s, { logger: r, unknown: D, descriptor: i }), c = r !== false;
1736
- c && Jt && (a._hasDeprecationWarned = Jt);
1737
- let p = a.normalize(t);
1738
- return c && (Jt = a._hasDeprecationWarned), p;
1739
- }
1740
- function Vo(t, { isCLI: e, FlagSchema: r }) {
1741
- let n = [];
1742
- e && n.push(lt.create({ name: "_" }));
1743
- for (let u of t) n.push(Wo(u, { isCLI: e, optionInfos: t, FlagSchema: r })), u.alias && e && n.push(ft.create({ name: u.alias, sourceName: u.name }));
1744
- return n;
1745
- }
1746
- function Wo(t, { isCLI: e, optionInfos: r, FlagSchema: n }) {
1747
- let { name: u } = t, o = { name: u }, i, D = {};
1748
- switch (t.type) {
1749
- case "int":
1750
- i = Ct, e && (o.preprocess = Number);
1751
- break;
1752
- case "string":
1753
- i = Ye;
1754
- break;
1755
- case "choice":
1756
- i = Ft, o.choices = t.choices.map((s) => (s == null ? void 0 : s.redirect) ? { ...s, redirect: { to: { key: t.name, value: s.redirect } } } : s);
1757
- break;
1758
- case "boolean":
1759
- i = mt;
1760
- break;
1761
- case "flag":
1762
- i = n, o.flags = r.flatMap((s) => [s.alias, s.description && s.name, s.oppositeDescription && `no-${s.name}`].filter(Boolean));
1763
- break;
1764
- case "path":
1765
- i = Ye;
1766
- break;
1767
- default:
1768
- throw new Error(`Unexpected type ${t.type}`);
1769
- }
1770
- if (t.exception ? o.validate = (s, a, c) => t.exception(s) || a.validate(s, c) : o.validate = (s, a, c) => s === void 0 || a.validate(s, c), t.redirect && (D.redirect = (s) => s ? { to: typeof t.redirect == "string" ? t.redirect : { key: t.redirect.option, value: t.redirect.value } } : void 0), t.deprecated && (D.deprecated = true), e && !t.array) {
1771
- let s = o.preprocess || ((a) => a);
1772
- o.preprocess = (a, c, p) => c.preprocess(s(Array.isArray(a) ? y(0, a, -1) : a), p);
1773
- }
1774
- return t.array ? pt.create({ ...e ? { preprocess: (s) => Array.isArray(s) ? s : [s] } : {}, ...D, valueSchema: i.create(o) }) : i.create({ ...o, ...D });
1775
- }
1776
- var $n = Uo;
1777
- var $o = Array.prototype.findLast ?? function(t) {
1778
- for (let e = this.length - 1; e >= 0; e--) {
1779
- let r = this[e];
1780
- if (t(r, e, this)) return r;
1781
- }
1782
- }, zo = X("findLast", function() {
1783
- if (Array.isArray(this)) return $o;
1784
- }), qt = zo;
1785
- var zn = Symbol.for("PRETTIER_IS_FRONT_MATTER"), Xt = [];
1786
- function Go(t) {
1787
- return !!(t == null ? void 0 : t[zn]);
1788
- }
1789
- var pe = Go;
1790
- var Gn = /* @__PURE__ */ new Set(["yaml", "toml"]), je = ({ node: t }) => pe(t) && Gn.has(t.language);
1791
- async function Qt(t, e, r, n) {
1792
- let { node: u } = r, { language: o } = u;
1793
- if (!Gn.has(o)) return;
1794
- let i = u.value.trim(), D;
1795
- if (i) {
1796
- let s = o === "yaml" ? o : st(n, { language: o });
1797
- if (!s) return;
1798
- D = i ? await t(i, { parser: s }) : "";
1799
- } else D = i;
1800
- return Xe([u.startDelimiter, u.explicitLanguage ?? "", W, D, D ? W : "", u.endDelimiter]);
1801
- }
1802
- function Ko(t, e) {
1803
- return je({ node: t }) && (delete e.end, delete e.raw, delete e.value), e;
1804
- }
1805
- var Zt = Ko;
1806
- function Ho({ node: t }) {
1807
- return t.raw;
1808
- }
1809
- var er = Ho;
1810
- var Kn = /* @__PURE__ */ new Set(["tokens", "comments", "parent", "enclosingNode", "precedingNode", "followingNode"]), Jo = (t) => Object.keys(t).filter((e) => !Kn.has(e));
1811
- function qo(t, e) {
1812
- let r = t ? (n) => t(n, Kn) : Jo;
1813
- return e ? new Proxy(r, { apply: (n, u, o) => pe(o[0]) ? Xt : Reflect.apply(n, u, o) }) : r;
1814
- }
1815
- var tr = qo;
1816
- function rr(t, e) {
1817
- if (!e) throw new Error("parserName is required.");
1818
- let r = qt(0, t, (u) => u.parsers && le(u.parsers, e));
1819
- if (r) return r;
1820
- let n = `Couldn't resolve parser "${e}".`;
1821
- throw n += " Plugins must be explicitly added to the standalone bundle.", new Le(n);
1822
- }
1823
- function Hn(t, e) {
1824
- if (!e) throw new Error("astFormat is required.");
1825
- let r = qt(0, t, (u) => u.printers && le(u.printers, e));
1826
- if (r) return r;
1827
- let n = `Couldn't find plugin for AST format "${e}".`;
1828
- throw n += " Plugins must be explicitly added to the standalone bundle.", new Le(n);
1829
- }
1830
- function Ue({ plugins: t, parser: e }) {
1831
- let r = rr(t, e);
1832
- return nr(r, e);
1833
- }
1834
- function nr(t, e) {
1835
- let r = t.parsers[e];
1836
- return typeof r == "function" ? r() : r;
1837
- }
1838
- async function Jn(t, e) {
1839
- let r = t.printers[e], n = typeof r == "function" ? await r() : r;
1840
- return Zo(n);
1841
- }
1842
- function Xo(t) {
1843
- let { features: e, getVisitorKeys: r, embed: n, massageAstNode: u, print: o, ...i } = t;
1844
- e = ni(e);
1845
- let D = e.experimental_frontMatterSupport;
1846
- r = tr(r, D.massageAstNode || D.embed || D.print);
1847
- let s = u;
1848
- u && D.massageAstNode && (s = new Proxy(u, { apply(l, m, f) {
1849
- return Zt(...f), Reflect.apply(l, m, f);
1850
- } }));
1851
- let a = n;
1852
- if (n) {
1853
- let l;
1854
- a = new Proxy(n, { get(m, f, F) {
1855
- return f === "getVisitorKeys" ? (l ?? (l = n.getVisitorKeys ? tr(n.getVisitorKeys, D.massageAstNode || D.embed) : r), l) : Reflect.get(m, f, F);
1856
- }, apply: (m, f, F) => D.embed && je(...F) ? Qt : Reflect.apply(m, f, F) });
1857
- }
1858
- let c = o;
1859
- return D.print && (c = new Proxy(o, { apply(l, m, f) {
1860
- let [F] = f;
1861
- return pe(F.node) ? er(F) : Reflect.apply(l, m, f);
1862
- } })), { features: e, getVisitorKeys: r, embed: a, massageAstNode: s, print: c, ...i };
1863
- }
1864
- var Qo = /* @__PURE__ */ new WeakMap();
1865
- function Zo(t) {
1866
- return Fe(Qo, t, Xo);
1867
- }
1868
- var ei = ["clean", "embed", "print"], ti = Object.fromEntries(ei.map((t) => [t, false]));
1869
- function ri(t) {
1870
- return { ...ti, ...t };
1871
- }
1872
- function ni(t) {
1873
- return { experimental_avoidAstMutation: false, ...t, experimental_frontMatterSupport: ri(t == null ? void 0 : t.experimental_frontMatterSupport) };
1874
- }
1875
- var qn = { astFormat: "estree", printer: {}, originalText: void 0, locStart: null, locEnd: null, getVisitorKeys: null };
1876
- async function ui(t, e = {}) {
1877
- var _a2;
1878
- let r = { ...t };
1879
- if (!r.parser) {
1880
- if (!r.filepath) throw new Me("No parser and no file path given, couldn't infer a parser.");
1881
- if (r.parser = st(r, { physicalFile: r.filepath }), !r.parser) throw new Me(`No parser could be inferred for file "${r.filepath}".`);
1882
- }
1883
- let n = it({ plugins: t.plugins, showDeprecated: true }).options, u = { ...qn, ...Object.fromEntries(n.filter((p) => p.default !== void 0).map((p) => [p.name, p.default])) }, o = rr(r.plugins, r.parser), i = await nr(o, r.parser);
1884
- r.astFormat = i.astFormat, r.locEnd = i.locEnd, r.locStart = i.locStart;
1885
- let D = ((_a2 = o.printers) == null ? void 0 : _a2[i.astFormat]) ? o : Hn(r.plugins, i.astFormat), s = await Jn(D, i.astFormat);
1886
- r.printer = s, r.getVisitorKeys = s.getVisitorKeys;
1887
- let a = D.defaultOptions ? Object.fromEntries(Object.entries(D.defaultOptions).filter(([, p]) => p !== void 0)) : {}, c = { ...u, ...a };
1888
- for (let [p, l] of Object.entries(c)) r[p] ?? (r[p] = l);
1889
- return r.parser === "json" && (r.trailingComma = "none"), $n(r, n, { passThrough: Object.keys(qn), ...e });
1890
- }
1891
- var se = ui;
1892
- var Xn = /\r\n|[\n\r\u2028\u2029]/;
1893
- function oi(t, e, r, n) {
1894
- let u = { column: null, line: -1, ...t.start }, o = { ...u, ...t.end }, { linesAbove: i = 2, linesBelow: D = 3 } = r || {}, s = u.line - n, a = u.column, c = o.line - n, p = o.column, l = Math.max(s - (i + 1), 0), m = Math.min(e.length, c + D);
1895
- s === -1 && (l = 0), c === -1 && (m = e.length);
1896
- let f = c - s, F = {};
1897
- if (f) for (let d = 0; d <= f; d++) {
1898
- let E = d + s;
1899
- if (a == null) F[E] = true;
1900
- else if (d === 0) {
1901
- let C = e[E - 1].length;
1902
- F[E] = [a, C - a];
1903
- } else if (d === f) F[E] = [0, p];
1904
- else {
1905
- let C = e[E - 1].length;
1906
- F[E] = [0, C];
1907
- }
1908
- }
1909
- else if (a === p) a != null ? F[s] = [a, 0] : F[s] = true;
1910
- else {
1911
- let d = a ?? 0, E = p ?? d;
1912
- F[s] = [d, E - d];
1913
- }
1914
- return { start: l, end: m, markerLines: F };
1915
- }
1916
- function Qn(t, e, r = {}, n) {
1917
- let { defs: u, highlight: o } = { defs: { gutter: String, marker: String, message: String, reset: String }, highlight: String }, i = (r.startLine || 1) - 1, D = t.split(Xn), { start: s, end: a, markerLines: c } = oi(e, D, r, i), p = e.start && typeof e.start.column == "number", l = String(a + i).length, f = o(t).split(Xn, a).slice(s, a).map((F, d) => {
1918
- let E = s + 1 + d, h = ` ${` ${E + i}`.slice(-l)} |`, _ = c[E], P = !c[E + 1];
1919
- if (_) {
1920
- let A = "";
1921
- if (Array.isArray(_)) {
1922
- let B = F.slice(0, _[0]).replace(/[^\t]/g, " "), J = _[1] || 1;
1923
- A = [`
1924
- `, u.gutter(h.replace(/\d/g, " ")), " ", B, u.marker("^").repeat(J)].join(""), P && r.message && (A += " " + u.message(r.message));
1925
- }
1926
- return [u.marker(">"), u.gutter(h), F.length > 0 ? ` ${F}` : "", A].join("");
1927
- } else return ` ${u.gutter(h)}${F.length > 0 ? ` ${F}` : ""}`;
1928
- }).join(`
1929
- `);
1930
- return r.message && !p && (f = `${" ".repeat(l + 1)}${r.message}
1931
- ${f}`), u.reset(f);
1932
- }
1933
- function Zn(t, e, r = {}) {
1934
- return Qn(t, e, r);
1935
- }
1936
- async function ii(t, e) {
1937
- let r = await Ue(e), n = r.preprocess ? await r.preprocess(t, e) : t;
1938
- e.originalText = n;
1939
- let u;
1940
- try {
1941
- u = await r.parse(n, e, e);
1942
- } catch (o) {
1943
- si(o, t);
1944
- }
1945
- return { text: n, ast: u };
1946
- }
1947
- function si(t, e) {
1948
- let { loc: r } = t;
1949
- if (r) {
1950
- let { start: n, end: u } = r;
1951
- n && (n = { line: n.line, column: n.column - 1 }), u && (u = { line: u.line, column: u.column - 1 });
1952
- let o = Zn(e, { start: n, end: u }, {});
1953
- t.message += `
1954
- ` + o, t.codeFrame = o;
1955
- }
1956
- throw t;
1957
- }
1958
- var me = ii;
1959
- async function eu(t, e, r, n, u) {
1960
- if (r.embeddedLanguageFormatting !== "auto") return;
1961
- let { printer: o } = r, { embed: i } = o;
1962
- if (!i) return;
1963
- 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");
1964
- let { hasPrettierIgnore: D } = o, { getVisitorKeys: s } = i, a = [];
1965
- l();
1966
- let c = t.stack;
1967
- for (let { print: m, node: f, pathStack: F } of a) try {
1968
- t.stack = F;
1969
- let d = await m(p, e, t, r);
1970
- d && u.set(f, d);
1971
- } catch (d) {
1972
- if (globalThis.PRETTIER_DEBUG) throw d;
1973
- }
1974
- t.stack = c;
1975
- function p(m, f) {
1976
- return Di(m, f, r, n);
1977
- }
1978
- function l() {
1979
- let { node: m } = t;
1980
- if (m === null || typeof m != "object" || (D == null ? void 0 : D(t))) return;
1981
- for (let F of s(m)) Array.isArray(m[F]) ? t.each(l, F) : t.call(l, F);
1982
- let f = i(t, r);
1983
- if (f) {
1984
- if (typeof f == "function") {
1985
- a.push({ print: f, node: m, pathStack: [...t.stack] });
1986
- return;
1987
- }
1988
- u.set(m, f);
1989
- }
1990
- }
1991
- }
1992
- async function Di(t, e, r, n) {
1993
- let u = await se({ ...r, ...e, parentParser: r.parser, originalText: t, cursorOffset: void 0, rangeStart: void 0, rangeEnd: void 0 }, { passThrough: true }), { ast: o } = await me(t, u), i = await n(o, u);
1994
- return He(i);
1995
- }
1996
- function ai(t, e, r, n) {
1997
- let { originalText: u, [ue]: o, locStart: i, locEnd: D, [Symbol.for("printedComments")]: s } = e, { node: a } = t, c = i(a), p = D(a);
1998
- for (let m of o) i(m) >= c && D(m) <= p && s.add(m);
1999
- let { printPrettierIgnored: l } = e.printer;
2000
- return l ? l(t, e, r, n) : u.slice(c, p);
2001
- }
2002
- var tu = ai;
2003
- async function Ve(t, e) {
2004
- ({ ast: t } = await ur(t, e));
2005
- let r = /* @__PURE__ */ new Map(), n = new en(t), o = /* @__PURE__ */ new Map();
2006
- await eu(n, D, e, Ve, o);
2007
- let i = await ru(n, e, D, void 0, o);
2008
- if (mn(e), e.cursorOffset >= 0) {
2009
- if (e.nodeAfterCursor && !e.nodeBeforeCursor) return [ee, i];
2010
- if (e.nodeBeforeCursor && !e.nodeAfterCursor) return [i, ee];
2011
- }
2012
- return i;
2013
- function D(a, c) {
2014
- return a === void 0 || a === n ? s(c) : Array.isArray(a) ? n.call(() => s(c), ...a) : n.call(() => s(c), a);
2015
- }
2016
- function s(a) {
2017
- let c = n.node;
2018
- if (c == null) return "";
2019
- let p = ge(c) && a === void 0;
2020
- if (p && r.has(c)) return r.get(c);
2021
- let l = ru(n, e, D, a, o);
2022
- return p && r.set(c, l), l;
2023
- }
2024
- }
2025
- function ru(t, e, r, n, u) {
2026
- var _a2, _b2;
2027
- let { node: o } = t, { printer: i } = e, D;
2028
- switch (((_a2 = i.hasPrettierIgnore) == null ? void 0 : _a2.call(i, t)) ? D = tu(t, e, r, n) : u.has(o) ? D = u.get(o) : D = i.print(t, e, r, n), o) {
2029
- case e.cursorNode:
2030
- D = Ee(D, (s) => [ee, s, ee]);
2031
- break;
2032
- case e.nodeBeforeCursor:
2033
- D = Ee(D, (s) => [s, ee]);
2034
- break;
2035
- case e.nodeAfterCursor:
2036
- D = Ee(D, (s) => [ee, s]);
2037
- break;
2038
- }
2039
- return i.printComment && rt(o.comments) && !((_b2 = i.willPrintOwnComments) == null ? void 0 : _b2.call(i, t, e)) && (D = pn(t, D, e)), D;
2040
- }
2041
- async function ur(t, e) {
2042
- let r = t.comments ?? [];
2043
- e[ue] = r, e[Symbol.for("printedComments")] = /* @__PURE__ */ new Set(), an(t, e);
2044
- let { printer: { preprocess: n } } = e;
2045
- return t = n ? await n(t, e) : t, { ast: t, comments: r };
2046
- }
2047
- function ci(t, e) {
2048
- let { cursorOffset: r, locStart: n, locEnd: u, getVisitorKeys: o } = e, i = (m) => n(m) <= r && u(m) >= r, D = t, s = [t];
2049
- for (let m of nn(t, { getVisitorKeys: o, filter: i })) s.push(m), D = m;
2050
- if (un(D, { getVisitorKeys: o })) return { cursorNode: D };
2051
- let a, c, p = -1, l = Number.POSITIVE_INFINITY;
2052
- for (; s.length > 0 && (a === void 0 || c === void 0); ) {
2053
- D = s.pop();
2054
- let m = a !== void 0, f = c !== void 0;
2055
- for (let F of ye(D, { getVisitorKeys: o })) {
2056
- if (!m) {
2057
- let d = u(F);
2058
- d <= r && d > p && (a = F, p = d);
2059
- }
2060
- if (!f) {
2061
- let d = n(F);
2062
- d >= r && d < l && (c = F, l = d);
2063
- }
2064
- }
2065
- }
2066
- return { nodeBeforeCursor: a, nodeAfterCursor: c };
2067
- }
2068
- var or = ci;
2069
- function fi(t, e) {
2070
- let { printer: r } = e, n = r.massageAstNode;
2071
- if (!n) return t;
2072
- let { getVisitorKeys: u } = r, { ignoredProperties: o } = n;
2073
- return i(t);
2074
- function i(D, s) {
2075
- if (!ge(D)) return D;
2076
- if (Array.isArray(D)) return D.map((l) => i(l, s)).filter(Boolean);
2077
- let a = {}, c = new Set(u(D));
2078
- for (let l in D) !le(D, l) || (o == null ? void 0 : o.has(l)) || (c.has(l) ? a[l] = i(D[l], D) : a[l] = D[l]);
2079
- let p = n(D, a, s);
2080
- if (p !== null) return p ?? a;
2081
- }
2082
- }
2083
- var nu = fi;
2084
- var li = Array.prototype.findLastIndex ?? function(t) {
2085
- for (let e = this.length - 1; e >= 0; e--) {
2086
- let r = this[e];
2087
- if (t(r, e, this)) return e;
2088
- }
2089
- return -1;
2090
- }, pi = X("findLastIndex", function() {
2091
- if (Array.isArray(this)) return li;
2092
- }), uu = pi;
2093
- function mi(t, e) {
2094
- return e = new Set(e), t.find((r) => su.has(r.type) && e.has(r));
2095
- }
2096
- function ou(t) {
2097
- let e = uu(0, t, (r) => r.type !== "Program" && r.type !== "File");
2098
- return e === -1 ? t : t.slice(0, e + 1);
2099
- }
2100
- function di(t, e, { locStart: r, locEnd: n }) {
2101
- let [u, ...o] = t, [i, ...D] = e;
2102
- if (u === i) return [u, i];
2103
- let s = r(u);
2104
- for (let c of ou(D)) if (r(c) >= s) i = c;
2105
- else break;
2106
- let a = n(i);
2107
- for (let c of ou(o)) {
2108
- if (n(c) <= a) u = c;
2109
- else break;
2110
- if (u === i) break;
2111
- }
2112
- return [u, i];
2113
- }
2114
- function ir(t, e, r, n, u = [], o, i) {
2115
- let { locStart: D, locEnd: s } = i, a = D(t), c = s(t);
2116
- if (e > c || e < a || o === "rangeEnd" && e === a || o === "rangeStart" && e === c) return;
2117
- let p = [t, ...u], l = ot(t, p, { cache: Ut, locStart: D, locEnd: s, getVisitorKeys: r.getVisitorKeys, filter: r.printer.canAttachComment, getChildren: r.printer.getCommentChildNodes });
2118
- for (let m of l) {
2119
- let f = ir(m, e, r, n, p, o, i);
2120
- if (f) return f;
2121
- }
2122
- if (n(t, u[0])) return p;
2123
- }
2124
- function Fi(t, e) {
2125
- return e !== "DeclareExportDeclaration" && t !== "TypeParameterDeclaration" && (t === "Directive" || t === "TypeAlias" || t === "TSExportAssignment" || t.startsWith("Declare") || t.startsWith("TSDeclare") || t.endsWith("Statement") || t.endsWith("Declaration"));
2126
- }
2127
- var su = /* @__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"]);
2128
- function iu(t, e, r) {
2129
- if (!e) return false;
2130
- switch (t.parser) {
2131
- case "flow":
2132
- case "hermes":
2133
- case "babel":
2134
- case "babel-flow":
2135
- case "babel-ts":
2136
- case "typescript":
2137
- case "acorn":
2138
- case "espree":
2139
- case "meriyah":
2140
- case "oxc":
2141
- case "oxc-ts":
2142
- case "yuku":
2143
- case "yuku-ts":
2144
- case "__babel_estree":
2145
- return Fi(e.type, r == null ? void 0 : r.type);
2146
- case "json":
2147
- case "json5":
2148
- case "jsonc":
2149
- case "json-stringify":
2150
- return su.has(e.type);
2151
- case "graphql":
2152
- return Ei.has(e.kind);
2153
- case "vue":
2154
- return e.tag !== "root";
2155
- }
2156
- return false;
2157
- }
2158
- function Du(t, e, r) {
2159
- var _a2;
2160
- let { rangeStart: n, rangeEnd: u } = e;
2161
- let o = t.slice(n, u).search(/\S/), i = o === -1;
2162
- if (!i) for (n += o; u > n && !/\S/.test(t[u - 1]); --u) ;
2163
- let D = ((_a2 = e.printer.features) == null ? void 0 : _a2.experimental_locForRangeFormat) ?? e, s = ir(r, n, e, (f, F) => iu(e, f, F), [], "rangeStart", D);
2164
- if (!s) return;
2165
- let a = i ? s : ir(r, u, e, (f) => iu(e, f), [], "rangeEnd", D);
2166
- if (!a) return;
2167
- let c, p;
2168
- if (r.type === "JsonRoot") {
2169
- let f = mi(s, a);
2170
- c = f, p = f;
2171
- } else [c, p] = di(s, a, e);
2172
- let { locStart: l, locEnd: m } = D;
2173
- return [Math.min(l(c), l(p)), Math.max(m(c), m(p))];
2174
- }
2175
- var lu = "\uFEFF", au = Symbol("cursor");
2176
- async function pu(t, e, r = 0) {
2177
- if (!t || t.trim().length === 0) return { formatted: "", cursorOffset: -1, comments: [] };
2178
- let { ast: n, text: u } = await me(t, e);
2179
- e.cursorOffset >= 0 && (e = { ...e, ...or(n, e) });
2180
- let o = await Ve(n, e);
2181
- r > 0 && (o = Qe([W, o], r, e.tabWidth));
2182
- let i = Ce(o, e);
2183
- if (r > 0) {
2184
- let s = i.formatted.trim();
2185
- i.cursorNodeStart !== void 0 && (i.cursorNodeStart -= i.formatted.indexOf(s), i.cursorNodeStart < 0 && (i.cursorNodeStart = 0, i.cursorNodeText = i.cursorNodeText.trimStart()), i.cursorNodeStart + i.cursorNodeText.length > s.length && (i.cursorNodeText = i.cursorNodeText.trimEnd())), i.formatted = s + we(e.endOfLine);
2186
- }
2187
- let D = e[ue];
2188
- if (e.cursorOffset >= 0) {
2189
- let s, a, c, p;
2190
- if ((e.cursorNode || e.nodeBeforeCursor || e.nodeAfterCursor) && i.cursorNodeText) if (c = i.cursorNodeStart, p = i.cursorNodeText, e.cursorNode) s = e.locStart(e.cursorNode), a = u.slice(s, e.locEnd(e.cursorNode));
2191
- else {
2192
- if (!e.nodeBeforeCursor && !e.nodeAfterCursor) throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");
2193
- s = e.nodeBeforeCursor ? e.locEnd(e.nodeBeforeCursor) : 0;
2194
- let E = e.nodeAfterCursor ? e.locStart(e.nodeAfterCursor) : u.length;
2195
- a = u.slice(s, E);
2196
- }
2197
- else s = 0, a = u, c = 0, p = i.formatted;
2198
- let l = e.cursorOffset - s;
2199
- if (a === p) return { formatted: i.formatted, cursorOffset: c + l, comments: D };
2200
- let m = a.split("");
2201
- m.splice(l, 0, au);
2202
- let f = p.split(""), F = xt(m, f), d = c;
2203
- for (let E of F) if (E.removed) {
2204
- if (E.value.includes(au)) break;
2205
- } else d += E.count;
2206
- return { formatted: i.formatted, cursorOffset: d, comments: D };
2207
- }
2208
- return { formatted: i.formatted, cursorOffset: -1, comments: D };
2209
- }
2210
- async function Ci(t, e) {
2211
- let { ast: r, text: n } = await me(t, e), [u, o] = Du(n, e, r) ?? [0, 0], i = n.slice(u, o), D = Math.min(u, n.lastIndexOf(`
2212
- `, u) + 1), s = n.slice(D, u).match(/^\s*/)[0], a = he(s, e.tabWidth), c = await pu(i, { ...e, rangeStart: 0, rangeEnd: Number.POSITIVE_INFINITY, cursorOffset: e.cursorOffset > u && e.cursorOffset <= o ? e.cursorOffset - u : -1, endOfLine: "lf" }, a), p = c.formatted.trimEnd(), { cursorOffset: l } = e;
2213
- l > o ? l += p.length - i.length : c.cursorOffset >= 0 && (l = c.cursorOffset + u);
2214
- let m = n.slice(0, u) + p + n.slice(o);
2215
- if (e.endOfLine !== "lf") {
2216
- let f = we(e.endOfLine);
2217
- l >= 0 && f === `\r
2218
- ` && (l += Tt(m.slice(0, l), `
2219
- `)), m = ne(0, m, `
2220
- `, f);
2221
- }
2222
- return { formatted: m, cursorOffset: l, comments: c.comments };
2223
- }
2224
- function sr(t, e, r) {
2225
- return typeof e != "number" || Number.isNaN(e) || e < 0 || e > t.length ? r : e;
2226
- }
2227
- function cu(t, e) {
2228
- let { cursorOffset: r, rangeStart: n, rangeEnd: u } = e;
2229
- return r = sr(t, r, -1), n = sr(t, n, 0), u = sr(t, u, t.length), { ...e, cursorOffset: r, rangeStart: n, rangeEnd: u };
2230
- }
2231
- function mu(t, e) {
2232
- let { cursorOffset: r, rangeStart: n, rangeEnd: u, endOfLine: o } = cu(t, e), i = t.charAt(0) === lu;
2233
- if (i && (t = t.slice(1), r--, n--, u--), o === "auto" && (o = Cr(t)), t.includes("\r")) {
2234
- let D = (s) => Tt(t.slice(0, Math.max(s, 0)), `\r
2235
- `);
2236
- r -= D(r), n -= D(n), u -= D(u), t = hr(t);
2237
- }
2238
- return { hasBOM: i, text: t, options: cu(t, { ...e, cursorOffset: r, rangeStart: n, rangeEnd: u, endOfLine: o }) };
2239
- }
2240
- async function fu(t, e) {
2241
- let r = await Ue(e);
2242
- return !r.hasPragma || r.hasPragma(t);
2243
- }
2244
- async function hi(t, e) {
2245
- var _a2, _b2;
2246
- return (_b2 = (_a2 = await Ue(e)).hasIgnorePragma) == null ? void 0 : _b2.call(_a2, t);
2247
- }
2248
- async function Dr(t, e) {
2249
- let { hasBOM: r, text: n, options: u } = mu(t, await se(e));
2250
- if (u.rangeStart >= u.rangeEnd && n !== "" || u.requirePragma && !await fu(n, u) || u.checkIgnorePragma && await hi(n, u)) return { formatted: t, cursorOffset: e.cursorOffset, comments: [] };
2251
- let o;
2252
- return u.rangeStart > 0 || u.rangeEnd < n.length ? o = await Ci(n, u) : (!u.requirePragma && u.insertPragma && u.printer.insertPragma && !await fu(n, u) && (n = u.printer.insertPragma(n)), o = await pu(n, u)), r && (o.formatted = lu + o.formatted, o.cursorOffset >= 0 && o.cursorOffset++), o;
2253
- }
2254
- async function du(t, e, r) {
2255
- let { text: n, options: u } = mu(t, await se(e)), o = await me(n, u);
2256
- return r && (r.preprocessForPrint && (o.ast = await ur(o.ast, u)), r.massage && (o.ast = nu(o.ast, u))), o;
2257
- }
2258
- async function Fu(t, e) {
2259
- e = await se(e);
2260
- let r = await Ve(t, e);
2261
- return Ce(r, e);
2262
- }
2263
- async function Eu(t, e) {
2264
- let r = Ur(t), { formatted: n } = await Dr(r, { ...e, parser: "__js_expression" });
2265
- return n;
2266
- }
2267
- async function Cu(t, e) {
2268
- e = await se(e);
2269
- let { ast: r } = await me(t, e);
2270
- return e.cursorOffset >= 0 && (e = { ...e, ...or(r, e) }), Ve(r, e);
2271
- }
2272
- async function hu(t, e) {
2273
- return Ce(t, await se(e));
2274
- }
2275
- var ar = {};
2276
- yt(ar, { builders: () => _i, printer: () => yi, utils: () => Ai });
2277
- var _i = { join: be, line: Ze, softline: Mr, hardline: W, literalline: Je, group: wt, conditionalGroup: Ir, fill: kr, lineSuffix: Ie, lineSuffixBoundary: Yr, cursor: ee, breakParent: ae, ifBreak: Rr, trim: jr, indent: oe, indentIfBreak: vr, align: De, addAlignmentToDoc: Qe, markAsRoot: Xe, dedentToRoot: Sr, dedent: br, hardlineWithoutBreakParent: ke, literallineWithoutBreakParent: Ot, label: Lr, concat: (t) => t }, yi = { printDocToString: Ce }, Ai = { willBreak: xr, traverseDoc: Oe, findInDoc: Ke, mapDoc: Se, removeLines: Tr, stripTrailingHardline: He, replaceEndOfLine: Nr, canBreak: wr };
2278
- var gu = "3.9.6";
2279
- var fr = {};
2280
- yt(fr, { addDanglingComment: () => re, addLeadingComment: () => ce, addTrailingComment: () => fe, getAlignmentSize: () => he, getIndentSize: () => _u, getMaxContinuousCount: () => yu, getNextNonSpaceNonCommentCharacter: () => Au, getNextNonSpaceNonCommentCharacterIndex: () => vi, getPreferredQuote: () => Tu, getStringWidth: () => Re, hasNewline: () => H, hasNewlineInRange: () => Nu, hasSpaces: () => wu, isNextLineEmpty: () => Ui, isNextLineEmptyAfterIndex: () => gt, isPreviousLineEmpty: () => Mi, makeString: () => ji, skip: () => _e, skipEverythingButNewLine: () => ut, skipInlineComment: () => Be, skipNewline: () => $, skipSpaces: () => j, skipToLineEnd: () => nt, skipTrailingComment: () => Te, skipWhitespace: () => tn });
2281
- function xi(t, e) {
2282
- if (e === false) return false;
2283
- if (t.charAt(e) === "/" && t.charAt(e + 1) === "*") {
2284
- for (let r = e + 2; r < t.length; ++r) if (t.charAt(r) === "*" && t.charAt(r + 1) === "/") return r + 2;
2285
- }
2286
- return e;
2287
- }
2288
- var Be = xi;
2289
- function Bi(t, e) {
2290
- return e === false ? false : t.charAt(e) === "/" && t.charAt(e + 1) === "/" ? ut(t, e) : e;
2291
- }
2292
- var Te = Bi;
2293
- function Ti(t, e) {
2294
- let r = null, n = e;
2295
- for (; n !== r; ) r = n, n = j(t, n), n = Be(t, n), n = Te(t, n), n = $(t, n);
2296
- return n;
2297
- }
2298
- var We = Ti;
2299
- function Ni(t, e) {
2300
- let r = null, n = e;
2301
- for (; n !== r; ) r = n, n = nt(t, n), n = Be(t, n), n = j(t, n);
2302
- return n = Te(t, n), n = $(t, n), n !== false && H(t, n);
2303
- }
2304
- var gt = Ni;
2305
- function wi(t, e) {
2306
- let r = t.lastIndexOf(`
2307
- `);
2308
- return r === -1 ? 0 : he(t.slice(r + 1).match(/^[\t ]*/)[0], e);
2309
- }
2310
- var _u = wi;
2311
- function cr(t) {
2312
- if (typeof t != "string") throw new TypeError("Expected a string");
2313
- return t.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
2314
- }
2315
- function Oi(t, e) {
2316
- let r = t.matchAll(new RegExp(`(?:${cr(e)})+`, "g"));
2317
- return r.reduce || (r = [...r]), r.reduce((n, [u]) => Math.max(n, u.length), 0) / e.length;
2318
- }
2319
- var yu = Oi;
2320
- function Pi(t, e) {
2321
- let r = We(t, e);
2322
- return r === false ? "" : t.charAt(r);
2323
- }
2324
- var Au = Pi;
2325
- var xu = Object.freeze({ character: "'", codePoint: 39 }), Bu = Object.freeze({ character: '"', codePoint: 34 }), Si = Object.freeze({ preferred: xu, alternate: Bu }), bi = Object.freeze({ preferred: Bu, alternate: xu });
2326
- function Tu(t, e) {
2327
- let { preferred: r, alternate: n } = e === true || e === "'" ? Si : bi, { length: u } = t, o = 0, i = 0;
2328
- for (let D = 0; D < u; D++) {
2329
- let s = t.charCodeAt(D);
2330
- s === r.codePoint ? o++ : s === n.codePoint && i++;
2331
- }
2332
- return (o > i ? n : r).character;
2333
- }
2334
- function ki(t, e, r) {
2335
- for (let n = e; n < r; ++n) if (t.charAt(n) === `
2336
- `) return true;
2337
- return false;
2338
- }
2339
- var Nu = ki;
2340
- function Ii(t, e, r = {}) {
2341
- return j(t, r.backwards ? e - 1 : e, r) !== e;
2342
- }
2343
- var wu = Ii;
2344
- function Ri(t, e, r) {
2345
- return We(t, r(e));
2346
- }
2347
- function vi(t, e) {
2348
- return arguments.length === 2 || typeof e == "number" ? We(t, e) : Ri(...arguments);
2349
- }
2350
- function Li(t, e, r) {
2351
- return ve(t, r(e));
2352
- }
2353
- function Mi(t, e) {
2354
- return arguments.length === 2 || typeof e == "number" ? ve(t, e) : Li(...arguments);
2355
- }
2356
- function Yi(t, e, r) {
2357
- return gt(t, r(e));
2358
- }
2359
- function ji(t, e, r) {
2360
- let n = e === '"' ? "'" : '"', o = ne(0, t, /\\(.)|(["'])/gs, (i, D, s) => D === n ? D : s === e ? "\\" + s : s || (r && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(D) ? D : "\\" + D));
2361
- return e + o + e;
2362
- }
2363
- function Ui(t, e) {
2364
- return arguments.length === 2 || typeof e == "number" ? gt(t, e) : Yi(...arguments);
2365
- }
2366
- function de(t, e = 1) {
2367
- return async (...r) => {
2368
- let n = r[e] ?? {}, u = n.plugins ?? [];
2369
- return r[e] = { ...n, plugins: Array.isArray(u) ? u : Object.values(u) }, await t(...r);
2370
- };
2371
- }
2372
- var Ou = de(Dr);
2373
- async function Pu(t, e) {
2374
- let { formatted: r } = await Ou(t, { ...e, cursorOffset: -1 });
2375
- return r;
2376
- }
2377
- async function Vi(t, e) {
2378
- return await Pu(t, e) === t;
2379
- }
2380
- var Wi = de(it, 0), $i = { parse: de(du), formatAST: de(Fu), formatDoc: de(Eu), printToDoc: de(Cu), printDocToString: de(hu) };
2381
- export {
2382
- $i as __debug,
2383
- Vi as check,
2384
- Su as default,
2385
- ar as doc,
2386
- Pu as format,
2387
- Ou as formatWithCursor,
2388
- Wi as getSupportInfo,
2389
- fr as util,
2390
- gu as version
2391
- };